Commit Graph

111 Commits

Author SHA1 Message Date
Yuriy Taraday
7442c709b1 Extract processIncomingStream func to make requestStream cleaner 2018-05-06 00:56:21 +04:00
Yuriy Taraday
f6ceaff755 Add comments to B, KiB and MiB units 2018-05-05 23:11:29 +04:00
Yuriy Taraday
8d6ee20a7c Fix error return when stream send failed 2018-05-05 22:34:13 +04:00
Yuriy Taraday
b27200c99b Better explain what 1<<22-24 means for packet length 2018-05-05 22:27:31 +04:00
Yuriy Taraday
8965adaafb Expand some comments by Geoff's request 2018-03-02 00:26:38 +04:00
Yuriy Taraday
35cd6327cf Don't drain callback channel, just close it and recover
Reverts 07dbf86, adds recovering from writing on eventually closed
channel in callback().
2018-03-01 21:27:02 +04:00
Yuriy Taraday
16e61b53a7 Remove unused parts of ProcMeta
Also replace if-else if chain with switch and fix error strings.
2018-03-01 20:22:28 +04:00
Yuriy Taraday
f960aceaee Factor out sendStream method from requestStream 2018-03-01 20:22:28 +04:00
Yuriy Taraday
980f867cc2 Add myself to AUTHORS file 2018-03-01 10:58:10 +04:00
Yuriy Taraday
81923720d1 Fix golint errors 2018-03-01 10:57:28 +04:00
Yuriy Taraday
02e0818aef Add streams to proc arguments, use requestStream
This makes functions look just like in actual libvirt API, except
virStreamPtr is replaced with io.Reader for outgoing streams and
io.Writer for incoming streams.
2018-03-01 10:12:56 +04:00
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