Commit Graph

97 Commits

Author SHA1 Message Date
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
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
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
Geoff Hickey
85dc33f30e Merge pull request #44 from digitalocean/gh/fix-compiler-warnings
fix a trio of compiler warnings
2017-08-01 17:24:15 -04:00
Geoff Hickey
1df4a7eec4 fix a trio of compiler warnings
Fix three compiler warnings caused by using format strings in calls to
testing.Error() and Fatal(). Switched to Errorf() and Fatalf().
2017-08-01 16:52:12 -04:00
Ben LeMasurier
975d5a18d5 Updates README (#43)
This updates the project README, removing the pre-production warning
and adding a note about the libvirt project's feelings surrounding
direct interaction with the RPC interface.
2017-06-22 10:04:46 -06:00