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.
- 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.
* 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
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.
* 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.
* 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.
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.