Commit Graph

100 Commits

Author SHA1 Message Date
Yuriy Taraday
3613b30fe2 Parse proc annotations and store in Proc struct 2018-03-01 10:06:40 +04:00
Yuriy Taraday
5d8cdfc854 Capture comment before libvirt proc declaration
It contains annotations that we can use to insert streams in proc
arguments.
2018-03-01 10:06:40 +04:00
Yuriy Taraday
81b15d4775 Add input and output streams handling to rpc layer 2018-03-01 10:06:40 +04:00
Yuriy Taraday
bfac3da6dc Treat only StatusError as error, not StatusContinue 2018-03-01 10:06:40 +04:00
Yuriy Taraday
07dbf8603a Drain callback channel when try to deregister it
callback() is blocked on sending into channel otherwise.
2018-03-01 10:06:40 +04:00
Yuriy Taraday
0c23de2f7e Deregister channels in request() method 2018-03-01 10:06:40 +04:00
Yuriy Taraday
f314e95419 Extract sendPacket and getResponse methods from request() 2018-03-01 10:06:40 +04:00
Ben LeMasurier
0978bc3291
Adds DomainUpdateDeviceFlags to translation table (#62)
* Adds DomainUpdateDeviceFlags to translation table

* Updates generated code

libvirt-4.0.0

* fixes merge conflict
2018-02-28 15:00:59 -07:00
Geoff Hickey
a7be1ba7c0
Merge pull request #60 from YorikSar/refactor_encode
Return []byte from encode, use it instead of bytes.Buffer
2018-02-27 17:37:25 -05:00
Geoff Hickey
55e91f8332
Merge pull request #61 from digitalocean/geoff/remove-c-for-go-workaround
Geoff/remove c for go workaround
2018-02-26 13:11:08 -05:00
Yuriy Taraday
38a1eeb6c3 Return []byte from encode, use it instead of bytes.Buffer
We only use Buffer for its internal buffer returned by Bytes() outside
encode() anyway, so there's no reason to hold on to whole Buffer object.
2018-02-24 12:08:15 +04:00
Geoff Hickey
595827cea1 Go version needs to be a string, not a number. 2018-02-23 18:21:08 -05:00
Geoff Hickey
08274ece93 Bump go version to 1.10 for travis. 2018-02-23 18:09:47 -05:00
Geoff Hickey
2f6e11ea09 Remove the c-for-go workaround I added earlier - fixed upstream. 2018-02-23 18:03:58 -05:00
Geoff Hickey
101d836616
Merge pull request #58 from YorikSar/refactor_request
Move fetching response from channel to request() method
2018-02-23 14:51:59 -05:00
Yuriy Taraday
47db3dbbbc Move fetching response from channel to request() method
Also parse error on bad status in request method.
This pattern was scattered all over the place.
2018-02-23 10:36:58 +04:00
Geoff Hickey
338b59a53a
Geoff/c for go flags (#59)
* regenerate using libvirt 4.0.0 release.
* use a particular version of c-for-go because the current HEAD is broken.
2018-02-14 13:49:14 -05:00
Geoff Hickey
59d541f193
Generate the remaining consts. (#55)
* Generate the remaining consts.

There were a number of hand-written consts in go-libvirt, including flag
values for various libvirt functions. Remove these and generate them
instead, so that we now have a complete set, and the naming is
consistent. I used c-for-go to do this generation, but turned off any
cgo usage by the generated code - we don't want or need to introduce a
dependency on cgo just to get constants from C headers. All code is
still generated using 'go generate ./...', which now calls a wrapper
script for added robustness.

This change also returns to using Go types for flags for most libvirt
functions, instead of plain integers.
2018-01-03 15:19:28 -05:00
Ben LeMasurier
1a220100bd
adds missing mutex around callback map (#54)
We were missing a mutex when retrieving the caller in callback().
Triggered a test failure here: https://travis-ci.org/digitalocean/go-libvirt/jobs/317051310
2017-12-15 12:56:47 -07:00
JenniGriesmann
fa865cdb8e
Merge pull request #53 from digitalocean/jenni/add_scheduler_constants
add domain scheduler parameter constants
2017-12-15 12:13:32 -06:00
Jenni Griesmann
73af7b867b improve comment for scheduler parameters 2017-12-15 11:52:28 -06:00
Jenni Griesmann
2e5b7c8dce add domain scheduler parameter constants 2017-12-15 07:55:41 -06:00
Ben LeMasurier
165035e03c
prevent connection write collisions (#52)
* prevent connection write collisions

When multiple calls are made on the same connection, it's possible for
the writes to collide with each other. This adds a write mutex when
communicating with the libvirt daemon.
2017-12-07 10:47:52 -07:00
Geoff Hickey
7de663d9cc
Merge pull request #50 from digitalocean/geoff/rename-main-types
Rename the main structure types for clarity
2017-11-20 14:45:14 -05:00
Geoff Hickey
fcd4f72b3c Rename the main structure types for clarity
libvirt follows a convention where structure types used in its API are
named "remote_nonnull_domain", and optional values for those  structures
are called "remote_domain". The generator was translating these into go
names like "NonnullDomain" and "Domain". In go this seems unnatural, and
doesn't match the way the pre-generator version of go-libvirt named
things. So this commit changes the names: "remote_nonnull_domain" will
now be "Domain" in go; "remote_domain" will be "OptDomain". This pattern
is applied to all types.
2017-11-20 13:50:32 -05:00
Geoff Hickey
7c0f66a1e9
Merge pull request #49 from digitalocean/geoff/generate-lv-bindings
Geoff/generate lv bindings
2017-11-17 14:02:45 -05:00
Geoff Hickey
382425aa72 Update the README. 2017-11-16 19:56:41 -05:00
Geoff Hickey
1e71d0e45e Shorten an error path 2017-11-16 19:27:00 -05:00
Geoff Hickey
3c5bd59dc7 Build changes:
- Bump the minimum libvirt version from 1.2.2 to 1.2.12, because
virDomainDefineXMLFlags wasn't introduced until that version.
- Use the correct format for the generated file notice, so that golint
ignores the generated files.
2017-11-16 19:14:34 -05:00
Geoff Hickey
57b9cae05d add licenses and fix the license checking script. 2017-11-16 18:44:11 -05:00
Geoff Hickey
53846d5d14 oops. Fix the goyacc import URI. 2017-11-16 17:53:31 -05:00
Geoff Hickey
e6dc7bd464 travis: move goyacc install to before-install section 2017-11-16 17:41:26 -05:00
Geoff Hickey
94eb6fad03 travis build changes
- Update go version to 1.9.
- add go generate step.
2017-11-16 17:29:58 -05:00
Geoff Hickey
c73820057a fix an integration test failure. 2017-11-16 17:28:40 -05:00
Geoff Hickey
45342c3080 fix another integration test problem. 2017-11-16 17:16:10 -05:00
Geoff Hickey
71f606ddd7 Add comments to generated code, fix integration test. 2017-11-16 17:14:05 -05:00
Geoff Hickey
4ec9ce0aea git add parser output files in lvgen 2017-11-16 15:56:36 -05:00
Geoff Hickey
f0eaf10a26 Review comments 2017-11-16 15:49:40 -05:00
Geoff Hickey
96763e5316 Rename "String" type to "OptString" 2017-11-16 14:36:31 -05:00
Geoff Hickey
b59e9d42f4 Migrate all libvirt calls to the generated code.
- Update libvirt.go so that all libvirt calls now go through the
generated routines.
- Remove some libvirt routines that had the same name as generated ones,
leave the rest as convenience routines.
- Fix the handling of Optional-values (the declarations of which in the
.x file look like pointers)
2017-11-16 14:17:46 -05:00
Geoff Hickey
a3bd42a5b1 Cleanup, and fix decoding of TypedParams. 2017-11-14 18:59:55 -05:00
Geoff Hickey
deb7a54ff8 Generate libvirt procedure wrappers.
The generated wrappers have an argument for every field in their "Args"
struct, and return everything in their "Ret" struct (these structs are
defined in the protocol file, and identified by procedure name).
Marshaling and unmarshaling is handled inside the generated procedures.
2017-11-13 15:18:18 -05:00
Geoff Hickey
fb16117ff9 Generate libvirt structs, unions, typedefs. 2017-11-07 16:05:12 -05:00
Geoff Hickey
f88cbd7a8e Move the constants.go template to its own file. 2017-11-03 13:58:41 -04:00
Geoff Hickey
6e924657b1 Move the rpcgen lexer to its own file. 2017-11-03 13:37:16 -04:00
Geoff Hickey
5a6654f07a Generate libvirt constants from libvirt sources.
- Add a yacc-based parser and a hand-written lexer to read the
remote_protocol.x file from libvirt's sources.
- Use the new parser to generate the constants used to communicate with
libvirt.
2017-11-02 19:42:44 -04:00
Katrina Ellison Geltman
8b2644f7ff Merge pull request #47 from digitalocean/domainstate-const
Explicitly specify type of DomainState constants
2017-10-23 18:14:56 -04:00
Katrina Ellison Geltman
85330a67c6 Explicitly specify type of DomainState constants 2017-10-23 17:23:17 -04:00
Geoff Hickey
a339d0ac95 Handle TypedParamStrings (#46)
* Handle TypedParamStrings

Add handling for TypedParamStrings, which are different from the other
TypedParam... types in that the decoded value is variable-sized.
2017-09-15 10:48:46 -04:00
Geoff Hickey
c8e4b6a7b8 Add Get/SetBlockIoTune to go-libvirt API. (#45)
* Add Get/SetBlockIoTune to go-libvirt API.

This adds two libvirt entry points to the go-libvirt API:
virDomainSetBlockIoTune and virDomainGetBlockIoTune. These can be used
to control block device throttling for a VM.
2017-08-31 11:21:31 -04:00