Commit Graph

124 Commits

Author SHA1 Message Date
Len Weincier
290a4e90c0 Update README.md (#72)
A small fix to the example
2018-08-29 14:21:39 -06:00
Geoff Hickey
6b70563d38
Merge pull request #70 from digitalocean/geoff/no-dereg-on-eof
don't deregisterAll callbacks when one gets an EOF.
2018-06-28 19:09:27 -04:00
Geoff Hickey
537933a1e2 don't deregisterAll callbacks when one gets an EOF.
The deregisterAll routine is still called when the connection is
explicitly shut down by calling Disconnect.
2018-06-28 18:00:02 -04:00
Geoff Hickey
2b098b4625
Geoff/dereg callbacks on disconnect (#69)
Deregister all callbacks when disconnecting from libvirt.

Deregister all callbacks when we lose or close the connection to libvirt. This fixes a problem where goroutines with outstanding requests waiting for replies would block forever if the libvirt connection dies, whether because disconnect is called, or the libvirt daemon crashes or restarts.
2018-06-27 18:38:11 -04:00
Geoff Hickey
17c24de803
Merge pull request #63 from YorikSar/streams
Add streams support to libvirt RPC API
2018-05-08 18:10:14 -04:00
Yuriy Taraday
714fd9efff Add test for volume upload and download 2018-05-06 00:57:24 +04:00
Yuriy Taraday
9adcb04498 Fix volume download 2018-05-06 00:56:50 +04:00
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
Geoff Hickey
201d94aa6a
Merge pull request #66 from liaoishere/feat/export-libvirt-error
Add helper function for error detection
2018-03-23 18:03:13 -04:00
Penghui Liao
2d4c9f9f6d
make libvirt error types private
also change ErrIsNotFound to IsNotFound

Signed-off-by: Penghui Liao <liaoishere@gmail.com>
2018-03-24 03:51:25 +08:00
Penghui Liao
482640a285 Add helper function to indicate the error cause
Signed-off-by: Penghui Liao <liaoishere@gmail.com>
2018-03-23 11:14:29 +08:00
Geoff Hickey
be723e47ed
Merge pull request #67 from digitalocean/deprecate-old-apis
Deprecate the old pre-generation APIs
2018-03-22 18:33:21 -04:00
Geoff Hickey
95c99e45a2 Deprecate the old pre-generation APIs
- Marked all the remaining old APIs from before the code-generator as
deprecated. These will be removed from the go-libvirt library as soon as
we're moved all the DO code over to use the generated APIs.
- Consolidated a couple of APIs whose implementation was split into
multiple files.
- Removed a couple of Migration-related calls we're no longer using.
2018-03-22 18:12:51 -04:00
Yuriy Taraday
8965adaafb Expand some comments by Geoff's request 2018-03-02 00:26:38 +04:00
Yuriy Taraday
6075ea3c39 Use ccache in Travis (#64)
* Use ccache in Travis

This should speed up builds as we are rebuilding the same libvirt
versions and it takes over half of test run time.

* Show ccache stats before and after building libvirt
2018-03-01 13:00:12 -07: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