aboutsummaryrefslogtreecommitdiffstats
path: root/src/dma/vendor/github.com/libvirt
diff options
context:
space:
mode:
Diffstat (limited to 'src/dma/vendor/github.com/libvirt')
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/.gitignore7
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/.gitpublish4
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/.travis.yml42
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/FAQ.md19
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/LICENSE21
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/README.md136
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/callbacks.go102
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/callbacks_wrapper.go39
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/callbacks_wrapper.h32
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/connect.go2998
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/connect_compat.h200
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/connect_wrapper.go1766
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/connect_wrapper.h730
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/doc.go141
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/domain.go4766
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/domain_compat.h914
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/domain_events.go1633
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/domain_events_wrapper.go259
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/domain_events_wrapper.h207
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot.go240
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot_wrapper.go215
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot_wrapper.h102
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/domain_wrapper.go2330
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/domain_wrapper.h986
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/error.go604
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/error_compat.h166
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/events.go258
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/events_wrapper.go193
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/events_wrapper.h82
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/interface.go145
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/interface_wrapper.go158
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/interface_wrapper.h76
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/libvirtd.conf6
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/libvirtd.sasl2
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/lxc.go155
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/lxc_wrapper.go101
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/lxc_wrapper.h63
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/network.go335
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/network_compat.h86
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/network_events.go125
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/network_events_wrapper.go79
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/network_events_wrapper.h55
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/network_wrapper.go267
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/network_wrapper.h119
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/node_device.go192
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/node_device_compat.h55
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events.go156
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events_wrapper.go88
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events_wrapper.h60
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/node_device_wrapper.go184
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/node_device_wrapper.h88
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter.go118
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding.go125
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_compat.h33
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_wrapper.go132
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_wrapper.h60
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_wrapper.go122
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_wrapper.h65
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/qemu.go189
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/qemu_compat.h57
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/qemu_wrapper.go133
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/qemu_wrapper.h78
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/secret.go184
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/secret_compat.h61
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/secret_events.go159
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/secret_events_wrapper.go88
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/secret_events_wrapper.h58
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/secret_wrapper.go175
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/secret_wrapper.h86
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool.go394
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_compat.h92
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events.go174
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events_wrapper.go89
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events_wrapper.h59
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_wrapper.go343
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_wrapper.h150
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume.go290
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_compat.h78
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_wrapper.go249
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_wrapper.h116
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/stream.go418
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/stream_compat.h36
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/stream_wrapper.go331
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/stream_wrapper.h120
-rw-r--r--src/dma/vendor/github.com/libvirt/libvirt-go/typedparams.go262
85 files changed, 26911 insertions, 0 deletions
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/.gitignore b/src/dma/vendor/github.com/libvirt/libvirt-go/.gitignore
new file mode 100644
index 00000000..3624e1cf
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/.gitignore
@@ -0,0 +1,7 @@
+*.sublime-workspace
+*.sublime-project
+.vagrant
+/libvirt-go.test
+*~
+.#*
+\#*
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/.gitpublish b/src/dma/vendor/github.com/libvirt/libvirt-go/.gitpublish
new file mode 100644
index 00000000..567c1398
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/.gitpublish
@@ -0,0 +1,4 @@
+[gitpublishprofile "default"]
+base = master
+to = libvir-list@redhat.com
+prefix = go PATCH
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/.travis.yml b/src/dma/vendor/github.com/libvirt/libvirt-go/.travis.yml
new file mode 100644
index 00000000..1bdb48f9
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/.travis.yml
@@ -0,0 +1,42 @@
+language: go
+os: linux
+dist: trusty
+sudo: require
+
+go:
+ - 1.5
+ - 1.6
+ - 1.7
+ - 1.8
+ - 1.9
+
+env:
+ - LIBVIRT=1.2.0 EXT=gz
+ - LIBVIRT=1.2.10 EXT=gz
+ - LIBVIRT=1.2.20 EXT=gz
+ - LIBVIRT=2.5.0 EXT=xz
+ - LIBVIRT=3.6.0 EXT=xz
+
+install:
+ - sudo apt-get -qqy build-dep libvirt
+ - sudo apt-get -qqy install curl qemu-system-x86 sasl2-bin
+ - sudo mkdir -p /usr/src && sudo chown $(id -u) /usr/src
+ - curl -O -s https://libvirt.org/sources/libvirt-${LIBVIRT}.tar.${EXT}
+ - tar -C /usr/src -xf libvirt-${LIBVIRT}.tar.${EXT}
+ - pushd /usr/src/libvirt-${LIBVIRT}
+ - |
+ ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc \
+ --without-polkit \
+ --without-esx --without-vbox --without-xen --without-libxl \
+ --with-qemu --with-lxc
+ - make
+ - sudo make install
+ - popd
+ - sudo cp libvirtd.sasl /etc/sasl2/libvirt.conf
+ - sudo libvirtd -d -l -f libvirtd.conf
+ - sudo virtlogd -d || true
+ - sudo chmod a+rwx /var/run/libvirt/libvirt-sock*
+ - echo "pass" | sudo saslpasswd2 -p -a libvirt user
+
+script:
+ go test -timeout 1m -tags "integration" -v
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/FAQ.md b/src/dma/vendor/github.com/libvirt/libvirt-go/FAQ.md
new file mode 100644
index 00000000..0e731817
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/FAQ.md
@@ -0,0 +1,19 @@
+#libvirt-go
+
+##FAQ - Frequently asked questions
+
+If your question is a good one, please ask it as a well-formatted patch to this
+repository, and we'll merge it along with the answer.
+
+###Why does this fail when added to my project in travis?
+
+This lib requires a newish version of the libvirt-dev library to compile. These
+are only available in the newer travis environment. You can add:
+
+```
+sudo: true
+dist: trusty
+install: sudo apt-get install -y libvirt-dev
+```
+
+to your `.travis.yaml` file to avoid these errors.
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/LICENSE b/src/dma/vendor/github.com/libvirt/libvirt-go/LICENSE
new file mode 100644
index 00000000..202f5fce
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2013 Alex Zorin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE. \ No newline at end of file
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/README.md b/src/dma/vendor/github.com/libvirt/libvirt-go/README.md
new file mode 100644
index 00000000..326d6a06
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/README.md
@@ -0,0 +1,136 @@
+# libvirt-go [![Build Status](https://travis-ci.org/libvirt/libvirt-go.svg?branch=master)](https://travis-ci.org/libvirt/libvirt-go) [![GoDoc](https://godoc.org/github.com/libvirt/libvirt-go?status.svg)](https://godoc.org/github.com/libvirt/libvirt-go)
+
+Go bindings for libvirt.
+
+Make sure to have `libvirt-dev` package (or the development files otherwise somewhere in your include path)
+
+## Version Support
+
+The libvirt go package provides API coverage for libvirt versions
+from 1.2.0 onwards, through conditional compilation of newer APIs.
+
+By default the binding will support APIs in libvirt.so, libvirt-qemu.so
+and libvirt-lxc.so. Coverage for the latter two libraries can be dropped
+from the build using build tags 'without_qemu' or 'without_lxc'
+respectively.
+
+## Development status
+
+The Go API is considered to be production ready and aims to be kept
+stable across future versions. Note, however, that the following
+changes may apply to future versions:
+
+* Existing structs can be augmented with new fields, but no existing
+ fields will be changed / removed. New fields are needed when libvirt
+ defines new typed parameters for various methods
+
+* Any method with an 'flags uint32' parameter will have its parameter
+ type changed to a specific typedef, if & when the libvirt API defines
+ constants for the flags. To avoid breakage, always pass a literal
+ '0' to any 'flags uint32' parameter, since this will auto-cast to
+ any future typedef that is introduced.
+
+## Documentation
+
+* [api documentation for the bindings](https://godoc.org/github.com/libvirt/libvirt-go)
+* [api documentation for libvirt](http://libvirt.org/html/libvirt-libvirt.html)
+
+## Contributing
+
+The libvirt project aims to add support for new APIs to libvirt-go
+as soon as they are added to the main libvirt C library. If you
+are submitting changes to the libvirt C library API, please submit
+a libvirt-go change at the same time.
+
+Bug fixes and other improvements to the libvirt-go library are
+welcome at any time. The preferred submission method is to use
+git send-email to submit patches to the libvir-list@redhat.com
+mailing list. eg. to send a single patch
+
+ git send-email --to libvir-list@redhat.com --subject-prefix "PATCH go" \
+ --smtp-server=$HOSTNAME -1
+
+Or to send all patches on the current branch, against master
+
+ git send-email --to libvir-list@redhat.com --subject-prefix "PATCH go" \
+ --smtp-server=$HOSTNAME --no-chain-reply-to --cover-letter --annotate \
+ master..
+
+Note the master GIT repository is at
+
+* http://libvirt.org/git/?p=libvirt-go.git;a=summary
+
+The following automatic read-only mirrors are available as a
+convenience to allow contributors to "fork" the repository:
+
+* https://gitlab.com/libvirt/libvirt-go
+* https://github.com/libvirt/libvirt-go
+
+While you can send pull-requests to these mirrors, they will be
+re-submitted via emai to the mailing list for review before
+being merged, unless they are trivial/obvious bug fixes.
+
+## Testing
+
+The core API unit tests are all written to use the built-in
+test driver (test:///default), so they have no interaction
+with the host OS environment.
+
+Coverage of libvirt C library APIs / constants is verified
+using automated tests. These can be run by passing the 'api'
+build tag. eg go test -tags api
+
+For areas where the test driver lacks functionality, it is
+possible to use the QEMU or LXC drivers to exercise code.
+Such tests must be part of the 'integration_test.go' file
+though, which is only run when passing the 'integration'
+build tag. eg go test -tags integration
+
+In order to run the unit tests, libvirtd should be configured
+to allow your user account read-write access with no passwords.
+This can be easily done using polkit config files
+
+```
+# cat > /etc/polkit-1/localauthority/50-local.d/50-libvirt.pkla <<EOF
+[Passwordless libvirt access]
+Identity=unix-group:berrange
+Action=org.libvirt.unix.manage
+ResultAny=yes
+ResultInactive=yes
+ResultActive=yes
+EOF
+```
+
+(Replace 'berrange' with your UNIX user name).
+
+One of the integration tests also requires that libvirtd is
+listening for TCP connections on localhost, with sasl auth
+This can be setup by editing /etc/libvirt/libvirtd.conf to
+set
+
+```
+ listen_tls=0
+ listen_tcp=1
+ auth_tcp=sasl
+ listen_addr="127.0.0.1"
+```
+
+and then start libvirtd with the --listen flag (this can
+be set in /etc/sysconfig/libvirtd to make it persistent).
+
+Then create a sasl user
+
+```
+ saslpasswd2 -a libvirt user
+```
+
+and enter "pass" as the password.
+
+Alternatively a `Vagrantfile`, requiring use of virtualbox,
+is included to run the integration tests:
+
+* `cd ./vagrant`
+* `vagrant up` to provision the virtual machine
+* `vagrant ssh` to login to the virtual machine
+
+Once inside, `sudo su -` and `go test -tags integration libvirt`.
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/callbacks.go b/src/dma/vendor/github.com/libvirt/libvirt-go/callbacks.go
new file mode 100644
index 00000000..7b2d11ba
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/callbacks.go
@@ -0,0 +1,102 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+// Helpers functions to register a Go callback function to a C
+// function. For a simple example, look at how SetErrorFunc works in
+// error.go.
+//
+// - Create a struct that will contain at least the Go callback to
+// invoke (errorContext).
+//
+// - Create an exported Golang function whose job will be to retrieve
+// the context and execute the callback in it
+// (connErrCallback). Such a function should receive a callback ID
+// and will use it to retrive the context.
+//
+// - Create a CGO function similar to the above function but with the
+// appropriate signature to be registered as a callback in C code
+// (connErrCallbackHelper). Notably, it will have a void* argument
+// that should be cast to long to retrieve the callback ID. It
+// should be just a thin wrapper to transform the opaque argument to
+// a callback ID.
+//
+// - Create a CGO function which will be a wrapper around the C
+// function to register the callback (virConnSetErrorFuncWrapper). Its
+// only role is to transform a callback ID (long) to an opaque (void*)
+// and call the C function.
+//
+// - When setting up a callback (SetErrorFunc), register the struct from first step
+// with registerCallbackId and invoke the CGO function from the
+// previous step with the appropriate ID.
+//
+// - When unregistering the callback, don't forget to call freecallbackId.
+//
+// If you need to associate some additional data with the connection,
+// look at saveConnectionData, getConnectionData and
+// releaseConnectionData.
+
+import "C"
+
+import (
+ "sync"
+)
+
+const firstGoCallbackId int = 100 // help catch some additional errors during test
+var goCallbackLock sync.RWMutex
+var goCallbacks = make(map[int]interface{})
+var nextGoCallbackId int = firstGoCallbackId
+
+//export freeCallbackId
+func freeCallbackId(goCallbackId int) {
+ goCallbackLock.Lock()
+ delete(goCallbacks, goCallbackId)
+ goCallbackLock.Unlock()
+}
+
+func getCallbackId(goCallbackId int) interface{} {
+ goCallbackLock.RLock()
+ ctx := goCallbacks[goCallbackId]
+ goCallbackLock.RUnlock()
+ if ctx == nil {
+ // If this happens there must be a bug in libvirt
+ panic("Callback arrived after freeCallbackId was called")
+ }
+ return ctx
+}
+
+func registerCallbackId(ctx interface{}) int {
+ goCallbackLock.Lock()
+ goCallBackId := nextGoCallbackId
+ nextGoCallbackId++
+ for goCallbacks[nextGoCallbackId] != nil {
+ nextGoCallbackId++
+ }
+ goCallbacks[goCallBackId] = ctx
+ goCallbackLock.Unlock()
+ return goCallBackId
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/callbacks_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/callbacks_wrapper.go
new file mode 100644
index 00000000..9716bb10
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/callbacks_wrapper.go
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include "callbacks_wrapper.h"
+
+extern void freeCallbackId(long);
+void freeGoCallbackHelper(void* goCallbackId) {
+ freeCallbackId((long)goCallbackId);
+}
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/callbacks_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/callbacks_wrapper.h
new file mode 100644
index 00000000..4b91f7a7
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/callbacks_wrapper.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_CALLBACKS_WRAPPER_H__
+#define LIBVIRT_GO_CALLBACKS_WRAPPER_H__
+
+void freeGoCallbackHelper(void* goCallbackId);
+
+#endif /* LIBVIRT_GO_CALLBACKS_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/connect.go b/src/dma/vendor/github.com/libvirt/libvirt-go/connect.go
new file mode 100644
index 00000000..8cc7cc77
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/connect.go
@@ -0,0 +1,2998 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+import (
+ "fmt"
+ "os"
+ "reflect"
+ "sync"
+ "unsafe"
+)
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "connect_wrapper.h"
+*/
+import "C"
+
+func init() {
+ C.virInitialize()
+}
+
+const (
+ VERSION_NUMBER = uint32(C.LIBVIR_VERSION_NUMBER)
+)
+
+type ConnectCloseReason int
+
+const (
+ CONNECT_CLOSE_REASON_ERROR = ConnectCloseReason(C.VIR_CONNECT_CLOSE_REASON_ERROR)
+ CONNECT_CLOSE_REASON_EOF = ConnectCloseReason(C.VIR_CONNECT_CLOSE_REASON_EOF)
+ CONNECT_CLOSE_REASON_KEEPALIVE = ConnectCloseReason(C.VIR_CONNECT_CLOSE_REASON_KEEPALIVE)
+ CONNECT_CLOSE_REASON_CLIENT = ConnectCloseReason(C.VIR_CONNECT_CLOSE_REASON_CLIENT)
+)
+
+type ConnectListAllDomainsFlags int
+
+const (
+ CONNECT_LIST_DOMAINS_ACTIVE = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_ACTIVE)
+ CONNECT_LIST_DOMAINS_INACTIVE = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_INACTIVE)
+ CONNECT_LIST_DOMAINS_PERSISTENT = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_PERSISTENT)
+ CONNECT_LIST_DOMAINS_TRANSIENT = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_TRANSIENT)
+ CONNECT_LIST_DOMAINS_RUNNING = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_RUNNING)
+ CONNECT_LIST_DOMAINS_PAUSED = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_PAUSED)
+ CONNECT_LIST_DOMAINS_SHUTOFF = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_SHUTOFF)
+ CONNECT_LIST_DOMAINS_OTHER = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_OTHER)
+ CONNECT_LIST_DOMAINS_MANAGEDSAVE = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE)
+ CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE)
+ CONNECT_LIST_DOMAINS_AUTOSTART = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_AUTOSTART)
+ CONNECT_LIST_DOMAINS_NO_AUTOSTART = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART)
+ CONNECT_LIST_DOMAINS_HAS_SNAPSHOT = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT)
+ CONNECT_LIST_DOMAINS_NO_SNAPSHOT = ConnectListAllDomainsFlags(C.VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT)
+)
+
+type ConnectListAllNetworksFlags int
+
+const (
+ CONNECT_LIST_NETWORKS_INACTIVE = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_INACTIVE)
+ CONNECT_LIST_NETWORKS_ACTIVE = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_ACTIVE)
+ CONNECT_LIST_NETWORKS_PERSISTENT = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_PERSISTENT)
+ CONNECT_LIST_NETWORKS_TRANSIENT = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_TRANSIENT)
+ CONNECT_LIST_NETWORKS_AUTOSTART = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_AUTOSTART)
+ CONNECT_LIST_NETWORKS_NO_AUTOSTART = ConnectListAllNetworksFlags(C.VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART)
+)
+
+type ConnectListAllStoragePoolsFlags int
+
+const (
+ CONNECT_LIST_STORAGE_POOLS_INACTIVE = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE)
+ CONNECT_LIST_STORAGE_POOLS_ACTIVE = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE)
+ CONNECT_LIST_STORAGE_POOLS_PERSISTENT = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT)
+ CONNECT_LIST_STORAGE_POOLS_TRANSIENT = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT)
+ CONNECT_LIST_STORAGE_POOLS_AUTOSTART = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART)
+ CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART)
+ CONNECT_LIST_STORAGE_POOLS_DIR = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_DIR)
+ CONNECT_LIST_STORAGE_POOLS_FS = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_FS)
+ CONNECT_LIST_STORAGE_POOLS_NETFS = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_NETFS)
+ CONNECT_LIST_STORAGE_POOLS_LOGICAL = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_LOGICAL)
+ CONNECT_LIST_STORAGE_POOLS_DISK = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_DISK)
+ CONNECT_LIST_STORAGE_POOLS_ISCSI = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI)
+ CONNECT_LIST_STORAGE_POOLS_SCSI = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_SCSI)
+ CONNECT_LIST_STORAGE_POOLS_MPATH = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_MPATH)
+ CONNECT_LIST_STORAGE_POOLS_RBD = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_RBD)
+ CONNECT_LIST_STORAGE_POOLS_SHEEPDOG = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG)
+ CONNECT_LIST_STORAGE_POOLS_GLUSTER = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER)
+ CONNECT_LIST_STORAGE_POOLS_ZFS = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_ZFS)
+ CONNECT_LIST_STORAGE_POOLS_VSTORAGE = ConnectListAllStoragePoolsFlags(C.VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE)
+)
+
+type ConnectBaselineCPUFlags int
+
+const (
+ CONNECT_BASELINE_CPU_EXPAND_FEATURES = ConnectBaselineCPUFlags(C.VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES)
+ CONNECT_BASELINE_CPU_MIGRATABLE = ConnectBaselineCPUFlags(C.VIR_CONNECT_BASELINE_CPU_MIGRATABLE)
+)
+
+type ConnectCompareCPUFlags int
+
+const (
+ CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE = ConnectCompareCPUFlags(C.VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE)
+)
+
+type ConnectListAllInterfacesFlags int
+
+const (
+ CONNECT_LIST_INTERFACES_INACTIVE = ConnectListAllInterfacesFlags(C.VIR_CONNECT_LIST_INTERFACES_INACTIVE)
+ CONNECT_LIST_INTERFACES_ACTIVE = ConnectListAllInterfacesFlags(C.VIR_CONNECT_LIST_INTERFACES_ACTIVE)
+)
+
+type ConnectListAllNodeDeviceFlags int
+
+const (
+ CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM)
+ CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV)
+ CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV)
+ CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE)
+ CONNECT_LIST_NODE_DEVICES_CAP_NET = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_NET)
+ CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST)
+ CONNECT_LIST_NODE_DEVICES_CAP_SCSI_TARGET = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_TARGET)
+ CONNECT_LIST_NODE_DEVICES_CAP_SCSI = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI)
+ CONNECT_LIST_NODE_DEVICES_CAP_STORAGE = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE)
+ CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST)
+ CONNECT_LIST_NODE_DEVICES_CAP_VPORTS = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS)
+ CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC)
+ CONNECT_LIST_NODE_DEVICES_CAP_DRM = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM)
+ CONNECT_LIST_NODE_DEVICES_CAP_MDEV = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV)
+ CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES)
+ CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV = ConnectListAllNodeDeviceFlags(C.VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV)
+)
+
+type ConnectListAllSecretsFlags int
+
+const (
+ CONNECT_LIST_SECRETS_EPHEMERAL = ConnectListAllSecretsFlags(C.VIR_CONNECT_LIST_SECRETS_EPHEMERAL)
+ CONNECT_LIST_SECRETS_NO_EPHEMERAL = ConnectListAllSecretsFlags(C.VIR_CONNECT_LIST_SECRETS_NO_EPHEMERAL)
+ CONNECT_LIST_SECRETS_PRIVATE = ConnectListAllSecretsFlags(C.VIR_CONNECT_LIST_SECRETS_PRIVATE)
+ CONNECT_LIST_SECRETS_NO_PRIVATE = ConnectListAllSecretsFlags(C.VIR_CONNECT_LIST_SECRETS_NO_PRIVATE)
+)
+
+type ConnectGetAllDomainStatsFlags int
+
+const (
+ CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE)
+ CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE)
+ CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT)
+ CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT)
+ CONNECT_GET_ALL_DOMAINS_STATS_RUNNING = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING)
+ CONNECT_GET_ALL_DOMAINS_STATS_PAUSED = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED)
+ CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF)
+ CONNECT_GET_ALL_DOMAINS_STATS_OTHER = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER)
+ CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT)
+ CONNECT_GET_ALL_DOMAINS_STATS_BACKING = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING)
+ CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = ConnectGetAllDomainStatsFlags(C.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS)
+)
+
+type ConnectFlags int
+
+const (
+ CONNECT_RO = ConnectFlags(C.VIR_CONNECT_RO)
+ CONNECT_NO_ALIASES = ConnectFlags(C.VIR_CONNECT_NO_ALIASES)
+)
+
+type ConnectDomainEventAgentLifecycleState int
+
+const (
+ CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED = ConnectDomainEventAgentLifecycleState(C.VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED)
+ CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED = ConnectDomainEventAgentLifecycleState(C.VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED)
+)
+
+type ConnectDomainEventAgentLifecycleReason int
+
+const (
+ CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN = ConnectDomainEventAgentLifecycleReason(C.VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN)
+ CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED = ConnectDomainEventAgentLifecycleReason(C.VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED)
+ CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL = ConnectDomainEventAgentLifecycleReason(C.VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL)
+)
+
+type CPUCompareResult int
+
+const (
+ CPU_COMPARE_ERROR = CPUCompareResult(C.VIR_CPU_COMPARE_ERROR)
+ CPU_COMPARE_INCOMPATIBLE = CPUCompareResult(C.VIR_CPU_COMPARE_INCOMPATIBLE)
+ CPU_COMPARE_IDENTICAL = CPUCompareResult(C.VIR_CPU_COMPARE_IDENTICAL)
+ CPU_COMPARE_SUPERSET = CPUCompareResult(C.VIR_CPU_COMPARE_SUPERSET)
+)
+
+type NodeAllocPagesFlags int
+
+const (
+ NODE_ALLOC_PAGES_ADD = NodeAllocPagesFlags(C.VIR_NODE_ALLOC_PAGES_ADD)
+ NODE_ALLOC_PAGES_SET = NodeAllocPagesFlags(C.VIR_NODE_ALLOC_PAGES_SET)
+)
+
+type NodeSuspendTarget int
+
+const (
+ NODE_SUSPEND_TARGET_MEM = NodeSuspendTarget(C.VIR_NODE_SUSPEND_TARGET_MEM)
+ NODE_SUSPEND_TARGET_DISK = NodeSuspendTarget(C.VIR_NODE_SUSPEND_TARGET_DISK)
+ NODE_SUSPEND_TARGET_HYBRID = NodeSuspendTarget(C.VIR_NODE_SUSPEND_TARGET_HYBRID)
+)
+
+type NodeGetCPUStatsAllCPUs int
+
+const (
+ NODE_CPU_STATS_ALL_CPUS = NodeGetCPUStatsAllCPUs(C.VIR_NODE_CPU_STATS_ALL_CPUS)
+)
+
+const (
+ NODE_MEMORY_STATS_ALL_CELLS = int(C.VIR_NODE_MEMORY_STATS_ALL_CELLS)
+)
+
+type ConnectCredentialType int
+
+const (
+ CRED_USERNAME = ConnectCredentialType(C.VIR_CRED_USERNAME)
+ CRED_AUTHNAME = ConnectCredentialType(C.VIR_CRED_AUTHNAME)
+ CRED_LANGUAGE = ConnectCredentialType(C.VIR_CRED_LANGUAGE)
+ CRED_CNONCE = ConnectCredentialType(C.VIR_CRED_CNONCE)
+ CRED_PASSPHRASE = ConnectCredentialType(C.VIR_CRED_PASSPHRASE)
+ CRED_ECHOPROMPT = ConnectCredentialType(C.VIR_CRED_ECHOPROMPT)
+ CRED_NOECHOPROMPT = ConnectCredentialType(C.VIR_CRED_NOECHOPROMPT)
+ CRED_REALM = ConnectCredentialType(C.VIR_CRED_REALM)
+ CRED_EXTERNAL = ConnectCredentialType(C.VIR_CRED_EXTERNAL)
+)
+
+type Connect struct {
+ ptr C.virConnectPtr
+}
+
+type NodeInfo struct {
+ Model string
+ Memory uint64
+ Cpus uint
+ MHz uint
+ Nodes uint32
+ Sockets uint32
+ Cores uint32
+ Threads uint32
+}
+
+// Additional data associated to the connection.
+type virConnectionData struct {
+ errCallbackId *int
+ closeCallbackId *int
+}
+
+var connections map[C.virConnectPtr]*virConnectionData
+var connectionsLock sync.RWMutex
+
+func init() {
+ connections = make(map[C.virConnectPtr]*virConnectionData)
+}
+
+func saveConnectionData(c *Connect, d *virConnectionData) {
+ if c.ptr == nil {
+ return // Or panic?
+ }
+ connectionsLock.Lock()
+ defer connectionsLock.Unlock()
+ connections[c.ptr] = d
+}
+
+func getConnectionData(c *Connect) *virConnectionData {
+ connectionsLock.RLock()
+ d := connections[c.ptr]
+ connectionsLock.RUnlock()
+ if d != nil {
+ return d
+ }
+ d = &virConnectionData{}
+ saveConnectionData(c, d)
+ return d
+}
+
+func releaseConnectionData(c *Connect) {
+ if c.ptr == nil {
+ return
+ }
+ connectionsLock.Lock()
+ defer connectionsLock.Unlock()
+ delete(connections, c.ptr)
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virGetVersion
+func GetVersion() (uint32, error) {
+ var version C.ulong
+ var err C.virError
+ ret := C.virGetVersionWrapper(&version, nil, nil, &err)
+ if ret < 0 {
+ return 0, makeError(&err)
+ }
+ return uint32(version), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectOpen
+func NewConnect(uri string) (*Connect, error) {
+ var cUri *C.char
+ if uri != "" {
+ cUri = C.CString(uri)
+ defer C.free(unsafe.Pointer(cUri))
+ }
+ var err C.virError
+ ptr := C.virConnectOpenWrapper(cUri, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Connect{ptr: ptr}, nil
+}
+
+type ConnectCredential struct {
+ Type ConnectCredentialType
+ Prompt string
+ Challenge string
+ DefResult string
+ Result string
+ ResultLen int
+}
+
+type ConnectAuthCallback func(creds []*ConnectCredential)
+
+type ConnectAuth struct {
+ CredType []ConnectCredentialType
+ Callback ConnectAuthCallback
+}
+
+//export connectAuthCallback
+func connectAuthCallback(ccredlist C.virConnectCredentialPtr, ncred C.uint, callbackID C.int) C.int {
+ cred := make([]*ConnectCredential, int(ncred))
+
+ for i := 0; i < int(ncred); i++ {
+ ccred := (C.virConnectCredentialPtr)(unsafe.Pointer((uintptr)(unsafe.Pointer(ccredlist)) + (unsafe.Sizeof(*ccredlist) * uintptr(i))))
+ cred[i] = &ConnectCredential{
+ Type: ConnectCredentialType(ccred._type),
+ Prompt: C.GoString(ccred.prompt),
+ Challenge: C.GoString(ccred.challenge),
+ DefResult: C.GoString(ccred.defresult),
+ ResultLen: -1,
+ }
+ }
+ callbackEntry := getCallbackId(int(callbackID))
+ callback, ok := callbackEntry.(ConnectAuthCallback)
+ if !ok {
+ panic("Unexpected callback type")
+ }
+
+ callback(cred)
+
+ for i := 0; i < int(ncred); i++ {
+ ccred := (C.virConnectCredentialPtr)(unsafe.Pointer((uintptr)(unsafe.Pointer(ccredlist)) + (unsafe.Sizeof(*ccredlist) * uintptr(i))))
+ if cred[i].ResultLen >= 0 {
+ ccred.result = C.CString(cred[i].Result)
+ ccred.resultlen = C.uint(cred[i].ResultLen)
+ }
+ }
+
+ return 0
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectOpenAuth
+func NewConnectWithAuth(uri string, auth *ConnectAuth, flags ConnectFlags) (*Connect, error) {
+ var cUri *C.char
+
+ ccredtype := make([]C.int, len(auth.CredType))
+
+ for i := 0; i < len(auth.CredType); i++ {
+ ccredtype[i] = C.int(auth.CredType[i])
+ }
+
+ if uri != "" {
+ cUri = C.CString(uri)
+ defer C.free(unsafe.Pointer(cUri))
+ }
+
+ callbackID := registerCallbackId(auth.Callback)
+
+ var err C.virError
+ ptr := C.virConnectOpenAuthWrapper(cUri, &ccredtype[0], C.uint(len(auth.CredType)), C.int(callbackID), C.uint(flags), &err)
+ freeCallbackId(callbackID)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Connect{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectOpenReadOnly
+func NewConnectReadOnly(uri string) (*Connect, error) {
+ var cUri *C.char
+ if uri != "" {
+ cUri = C.CString(uri)
+ defer C.free(unsafe.Pointer(cUri))
+ }
+ var err C.virError
+ ptr := C.virConnectOpenReadOnlyWrapper(cUri, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Connect{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectClose
+func (c *Connect) Close() (int, error) {
+ var err C.virError
+ result := int(C.virConnectCloseWrapper(c.ptr, &err))
+ if result == -1 {
+ return result, makeError(&err)
+ }
+ if result == 0 {
+ // No more reference to this connection, release data.
+ releaseConnectionData(c)
+ c.ptr = nil
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectRef
+func (c *Connect) Ref() error {
+ var err C.virError
+ ret := C.virConnectRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+type CloseCallback func(conn *Connect, reason ConnectCloseReason)
+
+// Register a close callback for the given destination. Only one
+// callback per connection is allowed. Setting a callback will remove
+// the previous one.
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectRegisterCloseCallback
+func (c *Connect) RegisterCloseCallback(callback CloseCallback) error {
+ c.UnregisterCloseCallback()
+ goCallbackId := registerCallbackId(callback)
+ var err C.virError
+ res := C.virConnectRegisterCloseCallbackWrapper(c.ptr, C.long(goCallbackId), &err)
+ if res != 0 {
+ freeCallbackId(goCallbackId)
+ return makeError(&err)
+ }
+ connData := getConnectionData(c)
+ connData.closeCallbackId = &goCallbackId
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectUnregisterCloseCallback
+func (c *Connect) UnregisterCloseCallback() error {
+ connData := getConnectionData(c)
+ if connData.closeCallbackId == nil {
+ return nil
+ }
+ var err C.virError
+ res := C.virConnectUnregisterCloseCallbackWrapper(c.ptr, &err)
+ if res != 0 {
+ return makeError(&err)
+ }
+ connData.closeCallbackId = nil
+ return nil
+}
+
+//export closeCallback
+func closeCallback(conn C.virConnectPtr, reason ConnectCloseReason, goCallbackId int) {
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(CloseCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(&Connect{ptr: conn}, reason)
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetCapabilities
+func (c *Connect) GetCapabilities() (string, error) {
+ var err C.virError
+ str := C.virConnectGetCapabilitiesWrapper(c.ptr, &err)
+ if str == nil {
+ return "", makeError(&err)
+ }
+ capabilities := C.GoString(str)
+ C.free(unsafe.Pointer(str))
+ return capabilities, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetInfo
+func (c *Connect) GetNodeInfo() (*NodeInfo, error) {
+ var cinfo C.virNodeInfo
+ var err C.virError
+ result := C.virNodeGetInfoWrapper(c.ptr, &cinfo, &err)
+ if result == -1 {
+ return nil, makeError(&err)
+ }
+ return &NodeInfo{
+ Model: C.GoString((*C.char)(unsafe.Pointer(&cinfo.model[0]))),
+ Memory: uint64(cinfo.memory),
+ Cpus: uint(cinfo.cpus),
+ MHz: uint(cinfo.mhz),
+ Nodes: uint32(cinfo.nodes),
+ Sockets: uint32(cinfo.sockets),
+ Cores: uint32(cinfo.cores),
+ Threads: uint32(cinfo.threads),
+ }, nil
+}
+
+func (ni *NodeInfo) GetMaxCPUs() uint32 {
+ return ni.Nodes * ni.Sockets * ni.Cores * ni.Threads
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetHostname
+func (c *Connect) GetHostname() (string, error) {
+ var err C.virError
+ str := C.virConnectGetHostnameWrapper(c.ptr, &err)
+ if str == nil {
+ return "", makeError(&err)
+ }
+ hostname := C.GoString(str)
+ C.free(unsafe.Pointer(str))
+ return hostname, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetLibVersion
+func (c *Connect) GetLibVersion() (uint32, error) {
+ var version C.ulong
+ var err C.virError
+ ret := C.virConnectGetLibVersionWrapper(c.ptr, &version, &err)
+ if ret < 0 {
+ return 0, makeError(&err)
+ }
+ return uint32(version), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetType
+func (c *Connect) GetType() (string, error) {
+ var err C.virError
+ str := C.virConnectGetTypeWrapper(c.ptr, &err)
+ if str == nil {
+ return "", makeError(&err)
+ }
+ hypDriver := C.GoString(str)
+ return hypDriver, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsAlive
+func (c *Connect) IsAlive() (bool, error) {
+ var err C.virError
+ result := C.virConnectIsAliveWrapper(c.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsEncrypted
+func (c *Connect) IsEncrypted() (bool, error) {
+ var err C.virError
+ result := C.virConnectIsEncryptedWrapper(c.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsSecure
+func (c *Connect) IsSecure() (bool, error) {
+ var err C.virError
+ result := C.virConnectIsSecureWrapper(c.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListDefinedDomains
+func (c *Connect) ListDefinedDomains() ([]string, error) {
+ var names [1024](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numDomains := C.virConnectListDefinedDomainsWrapper(
+ c.ptr,
+ (**C.char)(namesPtr),
+ 1024, &err)
+ if numDomains == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numDomains)
+ for k := 0; k < int(numDomains); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListDomains
+func (c *Connect) ListDomains() ([]uint32, error) {
+ var cDomainsIds [512](uint32)
+ cDomainsPointer := unsafe.Pointer(&cDomainsIds)
+ var err C.virError
+ numDomains := C.virConnectListDomainsWrapper(c.ptr, (*C.int)(cDomainsPointer), 512, &err)
+ if numDomains == -1 {
+ return nil, makeError(&err)
+ }
+
+ return cDomainsIds[:numDomains], nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virConnectListInterfaces
+func (c *Connect) ListInterfaces() ([]string, error) {
+ const maxIfaces = 1024
+ var names [maxIfaces](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numIfaces := C.virConnectListInterfacesWrapper(
+ c.ptr,
+ (**C.char)(namesPtr),
+ maxIfaces, &err)
+ if numIfaces == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numIfaces)
+ for k := 0; k < int(numIfaces); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virConnectListNetworks
+func (c *Connect) ListNetworks() ([]string, error) {
+ const maxNets = 1024
+ var names [maxNets](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numNetworks := C.virConnectListNetworksWrapper(
+ c.ptr,
+ (**C.char)(namesPtr),
+ maxNets, &err)
+ if numNetworks == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numNetworks)
+ for k := 0; k < int(numNetworks); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virConnectListNWFilters
+func (c *Connect) ListNWFilters() ([]string, error) {
+ const maxFilters = 1024
+ var names [maxFilters](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numNWFilters := C.virConnectListNWFiltersWrapper(
+ c.ptr,
+ (**C.char)(namesPtr),
+ maxFilters, &err)
+ if numNWFilters == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numNWFilters)
+ for k := 0; k < int(numNWFilters); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectListStoragePools
+func (c *Connect) ListStoragePools() ([]string, error) {
+ const maxPools = 1024
+ var names [maxPools](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numStoragePools := C.virConnectListStoragePoolsWrapper(
+ c.ptr,
+ (**C.char)(namesPtr),
+ maxPools, &err)
+ if numStoragePools == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numStoragePools)
+ for k := 0; k < int(numStoragePools); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virConnectListSecrets
+func (c *Connect) ListSecrets() ([]string, error) {
+ const maxSecrets = 1024
+ var uuids [maxSecrets](*C.char)
+ uuidsPtr := unsafe.Pointer(&uuids)
+ var err C.virError
+ numSecrets := C.virConnectListSecretsWrapper(
+ c.ptr,
+ (**C.char)(uuidsPtr),
+ maxSecrets, &err)
+ if numSecrets == -1 {
+ return nil, makeError(&err)
+ }
+ goUuids := make([]string, numSecrets)
+ for k := 0; k < int(numSecrets); k++ {
+ goUuids[k] = C.GoString(uuids[k])
+ C.free(unsafe.Pointer(uuids[k]))
+ }
+ return goUuids, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeListDevices
+func (c *Connect) ListDevices(cap string, flags uint32) ([]string, error) {
+ ccap := C.CString(cap)
+ defer C.free(unsafe.Pointer(ccap))
+ const maxNodeDevices = 1024
+ var uuids [maxNodeDevices](*C.char)
+ uuidsPtr := unsafe.Pointer(&uuids)
+ var err C.virError
+ numNodeDevices := C.virNodeListDevicesWrapper(
+ c.ptr, ccap,
+ (**C.char)(uuidsPtr),
+ maxNodeDevices, C.uint(flags), &err)
+ if numNodeDevices == -1 {
+ return nil, makeError(&err)
+ }
+ goUuids := make([]string, numNodeDevices)
+ for k := 0; k < int(numNodeDevices); k++ {
+ goUuids[k] = C.GoString(uuids[k])
+ C.free(unsafe.Pointer(uuids[k]))
+ }
+ return goUuids, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainLookupByID
+func (c *Connect) LookupDomainById(id uint32) (*Domain, error) {
+ var err C.virError
+ ptr := C.virDomainLookupByIDWrapper(c.ptr, C.int(id), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Domain{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainLookupByName
+func (c *Connect) LookupDomainByName(id string) (*Domain, error) {
+ cName := C.CString(id)
+ defer C.free(unsafe.Pointer(cName))
+ var err C.virError
+ ptr := C.virDomainLookupByNameWrapper(c.ptr, cName, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Domain{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainLookupByUUIDString
+func (c *Connect) LookupDomainByUUIDString(uuid string) (*Domain, error) {
+ cUuid := C.CString(uuid)
+ defer C.free(unsafe.Pointer(cUuid))
+ var err C.virError
+ ptr := C.virDomainLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Domain{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainLookupByUUID
+func (c *Connect) LookupDomainByUUID(uuid []byte) (*Domain, error) {
+ if len(uuid) != C.VIR_UUID_BUFLEN {
+ return nil, fmt.Errorf("UUID must be exactly %d bytes in size",
+ int(C.VIR_UUID_BUFLEN))
+ }
+ cUuid := make([]C.uchar, C.VIR_UUID_BUFLEN)
+ for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
+ cUuid[i] = C.uchar(uuid[i])
+ }
+ var err C.virError
+ ptr := C.virDomainLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Domain{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateXML
+func (c *Connect) DomainCreateXML(xmlConfig string, flags DomainCreateFlags) (*Domain, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virDomainCreateXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Domain{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateXMLWithFiles
+func (c *Connect) DomainCreateXMLWithFiles(xmlConfig string, files []os.File, flags DomainCreateFlags) (*Domain, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ cfiles := make([]C.int, len(files))
+ for i := 0; i < len(files); i++ {
+ cfiles[i] = C.int(files[i].Fd())
+ }
+ var err C.virError
+ ptr := C.virDomainCreateXMLWithFilesWrapper(c.ptr, cXml, C.uint(len(files)), (&cfiles[0]), C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Domain{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDefineXML
+func (c *Connect) DomainDefineXML(xmlConfig string) (*Domain, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virDomainDefineXMLWrapper(c.ptr, cXml, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Domain{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDefineXMLFlags
+func (c *Connect) DomainDefineXMLFlags(xmlConfig string, flags DomainDefineFlags) (*Domain, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002012 {
+ return nil, makeNotImplementedError("virDomainDefineXMLFlags")
+ }
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virDomainDefineXMLFlagsWrapper(c.ptr, cXml, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Domain{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virConnectListDefinedInterfaces
+func (c *Connect) ListDefinedInterfaces() ([]string, error) {
+ const maxIfaces = 1024
+ var names [maxIfaces](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numIfaces := C.virConnectListDefinedInterfacesWrapper(
+ c.ptr,
+ (**C.char)(namesPtr),
+ maxIfaces, &err)
+ if numIfaces == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numIfaces)
+ for k := 0; k < int(numIfaces); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virConnectListDefinedNetworks
+func (c *Connect) ListDefinedNetworks() ([]string, error) {
+ const maxNets = 1024
+ var names [maxNets](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numNetworks := C.virConnectListDefinedNetworksWrapper(
+ c.ptr,
+ (**C.char)(namesPtr),
+ maxNets, &err)
+ if numNetworks == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numNetworks)
+ for k := 0; k < int(numNetworks); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectListDefinedStoragePools
+func (c *Connect) ListDefinedStoragePools() ([]string, error) {
+ const maxPools = 1024
+ var names [maxPools](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numStoragePools := C.virConnectListDefinedStoragePoolsWrapper(
+ c.ptr,
+ (**C.char)(namesPtr),
+ maxPools, &err)
+ if numStoragePools == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numStoragePools)
+ for k := 0; k < int(numStoragePools); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectNumOfDefinedDomains
+func (c *Connect) NumOfDefinedDomains() (int, error) {
+ var err C.virError
+ result := int(C.virConnectNumOfDefinedDomainsWrapper(c.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virConnectNumOfDefinedInterfaces
+func (c *Connect) NumOfDefinedInterfaces() (int, error) {
+ var err C.virError
+ result := int(C.virConnectNumOfDefinedInterfacesWrapper(c.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virConnectNumOfDefinedNetworks
+func (c *Connect) NumOfDefinedNetworks() (int, error) {
+ var err C.virError
+ result := int(C.virConnectNumOfDefinedNetworksWrapper(c.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectNumOfDefinedStoragePools
+func (c *Connect) NumOfDefinedStoragePools() (int, error) {
+ var err C.virError
+ result := int(C.virConnectNumOfDefinedStoragePoolsWrapper(c.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectNumOfDomains
+func (c *Connect) NumOfDomains() (int, error) {
+ var err C.virError
+ result := int(C.virConnectNumOfDomainsWrapper(c.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectNumOfStoragePools
+func (c *Connect) NumOfStoragePools() (int, error) {
+ var err C.virError
+ result := int(C.virConnectNumOfStoragePoolsWrapper(c.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virConnectNumOfInterfaces
+func (c *Connect) NumOfInterfaces() (int, error) {
+ var err C.virError
+ result := int(C.virConnectNumOfInterfacesWrapper(c.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virConnectNumOfNetworks
+func (c *Connect) NumOfNetworks() (int, error) {
+ var err C.virError
+ result := int(C.virConnectNumOfNetworksWrapper(c.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virConnectNumOfNWFilters
+func (c *Connect) NumOfNWFilters() (int, error) {
+ var err C.virError
+ result := int(C.virConnectNumOfNWFiltersWrapper(c.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virConnectNumOfSecrets
+func (c *Connect) NumOfSecrets() (int, error) {
+ var err C.virError
+ result := int(C.virConnectNumOfSecretsWrapper(c.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeNumOfDevices
+func (c *Connect) NumOfDevices(cap string, flags uint32) (int, error) {
+ ccap := C.CString(cap)
+ defer C.free(unsafe.Pointer(ccap))
+ var err C.virError
+ result := int(C.virNodeNumOfDevicesWrapper(c.ptr, ccap, C.uint(flags), &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkDefineXML
+func (c *Connect) NetworkDefineXML(xmlConfig string) (*Network, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virNetworkDefineXMLWrapper(c.ptr, cXml, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Network{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkCreateXML
+func (c *Connect) NetworkCreateXML(xmlConfig string) (*Network, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virNetworkCreateXMLWrapper(c.ptr, cXml, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Network{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkLookupByName
+func (c *Connect) LookupNetworkByName(name string) (*Network, error) {
+ cName := C.CString(name)
+ defer C.free(unsafe.Pointer(cName))
+ var err C.virError
+ ptr := C.virNetworkLookupByNameWrapper(c.ptr, cName, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Network{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkLookupByUUIDString
+func (c *Connect) LookupNetworkByUUIDString(uuid string) (*Network, error) {
+ cUuid := C.CString(uuid)
+ defer C.free(unsafe.Pointer(cUuid))
+ var err C.virError
+ ptr := C.virNetworkLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Network{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkLookupByUUID
+func (c *Connect) LookupNetworkByUUID(uuid []byte) (*Network, error) {
+ if len(uuid) != C.VIR_UUID_BUFLEN {
+ return nil, fmt.Errorf("UUID must be exactly %d bytes in size",
+ int(C.VIR_UUID_BUFLEN))
+ }
+ cUuid := make([]C.uchar, C.VIR_UUID_BUFLEN)
+ for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
+ cUuid[i] = C.uchar(uuid[i])
+ }
+ var err C.virError
+ ptr := C.virNetworkLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Network{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectSetKeepAlive
+func (c *Connect) SetKeepAlive(interval int, count uint) error {
+ var err C.virError
+ res := int(C.virConnectSetKeepAliveWrapper(c.ptr, C.int(interval), C.uint(count), &err))
+ switch res {
+ case 0:
+ return nil
+ default:
+ return makeError(&err)
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetSysinfo
+func (c *Connect) GetSysinfo(flags uint32) (string, error) {
+ var err C.virError
+ cStr := C.virConnectGetSysinfoWrapper(c.ptr, C.uint(flags), &err)
+ if cStr == nil {
+ return "", makeError(&err)
+ }
+ info := C.GoString(cStr)
+ C.free(unsafe.Pointer(cStr))
+ return info, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetURI
+func (c *Connect) GetURI() (string, error) {
+ var err C.virError
+ cStr := C.virConnectGetURIWrapper(c.ptr, &err)
+ if cStr == nil {
+ return "", makeError(&err)
+ }
+ uri := C.GoString(cStr)
+ C.free(unsafe.Pointer(cStr))
+ return uri, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetMaxVcpus
+func (c *Connect) GetMaxVcpus(typeAttr string) (int, error) {
+ var cTypeAttr *C.char
+ if typeAttr != "" {
+ cTypeAttr = C.CString(typeAttr)
+ defer C.free(unsafe.Pointer(cTypeAttr))
+ }
+ var err C.virError
+ result := int(C.virConnectGetMaxVcpusWrapper(c.ptr, cTypeAttr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceDefineXML
+func (c *Connect) InterfaceDefineXML(xmlConfig string, flags uint32) (*Interface, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virInterfaceDefineXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Interface{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceLookupByName
+func (c *Connect) LookupInterfaceByName(name string) (*Interface, error) {
+ cName := C.CString(name)
+ defer C.free(unsafe.Pointer(cName))
+ var err C.virError
+ ptr := C.virInterfaceLookupByNameWrapper(c.ptr, cName, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Interface{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceLookupByMACString
+func (c *Connect) LookupInterfaceByMACString(mac string) (*Interface, error) {
+ cName := C.CString(mac)
+ defer C.free(unsafe.Pointer(cName))
+ var err C.virError
+ ptr := C.virInterfaceLookupByMACStringWrapper(c.ptr, cName, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Interface{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolDefineXML
+func (c *Connect) StoragePoolDefineXML(xmlConfig string, flags uint32) (*StoragePool, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virStoragePoolDefineXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StoragePool{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolCreateXML
+func (c *Connect) StoragePoolCreateXML(xmlConfig string, flags StoragePoolCreateFlags) (*StoragePool, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virStoragePoolCreateXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StoragePool{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolLookupByName
+func (c *Connect) LookupStoragePoolByName(name string) (*StoragePool, error) {
+ cName := C.CString(name)
+ defer C.free(unsafe.Pointer(cName))
+ var err C.virError
+ ptr := C.virStoragePoolLookupByNameWrapper(c.ptr, cName, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StoragePool{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolLookupByUUIDString
+func (c *Connect) LookupStoragePoolByUUIDString(uuid string) (*StoragePool, error) {
+ cUuid := C.CString(uuid)
+ defer C.free(unsafe.Pointer(cUuid))
+ var err C.virError
+ ptr := C.virStoragePoolLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StoragePool{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolLookupByUUID
+func (c *Connect) LookupStoragePoolByUUID(uuid []byte) (*StoragePool, error) {
+ if len(uuid) != C.VIR_UUID_BUFLEN {
+ return nil, fmt.Errorf("UUID must be exactly %d bytes in size",
+ int(C.VIR_UUID_BUFLEN))
+ }
+ cUuid := make([]C.uchar, C.VIR_UUID_BUFLEN)
+ for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
+ cUuid[i] = C.uchar(uuid[i])
+ }
+ var err C.virError
+ ptr := C.virStoragePoolLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StoragePool{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolLookupByTargetPath
+func (c *Connect) LookupStoragePoolByTargetPath(path string) (*StoragePool, error) {
+ if C.LIBVIR_VERSION_NUMBER < 4001000 {
+ return nil, makeNotImplementedError("virStoragePoolLookupByTargetPath")
+ }
+ cPath := C.CString(path)
+ defer C.free(unsafe.Pointer(cPath))
+ var err C.virError
+ ptr := C.virStoragePoolLookupByTargetPathWrapper(c.ptr, cPath, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StoragePool{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterDefineXML
+func (c *Connect) NWFilterDefineXML(xmlConfig string) (*NWFilter, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virNWFilterDefineXMLWrapper(c.ptr, cXml, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &NWFilter{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterLookupByName
+func (c *Connect) LookupNWFilterByName(name string) (*NWFilter, error) {
+ cName := C.CString(name)
+ defer C.free(unsafe.Pointer(cName))
+ var err C.virError
+ ptr := C.virNWFilterLookupByNameWrapper(c.ptr, cName, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &NWFilter{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterLookupByUUIDString
+func (c *Connect) LookupNWFilterByUUIDString(uuid string) (*NWFilter, error) {
+ cUuid := C.CString(uuid)
+ defer C.free(unsafe.Pointer(cUuid))
+ var err C.virError
+ ptr := C.virNWFilterLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &NWFilter{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterLookupByUUID
+func (c *Connect) LookupNWFilterByUUID(uuid []byte) (*NWFilter, error) {
+ if len(uuid) != C.VIR_UUID_BUFLEN {
+ return nil, fmt.Errorf("UUID must be exactly %d bytes in size",
+ int(C.VIR_UUID_BUFLEN))
+ }
+ cUuid := make([]C.uchar, C.VIR_UUID_BUFLEN)
+ for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
+ cUuid[i] = C.uchar(uuid[i])
+ }
+ var err C.virError
+ ptr := C.virNWFilterLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &NWFilter{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingLookupByPortDev
+func (c *Connect) LookupNWFilterBindingByPortDev(name string) (*NWFilterBinding, error) {
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return nil, makeNotImplementedError("virNWFilterBindingLookupByPortDev")
+ }
+ cName := C.CString(name)
+ defer C.free(unsafe.Pointer(cName))
+ var err C.virError
+ ptr := C.virNWFilterBindingLookupByPortDevWrapper(c.ptr, cName, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &NWFilterBinding{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolLookupByKey
+func (c *Connect) LookupStorageVolByKey(key string) (*StorageVol, error) {
+ cKey := C.CString(key)
+ defer C.free(unsafe.Pointer(cKey))
+ var err C.virError
+ ptr := C.virStorageVolLookupByKeyWrapper(c.ptr, cKey, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StorageVol{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolLookupByPath
+func (c *Connect) LookupStorageVolByPath(path string) (*StorageVol, error) {
+ cPath := C.CString(path)
+ defer C.free(unsafe.Pointer(cPath))
+ var err C.virError
+ ptr := C.virStorageVolLookupByPathWrapper(c.ptr, cPath, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StorageVol{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretDefineXML
+func (c *Connect) SecretDefineXML(xmlConfig string, flags uint32) (*Secret, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virSecretDefineXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Secret{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretLookupByUUID
+func (c *Connect) LookupSecretByUUID(uuid []byte) (*Secret, error) {
+ if len(uuid) != C.VIR_UUID_BUFLEN {
+ return nil, fmt.Errorf("UUID must be exactly %d bytes in size",
+ int(C.VIR_UUID_BUFLEN))
+ }
+ cUuid := make([]C.uchar, C.VIR_UUID_BUFLEN)
+ for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
+ cUuid[i] = C.uchar(uuid[i])
+ }
+ var err C.virError
+ ptr := C.virSecretLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Secret{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretLookupByUUIDString
+func (c *Connect) LookupSecretByUUIDString(uuid string) (*Secret, error) {
+ cUuid := C.CString(uuid)
+ defer C.free(unsafe.Pointer(cUuid))
+ var err C.virError
+ ptr := C.virSecretLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Secret{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretLookupByUsage
+func (c *Connect) LookupSecretByUsage(usageType SecretUsageType, usageID string) (*Secret, error) {
+ cUsageID := C.CString(usageID)
+ defer C.free(unsafe.Pointer(cUsageID))
+ var err C.virError
+ ptr := C.virSecretLookupByUsageWrapper(c.ptr, C.int(usageType), cUsageID, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Secret{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceLookupByName
+func (c *Connect) LookupDeviceByName(id string) (*NodeDevice, error) {
+ cName := C.CString(id)
+ defer C.free(unsafe.Pointer(cName))
+ var err C.virError
+ ptr := C.virNodeDeviceLookupByNameWrapper(c.ptr, cName, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &NodeDevice{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceLookupSCSIHostByWWN
+func (c *Connect) LookupDeviceSCSIHostByWWN(wwnn, wwpn string, flags uint32) (*NodeDevice, error) {
+ cWwnn := C.CString(wwnn)
+ cWwpn := C.CString(wwpn)
+ defer C.free(unsafe.Pointer(cWwnn))
+ defer C.free(unsafe.Pointer(cWwpn))
+ var err C.virError
+ ptr := C.virNodeDeviceLookupSCSIHostByWWNWrapper(c.ptr, cWwnn, cWwpn, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &NodeDevice{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceCreateXML
+func (c *Connect) DeviceCreateXML(xmlConfig string, flags uint32) (*NodeDevice, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virNodeDeviceCreateXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &NodeDevice{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virConnectListAllInterfaces
+func (c *Connect) ListAllInterfaces(flags ConnectListAllInterfacesFlags) ([]Interface, error) {
+ var cList *C.virInterfacePtr
+ var err C.virError
+ numIfaces := C.virConnectListAllInterfacesWrapper(c.ptr, (**C.virInterfacePtr)(&cList), C.uint(flags), &err)
+ if numIfaces == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numIfaces),
+ Cap: int(numIfaces),
+ }
+ var ifaces []Interface
+ slice := *(*[]C.virInterfacePtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ ifaces = append(ifaces, Interface{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return ifaces, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virConnectListAllNetworks
+func (c *Connect) ListAllNetworks(flags ConnectListAllNetworksFlags) ([]Network, error) {
+ var cList *C.virNetworkPtr
+ var err C.virError
+ numNets := C.virConnectListAllNetworksWrapper(c.ptr, (**C.virNetworkPtr)(&cList), C.uint(flags), &err)
+ if numNets == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numNets),
+ Cap: int(numNets),
+ }
+ var nets []Network
+ slice := *(*[]C.virNetworkPtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ nets = append(nets, Network{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return nets, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListAllDomains
+func (c *Connect) ListAllDomains(flags ConnectListAllDomainsFlags) ([]Domain, error) {
+ var cList *C.virDomainPtr
+ var err C.virError
+ numDomains := C.virConnectListAllDomainsWrapper(c.ptr, (**C.virDomainPtr)(&cList), C.uint(flags), &err)
+ if numDomains == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numDomains),
+ Cap: int(numDomains),
+ }
+ var domains []Domain
+ slice := *(*[]C.virDomainPtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ domains = append(domains, Domain{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return domains, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virConnectListAllNWFilters
+func (c *Connect) ListAllNWFilters(flags uint32) ([]NWFilter, error) {
+ var cList *C.virNWFilterPtr
+ var err C.virError
+ numNWFilters := C.virConnectListAllNWFiltersWrapper(c.ptr, (**C.virNWFilterPtr)(&cList), C.uint(flags), &err)
+ if numNWFilters == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numNWFilters),
+ Cap: int(numNWFilters),
+ }
+ var filters []NWFilter
+ slice := *(*[]C.virNWFilterPtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ filters = append(filters, NWFilter{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return filters, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virConnectListAllNWFilterBindings
+func (c *Connect) ListAllNWFilterBindings(flags uint32) ([]NWFilterBinding, error) {
+ var cList *C.virNWFilterBindingPtr
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return []NWFilterBinding{}, makeNotImplementedError("virConnectListAllNWFilterBindings")
+ }
+ var err C.virError
+ numNWFilters := C.virConnectListAllNWFilterBindingsWrapper(c.ptr, (**C.virNWFilterBindingPtr)(&cList), C.uint(flags), &err)
+ if numNWFilters == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numNWFilters),
+ Cap: int(numNWFilters),
+ }
+ var filters []NWFilterBinding
+ slice := *(*[]C.virNWFilterBindingPtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ filters = append(filters, NWFilterBinding{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return filters, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectListAllStoragePools
+func (c *Connect) ListAllStoragePools(flags ConnectListAllStoragePoolsFlags) ([]StoragePool, error) {
+ var cList *C.virStoragePoolPtr
+ var err C.virError
+ numPools := C.virConnectListAllStoragePoolsWrapper(c.ptr, (**C.virStoragePoolPtr)(&cList), C.uint(flags), &err)
+ if numPools == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numPools),
+ Cap: int(numPools),
+ }
+ var pools []StoragePool
+ slice := *(*[]C.virStoragePoolPtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ pools = append(pools, StoragePool{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return pools, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virConnectListAllSecrets
+func (c *Connect) ListAllSecrets(flags ConnectListAllSecretsFlags) ([]Secret, error) {
+ var cList *C.virSecretPtr
+ var err C.virError
+ numPools := C.virConnectListAllSecretsWrapper(c.ptr, (**C.virSecretPtr)(&cList), C.uint(flags), &err)
+ if numPools == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numPools),
+ Cap: int(numPools),
+ }
+ var pools []Secret
+ slice := *(*[]C.virSecretPtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ pools = append(pools, Secret{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return pools, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virConnectListAllNodeDevices
+func (c *Connect) ListAllNodeDevices(flags ConnectListAllNodeDeviceFlags) ([]NodeDevice, error) {
+ var cList *C.virNodeDevicePtr
+ var err C.virError
+ numPools := C.virConnectListAllNodeDevicesWrapper(c.ptr, (**C.virNodeDevicePtr)(&cList), C.uint(flags), &err)
+ if numPools == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numPools),
+ Cap: int(numPools),
+ }
+ var pools []NodeDevice
+ slice := *(*[]C.virNodeDevicePtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ pools = append(pools, NodeDevice{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return pools, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceChangeBegin
+func (c *Connect) InterfaceChangeBegin(flags uint32) error {
+ var err C.virError
+ ret := C.virInterfaceChangeBeginWrapper(c.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceChangeCommit
+func (c *Connect) InterfaceChangeCommit(flags uint32) error {
+ var err C.virError
+ ret := C.virInterfaceChangeCommitWrapper(c.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceChangeRollback
+func (c *Connect) InterfaceChangeRollback(flags uint32) error {
+ var err C.virError
+ ret := C.virInterfaceChangeRollbackWrapper(c.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeAllocPages
+func (c *Connect) AllocPages(pageSizes map[int]int64, startCell int, cellCount uint, flags NodeAllocPagesFlags) (int, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002009 {
+ return 0, makeNotImplementedError("virNodeAllocPages")
+ }
+ cpages := make([]C.uint, len(pageSizes))
+ ccounts := make([]C.ulonglong, len(pageSizes))
+
+ i := 0
+ for key, val := range pageSizes {
+ cpages[i] = C.uint(key)
+ ccounts[i] = C.ulonglong(val)
+ i++
+ }
+
+ var err C.virError
+ ret := C.virNodeAllocPagesWrapper(c.ptr, C.uint(len(pageSizes)), (*C.uint)(unsafe.Pointer(&cpages)),
+ (*C.ulonglong)(unsafe.Pointer(&ccounts)), C.int(startCell), C.uint(cellCount), C.uint(flags), &err)
+ if ret == -1 {
+ return 0, makeError(&err)
+ }
+
+ return int(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetCPUMap
+func (c *Connect) GetCPUMap(flags uint32) (map[int]bool, uint, error) {
+ var ccpumap *C.uchar
+ var conline C.uint
+ var err C.virError
+ ret := C.virNodeGetCPUMapWrapper(c.ptr, &ccpumap, &conline, C.uint(flags), &err)
+ if ret == -1 {
+ return map[int]bool{}, 0, makeError(&err)
+ }
+ defer C.free(unsafe.Pointer(ccpumap))
+
+ cpumapbytes := C.GoBytes(unsafe.Pointer(ccpumap), C.int(ret/8))
+
+ cpumap := make(map[int]bool, 0)
+ for i := 0; i < int(ret); i++ {
+ idx := int(i / 8)
+ val := byte(cpumapbytes[idx])
+ shift := i % 8
+ cpumap[i] = (val & (1 << uint(shift))) == 1
+ }
+
+ return cpumap, uint(conline), nil
+}
+
+type NodeCPUStats struct {
+ KernelSet bool
+ Kernel uint64
+ UserSet bool
+ User uint64
+ IdleSet bool
+ Idle uint64
+ IowaitSet bool
+ Iowait uint64
+ IntrSet bool
+ Intr uint64
+ UtilizationSet bool
+ Utilization uint64
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetCPUStats
+func (c *Connect) GetCPUStats(cpuNum int, flags uint32) (*NodeCPUStats, error) {
+ var nparams C.int
+
+ var err C.virError
+ ret := C.virNodeGetCPUStatsWrapper(c.ptr, C.int(cpuNum), nil, &nparams, C.uint(0), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ params := make([]C.virNodeCPUStats, nparams)
+ ret = C.virNodeGetCPUStatsWrapper(c.ptr, C.int(cpuNum), (*C.virNodeCPUStats)(unsafe.Pointer(&params[0])), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ stats := &NodeCPUStats{}
+ for i := 0; i < int(nparams); i++ {
+ param := params[i]
+ field := C.GoString((*C.char)(unsafe.Pointer(&param.field)))
+ switch field {
+ case C.VIR_NODE_CPU_STATS_KERNEL:
+ stats.KernelSet = true
+ stats.Kernel = uint64(param.value)
+ case C.VIR_NODE_CPU_STATS_USER:
+ stats.UserSet = true
+ stats.User = uint64(param.value)
+ case C.VIR_NODE_CPU_STATS_IDLE:
+ stats.IdleSet = true
+ stats.Idle = uint64(param.value)
+ case C.VIR_NODE_CPU_STATS_IOWAIT:
+ stats.IowaitSet = true
+ stats.Iowait = uint64(param.value)
+ case C.VIR_NODE_CPU_STATS_INTR:
+ stats.IntrSet = true
+ stats.Intr = uint64(param.value)
+ case C.VIR_NODE_CPU_STATS_UTILIZATION:
+ stats.UtilizationSet = true
+ stats.Utilization = uint64(param.value)
+ }
+ }
+
+ return stats, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetCellsFreeMemory
+func (c *Connect) GetCellsFreeMemory(startCell int, maxCells int) ([]uint64, error) {
+ cmem := make([]C.ulonglong, maxCells)
+ var err C.virError
+ ret := C.virNodeGetCellsFreeMemoryWrapper(c.ptr, (*C.ulonglong)(unsafe.Pointer(&cmem[0])), C.int(startCell), C.int(maxCells), &err)
+ if ret == -1 {
+ return []uint64{}, makeError(&err)
+ }
+
+ mem := make([]uint64, ret)
+ for i := 0; i < int(ret); i++ {
+ mem[i] = uint64(cmem[i])
+ }
+
+ return mem, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetFreeMemory
+func (c *Connect) GetFreeMemory() (uint64, error) {
+ var err C.virError
+ ret := C.virNodeGetFreeMemoryWrapper(c.ptr, &err)
+ if ret == 0 {
+ return 0, makeError(&err)
+ }
+
+ return (uint64)(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetFreePages
+func (c *Connect) GetFreePages(pageSizes []uint64, startCell int, maxCells uint, flags uint32) ([]uint64, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002006 {
+ return []uint64{}, makeNotImplementedError("virNodeGetFreePages")
+ }
+ cpageSizes := make([]C.uint, len(pageSizes))
+ ccounts := make([]C.ulonglong, len(pageSizes)*int(maxCells))
+
+ for i := 0; i < len(pageSizes); i++ {
+ cpageSizes[i] = C.uint(pageSizes[i])
+ }
+
+ var err C.virError
+ ret := C.virNodeGetFreePagesWrapper(c.ptr, C.uint(len(pageSizes)), (*C.uint)(unsafe.Pointer(&cpageSizes)), C.int(startCell),
+ C.uint(maxCells), (*C.ulonglong)(unsafe.Pointer(&ccounts)), C.uint(flags), &err)
+ if ret == -1 {
+ return []uint64{}, makeError(&err)
+ }
+
+ counts := make([]uint64, ret)
+ for i := 0; i < int(ret); i++ {
+ counts[i] = uint64(ccounts[i])
+ }
+
+ return counts, nil
+}
+
+type NodeMemoryParameters struct {
+ ShmPagesToScanSet bool
+ ShmPagesToScan uint
+ ShmSleepMillisecsSet bool
+ ShmSleepMillisecs uint
+ ShmPagesSharedSet bool
+ ShmPagesShared uint64
+ ShmPagesSharingSet bool
+ ShmPagesSharing uint64
+ ShmPagesUnsharedSet bool
+ ShmPagesUnshared uint64
+ ShmPagesVolatileSet bool
+ ShmPagesVolatile uint64
+ ShmFullScansSet bool
+ ShmFullScans uint64
+ ShmMergeAcrossNodesSet bool
+ ShmMergeAcrossNodes uint
+}
+
+func getMemoryParameterFieldInfo(params *NodeMemoryParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN: typedParamsFieldInfo{
+ set: &params.ShmPagesToScanSet,
+ ui: &params.ShmPagesToScan,
+ },
+ C.VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS: typedParamsFieldInfo{
+ set: &params.ShmSleepMillisecsSet,
+ ui: &params.ShmSleepMillisecs,
+ },
+ C.VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES: typedParamsFieldInfo{
+ set: &params.ShmMergeAcrossNodesSet,
+ ui: &params.ShmMergeAcrossNodes,
+ },
+ C.VIR_NODE_MEMORY_SHARED_PAGES_SHARED: typedParamsFieldInfo{
+ set: &params.ShmPagesSharedSet,
+ ul: &params.ShmPagesShared,
+ },
+ C.VIR_NODE_MEMORY_SHARED_PAGES_SHARING: typedParamsFieldInfo{
+ set: &params.ShmPagesSharingSet,
+ ul: &params.ShmPagesSharing,
+ },
+ C.VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED: typedParamsFieldInfo{
+ set: &params.ShmPagesUnsharedSet,
+ ul: &params.ShmPagesUnshared,
+ },
+ C.VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE: typedParamsFieldInfo{
+ set: &params.ShmPagesVolatileSet,
+ ul: &params.ShmPagesVolatile,
+ },
+ C.VIR_NODE_MEMORY_SHARED_FULL_SCANS: typedParamsFieldInfo{
+ set: &params.ShmFullScansSet,
+ ul: &params.ShmFullScans,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetMemoryParameters
+func (c *Connect) GetMemoryParameters(flags uint32) (*NodeMemoryParameters, error) {
+ params := &NodeMemoryParameters{}
+ info := getMemoryParameterFieldInfo(params)
+
+ var nparams C.int
+
+ var err C.virError
+ ret := C.virNodeGetMemoryParametersWrapper(c.ptr, nil, &nparams, C.uint(0), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virNodeGetMemoryParametersWrapper(c.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ _, gerr := typedParamsUnpack(cparams, info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+type NodeMemoryStats struct {
+ TotalSet bool
+ Total uint64
+ FreeSet bool
+ Free uint64
+ BuffersSet bool
+ Buffers uint64
+ CachedSet bool
+ Cached uint64
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetMemoryStats
+func (c *Connect) GetMemoryStats(cellNum int, flags uint32) (*NodeMemoryStats, error) {
+ var nparams C.int
+
+ var err C.virError
+ ret := C.virNodeGetMemoryStatsWrapper(c.ptr, C.int(cellNum), nil, &nparams, 0, &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ params := make([]C.virNodeMemoryStats, nparams)
+ ret = C.virNodeGetMemoryStatsWrapper(c.ptr, C.int(cellNum), (*C.virNodeMemoryStats)(unsafe.Pointer(&params[0])), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ stats := &NodeMemoryStats{}
+ for i := 0; i < int(nparams); i++ {
+ param := params[i]
+ field := C.GoString((*C.char)(unsafe.Pointer(&param.field)))
+ switch field {
+ case C.VIR_NODE_MEMORY_STATS_TOTAL:
+ stats.TotalSet = true
+ stats.Total = uint64(param.value)
+ case C.VIR_NODE_MEMORY_STATS_FREE:
+ stats.FreeSet = true
+ stats.Free = uint64(param.value)
+ case C.VIR_NODE_MEMORY_STATS_BUFFERS:
+ stats.BuffersSet = true
+ stats.Buffers = uint64(param.value)
+ case C.VIR_NODE_MEMORY_STATS_CACHED:
+ stats.CachedSet = true
+ stats.Cached = uint64(param.value)
+ }
+ }
+
+ return stats, nil
+}
+
+type NodeSecurityModel struct {
+ Model string
+ Doi string
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetSecurityModel
+func (c *Connect) GetSecurityModel() (*NodeSecurityModel, error) {
+ var cmodel C.virSecurityModel
+ var err C.virError
+ ret := C.virNodeGetSecurityModelWrapper(c.ptr, &cmodel, &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ return &NodeSecurityModel{
+ Model: C.GoString((*C.char)(unsafe.Pointer(&cmodel.model))),
+ Doi: C.GoString((*C.char)(unsafe.Pointer(&cmodel.doi))),
+ }, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeSetMemoryParameters
+func (c *Connect) SetMemoryParameters(params *NodeMemoryParameters, flags uint32) error {
+ info := getMemoryParameterFieldInfo(params)
+
+ var nparams C.int
+
+ var err C.virError
+ ret := C.virNodeGetMemoryParametersWrapper(c.ptr, nil, &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virNodeGetMemoryParametersWrapper(c.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ gerr := typedParamsPack(cparams, info)
+ if gerr != nil {
+ return gerr
+ }
+
+ ret = C.virNodeSetMemoryParametersWrapper(c.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeSuspendForDuration
+func (c *Connect) SuspendForDuration(target NodeSuspendTarget, duration uint64, flags uint32) error {
+ var err C.virError
+ ret := C.virNodeSuspendForDurationWrapper(c.ptr, C.uint(target), C.ulonglong(duration), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSaveImageDefineXML
+func (c *Connect) DomainSaveImageDefineXML(file string, xml string, flags DomainSaveRestoreFlags) error {
+ cfile := C.CString(file)
+ defer C.free(unsafe.Pointer(cfile))
+ cxml := C.CString(xml)
+ defer C.free(unsafe.Pointer(cxml))
+
+ var err C.virError
+ ret := C.virDomainSaveImageDefineXMLWrapper(c.ptr, cfile, cxml, C.uint(flags), &err)
+
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSaveImageGetXMLDesc
+func (c *Connect) DomainSaveImageGetXMLDesc(file string, flags DomainXMLFlags) (string, error) {
+ cfile := C.CString(file)
+ defer C.free(unsafe.Pointer(cfile))
+
+ var err C.virError
+ ret := C.virDomainSaveImageGetXMLDescWrapper(c.ptr, cfile, C.uint(flags), &err)
+
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectBaselineCPU
+func (c *Connect) BaselineCPU(xmlCPUs []string, flags ConnectBaselineCPUFlags) (string, error) {
+ cxmlCPUs := make([]*C.char, len(xmlCPUs))
+ for i := 0; i < len(xmlCPUs); i++ {
+ cxmlCPUs[i] = C.CString(xmlCPUs[i])
+ defer C.free(unsafe.Pointer(cxmlCPUs[i]))
+ }
+
+ var err C.virError
+ ret := C.virConnectBaselineCPUWrapper(c.ptr, &cxmlCPUs[0], C.uint(len(xmlCPUs)), C.uint(flags), &err)
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectBaselineHypervisorCPU
+func (c *Connect) BaselineHypervisorCPU(emulator string, arch string, machine string, virttype string, xmlCPUs []string, flags ConnectBaselineCPUFlags) (string, error) {
+ if C.LIBVIR_VERSION_NUMBER < 4004000 {
+ return "", makeNotImplementedError("virConnectBaselineHypervisorCPU")
+ }
+
+ var cemulator, carch, cmachine, cvirttype *C.char
+ if emulator != "" {
+ cemulator = C.CString(emulator)
+ defer C.free(unsafe.Pointer(cemulator))
+ }
+ if arch != "" {
+ carch = C.CString(arch)
+ defer C.free(unsafe.Pointer(carch))
+ }
+ if machine != "" {
+ cmachine = C.CString(machine)
+ defer C.free(unsafe.Pointer(cmachine))
+ }
+ if virttype != "" {
+ cvirttype = C.CString(virttype)
+ defer C.free(unsafe.Pointer(cvirttype))
+ }
+ cxmlCPUs := make([]*C.char, len(xmlCPUs))
+ for i := 0; i < len(xmlCPUs); i++ {
+ cxmlCPUs[i] = C.CString(xmlCPUs[i])
+ defer C.free(unsafe.Pointer(cxmlCPUs[i]))
+ }
+
+ var err C.virError
+ ret := C.virConnectBaselineHypervisorCPUWrapper(c.ptr, cemulator, carch, cmachine, cvirttype,
+ &cxmlCPUs[0], C.uint(len(xmlCPUs)), C.uint(flags), &err)
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectCompareCPU
+func (c *Connect) CompareCPU(xmlDesc string, flags ConnectCompareCPUFlags) (CPUCompareResult, error) {
+ cxmlDesc := C.CString(xmlDesc)
+ defer C.free(unsafe.Pointer(cxmlDesc))
+
+ var err C.virError
+ ret := C.virConnectCompareCPUWrapper(c.ptr, cxmlDesc, C.uint(flags), &err)
+ if ret == C.VIR_CPU_COMPARE_ERROR {
+ return CPU_COMPARE_ERROR, makeError(&err)
+ }
+
+ return CPUCompareResult(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectCompareHypervisorCPU
+func (c *Connect) CompareHypervisorCPU(emulator string, arch string, machine string, virttype string, xmlDesc string, flags ConnectCompareCPUFlags) (CPUCompareResult, error) {
+ if C.LIBVIR_VERSION_NUMBER < 4004000 {
+ return CPU_COMPARE_ERROR, makeNotImplementedError("virConnectCompareHypervisorCPU")
+ }
+
+ var cemulator, carch, cmachine, cvirttype *C.char
+ if emulator != "" {
+ cemulator = C.CString(emulator)
+ defer C.free(unsafe.Pointer(cemulator))
+ }
+ if arch != "" {
+ carch = C.CString(arch)
+ defer C.free(unsafe.Pointer(carch))
+ }
+ if machine != "" {
+ cmachine = C.CString(machine)
+ defer C.free(unsafe.Pointer(cmachine))
+ }
+ if virttype != "" {
+ cvirttype = C.CString(virttype)
+ defer C.free(unsafe.Pointer(cvirttype))
+ }
+
+ cxmlDesc := C.CString(xmlDesc)
+ defer C.free(unsafe.Pointer(cxmlDesc))
+
+ var err C.virError
+ ret := C.virConnectCompareHypervisorCPUWrapper(c.ptr, cemulator, carch, cmachine, cvirttype, cxmlDesc, C.uint(flags), &err)
+ if ret == C.VIR_CPU_COMPARE_ERROR {
+ return CPU_COMPARE_ERROR, makeError(&err)
+ }
+
+ return CPUCompareResult(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainXMLFromNative
+func (c *Connect) DomainXMLFromNative(nativeFormat string, nativeConfig string, flags uint32) (string, error) {
+ cnativeFormat := C.CString(nativeFormat)
+ defer C.free(unsafe.Pointer(cnativeFormat))
+ cnativeConfig := C.CString(nativeConfig)
+ defer C.free(unsafe.Pointer(cnativeConfig))
+
+ var err C.virError
+ ret := C.virConnectDomainXMLFromNativeWrapper(c.ptr, cnativeFormat, cnativeConfig, C.uint(flags), &err)
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectDomainXMLToNative
+func (c *Connect) DomainXMLToNative(nativeFormat string, domainXml string, flags uint32) (string, error) {
+ cnativeFormat := C.CString(nativeFormat)
+ defer C.free(unsafe.Pointer(cnativeFormat))
+ cdomainXml := C.CString(domainXml)
+ defer C.free(unsafe.Pointer(cdomainXml))
+
+ var err C.virError
+ ret := C.virConnectDomainXMLToNativeWrapper(c.ptr, cnativeFormat, cdomainXml, C.uint(flags), &err)
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetCPUModelNames
+func (c *Connect) GetCPUModelNames(arch string, flags uint32) ([]string, error) {
+ carch := C.CString(arch)
+ defer C.free(unsafe.Pointer(carch))
+
+ var cmodels **C.char
+ var err C.virError
+ ret := C.virConnectGetCPUModelNamesWrapper(c.ptr, carch, &cmodels, C.uint(flags), &err)
+ if ret == -1 {
+ return []string{}, makeError(&err)
+ }
+
+ models := make([]string, int(ret))
+ for i := 0; i < int(ret); i++ {
+ cmodel := *(**C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(cmodels)) + (unsafe.Sizeof(*cmodels) * uintptr(i))))
+
+ defer C.free(unsafe.Pointer(cmodel))
+ models[i] = C.GoString(cmodel)
+ }
+ defer C.free(unsafe.Pointer(cmodels))
+
+ return models, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectGetDomainCapabilities
+func (c *Connect) GetDomainCapabilities(emulatorbin string, arch string, machine string, virttype string, flags uint32) (string, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002007 {
+ return "", makeNotImplementedError("virConnectGetDomainCapabilities")
+ }
+ var cemulatorbin *C.char
+ if emulatorbin != "" {
+ cemulatorbin = C.CString(emulatorbin)
+ defer C.free(unsafe.Pointer(cemulatorbin))
+ }
+ var carch *C.char
+ if arch != "" {
+ carch = C.CString(arch)
+ defer C.free(unsafe.Pointer(carch))
+ }
+ var cmachine *C.char
+ if machine != "" {
+ cmachine = C.CString(machine)
+ defer C.free(unsafe.Pointer(cmachine))
+ }
+ var cvirttype *C.char
+ if virttype != "" {
+ cvirttype = C.CString(virttype)
+ defer C.free(unsafe.Pointer(cvirttype))
+ }
+
+ var err C.virError
+ ret := C.virConnectGetDomainCapabilitiesWrapper(c.ptr, cemulatorbin, carch, cmachine, cvirttype, C.uint(flags), &err)
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetVersion
+func (c *Connect) GetVersion() (uint32, error) {
+ var hvVer C.ulong
+ var err C.virError
+ ret := C.virConnectGetVersionWrapper(c.ptr, &hvVer, &err)
+ if ret == -1 {
+ return 0, makeError(&err)
+ }
+
+ return uint32(hvVer), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectFindStoragePoolSources
+func (c *Connect) FindStoragePoolSources(pooltype string, srcSpec string, flags uint32) (string, error) {
+ cpooltype := C.CString(pooltype)
+ defer C.free(unsafe.Pointer(cpooltype))
+ var csrcSpec *C.char
+ if srcSpec != "" {
+ csrcSpec := C.CString(srcSpec)
+ defer C.free(unsafe.Pointer(csrcSpec))
+ }
+ var err C.virError
+ ret := C.virConnectFindStoragePoolSourcesWrapper(c.ptr, cpooltype, csrcSpec, C.uint(flags), &err)
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainRestore
+func (c *Connect) DomainRestore(srcFile string) error {
+ cPath := C.CString(srcFile)
+ defer C.free(unsafe.Pointer(cPath))
+ var err C.virError
+ if result := C.virDomainRestoreWrapper(c.ptr, cPath, &err); result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainRestoreFlags
+func (c *Connect) DomainRestoreFlags(srcFile, xmlConf string, flags DomainSaveRestoreFlags) error {
+ cPath := C.CString(srcFile)
+ defer C.free(unsafe.Pointer(cPath))
+ var cXmlConf *C.char
+ if xmlConf != "" {
+ cXmlConf = C.CString(xmlConf)
+ defer C.free(unsafe.Pointer(cXmlConf))
+ }
+ var err C.virError
+ if result := C.virDomainRestoreFlagsWrapper(c.ptr, cPath, cXmlConf, C.uint(flags), &err); result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamNew
+func (c *Connect) NewStream(flags StreamFlags) (*Stream, error) {
+ var err C.virError
+ virStream := C.virStreamNewWrapper(c.ptr, C.uint(flags), &err)
+ if virStream == nil {
+ return nil, makeError(&err)
+ }
+
+ return &Stream{
+ ptr: virStream,
+ }, nil
+}
+
+type DomainStatsState struct {
+ StateSet bool
+ State DomainState
+ ReasonSet bool
+ Reason int
+}
+
+func getDomainStatsStateFieldInfo(params *DomainStatsState) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ "state.state": typedParamsFieldInfo{
+ set: &params.StateSet,
+ i: (*int)(unsafe.Pointer(&params.State)),
+ },
+ "state.reason": typedParamsFieldInfo{
+ set: &params.ReasonSet,
+ i: &params.Reason,
+ },
+ }
+}
+
+type DomainStatsCPU struct {
+ TimeSet bool
+ Time uint64
+ UserSet bool
+ User uint64
+ SystemSet bool
+ System uint64
+}
+
+func getDomainStatsCPUFieldInfo(params *DomainStatsCPU) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ "cpu.time": typedParamsFieldInfo{
+ set: &params.TimeSet,
+ ul: &params.Time,
+ },
+ "cpu.user": typedParamsFieldInfo{
+ set: &params.UserSet,
+ ul: &params.User,
+ },
+ "cpu.system": typedParamsFieldInfo{
+ set: &params.SystemSet,
+ ul: &params.System,
+ },
+ }
+}
+
+type DomainStatsBalloon struct {
+ CurrentSet bool
+ Current uint64
+ MaximumSet bool
+ Maximum uint64
+}
+
+func getDomainStatsBalloonFieldInfo(params *DomainStatsBalloon) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ "balloon.current": typedParamsFieldInfo{
+ set: &params.CurrentSet,
+ ul: &params.Current,
+ },
+ "balloon.maximum": typedParamsFieldInfo{
+ set: &params.MaximumSet,
+ ul: &params.Maximum,
+ },
+ }
+}
+
+type DomainStatsVcpu struct {
+ StateSet bool
+ State VcpuState
+ TimeSet bool
+ Time uint64
+}
+
+func getDomainStatsVcpuFieldInfo(idx int, params *DomainStatsVcpu) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ fmt.Sprintf("vcpu.%d.state", idx): typedParamsFieldInfo{
+ set: &params.StateSet,
+ i: (*int)(unsafe.Pointer(&params.State)),
+ },
+ fmt.Sprintf("vcpu.%d.time", idx): typedParamsFieldInfo{
+ set: &params.TimeSet,
+ ul: &params.Time,
+ },
+ }
+}
+
+type DomainStatsNet struct {
+ NameSet bool
+ Name string
+ RxBytesSet bool
+ RxBytes uint64
+ RxPktsSet bool
+ RxPkts uint64
+ RxErrsSet bool
+ RxErrs uint64
+ RxDropSet bool
+ RxDrop uint64
+ TxBytesSet bool
+ TxBytes uint64
+ TxPktsSet bool
+ TxPkts uint64
+ TxErrsSet bool
+ TxErrs uint64
+ TxDropSet bool
+ TxDrop uint64
+}
+
+func getDomainStatsNetFieldInfo(idx int, params *DomainStatsNet) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ fmt.Sprintf("net.%d.name", idx): typedParamsFieldInfo{
+ set: &params.NameSet,
+ s: &params.Name,
+ },
+ fmt.Sprintf("net.%d.rx.bytes", idx): typedParamsFieldInfo{
+ set: &params.RxBytesSet,
+ ul: &params.RxBytes,
+ },
+ fmt.Sprintf("net.%d.rx.pkts", idx): typedParamsFieldInfo{
+ set: &params.RxPktsSet,
+ ul: &params.RxPkts,
+ },
+ fmt.Sprintf("net.%d.rx.errs", idx): typedParamsFieldInfo{
+ set: &params.RxErrsSet,
+ ul: &params.RxErrs,
+ },
+ fmt.Sprintf("net.%d.rx.drop", idx): typedParamsFieldInfo{
+ set: &params.RxDropSet,
+ ul: &params.RxDrop,
+ },
+ fmt.Sprintf("net.%d.tx.bytes", idx): typedParamsFieldInfo{
+ set: &params.TxBytesSet,
+ ul: &params.TxBytes,
+ },
+ fmt.Sprintf("net.%d.tx.pkts", idx): typedParamsFieldInfo{
+ set: &params.TxPktsSet,
+ ul: &params.TxPkts,
+ },
+ fmt.Sprintf("net.%d.tx.errs", idx): typedParamsFieldInfo{
+ set: &params.TxErrsSet,
+ ul: &params.TxErrs,
+ },
+ fmt.Sprintf("net.%d.tx.drop", idx): typedParamsFieldInfo{
+ set: &params.TxDropSet,
+ ul: &params.TxDrop,
+ },
+ }
+}
+
+type DomainStatsBlock struct {
+ NameSet bool
+ Name string
+ BackingIndexSet bool
+ BackingIndex uint
+ PathSet bool
+ Path string
+ RdReqsSet bool
+ RdReqs uint64
+ RdBytesSet bool
+ RdBytes uint64
+ RdTimesSet bool
+ RdTimes uint64
+ WrReqsSet bool
+ WrReqs uint64
+ WrBytesSet bool
+ WrBytes uint64
+ WrTimesSet bool
+ WrTimes uint64
+ FlReqsSet bool
+ FlReqs uint64
+ FlTimesSet bool
+ FlTimes uint64
+ ErrorsSet bool
+ Errors uint64
+ AllocationSet bool
+ Allocation uint64
+ CapacitySet bool
+ Capacity uint64
+ PhysicalSet bool
+ Physical uint64
+}
+
+func getDomainStatsBlockFieldInfo(idx int, params *DomainStatsBlock) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ fmt.Sprintf("block.%d.name", idx): typedParamsFieldInfo{
+ set: &params.NameSet,
+ s: &params.Name,
+ },
+ fmt.Sprintf("block.%d.backingIndex", idx): typedParamsFieldInfo{
+ set: &params.BackingIndexSet,
+ ui: &params.BackingIndex,
+ },
+ fmt.Sprintf("block.%d.path", idx): typedParamsFieldInfo{
+ set: &params.PathSet,
+ s: &params.Path,
+ },
+ fmt.Sprintf("block.%d.rd.reqs", idx): typedParamsFieldInfo{
+ set: &params.RdReqsSet,
+ ul: &params.RdReqs,
+ },
+ fmt.Sprintf("block.%d.rd.bytes", idx): typedParamsFieldInfo{
+ set: &params.RdBytesSet,
+ ul: &params.RdBytes,
+ },
+ fmt.Sprintf("block.%d.rd.times", idx): typedParamsFieldInfo{
+ set: &params.RdTimesSet,
+ ul: &params.RdTimes,
+ },
+ fmt.Sprintf("block.%d.wr.reqs", idx): typedParamsFieldInfo{
+ set: &params.WrReqsSet,
+ ul: &params.WrReqs,
+ },
+ fmt.Sprintf("block.%d.wr.bytes", idx): typedParamsFieldInfo{
+ set: &params.WrBytesSet,
+ ul: &params.WrBytes,
+ },
+ fmt.Sprintf("block.%d.wr.times", idx): typedParamsFieldInfo{
+ set: &params.WrTimesSet,
+ ul: &params.WrTimes,
+ },
+ fmt.Sprintf("block.%d.fl.reqs", idx): typedParamsFieldInfo{
+ set: &params.FlReqsSet,
+ ul: &params.FlReqs,
+ },
+ fmt.Sprintf("block.%d.fl.times", idx): typedParamsFieldInfo{
+ set: &params.FlTimesSet,
+ ul: &params.FlTimes,
+ },
+ fmt.Sprintf("block.%d.errors", idx): typedParamsFieldInfo{
+ set: &params.ErrorsSet,
+ ul: &params.Errors,
+ },
+ fmt.Sprintf("block.%d.allocation", idx): typedParamsFieldInfo{
+ set: &params.AllocationSet,
+ ul: &params.Allocation,
+ },
+ fmt.Sprintf("block.%d.capacity", idx): typedParamsFieldInfo{
+ set: &params.CapacitySet,
+ ul: &params.Capacity,
+ },
+ fmt.Sprintf("block.%d.physical", idx): typedParamsFieldInfo{
+ set: &params.PhysicalSet,
+ ul: &params.Physical,
+ },
+ }
+}
+
+type DomainStatsPerf struct {
+ CmtSet bool
+ Cmt uint64
+ MbmtSet bool
+ Mbmt uint64
+ MbmlSet bool
+ Mbml uint64
+ CacheMissesSet bool
+ CacheMisses uint64
+ CacheReferencesSet bool
+ CacheReferences uint64
+ InstructionsSet bool
+ Instructions uint64
+ CpuCyclesSet bool
+ CpuCycles uint64
+ BranchInstructionsSet bool
+ BranchInstructions uint64
+ BranchMissesSet bool
+ BranchMisses uint64
+ BusCyclesSet bool
+ BusCycles uint64
+ StalledCyclesFrontendSet bool
+ StalledCyclesFrontend uint64
+ StalledCyclesBackendSet bool
+ StalledCyclesBackend uint64
+ RefCpuCyclesSet bool
+ RefCpuCycles uint64
+ CpuClockSet bool
+ CpuClock uint64
+ TaskClockSet bool
+ TaskClock uint64
+ PageFaultsSet bool
+ PageFaults uint64
+ ContextSwitchesSet bool
+ ContextSwitches uint64
+ CpuMigrationsSet bool
+ CpuMigrations uint64
+ PageFaultsMinSet bool
+ PageFaultsMin uint64
+ PageFaultsMajSet bool
+ PageFaultsMaj uint64
+ AlignmentFaultsSet bool
+ AlignmentFaults uint64
+ EmulationFaultsSet bool
+ EmulationFaults uint64
+}
+
+func getDomainStatsPerfFieldInfo(params *DomainStatsPerf) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ "perf.cmt": typedParamsFieldInfo{
+ set: &params.CmtSet,
+ ul: &params.Cmt,
+ },
+ "perf.mbmt": typedParamsFieldInfo{
+ set: &params.MbmtSet,
+ ul: &params.Mbmt,
+ },
+ "perf.mbml": typedParamsFieldInfo{
+ set: &params.MbmlSet,
+ ul: &params.Mbml,
+ },
+ "perf.cache_misses": typedParamsFieldInfo{
+ set: &params.CacheMissesSet,
+ ul: &params.CacheMisses,
+ },
+ "perf.cache_references": typedParamsFieldInfo{
+ set: &params.CacheReferencesSet,
+ ul: &params.CacheReferences,
+ },
+ "perf.instructions": typedParamsFieldInfo{
+ set: &params.InstructionsSet,
+ ul: &params.Instructions,
+ },
+ "perf.cpu_cycles": typedParamsFieldInfo{
+ set: &params.CpuCyclesSet,
+ ul: &params.CpuCycles,
+ },
+ "perf.branch_instructions": typedParamsFieldInfo{
+ set: &params.BranchInstructionsSet,
+ ul: &params.BranchInstructions,
+ },
+ "perf.branch_misses": typedParamsFieldInfo{
+ set: &params.BranchMissesSet,
+ ul: &params.BranchMisses,
+ },
+ "perf.bus_cycles": typedParamsFieldInfo{
+ set: &params.BusCyclesSet,
+ ul: &params.BusCycles,
+ },
+ "perf.stalled_cycles_frontend": typedParamsFieldInfo{
+ set: &params.StalledCyclesFrontendSet,
+ ul: &params.StalledCyclesFrontend,
+ },
+ "perf.stalled_cycles_backend": typedParamsFieldInfo{
+ set: &params.StalledCyclesBackendSet,
+ ul: &params.StalledCyclesBackend,
+ },
+ "perf.ref_cpu_cycles": typedParamsFieldInfo{
+ set: &params.RefCpuCyclesSet,
+ ul: &params.RefCpuCycles,
+ },
+ "perf.cpu_clock": typedParamsFieldInfo{
+ set: &params.CpuClockSet,
+ ul: &params.CpuClock,
+ },
+ "perf.task_clock": typedParamsFieldInfo{
+ set: &params.TaskClockSet,
+ ul: &params.TaskClock,
+ },
+ "perf.page_faults": typedParamsFieldInfo{
+ set: &params.PageFaultsSet,
+ ul: &params.PageFaults,
+ },
+ "perf.context_switches": typedParamsFieldInfo{
+ set: &params.ContextSwitchesSet,
+ ul: &params.ContextSwitches,
+ },
+ "perf.cpu_migrations": typedParamsFieldInfo{
+ set: &params.CpuMigrationsSet,
+ ul: &params.CpuMigrations,
+ },
+ "perf.page_faults_min": typedParamsFieldInfo{
+ set: &params.PageFaultsMinSet,
+ ul: &params.PageFaultsMin,
+ },
+ "perf.page_faults_maj": typedParamsFieldInfo{
+ set: &params.PageFaultsMajSet,
+ ul: &params.PageFaultsMaj,
+ },
+ "perf.alignment_faults": typedParamsFieldInfo{
+ set: &params.AlignmentFaultsSet,
+ ul: &params.AlignmentFaults,
+ },
+ "perf.emulation_faults": typedParamsFieldInfo{
+ set: &params.EmulationFaultsSet,
+ ul: &params.EmulationFaults,
+ },
+ }
+}
+
+type DomainStats struct {
+ Domain *Domain
+ State *DomainStatsState
+ Cpu *DomainStatsCPU
+ Balloon *DomainStatsBalloon
+ Vcpu []DomainStatsVcpu
+ Net []DomainStatsNet
+ Block []DomainStatsBlock
+ Perf *DomainStatsPerf
+}
+
+type domainStatsLengths struct {
+ VcpuCurrentSet bool
+ VcpuCurrent uint
+ VcpuMaximumSet bool
+ VcpuMaximum uint
+ NetCountSet bool
+ NetCount uint
+ BlockCountSet bool
+ BlockCount uint
+}
+
+func getDomainStatsLengthsFieldInfo(params *domainStatsLengths) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ "vcpu.current": typedParamsFieldInfo{
+ set: &params.VcpuCurrentSet,
+ ui: &params.VcpuCurrent,
+ },
+ "vcpu.maximum": typedParamsFieldInfo{
+ set: &params.VcpuMaximumSet,
+ ui: &params.VcpuMaximum,
+ },
+ "net.count": typedParamsFieldInfo{
+ set: &params.NetCountSet,
+ ui: &params.NetCount,
+ },
+ "block.count": typedParamsFieldInfo{
+ set: &params.BlockCountSet,
+ ui: &params.BlockCount,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectGetAllDomainStats
+func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes DomainStatsTypes, flags ConnectGetAllDomainStatsFlags) ([]DomainStats, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002008 {
+ return []DomainStats{}, makeNotImplementedError("virConnectGetAllDomainStats")
+ }
+ var ret C.int
+ var cstats *C.virDomainStatsRecordPtr
+ var err C.virError
+ if len(doms) > 0 {
+ cdoms := make([]C.virDomainPtr, len(doms)+1)
+ for i := 0; i < len(doms); i++ {
+ cdoms[i] = doms[i].ptr
+ }
+
+ ret = C.virDomainListGetStatsWrapper(&cdoms[0], C.uint(statsTypes), &cstats, C.uint(flags), &err)
+ } else {
+ ret = C.virConnectGetAllDomainStatsWrapper(c.ptr, C.uint(statsTypes), &cstats, C.uint(flags), &err)
+ }
+ if ret == -1 {
+ return []DomainStats{}, makeError(&err)
+ }
+
+ defer C.virDomainStatsRecordListFreeWrapper(cstats)
+
+ stats := make([]DomainStats, ret)
+ for i := 0; i < int(ret); i++ {
+ cdomstats := *(*C.virDomainStatsRecordPtr)(unsafe.Pointer(uintptr(unsafe.Pointer(cstats)) + (unsafe.Sizeof(*cstats) * uintptr(i))))
+
+ domstats := DomainStats{
+ Domain: &Domain{ptr: cdomstats.dom},
+ }
+
+ state := &DomainStatsState{}
+ stateInfo := getDomainStatsStateFieldInfo(state)
+
+ count, gerr := typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), stateInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
+ }
+ if count != 0 {
+ domstats.State = state
+ }
+
+ cpu := &DomainStatsCPU{}
+ cpuInfo := getDomainStatsCPUFieldInfo(cpu)
+
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), cpuInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
+ }
+ if count != 0 {
+ domstats.Cpu = cpu
+ }
+
+ balloon := &DomainStatsBalloon{}
+ balloonInfo := getDomainStatsBalloonFieldInfo(balloon)
+
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), balloonInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
+ }
+ if count != 0 {
+ domstats.Balloon = balloon
+ }
+
+ perf := &DomainStatsPerf{}
+ perfInfo := getDomainStatsPerfFieldInfo(perf)
+
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), perfInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
+ }
+ if count != 0 {
+ domstats.Perf = perf
+ }
+
+ lengths := domainStatsLengths{}
+ lengthsInfo := getDomainStatsLengthsFieldInfo(&lengths)
+
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), lengthsInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
+ }
+
+ if !lengths.VcpuMaximumSet && lengths.VcpuCurrentSet {
+ lengths.VcpuMaximum = lengths.VcpuCurrent
+ }
+
+ if lengths.VcpuMaximum > 0 {
+
+ domstats.Vcpu = make([]DomainStatsVcpu, lengths.VcpuMaximum)
+ for j := 0; j < int(lengths.VcpuMaximum); j++ {
+ vcpu := DomainStatsVcpu{}
+ vcpuInfo := getDomainStatsVcpuFieldInfo(j, &vcpu)
+
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), vcpuInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
+ }
+ if count == 0 {
+ vcpu.StateSet = true
+ vcpu.State = VCPU_OFFLINE
+ }
+ domstats.Vcpu[j] = vcpu
+ }
+ }
+
+ if lengths.BlockCountSet && lengths.BlockCount > 0 {
+ domstats.Block = make([]DomainStatsBlock, lengths.BlockCount)
+ for j := 0; j < int(lengths.BlockCount); j++ {
+ block := DomainStatsBlock{}
+ blockInfo := getDomainStatsBlockFieldInfo(j, &block)
+
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), blockInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
+ }
+ if count != 0 {
+ domstats.Block[j] = block
+ }
+ }
+ }
+
+ if lengths.NetCountSet && lengths.NetCount > 0 {
+ domstats.Net = make([]DomainStatsNet, lengths.NetCount)
+ for j := 0; j < int(lengths.NetCount); j++ {
+ net := DomainStatsNet{}
+ netInfo := getDomainStatsNetFieldInfo(j, &net)
+
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), netInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
+ }
+ if count != 0 {
+ domstats.Net[j] = net
+ }
+ }
+ }
+
+ stats[i] = domstats
+ }
+
+ for i := 0; i < len(stats); i++ {
+ C.virDomainRef(stats[i].Domain.ptr)
+ }
+
+ return stats, nil
+}
+
+type NodeSEVParameters struct {
+ PDHSet bool
+ PDH string
+ CertChainSet bool
+ CertChain string
+ CBitPosSet bool
+ CBitPos uint
+ ReducedPhysBitsSet bool
+ ReducedPhysBits uint
+}
+
+func getNodeSEVFieldInfo(params *NodeSEVParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_NODE_SEV_PDH: typedParamsFieldInfo{
+ set: &params.PDHSet,
+ s: &params.PDH,
+ },
+ C.VIR_NODE_SEV_CERT_CHAIN: typedParamsFieldInfo{
+ set: &params.CertChainSet,
+ s: &params.CertChain,
+ },
+ C.VIR_NODE_SEV_CBITPOS: typedParamsFieldInfo{
+ set: &params.CBitPosSet,
+ ui: &params.CBitPos,
+ },
+ C.VIR_NODE_SEV_REDUCED_PHYS_BITS: typedParamsFieldInfo{
+ set: &params.ReducedPhysBitsSet,
+ ui: &params.ReducedPhysBits,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetSEVInfo
+func (c *Connect) GetSEVInfo(flags uint32) (*NodeSEVParameters, error) {
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return nil, makeNotImplementedError("virNodeGetSEVInfo")
+ }
+
+ params := &NodeSEVParameters{}
+ info := getNodeSEVFieldInfo(params)
+
+ var cparams *C.virTypedParameter
+ var nparams C.int
+
+ var err C.virError
+ ret := C.virNodeGetSEVInfoWrapper(c.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsFree(cparams, nparams)
+
+ _, gerr := typedParamsUnpackLen(cparams, int(nparams), info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virNWFilterBindingCreateXML
+func (c *Connect) NWFilterBindingCreateXML(xmlConfig string, flags uint32) (*NWFilterBinding, error) {
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return nil, makeNotImplementedError("virNWFilterBindingCreateXML")
+ }
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virNWFilterBindingCreateXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &NWFilterBinding{ptr: ptr}, nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/connect_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/connect_compat.h
new file mode 100644
index 00000000..924b07dd
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/connect_compat.h
@@ -0,0 +1,200 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_CONNECT_COMPAT_H__
+#define LIBVIRT_GO_CONNECT_COMPAT_H__
+
+/* 1.2.1 */
+
+#ifndef VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER
+#define VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER 1 << 16
+#endif
+
+
+/* 1.2.2 */
+
+#ifndef VIR_NODE_CPU_STATS_INTR
+#define VIR_NODE_CPU_STATS_INTR "intr"
+#endif
+
+
+/* 1.2.6 */
+
+#ifndef VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE
+#define VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE 1 << 0
+#endif
+
+
+/* 1.2.8 */
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE 1 << 0
+#endif
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE 1 << 1
+#endif
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT 1 << 2
+#endif
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT 1 << 3
+#endif
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING 1 << 4
+#endif
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED 1 << 5
+#endif
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF 1 << 6
+#endif
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER 1 << 7
+#endif
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS 1U << 31
+#endif
+
+#ifndef VIR_CONNECT_LIST_STORAGE_POOLS_ZFS
+#define VIR_CONNECT_LIST_STORAGE_POOLS_ZFS 1 << 17
+#endif
+
+#if LIBVIR_VERSION_NUMBER < 1002008
+typedef struct _virDomainStatsRecord virDomainStatsRecord;
+typedef virDomainStatsRecord *virDomainStatsRecordPtr;
+struct _virDomainStatsRecord {
+ virDomainPtr dom;
+ virTypedParameterPtr params;
+ int nparams;
+};
+#endif
+
+
+/* 1.2.9 */
+#ifndef VIR_NODE_ALLOC_PAGES_ADD
+#define VIR_NODE_ALLOC_PAGES_ADD 0
+#endif
+
+#ifndef VIR_NODE_ALLOC_PAGES_SET
+#define VIR_NODE_ALLOC_PAGES_SET 1 << 0
+#endif
+
+
+/* 1.2.11 */
+
+#ifndef VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED
+#define VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED 1
+#endif
+
+#ifndef VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED
+#define VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED 2
+#endif
+
+#ifndef VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN
+#define VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN 0
+#endif
+
+#ifndef VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED
+#define VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED 1
+#endif
+
+#ifndef VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL
+#define VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL 2
+#endif
+
+
+/* 1.2.12 */
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING 1 << 30
+#endif
+
+/* 1.2.14 */
+
+#ifndef VIR_CONNECT_BASELINE_CPU_MIGRATABLE
+#define VIR_CONNECT_BASELINE_CPU_MIGRATABLE 1 << 1
+#endif
+
+/* 3.1.0 */
+
+#ifndef VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE
+#define VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE 1 << 18
+#endif
+
+#ifndef VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM
+#define VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM 1 << 12
+#endif
+
+/* 3.4.0 */
+
+#ifndef VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES
+#define VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES 1 << 13
+#endif
+
+#ifndef VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV
+#define VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV 1 << 14
+#endif
+
+#ifndef VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV
+#define VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV 1 << 15
+#endif
+
+
+/* 4.5.0 */
+
+#ifndef VIR_NODE_SEV_CBITPOS
+#define VIR_NODE_SEV_CBITPOS "cbitpos"
+#endif
+
+#ifndef VIR_NODE_SEV_REDUCED_PHYS_BITS
+#define VIR_NODE_SEV_REDUCED_PHYS_BITS "reduced-phys-bits"
+#endif
+
+#ifndef VIR_NODE_SEV_PDH
+#define VIR_NODE_SEV_PDH "pdh"
+#endif
+
+#ifndef VIR_NODE_SEV_CERT_CHAIN
+#define VIR_NODE_SEV_CERT_CHAIN "cert-chain"
+#endif
+
+#if LIBVIR_VERSION_NUMBER < 4005000
+typedef struct _virNWFilterBinding *virNWFilterBindingPtr;
+#endif
+
+#ifndef VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT
+#define VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT 1 << 29
+#endif
+
+#endif /* LIBVIRT_GO_CONNECT_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/connect_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/connect_wrapper.go
new file mode 100644
index 00000000..89727d04
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/connect_wrapper.go
@@ -0,0 +1,1766 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include <stdio.h>
+#include "connect_wrapper.h"
+#include "callbacks_wrapper.h"
+
+extern void closeCallback(virConnectPtr, int, long);
+void closeCallbackHelper(virConnectPtr conn, int reason, void *opaque)
+{
+ closeCallback(conn, reason, (long)opaque);
+}
+
+extern int connectAuthCallback(virConnectCredentialPtr, unsigned int, int);
+int connectAuthCallbackHelper(virConnectCredentialPtr cred, unsigned int ncred, void *cbdata)
+{
+ int *callbackID = cbdata;
+
+ return connectAuthCallback(cred, ncred, *callbackID);
+}
+
+
+char *
+virConnectBaselineCPUWrapper(virConnectPtr conn,
+ const char **xmlCPUs,
+ unsigned int ncpus,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virConnectBaselineCPU(conn, xmlCPUs, ncpus, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virConnectBaselineHypervisorCPUWrapper(virConnectPtr conn,
+ const char *emulator,
+ const char *arch,
+ const char *machine,
+ const char *virttype,
+ const char **xmlCPUs,
+ unsigned int ncpus,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4004000
+ assert(0); // Caller should have checked version
+#else
+ char * ret = virConnectBaselineHypervisorCPU(conn, emulator, arch, machine, virttype, xmlCPUs, ncpus, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virConnectCloseWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectClose(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectCompareCPUWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virConnectCompareCPU(conn, xmlDesc, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectCompareHypervisorCPUWrapper(virConnectPtr conn,
+ const char *emulator,
+ const char *arch,
+ const char *machine,
+ const char *virttype,
+ const char *xmlCPU,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4004000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virConnectCompareHypervisorCPU(conn, emulator, arch, machine, virttype, xmlCPU, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+char *
+virConnectDomainXMLFromNativeWrapper(virConnectPtr conn,
+ const char *nativeFormat,
+ const char *nativeConfig,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virConnectDomainXMLFromNative(conn, nativeFormat, nativeConfig, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virConnectDomainXMLToNativeWrapper(virConnectPtr conn,
+ const char *nativeFormat,
+ const char *domainXml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virConnectDomainXMLToNative(conn, nativeFormat, domainXml, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virConnectFindStoragePoolSourcesWrapper(virConnectPtr conn,
+ const char *type,
+ const char *srcSpec,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virConnectFindStoragePoolSources(conn, type, srcSpec, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectGetAllDomainStatsWrapper(virConnectPtr conn,
+ unsigned int stats,
+ virDomainStatsRecordPtr **retStats,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002008
+ assert(0); // Caller should have checked version
+#else
+ int ret = virConnectGetAllDomainStats(conn, stats, retStats, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virConnectGetCPUModelNamesWrapper(virConnectPtr conn,
+ const char *arch,
+ char ** *models,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virConnectGetCPUModelNames(conn, arch, models, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virConnectGetCapabilitiesWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ char * ret = virConnectGetCapabilities(conn);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virConnectGetDomainCapabilitiesWrapper(virConnectPtr conn,
+ const char *emulatorbin,
+ const char *arch,
+ const char *machine,
+ const char *virttype,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002007
+ assert(0); // Caller should have checked version
+#else
+ char * ret = virConnectGetDomainCapabilities(conn, emulatorbin, arch, machine, virttype, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+char *
+virConnectGetHostnameWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ char * ret = virConnectGetHostname(conn);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectGetLibVersionWrapper(virConnectPtr conn,
+ unsigned long *libVer,
+ virErrorPtr err)
+{
+ int ret = virConnectGetLibVersion(conn, libVer);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectGetMaxVcpusWrapper(virConnectPtr conn,
+ const char *type,
+ virErrorPtr err)
+{
+ int ret = virConnectGetMaxVcpus(conn, type);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virConnectGetSysinfoWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virConnectGetSysinfo(conn, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virConnectGetTypeWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ const char * ret = virConnectGetType(conn);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virConnectGetURIWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ char * ret = virConnectGetURI(conn);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectGetVersionWrapper(virConnectPtr conn,
+ unsigned long *hvVer,
+ virErrorPtr err)
+{
+ int ret = virConnectGetVersion(conn, hvVer);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectIsAliveWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectIsAlive(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectIsEncryptedWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectIsEncrypted(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectIsSecureWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectIsSecure(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListAllDomainsWrapper(virConnectPtr conn,
+ virDomainPtr **domains,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virConnectListAllDomains(conn, domains, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListAllInterfacesWrapper(virConnectPtr conn,
+ virInterfacePtr **ifaces,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virConnectListAllInterfaces(conn, ifaces, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListAllNWFilterBindingsWrapper(virConnectPtr conn,
+ virNWFilterBindingPtr **bindings,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virConnectListAllNWFilterBindings(conn, bindings, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virConnectListAllNWFiltersWrapper(virConnectPtr conn,
+ virNWFilterPtr **filters,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virConnectListAllNWFilters(conn, filters, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListAllNetworksWrapper(virConnectPtr conn,
+ virNetworkPtr **nets,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virConnectListAllNetworks(conn, nets, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListAllNodeDevicesWrapper(virConnectPtr conn,
+ virNodeDevicePtr **devices,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virConnectListAllNodeDevices(conn, devices, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListAllSecretsWrapper(virConnectPtr conn,
+ virSecretPtr **secrets,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virConnectListAllSecrets(conn, secrets, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListAllStoragePoolsWrapper(virConnectPtr conn,
+ virStoragePoolPtr **pools,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virConnectListAllStoragePools(conn, pools, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListDefinedDomainsWrapper(virConnectPtr conn,
+ char ** const names,
+ int maxnames,
+ virErrorPtr err)
+{
+ int ret = virConnectListDefinedDomains(conn, names, maxnames);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListDefinedInterfacesWrapper(virConnectPtr conn,
+ char ** const names,
+ int maxnames,
+ virErrorPtr err)
+{
+ int ret = virConnectListDefinedInterfaces(conn, names, maxnames);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListDefinedNetworksWrapper(virConnectPtr conn,
+ char ** const names,
+ int maxnames,
+ virErrorPtr err)
+{
+ int ret = virConnectListDefinedNetworks(conn, names, maxnames);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListDefinedStoragePoolsWrapper(virConnectPtr conn,
+ char ** const names,
+ int maxnames,
+ virErrorPtr err)
+{
+ int ret = virConnectListDefinedStoragePools(conn, names, maxnames);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListDomainsWrapper(virConnectPtr conn,
+ int *ids,
+ int maxids,
+ virErrorPtr err)
+{
+ int ret = virConnectListDomains(conn, ids, maxids);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListInterfacesWrapper(virConnectPtr conn,
+ char ** const names,
+ int maxnames,
+ virErrorPtr err)
+{
+ int ret = virConnectListInterfaces(conn, names, maxnames);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListNWFiltersWrapper(virConnectPtr conn,
+ char ** const names,
+ int maxnames,
+ virErrorPtr err)
+{
+ int ret = virConnectListNWFilters(conn, names, maxnames);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListNetworksWrapper(virConnectPtr conn,
+ char ** const names,
+ int maxnames,
+ virErrorPtr err)
+{
+ int ret = virConnectListNetworks(conn, names, maxnames);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListSecretsWrapper(virConnectPtr conn,
+ char **uuids,
+ int maxuuids,
+ virErrorPtr err)
+{
+ int ret = virConnectListSecrets(conn, uuids, maxuuids);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectListStoragePoolsWrapper(virConnectPtr conn,
+ char ** const names,
+ int maxnames,
+ virErrorPtr err)
+{
+ int ret = virConnectListStoragePools(conn, names, maxnames);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectNumOfDefinedDomainsWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectNumOfDefinedDomains(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectNumOfDefinedInterfacesWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectNumOfDefinedInterfaces(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectNumOfDefinedNetworksWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectNumOfDefinedNetworks(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectNumOfDefinedStoragePoolsWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectNumOfDefinedStoragePools(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectNumOfDomainsWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectNumOfDomains(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectNumOfInterfacesWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectNumOfInterfaces(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectNumOfNWFiltersWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectNumOfNWFilters(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectNumOfNetworksWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectNumOfNetworks(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectNumOfSecretsWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectNumOfSecrets(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectNumOfStoragePoolsWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectNumOfStoragePools(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virConnectPtr
+virConnectOpenWrapper(const char *name,
+ virErrorPtr err)
+{
+ virConnectPtr ret = virConnectOpen(name);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virConnectPtr
+virConnectOpenAuthWrapper(const char *name,
+ int *credtype,
+ unsigned int ncredtype,
+ int callbackID,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virConnectAuth auth = {
+ .credtype = credtype,
+ .ncredtype = ncredtype,
+ .cb = connectAuthCallbackHelper,
+ .cbdata = &callbackID,
+ };
+
+ virConnectPtr ret = virConnectOpenAuth(name, &auth, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virConnectPtr
+virConnectOpenReadOnlyWrapper(const char *name,
+ virErrorPtr err)
+{
+ virConnectPtr ret = virConnectOpenReadOnly(name);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectRefWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectRef(conn);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectRegisterCloseCallbackWrapper(virConnectPtr conn,
+ long goCallbackId,
+ virErrorPtr err)
+{
+ void *id = (void*)goCallbackId;
+ int ret = virConnectRegisterCloseCallback(conn, closeCallbackHelper, id, freeGoCallbackHelper);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectSetKeepAliveWrapper(virConnectPtr conn,
+ int interval,
+ unsigned int count,
+ virErrorPtr err)
+{
+ int ret = virConnectSetKeepAlive(conn, interval, count);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectUnregisterCloseCallbackWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ int ret = virConnectUnregisterCloseCallback(conn, closeCallbackHelper);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainCreateLinuxWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainCreateLinux(conn, xmlDesc, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainCreateXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainCreateXML(conn, xmlDesc, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainCreateXMLWithFilesWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int nfiles,
+ int *files,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainCreateXMLWithFiles(conn, xmlDesc, nfiles, files, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainDefineXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainDefineXML(conn, xml);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainDefineXMLFlagsWrapper(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002012
+ assert(0); // Caller should have checked version
+#else
+ virDomainPtr ret = virDomainDefineXMLFlags(conn, xml, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainListGetStatsWrapper(virDomainPtr *doms,
+ unsigned int stats,
+ virDomainStatsRecordPtr **retStats,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002008
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainListGetStats(doms, stats, retStats, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+virDomainPtr
+virDomainLookupByIDWrapper(virConnectPtr conn,
+ int id,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainLookupByID(conn, id);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainLookupByName(conn, name);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainLookupByUUIDWrapper(virConnectPtr conn,
+ const unsigned char *uuid,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainLookupByUUID(conn, uuid);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainLookupByUUIDStringWrapper(virConnectPtr conn,
+ const char *uuidstr,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainLookupByUUIDString(conn, uuidstr);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainRestoreWrapper(virConnectPtr conn,
+ const char *from,
+ virErrorPtr err)
+{
+ int ret = virDomainRestore(conn, from);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainRestoreFlagsWrapper(virConnectPtr conn,
+ const char *from,
+ const char *dxml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainRestoreFlags(conn, from, dxml, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSaveImageDefineXMLWrapper(virConnectPtr conn,
+ const char *file,
+ const char *dxml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSaveImageDefineXML(conn, file, dxml, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virDomainSaveImageGetXMLDescWrapper(virConnectPtr conn,
+ const char *file,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virDomainSaveImageGetXMLDesc(conn, file, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+void
+virDomainStatsRecordListFreeWrapper(virDomainStatsRecordPtr *stats)
+{
+#if LIBVIR_VERSION_NUMBER < 1002008
+ assert(0); // Caller should have checked version
+#else
+ virDomainStatsRecordListFree(stats);
+#endif
+}
+
+
+int
+virGetVersionWrapper(unsigned long *libVer,
+ const char *type,
+ unsigned long *typeVer,
+ virErrorPtr err)
+{
+ int ret = virGetVersion(libVer, type, typeVer);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virInterfaceChangeBeginWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virInterfaceChangeBegin(conn, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virInterfaceChangeCommitWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virInterfaceChangeCommit(conn, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virInterfaceChangeRollbackWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virInterfaceChangeRollback(conn, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virInterfacePtr
+virInterfaceDefineXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virInterfacePtr ret = virInterfaceDefineXML(conn, xml, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virInterfacePtr
+virInterfaceLookupByMACStringWrapper(virConnectPtr conn,
+ const char *macstr,
+ virErrorPtr err)
+{
+ virInterfacePtr ret = virInterfaceLookupByMACString(conn, macstr);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virInterfacePtr
+virInterfaceLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err)
+{
+ virInterfacePtr ret = virInterfaceLookupByName(conn, name);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNWFilterBindingPtr
+virNWFilterBindingCreateXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ virNWFilterBindingPtr ret = virNWFilterBindingCreateXML(conn, xml, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+virNWFilterBindingPtr
+virNWFilterBindingLookupByPortDevWrapper(virConnectPtr conn,
+ const char *portdev,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ virNWFilterBindingPtr ret = virNWFilterBindingLookupByPortDev(conn, portdev);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+virNWFilterPtr
+virNWFilterDefineXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ virErrorPtr err)
+{
+ virNWFilterPtr ret = virNWFilterDefineXML(conn, xmlDesc);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNWFilterPtr
+virNWFilterLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err)
+{
+ virNWFilterPtr ret = virNWFilterLookupByName(conn, name);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNWFilterPtr
+virNWFilterLookupByUUIDWrapper(virConnectPtr conn,
+ const unsigned char *uuid,
+ virErrorPtr err)
+{
+ virNWFilterPtr ret = virNWFilterLookupByUUID(conn, uuid);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNWFilterPtr
+virNWFilterLookupByUUIDStringWrapper(virConnectPtr conn,
+ const char *uuidstr,
+ virErrorPtr err)
+{
+ virNWFilterPtr ret = virNWFilterLookupByUUIDString(conn, uuidstr);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNetworkPtr
+virNetworkCreateXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ virErrorPtr err)
+{
+ virNetworkPtr ret = virNetworkCreateXML(conn, xmlDesc);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNetworkPtr
+virNetworkDefineXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ virErrorPtr err)
+{
+ virNetworkPtr ret = virNetworkDefineXML(conn, xml);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNetworkPtr
+virNetworkLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err)
+{
+ virNetworkPtr ret = virNetworkLookupByName(conn, name);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNetworkPtr
+virNetworkLookupByUUIDWrapper(virConnectPtr conn,
+ const unsigned char *uuid,
+ virErrorPtr err)
+{
+ virNetworkPtr ret = virNetworkLookupByUUID(conn, uuid);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNetworkPtr
+virNetworkLookupByUUIDStringWrapper(virConnectPtr conn,
+ const char *uuidstr,
+ virErrorPtr err)
+{
+ virNetworkPtr ret = virNetworkLookupByUUIDString(conn, uuidstr);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeAllocPagesWrapper(virConnectPtr conn,
+ unsigned int npages,
+ unsigned int *pageSizes,
+ unsigned long long *pageCounts,
+ int startCell,
+ unsigned int cellCount,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002009
+ assert(0); // Caller should have checked version
+#else
+ int ret = virNodeAllocPages(conn, npages, pageSizes, pageCounts, startCell, cellCount, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+virNodeDevicePtr
+virNodeDeviceCreateXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virNodeDevicePtr ret = virNodeDeviceCreateXML(conn, xmlDesc, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNodeDevicePtr
+virNodeDeviceLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err)
+{
+ virNodeDevicePtr ret = virNodeDeviceLookupByName(conn, name);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virNodeDevicePtr
+virNodeDeviceLookupSCSIHostByWWNWrapper(virConnectPtr conn,
+ const char *wwnn,
+ const char *wwpn,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virNodeDevicePtr ret = virNodeDeviceLookupSCSIHostByWWN(conn, wwnn, wwpn, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeGetCPUMapWrapper(virConnectPtr conn,
+ unsigned char **cpumap,
+ unsigned int *online,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virNodeGetCPUMap(conn, cpumap, online, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeGetCPUStatsWrapper(virConnectPtr conn,
+ int cpuNum,
+ virNodeCPUStatsPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virNodeGetCPUStats(conn, cpuNum, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeGetCellsFreeMemoryWrapper(virConnectPtr conn,
+ unsigned long long *freeMems,
+ int startCell,
+ int maxCells,
+ virErrorPtr err)
+{
+ int ret = virNodeGetCellsFreeMemory(conn, freeMems, startCell, maxCells);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+unsigned long long
+virNodeGetFreeMemoryWrapper(virConnectPtr conn,
+ virErrorPtr err)
+{
+ unsigned long long ret = virNodeGetFreeMemory(conn);
+ if (ret == 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeGetFreePagesWrapper(virConnectPtr conn,
+ unsigned int npages,
+ unsigned int *pages,
+ int startCell,
+ unsigned int cellCount,
+ unsigned long long *counts,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002006
+ assert(0); // Caller should have checked version
+#else
+ int ret = virNodeGetFreePages(conn, npages, pages, startCell, cellCount, counts, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virNodeGetInfoWrapper(virConnectPtr conn,
+ virNodeInfoPtr info,
+ virErrorPtr err)
+{
+ int ret = virNodeGetInfo(conn, info);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeGetMemoryParametersWrapper(virConnectPtr conn,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virNodeGetMemoryParameters(conn, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeGetMemoryStatsWrapper(virConnectPtr conn,
+ int cellNum,
+ virNodeMemoryStatsPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virNodeGetMemoryStats(conn, cellNum, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeGetSEVInfoWrapper(virConnectPtr conn,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virNodeGetSEVInfo(conn, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virNodeGetSecurityModelWrapper(virConnectPtr conn,
+ virSecurityModelPtr secmodel,
+ virErrorPtr err)
+{
+ int ret = virNodeGetSecurityModel(conn, secmodel);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeListDevicesWrapper(virConnectPtr conn,
+ const char *cap,
+ char ** const names,
+ int maxnames,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virNodeListDevices(conn, cap, names, maxnames, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeNumOfDevicesWrapper(virConnectPtr conn,
+ const char *cap,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virNodeNumOfDevices(conn, cap, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeSetMemoryParametersWrapper(virConnectPtr conn,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virNodeSetMemoryParameters(conn, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeSuspendForDurationWrapper(virConnectPtr conn,
+ unsigned int target,
+ unsigned long long duration,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virNodeSuspendForDuration(conn, target, duration, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virSecretPtr
+virSecretDefineXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virSecretPtr ret = virSecretDefineXML(conn, xml, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virSecretPtr
+virSecretLookupByUUIDWrapper(virConnectPtr conn,
+ const unsigned char *uuid,
+ virErrorPtr err)
+{
+ virSecretPtr ret = virSecretLookupByUUID(conn, uuid);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virSecretPtr
+virSecretLookupByUUIDStringWrapper(virConnectPtr conn,
+ const char *uuidstr,
+ virErrorPtr err)
+{
+ virSecretPtr ret = virSecretLookupByUUIDString(conn, uuidstr);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virSecretPtr
+virSecretLookupByUsageWrapper(virConnectPtr conn,
+ int usageType,
+ const char *usageID,
+ virErrorPtr err)
+{
+ virSecretPtr ret = virSecretLookupByUsage(conn, usageType, usageID);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStoragePoolPtr
+virStoragePoolCreateXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virStoragePoolPtr ret = virStoragePoolCreateXML(conn, xmlDesc, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStoragePoolPtr
+virStoragePoolDefineXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virStoragePoolPtr ret = virStoragePoolDefineXML(conn, xml, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStoragePoolPtr
+virStoragePoolLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err)
+{
+ virStoragePoolPtr ret = virStoragePoolLookupByName(conn, name);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStoragePoolPtr
+virStoragePoolLookupByTargetPathWrapper(virConnectPtr conn,
+ const char *path,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4001000
+ assert(0); // Caller should have checked version
+#else
+ virStoragePoolPtr ret = virStoragePoolLookupByTargetPath(conn, path);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+virStoragePoolPtr
+virStoragePoolLookupByUUIDWrapper(virConnectPtr conn,
+ const unsigned char *uuid,
+ virErrorPtr err)
+{
+ virStoragePoolPtr ret = virStoragePoolLookupByUUID(conn, uuid);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStoragePoolPtr
+virStoragePoolLookupByUUIDStringWrapper(virConnectPtr conn,
+ const char *uuidstr,
+ virErrorPtr err)
+{
+ virStoragePoolPtr ret = virStoragePoolLookupByUUIDString(conn, uuidstr);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStorageVolPtr
+virStorageVolLookupByKeyWrapper(virConnectPtr conn,
+ const char *key,
+ virErrorPtr err)
+{
+ virStorageVolPtr ret = virStorageVolLookupByKey(conn, key);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStorageVolPtr
+virStorageVolLookupByPathWrapper(virConnectPtr conn,
+ const char *path,
+ virErrorPtr err)
+{
+ virStorageVolPtr ret = virStorageVolLookupByPath(conn, path);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStreamPtr
+virStreamNewWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virStreamPtr ret = virStreamNew(conn, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+////////////////////////////////////////////////
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/connect_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/connect_wrapper.h
new file mode 100644
index 00000000..5c282d21
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/connect_wrapper.h
@@ -0,0 +1,730 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_CONNECT_WRAPPER_H__
+#define LIBVIRT_GO_CONNECT_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "connect_compat.h"
+
+void
+closeCallbackHelper(virConnectPtr conn,
+ int reason,
+ void *opaque);
+
+int
+virConnectRegisterCloseCallbackHelper(virConnectPtr c,
+ virConnectCloseFunc cb,
+ long goCallbackId);
+
+char *
+virConnectBaselineCPUWrapper(virConnectPtr conn,
+ const char **xmlCPUs,
+ unsigned int ncpus,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virConnectBaselineHypervisorCPUWrapper(virConnectPtr conn,
+ const char *emulator,
+ const char *arch,
+ const char *machine,
+ const char *virttype,
+ const char **xmlCPUs,
+ unsigned int ncpus,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectCloseWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectCompareCPUWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectCompareHypervisorCPUWrapper(virConnectPtr conn,
+ const char *emulator,
+ const char *arch,
+ const char *machine,
+ const char *virttype,
+ const char *xmlCPU,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virConnectDomainXMLFromNativeWrapper(virConnectPtr conn,
+ const char *nativeFormat,
+ const char *nativeConfig,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virConnectDomainXMLToNativeWrapper(virConnectPtr conn,
+ const char *nativeFormat,
+ const char *domainXml,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virConnectFindStoragePoolSourcesWrapper(virConnectPtr conn,
+ const char *type,
+ const char *srcSpec,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectGetAllDomainStatsWrapper(virConnectPtr conn,
+ unsigned int stats,
+ virDomainStatsRecordPtr **retStats,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectGetCPUModelNamesWrapper(virConnectPtr conn,
+ const char *arch,
+ char ***models,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virConnectGetCapabilitiesWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+char *
+virConnectGetDomainCapabilitiesWrapper(virConnectPtr conn,
+ const char *emulatorbin,
+ const char *arch,
+ const char *machine,
+ const char *virttype,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virConnectGetHostnameWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectGetLibVersionWrapper(virConnectPtr conn,
+ unsigned long *libVer,
+ virErrorPtr err);
+
+int
+virConnectGetMaxVcpusWrapper(virConnectPtr conn,
+ const char *type,
+ virErrorPtr err);
+
+char *
+virConnectGetSysinfoWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err);
+
+const char *
+virConnectGetTypeWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+char *
+virConnectGetURIWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectGetVersionWrapper(virConnectPtr conn,
+ unsigned long *hvVer,
+ virErrorPtr err);
+
+int
+virConnectIsAliveWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectIsEncryptedWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectIsSecureWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectListAllDomainsWrapper(virConnectPtr conn,
+ virDomainPtr **domains,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectListAllInterfacesWrapper(virConnectPtr conn,
+ virInterfacePtr **ifaces,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectListAllNWFilterBindingsWrapper(virConnectPtr conn,
+ virNWFilterBindingPtr **bindings,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectListAllNWFiltersWrapper(virConnectPtr conn,
+ virNWFilterPtr **filters,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectListAllNetworksWrapper(virConnectPtr conn,
+ virNetworkPtr **nets,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectListAllNodeDevicesWrapper(virConnectPtr conn,
+ virNodeDevicePtr **devices,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectListAllSecretsWrapper(virConnectPtr conn,
+ virSecretPtr **secrets,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectListAllStoragePoolsWrapper(virConnectPtr conn,
+ virStoragePoolPtr **pools,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virConnectListDefinedDomainsWrapper(virConnectPtr conn,
+ char **const names,
+ int maxnames,
+ virErrorPtr err);
+
+int
+virConnectListDefinedInterfacesWrapper(virConnectPtr conn,
+ char **const names,
+ int maxnames,
+ virErrorPtr err);
+
+int
+virConnectListDefinedNetworksWrapper(virConnectPtr conn,
+ char **const names,
+ int maxnames,
+ virErrorPtr err);
+
+int
+virConnectListDefinedStoragePoolsWrapper(virConnectPtr conn,
+ char **const names,
+ int maxnames,
+ virErrorPtr err);
+
+int
+virConnectListDomainsWrapper(virConnectPtr conn,
+ int *ids,
+ int maxids,
+ virErrorPtr err);
+
+int
+virConnectListInterfacesWrapper(virConnectPtr conn,
+ char **const names,
+ int maxnames,
+ virErrorPtr err);
+
+int
+virConnectListNWFiltersWrapper(virConnectPtr conn,
+ char **const names,
+ int maxnames,
+ virErrorPtr err);
+
+int
+virConnectListNetworksWrapper(virConnectPtr conn,
+ char **const names,
+ int maxnames,
+ virErrorPtr err);
+
+int
+virConnectListSecretsWrapper(virConnectPtr conn,
+ char **uuids,
+ int maxuuids,
+ virErrorPtr err);
+
+int
+virConnectListStoragePoolsWrapper(virConnectPtr conn,
+ char **const names,
+ int maxnames,
+ virErrorPtr err);
+
+int
+virConnectNumOfDefinedDomainsWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectNumOfDefinedInterfacesWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectNumOfDefinedNetworksWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectNumOfDefinedStoragePoolsWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectNumOfDomainsWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectNumOfInterfacesWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectNumOfNWFiltersWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectNumOfNetworksWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectNumOfSecretsWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectNumOfStoragePoolsWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+virConnectPtr
+virConnectOpenWrapper(const char *name,
+ virErrorPtr err);
+
+virConnectPtr
+virConnectOpenAuthWrapper(const char *name,
+ int *credtype,
+ unsigned int ncredtype,
+ int callbackID,
+ unsigned int flags,
+ virErrorPtr err);
+
+virConnectPtr
+virConnectOpenReadOnlyWrapper(const char *name,
+ virErrorPtr err);
+
+int
+virConnectRefWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virConnectRegisterCloseCallbackWrapper(virConnectPtr conn,
+ long goCallbackId,
+ virErrorPtr err);
+
+int
+virConnectSetKeepAliveWrapper(virConnectPtr conn,
+ int interval,
+ unsigned int count,
+ virErrorPtr err);
+
+int
+virConnectUnregisterCloseCallbackWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainCreateLinuxWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainCreateXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainCreateXMLWithFilesWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int nfiles,
+ int *files,
+ unsigned int flags,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainDefineXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainDefineXMLFlagsWrapper(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainListGetStatsWrapper(virDomainPtr *doms,
+ unsigned int stats,
+ virDomainStatsRecordPtr **retStats,
+ unsigned int flags,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainLookupByIDWrapper(virConnectPtr conn,
+ int id,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainLookupByUUIDWrapper(virConnectPtr conn,
+ const unsigned char *uuid,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainLookupByUUIDStringWrapper(virConnectPtr conn,
+ const char *uuidstr,
+ virErrorPtr err);
+
+int
+virDomainRestoreWrapper(virConnectPtr conn,
+ const char *from,
+ virErrorPtr err);
+
+int
+virDomainRestoreFlagsWrapper(virConnectPtr conn,
+ const char *from,
+ const char *dxml,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSaveImageDefineXMLWrapper(virConnectPtr conn,
+ const char *file,
+ const char *dxml,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virDomainSaveImageGetXMLDescWrapper(virConnectPtr conn,
+ const char *file,
+ unsigned int flags,
+ virErrorPtr err);
+
+void
+virDomainStatsRecordListFreeWrapper(virDomainStatsRecordPtr *stats);
+
+int
+virGetVersionWrapper(unsigned long *libVer,
+ const char *type,
+ unsigned long *typeVer,
+ virErrorPtr err);
+
+int
+virInterfaceChangeBeginWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virInterfaceChangeCommitWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virInterfaceChangeRollbackWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err);
+
+virInterfacePtr
+virInterfaceDefineXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err);
+
+virInterfacePtr
+virInterfaceLookupByMACStringWrapper(virConnectPtr conn,
+ const char *macstr,
+ virErrorPtr err);
+
+virInterfacePtr
+virInterfaceLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err);
+
+virNWFilterBindingPtr
+virNWFilterBindingCreateXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err);
+
+virNWFilterBindingPtr
+virNWFilterBindingLookupByPortDevWrapper(virConnectPtr conn,
+ const char *portdev,
+ virErrorPtr err);
+
+virNWFilterPtr
+virNWFilterDefineXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ virErrorPtr err);
+
+virNWFilterPtr
+virNWFilterLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err);
+
+virNWFilterPtr
+virNWFilterLookupByUUIDWrapper(virConnectPtr conn,
+ const unsigned char *uuid,
+ virErrorPtr err);
+
+virNWFilterPtr
+virNWFilterLookupByUUIDStringWrapper(virConnectPtr conn,
+ const char *uuidstr,
+ virErrorPtr err);
+
+virNetworkPtr
+virNetworkCreateXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ virErrorPtr err);
+
+virNetworkPtr
+virNetworkDefineXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ virErrorPtr err);
+
+virNetworkPtr
+virNetworkLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err);
+
+virNetworkPtr
+virNetworkLookupByUUIDWrapper(virConnectPtr conn,
+ const unsigned char *uuid,
+ virErrorPtr err);
+
+virNetworkPtr
+virNetworkLookupByUUIDStringWrapper(virConnectPtr conn,
+ const char *uuidstr,
+ virErrorPtr err);
+
+int
+virNodeAllocPagesWrapper(virConnectPtr conn,
+ unsigned int npages,
+ unsigned int *pageSizes,
+ unsigned long long *pageCounts,
+ int startCell,
+ unsigned int cellCount,
+ unsigned int flags,
+ virErrorPtr err);
+
+virNodeDevicePtr
+virNodeDeviceCreateXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err);
+
+virNodeDevicePtr
+virNodeDeviceLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err);
+
+virNodeDevicePtr
+virNodeDeviceLookupSCSIHostByWWNWrapper(virConnectPtr conn,
+ const char *wwnn,
+ const char *wwpn,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeGetCPUMapWrapper(virConnectPtr conn,
+ unsigned char **cpumap,
+ unsigned int *online,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeGetCPUStatsWrapper(virConnectPtr conn,
+ int cpuNum,
+ virNodeCPUStatsPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeGetCellsFreeMemoryWrapper(virConnectPtr conn,
+ unsigned long long *freeMems,
+ int startCell,
+ int maxCells,
+ virErrorPtr err);
+
+unsigned long long
+virNodeGetFreeMemoryWrapper(virConnectPtr conn,
+ virErrorPtr err);
+
+int
+virNodeGetFreePagesWrapper(virConnectPtr conn,
+ unsigned int npages,
+ unsigned int *pages,
+ int startCell,
+ unsigned int cellCount,
+ unsigned long long *counts,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeGetInfoWrapper(virConnectPtr conn,
+ virNodeInfoPtr info,
+ virErrorPtr err);
+
+int
+virNodeGetMemoryParametersWrapper(virConnectPtr conn,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeGetMemoryStatsWrapper(virConnectPtr conn,
+ int cellNum,
+ virNodeMemoryStatsPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeGetSEVInfoWrapper(virConnectPtr conn,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeGetSecurityModelWrapper(virConnectPtr conn,
+ virSecurityModelPtr secmodel,
+ virErrorPtr err);
+
+int
+virNodeListDevicesWrapper(virConnectPtr conn,
+ const char *cap,
+ char **const names,
+ int maxnames,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeNumOfDevicesWrapper(virConnectPtr conn,
+ const char *cap,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeSetMemoryParametersWrapper(virConnectPtr conn,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeSuspendForDurationWrapper(virConnectPtr conn,
+ unsigned int target,
+ unsigned long long duration,
+ unsigned int flags,
+ virErrorPtr err);
+
+virSecretPtr
+virSecretDefineXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err);
+
+virSecretPtr
+virSecretLookupByUUIDWrapper(virConnectPtr conn,
+ const unsigned char *uuid,
+ virErrorPtr err);
+
+virSecretPtr
+virSecretLookupByUUIDStringWrapper(virConnectPtr conn,
+ const char *uuidstr,
+ virErrorPtr err);
+
+virSecretPtr
+virSecretLookupByUsageWrapper(virConnectPtr conn,
+ int usageType,
+ const char *usageID,
+ virErrorPtr err);
+
+virStoragePoolPtr
+virStoragePoolCreateXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err);
+
+virStoragePoolPtr
+virStoragePoolDefineXMLWrapper(virConnectPtr conn,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err);
+
+virStoragePoolPtr
+virStoragePoolLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ virErrorPtr err);
+
+virStoragePoolPtr
+virStoragePoolLookupByTargetPathWrapper(virConnectPtr conn,
+ const char *path,
+ virErrorPtr err);
+
+virStoragePoolPtr
+virStoragePoolLookupByUUIDWrapper(virConnectPtr conn,
+ const unsigned char *uuid,
+ virErrorPtr err);
+
+virStoragePoolPtr
+virStoragePoolLookupByUUIDStringWrapper(virConnectPtr conn,
+ const char *uuidstr,
+ virErrorPtr err);
+
+virStorageVolPtr
+virStorageVolLookupByKeyWrapper(virConnectPtr conn,
+ const char *key,
+ virErrorPtr err);
+
+virStorageVolPtr
+virStorageVolLookupByPathWrapper(virConnectPtr conn,
+ const char *path,
+ virErrorPtr err);
+
+virStreamPtr
+virStreamNewWrapper(virConnectPtr conn,
+ unsigned int flags,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_CONNECT_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/doc.go b/src/dma/vendor/github.com/libvirt/libvirt-go/doc.go
new file mode 100644
index 00000000..55d75b0c
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/doc.go
@@ -0,0 +1,141 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+// Package libvirt provides a Go binding to the libvirt C library
+//
+// Through conditional compilation it supports libvirt versions 1.2.0 onwards.
+// This is done automatically, with no requirement to use magic Go build tags.
+// If an API was not available in the particular version of libvirt this package
+// was built against, an error will be returned with a code of ERR_NO_SUPPORT.
+// This is the same code seen if using a new libvirt library to talk to an old
+// libvirtd lacking the API, or if a hypervisor does not support a given feature,
+// so an application can easily handle all scenarios together.
+//
+// The Go binding is a fairly direct mapping of the underling C API which seeks
+// to maximise the use of the Go type system to allow strong compiler type
+// checking. The following rules describe how APIs/constants are mapped from C
+// to Go
+//
+// For structs, the 'vir' prefix and 'Ptr' suffix are removed from the name.
+// e.g. virConnectPtr in C becomes 'Connect' in Go.
+//
+// For structs which are reference counted at the C level, it is neccessary to
+// explicitly release the reference at the Go level. e.g. if a Go method returns
+// a '* Domain' struct, it is neccessary to call 'Free' on this when no longer
+// required. The use of 'defer' is recommended for this purpose
+//
+// dom, err := conn.LookupDomainByName("myguest")
+// if err != nil {
+// ...
+// }
+// defer dom.Free()
+//
+// If multiple goroutines are using the same libvirt object struct, it may
+// not be possible to determine which goroutine should call 'Free'. In such
+// scenarios each new goroutine should call 'Ref' to obtain a private reference
+// on the underlying C struct. All goroutines can call 'Free' unconditionally
+// with the final one causing the release of the C object.
+//
+// For methods, the 'vir' prefix and object name prefix are remove from the name.
+// The C functions become methods with an object receiver. e.g.
+// 'virDomainScreenshot' in C becomes 'Screenshot' with a 'Domain *' receiver.
+//
+// For methods which accept a 'unsigned int flags' parameter in the C level,
+// the corresponding Go parameter will be a named type corresponding to the
+// C enum that defines the valid flags. For example, the ListAllDomains
+// method takes a 'flags ConnectListAllDomainsFlags' parameter. If there are
+// not currently any flags defined for a method in the C API, then the Go
+// method parameter will be declared as a "flags uint32". Callers should always
+// pass the literal integer value 0 for such parameters, without forcing any
+// specific type. This will allow compatibility with future updates to the
+// libvirt-go binding which may replace the 'uint32' type with a enum type
+// at a later date.
+//
+// For enums, the VIR_ prefix is removed from the name. The enums get a dedicated
+// type defined in Go. e.g. the VIR_NODE_SUSPEND_TARGET_MEM enum constant in C,
+// becomes NODE_SUSPEND_TARGET_MEM with a type of NodeSuspendTarget.
+//
+// Methods accepting or returning virTypedParameter arrays in C will map the
+// parameters into a Go struct. The struct will contain two fields for each
+// possible parameter. One boolean field with a suffix of 'Set' indicates whether
+// the parameter has a value set, and the other custom typed field provides the
+// parameter value. This makes it possible to distinguish a parameter with a
+// default value of '0' from a parameter which is 0 because it isn't supported by
+// the hypervisor. If the C API defines additional typed parameters, then the
+// corresponding Go struct will be extended to have further fields.
+// e.g. the GetMemoryStats method in Go (which is backed by
+// virNodeGetMemoryStats in C) will return a NodeMemoryStats struct containing
+// the typed parameter values.
+//
+// stats, err := conn.GetMemoryParameters()
+// if err != nil {
+// ....
+// }
+// if stats.TotalSet {
+// fmt.Printf("Total memory: %d KB", stats.Total)
+// }
+//
+// Every method that can fail will include an 'error' object as the last return
+// value. This will be an instance of the Error struct if an error occurred. To
+// check for specific libvirt error codes, it is neccessary to cast the error.
+//
+// err := storage_vol.Wipe(0)
+// if err != nil {
+// lverr, ok := err.(libvirt.Error)
+// if ok && lverr.Code == libvirt.ERR_NO_SUPPORT {
+// fmt.Println("Wiping storage volumes is not supported");
+// } else {
+// fmt.Println("Error wiping storage volume: %s", err)
+// }
+// }
+//
+// Example usage
+//
+// To connect to libvirt
+//
+// import (
+// libvirt "github.com/libvirt/libvirt-go"
+// )
+// conn, err := libvirt.NewConnect("qemu:///system")
+// if err != nil {
+// ...
+// }
+// defer conn.Close()
+//
+// doms, err := conn.ListAllDomains(libvirt.CONNECT_LIST_DOMAINS_ACTIVE)
+// if err != nil {
+// ...
+// }
+//
+// fmt.Printf("%d running domains:\n", len(doms))
+// for _, dom := range doms {
+// name, err := dom.GetName()
+// if err == nil {
+// fmt.Printf(" %s\n", name)
+// }
+// dom.Free()
+// }
+//
+package libvirt
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/domain.go b/src/dma/vendor/github.com/libvirt/libvirt-go/domain.go
new file mode 100644
index 00000000..3a3ef5b7
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/domain.go
@@ -0,0 +1,4766 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "domain_wrapper.h"
+#include "connect_wrapper.h"
+*/
+import "C"
+
+import (
+ "fmt"
+ "os"
+ "reflect"
+ "strconv"
+ "strings"
+ "unsafe"
+)
+
+const (
+ DOMAIN_SEND_KEY_MAX_KEYS = uint32(C.VIR_DOMAIN_SEND_KEY_MAX_KEYS)
+)
+
+type DomainState int
+
+const (
+ DOMAIN_NOSTATE = DomainState(C.VIR_DOMAIN_NOSTATE)
+ DOMAIN_RUNNING = DomainState(C.VIR_DOMAIN_RUNNING)
+ DOMAIN_BLOCKED = DomainState(C.VIR_DOMAIN_BLOCKED)
+ DOMAIN_PAUSED = DomainState(C.VIR_DOMAIN_PAUSED)
+ DOMAIN_SHUTDOWN = DomainState(C.VIR_DOMAIN_SHUTDOWN)
+ DOMAIN_CRASHED = DomainState(C.VIR_DOMAIN_CRASHED)
+ DOMAIN_PMSUSPENDED = DomainState(C.VIR_DOMAIN_PMSUSPENDED)
+ DOMAIN_SHUTOFF = DomainState(C.VIR_DOMAIN_SHUTOFF)
+)
+
+type DomainMetadataType int
+
+const (
+ DOMAIN_METADATA_DESCRIPTION = DomainMetadataType(C.VIR_DOMAIN_METADATA_DESCRIPTION)
+ DOMAIN_METADATA_TITLE = DomainMetadataType(C.VIR_DOMAIN_METADATA_TITLE)
+ DOMAIN_METADATA_ELEMENT = DomainMetadataType(C.VIR_DOMAIN_METADATA_ELEMENT)
+)
+
+type DomainVcpuFlags int
+
+const (
+ DOMAIN_VCPU_CONFIG = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_CONFIG)
+ DOMAIN_VCPU_CURRENT = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_CURRENT)
+ DOMAIN_VCPU_LIVE = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_LIVE)
+ DOMAIN_VCPU_MAXIMUM = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_MAXIMUM)
+ DOMAIN_VCPU_GUEST = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_GUEST)
+ DOMAIN_VCPU_HOTPLUGGABLE = DomainVcpuFlags(C.VIR_DOMAIN_VCPU_HOTPLUGGABLE)
+)
+
+type DomainModificationImpact int
+
+const (
+ DOMAIN_AFFECT_CONFIG = DomainModificationImpact(C.VIR_DOMAIN_AFFECT_CONFIG)
+ DOMAIN_AFFECT_CURRENT = DomainModificationImpact(C.VIR_DOMAIN_AFFECT_CURRENT)
+ DOMAIN_AFFECT_LIVE = DomainModificationImpact(C.VIR_DOMAIN_AFFECT_LIVE)
+)
+
+type DomainMemoryModFlags int
+
+const (
+ DOMAIN_MEM_CONFIG = DomainMemoryModFlags(C.VIR_DOMAIN_MEM_CONFIG)
+ DOMAIN_MEM_CURRENT = DomainMemoryModFlags(C.VIR_DOMAIN_MEM_CURRENT)
+ DOMAIN_MEM_LIVE = DomainMemoryModFlags(C.VIR_DOMAIN_MEM_LIVE)
+ DOMAIN_MEM_MAXIMUM = DomainMemoryModFlags(C.VIR_DOMAIN_MEM_MAXIMUM)
+)
+
+type DomainDestroyFlags int
+
+const (
+ DOMAIN_DESTROY_DEFAULT = DomainDestroyFlags(C.VIR_DOMAIN_DESTROY_DEFAULT)
+ DOMAIN_DESTROY_GRACEFUL = DomainDestroyFlags(C.VIR_DOMAIN_DESTROY_GRACEFUL)
+)
+
+type DomainShutdownFlags int
+
+const (
+ DOMAIN_SHUTDOWN_DEFAULT = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_DEFAULT)
+ DOMAIN_SHUTDOWN_ACPI_POWER_BTN = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)
+ DOMAIN_SHUTDOWN_GUEST_AGENT = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_GUEST_AGENT)
+ DOMAIN_SHUTDOWN_INITCTL = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_INITCTL)
+ DOMAIN_SHUTDOWN_SIGNAL = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_SIGNAL)
+ DOMAIN_SHUTDOWN_PARAVIRT = DomainShutdownFlags(C.VIR_DOMAIN_SHUTDOWN_PARAVIRT)
+)
+
+type DomainUndefineFlagsValues int
+
+const (
+ DOMAIN_UNDEFINE_MANAGED_SAVE = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) // Also remove any managed save
+ DOMAIN_UNDEFINE_SNAPSHOTS_METADATA = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA) // If last use of domain, then also remove any snapshot metadata
+ DOMAIN_UNDEFINE_NVRAM = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_NVRAM) // Also remove any nvram file
+ DOMAIN_UNDEFINE_KEEP_NVRAM = DomainUndefineFlagsValues(C.VIR_DOMAIN_UNDEFINE_KEEP_NVRAM) // Keep nvram file
+)
+
+type DomainDeviceModifyFlags int
+
+const (
+ DOMAIN_DEVICE_MODIFY_CONFIG = DomainDeviceModifyFlags(C.VIR_DOMAIN_DEVICE_MODIFY_CONFIG)
+ DOMAIN_DEVICE_MODIFY_CURRENT = DomainDeviceModifyFlags(C.VIR_DOMAIN_DEVICE_MODIFY_CURRENT)
+ DOMAIN_DEVICE_MODIFY_LIVE = DomainDeviceModifyFlags(C.VIR_DOMAIN_DEVICE_MODIFY_LIVE)
+ DOMAIN_DEVICE_MODIFY_FORCE = DomainDeviceModifyFlags(C.VIR_DOMAIN_DEVICE_MODIFY_FORCE)
+)
+
+type DomainCreateFlags int
+
+const (
+ DOMAIN_NONE = DomainCreateFlags(C.VIR_DOMAIN_NONE)
+ DOMAIN_START_PAUSED = DomainCreateFlags(C.VIR_DOMAIN_START_PAUSED)
+ DOMAIN_START_AUTODESTROY = DomainCreateFlags(C.VIR_DOMAIN_START_AUTODESTROY)
+ DOMAIN_START_BYPASS_CACHE = DomainCreateFlags(C.VIR_DOMAIN_START_BYPASS_CACHE)
+ DOMAIN_START_FORCE_BOOT = DomainCreateFlags(C.VIR_DOMAIN_START_FORCE_BOOT)
+ DOMAIN_START_VALIDATE = DomainCreateFlags(C.VIR_DOMAIN_START_VALIDATE)
+)
+
+const DOMAIN_MEMORY_PARAM_UNLIMITED = C.VIR_DOMAIN_MEMORY_PARAM_UNLIMITED
+
+type DomainEventType int
+
+const (
+ DOMAIN_EVENT_DEFINED = DomainEventType(C.VIR_DOMAIN_EVENT_DEFINED)
+ DOMAIN_EVENT_UNDEFINED = DomainEventType(C.VIR_DOMAIN_EVENT_UNDEFINED)
+ DOMAIN_EVENT_STARTED = DomainEventType(C.VIR_DOMAIN_EVENT_STARTED)
+ DOMAIN_EVENT_SUSPENDED = DomainEventType(C.VIR_DOMAIN_EVENT_SUSPENDED)
+ DOMAIN_EVENT_RESUMED = DomainEventType(C.VIR_DOMAIN_EVENT_RESUMED)
+ DOMAIN_EVENT_STOPPED = DomainEventType(C.VIR_DOMAIN_EVENT_STOPPED)
+ DOMAIN_EVENT_SHUTDOWN = DomainEventType(C.VIR_DOMAIN_EVENT_SHUTDOWN)
+ DOMAIN_EVENT_PMSUSPENDED = DomainEventType(C.VIR_DOMAIN_EVENT_PMSUSPENDED)
+ DOMAIN_EVENT_CRASHED = DomainEventType(C.VIR_DOMAIN_EVENT_CRASHED)
+)
+
+type DomainEventWatchdogAction int
+
+// The action that is to be taken due to the watchdog device firing
+const (
+ // No action, watchdog ignored
+ DOMAIN_EVENT_WATCHDOG_NONE = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_NONE)
+
+ // Guest CPUs are paused
+ DOMAIN_EVENT_WATCHDOG_PAUSE = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_PAUSE)
+
+ // Guest CPUs are reset
+ DOMAIN_EVENT_WATCHDOG_RESET = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_RESET)
+
+ // Guest is forcibly powered off
+ DOMAIN_EVENT_WATCHDOG_POWEROFF = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF)
+
+ // Guest is requested to gracefully shutdown
+ DOMAIN_EVENT_WATCHDOG_SHUTDOWN = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN)
+
+ // No action, a debug message logged
+ DOMAIN_EVENT_WATCHDOG_DEBUG = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_DEBUG)
+
+ // Inject a non-maskable interrupt into guest
+ DOMAIN_EVENT_WATCHDOG_INJECTNMI = DomainEventWatchdogAction(C.VIR_DOMAIN_EVENT_WATCHDOG_INJECTNMI)
+)
+
+type DomainEventIOErrorAction int
+
+// The action that is to be taken due to an IO error occurring
+const (
+ // No action, IO error ignored
+ DOMAIN_EVENT_IO_ERROR_NONE = DomainEventIOErrorAction(C.VIR_DOMAIN_EVENT_IO_ERROR_NONE)
+
+ // Guest CPUs are paused
+ DOMAIN_EVENT_IO_ERROR_PAUSE = DomainEventIOErrorAction(C.VIR_DOMAIN_EVENT_IO_ERROR_PAUSE)
+
+ // IO error reported to guest OS
+ DOMAIN_EVENT_IO_ERROR_REPORT = DomainEventIOErrorAction(C.VIR_DOMAIN_EVENT_IO_ERROR_REPORT)
+)
+
+type DomainEventGraphicsPhase int
+
+// The phase of the graphics client connection
+const (
+ // Initial socket connection established
+ DOMAIN_EVENT_GRAPHICS_CONNECT = DomainEventGraphicsPhase(C.VIR_DOMAIN_EVENT_GRAPHICS_CONNECT)
+
+ // Authentication & setup completed
+ DOMAIN_EVENT_GRAPHICS_INITIALIZE = DomainEventGraphicsPhase(C.VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE)
+
+ // Final socket disconnection
+ DOMAIN_EVENT_GRAPHICS_DISCONNECT = DomainEventGraphicsPhase(C.VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT)
+)
+
+type DomainEventGraphicsAddressType int
+
+const (
+ // IPv4 address
+ DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4 = DomainEventGraphicsAddressType(C.VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4)
+
+ // IPv6 address
+ DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6 = DomainEventGraphicsAddressType(C.VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6)
+
+ // UNIX socket path
+ DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX = DomainEventGraphicsAddressType(C.VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX)
+)
+
+type DomainBlockJobType int
+
+const (
+ // Placeholder
+ DOMAIN_BLOCK_JOB_TYPE_UNKNOWN = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN)
+
+ // Block Pull (virDomainBlockPull, or virDomainBlockRebase without
+ // flags), job ends on completion
+ DOMAIN_BLOCK_JOB_TYPE_PULL = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_PULL)
+
+ // Block Copy (virDomainBlockCopy, or virDomainBlockRebase with
+ // flags), job exists as long as mirroring is active
+ DOMAIN_BLOCK_JOB_TYPE_COPY = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_COPY)
+
+ // Block Commit (virDomainBlockCommit without flags), job ends on
+ // completion
+ DOMAIN_BLOCK_JOB_TYPE_COMMIT = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT)
+
+ // Active Block Commit (virDomainBlockCommit with flags), job
+ // exists as long as sync is active
+ DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT = DomainBlockJobType(C.VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT)
+)
+
+type DomainRunningReason int
+
+const (
+ DOMAIN_RUNNING_UNKNOWN = DomainRunningReason(C.VIR_DOMAIN_RUNNING_UNKNOWN)
+ DOMAIN_RUNNING_BOOTED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_BOOTED) /* normal startup from boot */
+ DOMAIN_RUNNING_MIGRATED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_MIGRATED) /* migrated from another host */
+ DOMAIN_RUNNING_RESTORED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_RESTORED) /* restored from a state file */
+ DOMAIN_RUNNING_FROM_SNAPSHOT = DomainRunningReason(C.VIR_DOMAIN_RUNNING_FROM_SNAPSHOT) /* restored from snapshot */
+ DOMAIN_RUNNING_UNPAUSED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_UNPAUSED) /* returned from paused state */
+ DOMAIN_RUNNING_MIGRATION_CANCELED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_MIGRATION_CANCELED) /* returned from migration */
+ DOMAIN_RUNNING_SAVE_CANCELED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_SAVE_CANCELED) /* returned from failed save process */
+ DOMAIN_RUNNING_WAKEUP = DomainRunningReason(C.VIR_DOMAIN_RUNNING_WAKEUP) /* returned from pmsuspended due to wakeup event */
+ DOMAIN_RUNNING_CRASHED = DomainRunningReason(C.VIR_DOMAIN_RUNNING_CRASHED) /* resumed from crashed */
+ DOMAIN_RUNNING_POSTCOPY = DomainRunningReason(C.VIR_DOMAIN_RUNNING_POSTCOPY) /* running in post-copy migration mode */
+)
+
+type DomainPausedReason int
+
+const (
+ DOMAIN_PAUSED_UNKNOWN = DomainPausedReason(C.VIR_DOMAIN_PAUSED_UNKNOWN) /* the reason is unknown */
+ DOMAIN_PAUSED_USER = DomainPausedReason(C.VIR_DOMAIN_PAUSED_USER) /* paused on user request */
+ DOMAIN_PAUSED_MIGRATION = DomainPausedReason(C.VIR_DOMAIN_PAUSED_MIGRATION) /* paused for offline migration */
+ DOMAIN_PAUSED_SAVE = DomainPausedReason(C.VIR_DOMAIN_PAUSED_SAVE) /* paused for save */
+ DOMAIN_PAUSED_DUMP = DomainPausedReason(C.VIR_DOMAIN_PAUSED_DUMP) /* paused for offline core dump */
+ DOMAIN_PAUSED_IOERROR = DomainPausedReason(C.VIR_DOMAIN_PAUSED_IOERROR) /* paused due to a disk I/O error */
+ DOMAIN_PAUSED_WATCHDOG = DomainPausedReason(C.VIR_DOMAIN_PAUSED_WATCHDOG) /* paused due to a watchdog event */
+ DOMAIN_PAUSED_FROM_SNAPSHOT = DomainPausedReason(C.VIR_DOMAIN_PAUSED_FROM_SNAPSHOT) /* paused after restoring from snapshot */
+ DOMAIN_PAUSED_SHUTTING_DOWN = DomainPausedReason(C.VIR_DOMAIN_PAUSED_SHUTTING_DOWN) /* paused during shutdown process */
+ DOMAIN_PAUSED_SNAPSHOT = DomainPausedReason(C.VIR_DOMAIN_PAUSED_SNAPSHOT) /* paused while creating a snapshot */
+ DOMAIN_PAUSED_CRASHED = DomainPausedReason(C.VIR_DOMAIN_PAUSED_CRASHED) /* paused due to a guest crash */
+ DOMAIN_PAUSED_STARTING_UP = DomainPausedReason(C.VIR_DOMAIN_PAUSED_STARTING_UP) /* the domainis being started */
+ DOMAIN_PAUSED_POSTCOPY = DomainPausedReason(C.VIR_DOMAIN_PAUSED_POSTCOPY) /* paused for post-copy migration */
+ DOMAIN_PAUSED_POSTCOPY_FAILED = DomainPausedReason(C.VIR_DOMAIN_PAUSED_POSTCOPY_FAILED) /* paused after failed post-copy */
+)
+
+type DomainXMLFlags int
+
+const (
+ DOMAIN_XML_SECURE = DomainXMLFlags(C.VIR_DOMAIN_XML_SECURE) /* dump security sensitive information too */
+ DOMAIN_XML_INACTIVE = DomainXMLFlags(C.VIR_DOMAIN_XML_INACTIVE) /* dump inactive domain information */
+ DOMAIN_XML_UPDATE_CPU = DomainXMLFlags(C.VIR_DOMAIN_XML_UPDATE_CPU) /* update guest CPU requirements according to host CPU */
+ DOMAIN_XML_MIGRATABLE = DomainXMLFlags(C.VIR_DOMAIN_XML_MIGRATABLE) /* dump XML suitable for migration */
+)
+
+type DomainEventDefinedDetailType int
+
+const (
+ DOMAIN_EVENT_DEFINED_ADDED = DomainEventDefinedDetailType(C.VIR_DOMAIN_EVENT_DEFINED_ADDED)
+ DOMAIN_EVENT_DEFINED_UPDATED = DomainEventDefinedDetailType(C.VIR_DOMAIN_EVENT_DEFINED_UPDATED)
+ DOMAIN_EVENT_DEFINED_RENAMED = DomainEventDefinedDetailType(C.VIR_DOMAIN_EVENT_DEFINED_RENAMED)
+ DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT = DomainEventDefinedDetailType(C.VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT)
+)
+
+type DomainEventUndefinedDetailType int
+
+const (
+ DOMAIN_EVENT_UNDEFINED_REMOVED = DomainEventUndefinedDetailType(C.VIR_DOMAIN_EVENT_UNDEFINED_REMOVED)
+ DOMAIN_EVENT_UNDEFINED_RENAMED = DomainEventUndefinedDetailType(C.VIR_DOMAIN_EVENT_UNDEFINED_RENAMED)
+)
+
+type DomainEventStartedDetailType int
+
+const (
+ DOMAIN_EVENT_STARTED_BOOTED = DomainEventStartedDetailType(C.VIR_DOMAIN_EVENT_STARTED_BOOTED)
+ DOMAIN_EVENT_STARTED_MIGRATED = DomainEventStartedDetailType(C.VIR_DOMAIN_EVENT_STARTED_MIGRATED)
+ DOMAIN_EVENT_STARTED_RESTORED = DomainEventStartedDetailType(C.VIR_DOMAIN_EVENT_STARTED_RESTORED)
+ DOMAIN_EVENT_STARTED_FROM_SNAPSHOT = DomainEventStartedDetailType(C.VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT)
+ DOMAIN_EVENT_STARTED_WAKEUP = DomainEventStartedDetailType(C.VIR_DOMAIN_EVENT_STARTED_WAKEUP)
+)
+
+type DomainEventSuspendedDetailType int
+
+const (
+ DOMAIN_EVENT_SUSPENDED_PAUSED = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_PAUSED)
+ DOMAIN_EVENT_SUSPENDED_MIGRATED = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED)
+ DOMAIN_EVENT_SUSPENDED_IOERROR = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_IOERROR)
+ DOMAIN_EVENT_SUSPENDED_WATCHDOG = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG)
+ DOMAIN_EVENT_SUSPENDED_RESTORED = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_RESTORED)
+ DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT)
+ DOMAIN_EVENT_SUSPENDED_API_ERROR = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR)
+ DOMAIN_EVENT_SUSPENDED_POSTCOPY = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY)
+ DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED = DomainEventSuspendedDetailType(C.VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED)
+)
+
+type DomainEventResumedDetailType int
+
+const (
+ DOMAIN_EVENT_RESUMED_UNPAUSED = DomainEventResumedDetailType(C.VIR_DOMAIN_EVENT_RESUMED_UNPAUSED)
+ DOMAIN_EVENT_RESUMED_MIGRATED = DomainEventResumedDetailType(C.VIR_DOMAIN_EVENT_RESUMED_MIGRATED)
+ DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT = DomainEventResumedDetailType(C.VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT)
+ DOMAIN_EVENT_RESUMED_POSTCOPY = DomainEventResumedDetailType(C.VIR_DOMAIN_EVENT_RESUMED_POSTCOPY)
+)
+
+type DomainEventStoppedDetailType int
+
+const (
+ DOMAIN_EVENT_STOPPED_SHUTDOWN = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN)
+ DOMAIN_EVENT_STOPPED_DESTROYED = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_DESTROYED)
+ DOMAIN_EVENT_STOPPED_CRASHED = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_CRASHED)
+ DOMAIN_EVENT_STOPPED_MIGRATED = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_MIGRATED)
+ DOMAIN_EVENT_STOPPED_SAVED = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_SAVED)
+ DOMAIN_EVENT_STOPPED_FAILED = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_FAILED)
+ DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT = DomainEventStoppedDetailType(C.VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT)
+)
+
+type DomainEventShutdownDetailType int
+
+const (
+ DOMAIN_EVENT_SHUTDOWN_FINISHED = DomainEventShutdownDetailType(C.VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED)
+ DOMAIN_EVENT_SHUTDOWN_GUEST = DomainEventShutdownDetailType(C.VIR_DOMAIN_EVENT_SHUTDOWN_GUEST)
+ DOMAIN_EVENT_SHUTDOWN_HOST = DomainEventShutdownDetailType(C.VIR_DOMAIN_EVENT_SHUTDOWN_HOST)
+)
+
+type DomainMemoryStatTags int
+
+const (
+ DOMAIN_MEMORY_STAT_LAST = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_NR)
+ DOMAIN_MEMORY_STAT_SWAP_IN = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_SWAP_IN)
+ DOMAIN_MEMORY_STAT_SWAP_OUT = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_SWAP_OUT)
+ DOMAIN_MEMORY_STAT_MAJOR_FAULT = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT)
+ DOMAIN_MEMORY_STAT_MINOR_FAULT = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT)
+ DOMAIN_MEMORY_STAT_UNUSED = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_UNUSED)
+ DOMAIN_MEMORY_STAT_AVAILABLE = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_AVAILABLE)
+ DOMAIN_MEMORY_STAT_ACTUAL_BALLOON = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON)
+ DOMAIN_MEMORY_STAT_RSS = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_RSS)
+ DOMAIN_MEMORY_STAT_USABLE = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_USABLE)
+ DOMAIN_MEMORY_STAT_LAST_UPDATE = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE)
+ DOMAIN_MEMORY_STAT_DISK_CACHES = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_DISK_CACHES)
+ DOMAIN_MEMORY_STAT_NR = DomainMemoryStatTags(C.VIR_DOMAIN_MEMORY_STAT_NR)
+)
+
+type DomainCPUStatsTags string
+
+const (
+ DOMAIN_CPU_STATS_CPUTIME = DomainCPUStatsTags(C.VIR_DOMAIN_CPU_STATS_CPUTIME)
+ DOMAIN_CPU_STATS_SYSTEMTIME = DomainCPUStatsTags(C.VIR_DOMAIN_CPU_STATS_SYSTEMTIME)
+ DOMAIN_CPU_STATS_USERTIME = DomainCPUStatsTags(C.VIR_DOMAIN_CPU_STATS_USERTIME)
+ DOMAIN_CPU_STATS_VCPUTIME = DomainCPUStatsTags(C.VIR_DOMAIN_CPU_STATS_VCPUTIME)
+)
+
+type DomainInterfaceAddressesSource int
+
+const (
+ DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE = DomainInterfaceAddressesSource(C.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE)
+ DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT = DomainInterfaceAddressesSource(C.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT)
+ DOMAIN_INTERFACE_ADDRESSES_SRC_ARP = DomainInterfaceAddressesSource(C.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP)
+)
+
+type KeycodeSet int
+
+const (
+ KEYCODE_SET_LINUX = KeycodeSet(C.VIR_KEYCODE_SET_LINUX)
+ KEYCODE_SET_XT = KeycodeSet(C.VIR_KEYCODE_SET_XT)
+ KEYCODE_SET_ATSET1 = KeycodeSet(C.VIR_KEYCODE_SET_ATSET1)
+ KEYCODE_SET_ATSET2 = KeycodeSet(C.VIR_KEYCODE_SET_ATSET2)
+ KEYCODE_SET_ATSET3 = KeycodeSet(C.VIR_KEYCODE_SET_ATSET3)
+ KEYCODE_SET_OSX = KeycodeSet(C.VIR_KEYCODE_SET_OSX)
+ KEYCODE_SET_XT_KBD = KeycodeSet(C.VIR_KEYCODE_SET_XT_KBD)
+ KEYCODE_SET_USB = KeycodeSet(C.VIR_KEYCODE_SET_USB)
+ KEYCODE_SET_WIN32 = KeycodeSet(C.VIR_KEYCODE_SET_WIN32)
+ KEYCODE_SET_RFB = KeycodeSet(C.VIR_KEYCODE_SET_RFB)
+ KEYCODE_SET_QNUM = KeycodeSet(C.VIR_KEYCODE_SET_QNUM)
+)
+
+type ConnectDomainEventBlockJobStatus int
+
+const (
+ DOMAIN_BLOCK_JOB_COMPLETED = ConnectDomainEventBlockJobStatus(C.VIR_DOMAIN_BLOCK_JOB_COMPLETED)
+ DOMAIN_BLOCK_JOB_FAILED = ConnectDomainEventBlockJobStatus(C.VIR_DOMAIN_BLOCK_JOB_FAILED)
+ DOMAIN_BLOCK_JOB_CANCELED = ConnectDomainEventBlockJobStatus(C.VIR_DOMAIN_BLOCK_JOB_CANCELED)
+ DOMAIN_BLOCK_JOB_READY = ConnectDomainEventBlockJobStatus(C.VIR_DOMAIN_BLOCK_JOB_READY)
+)
+
+type ConnectDomainEventDiskChangeReason int
+
+const (
+ // OldSrcPath is set
+ DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START = ConnectDomainEventDiskChangeReason(C.VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START)
+ DOMAIN_EVENT_DISK_DROP_MISSING_ON_START = ConnectDomainEventDiskChangeReason(C.VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START)
+)
+
+type ConnectDomainEventTrayChangeReason int
+
+const (
+ DOMAIN_EVENT_TRAY_CHANGE_OPEN = ConnectDomainEventTrayChangeReason(C.VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN)
+ DOMAIN_EVENT_TRAY_CHANGE_CLOSE = ConnectDomainEventTrayChangeReason(C.VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE)
+)
+
+type DomainProcessSignal int
+
+const (
+ DOMAIN_PROCESS_SIGNAL_NOP = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_NOP)
+ DOMAIN_PROCESS_SIGNAL_HUP = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_HUP)
+ DOMAIN_PROCESS_SIGNAL_INT = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_INT)
+ DOMAIN_PROCESS_SIGNAL_QUIT = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_QUIT)
+ DOMAIN_PROCESS_SIGNAL_ILL = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_ILL)
+ DOMAIN_PROCESS_SIGNAL_TRAP = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_TRAP)
+ DOMAIN_PROCESS_SIGNAL_ABRT = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_ABRT)
+ DOMAIN_PROCESS_SIGNAL_BUS = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_BUS)
+ DOMAIN_PROCESS_SIGNAL_FPE = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_FPE)
+ DOMAIN_PROCESS_SIGNAL_KILL = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_KILL)
+
+ DOMAIN_PROCESS_SIGNAL_USR1 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_USR1)
+ DOMAIN_PROCESS_SIGNAL_SEGV = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_SEGV)
+ DOMAIN_PROCESS_SIGNAL_USR2 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_USR2)
+ DOMAIN_PROCESS_SIGNAL_PIPE = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_PIPE)
+ DOMAIN_PROCESS_SIGNAL_ALRM = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_ALRM)
+ DOMAIN_PROCESS_SIGNAL_TERM = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_TERM)
+ DOMAIN_PROCESS_SIGNAL_STKFLT = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_STKFLT)
+ DOMAIN_PROCESS_SIGNAL_CHLD = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_CHLD)
+ DOMAIN_PROCESS_SIGNAL_CONT = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_CONT)
+ DOMAIN_PROCESS_SIGNAL_STOP = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_STOP)
+
+ DOMAIN_PROCESS_SIGNAL_TSTP = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_TSTP)
+ DOMAIN_PROCESS_SIGNAL_TTIN = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_TTIN)
+ DOMAIN_PROCESS_SIGNAL_TTOU = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_TTOU)
+ DOMAIN_PROCESS_SIGNAL_URG = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_URG)
+ DOMAIN_PROCESS_SIGNAL_XCPU = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_XCPU)
+ DOMAIN_PROCESS_SIGNAL_XFSZ = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_XFSZ)
+ DOMAIN_PROCESS_SIGNAL_VTALRM = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_VTALRM)
+ DOMAIN_PROCESS_SIGNAL_PROF = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_PROF)
+ DOMAIN_PROCESS_SIGNAL_WINCH = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_WINCH)
+ DOMAIN_PROCESS_SIGNAL_POLL = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_POLL)
+
+ DOMAIN_PROCESS_SIGNAL_PWR = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_PWR)
+ DOMAIN_PROCESS_SIGNAL_SYS = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_SYS)
+ DOMAIN_PROCESS_SIGNAL_RT0 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT0)
+ DOMAIN_PROCESS_SIGNAL_RT1 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT1)
+ DOMAIN_PROCESS_SIGNAL_RT2 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT2)
+ DOMAIN_PROCESS_SIGNAL_RT3 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT3)
+ DOMAIN_PROCESS_SIGNAL_RT4 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT4)
+ DOMAIN_PROCESS_SIGNAL_RT5 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT5)
+ DOMAIN_PROCESS_SIGNAL_RT6 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT6)
+ DOMAIN_PROCESS_SIGNAL_RT7 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT7)
+
+ DOMAIN_PROCESS_SIGNAL_RT8 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT8)
+ DOMAIN_PROCESS_SIGNAL_RT9 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT9)
+ DOMAIN_PROCESS_SIGNAL_RT10 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT10)
+ DOMAIN_PROCESS_SIGNAL_RT11 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT11)
+ DOMAIN_PROCESS_SIGNAL_RT12 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT12)
+ DOMAIN_PROCESS_SIGNAL_RT13 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT13)
+ DOMAIN_PROCESS_SIGNAL_RT14 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT14)
+ DOMAIN_PROCESS_SIGNAL_RT15 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT15)
+ DOMAIN_PROCESS_SIGNAL_RT16 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT16)
+ DOMAIN_PROCESS_SIGNAL_RT17 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT17)
+ DOMAIN_PROCESS_SIGNAL_RT18 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT18)
+
+ DOMAIN_PROCESS_SIGNAL_RT19 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT19)
+ DOMAIN_PROCESS_SIGNAL_RT20 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT20)
+ DOMAIN_PROCESS_SIGNAL_RT21 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT21)
+ DOMAIN_PROCESS_SIGNAL_RT22 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT22)
+ DOMAIN_PROCESS_SIGNAL_RT23 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT23)
+ DOMAIN_PROCESS_SIGNAL_RT24 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT24)
+ DOMAIN_PROCESS_SIGNAL_RT25 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT25)
+ DOMAIN_PROCESS_SIGNAL_RT26 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT26)
+ DOMAIN_PROCESS_SIGNAL_RT27 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT27)
+
+ DOMAIN_PROCESS_SIGNAL_RT28 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT28)
+ DOMAIN_PROCESS_SIGNAL_RT29 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT29)
+ DOMAIN_PROCESS_SIGNAL_RT30 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT30)
+ DOMAIN_PROCESS_SIGNAL_RT31 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT31)
+ DOMAIN_PROCESS_SIGNAL_RT32 = DomainProcessSignal(C.VIR_DOMAIN_PROCESS_SIGNAL_RT32)
+)
+
+type DomainBlockedReason int
+
+const (
+ DOMAIN_BLOCKED_UNKNOWN = DomainBlockedReason(C.VIR_DOMAIN_BLOCKED_UNKNOWN)
+)
+
+type DomainControlState int
+
+const (
+ DOMAIN_CONTROL_OK = DomainControlState(C.VIR_DOMAIN_CONTROL_OK)
+ DOMAIN_CONTROL_JOB = DomainControlState(C.VIR_DOMAIN_CONTROL_JOB)
+ DOMAIN_CONTROL_OCCUPIED = DomainControlState(C.VIR_DOMAIN_CONTROL_OCCUPIED)
+ DOMAIN_CONTROL_ERROR = DomainControlState(C.VIR_DOMAIN_CONTROL_ERROR)
+)
+
+type DomainControlErrorReason int
+
+const (
+ DOMAIN_CONTROL_ERROR_REASON_NONE = DomainControlErrorReason(C.VIR_DOMAIN_CONTROL_ERROR_REASON_NONE)
+ DOMAIN_CONTROL_ERROR_REASON_UNKNOWN = DomainControlErrorReason(C.VIR_DOMAIN_CONTROL_ERROR_REASON_UNKNOWN)
+ DOMAIN_CONTROL_ERROR_REASON_MONITOR = DomainControlErrorReason(C.VIR_DOMAIN_CONTROL_ERROR_REASON_MONITOR)
+ DOMAIN_CONTROL_ERROR_REASON_INTERNAL = DomainControlErrorReason(C.VIR_DOMAIN_CONTROL_ERROR_REASON_INTERNAL)
+)
+
+type DomainCrashedReason int
+
+const (
+ DOMAIN_CRASHED_UNKNOWN = DomainCrashedReason(C.VIR_DOMAIN_CRASHED_UNKNOWN)
+ DOMAIN_CRASHED_PANICKED = DomainCrashedReason(C.VIR_DOMAIN_CRASHED_PANICKED)
+)
+
+type DomainEventCrashedDetailType int
+
+const (
+ DOMAIN_EVENT_CRASHED_PANICKED = DomainEventCrashedDetailType(C.VIR_DOMAIN_EVENT_CRASHED_PANICKED)
+)
+
+type DomainEventPMSuspendedDetailType int
+
+const (
+ DOMAIN_EVENT_PMSUSPENDED_MEMORY = DomainEventPMSuspendedDetailType(C.VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY)
+ DOMAIN_EVENT_PMSUSPENDED_DISK = DomainEventPMSuspendedDetailType(C.VIR_DOMAIN_EVENT_PMSUSPENDED_DISK)
+)
+
+type DomainNostateReason int
+
+const (
+ DOMAIN_NOSTATE_UNKNOWN = DomainNostateReason(C.VIR_DOMAIN_NOSTATE_UNKNOWN)
+)
+
+type DomainPMSuspendedReason int
+
+const (
+ DOMAIN_PMSUSPENDED_UNKNOWN = DomainPMSuspendedReason(C.VIR_DOMAIN_PMSUSPENDED_UNKNOWN)
+)
+
+type DomainPMSuspendedDiskReason int
+
+const (
+ DOMAIN_PMSUSPENDED_DISK_UNKNOWN = DomainPMSuspendedDiskReason(C.VIR_DOMAIN_PMSUSPENDED_DISK_UNKNOWN)
+)
+
+type DomainShutdownReason int
+
+const (
+ DOMAIN_SHUTDOWN_UNKNOWN = DomainShutdownReason(C.VIR_DOMAIN_SHUTDOWN_UNKNOWN)
+ DOMAIN_SHUTDOWN_USER = DomainShutdownReason(C.VIR_DOMAIN_SHUTDOWN_USER)
+)
+
+type DomainShutoffReason int
+
+const (
+ DOMAIN_SHUTOFF_UNKNOWN = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_UNKNOWN)
+ DOMAIN_SHUTOFF_SHUTDOWN = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_SHUTDOWN)
+ DOMAIN_SHUTOFF_DESTROYED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_DESTROYED)
+ DOMAIN_SHUTOFF_CRASHED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_CRASHED)
+ DOMAIN_SHUTOFF_MIGRATED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_MIGRATED)
+ DOMAIN_SHUTOFF_SAVED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_SAVED)
+ DOMAIN_SHUTOFF_FAILED = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_FAILED)
+ DOMAIN_SHUTOFF_FROM_SNAPSHOT = DomainShutoffReason(C.VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT)
+)
+
+type DomainBlockCommitFlags int
+
+const (
+ DOMAIN_BLOCK_COMMIT_SHALLOW = DomainBlockCommitFlags(C.VIR_DOMAIN_BLOCK_COMMIT_SHALLOW)
+ DOMAIN_BLOCK_COMMIT_DELETE = DomainBlockCommitFlags(C.VIR_DOMAIN_BLOCK_COMMIT_DELETE)
+ DOMAIN_BLOCK_COMMIT_ACTIVE = DomainBlockCommitFlags(C.VIR_DOMAIN_BLOCK_COMMIT_ACTIVE)
+ DOMAIN_BLOCK_COMMIT_RELATIVE = DomainBlockCommitFlags(C.VIR_DOMAIN_BLOCK_COMMIT_RELATIVE)
+ DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES = DomainBlockCommitFlags(C.VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES)
+)
+
+type DomainBlockCopyFlags int
+
+const (
+ DOMAIN_BLOCK_COPY_SHALLOW = DomainBlockCopyFlags(C.VIR_DOMAIN_BLOCK_COPY_SHALLOW)
+ DOMAIN_BLOCK_COPY_REUSE_EXT = DomainBlockCopyFlags(C.VIR_DOMAIN_BLOCK_COPY_REUSE_EXT)
+ DOMAIN_BLOCK_COPY_TRANSIENT_JOB = DomainBlockCopyFlags(C.VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB)
+)
+
+type DomainBlockRebaseFlags int
+
+const (
+ DOMAIN_BLOCK_REBASE_SHALLOW = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_SHALLOW)
+ DOMAIN_BLOCK_REBASE_REUSE_EXT = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)
+ DOMAIN_BLOCK_REBASE_COPY_RAW = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_COPY_RAW)
+ DOMAIN_BLOCK_REBASE_COPY = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_COPY)
+ DOMAIN_BLOCK_REBASE_RELATIVE = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_RELATIVE)
+ DOMAIN_BLOCK_REBASE_COPY_DEV = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_COPY_DEV)
+ DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES = DomainBlockRebaseFlags(C.VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES)
+)
+
+type DomainBlockJobAbortFlags int
+
+const (
+ DOMAIN_BLOCK_JOB_ABORT_ASYNC = DomainBlockJobAbortFlags(C.VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC)
+ DOMAIN_BLOCK_JOB_ABORT_PIVOT = DomainBlockJobAbortFlags(C.VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT)
+)
+
+type DomainBlockJobInfoFlags int
+
+const (
+ DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES = DomainBlockJobInfoFlags(C.VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES)
+)
+
+type DomainBlockJobSetSpeedFlags int
+
+const (
+ DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES = DomainBlockJobSetSpeedFlags(C.VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES)
+)
+
+type DomainBlockPullFlags int
+
+const (
+ DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES = DomainBlockPullFlags(C.VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES)
+)
+
+type DomainBlockResizeFlags int
+
+const (
+ DOMAIN_BLOCK_RESIZE_BYTES = DomainBlockResizeFlags(C.VIR_DOMAIN_BLOCK_RESIZE_BYTES)
+)
+
+type Domain struct {
+ ptr C.virDomainPtr
+}
+
+type DomainChannelFlags int
+
+const (
+ DOMAIN_CHANNEL_FORCE = DomainChannelFlags(C.VIR_DOMAIN_CHANNEL_FORCE)
+)
+
+type DomainConsoleFlags int
+
+const (
+ DOMAIN_CONSOLE_FORCE = DomainConsoleFlags(C.VIR_DOMAIN_CONSOLE_FORCE)
+ DOMAIN_CONSOLE_SAFE = DomainConsoleFlags(C.VIR_DOMAIN_CONSOLE_SAFE)
+)
+
+type DomainCoreDumpFormat int
+
+const (
+ DOMAIN_CORE_DUMP_FORMAT_RAW = DomainCoreDumpFormat(C.VIR_DOMAIN_CORE_DUMP_FORMAT_RAW)
+ DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB = DomainCoreDumpFormat(C.VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB)
+ DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO = DomainCoreDumpFormat(C.VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO)
+ DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY = DomainCoreDumpFormat(C.VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY)
+)
+
+type DomainDefineFlags int
+
+const (
+ DOMAIN_DEFINE_VALIDATE = DomainDefineFlags(C.VIR_DOMAIN_DEFINE_VALIDATE)
+)
+
+type DomainJobType int
+
+const (
+ DOMAIN_JOB_NONE = DomainJobType(C.VIR_DOMAIN_JOB_NONE)
+ DOMAIN_JOB_BOUNDED = DomainJobType(C.VIR_DOMAIN_JOB_BOUNDED)
+ DOMAIN_JOB_UNBOUNDED = DomainJobType(C.VIR_DOMAIN_JOB_UNBOUNDED)
+ DOMAIN_JOB_COMPLETED = DomainJobType(C.VIR_DOMAIN_JOB_COMPLETED)
+ DOMAIN_JOB_FAILED = DomainJobType(C.VIR_DOMAIN_JOB_FAILED)
+ DOMAIN_JOB_CANCELLED = DomainJobType(C.VIR_DOMAIN_JOB_CANCELLED)
+)
+
+type DomainGetJobStatsFlags int
+
+const (
+ DOMAIN_JOB_STATS_COMPLETED = DomainGetJobStatsFlags(C.VIR_DOMAIN_JOB_STATS_COMPLETED)
+)
+
+type DomainNumatuneMemMode int
+
+const (
+ DOMAIN_NUMATUNE_MEM_STRICT = DomainNumatuneMemMode(C.VIR_DOMAIN_NUMATUNE_MEM_STRICT)
+ DOMAIN_NUMATUNE_MEM_PREFERRED = DomainNumatuneMemMode(C.VIR_DOMAIN_NUMATUNE_MEM_PREFERRED)
+ DOMAIN_NUMATUNE_MEM_INTERLEAVE = DomainNumatuneMemMode(C.VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE)
+)
+
+type DomainOpenGraphicsFlags int
+
+const (
+ DOMAIN_OPEN_GRAPHICS_SKIPAUTH = DomainOpenGraphicsFlags(C.VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH)
+)
+
+type DomainSetUserPasswordFlags int
+
+const (
+ DOMAIN_PASSWORD_ENCRYPTED = DomainSetUserPasswordFlags(C.VIR_DOMAIN_PASSWORD_ENCRYPTED)
+)
+
+type DomainRebootFlagValues int
+
+const (
+ DOMAIN_REBOOT_DEFAULT = DomainRebootFlagValues(C.VIR_DOMAIN_REBOOT_DEFAULT)
+ DOMAIN_REBOOT_ACPI_POWER_BTN = DomainRebootFlagValues(C.VIR_DOMAIN_REBOOT_ACPI_POWER_BTN)
+ DOMAIN_REBOOT_GUEST_AGENT = DomainRebootFlagValues(C.VIR_DOMAIN_REBOOT_GUEST_AGENT)
+ DOMAIN_REBOOT_INITCTL = DomainRebootFlagValues(C.VIR_DOMAIN_REBOOT_INITCTL)
+ DOMAIN_REBOOT_SIGNAL = DomainRebootFlagValues(C.VIR_DOMAIN_REBOOT_SIGNAL)
+ DOMAIN_REBOOT_PARAVIRT = DomainRebootFlagValues(C.VIR_DOMAIN_REBOOT_PARAVIRT)
+)
+
+type DomainSaveRestoreFlags int
+
+const (
+ DOMAIN_SAVE_BYPASS_CACHE = DomainSaveRestoreFlags(C.VIR_DOMAIN_SAVE_BYPASS_CACHE)
+ DOMAIN_SAVE_RUNNING = DomainSaveRestoreFlags(C.VIR_DOMAIN_SAVE_RUNNING)
+ DOMAIN_SAVE_PAUSED = DomainSaveRestoreFlags(C.VIR_DOMAIN_SAVE_PAUSED)
+)
+
+type DomainSetTimeFlags int
+
+const (
+ DOMAIN_TIME_SYNC = DomainSetTimeFlags(C.VIR_DOMAIN_TIME_SYNC)
+)
+
+type DomainDiskErrorCode int
+
+const (
+ DOMAIN_DISK_ERROR_NONE = DomainDiskErrorCode(C.VIR_DOMAIN_DISK_ERROR_NONE)
+ DOMAIN_DISK_ERROR_UNSPEC = DomainDiskErrorCode(C.VIR_DOMAIN_DISK_ERROR_UNSPEC)
+ DOMAIN_DISK_ERROR_NO_SPACE = DomainDiskErrorCode(C.VIR_DOMAIN_DISK_ERROR_NO_SPACE)
+)
+
+type DomainStatsTypes int
+
+const (
+ DOMAIN_STATS_STATE = DomainStatsTypes(C.VIR_DOMAIN_STATS_STATE)
+ DOMAIN_STATS_CPU_TOTAL = DomainStatsTypes(C.VIR_DOMAIN_STATS_CPU_TOTAL)
+ DOMAIN_STATS_BALLOON = DomainStatsTypes(C.VIR_DOMAIN_STATS_BALLOON)
+ DOMAIN_STATS_VCPU = DomainStatsTypes(C.VIR_DOMAIN_STATS_VCPU)
+ DOMAIN_STATS_INTERFACE = DomainStatsTypes(C.VIR_DOMAIN_STATS_INTERFACE)
+ DOMAIN_STATS_BLOCK = DomainStatsTypes(C.VIR_DOMAIN_STATS_BLOCK)
+ DOMAIN_STATS_PERF = DomainStatsTypes(C.VIR_DOMAIN_STATS_PERF)
+)
+
+type DomainCoreDumpFlags int
+
+const (
+ DUMP_CRASH = DomainCoreDumpFlags(C.VIR_DUMP_CRASH)
+ DUMP_LIVE = DomainCoreDumpFlags(C.VIR_DUMP_LIVE)
+ DUMP_BYPASS_CACHE = DomainCoreDumpFlags(C.VIR_DUMP_BYPASS_CACHE)
+ DUMP_RESET = DomainCoreDumpFlags(C.VIR_DUMP_RESET)
+ DUMP_MEMORY_ONLY = DomainCoreDumpFlags(C.VIR_DUMP_MEMORY_ONLY)
+)
+
+type DomainMemoryFlags int
+
+const (
+ MEMORY_VIRTUAL = DomainMemoryFlags(C.VIR_MEMORY_VIRTUAL)
+ MEMORY_PHYSICAL = DomainMemoryFlags(C.VIR_MEMORY_PHYSICAL)
+)
+
+type DomainMigrateFlags int
+
+const (
+ MIGRATE_LIVE = DomainMigrateFlags(C.VIR_MIGRATE_LIVE)
+ MIGRATE_PEER2PEER = DomainMigrateFlags(C.VIR_MIGRATE_PEER2PEER)
+ MIGRATE_TUNNELLED = DomainMigrateFlags(C.VIR_MIGRATE_TUNNELLED)
+ MIGRATE_PERSIST_DEST = DomainMigrateFlags(C.VIR_MIGRATE_PERSIST_DEST)
+ MIGRATE_UNDEFINE_SOURCE = DomainMigrateFlags(C.VIR_MIGRATE_UNDEFINE_SOURCE)
+ MIGRATE_PAUSED = DomainMigrateFlags(C.VIR_MIGRATE_PAUSED)
+ MIGRATE_NON_SHARED_DISK = DomainMigrateFlags(C.VIR_MIGRATE_NON_SHARED_DISK)
+ MIGRATE_NON_SHARED_INC = DomainMigrateFlags(C.VIR_MIGRATE_NON_SHARED_INC)
+ MIGRATE_CHANGE_PROTECTION = DomainMigrateFlags(C.VIR_MIGRATE_CHANGE_PROTECTION)
+ MIGRATE_UNSAFE = DomainMigrateFlags(C.VIR_MIGRATE_UNSAFE)
+ MIGRATE_OFFLINE = DomainMigrateFlags(C.VIR_MIGRATE_OFFLINE)
+ MIGRATE_COMPRESSED = DomainMigrateFlags(C.VIR_MIGRATE_COMPRESSED)
+ MIGRATE_ABORT_ON_ERROR = DomainMigrateFlags(C.VIR_MIGRATE_ABORT_ON_ERROR)
+ MIGRATE_AUTO_CONVERGE = DomainMigrateFlags(C.VIR_MIGRATE_AUTO_CONVERGE)
+ MIGRATE_RDMA_PIN_ALL = DomainMigrateFlags(C.VIR_MIGRATE_RDMA_PIN_ALL)
+ MIGRATE_POSTCOPY = DomainMigrateFlags(C.VIR_MIGRATE_POSTCOPY)
+ MIGRATE_TLS = DomainMigrateFlags(C.VIR_MIGRATE_TLS)
+)
+
+type VcpuState int
+
+const (
+ VCPU_OFFLINE = VcpuState(C.VIR_VCPU_OFFLINE)
+ VCPU_RUNNING = VcpuState(C.VIR_VCPU_RUNNING)
+ VCPU_BLOCKED = VcpuState(C.VIR_VCPU_BLOCKED)
+)
+
+type DomainJobOperationType int
+
+const (
+ DOMAIN_JOB_OPERATION_UNKNOWN = DomainJobOperationType(C.VIR_DOMAIN_JOB_OPERATION_UNKNOWN)
+ DOMAIN_JOB_OPERATION_START = DomainJobOperationType(C.VIR_DOMAIN_JOB_OPERATION_START)
+ DOMAIN_JOB_OPERATION_SAVE = DomainJobOperationType(C.VIR_DOMAIN_JOB_OPERATION_SAVE)
+ DOMAIN_JOB_OPERATION_RESTORE = DomainJobOperationType(C.VIR_DOMAIN_JOB_OPERATION_RESTORE)
+ DOMAIN_JOB_OPERATION_MIGRATION_IN = DomainJobOperationType(C.VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN)
+ DOMAIN_JOB_OPERATION_MIGRATION_OUT = DomainJobOperationType(C.VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT)
+ DOMAIN_JOB_OPERATION_SNAPSHOT = DomainJobOperationType(C.VIR_DOMAIN_JOB_OPERATION_SNAPSHOT)
+ DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT = DomainJobOperationType(C.VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT)
+ DOMAIN_JOB_OPERATION_DUMP = DomainJobOperationType(C.VIR_DOMAIN_JOB_OPERATION_DUMP)
+)
+
+type DomainBlockInfo struct {
+ Capacity uint64
+ Allocation uint64
+ Physical uint64
+}
+
+type DomainInfo struct {
+ State DomainState
+ MaxMem uint64
+ Memory uint64
+ NrVirtCpu uint
+ CpuTime uint64
+}
+
+type DomainMemoryStat struct {
+ Tag int32
+ Val uint64
+}
+
+type DomainVcpuInfo struct {
+ Number uint32
+ State int32
+ CpuTime uint64
+ Cpu int32
+ CpuMap []bool
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainFree
+func (d *Domain) Free() error {
+ var err C.virError
+ ret := C.virDomainFreeWrapper(d.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainRef
+func (c *Domain) Ref() error {
+ var err C.virError
+ ret := C.virDomainRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreate
+func (d *Domain) Create() error {
+ var err C.virError
+ result := C.virDomainCreateWrapper(d.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFlags
+func (d *Domain) CreateWithFlags(flags DomainCreateFlags) error {
+ var err C.virError
+ result := C.virDomainCreateWithFlagsWrapper(d.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCreateWithFiles
+func (d *Domain) CreateWithFiles(files []os.File, flags DomainCreateFlags) error {
+ cfiles := make([]C.int, len(files))
+ for i := 0; i < len(files); i++ {
+ cfiles[i] = C.int(files[i].Fd())
+ }
+ var err C.virError
+ result := C.virDomainCreateWithFilesWrapper(d.ptr, C.uint(len(files)), &cfiles[0], C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroy
+func (d *Domain) Destroy() error {
+ var err C.virError
+ result := C.virDomainDestroyWrapper(d.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainShutdown
+func (d *Domain) Shutdown() error {
+ var err C.virError
+ result := C.virDomainShutdownWrapper(d.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReboot
+func (d *Domain) Reboot(flags DomainRebootFlagValues) error {
+ var err C.virError
+ result := C.virDomainRebootWrapper(d.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsActive
+func (d *Domain) IsActive() (bool, error) {
+ var err C.virError
+ result := C.virDomainIsActiveWrapper(d.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsPersistent
+func (d *Domain) IsPersistent() (bool, error) {
+ var err C.virError
+ result := C.virDomainIsPersistentWrapper(d.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainIsUpdated
+func (d *Domain) IsUpdated() (bool, error) {
+ var err C.virError
+ result := C.virDomainIsUpdatedWrapper(d.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetAutostart
+func (d *Domain) SetAutostart(autostart bool) error {
+ var cAutostart C.int
+ switch autostart {
+ case true:
+ cAutostart = 1
+ default:
+ cAutostart = 0
+ }
+ var err C.virError
+ result := C.virDomainSetAutostartWrapper(d.ptr, cAutostart, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetAutostart
+func (d *Domain) GetAutostart() (bool, error) {
+ var out C.int
+ var err C.virError
+ result := C.virDomainGetAutostartWrapper(d.ptr, (*C.int)(unsafe.Pointer(&out)), &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ switch out {
+ case 1:
+ return true, nil
+ default:
+ return false, nil
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlockInfo
+func (d *Domain) GetBlockInfo(disk string, flag uint) (*DomainBlockInfo, error) {
+ var cinfo C.virDomainBlockInfo
+ cDisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cDisk))
+ var err C.virError
+ result := C.virDomainGetBlockInfoWrapper(d.ptr, cDisk, &cinfo, C.uint(flag), &err)
+ if result == -1 {
+ return nil, makeError(&err)
+ }
+
+ return &DomainBlockInfo{
+ Capacity: uint64(cinfo.capacity),
+ Allocation: uint64(cinfo.allocation),
+ Physical: uint64(cinfo.physical),
+ }, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetName
+func (d *Domain) GetName() (string, error) {
+ var err C.virError
+ name := C.virDomainGetNameWrapper(d.ptr, &err)
+ if name == nil {
+ return "", makeError(&err)
+ }
+ return C.GoString(name), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState
+func (d *Domain) GetState() (DomainState, int, error) {
+ var cState C.int
+ var cReason C.int
+ var err C.virError
+ result := C.virDomainGetStateWrapper(d.ptr,
+ (*C.int)(unsafe.Pointer(&cState)),
+ (*C.int)(unsafe.Pointer(&cReason)),
+ 0, &err)
+ if int(result) == -1 {
+ return 0, 0, makeError(&err)
+ }
+ return DomainState(cState), int(cReason), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetID
+func (d *Domain) GetID() (uint, error) {
+ var err C.virError
+ id := uint(C.virDomainGetIDWrapper(d.ptr, &err))
+ if id == ^uint(0) {
+ return id, makeError(&err)
+ }
+ return id, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUID
+func (d *Domain) GetUUID() ([]byte, error) {
+ var cUuid [C.VIR_UUID_BUFLEN](byte)
+ cuidPtr := unsafe.Pointer(&cUuid)
+ var err C.virError
+ result := C.virDomainGetUUIDWrapper(d.ptr, (*C.uchar)(cuidPtr), &err)
+ if result != 0 {
+ return []byte{}, makeError(&err)
+ }
+ return C.GoBytes(cuidPtr, C.VIR_UUID_BUFLEN), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetUUIDString
+func (d *Domain) GetUUIDString() (string, error) {
+ var cUuid [C.VIR_UUID_STRING_BUFLEN](C.char)
+ cuidPtr := unsafe.Pointer(&cUuid)
+ var err C.virError
+ result := C.virDomainGetUUIDStringWrapper(d.ptr, (*C.char)(cuidPtr), &err)
+ if result != 0 {
+ return "", makeError(&err)
+ }
+ return C.GoString((*C.char)(cuidPtr)), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetInfo
+func (d *Domain) GetInfo() (*DomainInfo, error) {
+ var cinfo C.virDomainInfo
+ var err C.virError
+ result := C.virDomainGetInfoWrapper(d.ptr, &cinfo, &err)
+ if result == -1 {
+ return nil, makeError(&err)
+ }
+ return &DomainInfo{
+ State: DomainState(cinfo.state),
+ MaxMem: uint64(cinfo.maxMem),
+ Memory: uint64(cinfo.memory),
+ NrVirtCpu: uint(cinfo.nrVirtCpu),
+ CpuTime: uint64(cinfo.cpuTime),
+ }, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetXMLDesc
+func (d *Domain) GetXMLDesc(flags DomainXMLFlags) (string, error) {
+ var err C.virError
+ result := C.virDomainGetXMLDescWrapper(d.ptr, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ xml := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return xml, nil
+}
+
+type DomainCPUStats struct {
+ CpuTimeSet bool
+ CpuTime uint64
+ UserTimeSet bool
+ UserTime uint64
+ SystemTimeSet bool
+ SystemTime uint64
+ VcpuTimeSet bool
+ VcpuTime uint64
+}
+
+func getCPUStatsFieldInfo(params *DomainCPUStats) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_CPU_STATS_CPUTIME: typedParamsFieldInfo{
+ set: &params.CpuTimeSet,
+ ul: &params.CpuTime,
+ },
+ C.VIR_DOMAIN_CPU_STATS_USERTIME: typedParamsFieldInfo{
+ set: &params.UserTimeSet,
+ ul: &params.UserTime,
+ },
+ C.VIR_DOMAIN_CPU_STATS_SYSTEMTIME: typedParamsFieldInfo{
+ set: &params.SystemTimeSet,
+ ul: &params.SystemTime,
+ },
+ C.VIR_DOMAIN_CPU_STATS_VCPUTIME: typedParamsFieldInfo{
+ set: &params.VcpuTimeSet,
+ ul: &params.VcpuTime,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetCPUStats
+func (d *Domain) GetCPUStats(startCpu int, nCpus uint, flags uint32) ([]DomainCPUStats, error) {
+ var err C.virError
+ if nCpus == 0 {
+ if startCpu == -1 {
+ nCpus = 1
+ } else {
+ ret := C.virDomainGetCPUStatsWrapper(d.ptr, nil, 0, 0, 0, 0, &err)
+ if ret == -1 {
+ return []DomainCPUStats{}, makeError(&err)
+ }
+ nCpus = uint(ret)
+ }
+ }
+
+ ret := C.virDomainGetCPUStatsWrapper(d.ptr, nil, 0, C.int(startCpu), C.uint(nCpus), 0, &err)
+ if ret == -1 {
+ return []DomainCPUStats{}, makeError(&err)
+ }
+ nparams := uint(ret)
+
+ var cparams []C.virTypedParameter
+ var nallocparams uint
+ if startCpu == -1 {
+ nallocparams = nparams
+ } else {
+ nallocparams = nparams * nCpus
+ }
+ cparams = make([]C.virTypedParameter, nallocparams)
+ ret = C.virDomainGetCPUStatsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), C.uint(nparams), C.int(startCpu), C.uint(nCpus), C.uint(flags), &err)
+ if ret == -1 {
+ return []DomainCPUStats{}, makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), C.int(nallocparams))
+
+ stats := make([]DomainCPUStats, nCpus)
+ for i := 0; i < int(nCpus); i++ {
+ offset := i * int(nparams)
+ info := getCPUStatsFieldInfo(&stats[i])
+ cparamscpu := cparams[offset : offset+int(ret)]
+ _, gerr := typedParamsUnpack(cparamscpu, info)
+ if gerr != nil {
+ return []DomainCPUStats{}, gerr
+ }
+ }
+ return stats, nil
+}
+
+type DomainInterfaceParameters struct {
+ BandwidthInAverageSet bool
+ BandwidthInAverage uint
+ BandwidthInPeakSet bool
+ BandwidthInPeak uint
+ BandwidthInBurstSet bool
+ BandwidthInBurst uint
+ BandwidthInFloorSet bool
+ BandwidthInFloor uint
+ BandwidthOutAverageSet bool
+ BandwidthOutAverage uint
+ BandwidthOutPeakSet bool
+ BandwidthOutPeak uint
+ BandwidthOutBurstSet bool
+ BandwidthOutBurst uint
+}
+
+func getInterfaceParameterFieldInfo(params *DomainInterfaceParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_BANDWIDTH_IN_AVERAGE: typedParamsFieldInfo{
+ set: &params.BandwidthInAverageSet,
+ ui: &params.BandwidthInAverage,
+ },
+ C.VIR_DOMAIN_BANDWIDTH_IN_PEAK: typedParamsFieldInfo{
+ set: &params.BandwidthInPeakSet,
+ ui: &params.BandwidthInPeak,
+ },
+ C.VIR_DOMAIN_BANDWIDTH_IN_BURST: typedParamsFieldInfo{
+ set: &params.BandwidthInBurstSet,
+ ui: &params.BandwidthInBurst,
+ },
+ C.VIR_DOMAIN_BANDWIDTH_IN_FLOOR: typedParamsFieldInfo{
+ set: &params.BandwidthInFloorSet,
+ ui: &params.BandwidthInFloor,
+ },
+ C.VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE: typedParamsFieldInfo{
+ set: &params.BandwidthOutAverageSet,
+ ui: &params.BandwidthOutAverage,
+ },
+ C.VIR_DOMAIN_BANDWIDTH_OUT_PEAK: typedParamsFieldInfo{
+ set: &params.BandwidthOutPeakSet,
+ ui: &params.BandwidthOutPeak,
+ },
+ C.VIR_DOMAIN_BANDWIDTH_OUT_BURST: typedParamsFieldInfo{
+ set: &params.BandwidthOutBurstSet,
+ ui: &params.BandwidthOutBurst,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetInterfaceParameters
+func (d *Domain) GetInterfaceParameters(device string, flags DomainModificationImpact) (*DomainInterfaceParameters, error) {
+ params := &DomainInterfaceParameters{}
+ info := getInterfaceParameterFieldInfo(params)
+
+ var nparams C.int
+
+ cdevice := C.CString(device)
+ defer C.free(unsafe.Pointer(cdevice))
+ var err C.virError
+ ret := C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, nil, &nparams, C.uint(0), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ _, gerr := typedParamsUnpack(cparams, info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetInterfaceParameters
+func (d *Domain) SetInterfaceParameters(device string, params *DomainInterfaceParameters, flags DomainModificationImpact) error {
+ info := getInterfaceParameterFieldInfo(params)
+
+ var nparams C.int
+
+ cdevice := C.CString(device)
+ defer C.free(unsafe.Pointer(cdevice))
+ var err C.virError
+ ret := C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, nil, &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ gerr := typedParamsPack(cparams, info)
+ if gerr != nil {
+ return gerr
+ }
+
+ ret = C.virDomainSetInterfaceParametersWrapper(d.ptr, cdevice, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetMetadata
+func (d *Domain) GetMetadata(tipus DomainMetadataType, uri string, flags DomainModificationImpact) (string, error) {
+ var cUri *C.char
+ if uri != "" {
+ cUri = C.CString(uri)
+ defer C.free(unsafe.Pointer(cUri))
+ }
+
+ var err C.virError
+ result := C.virDomainGetMetadataWrapper(d.ptr, C.int(tipus), cUri, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+
+ }
+ defer C.free(unsafe.Pointer(result))
+ return C.GoString(result), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetMetadata
+func (d *Domain) SetMetadata(metaDataType DomainMetadataType, metaDataCont, uriKey, uri string, flags DomainModificationImpact) error {
+ var cMetaDataCont *C.char
+ var cUriKey *C.char
+ var cUri *C.char
+
+ if metaDataCont != "" {
+ cMetaDataCont = C.CString(metaDataCont)
+ defer C.free(unsafe.Pointer(cMetaDataCont))
+ }
+
+ if metaDataType == DOMAIN_METADATA_ELEMENT {
+ if uriKey != "" {
+ cUriKey = C.CString(uriKey)
+ defer C.free(unsafe.Pointer(cUriKey))
+ }
+ cUri = C.CString(uri)
+ defer C.free(unsafe.Pointer(cUri))
+ }
+ var err C.virError
+ result := C.virDomainSetMetadataWrapper(d.ptr, C.int(metaDataType), cMetaDataCont, cUriKey, cUri, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefine
+func (d *Domain) Undefine() error {
+ var err C.virError
+ result := C.virDomainUndefineWrapper(d.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUndefineFlags
+func (d *Domain) UndefineFlags(flags DomainUndefineFlagsValues) error {
+ var err C.virError
+ result := C.virDomainUndefineFlagsWrapper(d.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetMaxMemory
+func (d *Domain) SetMaxMemory(memory uint) error {
+ var err C.virError
+ result := C.virDomainSetMaxMemoryWrapper(d.ptr, C.ulong(memory), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetMemory
+func (d *Domain) SetMemory(memory uint64) error {
+ var err C.virError
+ result := C.virDomainSetMemoryWrapper(d.ptr, C.ulong(memory), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetMemoryFlags
+func (d *Domain) SetMemoryFlags(memory uint64, flags DomainMemoryModFlags) error {
+ var err C.virError
+ result := C.virDomainSetMemoryFlagsWrapper(d.ptr, C.ulong(memory), C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetMemoryStatsPeriod
+func (d *Domain) SetMemoryStatsPeriod(period int, flags DomainMemoryModFlags) error {
+ var err C.virError
+ result := C.virDomainSetMemoryStatsPeriodWrapper(d.ptr, C.int(period), C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetVcpus
+func (d *Domain) SetVcpus(vcpu uint) error {
+ var err C.virError
+ result := C.virDomainSetVcpusWrapper(d.ptr, C.uint(vcpu), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetVcpusFlags
+func (d *Domain) SetVcpusFlags(vcpu uint, flags DomainVcpuFlags) error {
+ var err C.virError
+ result := C.virDomainSetVcpusFlagsWrapper(d.ptr, C.uint(vcpu), C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSuspend
+func (d *Domain) Suspend() error {
+ var err C.virError
+ result := C.virDomainSuspendWrapper(d.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainResume
+func (d *Domain) Resume() error {
+ var err C.virError
+ result := C.virDomainResumeWrapper(d.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainAbortJob
+func (d *Domain) AbortJob() error {
+ var err C.virError
+ result := C.virDomainAbortJobWrapper(d.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDestroyFlags
+func (d *Domain) DestroyFlags(flags DomainDestroyFlags) error {
+ var err C.virError
+ result := C.virDomainDestroyFlagsWrapper(d.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainShutdownFlags
+func (d *Domain) ShutdownFlags(flags DomainShutdownFlags) error {
+ var err C.virError
+ result := C.virDomainShutdownFlagsWrapper(d.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainAttachDevice
+func (d *Domain) AttachDevice(xml string) error {
+ cXml := C.CString(xml)
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ result := C.virDomainAttachDeviceWrapper(d.ptr, cXml, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainAttachDeviceFlags
+func (d *Domain) AttachDeviceFlags(xml string, flags DomainDeviceModifyFlags) error {
+ cXml := C.CString(xml)
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ result := C.virDomainAttachDeviceFlagsWrapper(d.ptr, cXml, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDetachDevice
+func (d *Domain) DetachDevice(xml string) error {
+ cXml := C.CString(xml)
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ result := C.virDomainDetachDeviceWrapper(d.ptr, cXml, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDetachDeviceFlags
+func (d *Domain) DetachDeviceFlags(xml string, flags DomainDeviceModifyFlags) error {
+ cXml := C.CString(xml)
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ result := C.virDomainDetachDeviceFlagsWrapper(d.ptr, cXml, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDetachDeviceAlias
+func (d *Domain) DetachDeviceAlias(alias string, flags DomainDeviceModifyFlags) error {
+ if C.LIBVIR_VERSION_NUMBER < 4004000 {
+ return makeNotImplementedError("virDomainDetachDeviceAlias")
+ }
+
+ cAlias := C.CString(alias)
+ defer C.free(unsafe.Pointer(cAlias))
+ var err C.virError
+ result := C.virDomainDetachDeviceAliasWrapper(d.ptr, cAlias, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainUpdateDeviceFlags
+func (d *Domain) UpdateDeviceFlags(xml string, flags DomainDeviceModifyFlags) error {
+ cXml := C.CString(xml)
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ result := C.virDomainUpdateDeviceFlagsWrapper(d.ptr, cXml, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainScreenshot
+func (d *Domain) Screenshot(stream *Stream, screen, flags uint32) (string, error) {
+ var err C.virError
+ cType := C.virDomainScreenshotWrapper(d.ptr, stream.ptr, C.uint(screen), C.uint(flags), &err)
+ if cType == nil {
+ return "", makeError(&err)
+ }
+ defer C.free(unsafe.Pointer(cType))
+
+ mimeType := C.GoString(cType)
+ return mimeType, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSendKey
+func (d *Domain) SendKey(codeset, holdtime uint, keycodes []uint, flags uint32) error {
+ var err C.virError
+ result := C.virDomainSendKeyWrapper(d.ptr, C.uint(codeset), C.uint(holdtime), (*C.uint)(unsafe.Pointer(&keycodes[0])), C.int(len(keycodes)), C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+type DomainBlockStats struct {
+ RdBytesSet bool
+ RdBytes int64
+ RdReqSet bool
+ RdReq int64
+ RdTotalTimesSet bool
+ RdTotalTimes int64
+ WrBytesSet bool
+ WrBytes int64
+ WrReqSet bool
+ WrReq int64
+ WrTotalTimesSet bool
+ WrTotalTimes int64
+ FlushReqSet bool
+ FlushReq int64
+ FlushTotalTimesSet bool
+ FlushTotalTimes int64
+ ErrsSet bool
+ Errs int64
+}
+
+func getBlockStatsFieldInfo(params *DomainBlockStats) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_BLOCK_STATS_READ_BYTES: typedParamsFieldInfo{
+ set: &params.RdBytesSet,
+ l: &params.RdBytes,
+ },
+ C.VIR_DOMAIN_BLOCK_STATS_READ_REQ: typedParamsFieldInfo{
+ set: &params.RdReqSet,
+ l: &params.RdReq,
+ },
+ C.VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES: typedParamsFieldInfo{
+ set: &params.RdTotalTimesSet,
+ l: &params.RdTotalTimes,
+ },
+ C.VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES: typedParamsFieldInfo{
+ set: &params.WrBytesSet,
+ l: &params.WrBytes,
+ },
+ C.VIR_DOMAIN_BLOCK_STATS_WRITE_REQ: typedParamsFieldInfo{
+ set: &params.WrReqSet,
+ l: &params.WrReq,
+ },
+ C.VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES: typedParamsFieldInfo{
+ set: &params.WrTotalTimesSet,
+ l: &params.WrTotalTimes,
+ },
+ C.VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ: typedParamsFieldInfo{
+ set: &params.FlushReqSet,
+ l: &params.FlushReq,
+ },
+ C.VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES: typedParamsFieldInfo{
+ set: &params.FlushTotalTimesSet,
+ l: &params.FlushTotalTimes,
+ },
+ C.VIR_DOMAIN_BLOCK_STATS_ERRS: typedParamsFieldInfo{
+ set: &params.ErrsSet,
+ l: &params.Errs,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockStatsFlags
+func (d *Domain) BlockStatsFlags(disk string, flags uint32) (*DomainBlockStats, error) {
+ params := &DomainBlockStats{}
+ info := getBlockStatsFieldInfo(params)
+
+ var nparams C.int
+
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+ var err C.virError
+ ret := C.virDomainBlockStatsFlagsWrapper(d.ptr, cdisk, nil, &nparams, C.uint(0), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainBlockStatsFlagsWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ _, gerr := typedParamsUnpack(cparams, info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockStats
+func (d *Domain) BlockStats(path string) (*DomainBlockStats, error) {
+ cPath := C.CString(path)
+ defer C.free(unsafe.Pointer(cPath))
+
+ size := C.size_t(unsafe.Sizeof(C.struct__virDomainBlockStats{}))
+
+ cStats := (C.virDomainBlockStatsPtr)(C.malloc(size))
+ defer C.free(unsafe.Pointer(cStats))
+
+ var err C.virError
+ result := C.virDomainBlockStatsWrapper(d.ptr, cPath, (C.virDomainBlockStatsPtr)(cStats), size, &err)
+
+ if result != 0 {
+ return nil, makeError(&err)
+ }
+ return &DomainBlockStats{
+ WrReqSet: true,
+ WrReq: int64(cStats.wr_req),
+ RdReqSet: true,
+ RdReq: int64(cStats.rd_req),
+ RdBytesSet: true,
+ RdBytes: int64(cStats.rd_bytes),
+ WrBytesSet: true,
+ WrBytes: int64(cStats.wr_bytes),
+ }, nil
+}
+
+type DomainInterfaceStats struct {
+ RxBytesSet bool
+ RxBytes int64
+ RxPacketsSet bool
+ RxPackets int64
+ RxErrsSet bool
+ RxErrs int64
+ RxDropSet bool
+ RxDrop int64
+ TxBytesSet bool
+ TxBytes int64
+ TxPacketsSet bool
+ TxPackets int64
+ TxErrsSet bool
+ TxErrs int64
+ TxDropSet bool
+ TxDrop int64
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainInterfaceStats
+func (d *Domain) InterfaceStats(path string) (*DomainInterfaceStats, error) {
+ cPath := C.CString(path)
+ defer C.free(unsafe.Pointer(cPath))
+
+ size := C.size_t(unsafe.Sizeof(C.struct__virDomainInterfaceStats{}))
+
+ cStats := (C.virDomainInterfaceStatsPtr)(C.malloc(size))
+ defer C.free(unsafe.Pointer(cStats))
+
+ var err C.virError
+ result := C.virDomainInterfaceStatsWrapper(d.ptr, cPath, (C.virDomainInterfaceStatsPtr)(cStats), size, &err)
+
+ if result != 0 {
+ return nil, makeError(&err)
+ }
+ return &DomainInterfaceStats{
+ RxBytesSet: true,
+ RxBytes: int64(cStats.rx_bytes),
+ RxPacketsSet: true,
+ RxPackets: int64(cStats.rx_packets),
+ RxErrsSet: true,
+ RxErrs: int64(cStats.rx_errs),
+ RxDropSet: true,
+ RxDrop: int64(cStats.rx_drop),
+ TxBytesSet: true,
+ TxBytes: int64(cStats.tx_bytes),
+ TxPacketsSet: true,
+ TxPackets: int64(cStats.tx_packets),
+ TxErrsSet: true,
+ TxErrs: int64(cStats.tx_errs),
+ TxDropSet: true,
+ TxDrop: int64(cStats.tx_drop),
+ }, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryStats
+func (d *Domain) MemoryStats(nrStats uint32, flags uint32) ([]DomainMemoryStat, error) {
+ ptr := make([]C.virDomainMemoryStatStruct, nrStats)
+
+ var err C.virError
+ result := C.virDomainMemoryStatsWrapper(
+ d.ptr, (C.virDomainMemoryStatPtr)(unsafe.Pointer(&ptr[0])),
+ C.uint(nrStats), C.uint(flags), &err)
+
+ if result == -1 {
+ return []DomainMemoryStat{}, makeError(&err)
+ }
+
+ out := make([]DomainMemoryStat, 0)
+ for i := 0; i < int(result); i++ {
+ out = append(out, DomainMemoryStat{
+ Tag: int32(ptr[i].tag),
+ Val: uint64(ptr[i].val),
+ })
+ }
+ return out, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetConnect
+//
+// Contrary to the native C API behaviour, the Go API will
+// acquire a reference on the returned Connect, which must
+// be released by calling Close()
+func (d *Domain) DomainGetConnect() (*Connect, error) {
+ var err C.virError
+ ptr := C.virDomainGetConnectWrapper(d.ptr, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+
+ ret := C.virConnectRefWrapper(ptr, &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ return &Connect{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpus
+func (d *Domain) GetVcpus() ([]DomainVcpuInfo, error) {
+ var cnodeinfo C.virNodeInfo
+ var err C.virError
+ ret := C.virNodeGetInfoWrapper(C.virDomainGetConnect(d.ptr), &cnodeinfo, &err)
+ if ret == -1 {
+ return []DomainVcpuInfo{}, makeError(&err)
+ }
+
+ var cdominfo C.virDomainInfo
+ ret = C.virDomainGetInfoWrapper(d.ptr, &cdominfo, &err)
+ if ret == -1 {
+ return []DomainVcpuInfo{}, makeError(&err)
+ }
+
+ nvcpus := int(cdominfo.nrVirtCpu)
+ npcpus := int(cnodeinfo.nodes * cnodeinfo.sockets * cnodeinfo.cores * cnodeinfo.threads)
+ maplen := ((npcpus + 7) / 8)
+ ccpumaps := make([]C.uchar, maplen*nvcpus)
+ cinfo := make([]C.virVcpuInfo, nvcpus)
+
+ ret = C.virDomainGetVcpusWrapper(d.ptr, &cinfo[0], C.int(nvcpus), &ccpumaps[0], C.int(maplen), &err)
+ if ret == -1 {
+ return []DomainVcpuInfo{}, makeError(&err)
+ }
+
+ info := make([]DomainVcpuInfo, int(ret))
+ for i := 0; i < int(ret); i++ {
+ affinity := make([]bool, npcpus)
+ for j := 0; j < npcpus; j++ {
+ byte := (i * maplen) + (j / 8)
+ bit := j % 8
+
+ affinity[j] = (ccpumaps[byte] & (1 << uint(bit))) != 0
+ }
+
+ info[i] = DomainVcpuInfo{
+ Number: uint32(cinfo[i].number),
+ State: int32(cinfo[i].state),
+ CpuTime: uint64(cinfo[i].cpuTime),
+ Cpu: int32(cinfo[i].cpu),
+ CpuMap: affinity,
+ }
+ }
+
+ return info, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFlags
+func (d *Domain) GetVcpusFlags(flags DomainVcpuFlags) (int32, error) {
+ var err C.virError
+ result := C.virDomainGetVcpusFlagsWrapper(d.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return int32(result), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainPinVcpu
+func (d *Domain) PinVcpu(vcpu uint, cpuMap []bool) error {
+ maplen := (len(cpuMap) + 7) / 8
+ ccpumap := make([]C.uchar, maplen)
+ for i := 0; i < len(cpuMap); i++ {
+ if cpuMap[i] {
+ byte := i / 8
+ bit := i % 8
+ ccpumap[byte] |= (1 << uint(bit))
+ }
+ }
+
+ var err C.virError
+ result := C.virDomainPinVcpuWrapper(d.ptr, C.uint(vcpu), &ccpumap[0], C.int(maplen), &err)
+
+ if result == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainPinVcpuFlags
+func (d *Domain) PinVcpuFlags(vcpu uint, cpuMap []bool, flags DomainModificationImpact) error {
+ maplen := (len(cpuMap) + 7) / 8
+ ccpumap := make([]C.uchar, maplen)
+ for i := 0; i < len(cpuMap); i++ {
+ if cpuMap[i] {
+ byte := i / 8
+ bit := i % 8
+ ccpumap[byte] |= (1 << uint(bit))
+ }
+ }
+
+ var err C.virError
+ result := C.virDomainPinVcpuFlagsWrapper(d.ptr, C.uint(vcpu), &ccpumap[0], C.int(maplen), C.uint(flags), &err)
+
+ if result == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+type DomainIPAddress struct {
+ Type int
+ Addr string
+ Prefix uint
+}
+
+type DomainInterface struct {
+ Name string
+ Hwaddr string
+ Addrs []DomainIPAddress
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainInterfaceAddresses
+func (d *Domain) ListAllInterfaceAddresses(src DomainInterfaceAddressesSource) ([]DomainInterface, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002014 {
+ return []DomainInterface{}, makeNotImplementedError("virDomainInterfaceAddresses")
+ }
+
+ var cList *C.virDomainInterfacePtr
+ var err C.virError
+ numIfaces := int(C.virDomainInterfaceAddressesWrapper(d.ptr, (**C.virDomainInterfacePtr)(&cList), C.uint(src), 0, &err))
+ if numIfaces == -1 {
+ return nil, makeError(&err)
+ }
+
+ ifaces := make([]DomainInterface, numIfaces)
+
+ for i := 0; i < numIfaces; i++ {
+ var ciface *C.virDomainInterface
+ ciface = *(**C.virDomainInterface)(unsafe.Pointer(uintptr(unsafe.Pointer(cList)) + (unsafe.Sizeof(ciface) * uintptr(i))))
+
+ ifaces[i].Name = C.GoString(ciface.name)
+ ifaces[i].Hwaddr = C.GoString(ciface.hwaddr)
+
+ numAddr := int(ciface.naddrs)
+
+ ifaces[i].Addrs = make([]DomainIPAddress, numAddr)
+
+ for k := 0; k < numAddr; k++ {
+ var caddr *C.virDomainIPAddress
+ caddr = (*C.virDomainIPAddress)(unsafe.Pointer(uintptr(unsafe.Pointer(ciface.addrs)) + (unsafe.Sizeof(*caddr) * uintptr(k))))
+ ifaces[i].Addrs[k] = DomainIPAddress{}
+ ifaces[i].Addrs[k].Type = int(caddr._type)
+ ifaces[i].Addrs[k].Addr = C.GoString(caddr.addr)
+ ifaces[i].Addrs[k].Prefix = uint(caddr.prefix)
+
+ }
+ C.virDomainInterfaceFreeWrapper(ciface)
+ }
+ C.free(unsafe.Pointer(cList))
+ return ifaces, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotCurrent
+func (d *Domain) SnapshotCurrent(flags uint32) (*DomainSnapshot, error) {
+ var err C.virError
+ result := C.virDomainSnapshotCurrentWrapper(d.ptr, C.uint(flags), &err)
+ if result == nil {
+ return nil, makeError(&err)
+ }
+ return &DomainSnapshot{ptr: result}, nil
+
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotNum
+func (d *Domain) SnapshotNum(flags DomainSnapshotListFlags) (int, error) {
+ var err C.virError
+ result := int(C.virDomainSnapshotNumWrapper(d.ptr, C.uint(flags), &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotLookupByName
+func (d *Domain) SnapshotLookupByName(name string, flags uint32) (*DomainSnapshot, error) {
+ cName := C.CString(name)
+ defer C.free(unsafe.Pointer(cName))
+ var err C.virError
+ ptr := C.virDomainSnapshotLookupByNameWrapper(d.ptr, cName, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &DomainSnapshot{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotListNames
+func (d *Domain) SnapshotListNames(flags DomainSnapshotListFlags) ([]string, error) {
+ const maxNames = 1024
+ var names [maxNames](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numNames := C.virDomainSnapshotListNamesWrapper(
+ d.ptr,
+ (**C.char)(namesPtr),
+ maxNames, C.uint(flags), &err)
+ if numNames == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numNames)
+ for k := 0; k < int(numNames); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainListAllSnapshots
+func (d *Domain) ListAllSnapshots(flags DomainSnapshotListFlags) ([]DomainSnapshot, error) {
+ var cList *C.virDomainSnapshotPtr
+ var err C.virError
+ numVols := C.virDomainListAllSnapshotsWrapper(d.ptr, (**C.virDomainSnapshotPtr)(&cList), C.uint(flags), &err)
+ if numVols == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numVols),
+ Cap: int(numVols),
+ }
+ var pools []DomainSnapshot
+ slice := *(*[]C.virDomainSnapshotPtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ pools = append(pools, DomainSnapshot{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return pools, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockCommit
+func (d *Domain) BlockCommit(disk string, base string, top string, bandwidth uint64, flags DomainBlockCommitFlags) error {
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+ var cbase *C.char
+ if base != "" {
+ cbase = C.CString(base)
+ defer C.free(unsafe.Pointer(cbase))
+ }
+ var ctop *C.char
+ if top != "" {
+ ctop = C.CString(top)
+ defer C.free(unsafe.Pointer(ctop))
+ }
+ var err C.virError
+ ret := C.virDomainBlockCommitWrapper(d.ptr, cdisk, cbase, ctop, C.ulong(bandwidth), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+type DomainBlockCopyParameters struct {
+ BandwidthSet bool
+ Bandwidth uint64
+ GranularitySet bool
+ Granularity uint
+ BufSizeSet bool
+ BufSize uint64
+}
+
+func getBlockCopyParameterFieldInfo(params *DomainBlockCopyParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_BLOCK_COPY_BANDWIDTH: typedParamsFieldInfo{
+ set: &params.BandwidthSet,
+ ul: &params.Bandwidth,
+ },
+ C.VIR_DOMAIN_BLOCK_COPY_GRANULARITY: typedParamsFieldInfo{
+ set: &params.GranularitySet,
+ ui: &params.Granularity,
+ },
+ C.VIR_DOMAIN_BLOCK_COPY_BUF_SIZE: typedParamsFieldInfo{
+ set: &params.BufSizeSet,
+ ul: &params.BufSize,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockCopy
+func (d *Domain) BlockCopy(disk string, destxml string, params *DomainBlockCopyParameters, flags DomainBlockCopyFlags) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002008 {
+ return makeNotImplementedError("virDomainBlockCopy")
+ }
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+ cdestxml := C.CString(destxml)
+ defer C.free(unsafe.Pointer(cdestxml))
+
+ info := getBlockCopyParameterFieldInfo(params)
+
+ cparams, gerr := typedParamsPackNew(info)
+ if gerr != nil {
+ return gerr
+ }
+ nparams := len(*cparams)
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.int(nparams))
+
+ var err C.virError
+ ret := C.virDomainBlockCopyWrapper(d.ptr, cdisk, cdestxml, (*C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.int(nparams), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockJobAbort
+func (d *Domain) BlockJobAbort(disk string, flags DomainBlockJobAbortFlags) error {
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+ var err C.virError
+ ret := C.virDomainBlockJobAbortWrapper(d.ptr, cdisk, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockJobSetSpeed
+func (d *Domain) BlockJobSetSpeed(disk string, bandwidth uint64, flags DomainBlockJobSetSpeedFlags) error {
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+ var err C.virError
+ ret := C.virDomainBlockJobSetSpeedWrapper(d.ptr, cdisk, C.ulong(bandwidth), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockPull
+func (d *Domain) BlockPull(disk string, bandwidth uint64, flags DomainBlockPullFlags) error {
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+ var err C.virError
+ ret := C.virDomainBlockPullWrapper(d.ptr, cdisk, C.ulong(bandwidth), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockRebase
+func (d *Domain) BlockRebase(disk string, base string, bandwidth uint64, flags DomainBlockRebaseFlags) error {
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+ var cbase *C.char
+ if base != "" {
+ cbase := C.CString(base)
+ defer C.free(unsafe.Pointer(cbase))
+ }
+ var err C.virError
+ ret := C.virDomainBlockRebaseWrapper(d.ptr, cdisk, cbase, C.ulong(bandwidth), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockResize
+func (d *Domain) BlockResize(disk string, size uint64, flags DomainBlockResizeFlags) error {
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+ var err C.virError
+ ret := C.virDomainBlockResizeWrapper(d.ptr, cdisk, C.ulonglong(size), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockPeek
+func (d *Domain) BlockPeek(disk string, offset uint64, size uint64, flags uint32) ([]byte, error) {
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+ data := make([]byte, size)
+ var err C.virError
+ ret := C.virDomainBlockPeekWrapper(d.ptr, cdisk, C.ulonglong(offset), C.size_t(size),
+ unsafe.Pointer(&data[0]), C.uint(flags), &err)
+ if ret == -1 {
+ return []byte{}, makeError(&err)
+ }
+
+ return data, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryPeek
+func (d *Domain) MemoryPeek(start uint64, size uint64, flags DomainMemoryFlags) ([]byte, error) {
+ data := make([]byte, size)
+ var err C.virError
+ ret := C.virDomainMemoryPeekWrapper(d.ptr, C.ulonglong(start), C.size_t(size),
+ unsafe.Pointer(&data[0]), C.uint(flags), &err)
+ if ret == -1 {
+ return []byte{}, makeError(&err)
+ }
+
+ return data, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrate
+func (d *Domain) Migrate(dconn *Connect, flags DomainMigrateFlags, dname string, uri string, bandwidth uint64) (*Domain, error) {
+ var cdname *C.char
+ if dname != "" {
+ cdname = C.CString(dname)
+ defer C.free(unsafe.Pointer(cdname))
+ }
+ var curi *C.char
+ if uri != "" {
+ curi = C.CString(uri)
+ defer C.free(unsafe.Pointer(curi))
+ }
+
+ var err C.virError
+ ret := C.virDomainMigrateWrapper(d.ptr, dconn.ptr, C.ulong(flags), cdname, curi, C.ulong(bandwidth), &err)
+ if ret == nil {
+ return nil, makeError(&err)
+ }
+
+ return &Domain{
+ ptr: ret,
+ }, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrate2
+func (d *Domain) Migrate2(dconn *Connect, dxml string, flags DomainMigrateFlags, dname string, uri string, bandwidth uint64) (*Domain, error) {
+ var cdxml *C.char
+ if dxml != "" {
+ cdxml = C.CString(dxml)
+ defer C.free(unsafe.Pointer(cdxml))
+ }
+ var cdname *C.char
+ if dname != "" {
+ cdname = C.CString(dname)
+ defer C.free(unsafe.Pointer(cdname))
+ }
+ var curi *C.char
+ if uri != "" {
+ curi = C.CString(uri)
+ defer C.free(unsafe.Pointer(curi))
+ }
+
+ var err C.virError
+ ret := C.virDomainMigrate2Wrapper(d.ptr, dconn.ptr, cdxml, C.ulong(flags), cdname, curi, C.ulong(bandwidth), &err)
+ if ret == nil {
+ return nil, makeError(&err)
+ }
+
+ return &Domain{
+ ptr: ret,
+ }, nil
+}
+
+type DomainMigrateParameters struct {
+ URISet bool
+ URI string
+ DestNameSet bool
+ DestName string
+ DestXMLSet bool
+ DestXML string
+ PersistXMLSet bool
+ PersistXML string
+ BandwidthSet bool
+ Bandwidth uint64
+ GraphicsURISet bool
+ GraphicsURI string
+ ListenAddressSet bool
+ ListenAddress string
+ MigrateDisksSet bool
+ MigrateDisks []string
+ DisksPortSet bool
+ DisksPort int
+ CompressionSet bool
+ Compression string
+ CompressionMTLevelSet bool
+ CompressionMTLevel int
+ CompressionMTThreadsSet bool
+ CompressionMTThreads int
+ CompressionMTDThreadsSet bool
+ CompressionMTDThreads int
+ CompressionXBZRLECacheSet bool
+ CompressionXBZRLECache uint64
+ AutoConvergeInitialSet bool
+ AutoConvergeInitial int
+ AutoConvergeIncrementSet bool
+ AutoConvergeIncrement int
+}
+
+func getMigrateParameterFieldInfo(params *DomainMigrateParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_MIGRATE_PARAM_URI: typedParamsFieldInfo{
+ set: &params.URISet,
+ s: &params.URI,
+ },
+ C.VIR_MIGRATE_PARAM_DEST_NAME: typedParamsFieldInfo{
+ set: &params.DestNameSet,
+ s: &params.DestName,
+ },
+ C.VIR_MIGRATE_PARAM_DEST_XML: typedParamsFieldInfo{
+ set: &params.DestXMLSet,
+ s: &params.DestXML,
+ },
+ C.VIR_MIGRATE_PARAM_PERSIST_XML: typedParamsFieldInfo{
+ set: &params.PersistXMLSet,
+ s: &params.PersistXML,
+ },
+ C.VIR_MIGRATE_PARAM_BANDWIDTH: typedParamsFieldInfo{
+ set: &params.BandwidthSet,
+ ul: &params.Bandwidth,
+ },
+ C.VIR_MIGRATE_PARAM_GRAPHICS_URI: typedParamsFieldInfo{
+ set: &params.GraphicsURISet,
+ s: &params.GraphicsURI,
+ },
+ C.VIR_MIGRATE_PARAM_LISTEN_ADDRESS: typedParamsFieldInfo{
+ set: &params.ListenAddressSet,
+ s: &params.ListenAddress,
+ },
+ C.VIR_MIGRATE_PARAM_MIGRATE_DISKS: typedParamsFieldInfo{
+ set: &params.MigrateDisksSet,
+ sl: &params.MigrateDisks,
+ },
+ C.VIR_MIGRATE_PARAM_DISKS_PORT: typedParamsFieldInfo{
+ set: &params.DisksPortSet,
+ i: &params.DisksPort,
+ },
+ C.VIR_MIGRATE_PARAM_COMPRESSION: typedParamsFieldInfo{
+ set: &params.CompressionSet,
+ s: &params.Compression,
+ },
+ C.VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL: typedParamsFieldInfo{
+ set: &params.CompressionMTLevelSet,
+ i: &params.CompressionMTLevel,
+ },
+ C.VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS: typedParamsFieldInfo{
+ set: &params.CompressionMTThreadsSet,
+ i: &params.CompressionMTThreads,
+ },
+ C.VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS: typedParamsFieldInfo{
+ set: &params.CompressionMTDThreadsSet,
+ i: &params.CompressionMTDThreads,
+ },
+ C.VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE: typedParamsFieldInfo{
+ set: &params.CompressionXBZRLECacheSet,
+ ul: &params.CompressionXBZRLECache,
+ },
+ C.VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL: typedParamsFieldInfo{
+ set: &params.AutoConvergeInitialSet,
+ i: &params.AutoConvergeInitial,
+ },
+ C.VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT: typedParamsFieldInfo{
+ set: &params.AutoConvergeIncrementSet,
+ i: &params.AutoConvergeIncrement,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrate3
+func (d *Domain) Migrate3(dconn *Connect, params *DomainMigrateParameters, flags DomainMigrateFlags) (*Domain, error) {
+
+ info := getMigrateParameterFieldInfo(params)
+ cparams, gerr := typedParamsPackNew(info)
+ if gerr != nil {
+ return nil, gerr
+ }
+ nparams := len(*cparams)
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.int(nparams))
+
+ var err C.virError
+ ret := C.virDomainMigrate3Wrapper(d.ptr, dconn.ptr, (*C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.uint(nparams), C.uint(flags), &err)
+ if ret == nil {
+ return nil, makeError(&err)
+ }
+
+ return &Domain{
+ ptr: ret,
+ }, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateToURI
+func (d *Domain) MigrateToURI(duri string, flags DomainMigrateFlags, dname string, bandwidth uint64) error {
+ cduri := C.CString(duri)
+ defer C.free(unsafe.Pointer(cduri))
+
+ var cdname *C.char
+ if dname != "" {
+ cdname = C.CString(dname)
+ defer C.free(unsafe.Pointer(cdname))
+ }
+
+ var err C.virError
+ ret := C.virDomainMigrateToURIWrapper(d.ptr, cduri, C.ulong(flags), cdname, C.ulong(bandwidth), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateToURI2
+func (d *Domain) MigrateToURI2(dconnuri string, miguri string, dxml string, flags DomainMigrateFlags, dname string, bandwidth uint64) error {
+ var cdconnuri *C.char
+ if dconnuri != "" {
+ cdconnuri = C.CString(dconnuri)
+ defer C.free(unsafe.Pointer(cdconnuri))
+ }
+ var cmiguri *C.char
+ if miguri != "" {
+ cmiguri = C.CString(miguri)
+ defer C.free(unsafe.Pointer(cmiguri))
+ }
+ var cdxml *C.char
+ if dxml != "" {
+ cdxml = C.CString(dxml)
+ defer C.free(unsafe.Pointer(cdxml))
+ }
+ var cdname *C.char
+ if dname != "" {
+ cdname = C.CString(dname)
+ defer C.free(unsafe.Pointer(cdname))
+ }
+
+ var err C.virError
+ ret := C.virDomainMigrateToURI2Wrapper(d.ptr, cdconnuri, cmiguri, cdxml, C.ulong(flags), cdname, C.ulong(bandwidth), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateToURI3
+func (d *Domain) MigrateToURI3(dconnuri string, params *DomainMigrateParameters, flags DomainMigrateFlags) error {
+ var cdconnuri *C.char
+ if dconnuri != "" {
+ cdconnuri = C.CString(dconnuri)
+ defer C.free(unsafe.Pointer(cdconnuri))
+ }
+
+ info := getMigrateParameterFieldInfo(params)
+ cparams, gerr := typedParamsPackNew(info)
+ if gerr != nil {
+ return gerr
+ }
+ nparams := len(*cparams)
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.int(nparams))
+
+ var err C.virError
+ ret := C.virDomainMigrateToURI3Wrapper(d.ptr, cdconnuri, (*C.virTypedParameter)(unsafe.Pointer(&(*cparams)[0])), C.uint(nparams), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateGetCompressionCache
+func (d *Domain) MigrateGetCompressionCache(flags uint32) (uint64, error) {
+ var cacheSize C.ulonglong
+
+ var err C.virError
+ ret := C.virDomainMigrateGetCompressionCacheWrapper(d.ptr, &cacheSize, C.uint(flags), &err)
+ if ret == -1 {
+ return 0, makeError(&err)
+ }
+
+ return uint64(cacheSize), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateSetCompressionCache
+func (d *Domain) MigrateSetCompressionCache(size uint64, flags uint32) error {
+ var err C.virError
+ ret := C.virDomainMigrateSetCompressionCacheWrapper(d.ptr, C.ulonglong(size), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateGetMaxSpeed
+func (d *Domain) MigrateGetMaxSpeed(flags uint32) (uint64, error) {
+ var maxSpeed C.ulong
+
+ var err C.virError
+ ret := C.virDomainMigrateGetMaxSpeedWrapper(d.ptr, &maxSpeed, C.uint(flags), &err)
+ if ret == -1 {
+ return 0, makeError(&err)
+ }
+
+ return uint64(maxSpeed), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateSetMaxSpeed
+func (d *Domain) MigrateSetMaxSpeed(speed uint64, flags uint32) error {
+ var err C.virError
+ ret := C.virDomainMigrateSetMaxSpeedWrapper(d.ptr, C.ulong(speed), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateSetMaxDowntime
+func (d *Domain) MigrateSetMaxDowntime(downtime uint64, flags uint32) error {
+ var err C.virError
+ ret := C.virDomainMigrateSetMaxDowntimeWrapper(d.ptr, C.ulonglong(downtime), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateGetMaxDowntime
+func (d *Domain) MigrateGetMaxDowntime(flags uint32) (uint64, error) {
+ var downtimeLen C.ulonglong
+
+ if C.LIBVIR_VERSION_NUMBER < 3007000 {
+ return 0, makeNotImplementedError("virDomainMigrateGetMaxDowntime")
+ }
+
+ var err C.virError
+ ret := C.virDomainMigrateGetMaxDowntimeWrapper(d.ptr, &downtimeLen, C.uint(flags), &err)
+ if ret == -1 {
+ return 0, makeError(&err)
+ }
+
+ return uint64(downtimeLen), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrateStartPostCopy
+func (d *Domain) MigrateStartPostCopy(flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 1003003 {
+ return makeNotImplementedError("virDomainMigrateStartPostCopy")
+ }
+
+ var err C.virError
+ ret := C.virDomainMigrateStartPostCopyWrapper(d.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+type DomainBlkioParameters struct {
+ WeightSet bool
+ Weight uint
+ DeviceWeightSet bool
+ DeviceWeight string
+ DeviceReadIopsSet bool
+ DeviceReadIops string
+ DeviceWriteIopsSet bool
+ DeviceWriteIops string
+ DeviceReadBpsSet bool
+ DeviceReadBps string
+ DeviceWriteBpsSet bool
+ DeviceWriteBps string
+}
+
+func getBlkioParametersFieldInfo(params *DomainBlkioParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_BLKIO_WEIGHT: typedParamsFieldInfo{
+ set: &params.WeightSet,
+ ui: &params.Weight,
+ },
+ C.VIR_DOMAIN_BLKIO_DEVICE_WEIGHT: typedParamsFieldInfo{
+ set: &params.DeviceWeightSet,
+ s: &params.DeviceWeight,
+ },
+ C.VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS: typedParamsFieldInfo{
+ set: &params.DeviceReadIopsSet,
+ s: &params.DeviceReadIops,
+ },
+ C.VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS: typedParamsFieldInfo{
+ set: &params.DeviceWriteIopsSet,
+ s: &params.DeviceWriteIops,
+ },
+ C.VIR_DOMAIN_BLKIO_DEVICE_READ_BPS: typedParamsFieldInfo{
+ set: &params.DeviceReadBpsSet,
+ s: &params.DeviceReadBps,
+ },
+ C.VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS: typedParamsFieldInfo{
+ set: &params.DeviceWriteBpsSet,
+ s: &params.DeviceWriteBps,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlkioParameters
+func (d *Domain) GetBlkioParameters(flags DomainModificationImpact) (*DomainBlkioParameters, error) {
+ params := &DomainBlkioParameters{}
+ info := getBlkioParametersFieldInfo(params)
+
+ var nparams C.int
+ var err C.virError
+ ret := C.virDomainGetBlkioParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainGetBlkioParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ _, gerr := typedParamsUnpack(cparams, info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetBlkioParameters
+func (d *Domain) SetBlkioParameters(params *DomainBlkioParameters, flags DomainModificationImpact) error {
+ info := getBlkioParametersFieldInfo(params)
+
+ var nparams C.int
+
+ var err C.virError
+ ret := C.virDomainGetBlkioParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainGetBlkioParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ gerr := typedParamsPack(cparams, info)
+ if gerr != nil {
+ return gerr
+ }
+
+ ret = C.virDomainSetBlkioParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+
+ return nil
+}
+
+type DomainBlockIoTuneParameters struct {
+ TotalBytesSecSet bool
+ TotalBytesSec uint64
+ ReadBytesSecSet bool
+ ReadBytesSec uint64
+ WriteBytesSecSet bool
+ WriteBytesSec uint64
+ TotalIopsSecSet bool
+ TotalIopsSec uint64
+ ReadIopsSecSet bool
+ ReadIopsSec uint64
+ WriteIopsSecSet bool
+ WriteIopsSec uint64
+ TotalBytesSecMaxSet bool
+ TotalBytesSecMax uint64
+ ReadBytesSecMaxSet bool
+ ReadBytesSecMax uint64
+ WriteBytesSecMaxSet bool
+ WriteBytesSecMax uint64
+ TotalIopsSecMaxSet bool
+ TotalIopsSecMax uint64
+ ReadIopsSecMaxSet bool
+ ReadIopsSecMax uint64
+ WriteIopsSecMaxSet bool
+ WriteIopsSecMax uint64
+ TotalBytesSecMaxLengthSet bool
+ TotalBytesSecMaxLength uint64
+ ReadBytesSecMaxLengthSet bool
+ ReadBytesSecMaxLength uint64
+ WriteBytesSecMaxLengthSet bool
+ WriteBytesSecMaxLength uint64
+ TotalIopsSecMaxLengthSet bool
+ TotalIopsSecMaxLength uint64
+ ReadIopsSecMaxLengthSet bool
+ ReadIopsSecMaxLength uint64
+ WriteIopsSecMaxLengthSet bool
+ WriteIopsSecMaxLength uint64
+ SizeIopsSecSet bool
+ SizeIopsSec uint64
+ GroupNameSet bool
+ GroupName string
+}
+
+func getBlockIoTuneParametersFieldInfo(params *DomainBlockIoTuneParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC: typedParamsFieldInfo{
+ set: &params.TotalBytesSecSet,
+ ul: &params.TotalBytesSec,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC: typedParamsFieldInfo{
+ set: &params.ReadBytesSecSet,
+ ul: &params.ReadBytesSec,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC: typedParamsFieldInfo{
+ set: &params.WriteBytesSecSet,
+ ul: &params.WriteBytesSec,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC: typedParamsFieldInfo{
+ set: &params.TotalIopsSecSet,
+ ul: &params.TotalIopsSec,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC: typedParamsFieldInfo{
+ set: &params.ReadIopsSecSet,
+ ul: &params.ReadIopsSec,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC: typedParamsFieldInfo{
+ set: &params.WriteIopsSecSet,
+ ul: &params.WriteIopsSec,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX: typedParamsFieldInfo{
+ set: &params.TotalBytesSecMaxSet,
+ ul: &params.TotalBytesSecMax,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX: typedParamsFieldInfo{
+ set: &params.ReadBytesSecMaxSet,
+ ul: &params.ReadBytesSecMax,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX: typedParamsFieldInfo{
+ set: &params.WriteBytesSecMaxSet,
+ ul: &params.WriteBytesSecMax,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX: typedParamsFieldInfo{
+ set: &params.TotalIopsSecMaxSet,
+ ul: &params.TotalIopsSecMax,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX: typedParamsFieldInfo{
+ set: &params.ReadIopsSecMaxSet,
+ ul: &params.ReadIopsSecMax,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX: typedParamsFieldInfo{
+ set: &params.WriteIopsSecMaxSet,
+ ul: &params.WriteIopsSecMax,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.TotalBytesSecMaxLengthSet,
+ ul: &params.TotalBytesSecMaxLength,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.ReadBytesSecMaxLengthSet,
+ ul: &params.ReadBytesSecMaxLength,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.WriteBytesSecMaxLengthSet,
+ ul: &params.WriteBytesSecMaxLength,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.TotalIopsSecMaxLengthSet,
+ ul: &params.TotalIopsSecMaxLength,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.ReadIopsSecMaxLengthSet,
+ ul: &params.ReadIopsSecMaxLength,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.WriteIopsSecMaxLengthSet,
+ ul: &params.WriteIopsSecMaxLength,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC: typedParamsFieldInfo{
+ set: &params.SizeIopsSecSet,
+ ul: &params.SizeIopsSec,
+ },
+ C.VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME: typedParamsFieldInfo{
+ set: &params.GroupNameSet,
+ s: &params.GroupName,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlockIoTune
+func (d *Domain) GetBlockIoTune(disk string, flags DomainModificationImpact) (*DomainBlockIoTuneParameters, error) {
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+
+ params := &DomainBlockIoTuneParameters{}
+ info := getBlockIoTuneParametersFieldInfo(params)
+
+ var nparams C.int
+ var err C.virError
+ ret := C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, nil, &nparams, 0, &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ _, gerr := typedParamsUnpack(cparams, info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetBlockIoTune
+func (d *Domain) SetBlockIoTune(disk string, params *DomainBlockIoTuneParameters, flags DomainModificationImpact) error {
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+
+ info := getBlockIoTuneParametersFieldInfo(params)
+
+ var nparams C.int
+
+ var err C.virError
+ ret := C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, nil, &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ gerr := typedParamsPack(cparams, info)
+ if gerr != nil {
+ return gerr
+ }
+
+ ret = C.virDomainSetBlockIoTuneWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+
+ return nil
+}
+
+type DomainBlockJobInfo struct {
+ Type DomainBlockJobType
+ Bandwidth uint64
+ Cur uint64
+ End uint64
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlockJobInfo
+func (d *Domain) GetBlockJobInfo(disk string, flags DomainBlockJobInfoFlags) (*DomainBlockJobInfo, error) {
+ cdisk := C.CString(disk)
+ defer C.free(unsafe.Pointer(cdisk))
+
+ var cinfo C.virDomainBlockJobInfo
+
+ var err C.virError
+ ret := C.virDomainGetBlockJobInfoWrapper(d.ptr, cdisk, &cinfo, C.uint(flags), &err)
+
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ return &DomainBlockJobInfo{
+ Type: DomainBlockJobType(cinfo._type),
+ Bandwidth: uint64(cinfo.bandwidth),
+ Cur: uint64(cinfo.cur),
+ End: uint64(cinfo.end),
+ }, nil
+}
+
+type DomainControlInfo struct {
+ State DomainControlState
+ Details int
+ StateTime uint64
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetControlInfo
+func (d *Domain) GetControlInfo(flags uint32) (*DomainControlInfo, error) {
+
+ var cinfo C.virDomainControlInfo
+
+ var err C.virError
+ ret := C.virDomainGetControlInfoWrapper(d.ptr, &cinfo, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ return &DomainControlInfo{
+ State: DomainControlState(cinfo.state),
+ Details: int(cinfo.details),
+ StateTime: uint64(cinfo.stateTime),
+ }, nil
+}
+
+type DomainDiskError struct {
+ Disk string
+ Error DomainDiskErrorCode
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetDiskErrors
+func (d *Domain) GetDiskErrors(flags uint32) ([]DomainDiskError, error) {
+ var err C.virError
+ ret := C.virDomainGetDiskErrorsWrapper(d.ptr, nil, 0, 0, &err)
+ if ret == -1 {
+ return []DomainDiskError{}, makeError(&err)
+ }
+
+ maxerrors := ret
+ cerrors := make([]C.virDomainDiskError, maxerrors)
+
+ ret = C.virDomainGetDiskErrorsWrapper(d.ptr, (*C.virDomainDiskError)(unsafe.Pointer(&cerrors[0])), C.uint(maxerrors), C.uint(flags), &err)
+ if ret == -1 {
+ return []DomainDiskError{}, makeError(&err)
+ }
+
+ errors := make([]DomainDiskError, maxerrors)
+
+ for i, cerror := range cerrors {
+ errors[i] = DomainDiskError{
+ Disk: C.GoString(cerror.disk),
+ Error: DomainDiskErrorCode(cerror.error),
+ }
+ C.free(unsafe.Pointer(cerror.disk))
+ }
+
+ return errors, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetHostname
+func (d *Domain) GetHostname(flags uint32) (string, error) {
+ var err C.virError
+ ret := C.virDomainGetHostnameWrapper(d.ptr, C.uint(flags), &err)
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret), nil
+}
+
+type DomainJobInfo struct {
+ Type DomainJobType
+ TimeElapsedSet bool
+ TimeElapsed uint64
+ TimeElapsedNetSet bool
+ TimeElapsedNet uint64
+ TimeRemainingSet bool
+ TimeRemaining uint64
+ DowntimeSet bool
+ Downtime uint64
+ DowntimeNetSet bool
+ DowntimeNet uint64
+ SetupTimeSet bool
+ SetupTime uint64
+ DataTotalSet bool
+ DataTotal uint64
+ DataProcessedSet bool
+ DataProcessed uint64
+ DataRemainingSet bool
+ DataRemaining uint64
+ MemTotalSet bool
+ MemTotal uint64
+ MemProcessedSet bool
+ MemProcessed uint64
+ MemRemainingSet bool
+ MemRemaining uint64
+ MemConstantSet bool
+ MemConstant uint64
+ MemNormalSet bool
+ MemNormal uint64
+ MemNormalBytesSet bool
+ MemNormalBytes uint64
+ MemBpsSet bool
+ MemBps uint64
+ MemDirtyRateSet bool
+ MemDirtyRate uint64
+ MemPageSizeSet bool
+ MemPageSize uint64
+ MemIterationSet bool
+ MemIteration uint64
+ DiskTotalSet bool
+ DiskTotal uint64
+ DiskProcessedSet bool
+ DiskProcessed uint64
+ DiskRemainingSet bool
+ DiskRemaining uint64
+ DiskBpsSet bool
+ DiskBps uint64
+ CompressionCacheSet bool
+ CompressionCache uint64
+ CompressionBytesSet bool
+ CompressionBytes uint64
+ CompressionPagesSet bool
+ CompressionPages uint64
+ CompressionCacheMissesSet bool
+ CompressionCacheMisses uint64
+ CompressionOverflowSet bool
+ CompressionOverflow uint64
+ AutoConvergeThrottleSet bool
+ AutoConvergeThrottle int
+ OperationSet bool
+ Operation DomainJobOperationType
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobInfo
+func (d *Domain) GetJobInfo() (*DomainJobInfo, error) {
+ var cinfo C.virDomainJobInfo
+
+ var err C.virError
+ ret := C.virDomainGetJobInfoWrapper(d.ptr, &cinfo, &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ return &DomainJobInfo{
+ Type: DomainJobType(cinfo._type),
+ TimeElapsedSet: true,
+ TimeElapsed: uint64(cinfo.timeElapsed),
+ TimeRemainingSet: true,
+ TimeRemaining: uint64(cinfo.timeRemaining),
+ DataTotalSet: true,
+ DataTotal: uint64(cinfo.dataTotal),
+ DataProcessedSet: true,
+ DataProcessed: uint64(cinfo.dataProcessed),
+ DataRemainingSet: true,
+ DataRemaining: uint64(cinfo.dataRemaining),
+ MemTotalSet: true,
+ MemTotal: uint64(cinfo.memTotal),
+ MemProcessedSet: true,
+ MemProcessed: uint64(cinfo.memProcessed),
+ MemRemainingSet: true,
+ MemRemaining: uint64(cinfo.memRemaining),
+ DiskTotalSet: true,
+ DiskTotal: uint64(cinfo.fileTotal),
+ DiskProcessedSet: true,
+ DiskProcessed: uint64(cinfo.fileProcessed),
+ DiskRemainingSet: true,
+ DiskRemaining: uint64(cinfo.fileRemaining),
+ }, nil
+}
+
+func getDomainJobInfoFieldInfo(params *DomainJobInfo) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_JOB_TIME_ELAPSED: typedParamsFieldInfo{
+ set: &params.TimeElapsedSet,
+ ul: &params.TimeElapsed,
+ },
+ C.VIR_DOMAIN_JOB_TIME_ELAPSED_NET: typedParamsFieldInfo{
+ set: &params.TimeElapsedNetSet,
+ ul: &params.TimeElapsedNet,
+ },
+ C.VIR_DOMAIN_JOB_TIME_REMAINING: typedParamsFieldInfo{
+ set: &params.TimeRemainingSet,
+ ul: &params.TimeRemaining,
+ },
+ C.VIR_DOMAIN_JOB_DOWNTIME: typedParamsFieldInfo{
+ set: &params.DowntimeSet,
+ ul: &params.Downtime,
+ },
+ C.VIR_DOMAIN_JOB_DOWNTIME_NET: typedParamsFieldInfo{
+ set: &params.DowntimeNetSet,
+ ul: &params.DowntimeNet,
+ },
+ C.VIR_DOMAIN_JOB_SETUP_TIME: typedParamsFieldInfo{
+ set: &params.SetupTimeSet,
+ ul: &params.SetupTime,
+ },
+ C.VIR_DOMAIN_JOB_DATA_TOTAL: typedParamsFieldInfo{
+ set: &params.DataTotalSet,
+ ul: &params.DataTotal,
+ },
+ C.VIR_DOMAIN_JOB_DATA_PROCESSED: typedParamsFieldInfo{
+ set: &params.DataProcessedSet,
+ ul: &params.DataProcessed,
+ },
+ C.VIR_DOMAIN_JOB_DATA_REMAINING: typedParamsFieldInfo{
+ set: &params.DataRemainingSet,
+ ul: &params.DataRemaining,
+ },
+ C.VIR_DOMAIN_JOB_MEMORY_TOTAL: typedParamsFieldInfo{
+ set: &params.MemTotalSet,
+ ul: &params.MemTotal,
+ },
+ C.VIR_DOMAIN_JOB_MEMORY_PROCESSED: typedParamsFieldInfo{
+ set: &params.MemProcessedSet,
+ ul: &params.MemProcessed,
+ },
+ C.VIR_DOMAIN_JOB_MEMORY_REMAINING: typedParamsFieldInfo{
+ set: &params.MemRemainingSet,
+ ul: &params.MemRemaining,
+ },
+ C.VIR_DOMAIN_JOB_MEMORY_CONSTANT: typedParamsFieldInfo{
+ set: &params.MemConstantSet,
+ ul: &params.MemConstant,
+ },
+ C.VIR_DOMAIN_JOB_MEMORY_NORMAL: typedParamsFieldInfo{
+ set: &params.MemNormalSet,
+ ul: &params.MemNormal,
+ },
+ C.VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES: typedParamsFieldInfo{
+ set: &params.MemNormalBytesSet,
+ ul: &params.MemNormalBytes,
+ },
+ C.VIR_DOMAIN_JOB_MEMORY_BPS: typedParamsFieldInfo{
+ set: &params.MemBpsSet,
+ ul: &params.MemBps,
+ },
+ C.VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE: typedParamsFieldInfo{
+ set: &params.MemDirtyRateSet,
+ ul: &params.MemDirtyRate,
+ },
+ C.VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE: typedParamsFieldInfo{
+ set: &params.MemPageSizeSet,
+ ul: &params.MemPageSize,
+ },
+ C.VIR_DOMAIN_JOB_MEMORY_ITERATION: typedParamsFieldInfo{
+ set: &params.MemIterationSet,
+ ul: &params.MemIteration,
+ },
+ C.VIR_DOMAIN_JOB_DISK_TOTAL: typedParamsFieldInfo{
+ set: &params.DiskTotalSet,
+ ul: &params.DiskTotal,
+ },
+ C.VIR_DOMAIN_JOB_DISK_PROCESSED: typedParamsFieldInfo{
+ set: &params.DiskProcessedSet,
+ ul: &params.DiskProcessed,
+ },
+ C.VIR_DOMAIN_JOB_DISK_REMAINING: typedParamsFieldInfo{
+ set: &params.DiskRemainingSet,
+ ul: &params.DiskRemaining,
+ },
+ C.VIR_DOMAIN_JOB_DISK_BPS: typedParamsFieldInfo{
+ set: &params.DiskBpsSet,
+ ul: &params.DiskBps,
+ },
+ C.VIR_DOMAIN_JOB_COMPRESSION_CACHE: typedParamsFieldInfo{
+ set: &params.CompressionCacheSet,
+ ul: &params.CompressionCache,
+ },
+ C.VIR_DOMAIN_JOB_COMPRESSION_BYTES: typedParamsFieldInfo{
+ set: &params.CompressionBytesSet,
+ ul: &params.CompressionBytes,
+ },
+ C.VIR_DOMAIN_JOB_COMPRESSION_PAGES: typedParamsFieldInfo{
+ set: &params.CompressionPagesSet,
+ ul: &params.CompressionPages,
+ },
+ C.VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES: typedParamsFieldInfo{
+ set: &params.CompressionCacheMissesSet,
+ ul: &params.CompressionCacheMisses,
+ },
+ C.VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW: typedParamsFieldInfo{
+ set: &params.CompressionOverflowSet,
+ ul: &params.CompressionOverflow,
+ },
+ C.VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE: typedParamsFieldInfo{
+ set: &params.AutoConvergeThrottleSet,
+ i: &params.AutoConvergeThrottle,
+ },
+ C.VIR_DOMAIN_JOB_OPERATION: typedParamsFieldInfo{
+ set: &params.OperationSet,
+ i: (*int)(&params.Operation),
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobStats
+func (d *Domain) GetJobStats(flags DomainGetJobStatsFlags) (*DomainJobInfo, error) {
+ var cparams *C.virTypedParameter
+ var nparams C.int
+ var jobtype C.int
+ var err C.virError
+ ret := C.virDomainGetJobStatsWrapper(d.ptr, &jobtype, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+ defer C.virTypedParamsFree(cparams, nparams)
+
+ params := DomainJobInfo{}
+ info := getDomainJobInfoFieldInfo(&params)
+
+ _, gerr := typedParamsUnpackLen(cparams, int(nparams), info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return &params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetMaxMemory
+func (d *Domain) GetMaxMemory() (uint64, error) {
+ var err C.virError
+ ret := C.virDomainGetMaxMemoryWrapper(d.ptr, &err)
+ if ret == 0 {
+ return 0, makeError(&err)
+ }
+
+ return uint64(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetMaxVcpus
+func (d *Domain) GetMaxVcpus() (uint, error) {
+ var err C.virError
+ ret := C.virDomainGetMaxVcpusWrapper(d.ptr, &err)
+ if ret == -1 {
+ return 0, makeError(&err)
+ }
+
+ return uint(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetOSType
+func (d *Domain) GetOSType() (string, error) {
+ var err C.virError
+ ret := C.virDomainGetOSTypeWrapper(d.ptr, &err)
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(ret))
+
+ return C.GoString(ret), nil
+}
+
+type DomainMemoryParameters struct {
+ HardLimitSet bool
+ HardLimit uint64
+ SoftLimitSet bool
+ SoftLimit uint64
+ MinGuaranteeSet bool
+ MinGuarantee uint64
+ SwapHardLimitSet bool
+ SwapHardLimit uint64
+}
+
+func getDomainMemoryParametersFieldInfo(params *DomainMemoryParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_MEMORY_HARD_LIMIT: typedParamsFieldInfo{
+ set: &params.HardLimitSet,
+ ul: &params.HardLimit,
+ },
+ C.VIR_DOMAIN_MEMORY_SOFT_LIMIT: typedParamsFieldInfo{
+ set: &params.SoftLimitSet,
+ ul: &params.SoftLimit,
+ },
+ C.VIR_DOMAIN_MEMORY_MIN_GUARANTEE: typedParamsFieldInfo{
+ set: &params.MinGuaranteeSet,
+ ul: &params.MinGuarantee,
+ },
+ C.VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT: typedParamsFieldInfo{
+ set: &params.SwapHardLimitSet,
+ ul: &params.SwapHardLimit,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetMemoryParameters
+func (d *Domain) GetMemoryParameters(flags DomainModificationImpact) (*DomainMemoryParameters, error) {
+ params := &DomainMemoryParameters{}
+ info := getDomainMemoryParametersFieldInfo(params)
+
+ var nparams C.int
+ var err C.virError
+ ret := C.virDomainGetMemoryParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainGetMemoryParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ _, gerr := typedParamsUnpack(cparams, info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetMemoryParameters
+func (d *Domain) SetMemoryParameters(params *DomainMemoryParameters, flags DomainModificationImpact) error {
+ info := getDomainMemoryParametersFieldInfo(params)
+
+ var nparams C.int
+
+ var err C.virError
+ ret := C.virDomainGetMemoryParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainGetMemoryParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ gerr := typedParamsPack(cparams, info)
+ if gerr != nil {
+ return gerr
+ }
+
+ ret = C.virDomainSetMemoryParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+
+ return nil
+}
+
+type DomainNumaParameters struct {
+ NodesetSet bool
+ Nodeset string
+ ModeSet bool
+ Mode DomainNumatuneMemMode
+}
+
+func getDomainNumaParametersFieldInfo(params *DomainNumaParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_NUMA_NODESET: typedParamsFieldInfo{
+ set: &params.NodesetSet,
+ s: &params.Nodeset,
+ },
+ C.VIR_DOMAIN_NUMA_MODE: typedParamsFieldInfo{
+ set: &params.ModeSet,
+ i: (*int)(&params.Mode),
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetNumaParameters
+func (d *Domain) GetNumaParameters(flags DomainModificationImpact) (*DomainNumaParameters, error) {
+ params := &DomainNumaParameters{}
+ info := getDomainNumaParametersFieldInfo(params)
+
+ var nparams C.int
+ var err C.virError
+ ret := C.virDomainGetNumaParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainGetNumaParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ _, gerr := typedParamsUnpack(cparams, info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetNumaParameters
+func (d *Domain) SetNumaParameters(params *DomainNumaParameters, flags DomainModificationImpact) error {
+ info := getDomainNumaParametersFieldInfo(params)
+
+ var nparams C.int
+
+ var err C.virError
+ ret := C.virDomainGetNumaParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret = C.virDomainGetNumaParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ gerr := typedParamsPack(cparams, info)
+ if gerr != nil {
+ return gerr
+ }
+
+ ret = C.virDomainSetNumaParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+
+ return nil
+}
+
+type DomainPerfEvents struct {
+ CmtSet bool
+ Cmt bool
+ MbmtSet bool
+ Mbmt bool
+ MbmlSet bool
+ Mbml bool
+ CacheMissesSet bool
+ CacheMisses bool
+ CacheReferencesSet bool
+ CacheReferences bool
+ InstructionsSet bool
+ Instructions bool
+ CpuCyclesSet bool
+ CpuCycles bool
+ BranchInstructionsSet bool
+ BranchInstructions bool
+ BranchMissesSet bool
+ BranchMisses bool
+ BusCyclesSet bool
+ BusCycles bool
+ StalledCyclesFrontendSet bool
+ StalledCyclesFrontend bool
+ StalledCyclesBackendSet bool
+ StalledCyclesBackend bool
+ RefCpuCyclesSet bool
+ RefCpuCycles bool
+ CpuClockSet bool
+ CpuClock bool
+ TaskClockSet bool
+ TaskClock bool
+ PageFaultsSet bool
+ PageFaults bool
+ ContextSwitchesSet bool
+ ContextSwitches bool
+ CpuMigrationsSet bool
+ CpuMigrations bool
+ PageFaultsMinSet bool
+ PageFaultsMin bool
+ PageFaultsMajSet bool
+ PageFaultsMaj bool
+ AlignmentFaultsSet bool
+ AlignmentFaults bool
+ EmulationFaultsSet bool
+ EmulationFaults bool
+}
+
+/* Remember to also update DomainStatsPerf in connect.go when adding to the stuct above */
+
+func getDomainPerfEventsFieldInfo(params *DomainPerfEvents) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_PERF_PARAM_CMT: typedParamsFieldInfo{
+ set: &params.CmtSet,
+ b: &params.Cmt,
+ },
+ C.VIR_PERF_PARAM_MBMT: typedParamsFieldInfo{
+ set: &params.MbmtSet,
+ b: &params.Mbmt,
+ },
+ C.VIR_PERF_PARAM_MBML: typedParamsFieldInfo{
+ set: &params.MbmlSet,
+ b: &params.Mbml,
+ },
+ C.VIR_PERF_PARAM_CACHE_MISSES: typedParamsFieldInfo{
+ set: &params.CacheMissesSet,
+ b: &params.CacheMisses,
+ },
+ C.VIR_PERF_PARAM_CACHE_REFERENCES: typedParamsFieldInfo{
+ set: &params.CacheReferencesSet,
+ b: &params.CacheReferences,
+ },
+ C.VIR_PERF_PARAM_INSTRUCTIONS: typedParamsFieldInfo{
+ set: &params.InstructionsSet,
+ b: &params.Instructions,
+ },
+ C.VIR_PERF_PARAM_CPU_CYCLES: typedParamsFieldInfo{
+ set: &params.CpuCyclesSet,
+ b: &params.CpuCycles,
+ },
+ C.VIR_PERF_PARAM_BRANCH_INSTRUCTIONS: typedParamsFieldInfo{
+ set: &params.BranchInstructionsSet,
+ b: &params.BranchInstructions,
+ },
+ C.VIR_PERF_PARAM_BRANCH_MISSES: typedParamsFieldInfo{
+ set: &params.BranchMissesSet,
+ b: &params.BranchMisses,
+ },
+ C.VIR_PERF_PARAM_BUS_CYCLES: typedParamsFieldInfo{
+ set: &params.BusCyclesSet,
+ b: &params.BusCycles,
+ },
+ C.VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND: typedParamsFieldInfo{
+ set: &params.StalledCyclesFrontendSet,
+ b: &params.StalledCyclesFrontend,
+ },
+ C.VIR_PERF_PARAM_STALLED_CYCLES_BACKEND: typedParamsFieldInfo{
+ set: &params.StalledCyclesBackendSet,
+ b: &params.StalledCyclesBackend,
+ },
+ C.VIR_PERF_PARAM_REF_CPU_CYCLES: typedParamsFieldInfo{
+ set: &params.RefCpuCyclesSet,
+ b: &params.RefCpuCycles,
+ },
+ C.VIR_PERF_PARAM_CPU_CLOCK: typedParamsFieldInfo{
+ set: &params.CpuClockSet,
+ b: &params.CpuClock,
+ },
+ C.VIR_PERF_PARAM_TASK_CLOCK: typedParamsFieldInfo{
+ set: &params.TaskClockSet,
+ b: &params.TaskClock,
+ },
+ C.VIR_PERF_PARAM_PAGE_FAULTS: typedParamsFieldInfo{
+ set: &params.PageFaultsSet,
+ b: &params.PageFaults,
+ },
+ C.VIR_PERF_PARAM_CONTEXT_SWITCHES: typedParamsFieldInfo{
+ set: &params.ContextSwitchesSet,
+ b: &params.ContextSwitches,
+ },
+ C.VIR_PERF_PARAM_CPU_MIGRATIONS: typedParamsFieldInfo{
+ set: &params.CpuMigrationsSet,
+ b: &params.CpuMigrations,
+ },
+ C.VIR_PERF_PARAM_PAGE_FAULTS_MIN: typedParamsFieldInfo{
+ set: &params.PageFaultsMinSet,
+ b: &params.PageFaultsMin,
+ },
+ C.VIR_PERF_PARAM_PAGE_FAULTS_MAJ: typedParamsFieldInfo{
+ set: &params.PageFaultsMajSet,
+ b: &params.PageFaultsMaj,
+ },
+ C.VIR_PERF_PARAM_ALIGNMENT_FAULTS: typedParamsFieldInfo{
+ set: &params.AlignmentFaultsSet,
+ b: &params.AlignmentFaults,
+ },
+ C.VIR_PERF_PARAM_EMULATION_FAULTS: typedParamsFieldInfo{
+ set: &params.EmulationFaultsSet,
+ b: &params.EmulationFaults,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetPerfEvents
+func (d *Domain) GetPerfEvents(flags DomainModificationImpact) (*DomainPerfEvents, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1003003 {
+ return nil, makeNotImplementedError("virDomainGetPerfEvents")
+ }
+
+ params := &DomainPerfEvents{}
+ info := getDomainPerfEventsFieldInfo(params)
+
+ var cparams *C.virTypedParameter
+ var nparams C.int
+ var err C.virError
+ ret := C.virDomainGetPerfEventsWrapper(d.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsFree(cparams, nparams)
+
+ _, gerr := typedParamsUnpackLen(cparams, int(nparams), info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetPerfEvents
+func (d *Domain) SetPerfEvents(params *DomainPerfEvents, flags DomainModificationImpact) error {
+ if C.LIBVIR_VERSION_NUMBER < 1003003 {
+ return makeNotImplementedError("virDomainSetPerfEvents")
+ }
+
+ info := getDomainPerfEventsFieldInfo(params)
+
+ var cparams *C.virTypedParameter
+ var nparams C.int
+ var err C.virError
+ ret := C.virDomainGetPerfEventsWrapper(d.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ defer C.virTypedParamsFree(cparams, nparams)
+
+ gerr := typedParamsPackLen(cparams, int(nparams), info)
+ if gerr != nil {
+ return gerr
+ }
+
+ ret = C.virDomainSetPerfEventsWrapper(d.ptr, cparams, nparams, C.uint(flags), &err)
+
+ return nil
+}
+
+type DomainSchedulerParameters struct {
+ Type string
+ CpuSharesSet bool
+ CpuShares uint64
+ GlobalPeriodSet bool
+ GlobalPeriod uint64
+ GlobalQuotaSet bool
+ GlobalQuota int64
+ VcpuPeriodSet bool
+ VcpuPeriod uint64
+ VcpuQuotaSet bool
+ VcpuQuota int64
+ EmulatorPeriodSet bool
+ EmulatorPeriod uint64
+ EmulatorQuotaSet bool
+ EmulatorQuota int64
+ IothreadPeriodSet bool
+ IothreadPeriod uint64
+ IothreadQuotaSet bool
+ IothreadQuota int64
+ WeightSet bool
+ Weight uint
+ CapSet bool
+ Cap uint
+ ReservationSet bool
+ Reservation int64
+ LimitSet bool
+ Limit int64
+ SharesSet bool
+ Shares int
+}
+
+func getDomainSchedulerParametersFieldInfo(params *DomainSchedulerParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_SCHEDULER_CPU_SHARES: typedParamsFieldInfo{
+ set: &params.CpuSharesSet,
+ ul: &params.CpuShares,
+ },
+ C.VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD: typedParamsFieldInfo{
+ set: &params.GlobalPeriodSet,
+ ul: &params.GlobalPeriod,
+ },
+ C.VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA: typedParamsFieldInfo{
+ set: &params.GlobalQuotaSet,
+ l: &params.GlobalQuota,
+ },
+ C.VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD: typedParamsFieldInfo{
+ set: &params.EmulatorPeriodSet,
+ ul: &params.EmulatorPeriod,
+ },
+ C.VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA: typedParamsFieldInfo{
+ set: &params.EmulatorQuotaSet,
+ l: &params.EmulatorQuota,
+ },
+ C.VIR_DOMAIN_SCHEDULER_VCPU_PERIOD: typedParamsFieldInfo{
+ set: &params.VcpuPeriodSet,
+ ul: &params.VcpuPeriod,
+ },
+ C.VIR_DOMAIN_SCHEDULER_VCPU_QUOTA: typedParamsFieldInfo{
+ set: &params.VcpuQuotaSet,
+ l: &params.VcpuQuota,
+ },
+ C.VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD: typedParamsFieldInfo{
+ set: &params.IothreadPeriodSet,
+ ul: &params.IothreadPeriod,
+ },
+ C.VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA: typedParamsFieldInfo{
+ set: &params.IothreadQuotaSet,
+ l: &params.IothreadQuota,
+ },
+ C.VIR_DOMAIN_SCHEDULER_WEIGHT: typedParamsFieldInfo{
+ set: &params.WeightSet,
+ ui: &params.Weight,
+ },
+ C.VIR_DOMAIN_SCHEDULER_CAP: typedParamsFieldInfo{
+ set: &params.CapSet,
+ ui: &params.Cap,
+ },
+ C.VIR_DOMAIN_SCHEDULER_RESERVATION: typedParamsFieldInfo{
+ set: &params.ReservationSet,
+ l: &params.Reservation,
+ },
+ C.VIR_DOMAIN_SCHEDULER_LIMIT: typedParamsFieldInfo{
+ set: &params.LimitSet,
+ l: &params.Limit,
+ },
+ C.VIR_DOMAIN_SCHEDULER_SHARES: typedParamsFieldInfo{
+ set: &params.SharesSet,
+ i: &params.Shares,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSchedulerParameters
+func (d *Domain) GetSchedulerParameters() (*DomainSchedulerParameters, error) {
+ params := &DomainSchedulerParameters{}
+ info := getDomainSchedulerParametersFieldInfo(params)
+
+ var nparams C.int
+ var err C.virError
+ schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &nparams, &err)
+ if schedtype == nil {
+ return nil, makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(schedtype))
+ if nparams == 0 {
+ return &DomainSchedulerParameters{
+ Type: C.GoString(schedtype),
+ }, nil
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret := C.virDomainGetSchedulerParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ _, gerr := typedParamsUnpack(cparams, info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSchedulerParametersFlags
+func (d *Domain) GetSchedulerParametersFlags(flags DomainModificationImpact) (*DomainSchedulerParameters, error) {
+ params := &DomainSchedulerParameters{}
+ info := getDomainSchedulerParametersFieldInfo(params)
+
+ var nparams C.int
+ var err C.virError
+ schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &nparams, &err)
+ if schedtype == nil {
+ return nil, makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(schedtype))
+ if nparams == 0 {
+ return &DomainSchedulerParameters{
+ Type: C.GoString(schedtype),
+ }, nil
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret := C.virDomainGetSchedulerParametersFlagsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ _, gerr := typedParamsUnpack(cparams, info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetSchedulerParameters
+func (d *Domain) SetSchedulerParameters(params *DomainSchedulerParameters) error {
+ info := getDomainSchedulerParametersFieldInfo(params)
+
+ var nparams C.int
+ var err C.virError
+ schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &nparams, &err)
+ if schedtype == nil {
+ return makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(schedtype))
+ if nparams == 0 {
+ return nil
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret := C.virDomainGetSchedulerParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ gerr := typedParamsPack(cparams, info)
+ if gerr != nil {
+ return gerr
+ }
+
+ ret = C.virDomainSetSchedulerParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, &err)
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetSchedulerParametersFlags
+func (d *Domain) SetSchedulerParametersFlags(params *DomainSchedulerParameters, flags DomainModificationImpact) error {
+ info := getDomainSchedulerParametersFieldInfo(params)
+
+ var nparams C.int
+ var err C.virError
+ schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &nparams, &err)
+ if schedtype == nil {
+ return makeError(&err)
+ }
+
+ defer C.free(unsafe.Pointer(schedtype))
+ if nparams == 0 {
+ return nil
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ ret := C.virDomainGetSchedulerParametersFlagsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+
+ gerr := typedParamsPack(cparams, info)
+ if gerr != nil {
+ return gerr
+ }
+
+ ret = C.virDomainSetSchedulerParametersFlagsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+
+ return nil
+}
+
+type SecurityLabel struct {
+ Label string
+ Enforcing bool
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSecurityLabel
+func (d *Domain) GetSecurityLabel() (*SecurityLabel, error) {
+ var clabel C.virSecurityLabel
+
+ var err C.virError
+ ret := C.virDomainGetSecurityLabelWrapper(d.ptr, &clabel, &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ return &SecurityLabel{
+ Label: C.GoString((*C.char)(unsafe.Pointer(&clabel.label))),
+ Enforcing: clabel.enforcing == 1,
+ }, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSecurityLabelList
+func (d *Domain) GetSecurityLabelList() ([]SecurityLabel, error) {
+ var clabels *C.virSecurityLabel
+
+ var err C.virError
+ ret := C.virDomainGetSecurityLabelListWrapper(d.ptr, (*C.virSecurityLabelPtr)(unsafe.Pointer(&clabels)), &err)
+ if ret == -1 {
+ return []SecurityLabel{}, makeError(&err)
+ }
+
+ labels := make([]SecurityLabel, ret)
+ for i := 0; i < int(ret); i++ {
+ var clabel *C.virSecurityLabel
+ clabel = (*C.virSecurityLabel)(unsafe.Pointer(uintptr(unsafe.Pointer(clabels)) + (unsafe.Sizeof(*clabel) * uintptr(i))))
+ labels[i] = SecurityLabel{
+ Label: C.GoString((*C.char)(unsafe.Pointer(&clabel.label))),
+ Enforcing: clabel.enforcing == 1,
+ }
+ }
+
+ return labels, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetTime
+func (d *Domain) GetTime(flags uint32) (int64, uint, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002005 {
+ return 0, 0, makeNotImplementedError("virDomainGetTime")
+ }
+ var secs C.longlong
+ var nsecs C.uint
+ var err C.virError
+ ret := C.virDomainGetTimeWrapper(d.ptr, &secs, &nsecs, C.uint(flags), &err)
+ if ret == -1 {
+ return 0, 0, makeError(&err)
+ }
+
+ return int64(secs), uint(nsecs), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetTime
+func (d *Domain) SetTime(secs int64, nsecs uint, flags DomainSetTimeFlags) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002005 {
+ return makeNotImplementedError("virDomainSetTime")
+ }
+
+ var err C.virError
+ ret := C.virDomainSetTimeWrapper(d.ptr, C.longlong(secs), C.uint(nsecs), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetUserPassword
+func (d *Domain) SetUserPassword(user string, password string, flags DomainSetUserPasswordFlags) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002015 {
+ return makeNotImplementedError("virDomainSetUserPassword")
+ }
+ cuser := C.CString(user)
+ cpassword := C.CString(password)
+
+ defer C.free(unsafe.Pointer(cuser))
+ defer C.free(unsafe.Pointer(cpassword))
+
+ var err C.virError
+ ret := C.virDomainSetUserPasswordWrapper(d.ptr, cuser, cpassword, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSave
+func (d *Domain) ManagedSave(flags DomainSaveRestoreFlags) error {
+ var err C.virError
+ ret := C.virDomainManagedSaveWrapper(d.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainHasManagedSaveImage
+func (d *Domain) HasManagedSaveImage(flags uint32) (bool, error) {
+ var err C.virError
+ result := C.virDomainHasManagedSaveImageWrapper(d.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSaveRemove
+func (d *Domain) ManagedSaveRemove(flags uint32) error {
+ var err C.virError
+ ret := C.virDomainManagedSaveRemoveWrapper(d.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainRename
+func (d *Domain) Rename(name string, flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002019 {
+ return makeNotImplementedError("virDomainRename")
+ }
+ cname := C.CString(name)
+ defer C.free(unsafe.Pointer(cname))
+ var err C.virError
+ ret := C.virDomainRenameWrapper(d.ptr, cname, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainReset
+func (d *Domain) Reset(flags uint32) error {
+ var err C.virError
+ ret := C.virDomainResetWrapper(d.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSendProcessSignal
+func (d *Domain) SendProcessSignal(pid int64, signum DomainProcessSignal, flags uint32) error {
+ var err C.virError
+ ret := C.virDomainSendProcessSignalWrapper(d.ptr, C.longlong(pid), C.uint(signum), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainInjectNMI
+func (d *Domain) InjectNMI(flags uint32) error {
+ var err C.virError
+ ret := C.virDomainInjectNMIWrapper(d.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCoreDump
+func (d *Domain) CoreDump(to string, flags DomainCoreDumpFlags) error {
+ cto := C.CString(to)
+ defer C.free(unsafe.Pointer(cto))
+
+ var err C.virError
+ ret := C.virDomainCoreDumpWrapper(d.ptr, cto, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainCoreDumpWithFormat
+func (d *Domain) CoreDumpWithFormat(to string, format DomainCoreDumpFormat, flags DomainCoreDumpFlags) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002003 {
+ makeNotImplementedError("virDomainCoreDumpWithFormat")
+ }
+ cto := C.CString(to)
+ defer C.free(unsafe.Pointer(cto))
+
+ var err C.virError
+ ret := C.virDomainCoreDumpWithFormatWrapper(d.ptr, cto, C.uint(format), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainHasCurrentSnapshot
+func (d *Domain) HasCurrentSnapshot(flags uint32) (bool, error) {
+ var err C.virError
+ result := C.virDomainHasCurrentSnapshotWrapper(d.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainFSFreeze
+func (d *Domain) FSFreeze(mounts []string, flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002005 {
+ return makeNotImplementedError("virDomainFSFreeze")
+ }
+ cmounts := make([](*C.char), len(mounts))
+
+ for i := 0; i < len(mounts); i++ {
+ cmounts[i] = C.CString(mounts[i])
+ defer C.free(unsafe.Pointer(cmounts[i]))
+ }
+
+ nmounts := len(mounts)
+ var err C.virError
+ ret := C.virDomainFSFreezeWrapper(d.ptr, (**C.char)(unsafe.Pointer(&cmounts[0])), C.uint(nmounts), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainFSThaw
+func (d *Domain) FSThaw(mounts []string, flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002005 {
+ return makeNotImplementedError("virDomainFSThaw")
+ }
+ cmounts := make([](*C.char), len(mounts))
+
+ for i := 0; i < len(mounts); i++ {
+ cmounts[i] = C.CString(mounts[i])
+ defer C.free(unsafe.Pointer(cmounts[i]))
+ }
+
+ nmounts := len(mounts)
+ var err C.virError
+ ret := C.virDomainFSThawWrapper(d.ptr, (**C.char)(unsafe.Pointer(&cmounts[0])), C.uint(nmounts), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainFSTrim
+func (d *Domain) FSTrim(mount string, minimum uint64, flags uint32) error {
+ var cmount *C.char
+ if mount != "" {
+ cmount := C.CString(mount)
+ defer C.free(unsafe.Pointer(cmount))
+ }
+
+ var err C.virError
+ ret := C.virDomainFSTrimWrapper(d.ptr, cmount, C.ulonglong(minimum), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+type DomainFSInfo struct {
+ MountPoint string
+ Name string
+ FSType string
+ DevAlias []string
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetFSInfo
+func (d *Domain) GetFSInfo(flags uint32) ([]DomainFSInfo, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002011 {
+ return []DomainFSInfo{}, makeNotImplementedError("virDomainGetFSInfo")
+ }
+ var cfsinfolist **C.virDomainFSInfo
+
+ var err C.virError
+ ret := C.virDomainGetFSInfoWrapper(d.ptr, (**C.virDomainFSInfoPtr)(unsafe.Pointer(&cfsinfolist)), C.uint(flags), &err)
+ if ret == -1 {
+ return []DomainFSInfo{}, makeError(&err)
+ }
+
+ fsinfo := make([]DomainFSInfo, int(ret))
+
+ for i := 0; i < int(ret); i++ {
+ cfsinfo := (*C.virDomainFSInfo)(*(**C.virDomainFSInfo)(unsafe.Pointer(uintptr(unsafe.Pointer(cfsinfolist)) + (unsafe.Sizeof(*cfsinfolist) * uintptr(i)))))
+
+ aliases := make([]string, int(cfsinfo.ndevAlias))
+ for j := 0; j < int(cfsinfo.ndevAlias); j++ {
+ calias := (*C.char)(*(**C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(cfsinfo.devAlias)) + (unsafe.Sizeof(*cfsinfo) * uintptr(j)))))
+ aliases[j] = C.GoString(calias)
+ }
+ fsinfo[i] = DomainFSInfo{
+ MountPoint: C.GoString(cfsinfo.mountpoint),
+ Name: C.GoString(cfsinfo.name),
+ FSType: C.GoString(cfsinfo.fstype),
+ DevAlias: aliases,
+ }
+
+ C.virDomainFSInfoFreeWrapper(cfsinfo)
+ }
+ C.free(unsafe.Pointer(cfsinfolist))
+
+ return fsinfo, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainPMSuspendForDuration
+func (d *Domain) PMSuspendForDuration(target NodeSuspendTarget, duration uint64, flags uint32) error {
+ var err C.virError
+ ret := C.virDomainPMSuspendForDurationWrapper(d.ptr, C.uint(target), C.ulonglong(duration), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainPMWakeup
+func (d *Domain) PMWakeup(flags uint32) error {
+ var err C.virError
+ ret := C.virDomainPMWakeupWrapper(d.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainAddIOThread
+func (d *Domain) AddIOThread(id uint, flags DomainModificationImpact) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002015 {
+ return makeNotImplementedError("virDomainAddIOThread")
+ }
+ var err C.virError
+ ret := C.virDomainAddIOThreadWrapper(d.ptr, C.uint(id), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDelIOThread
+func (d *Domain) DelIOThread(id uint, flags DomainModificationImpact) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002015 {
+ return makeNotImplementedError("virDomainDelIOThread")
+ }
+ var err C.virError
+ ret := C.virDomainDelIOThreadWrapper(d.ptr, C.uint(id), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetEmulatorPinInfo
+func (d *Domain) GetEmulatorPinInfo(flags DomainModificationImpact) ([]bool, error) {
+ var cnodeinfo C.virNodeInfo
+ var err C.virError
+ ret := C.virNodeGetInfoWrapper(C.virDomainGetConnect(d.ptr), &cnodeinfo, &err)
+ if ret == -1 {
+ return []bool{}, makeError(&err)
+ }
+
+ ncpus := cnodeinfo.nodes * cnodeinfo.sockets * cnodeinfo.cores * cnodeinfo.threads
+ maplen := int((ncpus + 7) / 8)
+ ccpumaps := make([]C.uchar, maplen)
+ ret = C.virDomainGetEmulatorPinInfoWrapper(d.ptr, &ccpumaps[0], C.int(maplen), C.uint(flags), &err)
+ if ret == -1 {
+ return []bool{}, makeError(&err)
+ }
+
+ cpumaps := make([]bool, ncpus)
+ for i := 0; i < int(ncpus); i++ {
+ byte := i / 8
+ bit := i % 8
+ cpumaps[i] = (ccpumaps[byte] & (1 << uint(bit))) != 0
+ }
+
+ return cpumaps, nil
+}
+
+type DomainIOThreadInfo struct {
+ IOThreadID uint
+ CpuMap []bool
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetIOThreadInfo
+func (d *Domain) GetIOThreadInfo(flags DomainModificationImpact) ([]DomainIOThreadInfo, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002014 {
+ return []DomainIOThreadInfo{}, makeNotImplementedError("virDomaingetIOThreadInfo")
+ }
+ var cinfolist **C.virDomainIOThreadInfo
+
+ var err C.virError
+ ret := C.virDomainGetIOThreadInfoWrapper(d.ptr, (**C.virDomainIOThreadInfoPtr)(unsafe.Pointer(&cinfolist)), C.uint(flags), &err)
+ if ret == -1 {
+ return []DomainIOThreadInfo{}, makeError(&err)
+ }
+
+ info := make([]DomainIOThreadInfo, int(ret))
+
+ for i := 0; i < int(ret); i++ {
+ cinfo := (*(**C.virDomainIOThreadInfo)(unsafe.Pointer(uintptr(unsafe.Pointer(cinfolist)) + (unsafe.Sizeof(*cinfolist) * uintptr(i)))))
+
+ ncpus := int(cinfo.cpumaplen * 8)
+ cpumap := make([]bool, ncpus)
+ for j := 0; j < ncpus; j++ {
+ byte := j / 8
+ bit := j % 8
+
+ cpumapbyte := *(*C.uchar)(unsafe.Pointer(uintptr(unsafe.Pointer(cinfo.cpumap)) + (unsafe.Sizeof(*cinfo.cpumap) * uintptr(byte))))
+ cpumap[j] = (cpumapbyte & (1 << uint(bit))) != 0
+ }
+
+ info[i] = DomainIOThreadInfo{
+ IOThreadID: uint(cinfo.iothread_id),
+ CpuMap: cpumap,
+ }
+
+ C.virDomainIOThreadInfoFreeWrapper(cinfo)
+ }
+ C.free(unsafe.Pointer(cinfolist))
+
+ return info, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpuPinInfo
+func (d *Domain) GetVcpuPinInfo(flags DomainModificationImpact) ([][]bool, error) {
+ var cnodeinfo C.virNodeInfo
+ var err C.virError
+ ret := C.virNodeGetInfoWrapper(C.virDomainGetConnect(d.ptr), &cnodeinfo, &err)
+ if ret == -1 {
+ return [][]bool{}, makeError(&err)
+ }
+
+ var cdominfo C.virDomainInfo
+ ret = C.virDomainGetInfoWrapper(d.ptr, &cdominfo, &err)
+ if ret == -1 {
+ return [][]bool{}, makeError(&err)
+ }
+
+ nvcpus := int(cdominfo.nrVirtCpu)
+ npcpus := int(cnodeinfo.nodes * cnodeinfo.sockets * cnodeinfo.cores * cnodeinfo.threads)
+ maplen := ((npcpus + 7) / 8)
+ ccpumaps := make([]C.uchar, maplen*nvcpus)
+
+ ret = C.virDomainGetVcpuPinInfoWrapper(d.ptr, C.int(nvcpus), &ccpumaps[0], C.int(maplen), C.uint(flags), &err)
+ if ret == -1 {
+ return [][]bool{}, makeError(&err)
+ }
+
+ cpumaps := make([][]bool, nvcpus)
+ for i := 0; i < nvcpus; i++ {
+ cpumaps[i] = make([]bool, npcpus)
+ for j := 0; j < npcpus; j++ {
+ byte := (i * maplen) + (j / 8)
+ bit := j % 8
+
+ if (ccpumaps[byte] & (1 << uint(bit))) != 0 {
+ cpumaps[i][j] = true
+ }
+ }
+ }
+
+ return cpumaps, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainPinEmulator
+func (d *Domain) PinEmulator(cpumap []bool, flags DomainModificationImpact) error {
+
+ maplen := (len(cpumap) + 7) / 8
+ ccpumaps := make([]C.uchar, maplen)
+ for i := 0; i < len(cpumap); i++ {
+ if cpumap[i] {
+ byte := i / 8
+ bit := i % 8
+
+ ccpumaps[byte] |= (1 << uint(bit))
+ }
+ }
+
+ var err C.virError
+ ret := C.virDomainPinEmulatorWrapper(d.ptr, &ccpumaps[0], C.int(maplen), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainPinIOThread
+func (d *Domain) PinIOThread(iothreadid uint, cpumap []bool, flags DomainModificationImpact) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002014 {
+ return makeNotImplementedError("virDomainPinIOThread")
+ }
+
+ maplen := (len(cpumap) + 7) / 8
+ ccpumaps := make([]C.uchar, maplen)
+ for i := 0; i < len(cpumap); i++ {
+ if cpumap[i] {
+ byte := i / 8
+ bit := i % 8
+
+ ccpumaps[byte] |= (1 << uint(bit))
+ }
+ }
+
+ var err C.virError
+ ret := C.virDomainPinIOThreadWrapper(d.ptr, C.uint(iothreadid), &ccpumaps[0], C.int(maplen), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainOpenChannel
+func (d *Domain) OpenChannel(name string, stream *Stream, flags DomainChannelFlags) error {
+ cname := C.CString(name)
+ defer C.free(unsafe.Pointer(cname))
+
+ var err C.virError
+ ret := C.virDomainOpenChannelWrapper(d.ptr, cname, stream.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainOpenConsole
+func (d *Domain) OpenConsole(devname string, stream *Stream, flags DomainConsoleFlags) error {
+ var cdevname *C.char
+ if devname != "" {
+ cdevname = C.CString(devname)
+ defer C.free(unsafe.Pointer(cdevname))
+ }
+
+ var err C.virError
+ ret := C.virDomainOpenConsoleWrapper(d.ptr, cdevname, stream.ptr, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainOpenGraphics
+func (d *Domain) OpenGraphics(idx uint, file os.File, flags DomainOpenGraphicsFlags) error {
+ var err C.virError
+ ret := C.virDomainOpenGraphicsWrapper(d.ptr, C.uint(idx), C.int(file.Fd()), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainOpenGraphicsFD
+func (d *Domain) OpenGraphicsFD(idx uint, flags DomainOpenGraphicsFlags) (*os.File, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002008 {
+ return nil, makeNotImplementedError("virDomainOpenGraphicsFD")
+ }
+ var err C.virError
+ ret := C.virDomainOpenGraphicsFDWrapper(d.ptr, C.uint(idx), C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ return os.NewFile(uintptr(ret), "graphics"), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotCreateXML
+func (d *Domain) CreateSnapshotXML(xml string, flags DomainSnapshotCreateFlags) (*DomainSnapshot, error) {
+ cXml := C.CString(xml)
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ result := C.virDomainSnapshotCreateXMLWrapper(d.ptr, cXml, C.uint(flags), &err)
+ if result == nil {
+ return nil, makeError(&err)
+ }
+ return &DomainSnapshot{ptr: result}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSave
+func (d *Domain) Save(destFile string) error {
+ cPath := C.CString(destFile)
+ defer C.free(unsafe.Pointer(cPath))
+ var err C.virError
+ result := C.virDomainSaveWrapper(d.ptr, cPath, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSaveFlags
+func (d *Domain) SaveFlags(destFile string, destXml string, flags DomainSaveRestoreFlags) error {
+ cDestFile := C.CString(destFile)
+ cDestXml := C.CString(destXml)
+ defer C.free(unsafe.Pointer(cDestXml))
+ defer C.free(unsafe.Pointer(cDestFile))
+ var err C.virError
+ result := C.virDomainSaveFlagsWrapper(d.ptr, cDestFile, cDestXml, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+type DomainGuestVcpus struct {
+ Vcpus []bool
+ Online []bool
+ Offlinable []bool
+}
+
+func getDomainGuestVcpusParametersFieldInfo(VcpusSet *bool, Vcpus *string, OnlineSet *bool, Online *string, OfflinableSet *bool, Offlinable *string) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ "vcpus": typedParamsFieldInfo{
+ set: VcpusSet,
+ s: Vcpus,
+ },
+ "online": typedParamsFieldInfo{
+ set: OnlineSet,
+ s: Online,
+ },
+ "offlinable": typedParamsFieldInfo{
+ set: OfflinableSet,
+ s: Offlinable,
+ },
+ }
+}
+
+func parseCPUString(cpumapstr string) ([]bool, error) {
+ pieces := strings.Split(cpumapstr, ",")
+ var cpumap []bool
+ for _, piece := range pieces {
+ if len(piece) < 1 {
+ return []bool{}, fmt.Errorf("Malformed cpu map string %s", cpumapstr)
+ }
+ invert := false
+ if piece[0] == '^' {
+ invert = true
+ piece = piece[1:]
+ }
+ pair := strings.Split(piece, "-")
+ var start, end int
+ var err error
+ if len(pair) == 1 {
+ start, err = strconv.Atoi(pair[0])
+ if err != nil {
+ return []bool{}, fmt.Errorf("Malformed cpu map string %s", cpumapstr)
+ }
+ end, err = strconv.Atoi(pair[0])
+ if err != nil {
+ return []bool{}, fmt.Errorf("Malformed cpu map string %s", cpumapstr)
+ }
+ } else if len(pair) == 2 {
+ start, err = strconv.Atoi(pair[0])
+ if err != nil {
+ return []bool{}, fmt.Errorf("Malformed cpu map string %s", cpumapstr)
+ }
+ end, err = strconv.Atoi(pair[1])
+ if err != nil {
+ return []bool{}, fmt.Errorf("Malformed cpu map string %s", cpumapstr)
+ }
+ } else {
+ return []bool{}, fmt.Errorf("Malformed cpu map string %s", cpumapstr)
+ }
+ if start > end {
+ return []bool{}, fmt.Errorf("Malformed cpu map string %s", cpumapstr)
+ }
+ if (end + 1) > len(cpumap) {
+ newcpumap := make([]bool, end+1)
+ copy(newcpumap, cpumap)
+ cpumap = newcpumap
+ }
+
+ for i := start; i <= end; i++ {
+ if invert {
+ cpumap[i] = false
+ } else {
+ cpumap[i] = true
+ }
+ }
+ }
+
+ return cpumap, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetGuestVcpus
+func (d *Domain) GetGuestVcpus(flags uint32) (*DomainGuestVcpus, error) {
+ if C.LIBVIR_VERSION_NUMBER < 2000000 {
+ return nil, makeNotImplementedError("virDomainGetGuestVcpus")
+ }
+
+ var VcpusSet, OnlineSet, OfflinableSet bool
+ var VcpusStr, OnlineStr, OfflinableStr string
+ info := getDomainGuestVcpusParametersFieldInfo(&VcpusSet, &VcpusStr, &OnlineSet, &OnlineStr, &OfflinableSet, &OfflinableStr)
+
+ var cparams C.virTypedParameterPtr
+ var nparams C.uint
+ var err C.virError
+ ret := C.virDomainGetGuestVcpusWrapper(d.ptr, &cparams, &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsFree(cparams, C.int(nparams))
+
+ _, gerr := typedParamsUnpackLen(cparams, int(nparams), info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return &DomainGuestVcpus{}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetGuestVcpus
+func (d *Domain) SetGuestVcpus(cpus []bool, state bool, flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 2000000 {
+ return makeNotImplementedError("virDomainSetGuestVcpus")
+ }
+
+ cpumap := ""
+ for i := 0; i < len(cpus); i++ {
+ if cpus[i] {
+ if cpumap == "" {
+ cpumap = string(i)
+ } else {
+ cpumap += "," + string(i)
+ }
+ }
+ }
+
+ var cstate C.int
+ if state {
+ cstate = 1
+ } else {
+ cstate = 0
+ }
+ ccpumap := C.CString(cpumap)
+ defer C.free(unsafe.Pointer(ccpumap))
+ var err C.virError
+ ret := C.virDomainSetGuestVcpusWrapper(d.ptr, ccpumap, cstate, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetVcpu
+func (d *Domain) SetVcpu(cpus []bool, state bool, flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 3001000 {
+ return makeNotImplementedError("virDomainSetVcpu")
+ }
+
+ cpumap := ""
+ for i := 0; i < len(cpus); i++ {
+ if cpus[i] {
+ if cpumap == "" {
+ cpumap = string(i)
+ } else {
+ cpumap += "," + string(i)
+ }
+ }
+ }
+
+ var cstate C.int
+ if state {
+ cstate = 1
+ } else {
+ cstate = 0
+ }
+ ccpumap := C.CString(cpumap)
+ defer C.free(unsafe.Pointer(ccpumap))
+ var err C.virError
+ ret := C.virDomainSetVcpuWrapper(d.ptr, ccpumap, cstate, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetBlockThreshold
+func (d *Domain) SetBlockThreshold(dev string, threshold uint64, flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 3002000 {
+ return makeNotImplementedError("virDomainSetBlockThreshold")
+ }
+
+ cdev := C.CString(dev)
+ defer C.free(unsafe.Pointer(cdev))
+ var err C.virError
+ ret := C.virDomainSetBlockThresholdWrapper(d.ptr, cdev, C.ulonglong(threshold), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSaveDefineXML
+func (d *Domain) ManagedSaveDefineXML(xml string, flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 3007000 {
+ return makeNotImplementedError("virDomainManagedSaveDefineXML")
+ }
+
+ cxml := C.CString(xml)
+ defer C.free(unsafe.Pointer(cxml))
+ var err C.virError
+ ret := C.virDomainManagedSaveDefineXMLWrapper(d.ptr, cxml, C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainManagedSaveGetXMLDesc
+func (d *Domain) ManagedSaveGetXMLDesc(flags uint32) (string, error) {
+ if C.LIBVIR_VERSION_NUMBER < 3007000 {
+ return "", makeNotImplementedError("virDomainManagedSaveGetXMLDesc")
+ }
+
+ var err C.virError
+ ret := C.virDomainManagedSaveGetXMLDescWrapper(d.ptr, C.uint(flags), &err)
+ if ret == nil {
+ return "", makeError(&err)
+ }
+
+ xml := C.GoString(ret)
+ C.free(unsafe.Pointer(ret))
+ return xml, nil
+}
+
+type DomainLifecycle int
+
+const (
+ DOMAIN_LIFECYCLE_POWEROFF = DomainLifecycle(C.VIR_DOMAIN_LIFECYCLE_POWEROFF)
+ DOMAIN_LIFECYCLE_REBOOT = DomainLifecycle(C.VIR_DOMAIN_LIFECYCLE_REBOOT)
+ DOMAIN_LIFECYCLE_CRASH = DomainLifecycle(C.VIR_DOMAIN_LIFECYCLE_CRASH)
+)
+
+type DomainLifecycleAction int
+
+const (
+ DOMAIN_LIFECYCLE_ACTION_DESTROY = DomainLifecycleAction(C.VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY)
+ DOMAIN_LIFECYCLE_ACTION_RESTART = DomainLifecycleAction(C.VIR_DOMAIN_LIFECYCLE_ACTION_RESTART)
+ DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME = DomainLifecycleAction(C.VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME)
+ DOMAIN_LIFECYCLE_ACTION_PRESERVE = DomainLifecycleAction(C.VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE)
+ DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY = DomainLifecycleAction(C.VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY)
+ DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART = DomainLifecycleAction(C.VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART)
+)
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainSetLifecycleAction
+func (d *Domain) SetLifecycleAction(lifecycleType uint32, action uint32, flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 3009000 {
+ return makeNotImplementedError("virDomainSetLifecycleAction")
+ }
+
+ var err C.virError
+ ret := C.virDomainSetLifecycleActionWrapper(d.ptr, C.uint(lifecycleType), C.uint(action), C.uint(flags), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+type DomainLaunchSecurityParameters struct {
+ SEVMeasurementSet bool
+ SEVMeasurement string
+}
+
+func getDomainLaunchSecurityFieldInfo(params *DomainLaunchSecurityParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_LAUNCH_SECURITY_SEV_MEASUREMENT: typedParamsFieldInfo{
+ set: &params.SEVMeasurementSet,
+ s: &params.SEVMeasurement,
+ },
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetLaunchSecurityInfo
+func (d *Domain) GetLaunchSecurityInfo(flags uint32) (*DomainLaunchSecurityParameters, error) {
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return nil, makeNotImplementedError("virDomainGetLaunchSecurityInfo")
+ }
+
+ params := &DomainLaunchSecurityParameters{}
+ info := getDomainLaunchSecurityFieldInfo(params)
+
+ var cparams *C.virTypedParameter
+ var nparams C.int
+
+ var err C.virError
+ ret := C.virDomainGetLaunchSecurityInfoWrapper(d.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ defer C.virTypedParamsFree(cparams, nparams)
+
+ _, gerr := typedParamsUnpackLen(cparams, int(nparams), info)
+ if gerr != nil {
+ return nil, gerr
+ }
+
+ return params, nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/domain_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_compat.h
new file mode 100644
index 00000000..d20631fc
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_compat.h
@@ -0,0 +1,914 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_DOMAIN_COMPAT_H__
+#define LIBVIRT_GO_DOMAIN_COMPAT_H__
+
+/* 1.2.2 */
+
+#ifndef VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS
+#define VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS "device_read_iops_sec"
+#endif
+
+#ifndef VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS
+#define VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS "device_write_iops_sec"
+#endif
+
+#ifndef VIR_DOMAIN_BLKIO_DEVICE_READ_BPS
+#define VIR_DOMAIN_BLKIO_DEVICE_READ_BPS "device_read_bytes_sec"
+#endif
+
+#ifndef VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS
+#define VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS "device_write_bytes_sec"
+#endif
+
+
+/* 1.2.3 */
+
+#ifndef VIR_DOMAIN_CORE_DUMP_FORMAT_RAW
+#define VIR_DOMAIN_CORE_DUMP_FORMAT_RAW 0
+#endif
+
+#ifndef VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB
+#define VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB 1
+#endif
+
+#ifndef VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO
+#define VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO 2
+#endif
+
+#ifndef VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY
+#define VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY 3
+#endif
+
+#ifndef VIR_MIGRATE_AUTO_CONVERGE
+#define VIR_MIGRATE_AUTO_CONVERGE 1 << 13
+#endif
+
+
+/* 1.2.5 */
+
+#ifndef VIR_DOMAIN_REBOOT_PARAVIRT
+#define VIR_DOMAIN_REBOOT_PARAVIRT 1 << 4
+#endif
+
+#ifndef VIR_DOMAIN_SHUTDOWN_PARAVIRT
+#define VIR_DOMAIN_SHUTDOWN_PARAVIRT 1 << 4
+#endif
+
+#ifndef VIR_DOMAIN_TIME_SYNC
+#define VIR_DOMAIN_TIME_SYNC 1 << 0
+#endif
+
+/* 1.2.6 */
+
+#ifndef VIR_DOMAIN_BLOCK_COMMIT_ACTIVE
+#define VIR_DOMAIN_BLOCK_COMMIT_ACTIVE 1 << 2
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT
+#define VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT 4
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2
+#define VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 16
+#endif
+
+
+/* 1.2.7 */
+
+#ifndef VIR_DOMAIN_BLOCK_COMMIT_RELATIVE
+#define VIR_DOMAIN_BLOCK_COMMIT_RELATIVE 1 << 3
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_REBASE_RELATIVE
+#define VIR_DOMAIN_BLOCK_REBASE_RELATIVE 1 << 4
+#endif
+
+
+/* 1.2.8 */
+
+#ifndef VIR_DOMAIN_BLOCK_COPY_SHALLOW
+#define VIR_DOMAIN_BLOCK_COPY_SHALLOW 1 << 0
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_COPY_REUSE_EXT
+#define VIR_DOMAIN_BLOCK_COPY_REUSE_EXT 1 << 1
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_COPY_BANDWIDTH
+#define VIR_DOMAIN_BLOCK_COPY_BANDWIDTH "bandwidth"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_COPY_GRANULARITY
+#define VIR_DOMAIN_BLOCK_COPY_GRANULARITY "granularity"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_COPY_BUF_SIZE
+#define VIR_DOMAIN_BLOCK_COPY_BUF_SIZE "buf-size"
+#endif
+
+#ifndef VIR_DOMAIN_STATS_STATE
+#define VIR_DOMAIN_STATS_STATE 1 << 0
+#endif
+
+/* 1.2.9 */
+
+#ifndef VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES
+#define VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES 1 << 4
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES
+#define VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES 1 << 0
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES
+#define VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES 1 << 0
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES
+#define VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES 1 << 6
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_REBASE_COPY_DEV
+#define VIR_DOMAIN_BLOCK_REBASE_COPY_DEV 1 << 5
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES
+#define VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES 1 << 6
+#endif
+
+#ifndef VIR_DOMAIN_JOB_DISK_BPS
+#define VIR_DOMAIN_JOB_DISK_BPS "disk_bps"
+#endif
+
+#ifndef VIR_DOMAIN_JOB_MEMORY_BPS
+#define VIR_DOMAIN_JOB_MEMORY_BPS "memory_bps"
+#endif
+
+#ifndef VIR_DOMAIN_JOB_SETUP_TIME
+#define VIR_DOMAIN_JOB_SETUP_TIME "setup_time"
+#endif
+
+#ifndef VIR_DOMAIN_JOB_STATS_COMPLETED
+#define VIR_DOMAIN_JOB_STATS_COMPLETED 1 << 0
+#endif
+
+#ifndef VIR_DOMAIN_STATS_CPU_TOTAL
+#define VIR_DOMAIN_STATS_CPU_TOTAL 1 << 1
+#endif
+
+#ifndef VIR_DOMAIN_STATS_BALLOON
+#define VIR_DOMAIN_STATS_BALLOON 1 << 2
+#endif
+
+#ifndef VIR_DOMAIN_STATS_VCPU
+#define VIR_DOMAIN_STATS_VCPU 1 << 3
+#endif
+
+#ifndef VIR_DOMAIN_STATS_INTERFACE
+#define VIR_DOMAIN_STATS_INTERFACE 1 << 4
+#endif
+
+#ifndef VIR_DOMAIN_STATS_BLOCK
+#define VIR_DOMAIN_STATS_BLOCK 1 << 5
+#endif
+
+#ifndef VIR_DOMAIN_UNDEFINE_NVRAM
+#define VIR_DOMAIN_UNDEFINE_NVRAM 1 << 2
+#endif
+
+#ifndef VIR_MIGRATE_RDMA_PIN_ALL
+#define VIR_MIGRATE_RDMA_PIN_ALL 1 << 14
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_ID_TUNABLE
+#define VIR_DOMAIN_EVENT_ID_TUNABLE 17
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_DISK
+#define VIR_DOMAIN_TUNABLE_BLKDEV_DISK "blkdeviotune.disk"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC
+#define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC "blkdeviotune.total_bytes_sec"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC
+#define VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC "blkdeviotune.read_bytes_sec"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC
+#define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC "blkdeviotune.write_bytes_sec"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC
+#define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC "blkdeviotune.total_iops_sec"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC
+#define VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC "blkdeviotune.read_iops_sec"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC
+#define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC "blkdeviotune.write_iops_sec"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES
+#define VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES "cputune.cpu_shares"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN
+#define VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN "cputune.emulatorpin"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_CPU_EMULATOR_PERIOD
+#define VIR_DOMAIN_TUNABLE_CPU_EMULATOR_PERIOD "cputune.emulator_period"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA
+#define VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA "cputune.emulator_quota"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD
+#define VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD "cputune.vcpu_period"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_CPU_VCPU_QUOTA
+#define VIR_DOMAIN_TUNABLE_CPU_VCPU_QUOTA "cputune.vcpu_quota"
+#endif
+
+
+
+/* 1.2.11 */
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX
+#define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX "blkdeviotune.total_bytes_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX
+#define VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX "blkdeviotune.read_bytes_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX
+#define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX "blkdeviotune.write_bytes_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX
+#define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX "blkdeviotune.total_iops_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX
+#define VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX "blkdeviotune.read_iops_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX
+#define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX "blkdeviotune.write_iops_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC
+#define VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC "blkdeviotune.size_iops_sec"
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE
+#define VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE 18
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX
+#define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX "total_bytes_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX
+#define VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX "read_bytes_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX
+#define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX "write_bytes_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX
+#define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX "total_iops_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX
+#define VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX "read_iops_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX
+#define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX "write_iops_sec_max"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC
+#define VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC "size_iops_sec"
+#endif
+
+#if LIBVIR_VERSION_NUMBER < 1002011
+typedef struct _virDomainFSInfo virDomainFSInfo;
+typedef virDomainFSInfo *virDomainFSInfoPtr;
+struct _virDomainFSInfo {
+ char *mountpoint; /* path to mount point */
+ char *name; /* device name in the guest (e.g. "sda1") */
+ char *fstype; /* filesystem type */
+ size_t ndevAlias; /* number of elements in devAlias */
+ char **devAlias; /* array of disk device aliases */
+};
+#endif
+
+/* 1.2.12 */
+
+#ifndef VIR_DOMAIN_DEFINE_VALIDATE
+#define VIR_DOMAIN_DEFINE_VALIDATE 1 << 0
+#endif
+
+#ifndef VIR_DOMAIN_START_VALIDATE
+#define VIR_DOMAIN_START_VALIDATE 1 << 4
+#endif
+
+
+/* 1.2.14 */
+
+#ifndef VIR_DOMAIN_CONTROL_ERROR_REASON_NONE
+#define VIR_DOMAIN_CONTROL_ERROR_REASON_NONE 0
+#endif
+
+#ifndef VIR_DOMAIN_CONTROL_ERROR_REASON_UNKNOWN
+#define VIR_DOMAIN_CONTROL_ERROR_REASON_UNKNOWN 1
+#endif
+
+#ifndef VIR_DOMAIN_CONTROL_ERROR_REASON_MONITOR
+#define VIR_DOMAIN_CONTROL_ERROR_REASON_MONITOR 2
+#endif
+
+#ifndef VIR_DOMAIN_CONTROL_ERROR_REASON_INTERNAL
+#define VIR_DOMAIN_CONTROL_ERROR_REASON_INTERNAL 3
+#endif
+
+#ifndef VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE
+#define VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE 0
+#endif
+
+#ifndef VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT
+#define VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT 1
+#endif
+
+#ifndef VIR_DOMAIN_PAUSED_STARTING_UP
+#define VIR_DOMAIN_PAUSED_STARTING_UP 11
+#endif
+
+#if LIBVIR_VERSION_NUMBER < 1002014
+typedef struct _virDomainIOThreadInfo virDomainIOThreadInfo;
+typedef virDomainIOThreadInfo *virDomainIOThreadInfoPtr;
+struct _virDomainIOThreadInfo {
+ unsigned int iothread_id; /* IOThread ID */
+ unsigned char *cpumap; /* CPU map for thread. A pointer to an */
+ /* array of real CPUs (in 8-bit bytes) */
+ int cpumaplen; /* cpumap size */
+};
+
+typedef struct _virDomainInterfaceIPAddress virDomainIPAddress;
+typedef virDomainIPAddress *virDomainIPAddressPtr;
+struct _virDomainInterfaceIPAddress {
+ int type; /* virIPAddrType */
+ char *addr; /* IP address */
+ unsigned int prefix; /* IP address prefix */
+};
+
+typedef struct _virDomainInterface virDomainInterface;
+typedef virDomainInterface *virDomainInterfacePtr;
+struct _virDomainInterface {
+ char *name; /* interface name */
+ char *hwaddr; /* hardware address, may be NULL */
+ unsigned int naddrs; /* number of items in @addrs */
+ virDomainIPAddressPtr addrs; /* array of IP addresses */
+};
+#endif
+
+
+/* 1.2.15 */
+
+#ifndef VIR_DOMAIN_JOB_DOWNTIME_NET
+#define VIR_DOMAIN_JOB_DOWNTIME_NET "downtime_net"
+#endif
+
+#ifndef VIR_DOMAIN_JOB_TIME_ELAPSED_NET
+#define VIR_DOMAIN_JOB_TIME_ELAPSED_NET "time_elapsed_net"
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_ID_DEVICE_ADDED
+#define VIR_DOMAIN_EVENT_ID_DEVICE_ADDED 19
+#endif
+
+
+/* 1.2.16 */
+
+#ifndef VIR_DOMAIN_PASSWORD_ENCRYPTED
+#define VIR_DOMAIN_PASSWORD_ENCRYPTED 1 << 0
+#endif
+
+
+/* 1.2.17 */
+
+#ifndef VIR_DOMAIN_EVENT_WATCHDOG_INJECTNMI
+#define VIR_DOMAIN_EVENT_WATCHDOG_INJECTNMI 6
+#endif
+
+#ifndef VIR_MIGRATE_PARAM_MIGRATE_DISKS
+#define VIR_MIGRATE_PARAM_MIGRATE_DISKS "migrate_disks"
+#endif
+
+
+/* 1.2.19 */
+
+#ifndef VIR_DOMAIN_BANDWIDTH_IN_FLOOR
+#define VIR_DOMAIN_BANDWIDTH_IN_FLOOR "inbound.floor"
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_DEFINED_RENAMED
+#define VIR_DOMAIN_EVENT_DEFINED_RENAMED 2
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_UNDEFINED_RENAMED
+#define VIR_DOMAIN_EVENT_UNDEFINED_RENAMED 1
+#endif
+
+
+/* 1.3.1 */
+
+#ifndef VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE
+#define VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE "memory_dirty_rate"
+#endif
+
+#ifndef VIR_DOMAIN_JOB_MEMORY_ITERATION
+#define VIR_DOMAIN_JOB_MEMORY_ITERATION "memory_iteration"
+#endif
+
+
+/* 1.3.2 */
+
+#ifndef VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION
+#define VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION 20
+#endif
+
+
+/* 1.3.3 */
+
+#ifndef VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT
+#define VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT 3
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_RESUMED_POSTCOPY
+#define VIR_DOMAIN_EVENT_RESUMED_POSTCOPY 3
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY
+#define VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY 7
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED
+#define VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED 8
+#endif
+
+#ifndef VIR_DOMAIN_PAUSED_POSTCOPY
+#define VIR_DOMAIN_PAUSED_POSTCOPY 12
+#endif
+
+#ifndef VIR_DOMAIN_PAUSED_POSTCOPY_FAILED
+#define VIR_DOMAIN_PAUSED_POSTCOPY_FAILED 13
+#endif
+
+#ifndef VIR_DOMAIN_RUNNING_POSTCOPY
+#define VIR_DOMAIN_RUNNING_POSTCOPY 10
+#endif
+
+#ifndef VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD
+#define VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD "global_period"
+#endif
+
+#ifndef VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA
+#define VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA "global_quota"
+#endif
+
+#ifndef VIR_DOMAIN_STATS_PERF
+#define VIR_DOMAIN_STATS_PERF (1 << 6)
+#endif
+
+#ifndef VIR_MIGRATE_PARAM_DISKS_PORT
+#define VIR_MIGRATE_PARAM_DISKS_PORT "disks_port"
+#endif
+
+#ifndef VIR_PERF_PARAM_CMT
+#define VIR_PERF_PARAM_CMT "cmt"
+#endif
+
+#ifndef VIR_MIGRATE_POSTCOPY
+#define VIR_MIGRATE_POSTCOPY (1 << 15)
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_ID_JOB_COMPLETED
+#define VIR_DOMAIN_EVENT_ID_JOB_COMPLETED 21
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD
+#define VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD "cputune.global_period"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA
+#define VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA "cputune.global_quota"
+#endif
+
+/* 1.3.4 */
+
+#ifndef VIR_MIGRATE_PARAM_COMPRESSION
+#define VIR_MIGRATE_PARAM_COMPRESSION "compression"
+#endif
+
+#ifndef VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS
+#define VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS "compression.mt.threads"
+#endif
+
+#ifndef VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS
+#define VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS "compression.mt.dthreads"
+#endif
+
+#ifndef VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL
+#define VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL "compression.mt.level"
+#endif
+
+#ifndef VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE
+#define VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE "compression.xbzrle.cache"
+#endif
+
+#ifndef VIR_MIGRATE_PARAM_PERSIST_XML
+#define VIR_MIGRATE_PARAM_PERSIST_XML "persistent_xml"
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED
+#define VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED 22
+#endif
+
+
+/* 1.3.5 */
+
+#ifndef VIR_PERF_PARAM_MBML
+#define VIR_PERF_PARAM_MBML "mbml"
+#endif
+
+#ifndef VIR_PERF_PARAM_MBMT
+#define VIR_PERF_PARAM_MBMT "mbmt"
+#endif
+
+
+/* 2.0.0 */
+
+#ifndef VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE
+#define VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "auto_converge_throttle"
+#endif
+
+#ifndef VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL
+#define VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL "auto_converge.initial"
+#endif
+
+#ifndef VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT
+#define VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT "auto_converge.increment"
+#endif
+
+/* 2.1.0 */
+
+#ifndef VIR_DOMAIN_MEMORY_STAT_USABLE
+#define VIR_DOMAIN_MEMORY_STAT_USABLE 8
+#endif
+
+#ifndef VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE
+#define VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE 9
+#endif
+
+/* 2.2.0 */
+
+#ifndef VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD
+#define VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD "iothread_period"
+#endif
+
+#ifndef VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA
+#define VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA "iothread_quota"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_PERIOD
+#define VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_PERIOD "cputune.iothread_period"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_QUOTA
+# define VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_QUOTA "cputune.iothread_quota"
+#endif
+
+
+/* 2.3.0 */
+
+#ifndef VIR_DOMAIN_UNDEFINE_KEEP_NVRAM
+#define VIR_DOMAIN_UNDEFINE_KEEP_NVRAM (1 << 3)
+#endif
+
+#ifndef VIR_PERF_PARAM_CACHE_MISSES
+#define VIR_PERF_PARAM_CACHE_MISSES "cache_misses"
+#endif
+
+#ifndef VIR_PERF_PARAM_CACHE_REFERENCES
+#define VIR_PERF_PARAM_CACHE_REFERENCES "cache_references"
+#endif
+
+#ifndef VIR_PERF_PARAM_INSTRUCTIONS
+#define VIR_PERF_PARAM_INSTRUCTIONS "instructions"
+#endif
+
+#ifndef VIR_PERF_PARAM_CPU_CYCLES
+#define VIR_PERF_PARAM_CPU_CYCLES "cpu_cycles"
+#endif
+
+
+/* 2.4.0 */
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH
+#define VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH "read_bytes_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH
+#define VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH "read_iops_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH
+#define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH "total_bytes_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH
+#define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH "total_iops_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH
+#define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH "write_bytes_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH
+#define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH "write_iopcs_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH
+#define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH "blkdeviotune.total_bytes_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH
+#define VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH "blkdeviotune.read_bytes_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH
+#define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH "blkdeviotune.write_bytes_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH
+#define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH "blkdeviotune.total_iops_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH
+#define VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH "blkdeviotune.read_iops_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH
+#define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH "blkdeviotune.write_iops_sec_max_length"
+#endif
+
+#ifndef VIR_DOMAIN_VCPU_HOTPLUGGABLE
+#define VIR_DOMAIN_VCPU_HOTPLUGGABLE (1 << 4)
+#endif
+
+/* 3.0.0 */
+
+#ifndef VIR_PERF_PARAM_BRANCH_INSTRUCTIONS
+#define VIR_PERF_PARAM_BRANCH_INSTRUCTIONS "branch_instructions"
+#endif
+
+#ifndef VIR_PERF_PARAM_BRANCH_MISSES
+#define VIR_PERF_PARAM_BRANCH_MISSES "branch_misses"
+#endif
+
+#ifndef VIR_PERF_PARAM_BUS_CYCLES
+#define VIR_PERF_PARAM_BUS_CYCLES "bus_cycles"
+#endif
+
+#ifndef VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND
+#define VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND "stalled_cycles_frontend"
+#endif
+
+#ifndef VIR_PERF_PARAM_STALLED_CYCLES_BACKEND
+#define VIR_PERF_PARAM_STALLED_CYCLES_BACKEND "stalled_cycles_backend"
+#endif
+
+#ifndef VIR_PERF_PARAM_REF_CPU_CYCLES
+#define VIR_PERF_PARAM_REF_CPU_CYCLES "ref_cpu_cycles"
+#endif
+
+#ifndef VIR_PERF_PARAM_CPU_CLOCK
+#define VIR_PERF_PARAM_CPU_CLOCK "cpu_clock"
+#endif
+
+#ifndef VIR_PERF_PARAM_TASK_CLOCK
+#define VIR_PERF_PARAM_TASK_CLOCK "task_clock"
+#endif
+
+#ifndef VIR_PERF_PARAM_PAGE_FAULTS
+#define VIR_PERF_PARAM_PAGE_FAULTS "page_faults"
+#endif
+
+#ifndef VIR_PERF_PARAM_CONTEXT_SWITCHES
+#define VIR_PERF_PARAM_CONTEXT_SWITCHES "context_switches"
+#endif
+
+#ifndef VIR_PERF_PARAM_CPU_MIGRATIONS
+#define VIR_PERF_PARAM_CPU_MIGRATIONS "cpu_migrations"
+#endif
+
+#ifndef VIR_PERF_PARAM_PAGE_FAULTS_MIN
+#define VIR_PERF_PARAM_PAGE_FAULTS_MIN "page_faults_min"
+#endif
+
+#ifndef VIR_PERF_PARAM_PAGE_FAULTS_MAJ
+#define VIR_PERF_PARAM_PAGE_FAULTS_MAJ "page_faults_maj"
+#endif
+
+#ifndef VIR_PERF_PARAM_ALIGNMENT_FAULTS
+#define VIR_PERF_PARAM_ALIGNMENT_FAULTS "alignment_faults"
+#endif
+
+#ifndef VIR_PERF_PARAM_EMULATION_FAULTS
+#define VIR_PERF_PARAM_EMULATION_FAULTS "emulation_faults"
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_ID_METADATA_CHANGE
+#define VIR_DOMAIN_EVENT_ID_METADATA_CHANGE 23
+#endif
+
+#ifndef VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME
+#define VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME "group_name"
+#endif
+
+#ifndef VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NAME
+#define VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NAME "blkdeviotune.group_name"
+#endif
+
+/* 3.2.0 */
+
+#ifndef VIR_MIGRATE_TLS
+#define VIR_MIGRATE_TLS 1 << 16
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD
+#define VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD 24
+#endif
+
+/* 3.3.0 */
+
+#ifndef VIR_DOMAIN_JOB_OPERATION
+#define VIR_DOMAIN_JOB_OPERATION "operation"
+#endif
+
+#ifndef VIR_DOMAIN_JOB_OPERATION_UNKNOWN
+#define VIR_DOMAIN_JOB_OPERATION_UNKNOWN 0
+#endif
+
+#ifndef VIR_DOMAIN_JOB_OPERATION_START
+#define VIR_DOMAIN_JOB_OPERATION_START 1
+#endif
+
+#ifndef VIR_DOMAIN_JOB_OPERATION_SAVE
+#define VIR_DOMAIN_JOB_OPERATION_SAVE 2
+#endif
+
+#ifndef VIR_DOMAIN_JOB_OPERATION_RESTORE
+#define VIR_DOMAIN_JOB_OPERATION_RESTORE 3
+#endif
+
+#ifndef VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN
+#define VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN 4
+#endif
+
+#ifndef VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT
+#define VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT 5
+#endif
+
+#ifndef VIR_DOMAIN_JOB_OPERATION_SNAPSHOT
+#define VIR_DOMAIN_JOB_OPERATION_SNAPSHOT 6
+#endif
+
+#ifndef VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT
+#define VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT 7
+#endif
+
+#ifndef VIR_DOMAIN_JOB_OPERATION_DUMP
+#define VIR_DOMAIN_JOB_OPERATION_DUMP 8
+#endif
+
+
+/* 3.4.0 */
+
+#ifndef VIR_DOMAIN_EVENT_SHUTDOWN_GUEST
+#define VIR_DOMAIN_EVENT_SHUTDOWN_GUEST 1
+#endif
+
+#ifndef VIR_DOMAIN_EVENT_SHUTDOWN_HOST
+#define VIR_DOMAIN_EVENT_SHUTDOWN_HOST 2
+#endif
+
+
+/* 3.5.0 */
+
+#ifndef VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB
+#define VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB 1 << 2
+#endif
+
+
+/* 3.9.0 */
+
+#ifndef VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE
+#define VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE "memory_page_size"
+#endif
+
+#ifndef VIR_DOMAIN_LIFECYCLE_POWEROFF
+#define VIR_DOMAIN_LIFECYCLE_POWEROFF 0
+#endif
+
+#ifndef VIR_DOMAIN_LIFECYCLE_REBOOT
+#define VIR_DOMAIN_LIFECYCLE_REBOOT 1
+#endif
+
+#ifndef VIR_DOMAIN_LIFECYCLE_CRASH
+#define VIR_DOMAIN_LIFECYCLE_CRASH 2
+#endif
+
+#ifndef VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY
+#define VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY 0
+#endif
+
+#ifndef VIR_DOMAIN_LIFECYCLE_ACTION_RESTART
+#define VIR_DOMAIN_LIFECYCLE_ACTION_RESTART 1
+#endif
+
+#ifndef VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME
+#define VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME 2
+#endif
+
+#ifndef VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE
+#define VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE 3
+#endif
+
+#ifndef VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY
+#define VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY 4
+#endif
+
+#ifndef VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART
+#define VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART 5
+#endif
+
+/* 4.2.0 */
+
+#ifndef VIR_KEYCODE_SET_QNUM
+#define VIR_KEYCODE_SET_QNUM 9
+#endif
+
+#ifndef VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP
+#define VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP 1
+#endif
+
+/* 4.5.0 */
+
+
+#ifndef VIR_DOMAIN_LAUNCH_SECURITY_SEV_MEASUREMENT
+#define VIR_DOMAIN_LAUNCH_SECURITY_SEV_MEASUREMENT "sev-measurement"
+#endif
+
+/* 4.6.0 */
+
+#ifndef VIR_DOMAIN_MEMORY_STAT_DISK_CACHES
+#define VIR_DOMAIN_MEMORY_STAT_DISK_CACHES 10
+#endif
+
+#endif /* LIBVIRT_GO_DOMAIN_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/domain_events.go b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_events.go
new file mode 100644
index 00000000..fe46c5e2
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_events.go
@@ -0,0 +1,1633 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+/*
+#cgo pkg-config: libvirt
+#include "domain_events_wrapper.h"
+*/
+import "C"
+
+type DomainEventGenericCallback func(c *Connect, d *Domain)
+
+type DomainEventLifecycle struct {
+ Event DomainEventType
+ // TODO: we can make Detail typesafe somehow ?
+ Detail int
+}
+
+type DomainEventLifecycleCallback func(c *Connect, d *Domain, event *DomainEventLifecycle)
+
+type DomainEventRTCChange struct {
+ Utcoffset int64
+}
+
+type DomainEventRTCChangeCallback func(c *Connect, d *Domain, event *DomainEventRTCChange)
+
+type DomainEventWatchdog struct {
+ Action DomainEventWatchdogAction
+}
+
+type DomainEventWatchdogCallback func(c *Connect, d *Domain, event *DomainEventWatchdog)
+
+type DomainEventIOError struct {
+ SrcPath string
+ DevAlias string
+ Action DomainEventIOErrorAction
+}
+
+type DomainEventIOErrorCallback func(c *Connect, d *Domain, event *DomainEventIOError)
+
+type DomainEventGraphicsAddress struct {
+ Family DomainEventGraphicsAddressType
+ Node string
+ Service string
+}
+
+type DomainEventGraphicsSubjectIdentity struct {
+ Type string
+ Name string
+}
+
+type DomainEventGraphics struct {
+ Phase DomainEventGraphicsPhase
+ Local DomainEventGraphicsAddress
+ Remote DomainEventGraphicsAddress
+ AuthScheme string
+ Subject []DomainEventGraphicsSubjectIdentity
+}
+
+type DomainEventGraphicsCallback func(c *Connect, d *Domain, event *DomainEventGraphics)
+
+type DomainEventIOErrorReason struct {
+ SrcPath string
+ DevAlias string
+ Action DomainEventIOErrorAction
+ Reason string
+}
+
+type DomainEventIOErrorReasonCallback func(c *Connect, d *Domain, event *DomainEventIOErrorReason)
+
+type DomainEventBlockJob struct {
+ Disk string
+ Type DomainBlockJobType
+ Status ConnectDomainEventBlockJobStatus
+}
+
+type DomainEventBlockJobCallback func(c *Connect, d *Domain, event *DomainEventBlockJob)
+
+type DomainEventDiskChange struct {
+ OldSrcPath string
+ NewSrcPath string
+ DevAlias string
+ Reason ConnectDomainEventDiskChangeReason
+}
+
+type DomainEventDiskChangeCallback func(c *Connect, d *Domain, event *DomainEventDiskChange)
+
+type DomainEventTrayChange struct {
+ DevAlias string
+ Reason ConnectDomainEventTrayChangeReason
+}
+
+type DomainEventTrayChangeCallback func(c *Connect, d *Domain, event *DomainEventTrayChange)
+
+type DomainEventPMSuspend struct {
+ Reason int
+}
+
+type DomainEventPMSuspendCallback func(c *Connect, d *Domain, event *DomainEventPMSuspend)
+
+type DomainEventPMWakeup struct {
+ Reason int
+}
+
+type DomainEventPMWakeupCallback func(c *Connect, d *Domain, event *DomainEventPMWakeup)
+
+type DomainEventPMSuspendDisk struct {
+ Reason int
+}
+
+type DomainEventPMSuspendDiskCallback func(c *Connect, d *Domain, event *DomainEventPMSuspendDisk)
+
+type DomainEventBalloonChange struct {
+ Actual uint64
+}
+
+type DomainEventBalloonChangeCallback func(c *Connect, d *Domain, event *DomainEventBalloonChange)
+
+type DomainEventDeviceRemoved struct {
+ DevAlias string
+}
+
+type DomainEventDeviceRemovedCallback func(c *Connect, d *Domain, event *DomainEventDeviceRemoved)
+
+type DomainEventTunableCpuPin struct {
+ VcpuPinSet bool
+ VcpuPin [][]bool
+ EmulatorPinSet bool
+ EmulatorPin []bool
+ IOThreadPinSet bool
+ IOThreadPin [][]bool
+}
+
+type DomainEventTunable struct {
+ CpuSched *DomainSchedulerParameters
+ CpuPin *DomainEventTunableCpuPin
+ BlkdevDiskSet bool
+ BlkdevDisk string
+ BlkdevTune *DomainBlockIoTuneParameters
+}
+
+type DomainEventTunableCallback func(c *Connect, d *Domain, event *DomainEventTunable)
+
+type DomainEventAgentLifecycle struct {
+ State ConnectDomainEventAgentLifecycleState
+ Reason ConnectDomainEventAgentLifecycleReason
+}
+
+type DomainEventAgentLifecycleCallback func(c *Connect, d *Domain, event *DomainEventAgentLifecycle)
+
+type DomainEventDeviceAdded struct {
+ DevAlias string
+}
+
+type DomainEventDeviceAddedCallback func(c *Connect, d *Domain, event *DomainEventDeviceAdded)
+
+type DomainEventMigrationIteration struct {
+ Iteration int
+}
+
+type DomainEventMigrationIterationCallback func(c *Connect, d *Domain, event *DomainEventMigrationIteration)
+
+type DomainEventJobCompleted struct {
+ Info DomainJobInfo
+}
+
+type DomainEventJobCompletedCallback func(c *Connect, d *Domain, event *DomainEventJobCompleted)
+
+type DomainEventDeviceRemovalFailed struct {
+ DevAlias string
+}
+
+type DomainEventDeviceRemovalFailedCallback func(c *Connect, d *Domain, event *DomainEventDeviceRemovalFailed)
+
+type DomainEventMetadataChange struct {
+ Type int
+ NSURI string
+}
+
+type DomainEventMetadataChangeCallback func(c *Connect, d *Domain, event *DomainEventMetadataChange)
+
+type DomainEventBlockThreshold struct {
+ Dev string
+ Path string
+ Threshold uint64
+ Excess uint64
+}
+
+type DomainEventBlockThresholdCallback func(c *Connect, d *Domain, event *DomainEventBlockThreshold)
+
+//export domainEventLifecycleCallback
+func domainEventLifecycleCallback(c C.virConnectPtr, d C.virDomainPtr,
+ event int, detail int,
+ goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventLifecycle{
+ Event: DomainEventType(event),
+ Detail: detail,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventLifecycleCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+}
+
+//export domainEventGenericCallback
+func domainEventGenericCallback(c C.virConnectPtr, d C.virDomainPtr,
+ goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventGenericCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain)
+}
+
+//export domainEventRTCChangeCallback
+func domainEventRTCChangeCallback(c C.virConnectPtr, d C.virDomainPtr,
+ utcoffset int64, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventRTCChange{
+ Utcoffset: utcoffset,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventRTCChangeCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventWatchdogCallback
+func domainEventWatchdogCallback(c C.virConnectPtr, d C.virDomainPtr,
+ action int, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventWatchdog{
+ Action: DomainEventWatchdogAction(action),
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventWatchdogCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventIOErrorCallback
+func domainEventIOErrorCallback(c C.virConnectPtr, d C.virDomainPtr,
+ srcPath *C.char, devAlias *C.char, action int, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventIOError{
+ SrcPath: C.GoString(srcPath),
+ DevAlias: C.GoString(devAlias),
+ Action: DomainEventIOErrorAction(action),
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventIOErrorCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventGraphicsCallback
+func domainEventGraphicsCallback(c C.virConnectPtr, d C.virDomainPtr,
+ phase int,
+ local C.virDomainEventGraphicsAddressPtr,
+ remote C.virDomainEventGraphicsAddressPtr,
+ authScheme *C.char,
+ subject C.virDomainEventGraphicsSubjectPtr,
+ goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ subjectGo := make([]DomainEventGraphicsSubjectIdentity, 0)
+ nidentities := int(subject.nidentity)
+ identities := (*[1 << 30]C.virDomainEventGraphicsSubjectIdentity)(unsafe.Pointer(&subject.identities))[:nidentities:nidentities]
+ for _, identity := range identities {
+ subjectGo = append(subjectGo,
+ DomainEventGraphicsSubjectIdentity{
+ Type: C.GoString(identity._type),
+ Name: C.GoString(identity.name),
+ },
+ )
+ }
+
+ eventDetails := &DomainEventGraphics{
+ Phase: DomainEventGraphicsPhase(phase),
+ Local: DomainEventGraphicsAddress{
+ Family: DomainEventGraphicsAddressType(local.family),
+ Node: C.GoString(local.node),
+ Service: C.GoString(local.service),
+ },
+ Remote: DomainEventGraphicsAddress{
+ Family: DomainEventGraphicsAddressType(remote.family),
+ Node: C.GoString(remote.node),
+ Service: C.GoString(remote.service),
+ },
+ AuthScheme: C.GoString(authScheme),
+ Subject: subjectGo,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventGraphicsCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventIOErrorReasonCallback
+func domainEventIOErrorReasonCallback(c C.virConnectPtr, d C.virDomainPtr,
+ srcPath *C.char, devAlias *C.char, action int, reason *C.char,
+ goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventIOErrorReason{
+ SrcPath: C.GoString(srcPath),
+ DevAlias: C.GoString(devAlias),
+ Action: DomainEventIOErrorAction(action),
+ Reason: C.GoString(reason),
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventIOErrorReasonCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventBlockJobCallback
+func domainEventBlockJobCallback(c C.virConnectPtr, d C.virDomainPtr,
+ disk *C.char, _type int, status int, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventBlockJob{
+ Disk: C.GoString(disk),
+ Type: DomainBlockJobType(_type),
+ Status: ConnectDomainEventBlockJobStatus(status),
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventBlockJobCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventDiskChangeCallback
+func domainEventDiskChangeCallback(c C.virConnectPtr, d C.virDomainPtr,
+ oldSrcPath *C.char, newSrcPath *C.char, devAlias *C.char,
+ reason int, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventDiskChange{
+ OldSrcPath: C.GoString(oldSrcPath),
+ NewSrcPath: C.GoString(newSrcPath),
+ DevAlias: C.GoString(devAlias),
+ Reason: ConnectDomainEventDiskChangeReason(reason),
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventDiskChangeCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventTrayChangeCallback
+func domainEventTrayChangeCallback(c C.virConnectPtr, d C.virDomainPtr,
+ devAlias *C.char, reason int, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventTrayChange{
+ DevAlias: C.GoString(devAlias),
+ Reason: ConnectDomainEventTrayChangeReason(reason),
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventTrayChangeCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventPMSuspendCallback
+func domainEventPMSuspendCallback(c C.virConnectPtr, d C.virDomainPtr,
+ reason int, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventPMSuspend{
+ Reason: reason,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventPMSuspendCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventPMWakeupCallback
+func domainEventPMWakeupCallback(c C.virConnectPtr, d C.virDomainPtr,
+ reason int, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventPMWakeup{
+ Reason: reason,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventPMWakeupCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventPMSuspendDiskCallback
+func domainEventPMSuspendDiskCallback(c C.virConnectPtr, d C.virDomainPtr,
+ reason int, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventPMSuspendDisk{
+ Reason: reason,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventPMSuspendDiskCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventBalloonChangeCallback
+func domainEventBalloonChangeCallback(c C.virConnectPtr, d C.virDomainPtr,
+ actual uint64, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventBalloonChange{
+ Actual: actual,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventBalloonChangeCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventDeviceRemovedCallback
+func domainEventDeviceRemovedCallback(c C.virConnectPtr, d C.virDomainPtr,
+ devAlias *C.char, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventDeviceRemoved{
+ DevAlias: C.GoString(devAlias),
+ }
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventDeviceRemovedCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventMetadataChangeCallback
+func domainEventMetadataChangeCallback(c C.virConnectPtr, d C.virDomainPtr,
+ mtype int, nsuri *C.char, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventMetadataChange{
+ Type: (int)(mtype),
+ NSURI: C.GoString(nsuri),
+ }
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventMetadataChangeCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+func getDomainTuneSchedulerParametersFieldInfo(params *DomainSchedulerParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES: typedParamsFieldInfo{
+ set: &params.CpuSharesSet,
+ ul: &params.CpuShares,
+ },
+ C.VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD: typedParamsFieldInfo{
+ set: &params.GlobalPeriodSet,
+ ul: &params.GlobalPeriod,
+ },
+ C.VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA: typedParamsFieldInfo{
+ set: &params.GlobalQuotaSet,
+ l: &params.GlobalQuota,
+ },
+ C.VIR_DOMAIN_TUNABLE_CPU_EMULATOR_PERIOD: typedParamsFieldInfo{
+ set: &params.EmulatorPeriodSet,
+ ul: &params.EmulatorPeriod,
+ },
+ C.VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA: typedParamsFieldInfo{
+ set: &params.EmulatorQuotaSet,
+ l: &params.EmulatorQuota,
+ },
+ C.VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD: typedParamsFieldInfo{
+ set: &params.VcpuPeriodSet,
+ ul: &params.VcpuPeriod,
+ },
+ C.VIR_DOMAIN_TUNABLE_CPU_VCPU_QUOTA: typedParamsFieldInfo{
+ set: &params.VcpuQuotaSet,
+ l: &params.VcpuQuota,
+ },
+ C.VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_PERIOD: typedParamsFieldInfo{
+ set: &params.IothreadPeriodSet,
+ ul: &params.IothreadPeriod,
+ },
+ C.VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_QUOTA: typedParamsFieldInfo{
+ set: &params.IothreadQuotaSet,
+ l: &params.IothreadQuota,
+ },
+ }
+}
+
+func getTuneBlockIoTuneParametersFieldInfo(params *DomainBlockIoTuneParameters) map[string]typedParamsFieldInfo {
+ return map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC: typedParamsFieldInfo{
+ set: &params.TotalBytesSecSet,
+ ul: &params.TotalBytesSec,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC: typedParamsFieldInfo{
+ set: &params.ReadBytesSecSet,
+ ul: &params.ReadBytesSec,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC: typedParamsFieldInfo{
+ set: &params.WriteBytesSecSet,
+ ul: &params.WriteBytesSec,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC: typedParamsFieldInfo{
+ set: &params.TotalIopsSecSet,
+ ul: &params.TotalIopsSec,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC: typedParamsFieldInfo{
+ set: &params.ReadIopsSecSet,
+ ul: &params.ReadIopsSec,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC: typedParamsFieldInfo{
+ set: &params.WriteIopsSecSet,
+ ul: &params.WriteIopsSec,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX: typedParamsFieldInfo{
+ set: &params.TotalBytesSecMaxSet,
+ ul: &params.TotalBytesSecMax,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX: typedParamsFieldInfo{
+ set: &params.ReadBytesSecMaxSet,
+ ul: &params.ReadBytesSecMax,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX: typedParamsFieldInfo{
+ set: &params.WriteBytesSecMaxSet,
+ ul: &params.WriteBytesSecMax,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX: typedParamsFieldInfo{
+ set: &params.TotalIopsSecMaxSet,
+ ul: &params.TotalIopsSecMax,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX: typedParamsFieldInfo{
+ set: &params.ReadIopsSecMaxSet,
+ ul: &params.ReadIopsSecMax,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX: typedParamsFieldInfo{
+ set: &params.WriteIopsSecMaxSet,
+ ul: &params.WriteIopsSecMax,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.TotalBytesSecMaxLengthSet,
+ ul: &params.TotalBytesSecMaxLength,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.ReadBytesSecMaxLengthSet,
+ ul: &params.ReadBytesSecMaxLength,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.WriteBytesSecMaxLengthSet,
+ ul: &params.WriteBytesSecMaxLength,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.TotalIopsSecMaxLengthSet,
+ ul: &params.TotalIopsSecMaxLength,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.ReadIopsSecMaxLengthSet,
+ ul: &params.ReadIopsSecMaxLength,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH: typedParamsFieldInfo{
+ set: &params.WriteIopsSecMaxLengthSet,
+ ul: &params.WriteIopsSecMaxLength,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC: typedParamsFieldInfo{
+ set: &params.SizeIopsSecSet,
+ ul: &params.SizeIopsSec,
+ },
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NAME: typedParamsFieldInfo{
+ set: &params.GroupNameSet,
+ s: &params.GroupName,
+ },
+ }
+}
+
+type domainEventTunablePinTemp struct {
+ VcpuPinSet bool
+ VcpuPin []string
+ EmulatorPinSet bool
+ EmulatorPin string
+ IOThreadPinSet bool
+ IOThreadPin []string
+}
+
+func getDomainPinTempFieldInfo(numvcpu int, numiothread int, params *domainEventTunablePinTemp) map[string]typedParamsFieldInfo {
+ ret := map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN: typedParamsFieldInfo{
+ set: &params.EmulatorPinSet,
+ s: &params.EmulatorPin,
+ },
+ }
+ for i := 0; i < numvcpu; i++ {
+ ret[fmt.Sprintf("cputune.vcpupin%d", i)] = typedParamsFieldInfo{
+ s: &params.VcpuPin[i],
+ }
+ }
+ for i := 0; i < numiothread; i++ {
+ ret[fmt.Sprintf("cputune.iothreadpin%d", i)] = typedParamsFieldInfo{
+ s: &params.IOThreadPin[i],
+ }
+ }
+
+ return ret
+}
+
+func countPinInfo(cparams C.virTypedParameterPtr, nparams C.int) (int, int) {
+ maxvcpus := 0
+ maxiothreads := 0
+ for i := 0; i < int(nparams); i++ {
+ var cparam *C.virTypedParameter
+ cparam = (*C.virTypedParameter)(unsafe.Pointer(uintptr(unsafe.Pointer(cparams)) + unsafe.Sizeof(*cparam)*uintptr(i)))
+ name := C.GoString((*C.char)(unsafe.Pointer(&cparam.field)))
+
+ var vcpu int
+ _, err := fmt.Scanf(name, "cputune.vcpupin%d", &vcpu)
+ if err == nil {
+ if vcpu > maxvcpus {
+ maxvcpus = vcpu
+ }
+ }
+
+ var iothread int
+ _, err = fmt.Scanf(name, "cputune.iothreadpin%d", &iothread)
+ if err == nil {
+ if iothread > maxiothreads {
+ maxiothreads = iothread
+ }
+ }
+ }
+
+ return maxvcpus + 1, maxiothreads + 1
+}
+
+func domainEventTunableGetPin(params C.virTypedParameterPtr, nparams C.int) *DomainEventTunableCpuPin {
+ var pin domainEventTunablePinTemp
+ numvcpus, numiothreads := countPinInfo(params, nparams)
+ pinInfo := getDomainPinTempFieldInfo(numvcpus, numiothreads, &pin)
+
+ num, err := typedParamsUnpackLen(params, int(nparams), pinInfo)
+ if num == 0 || err != nil {
+ return nil
+ }
+
+ info := &DomainEventTunableCpuPin{}
+
+ if pin.VcpuPinSet {
+ info.VcpuPinSet = true
+ info.VcpuPin = make([][]bool, len(pin.VcpuPin))
+
+ for i := 0; i < len(pin.VcpuPin); i++ {
+ bits, err := parseCPUString(pin.VcpuPin[i])
+ if err == nil {
+ info.VcpuPin[i] = bits
+ }
+ }
+ }
+
+ if pin.EmulatorPinSet {
+ bits, err := parseCPUString(pin.EmulatorPin)
+ if err == nil {
+ info.EmulatorPinSet = true
+ info.EmulatorPin = bits
+ }
+ }
+
+ if pin.IOThreadPinSet {
+ info.IOThreadPinSet = true
+ info.IOThreadPin = make([][]bool, len(pin.IOThreadPin))
+
+ for i := 0; i < len(pin.IOThreadPin); i++ {
+ bits, err := parseCPUString(pin.IOThreadPin[i])
+ if err == nil {
+ info.IOThreadPin[i] = bits
+ }
+ }
+ }
+
+ return info
+}
+
+//export domainEventTunableCallback
+func domainEventTunableCallback(c C.virConnectPtr, d C.virDomainPtr, params C.virTypedParameterPtr, nparams C.int, goCallbackId int) {
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventTunable{}
+
+ pin := domainEventTunableGetPin(params, nparams)
+ if pin != nil {
+ eventDetails.CpuPin = pin
+ }
+
+ var sched DomainSchedulerParameters
+ schedInfo := getDomainTuneSchedulerParametersFieldInfo(&sched)
+
+ num, _ := typedParamsUnpackLen(params, int(nparams), schedInfo)
+ if num > 0 {
+ eventDetails.CpuSched = &sched
+ }
+
+ blknameInfo := map[string]typedParamsFieldInfo{
+ C.VIR_DOMAIN_TUNABLE_BLKDEV_DISK: typedParamsFieldInfo{
+ set: &eventDetails.BlkdevDiskSet,
+ s: &eventDetails.BlkdevDisk,
+ },
+ }
+ typedParamsUnpackLen(params, int(nparams), blknameInfo)
+
+ var blktune DomainBlockIoTuneParameters
+ blktuneInfo := getTuneBlockIoTuneParametersFieldInfo(&blktune)
+
+ num, _ = typedParamsUnpackLen(params, int(nparams), blktuneInfo)
+ if num > 0 {
+ eventDetails.BlkdevTune = &blktune
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventTunableCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventAgentLifecycleCallback
+func domainEventAgentLifecycleCallback(c C.virConnectPtr, d C.virDomainPtr, state C.int, reason C.int, goCallbackId int) {
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventAgentLifecycle{
+ State: ConnectDomainEventAgentLifecycleState(state),
+ Reason: ConnectDomainEventAgentLifecycleReason(reason),
+ }
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventAgentLifecycleCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventDeviceAddedCallback
+func domainEventDeviceAddedCallback(c C.virConnectPtr, d C.virDomainPtr, devalias *C.char, goCallbackId int) {
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventDeviceAdded{
+ DevAlias: C.GoString(devalias),
+ }
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventDeviceAddedCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventMigrationIterationCallback
+func domainEventMigrationIterationCallback(c C.virConnectPtr, d C.virDomainPtr, iteration C.int, goCallbackId int) {
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventMigrationIteration{
+ Iteration: int(iteration),
+ }
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventMigrationIterationCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventJobCompletedCallback
+func domainEventJobCompletedCallback(c C.virConnectPtr, d C.virDomainPtr, params C.virTypedParameterPtr, nparams C.int, goCallbackId int) {
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventJobCompleted{}
+ info := getDomainJobInfoFieldInfo(&eventDetails.Info)
+
+ typedParamsUnpackLen(params, int(nparams), info)
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventJobCompletedCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventDeviceRemovalFailedCallback
+func domainEventDeviceRemovalFailedCallback(c C.virConnectPtr, d C.virDomainPtr, devalias *C.char, goCallbackId int) {
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventDeviceRemovalFailed{
+ DevAlias: C.GoString(devalias),
+ }
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventDeviceRemovalFailedCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+//export domainEventBlockThresholdCallback
+func domainEventBlockThresholdCallback(c C.virConnectPtr, d C.virDomainPtr, dev *C.char, path *C.char, threshold C.ulonglong, excess C.ulonglong, goCallbackId int) {
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainEventBlockThreshold{
+ Dev: C.GoString(dev),
+ Path: C.GoString(path),
+ Threshold: uint64(threshold),
+ Excess: uint64(excess),
+ }
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainEventBlockThresholdCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+func (c *Connect) DomainEventLifecycleRegister(dom *Domain, callback DomainEventLifecycleCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventLifecycleCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_LIFECYCLE,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventRebootRegister(dom *Domain, callback DomainEventGenericCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventGenericCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_REBOOT,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventRTCChangeRegister(dom *Domain, callback DomainEventRTCChangeCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventRTCChangeCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_RTC_CHANGE,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventWatchdogRegister(dom *Domain, callback DomainEventWatchdogCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventWatchdogCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_WATCHDOG,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventIOErrorRegister(dom *Domain, callback DomainEventIOErrorCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventIOErrorCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_IO_ERROR,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventGraphicsRegister(dom *Domain, callback DomainEventGraphicsCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventGraphicsCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_GRAPHICS,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventIOErrorReasonRegister(dom *Domain, callback DomainEventIOErrorReasonCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventIOErrorReasonCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventControlErrorRegister(dom *Domain, callback DomainEventGenericCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventGenericCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_CONTROL_ERROR,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventBlockJobRegister(dom *Domain, callback DomainEventBlockJobCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventBlockJobCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_BLOCK_JOB,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventDiskChangeRegister(dom *Domain, callback DomainEventDiskChangeCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventDiskChangeCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_DISK_CHANGE,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventTrayChangeRegister(dom *Domain, callback DomainEventTrayChangeCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventTrayChangeCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_TRAY_CHANGE,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventPMWakeupRegister(dom *Domain, callback DomainEventPMWakeupCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventPMWakeupCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_PMWAKEUP,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventPMSuspendRegister(dom *Domain, callback DomainEventPMSuspendCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventPMSuspendCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_PMSUSPEND,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventBalloonChangeRegister(dom *Domain, callback DomainEventBalloonChangeCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventBalloonChangeCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventPMSuspendDiskRegister(dom *Domain, callback DomainEventPMSuspendDiskCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventPMSuspendDiskCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventDeviceRemovedRegister(dom *Domain, callback DomainEventDeviceRemovedCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventDeviceRemovedCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventBlockJob2Register(dom *Domain, callback DomainEventBlockJobCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventBlockJobCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventTunableRegister(dom *Domain, callback DomainEventTunableCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventTunableCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_TUNABLE,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventAgentLifecycleRegister(dom *Domain, callback DomainEventAgentLifecycleCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventAgentLifecycleCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventDeviceAddedRegister(dom *Domain, callback DomainEventDeviceAddedCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventDeviceAddedCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_DEVICE_ADDED,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventMigrationIterationRegister(dom *Domain, callback DomainEventMigrationIterationCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventMigrationIterationCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventJobCompletedRegister(dom *Domain, callback DomainEventJobCompletedCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventJobCompletedCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_JOB_COMPLETED,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventDeviceRemovalFailedRegister(dom *Domain, callback DomainEventDeviceRemovalFailedCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventDeviceRemovalFailedCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventMetadataChangeRegister(dom *Domain, callback DomainEventMetadataChangeCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventMetadataChangeCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_METADATA_CHANGE,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventBlockThresholdRegister(dom *Domain, callback DomainEventBlockThresholdCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.domainEventBlockThresholdCallbackHelper)
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainEventRegisterAnyWrapper(c.ptr, cdom,
+ C.VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD,
+ C.virConnectDomainEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainEventDeregister(callbackId int) error {
+ // Deregister the callback
+ var err C.virError
+ ret := int(C.virConnectDomainEventDeregisterAnyWrapper(c.ptr, C.int(callbackId), &err))
+ if ret < 0 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+func (e DomainEventLifecycle) String() string {
+ var detail, event string
+ switch e.Event {
+ case DOMAIN_EVENT_DEFINED:
+ event = "defined"
+ switch DomainEventDefinedDetailType(e.Detail) {
+ case DOMAIN_EVENT_DEFINED_ADDED:
+ detail = "added"
+ case DOMAIN_EVENT_DEFINED_UPDATED:
+ detail = "updated"
+ default:
+ detail = "unknown"
+ }
+
+ case DOMAIN_EVENT_UNDEFINED:
+ event = "undefined"
+ switch DomainEventUndefinedDetailType(e.Detail) {
+ case DOMAIN_EVENT_UNDEFINED_REMOVED:
+ detail = "removed"
+ default:
+ detail = "unknown"
+ }
+
+ case DOMAIN_EVENT_STARTED:
+ event = "started"
+ switch DomainEventStartedDetailType(e.Detail) {
+ case DOMAIN_EVENT_STARTED_BOOTED:
+ detail = "booted"
+ case DOMAIN_EVENT_STARTED_MIGRATED:
+ detail = "migrated"
+ case DOMAIN_EVENT_STARTED_RESTORED:
+ detail = "restored"
+ case DOMAIN_EVENT_STARTED_FROM_SNAPSHOT:
+ detail = "snapshot"
+ default:
+ detail = "unknown"
+ }
+
+ case DOMAIN_EVENT_SUSPENDED:
+ event = "suspended"
+ switch DomainEventSuspendedDetailType(e.Detail) {
+ case DOMAIN_EVENT_SUSPENDED_PAUSED:
+ detail = "paused"
+ case DOMAIN_EVENT_SUSPENDED_MIGRATED:
+ detail = "migrated"
+ case DOMAIN_EVENT_SUSPENDED_IOERROR:
+ detail = "I/O error"
+ case DOMAIN_EVENT_SUSPENDED_WATCHDOG:
+ detail = "watchdog"
+ case DOMAIN_EVENT_SUSPENDED_RESTORED:
+ detail = "restored"
+ case DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT:
+ detail = "snapshot"
+ default:
+ detail = "unknown"
+ }
+
+ case DOMAIN_EVENT_RESUMED:
+ event = "resumed"
+ switch DomainEventResumedDetailType(e.Detail) {
+ case DOMAIN_EVENT_RESUMED_UNPAUSED:
+ detail = "unpaused"
+ case DOMAIN_EVENT_RESUMED_MIGRATED:
+ detail = "migrated"
+ case DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT:
+ detail = "snapshot"
+ default:
+ detail = "unknown"
+ }
+
+ case DOMAIN_EVENT_STOPPED:
+ event = "stopped"
+ switch DomainEventStoppedDetailType(e.Detail) {
+ case DOMAIN_EVENT_STOPPED_SHUTDOWN:
+ detail = "shutdown"
+ case DOMAIN_EVENT_STOPPED_DESTROYED:
+ detail = "destroyed"
+ case DOMAIN_EVENT_STOPPED_CRASHED:
+ detail = "crashed"
+ case DOMAIN_EVENT_STOPPED_MIGRATED:
+ detail = "migrated"
+ case DOMAIN_EVENT_STOPPED_SAVED:
+ detail = "saved"
+ case DOMAIN_EVENT_STOPPED_FAILED:
+ detail = "failed"
+ case DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT:
+ detail = "snapshot"
+ default:
+ detail = "unknown"
+ }
+
+ case DOMAIN_EVENT_SHUTDOWN:
+ event = "shutdown"
+ switch DomainEventShutdownDetailType(e.Detail) {
+ case DOMAIN_EVENT_SHUTDOWN_FINISHED:
+ detail = "finished"
+ default:
+ detail = "unknown"
+ }
+
+ default:
+ event = "unknown"
+ }
+
+ return fmt.Sprintf("Domain event=%q detail=%q", event, detail)
+}
+
+func (e DomainEventRTCChange) String() string {
+ return fmt.Sprintf("RTC change offset=%d", e.Utcoffset)
+}
+
+func (e DomainEventWatchdog) String() string {
+ return fmt.Sprintf("Watchdog action=%d", e.Action)
+}
+
+func (e DomainEventIOError) String() string {
+ return fmt.Sprintf("I/O error path=%q alias=%q action=%d",
+ e.SrcPath, e.DevAlias, e.Action)
+}
+
+func (e DomainEventGraphics) String() string {
+ var phase string
+ switch e.Phase {
+ case DOMAIN_EVENT_GRAPHICS_CONNECT:
+ phase = "connected"
+ case DOMAIN_EVENT_GRAPHICS_INITIALIZE:
+ phase = "initialized"
+ case DOMAIN_EVENT_GRAPHICS_DISCONNECT:
+ phase = "disconnected"
+ default:
+ phase = "unknown"
+ }
+
+ return fmt.Sprintf("Graphics phase=%q", phase)
+}
+
+func (e DomainEventIOErrorReason) String() string {
+ return fmt.Sprintf("IO error path=%q alias=%q action=%d reason=%q",
+ e.SrcPath, e.DevAlias, e.Action, e.Reason)
+}
+
+func (e DomainEventBlockJob) String() string {
+ return fmt.Sprintf("Block job disk=%q status=%d type=%d",
+ e.Disk, e.Status, e.Type)
+}
+
+func (e DomainEventDiskChange) String() string {
+ return fmt.Sprintf("Disk change old=%q new=%q alias=%q reason=%d",
+ e.OldSrcPath, e.NewSrcPath, e.DevAlias, e.Reason)
+}
+
+func (e DomainEventTrayChange) String() string {
+ return fmt.Sprintf("Tray change dev=%q reason=%d",
+ e.DevAlias, e.Reason)
+}
+
+func (e DomainEventBalloonChange) String() string {
+ return fmt.Sprintf("Ballon change %d", e.Actual)
+}
+
+func (e DomainEventDeviceRemoved) String() string {
+ return fmt.Sprintf("Device %q removed ", e.DevAlias)
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/domain_events_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_events_wrapper.go
new file mode 100644
index 00000000..5d74feed
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_events_wrapper.go
@@ -0,0 +1,259 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include "domain_events_wrapper.h"
+#include "callbacks_wrapper.h"
+#include <stdint.h>
+
+extern void domainEventLifecycleCallback(virConnectPtr, virDomainPtr, int, int, int);
+void domainEventLifecycleCallbackHelper(virConnectPtr c, virDomainPtr d,
+ int event, int detail, void *data)
+{
+ domainEventLifecycleCallback(c, d, event, detail, (int)(intptr_t)data);
+}
+
+extern void domainEventGenericCallback(virConnectPtr, virDomainPtr, int);
+void domainEventGenericCallbackHelper(virConnectPtr c, virDomainPtr d, void *data)
+{
+ domainEventGenericCallback(c, d, (int)(intptr_t)data);
+}
+
+extern void domainEventRTCChangeCallback(virConnectPtr, virDomainPtr, long long, int);
+void domainEventRTCChangeCallbackHelper(virConnectPtr c, virDomainPtr d,
+ long long utcoffset, void *data)
+{
+ domainEventRTCChangeCallback(c, d, utcoffset, (int)(intptr_t)data);
+}
+
+extern void domainEventWatchdogCallback(virConnectPtr, virDomainPtr, int, int);
+void domainEventWatchdogCallbackHelper(virConnectPtr c, virDomainPtr d,
+ int action, void *data)
+{
+ domainEventWatchdogCallback(c, d, action, (int)(intptr_t)data);
+}
+
+extern void domainEventIOErrorCallback(virConnectPtr, virDomainPtr, const char *, const char *, int, int);
+void domainEventIOErrorCallbackHelper(virConnectPtr c, virDomainPtr d,
+ const char *srcPath, const char *devAlias,
+ int action, void *data)
+{
+ domainEventIOErrorCallback(c, d, srcPath, devAlias, action, (int)(intptr_t)data);
+}
+
+extern void domainEventGraphicsCallback(virConnectPtr, virDomainPtr, int, const virDomainEventGraphicsAddress *,
+ const virDomainEventGraphicsAddress *, const char *,
+ const virDomainEventGraphicsSubject *, int);
+void domainEventGraphicsCallbackHelper(virConnectPtr c, virDomainPtr d,
+ int phase, const virDomainEventGraphicsAddress *local,
+ const virDomainEventGraphicsAddress *remote,
+ const char *authScheme,
+ const virDomainEventGraphicsSubject *subject, void *data)
+{
+ domainEventGraphicsCallback(c, d, phase, local, remote, authScheme, subject, (int)(intptr_t)data);
+}
+
+extern void domainEventIOErrorReasonCallback(virConnectPtr, virDomainPtr, const char *, const char *,
+ int, const char *, int);
+void domainEventIOErrorReasonCallbackHelper(virConnectPtr c, virDomainPtr d,
+ const char *srcPath, const char *devAlias,
+ int action, const char *reason, void *data)
+{
+ domainEventIOErrorReasonCallback(c, d, srcPath, devAlias, action, reason, (int)(intptr_t)data);
+}
+
+extern void domainEventBlockJobCallback(virConnectPtr, virDomainPtr, const char *, int, int, int);
+void domainEventBlockJobCallbackHelper(virConnectPtr c, virDomainPtr d,
+ const char *disk, int type, int status, void *data)
+{
+ domainEventBlockJobCallback(c, d, disk, type, status, (int)(intptr_t)data);
+}
+
+extern void domainEventDiskChangeCallback(virConnectPtr, virDomainPtr, const char *, const char *,
+ const char *, int, int);
+void domainEventDiskChangeCallbackHelper(virConnectPtr c, virDomainPtr d,
+ const char *oldSrcPath, const char *newSrcPath,
+ const char *devAlias, int reason, void *data)
+{
+ domainEventDiskChangeCallback(c, d, oldSrcPath, newSrcPath, devAlias, reason, (int)(intptr_t)data);
+}
+
+extern void domainEventTrayChangeCallback(virConnectPtr, virDomainPtr, const char *, int, int);
+void domainEventTrayChangeCallbackHelper(virConnectPtr c, virDomainPtr d,
+ const char *devAlias, int reason, void *data)
+{
+ domainEventTrayChangeCallback(c, d, devAlias, reason, (int)(intptr_t)data);
+}
+
+extern void domainEventPMSuspendCallback(virConnectPtr, virDomainPtr, int, int);
+void domainEventPMSuspendCallbackHelper(virConnectPtr c, virDomainPtr d,
+ int reason, void *data)
+{
+ domainEventPMSuspendCallback(c, d, reason, (int)(intptr_t)data);
+}
+
+extern void domainEventPMWakeupCallback(virConnectPtr, virDomainPtr, int, int);
+void domainEventPMWakeupCallbackHelper(virConnectPtr c, virDomainPtr d,
+ int reason, void *data)
+{
+ domainEventPMWakeupCallback(c, d, reason, (int)(intptr_t)data);
+}
+
+extern void domainEventPMSuspendDiskCallback(virConnectPtr, virDomainPtr, int, int);
+void domainEventPMSuspendDiskCallbackHelper(virConnectPtr c, virDomainPtr d,
+ int reason, void *data)
+{
+ domainEventPMSuspendDiskCallback(c, d, reason, (int)(intptr_t)data);
+}
+
+extern void domainEventBalloonChangeCallback(virConnectPtr, virDomainPtr, unsigned long long, int);
+void domainEventBalloonChangeCallbackHelper(virConnectPtr c, virDomainPtr d,
+ unsigned long long actual, void *data)
+{
+ domainEventBalloonChangeCallback(c, d, actual, (int)(intptr_t)data);
+}
+
+extern void domainEventDeviceRemovedCallback(virConnectPtr, virDomainPtr, const char *, int);
+void domainEventDeviceRemovedCallbackHelper(virConnectPtr c, virDomainPtr d,
+ const char *devAlias, void *data)
+{
+ domainEventDeviceRemovedCallback(c, d, devAlias, (int)(intptr_t)data);
+}
+
+extern void domainEventTunableCallback(virConnectPtr, virDomainPtr, virTypedParameterPtr, int, int);
+void domainEventTunableCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ virTypedParameterPtr params,
+ int nparams,
+ void *opaque)
+{
+ domainEventTunableCallback(conn, dom, params, nparams, (int)(intptr_t)opaque);
+}
+
+extern void domainEventAgentLifecycleCallback(virConnectPtr, virDomainPtr, int, int, int);
+void domainEventAgentLifecycleCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ int state,
+ int reason,
+ void *opaque)
+{
+ domainEventAgentLifecycleCallback(conn, dom, state, reason, (int)(intptr_t)opaque);
+}
+
+extern void domainEventDeviceAddedCallback(virConnectPtr, virDomainPtr, const char *, int);
+void domainEventDeviceAddedCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *devAlias,
+ void *opaque)
+{
+ domainEventDeviceAddedCallback(conn, dom, devAlias, (int)(intptr_t)opaque);
+}
+
+extern void domainEventMigrationIterationCallback(virConnectPtr, virDomainPtr, int, int);
+void domainEventMigrationIterationCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ int iteration,
+ void *opaque)
+{
+ domainEventMigrationIterationCallback(conn, dom, iteration, (int)(intptr_t)opaque);
+}
+
+extern void domainEventJobCompletedCallback(virConnectPtr, virDomainPtr, virTypedParameterPtr, int, int);
+void domainEventJobCompletedCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ virTypedParameterPtr params,
+ int nparams,
+ void *opaque)
+{
+ domainEventJobCompletedCallback(conn, dom, params, nparams, (int)(intptr_t)opaque);
+}
+
+extern void domainEventDeviceRemovalFailedCallback(virConnectPtr, virDomainPtr, const char *, int);
+void domainEventDeviceRemovalFailedCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *devAlias,
+ void *opaque)
+{
+ domainEventDeviceRemovalFailedCallback(conn, dom, devAlias, (int)(intptr_t)opaque);
+}
+
+extern void domainEventMetadataChangeCallback(virConnectPtr, virDomainPtr, int, const char *, int);
+void domainEventMetadataChangeCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ int type,
+ const char *nsuri,
+ void *opaque)
+{
+ domainEventMetadataChangeCallback(conn, dom, type, nsuri, (int)(intptr_t)opaque);
+}
+
+extern void domainEventBlockThresholdCallback(virConnectPtr, virDomainPtr, const char *, const char *, unsigned long long, unsigned long long, int);
+void domainEventBlockThresholdCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *dev,
+ const char *path,
+ unsigned long long threshold,
+ unsigned long long excess,
+ void *opaque)
+{
+ domainEventBlockThresholdCallback(conn, dom, dev, path, threshold, excess, (int)(intptr_t)opaque);
+}
+
+int
+virConnectDomainEventRegisterAnyWrapper(virConnectPtr c,
+ virDomainPtr d,
+ int eventID,
+ virConnectDomainEventGenericCallback cb,
+ long goCallbackId,
+ virErrorPtr err)
+{
+ void *id = (void*)goCallbackId;
+ int ret = virConnectDomainEventRegisterAny(c, d, eventID, cb, id, freeGoCallbackHelper);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virConnectDomainEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err)
+{
+ int ret = virConnectDomainEventDeregisterAny(conn, callbackID);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/domain_events_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_events_wrapper.h
new file mode 100644
index 00000000..1670acdd
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_events_wrapper.h
@@ -0,0 +1,207 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_DOMAIN_EVENTS_WRAPPER_H__
+#define LIBVIRT_GO_DOMAIN_EVENTS_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "domain_compat.h"
+
+void
+domainEventLifecycleCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ int event,
+ int detail,
+ void *data);
+
+void
+domainEventGenericCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ void *data);
+
+void
+domainEventRTCChangeCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ long long utcoffset,
+ void *data);
+
+void
+domainEventWatchdogCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ int action,
+ void *data);
+
+void
+domainEventIOErrorCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ void *data);
+
+void
+domainEventGraphicsCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ int phase,
+ const virDomainEventGraphicsAddress *local,
+ const virDomainEventGraphicsAddress *remote,
+ const char *authScheme,
+ const virDomainEventGraphicsSubject *subject,
+ void *data);
+
+void
+domainEventIOErrorReasonCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ const char *srcPath,
+ const char *devAlias,
+ int action,
+ const char *reason,
+ void *data);
+
+void
+domainEventBlockJobCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ const char *disk,
+ int type,
+ int status,
+ void *data);
+
+void
+domainEventDiskChangeCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ const char *oldSrcPath,
+ const char *newSrcPath,
+ const char *devAlias,
+ int reason,
+ void *data);
+
+void
+domainEventTrayChangeCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ const char *devAlias,
+ int reason,
+ void *data);
+
+void
+domainEventPMSuspendCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ int reason,
+ void *data);
+
+void
+domainEventPMWakeupCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ int reason,
+ void *data);
+
+void
+domainEventPMSuspendDiskCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ int reason,
+ void *data);
+
+void
+domainEventBalloonChangeCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ unsigned long long actual,
+ void *data);
+
+void
+domainEventDeviceRemovedCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ const char *devAlias,
+ void *data);
+
+void
+domainEventTunableCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ virTypedParameterPtr params,
+ int nparams,
+ void *opaque);
+
+void
+domainEventAgentLifecycleCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ int state,
+ int reason,
+ void *opaque);
+
+void
+domainEventDeviceAddedCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *devAlias,
+ void *opaque);
+
+void
+domainEventMigrationIterationCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ int iteration,
+ void *opaque);
+
+void
+domainEventJobCompletedCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ virTypedParameterPtr params,
+ int nparams,
+ void *opaque);
+
+void
+domainEventDeviceRemovalFailedCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *devAlias,
+ void *opaque);
+
+void
+domainEventMetadataChangeCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ int type,
+ const char *nsuri,
+ void *opaque);
+
+void
+domainEventBlockThresholdCallbackHelper(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *dev,
+ const char *path,
+ unsigned long long threshold,
+ unsigned long long excess,
+ void *opaque);
+
+int
+virConnectDomainEventRegisterAnyWrapper(virConnectPtr c,
+ virDomainPtr d,
+ int eventID,
+ virConnectDomainEventGenericCallback cb,
+ long goCallbackId,
+ virErrorPtr err);
+int
+virConnectDomainEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_DOMAIN_EVENTS_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot.go b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot.go
new file mode 100644
index 00000000..65fbbb5c
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot.go
@@ -0,0 +1,240 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "domain_snapshot_wrapper.h"
+*/
+import "C"
+
+import (
+ "reflect"
+ "unsafe"
+)
+
+type DomainSnapshotCreateFlags int
+
+const (
+ DOMAIN_SNAPSHOT_CREATE_REDEFINE = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE)
+ DOMAIN_SNAPSHOT_CREATE_CURRENT = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)
+ DOMAIN_SNAPSHOT_CREATE_NO_METADATA = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)
+ DOMAIN_SNAPSHOT_CREATE_HALT = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_HALT)
+ DOMAIN_SNAPSHOT_CREATE_DISK_ONLY = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY)
+ DOMAIN_SNAPSHOT_CREATE_REUSE_EXT = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT)
+ DOMAIN_SNAPSHOT_CREATE_QUIESCE = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE)
+ DOMAIN_SNAPSHOT_CREATE_ATOMIC = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC)
+ DOMAIN_SNAPSHOT_CREATE_LIVE = DomainSnapshotCreateFlags(C.VIR_DOMAIN_SNAPSHOT_CREATE_LIVE)
+)
+
+type DomainSnapshotListFlags int
+
+const (
+ DOMAIN_SNAPSHOT_LIST_ROOTS = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_ROOTS)
+ DOMAIN_SNAPSHOT_LIST_DESCENDANTS = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS)
+ DOMAIN_SNAPSHOT_LIST_LEAVES = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_LEAVES)
+ DOMAIN_SNAPSHOT_LIST_NO_LEAVES = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES)
+ DOMAIN_SNAPSHOT_LIST_METADATA = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_METADATA)
+ DOMAIN_SNAPSHOT_LIST_NO_METADATA = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA)
+ DOMAIN_SNAPSHOT_LIST_INACTIVE = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE)
+ DOMAIN_SNAPSHOT_LIST_ACTIVE = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE)
+ DOMAIN_SNAPSHOT_LIST_DISK_ONLY = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY)
+ DOMAIN_SNAPSHOT_LIST_INTERNAL = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL)
+ DOMAIN_SNAPSHOT_LIST_EXTERNAL = DomainSnapshotListFlags(C.VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL)
+)
+
+type DomainSnapshotRevertFlags int
+
+const (
+ DOMAIN_SNAPSHOT_REVERT_RUNNING = DomainSnapshotRevertFlags(C.VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING)
+ DOMAIN_SNAPSHOT_REVERT_PAUSED = DomainSnapshotRevertFlags(C.VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED)
+ DOMAIN_SNAPSHOT_REVERT_FORCE = DomainSnapshotRevertFlags(C.VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)
+)
+
+type DomainSnapshotDeleteFlags int
+
+const (
+ DOMAIN_SNAPSHOT_DELETE_CHILDREN = DomainSnapshotDeleteFlags(C.VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN)
+ DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY = DomainSnapshotDeleteFlags(C.VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY)
+ DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY = DomainSnapshotDeleteFlags(C.VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY)
+)
+
+type DomainSnapshot struct {
+ ptr C.virDomainSnapshotPtr
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotFree
+func (s *DomainSnapshot) Free() error {
+ var err C.virError
+ ret := C.virDomainSnapshotFreeWrapper(s.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotRef
+func (c *DomainSnapshot) Ref() error {
+ var err C.virError
+ ret := C.virDomainSnapshotRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotDelete
+func (s *DomainSnapshot) Delete(flags DomainSnapshotDeleteFlags) error {
+ var err C.virError
+ result := C.virDomainSnapshotDeleteWrapper(s.ptr, C.uint(flags), &err)
+ if result != 0 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainRevertToSnapshot
+func (s *DomainSnapshot) RevertToSnapshot(flags DomainSnapshotRevertFlags) error {
+ var err C.virError
+ result := C.virDomainRevertToSnapshotWrapper(s.ptr, C.uint(flags), &err)
+ if result != 0 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotIsCurrent
+func (s *DomainSnapshot) IsCurrent(flags uint32) (bool, error) {
+ var err C.virError
+ result := C.virDomainSnapshotIsCurrentWrapper(s.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotHasMetadata
+func (s *DomainSnapshot) HasMetadata(flags uint32) (bool, error) {
+ var err C.virError
+ result := C.virDomainSnapshotHasMetadataWrapper(s.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotGetXMLDesc
+func (s *DomainSnapshot) GetXMLDesc(flags DomainXMLFlags) (string, error) {
+ var err C.virError
+ result := C.virDomainSnapshotGetXMLDescWrapper(s.ptr, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ xml := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return xml, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotGetName
+func (s *DomainSnapshot) GetName() (string, error) {
+ var err C.virError
+ name := C.virDomainSnapshotGetNameWrapper(s.ptr, &err)
+ if name == nil {
+ return "", makeError(&err)
+ }
+ return C.GoString(name), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotGetParent
+func (s *DomainSnapshot) GetParent(flags uint32) (*DomainSnapshot, error) {
+ var err C.virError
+ ptr := C.virDomainSnapshotGetParentWrapper(s.ptr, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &DomainSnapshot{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotNumChildren
+func (s *DomainSnapshot) NumChildren(flags DomainSnapshotListFlags) (int, error) {
+ var err C.virError
+ result := int(C.virDomainSnapshotNumChildrenWrapper(s.ptr, C.uint(flags), &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotListChildrenNames
+func (s *DomainSnapshot) ListChildrenNames(flags DomainSnapshotListFlags) ([]string, error) {
+ const maxNames = 1024
+ var names [maxNames](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numNames := C.virDomainSnapshotListChildrenNamesWrapper(
+ s.ptr,
+ (**C.char)(namesPtr),
+ maxNames, C.uint(flags), &err)
+ if numNames == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numNames)
+ for k := 0; k < int(numNames); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotListAllChildren
+func (d *DomainSnapshot) ListAllChildren(flags DomainSnapshotListFlags) ([]DomainSnapshot, error) {
+ var cList *C.virDomainSnapshotPtr
+ var err C.virError
+ numVols := C.virDomainSnapshotListAllChildrenWrapper(d.ptr, (**C.virDomainSnapshotPtr)(&cList), C.uint(flags), &err)
+ if numVols == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numVols),
+ Cap: int(numVols),
+ }
+ var pools []DomainSnapshot
+ slice := *(*[]C.virDomainSnapshotPtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ pools = append(pools, DomainSnapshot{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return pools, nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot_wrapper.go
new file mode 100644
index 00000000..a061dee0
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot_wrapper.go
@@ -0,0 +1,215 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "domain_snapshot_wrapper.h"
+
+
+int
+virDomainRevertToSnapshotWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainRevertToSnapshot(snapshot, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSnapshotDeleteWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSnapshotDelete(snapshot, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSnapshotFreeWrapper(virDomainSnapshotPtr snapshot,
+ virErrorPtr err)
+{
+ int ret = virDomainSnapshotFree(snapshot);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virConnectPtr
+virDomainSnapshotGetConnectWrapper(virDomainSnapshotPtr snapshot,
+ virErrorPtr err)
+{
+ virConnectPtr ret = virDomainSnapshotGetConnect(snapshot);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainSnapshotGetDomainWrapper(virDomainSnapshotPtr snapshot,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainSnapshotGetDomain(snapshot);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virDomainSnapshotGetNameWrapper(virDomainSnapshotPtr snapshot,
+ virErrorPtr err)
+{
+ const char * ret = virDomainSnapshotGetName(snapshot);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainSnapshotPtr
+virDomainSnapshotGetParentWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virDomainSnapshotPtr ret = virDomainSnapshotGetParent(snapshot, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virDomainSnapshotGetXMLDescWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virDomainSnapshotGetXMLDesc(snapshot, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSnapshotHasMetadataWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSnapshotHasMetadata(snapshot, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSnapshotIsCurrentWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSnapshotIsCurrent(snapshot, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSnapshotListAllChildrenWrapper(virDomainSnapshotPtr snapshot,
+ virDomainSnapshotPtr **snaps,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSnapshotListAllChildren(snapshot, snaps, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSnapshotListChildrenNamesWrapper(virDomainSnapshotPtr snapshot,
+ char **names,
+ int nameslen,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSnapshotListChildrenNames(snapshot, names, nameslen, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSnapshotNumChildrenWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSnapshotNumChildren(snapshot, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSnapshotRefWrapper(virDomainSnapshotPtr snapshot,
+ virErrorPtr err)
+{
+ int ret = virDomainSnapshotRef(snapshot);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot_wrapper.h
new file mode 100644
index 00000000..fcf8036b
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_snapshot_wrapper.h
@@ -0,0 +1,102 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_DOMAIN_SNAPSHOT_WRAPPER_H__
+#define LIBVIRT_GO_DOMAIN_SNAPSHOT_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+
+
+int
+virDomainRevertToSnapshotWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSnapshotDeleteWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSnapshotFreeWrapper(virDomainSnapshotPtr snapshot,
+ virErrorPtr err);
+
+virConnectPtr
+virDomainSnapshotGetConnectWrapper(virDomainSnapshotPtr snapshot,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainSnapshotGetDomainWrapper(virDomainSnapshotPtr snapshot,
+ virErrorPtr err);
+
+const char *
+virDomainSnapshotGetNameWrapper(virDomainSnapshotPtr snapshot,
+ virErrorPtr err);
+
+virDomainSnapshotPtr
+virDomainSnapshotGetParentWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virDomainSnapshotGetXMLDescWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSnapshotHasMetadataWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSnapshotIsCurrentWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSnapshotListAllChildrenWrapper(virDomainSnapshotPtr snapshot,
+ virDomainSnapshotPtr **snaps,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSnapshotListChildrenNamesWrapper(virDomainSnapshotPtr snapshot,
+ char **names,
+ int nameslen,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSnapshotNumChildrenWrapper(virDomainSnapshotPtr snapshot,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSnapshotRefWrapper(virDomainSnapshotPtr snapshot,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_DOMAIN_SNAPSHOT_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/domain_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_wrapper.go
new file mode 100644
index 00000000..b42dd42f
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_wrapper.go
@@ -0,0 +1,2330 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "domain_wrapper.h"
+
+int
+virDomainAbortJobWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ int ret = virDomainAbortJob(domain);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainAddIOThreadWrapper(virDomainPtr domain,
+ unsigned int iothread_id,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002015
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainAddIOThread(domain, iothread_id, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainAttachDeviceWrapper(virDomainPtr domain,
+ const char *xml,
+ virErrorPtr err)
+{
+ int ret = virDomainAttachDevice(domain, xml);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainAttachDeviceFlagsWrapper(virDomainPtr domain,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainAttachDeviceFlags(domain, xml, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainBlockCommitWrapper(virDomainPtr dom,
+ const char *disk,
+ const char *base,
+ const char *top,
+ unsigned long bandwidth,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainBlockCommit(dom, disk, base, top, bandwidth, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainBlockCopyWrapper(virDomainPtr dom,
+ const char *disk,
+ const char *destxml,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002008
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainBlockCopy(dom, disk, destxml, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainBlockJobAbortWrapper(virDomainPtr dom,
+ const char *disk,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainBlockJobAbort(dom, disk, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainBlockJobSetSpeedWrapper(virDomainPtr dom,
+ const char *disk,
+ unsigned long bandwidth,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainBlockJobSetSpeed(dom, disk, bandwidth, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainBlockPeekWrapper(virDomainPtr dom,
+ const char *disk,
+ unsigned long long offset,
+ size_t size,
+ void *buffer,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainBlockPeek(dom, disk, offset, size, buffer, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainBlockPullWrapper(virDomainPtr dom,
+ const char *disk,
+ unsigned long bandwidth,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainBlockPull(dom, disk, bandwidth, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainBlockRebaseWrapper(virDomainPtr dom,
+ const char *disk,
+ const char *base,
+ unsigned long bandwidth,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainBlockRebase(dom, disk, base, bandwidth, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainBlockResizeWrapper(virDomainPtr dom,
+ const char *disk,
+ unsigned long long size,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainBlockResize(dom, disk, size, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainBlockStatsWrapper(virDomainPtr dom,
+ const char *disk,
+ virDomainBlockStatsPtr stats,
+ size_t size,
+ virErrorPtr err)
+{
+ int ret = virDomainBlockStats(dom, disk, stats, size);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainBlockStatsFlagsWrapper(virDomainPtr dom,
+ const char *disk,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainBlockStatsFlags(dom, disk, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainCoreDumpWrapper(virDomainPtr domain,
+ const char *to,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainCoreDump(domain, to, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainCoreDumpWithFormatWrapper(virDomainPtr domain,
+ const char *to,
+ unsigned int dumpformat,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002003
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainCoreDumpWithFormat(domain, to, dumpformat, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainCreateWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ int ret = virDomainCreate(domain);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainCreateWithFilesWrapper(virDomainPtr domain,
+ unsigned int nfiles,
+ int *files,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainCreateWithFiles(domain, nfiles, files, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainCreateWithFlagsWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainCreateWithFlags(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainDelIOThreadWrapper(virDomainPtr domain,
+ unsigned int iothread_id,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002015
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainDelIOThread(domain, iothread_id, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainDestroyWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ int ret = virDomainDestroy(domain);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainDestroyFlagsWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainDestroyFlags(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainDetachDeviceWrapper(virDomainPtr domain,
+ const char *xml,
+ virErrorPtr err)
+{
+ int ret = virDomainDetachDevice(domain, xml);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainDetachDeviceAliasWrapper(virDomainPtr domain,
+ const char *alias,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4004000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainDetachDeviceAlias(domain, alias, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainDetachDeviceFlagsWrapper(virDomainPtr domain,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainDetachDeviceFlags(domain, xml, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainFSFreezeWrapper(virDomainPtr dom,
+ const char **mountpoints,
+ unsigned int nmountpoints,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002005
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainFSFreeze(dom, mountpoints, nmountpoints, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+void
+virDomainFSInfoFreeWrapper(virDomainFSInfoPtr info)
+{
+#if LIBVIR_VERSION_NUMBER < 1002011
+ assert(0); // Caller should have checked version
+#else
+ virDomainFSInfoFree(info);
+#endif
+}
+
+
+int
+virDomainFSThawWrapper(virDomainPtr dom,
+ const char **mountpoints,
+ unsigned int nmountpoints,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002005
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainFSThaw(dom, mountpoints, nmountpoints, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainFSTrimWrapper(virDomainPtr dom,
+ const char *mountPoint,
+ unsigned long long minimum,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainFSTrim(dom, mountPoint, minimum, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainFreeWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ int ret = virDomainFree(domain);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetAutostartWrapper(virDomainPtr domain,
+ int *autostart,
+ virErrorPtr err)
+{
+ int ret = virDomainGetAutostart(domain, autostart);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetBlkioParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetBlkioParameters(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetBlockInfoWrapper(virDomainPtr domain,
+ const char *disk,
+ virDomainBlockInfoPtr info,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetBlockInfo(domain, disk, info, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetBlockIoTuneWrapper(virDomainPtr dom,
+ const char *disk,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetBlockIoTune(dom, disk, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetBlockJobInfoWrapper(virDomainPtr dom,
+ const char *disk,
+ virDomainBlockJobInfoPtr info,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetBlockJobInfo(dom, disk, info, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetCPUStatsWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ unsigned int nparams,
+ int start_cpu,
+ unsigned int ncpus,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetCPUStats(domain, params, nparams, start_cpu, ncpus, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virConnectPtr
+virDomainGetConnectWrapper(virDomainPtr dom,
+ virErrorPtr err)
+{
+ virConnectPtr ret = virDomainGetConnect(dom);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetControlInfoWrapper(virDomainPtr domain,
+ virDomainControlInfoPtr info,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetControlInfo(domain, info, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetDiskErrorsWrapper(virDomainPtr dom,
+ virDomainDiskErrorPtr errors,
+ unsigned int maxerrors,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetDiskErrors(dom, errors, maxerrors, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetEmulatorPinInfoWrapper(virDomainPtr domain,
+ unsigned char *cpumap,
+ int maplen,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetEmulatorPinInfo(domain, cpumap, maplen, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetFSInfoWrapper(virDomainPtr dom,
+ virDomainFSInfoPtr **info,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002011
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainGetFSInfo(dom, info, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainGetGuestVcpusWrapper(virDomainPtr domain,
+ virTypedParameterPtr *params,
+ unsigned int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 2000000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainGetGuestVcpus(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+char *
+virDomainGetHostnameWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virDomainGetHostname(domain, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+unsigned int
+virDomainGetIDWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ unsigned int ret = virDomainGetID(domain);
+ if (ret == (unsigned int)-1) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetIOThreadInfoWrapper(virDomainPtr dom,
+ virDomainIOThreadInfoPtr **info,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002014
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainGetIOThreadInfo(dom, info, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainGetInfoWrapper(virDomainPtr domain,
+ virDomainInfoPtr info,
+ virErrorPtr err)
+{
+ int ret = virDomainGetInfo(domain, info);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetInterfaceParametersWrapper(virDomainPtr domain,
+ const char *device,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetInterfaceParameters(domain, device, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetJobInfoWrapper(virDomainPtr domain,
+ virDomainJobInfoPtr info,
+ virErrorPtr err)
+{
+ int ret = virDomainGetJobInfo(domain, info);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetJobStatsWrapper(virDomainPtr domain,
+ int *type,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetJobStats(domain, type, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetLaunchSecurityInfoWrapper(virDomainPtr domain,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainGetLaunchSecurityInfo(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+unsigned long
+virDomainGetMaxMemoryWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ unsigned long ret = virDomainGetMaxMemory(domain);
+ if (ret == 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetMaxVcpusWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ int ret = virDomainGetMaxVcpus(domain);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetMemoryParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetMemoryParameters(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virDomainGetMetadataWrapper(virDomainPtr domain,
+ int type,
+ const char *uri,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virDomainGetMetadata(domain, type, uri, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virDomainGetNameWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ const char * ret = virDomainGetName(domain);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetNumaParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetNumaParameters(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virDomainGetOSTypeWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ char * ret = virDomainGetOSType(domain);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetPerfEventsWrapper(virDomainPtr domain,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1003003
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainGetPerfEvents(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainGetSchedulerParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ virErrorPtr err)
+{
+ int ret = virDomainGetSchedulerParameters(domain, params, nparams);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetSchedulerParametersFlagsWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetSchedulerParametersFlags(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virDomainGetSchedulerTypeWrapper(virDomainPtr domain,
+ int *nparams,
+ virErrorPtr err)
+{
+ char * ret = virDomainGetSchedulerType(domain, nparams);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetSecurityLabelWrapper(virDomainPtr domain,
+ virSecurityLabelPtr seclabel,
+ virErrorPtr err)
+{
+ int ret = virDomainGetSecurityLabel(domain, seclabel);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetSecurityLabelListWrapper(virDomainPtr domain,
+ virSecurityLabelPtr *seclabels,
+ virErrorPtr err)
+{
+ int ret = virDomainGetSecurityLabelList(domain, seclabels);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetStateWrapper(virDomainPtr domain,
+ int *state,
+ int *reason,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetState(domain, state, reason, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetTimeWrapper(virDomainPtr dom,
+ long long *seconds,
+ unsigned int *nseconds,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002005
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainGetTime(dom, seconds, nseconds, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainGetUUIDWrapper(virDomainPtr domain,
+ unsigned char *uuid,
+ virErrorPtr err)
+{
+ int ret = virDomainGetUUID(domain, uuid);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetUUIDStringWrapper(virDomainPtr domain,
+ char *buf,
+ virErrorPtr err)
+{
+ int ret = virDomainGetUUIDString(domain, buf);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetVcpuPinInfoWrapper(virDomainPtr domain,
+ int ncpumaps,
+ unsigned char *cpumaps,
+ int maplen,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetVcpuPinInfo(domain, ncpumaps, cpumaps, maplen, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetVcpusWrapper(virDomainPtr domain,
+ virVcpuInfoPtr info,
+ int maxinfo,
+ unsigned char *cpumaps,
+ int maplen,
+ virErrorPtr err)
+{
+ int ret = virDomainGetVcpus(domain, info, maxinfo, cpumaps, maplen);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainGetVcpusFlagsWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainGetVcpusFlags(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virDomainGetXMLDescWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virDomainGetXMLDesc(domain, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainHasCurrentSnapshotWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainHasCurrentSnapshot(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainHasManagedSaveImageWrapper(virDomainPtr dom,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainHasManagedSaveImage(dom, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainInjectNMIWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainInjectNMI(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainInterfaceAddressesWrapper(virDomainPtr dom,
+ virDomainInterfacePtr **ifaces,
+ unsigned int source,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002014
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainInterfaceAddresses(dom, ifaces, source, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+void
+virDomainInterfaceFreeWrapper(virDomainInterfacePtr iface)
+{
+#if LIBVIR_VERSION_NUMBER < 1002014
+ assert(0); // Caller should have checked version
+#else
+ virDomainInterfaceFree(iface);
+#endif
+}
+
+
+int
+virDomainInterfaceStatsWrapper(virDomainPtr dom,
+ const char *device,
+ virDomainInterfaceStatsPtr stats,
+ size_t size,
+ virErrorPtr err)
+{
+ int ret = virDomainInterfaceStats(dom, device, stats, size);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+void
+virDomainIOThreadInfoFreeWrapper(virDomainIOThreadInfoPtr info)
+{
+#if LIBVIR_VERSION_NUMBER < 1002014
+ assert(0); // Caller should have checked version
+#else
+ virDomainIOThreadInfoFree(info);
+#endif
+}
+
+
+int
+virDomainIsActiveWrapper(virDomainPtr dom,
+ virErrorPtr err)
+{
+ int ret = virDomainIsActive(dom);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainIsPersistentWrapper(virDomainPtr dom,
+ virErrorPtr err)
+{
+ int ret = virDomainIsPersistent(dom);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainIsUpdatedWrapper(virDomainPtr dom,
+ virErrorPtr err)
+{
+ int ret = virDomainIsUpdated(dom);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainListAllSnapshotsWrapper(virDomainPtr domain,
+ virDomainSnapshotPtr **snaps,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainListAllSnapshots(domain, snaps, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainManagedSaveWrapper(virDomainPtr dom,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainManagedSave(dom, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainManagedSaveDefineXMLWrapper(virDomainPtr domain,
+ const char *dxml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3007000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainManagedSaveDefineXML(domain, dxml, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+char *
+virDomainManagedSaveGetXMLDescWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3007000
+ assert(0); // Caller should have checked version
+#else
+ char * ret = virDomainManagedSaveGetXMLDesc(domain, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainManagedSaveRemoveWrapper(virDomainPtr dom,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainManagedSaveRemove(dom, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainMemoryPeekWrapper(virDomainPtr dom,
+ unsigned long long start,
+ size_t size,
+ void *buffer,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainMemoryPeek(dom, start, size, buffer, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainMemoryStatsWrapper(virDomainPtr dom,
+ virDomainMemoryStatPtr stats,
+ unsigned int nr_stats,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainMemoryStats(dom, stats, nr_stats, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainMigrateWrapper(virDomainPtr domain,
+ virConnectPtr dconn,
+ unsigned long flags,
+ const char *dname,
+ const char *uri,
+ unsigned long bandwidth,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainMigrate(domain, dconn, flags, dname, uri, bandwidth);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainMigrate2Wrapper(virDomainPtr domain,
+ virConnectPtr dconn,
+ const char *dxml,
+ unsigned long flags,
+ const char *dname,
+ const char *uri,
+ unsigned long bandwidth,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainMigrate2(domain, dconn, dxml, flags, dname, uri, bandwidth);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainMigrate3Wrapper(virDomainPtr domain,
+ virConnectPtr dconn,
+ virTypedParameterPtr params,
+ unsigned int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainMigrate3(domain, dconn, params, nparams, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainMigrateGetCompressionCacheWrapper(virDomainPtr domain,
+ unsigned long long *cacheSize,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainMigrateGetCompressionCache(domain, cacheSize, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainMigrateGetMaxDowntimeWrapper(virDomainPtr domain,
+ unsigned long long *downtime,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3007000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainMigrateGetMaxDowntime(domain, downtime, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainMigrateGetMaxSpeedWrapper(virDomainPtr domain,
+ unsigned long *bandwidth,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainMigrateGetMaxSpeed(domain, bandwidth, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainMigrateSetCompressionCacheWrapper(virDomainPtr domain,
+ unsigned long long cacheSize,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainMigrateSetCompressionCache(domain, cacheSize, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainMigrateSetMaxDowntimeWrapper(virDomainPtr domain,
+ unsigned long long downtime,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainMigrateSetMaxDowntime(domain, downtime, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainMigrateSetMaxSpeedWrapper(virDomainPtr domain,
+ unsigned long bandwidth,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainMigrateSetMaxSpeed(domain, bandwidth, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainMigrateStartPostCopyWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1003003
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainMigrateStartPostCopy(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainMigrateToURIWrapper(virDomainPtr domain,
+ const char *duri,
+ unsigned long flags,
+ const char *dname,
+ unsigned long bandwidth,
+ virErrorPtr err)
+{
+ int ret = virDomainMigrateToURI(domain, duri, flags, dname, bandwidth);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainMigrateToURI2Wrapper(virDomainPtr domain,
+ const char *dconnuri,
+ const char *miguri,
+ const char *dxml,
+ unsigned long flags,
+ const char *dname,
+ unsigned long bandwidth,
+ virErrorPtr err)
+{
+ int ret = virDomainMigrateToURI2(domain, dconnuri, miguri, dxml, flags, dname, bandwidth);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainMigrateToURI3Wrapper(virDomainPtr domain,
+ const char *dconnuri,
+ virTypedParameterPtr params,
+ unsigned int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainMigrateToURI3(domain, dconnuri, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainOpenChannelWrapper(virDomainPtr dom,
+ const char *name,
+ virStreamPtr st,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainOpenChannel(dom, name, st, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainOpenConsoleWrapper(virDomainPtr dom,
+ const char *dev_name,
+ virStreamPtr st,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainOpenConsole(dom, dev_name, st, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainOpenGraphicsWrapper(virDomainPtr dom,
+ unsigned int idx,
+ int fd,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainOpenGraphics(dom, idx, fd, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainOpenGraphicsFDWrapper(virDomainPtr dom,
+ unsigned int idx,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002008
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainOpenGraphicsFD(dom, idx, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainPMSuspendForDurationWrapper(virDomainPtr dom,
+ unsigned int target,
+ unsigned long long duration,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainPMSuspendForDuration(dom, target, duration, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainPMWakeupWrapper(virDomainPtr dom,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainPMWakeup(dom, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainPinEmulatorWrapper(virDomainPtr domain,
+ unsigned char *cpumap,
+ int maplen,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainPinEmulator(domain, cpumap, maplen, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainPinIOThreadWrapper(virDomainPtr domain,
+ unsigned int iothread_id,
+ unsigned char *cpumap,
+ int maplen,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002014
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainPinIOThread(domain, iothread_id, cpumap, maplen, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainPinVcpuWrapper(virDomainPtr domain,
+ unsigned int vcpu,
+ unsigned char *cpumap,
+ int maplen,
+ virErrorPtr err)
+{
+ int ret = virDomainPinVcpu(domain, vcpu, cpumap, maplen);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainPinVcpuFlagsWrapper(virDomainPtr domain,
+ unsigned int vcpu,
+ unsigned char *cpumap,
+ int maplen,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainPinVcpuFlags(domain, vcpu, cpumap, maplen, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainRebootWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainReboot(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainRefWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ int ret = virDomainRef(domain);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainRenameWrapper(virDomainPtr dom,
+ const char *new_name,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002019
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainRename(dom, new_name, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainResetWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainReset(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainResumeWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ int ret = virDomainResume(domain);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSaveWrapper(virDomainPtr domain,
+ const char *to,
+ virErrorPtr err)
+{
+ int ret = virDomainSave(domain, to);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSaveFlagsWrapper(virDomainPtr domain,
+ const char *to,
+ const char *dxml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSaveFlags(domain, to, dxml, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virDomainScreenshotWrapper(virDomainPtr domain,
+ virStreamPtr stream,
+ unsigned int screen,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virDomainScreenshot(domain, stream, screen, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSendKeyWrapper(virDomainPtr domain,
+ unsigned int codeset,
+ unsigned int holdtime,
+ unsigned int *keycodes,
+ int nkeycodes,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSendKey(domain, codeset, holdtime, keycodes, nkeycodes, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSendProcessSignalWrapper(virDomainPtr domain,
+ long long pid_value,
+ unsigned int signum,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSendProcessSignal(domain, pid_value, signum, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetAutostartWrapper(virDomainPtr domain,
+ int autostart,
+ virErrorPtr err)
+{
+ int ret = virDomainSetAutostart(domain, autostart);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetBlkioParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSetBlkioParameters(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetBlockIoTuneWrapper(virDomainPtr dom,
+ const char *disk,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSetBlockIoTune(dom, disk, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetBlockThresholdWrapper(virDomainPtr domain,
+ const char *dev,
+ unsigned long long threshold,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3002000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainSetBlockThreshold(domain, dev, threshold, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainSetGuestVcpusWrapper(virDomainPtr domain,
+ const char *cpumap,
+ int state,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 2000000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainSetGuestVcpus(domain, cpumap, state, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainSetInterfaceParametersWrapper(virDomainPtr domain,
+ const char *device,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSetInterfaceParameters(domain, device, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetLifecycleActionWrapper(virDomainPtr domain,
+ unsigned int type,
+ unsigned int action,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3009000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainSetLifecycleAction(domain, type, action, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainSetMaxMemoryWrapper(virDomainPtr domain,
+ unsigned long memory,
+ virErrorPtr err)
+{
+ int ret = virDomainSetMaxMemory(domain, memory);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetMemoryWrapper(virDomainPtr domain,
+ unsigned long memory,
+ virErrorPtr err)
+{
+ int ret = virDomainSetMemory(domain, memory);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetMemoryFlagsWrapper(virDomainPtr domain,
+ unsigned long memory,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSetMemoryFlags(domain, memory, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetMemoryParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSetMemoryParameters(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetMemoryStatsPeriodWrapper(virDomainPtr domain,
+ int period,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSetMemoryStatsPeriod(domain, period, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetMetadataWrapper(virDomainPtr domain,
+ int type,
+ const char *metadata,
+ const char *key,
+ const char *uri,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSetMetadata(domain, type, metadata, key, uri, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetNumaParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSetNumaParameters(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetPerfEventsWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1003003
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainSetPerfEvents(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainSetSchedulerParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ virErrorPtr err)
+{
+ int ret = virDomainSetSchedulerParameters(domain, params, nparams);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetSchedulerParametersFlagsWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSetSchedulerParametersFlags(domain, params, nparams, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetTimeWrapper(virDomainPtr dom,
+ long long seconds,
+ unsigned int nseconds,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002005
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainSetTime(dom, seconds, nseconds, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainSetUserPasswordWrapper(virDomainPtr dom,
+ const char *user,
+ const char *password,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002016
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainSetUserPassword(dom, user, password, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainSetVcpuWrapper(virDomainPtr domain,
+ const char *vcpumap,
+ int state,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3001000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainSetVcpu(domain, vcpumap, state, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainSetVcpusWrapper(virDomainPtr domain,
+ unsigned int nvcpus,
+ virErrorPtr err)
+{
+ int ret = virDomainSetVcpus(domain, nvcpus);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSetVcpusFlagsWrapper(virDomainPtr domain,
+ unsigned int nvcpus,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSetVcpusFlags(domain, nvcpus, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainShutdownWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ int ret = virDomainShutdown(domain);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainShutdownFlagsWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainShutdownFlags(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainSnapshotPtr
+virDomainSnapshotCreateXMLWrapper(virDomainPtr domain,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virDomainSnapshotPtr ret = virDomainSnapshotCreateXML(domain, xmlDesc, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainSnapshotPtr
+virDomainSnapshotCurrentWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virDomainSnapshotPtr ret = virDomainSnapshotCurrent(domain, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSnapshotListNamesWrapper(virDomainPtr domain,
+ char **names,
+ int nameslen,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSnapshotListNames(domain, names, nameslen, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainSnapshotPtr
+virDomainSnapshotLookupByNameWrapper(virDomainPtr domain,
+ const char *name,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virDomainSnapshotPtr ret = virDomainSnapshotLookupByName(domain, name, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSnapshotNumWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainSnapshotNum(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainSuspendWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ int ret = virDomainSuspend(domain);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainUndefineWrapper(virDomainPtr domain,
+ virErrorPtr err)
+{
+ int ret = virDomainUndefine(domain);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainUndefineFlagsWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainUndefineFlags(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainUpdateDeviceFlagsWrapper(virDomainPtr domain,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainUpdateDeviceFlags(domain, xml, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/domain_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_wrapper.h
new file mode 100644
index 00000000..7bd82826
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/domain_wrapper.h
@@ -0,0 +1,986 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_DOMAIN_WRAPPER_H__
+#define LIBVIRT_GO_DOMAIN_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "domain_compat.h"
+
+int
+virDomainAbortJobWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainAddIOThreadWrapper(virDomainPtr domain,
+ unsigned int iothread_id,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainAttachDeviceWrapper(virDomainPtr domain,
+ const char *xml,
+ virErrorPtr err);
+
+int
+virDomainAttachDeviceFlagsWrapper(virDomainPtr domain,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainBlockCommitWrapper(virDomainPtr dom,
+ const char *disk,
+ const char *base,
+ const char *top,
+ unsigned long bandwidth,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainBlockCopyWrapper(virDomainPtr dom,
+ const char *disk,
+ const char *destxml,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainBlockJobAbortWrapper(virDomainPtr dom,
+ const char *disk,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainBlockJobSetSpeedWrapper(virDomainPtr dom,
+ const char *disk,
+ unsigned long bandwidth,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainBlockPeekWrapper(virDomainPtr dom,
+ const char *disk,
+ unsigned long long offset,
+ size_t size,
+ void *buffer,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainBlockPullWrapper(virDomainPtr dom,
+ const char *disk,
+ unsigned long bandwidth,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainBlockRebaseWrapper(virDomainPtr dom,
+ const char *disk,
+ const char *base,
+ unsigned long bandwidth,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainBlockResizeWrapper(virDomainPtr dom,
+ const char *disk,
+ unsigned long long size,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainBlockStatsWrapper(virDomainPtr dom,
+ const char *disk,
+ virDomainBlockStatsPtr stats,
+ size_t size,
+ virErrorPtr err);
+
+int
+virDomainBlockStatsFlagsWrapper(virDomainPtr dom,
+ const char *disk,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainCoreDumpWrapper(virDomainPtr domain,
+ const char *to,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainCoreDumpWithFormatWrapper(virDomainPtr domain,
+ const char *to,
+ unsigned int dumpformat,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainCreateWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainCreateWithFilesWrapper(virDomainPtr domain,
+ unsigned int nfiles,
+ int *files,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainCreateWithFlagsWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainDelIOThreadWrapper(virDomainPtr domain,
+ unsigned int iothread_id,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainDestroyWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainDestroyFlagsWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainDetachDeviceWrapper(virDomainPtr domain,
+ const char *xml,
+ virErrorPtr err);
+
+int
+virDomainDetachDeviceAliasWrapper(virDomainPtr domain,
+ const char *alias,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainDetachDeviceFlagsWrapper(virDomainPtr domain,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainFSFreezeWrapper(virDomainPtr dom,
+ const char **mountpoints,
+ unsigned int nmountpoints,
+ unsigned int flags,
+ virErrorPtr err);
+
+void
+virDomainFSInfoFreeWrapper(virDomainFSInfoPtr info);
+
+int
+virDomainFSThawWrapper(virDomainPtr dom,
+ const char **mountpoints,
+ unsigned int nmountpoints,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainFSTrimWrapper(virDomainPtr dom,
+ const char *mountPoint,
+ unsigned long long minimum,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainFreeWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainGetAutostartWrapper(virDomainPtr domain,
+ int *autostart,
+ virErrorPtr err);
+
+int
+virDomainGetBlkioParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetBlockInfoWrapper(virDomainPtr domain,
+ const char *disk,
+ virDomainBlockInfoPtr info,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetBlockIoTuneWrapper(virDomainPtr dom,
+ const char *disk,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetBlockJobInfoWrapper(virDomainPtr dom,
+ const char *disk,
+ virDomainBlockJobInfoPtr info,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetCPUStatsWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ unsigned int nparams,
+ int start_cpu,
+ unsigned int ncpus,
+ unsigned int flags,
+ virErrorPtr err);
+
+virConnectPtr
+virDomainGetConnectWrapper(virDomainPtr dom,
+ virErrorPtr err);
+
+int
+virDomainGetControlInfoWrapper(virDomainPtr domain,
+ virDomainControlInfoPtr info,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetDiskErrorsWrapper(virDomainPtr dom,
+ virDomainDiskErrorPtr errors,
+ unsigned int maxerrors,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetEmulatorPinInfoWrapper(virDomainPtr domain,
+ unsigned char *cpumap,
+ int maplen,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetFSInfoWrapper(virDomainPtr dom,
+ virDomainFSInfoPtr **info,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetGuestVcpusWrapper(virDomainPtr domain,
+ virTypedParameterPtr *params,
+ unsigned int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virDomainGetHostnameWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+unsigned int
+virDomainGetIDWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainGetIOThreadInfoWrapper(virDomainPtr dom,
+ virDomainIOThreadInfoPtr **info,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetInfoWrapper(virDomainPtr domain,
+ virDomainInfoPtr info,
+ virErrorPtr err);
+
+int
+virDomainGetInterfaceParametersWrapper(virDomainPtr domain,
+ const char *device,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetJobInfoWrapper(virDomainPtr domain,
+ virDomainJobInfoPtr info,
+ virErrorPtr err);
+
+int
+virDomainGetJobStatsWrapper(virDomainPtr domain,
+ int *type,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetLaunchSecurityInfoWrapper(virDomainPtr domain,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+unsigned long
+virDomainGetMaxMemoryWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainGetMaxVcpusWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainGetMemoryParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virDomainGetMetadataWrapper(virDomainPtr domain,
+ int type,
+ const char *uri,
+ unsigned int flags,
+ virErrorPtr err);
+
+const char *
+virDomainGetNameWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainGetNumaParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virDomainGetOSTypeWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainGetPerfEventsWrapper(virDomainPtr domain,
+ virTypedParameterPtr *params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetSchedulerParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ virErrorPtr err);
+
+int
+virDomainGetSchedulerParametersFlagsWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virDomainGetSchedulerTypeWrapper(virDomainPtr domain,
+ int *nparams,
+ virErrorPtr err);
+
+int
+virDomainGetSecurityLabelWrapper(virDomainPtr domain,
+ virSecurityLabelPtr seclabel,
+ virErrorPtr err);
+
+int
+virDomainGetSecurityLabelListWrapper(virDomainPtr domain,
+ virSecurityLabelPtr *seclabels,
+ virErrorPtr err);
+
+int
+virDomainGetStateWrapper(virDomainPtr domain,
+ int *state,
+ int *reason,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetTimeWrapper(virDomainPtr dom,
+ long long *seconds,
+ unsigned int *nseconds,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetUUIDWrapper(virDomainPtr domain,
+ unsigned char *uuid,
+ virErrorPtr err);
+
+int
+virDomainGetUUIDStringWrapper(virDomainPtr domain,
+ char *buf,
+ virErrorPtr err);
+
+int
+virDomainGetVcpuPinInfoWrapper(virDomainPtr domain,
+ int ncpumaps,
+ unsigned char *cpumaps,
+ int maplen,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainGetVcpusWrapper(virDomainPtr domain,
+ virVcpuInfoPtr info,
+ int maxinfo,
+ unsigned char *cpumaps,
+ int maplen,
+ virErrorPtr err);
+
+int
+virDomainGetVcpusFlagsWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virDomainGetXMLDescWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainHasCurrentSnapshotWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainHasManagedSaveImageWrapper(virDomainPtr dom,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainInjectNMIWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainInterfaceAddressesWrapper(virDomainPtr dom,
+ virDomainInterfacePtr **ifaces,
+ unsigned int source,
+ unsigned int flags,
+ virErrorPtr err);
+
+void
+virDomainInterfaceFreeWrapper(virDomainInterfacePtr iface);
+
+int
+virDomainInterfaceStatsWrapper(virDomainPtr dom,
+ const char *device,
+ virDomainInterfaceStatsPtr stats,
+ size_t size,
+ virErrorPtr err);
+
+void
+virDomainIOThreadInfoFreeWrapper(virDomainIOThreadInfoPtr info);
+
+int
+virDomainIsActiveWrapper(virDomainPtr dom,
+ virErrorPtr err);
+
+int
+virDomainIsPersistentWrapper(virDomainPtr dom,
+ virErrorPtr err);
+
+int
+virDomainIsUpdatedWrapper(virDomainPtr dom,
+ virErrorPtr err);
+
+int
+virDomainListAllSnapshotsWrapper(virDomainPtr domain,
+ virDomainSnapshotPtr **snaps,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainManagedSaveWrapper(virDomainPtr dom,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainManagedSaveDefineXMLWrapper(virDomainPtr domain,
+ const char *dxml,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virDomainManagedSaveGetXMLDescWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainManagedSaveRemoveWrapper(virDomainPtr dom,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainMemoryPeekWrapper(virDomainPtr dom,
+ unsigned long long start,
+ size_t size,
+ void *buffer,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainMemoryStatsWrapper(virDomainPtr dom,
+ virDomainMemoryStatPtr stats,
+ unsigned int nr_stats,
+ unsigned int flags,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainMigrateWrapper(virDomainPtr domain,
+ virConnectPtr dconn,
+ unsigned long flags,
+ const char *dname,
+ const char *uri,
+ unsigned long bandwidth,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainMigrate2Wrapper(virDomainPtr domain,
+ virConnectPtr dconn,
+ const char *dxml,
+ unsigned long flags,
+ const char *dname,
+ const char *uri,
+ unsigned long bandwidth,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainMigrate3Wrapper(virDomainPtr domain,
+ virConnectPtr dconn,
+ virTypedParameterPtr params,
+ unsigned int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainMigrateGetCompressionCacheWrapper(virDomainPtr domain,
+ unsigned long long *cacheSize,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainMigrateGetMaxDowntimeWrapper(virDomainPtr domain,
+ unsigned long long *downtime,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainMigrateGetMaxSpeedWrapper(virDomainPtr domain,
+ unsigned long *bandwidth,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainMigrateSetCompressionCacheWrapper(virDomainPtr domain,
+ unsigned long long cacheSize,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainMigrateSetMaxDowntimeWrapper(virDomainPtr domain,
+ unsigned long long downtime,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainMigrateSetMaxSpeedWrapper(virDomainPtr domain,
+ unsigned long bandwidth,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainMigrateStartPostCopyWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainMigrateToURIWrapper(virDomainPtr domain,
+ const char *duri,
+ unsigned long flags,
+ const char *dname,
+ unsigned long bandwidth,
+ virErrorPtr err);
+
+int
+virDomainMigrateToURI2Wrapper(virDomainPtr domain,
+ const char *dconnuri,
+ const char *miguri,
+ const char *dxml,
+ unsigned long flags,
+ const char *dname,
+ unsigned long bandwidth,
+ virErrorPtr err);
+
+int
+virDomainMigrateToURI3Wrapper(virDomainPtr domain,
+ const char *dconnuri,
+ virTypedParameterPtr params,
+ unsigned int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainOpenChannelWrapper(virDomainPtr dom,
+ const char *name,
+ virStreamPtr st,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainOpenConsoleWrapper(virDomainPtr dom,
+ const char *dev_name,
+ virStreamPtr st,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainOpenGraphicsWrapper(virDomainPtr dom,
+ unsigned int idx,
+ int fd,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainOpenGraphicsFDWrapper(virDomainPtr dom,
+ unsigned int idx,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainPMSuspendForDurationWrapper(virDomainPtr dom,
+ unsigned int target,
+ unsigned long long duration,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainPMWakeupWrapper(virDomainPtr dom,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainPinEmulatorWrapper(virDomainPtr domain,
+ unsigned char *cpumap,
+ int maplen,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainPinIOThreadWrapper(virDomainPtr domain,
+ unsigned int iothread_id,
+ unsigned char *cpumap,
+ int maplen,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainPinVcpuWrapper(virDomainPtr domain,
+ unsigned int vcpu,
+ unsigned char *cpumap,
+ int maplen,
+ virErrorPtr err);
+
+int
+virDomainPinVcpuFlagsWrapper(virDomainPtr domain,
+ unsigned int vcpu,
+ unsigned char *cpumap,
+ int maplen,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainRebootWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainRefWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainRenameWrapper(virDomainPtr dom,
+ const char *new_name,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainResetWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainResumeWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainSaveWrapper(virDomainPtr domain,
+ const char *to,
+ virErrorPtr err);
+
+int
+virDomainSaveFlagsWrapper(virDomainPtr domain,
+ const char *to,
+ const char *dxml,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virDomainScreenshotWrapper(virDomainPtr domain,
+ virStreamPtr stream,
+ unsigned int screen,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSendKeyWrapper(virDomainPtr domain,
+ unsigned int codeset,
+ unsigned int holdtime,
+ unsigned int *keycodes,
+ int nkeycodes,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSendProcessSignalWrapper(virDomainPtr domain,
+ long long pid_value,
+ unsigned int signum,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetAutostartWrapper(virDomainPtr domain,
+ int autostart,
+ virErrorPtr err);
+
+int
+virDomainSetBlkioParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetBlockIoTuneWrapper(virDomainPtr dom,
+ const char *disk,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetBlockThresholdWrapper(virDomainPtr domain,
+ const char *dev,
+ unsigned long long threshold,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetGuestVcpusWrapper(virDomainPtr domain,
+ const char *cpumap,
+ int state,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetInterfaceParametersWrapper(virDomainPtr domain,
+ const char *device,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetLifecycleActionWrapper(virDomainPtr domain,
+ unsigned int type,
+ unsigned int action,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetMaxMemoryWrapper(virDomainPtr domain,
+ unsigned long memory,
+ virErrorPtr err);
+
+int
+virDomainSetMemoryWrapper(virDomainPtr domain,
+ unsigned long memory,
+ virErrorPtr err);
+
+int
+virDomainSetMemoryFlagsWrapper(virDomainPtr domain,
+ unsigned long memory,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetMemoryParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetMemoryStatsPeriodWrapper(virDomainPtr domain,
+ int period,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetMetadataWrapper(virDomainPtr domain,
+ int type,
+ const char *metadata,
+ const char *key,
+ const char *uri,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetNumaParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetPerfEventsWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetSchedulerParametersWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ virErrorPtr err);
+
+int
+virDomainSetSchedulerParametersFlagsWrapper(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetTimeWrapper(virDomainPtr dom,
+ long long seconds,
+ unsigned int nseconds,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetUserPasswordWrapper(virDomainPtr dom,
+ const char *user,
+ const char *password,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetVcpuWrapper(virDomainPtr domain,
+ const char *vcpumap,
+ int state,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSetVcpusWrapper(virDomainPtr domain,
+ unsigned int nvcpus,
+ virErrorPtr err);
+
+int
+virDomainSetVcpusFlagsWrapper(virDomainPtr domain,
+ unsigned int nvcpus,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainShutdownWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainShutdownFlagsWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+virDomainSnapshotPtr
+virDomainSnapshotCreateXMLWrapper(virDomainPtr domain,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err);
+
+virDomainSnapshotPtr
+virDomainSnapshotCurrentWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSnapshotListNamesWrapper(virDomainPtr domain,
+ char **names,
+ int nameslen,
+ unsigned int flags,
+ virErrorPtr err);
+
+virDomainSnapshotPtr
+virDomainSnapshotLookupByNameWrapper(virDomainPtr domain,
+ const char *name,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSnapshotNumWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainSuspendWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainUndefineWrapper(virDomainPtr domain,
+ virErrorPtr err);
+
+int
+virDomainUndefineFlagsWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainUpdateDeviceFlagsWrapper(virDomainPtr domain,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_DOMAIN_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/error.go b/src/dma/vendor/github.com/libvirt/libvirt-go/error.go
new file mode 100644
index 00000000..1cfdf922
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/error.go
@@ -0,0 +1,604 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "error_compat.h"
+
+void ignoreErrorFunc(void *userData, virErrorPtr error) {
+ // no-op
+}
+*/
+import "C"
+
+import (
+ "fmt"
+)
+
+func init() {
+ C.virSetErrorFunc(nil, (C.virErrorFunc)(C.ignoreErrorFunc))
+ C.virInitialize()
+}
+
+type ErrorLevel int
+
+const (
+ ERR_NONE = ErrorLevel(C.VIR_ERR_NONE)
+ ERR_WARNING = ErrorLevel(C.VIR_ERR_WARNING)
+ ERR_ERROR = ErrorLevel(C.VIR_ERR_ERROR)
+)
+
+type ErrorNumber int
+
+const (
+ ERR_OK = ErrorNumber(C.VIR_ERR_OK)
+
+ // internal error
+ ERR_INTERNAL_ERROR = ErrorNumber(C.VIR_ERR_INTERNAL_ERROR)
+
+ // memory allocation failure
+ ERR_NO_MEMORY = ErrorNumber(C.VIR_ERR_NO_MEMORY)
+
+ // no support for this function
+ ERR_NO_SUPPORT = ErrorNumber(C.VIR_ERR_NO_SUPPORT)
+
+ // could not resolve hostname
+ ERR_UNKNOWN_HOST = ErrorNumber(C.VIR_ERR_UNKNOWN_HOST)
+
+ // can't connect to hypervisor
+ ERR_NO_CONNECT = ErrorNumber(C.VIR_ERR_NO_CONNECT)
+
+ // invalid connection object
+ ERR_INVALID_CONN = ErrorNumber(C.VIR_ERR_INVALID_CONN)
+
+ // invalid domain object
+ ERR_INVALID_DOMAIN = ErrorNumber(C.VIR_ERR_INVALID_DOMAIN)
+
+ // invalid function argument
+ ERR_INVALID_ARG = ErrorNumber(C.VIR_ERR_INVALID_ARG)
+
+ // a command to hypervisor failed
+ ERR_OPERATION_FAILED = ErrorNumber(C.VIR_ERR_OPERATION_FAILED)
+
+ // a HTTP GET command to failed
+ ERR_GET_FAILED = ErrorNumber(C.VIR_ERR_GET_FAILED)
+
+ // a HTTP POST command to failed
+ ERR_POST_FAILED = ErrorNumber(C.VIR_ERR_POST_FAILED)
+
+ // unexpected HTTP error code
+ ERR_HTTP_ERROR = ErrorNumber(C.VIR_ERR_HTTP_ERROR)
+
+ // failure to serialize an S-Expr
+ ERR_SEXPR_SERIAL = ErrorNumber(C.VIR_ERR_SEXPR_SERIAL)
+
+ // could not open Xen hypervisor control
+ ERR_NO_XEN = ErrorNumber(C.VIR_ERR_NO_XEN)
+
+ // failure doing an hypervisor call
+ ERR_XEN_CALL = ErrorNumber(C.VIR_ERR_XEN_CALL)
+
+ // unknown OS type
+ ERR_OS_TYPE = ErrorNumber(C.VIR_ERR_OS_TYPE)
+
+ // missing kernel information
+ ERR_NO_KERNEL = ErrorNumber(C.VIR_ERR_NO_KERNEL)
+
+ // missing root device information
+ ERR_NO_ROOT = ErrorNumber(C.VIR_ERR_NO_ROOT)
+
+ // missing source device information
+ ERR_NO_SOURCE = ErrorNumber(C.VIR_ERR_NO_SOURCE)
+
+ // missing target device information
+ ERR_NO_TARGET = ErrorNumber(C.VIR_ERR_NO_TARGET)
+
+ // missing domain name information
+ ERR_NO_NAME = ErrorNumber(C.VIR_ERR_NO_NAME)
+
+ // missing domain OS information
+ ERR_NO_OS = ErrorNumber(C.VIR_ERR_NO_OS)
+
+ // missing domain devices information
+ ERR_NO_DEVICE = ErrorNumber(C.VIR_ERR_NO_DEVICE)
+
+ // could not open Xen Store control
+ ERR_NO_XENSTORE = ErrorNumber(C.VIR_ERR_NO_XENSTORE)
+
+ // too many drivers registered
+ ERR_DRIVER_FULL = ErrorNumber(C.VIR_ERR_DRIVER_FULL)
+
+ // not supported by the drivers (DEPRECATED)
+ ERR_CALL_FAILED = ErrorNumber(C.VIR_ERR_CALL_FAILED)
+
+ // an XML description is not well formed or broken
+ ERR_XML_ERROR = ErrorNumber(C.VIR_ERR_XML_ERROR)
+
+ // the domain already exist
+ ERR_DOM_EXIST = ErrorNumber(C.VIR_ERR_DOM_EXIST)
+
+ // operation forbidden on read-only connections
+ ERR_OPERATION_DENIED = ErrorNumber(C.VIR_ERR_OPERATION_DENIED)
+
+ // failed to open a conf file
+ ERR_OPEN_FAILED = ErrorNumber(C.VIR_ERR_OPEN_FAILED)
+
+ // failed to read a conf file
+ ERR_READ_FAILED = ErrorNumber(C.VIR_ERR_READ_FAILED)
+
+ // failed to parse a conf file
+ ERR_PARSE_FAILED = ErrorNumber(C.VIR_ERR_PARSE_FAILED)
+
+ // failed to parse the syntax of a conf file
+ ERR_CONF_SYNTAX = ErrorNumber(C.VIR_ERR_CONF_SYNTAX)
+
+ // failed to write a conf file
+ ERR_WRITE_FAILED = ErrorNumber(C.VIR_ERR_WRITE_FAILED)
+
+ // detail of an XML error
+ ERR_XML_DETAIL = ErrorNumber(C.VIR_ERR_XML_DETAIL)
+
+ // invalid network object
+ ERR_INVALID_NETWORK = ErrorNumber(C.VIR_ERR_INVALID_NETWORK)
+
+ // the network already exist
+ ERR_NETWORK_EXIST = ErrorNumber(C.VIR_ERR_NETWORK_EXIST)
+
+ // general system call failure
+ ERR_SYSTEM_ERROR = ErrorNumber(C.VIR_ERR_SYSTEM_ERROR)
+
+ // some sort of RPC error
+ ERR_RPC = ErrorNumber(C.VIR_ERR_RPC)
+
+ // error from a GNUTLS call
+ ERR_GNUTLS_ERROR = ErrorNumber(C.VIR_ERR_GNUTLS_ERROR)
+
+ // failed to start network
+ WAR_NO_NETWORK = ErrorNumber(C.VIR_WAR_NO_NETWORK)
+
+ // domain not found or unexpectedly disappeared
+ ERR_NO_DOMAIN = ErrorNumber(C.VIR_ERR_NO_DOMAIN)
+
+ // network not found
+ ERR_NO_NETWORK = ErrorNumber(C.VIR_ERR_NO_NETWORK)
+
+ // invalid MAC address
+ ERR_INVALID_MAC = ErrorNumber(C.VIR_ERR_INVALID_MAC)
+
+ // authentication failed
+ ERR_AUTH_FAILED = ErrorNumber(C.VIR_ERR_AUTH_FAILED)
+
+ // invalid storage pool object
+ ERR_INVALID_STORAGE_POOL = ErrorNumber(C.VIR_ERR_INVALID_STORAGE_POOL)
+
+ // invalid storage vol object
+ ERR_INVALID_STORAGE_VOL = ErrorNumber(C.VIR_ERR_INVALID_STORAGE_VOL)
+
+ // failed to start storage
+ WAR_NO_STORAGE = ErrorNumber(C.VIR_WAR_NO_STORAGE)
+
+ // storage pool not found
+ ERR_NO_STORAGE_POOL = ErrorNumber(C.VIR_ERR_NO_STORAGE_POOL)
+
+ // storage volume not found
+ ERR_NO_STORAGE_VOL = ErrorNumber(C.VIR_ERR_NO_STORAGE_VOL)
+
+ // failed to start node driver
+ WAR_NO_NODE = ErrorNumber(C.VIR_WAR_NO_NODE)
+
+ // invalid node device object
+ ERR_INVALID_NODE_DEVICE = ErrorNumber(C.VIR_ERR_INVALID_NODE_DEVICE)
+
+ // node device not found
+ ERR_NO_NODE_DEVICE = ErrorNumber(C.VIR_ERR_NO_NODE_DEVICE)
+
+ // security model not found
+ ERR_NO_SECURITY_MODEL = ErrorNumber(C.VIR_ERR_NO_SECURITY_MODEL)
+
+ // operation is not applicable at this time
+ ERR_OPERATION_INVALID = ErrorNumber(C.VIR_ERR_OPERATION_INVALID)
+
+ // failed to start interface driver
+ WAR_NO_INTERFACE = ErrorNumber(C.VIR_WAR_NO_INTERFACE)
+
+ // interface driver not running
+ ERR_NO_INTERFACE = ErrorNumber(C.VIR_ERR_NO_INTERFACE)
+
+ // invalid interface object
+ ERR_INVALID_INTERFACE = ErrorNumber(C.VIR_ERR_INVALID_INTERFACE)
+
+ // more than one matching interface found
+ ERR_MULTIPLE_INTERFACES = ErrorNumber(C.VIR_ERR_MULTIPLE_INTERFACES)
+
+ // failed to start nwfilter driver
+ WAR_NO_NWFILTER = ErrorNumber(C.VIR_WAR_NO_NWFILTER)
+
+ // invalid nwfilter object
+ ERR_INVALID_NWFILTER = ErrorNumber(C.VIR_ERR_INVALID_NWFILTER)
+
+ // nw filter pool not found
+ ERR_NO_NWFILTER = ErrorNumber(C.VIR_ERR_NO_NWFILTER)
+
+ // nw filter pool not found
+ ERR_BUILD_FIREWALL = ErrorNumber(C.VIR_ERR_BUILD_FIREWALL)
+
+ // failed to start secret storage
+ WAR_NO_SECRET = ErrorNumber(C.VIR_WAR_NO_SECRET)
+
+ // invalid secret
+ ERR_INVALID_SECRET = ErrorNumber(C.VIR_ERR_INVALID_SECRET)
+
+ // secret not found
+ ERR_NO_SECRET = ErrorNumber(C.VIR_ERR_NO_SECRET)
+
+ // unsupported configuration construct
+ ERR_CONFIG_UNSUPPORTED = ErrorNumber(C.VIR_ERR_CONFIG_UNSUPPORTED)
+
+ // timeout occurred during operation
+ ERR_OPERATION_TIMEOUT = ErrorNumber(C.VIR_ERR_OPERATION_TIMEOUT)
+
+ // a migration worked, but making the VM persist on the dest host failed
+ ERR_MIGRATE_PERSIST_FAILED = ErrorNumber(C.VIR_ERR_MIGRATE_PERSIST_FAILED)
+
+ // a synchronous hook script failed
+ ERR_HOOK_SCRIPT_FAILED = ErrorNumber(C.VIR_ERR_HOOK_SCRIPT_FAILED)
+
+ // invalid domain snapshot
+ ERR_INVALID_DOMAIN_SNAPSHOT = ErrorNumber(C.VIR_ERR_INVALID_DOMAIN_SNAPSHOT)
+
+ // domain snapshot not found
+ ERR_NO_DOMAIN_SNAPSHOT = ErrorNumber(C.VIR_ERR_NO_DOMAIN_SNAPSHOT)
+
+ // stream pointer not valid
+ ERR_INVALID_STREAM = ErrorNumber(C.VIR_ERR_INVALID_STREAM)
+
+ // valid API use but unsupported by the given driver
+ ERR_ARGUMENT_UNSUPPORTED = ErrorNumber(C.VIR_ERR_ARGUMENT_UNSUPPORTED)
+
+ // storage pool probe failed
+ ERR_STORAGE_PROBE_FAILED = ErrorNumber(C.VIR_ERR_STORAGE_PROBE_FAILED)
+
+ // storage pool already built
+ ERR_STORAGE_POOL_BUILT = ErrorNumber(C.VIR_ERR_STORAGE_POOL_BUILT)
+
+ // force was not requested for a risky domain snapshot revert
+ ERR_SNAPSHOT_REVERT_RISKY = ErrorNumber(C.VIR_ERR_SNAPSHOT_REVERT_RISKY)
+
+ // operation on a domain was canceled/aborted by user
+ ERR_OPERATION_ABORTED = ErrorNumber(C.VIR_ERR_OPERATION_ABORTED)
+
+ // authentication cancelled
+ ERR_AUTH_CANCELLED = ErrorNumber(C.VIR_ERR_AUTH_CANCELLED)
+
+ // The metadata is not present
+ ERR_NO_DOMAIN_METADATA = ErrorNumber(C.VIR_ERR_NO_DOMAIN_METADATA)
+
+ // Migration is not safe
+ ERR_MIGRATE_UNSAFE = ErrorNumber(C.VIR_ERR_MIGRATE_UNSAFE)
+
+ // integer overflow
+ ERR_OVERFLOW = ErrorNumber(C.VIR_ERR_OVERFLOW)
+
+ // action prevented by block copy job
+ ERR_BLOCK_COPY_ACTIVE = ErrorNumber(C.VIR_ERR_BLOCK_COPY_ACTIVE)
+
+ // The requested operation is not supported
+ ERR_OPERATION_UNSUPPORTED = ErrorNumber(C.VIR_ERR_OPERATION_UNSUPPORTED)
+
+ // error in ssh transport driver
+ ERR_SSH = ErrorNumber(C.VIR_ERR_SSH)
+
+ // guest agent is unresponsive, not running or not usable
+ ERR_AGENT_UNRESPONSIVE = ErrorNumber(C.VIR_ERR_AGENT_UNRESPONSIVE)
+
+ // resource is already in use
+ ERR_RESOURCE_BUSY = ErrorNumber(C.VIR_ERR_RESOURCE_BUSY)
+
+ // operation on the object/resource was denied
+ ERR_ACCESS_DENIED = ErrorNumber(C.VIR_ERR_ACCESS_DENIED)
+
+ // error from a dbus service
+ ERR_DBUS_SERVICE = ErrorNumber(C.VIR_ERR_DBUS_SERVICE)
+
+ // the storage vol already exists
+ ERR_STORAGE_VOL_EXIST = ErrorNumber(C.VIR_ERR_STORAGE_VOL_EXIST)
+
+ // given CPU is incompatible with host CPU
+ ERR_CPU_INCOMPATIBLE = ErrorNumber(C.VIR_ERR_CPU_INCOMPATIBLE)
+
+ // XML document doesn't validate against schema
+ ERR_XML_INVALID_SCHEMA = ErrorNumber(C.VIR_ERR_XML_INVALID_SCHEMA)
+
+ // Finish API succeeded but it is expected to return NULL */
+ ERR_MIGRATE_FINISH_OK = ErrorNumber(C.VIR_ERR_MIGRATE_FINISH_OK)
+
+ // authentication unavailable
+ ERR_AUTH_UNAVAILABLE = ErrorNumber(C.VIR_ERR_AUTH_UNAVAILABLE)
+
+ // Server was not found
+ ERR_NO_SERVER = ErrorNumber(C.VIR_ERR_NO_SERVER)
+
+ // Client was not found
+ ERR_NO_CLIENT = ErrorNumber(C.VIR_ERR_NO_CLIENT)
+
+ // guest agent replies with wrong id to guest sync command
+ ERR_AGENT_UNSYNCED = ErrorNumber(C.VIR_ERR_AGENT_UNSYNCED)
+
+ // error in libssh transport driver
+ ERR_LIBSSH = ErrorNumber(C.VIR_ERR_LIBSSH)
+
+ // libvirt fail to find the desired device
+ ERR_DEVICE_MISSING = ErrorNumber(C.VIR_ERR_DEVICE_MISSING)
+
+ // Invalid nwfilter binding object
+ ERR_INVALID_NWFILTER_BINDING = ErrorNumber(C.VIR_ERR_INVALID_NWFILTER_BINDING)
+
+ // Requested nwfilter binding does not exist
+ ERR_NO_NWFILTER_BINDING = ErrorNumber(C.VIR_ERR_NO_NWFILTER_BINDING)
+)
+
+type ErrorDomain int
+
+const (
+ FROM_NONE = ErrorDomain(C.VIR_FROM_NONE)
+
+ // Error at Xen hypervisor layer
+ FROM_XEN = ErrorDomain(C.VIR_FROM_XEN)
+
+ // Error at connection with xend daemon
+ FROM_XEND = ErrorDomain(C.VIR_FROM_XEND)
+
+ // Error at connection with xen store
+ FROM_XENSTORE = ErrorDomain(C.VIR_FROM_XENSTORE)
+
+ // Error in the S-Expression code
+ FROM_SEXPR = ErrorDomain(C.VIR_FROM_SEXPR)
+
+ // Error in the XML code
+ FROM_XML = ErrorDomain(C.VIR_FROM_XML)
+
+ // Error when operating on a domain
+ FROM_DOM = ErrorDomain(C.VIR_FROM_DOM)
+
+ // Error in the XML-RPC code
+ FROM_RPC = ErrorDomain(C.VIR_FROM_RPC)
+
+ // Error in the proxy code; unused since 0.8.6
+ FROM_PROXY = ErrorDomain(C.VIR_FROM_PROXY)
+
+ // Error in the configuration file handling
+ FROM_CONF = ErrorDomain(C.VIR_FROM_CONF)
+
+ // Error at the QEMU daemon
+ FROM_QEMU = ErrorDomain(C.VIR_FROM_QEMU)
+
+ // Error when operating on a network
+ FROM_NET = ErrorDomain(C.VIR_FROM_NET)
+
+ // Error from test driver
+ FROM_TEST = ErrorDomain(C.VIR_FROM_TEST)
+
+ // Error from remote driver
+ FROM_REMOTE = ErrorDomain(C.VIR_FROM_REMOTE)
+
+ // Error from OpenVZ driver
+ FROM_OPENVZ = ErrorDomain(C.VIR_FROM_OPENVZ)
+
+ // Error at Xen XM layer
+ FROM_XENXM = ErrorDomain(C.VIR_FROM_XENXM)
+
+ // Error in the Linux Stats code
+ FROM_STATS_LINUX = ErrorDomain(C.VIR_FROM_STATS_LINUX)
+
+ // Error from Linux Container driver
+ FROM_LXC = ErrorDomain(C.VIR_FROM_LXC)
+
+ // Error from storage driver
+ FROM_STORAGE = ErrorDomain(C.VIR_FROM_STORAGE)
+
+ // Error from network config
+ FROM_NETWORK = ErrorDomain(C.VIR_FROM_NETWORK)
+
+ // Error from domain config
+ FROM_DOMAIN = ErrorDomain(C.VIR_FROM_DOMAIN)
+
+ // Error at the UML driver
+ FROM_UML = ErrorDomain(C.VIR_FROM_UML)
+
+ // Error from node device monitor
+ FROM_NODEDEV = ErrorDomain(C.VIR_FROM_NODEDEV)
+
+ // Error from xen inotify layer
+ FROM_XEN_INOTIFY = ErrorDomain(C.VIR_FROM_XEN_INOTIFY)
+
+ // Error from security framework
+ FROM_SECURITY = ErrorDomain(C.VIR_FROM_SECURITY)
+
+ // Error from VirtualBox driver
+ FROM_VBOX = ErrorDomain(C.VIR_FROM_VBOX)
+
+ // Error when operating on an interface
+ FROM_INTERFACE = ErrorDomain(C.VIR_FROM_INTERFACE)
+
+ // The OpenNebula driver no longer exists. Retained for ABI/API compat only
+ FROM_ONE = ErrorDomain(C.VIR_FROM_ONE)
+
+ // Error from ESX driver
+ FROM_ESX = ErrorDomain(C.VIR_FROM_ESX)
+
+ // Error from IBM power hypervisor
+ FROM_PHYP = ErrorDomain(C.VIR_FROM_PHYP)
+
+ // Error from secret storage
+ FROM_SECRET = ErrorDomain(C.VIR_FROM_SECRET)
+
+ // Error from CPU driver
+ FROM_CPU = ErrorDomain(C.VIR_FROM_CPU)
+
+ // Error from XenAPI
+ FROM_XENAPI = ErrorDomain(C.VIR_FROM_XENAPI)
+
+ // Error from network filter driver
+ FROM_NWFILTER = ErrorDomain(C.VIR_FROM_NWFILTER)
+
+ // Error from Synchronous hooks
+ FROM_HOOK = ErrorDomain(C.VIR_FROM_HOOK)
+
+ // Error from domain snapshot
+ FROM_DOMAIN_SNAPSHOT = ErrorDomain(C.VIR_FROM_DOMAIN_SNAPSHOT)
+
+ // Error from auditing subsystem
+ FROM_AUDIT = ErrorDomain(C.VIR_FROM_AUDIT)
+
+ // Error from sysinfo/SMBIOS
+ FROM_SYSINFO = ErrorDomain(C.VIR_FROM_SYSINFO)
+
+ // Error from I/O streams
+ FROM_STREAMS = ErrorDomain(C.VIR_FROM_STREAMS)
+
+ // Error from VMware driver
+ FROM_VMWARE = ErrorDomain(C.VIR_FROM_VMWARE)
+
+ // Error from event loop impl
+ FROM_EVENT = ErrorDomain(C.VIR_FROM_EVENT)
+
+ // Error from libxenlight driver
+ FROM_LIBXL = ErrorDomain(C.VIR_FROM_LIBXL)
+
+ // Error from lock manager
+ FROM_LOCKING = ErrorDomain(C.VIR_FROM_LOCKING)
+
+ // Error from Hyper-V driver
+ FROM_HYPERV = ErrorDomain(C.VIR_FROM_HYPERV)
+
+ // Error from capabilities
+ FROM_CAPABILITIES = ErrorDomain(C.VIR_FROM_CAPABILITIES)
+
+ // Error from URI handling
+ FROM_URI = ErrorDomain(C.VIR_FROM_URI)
+
+ // Error from auth handling
+ FROM_AUTH = ErrorDomain(C.VIR_FROM_AUTH)
+
+ // Error from DBus
+ FROM_DBUS = ErrorDomain(C.VIR_FROM_DBUS)
+
+ // Error from Parallels
+ FROM_PARALLELS = ErrorDomain(C.VIR_FROM_PARALLELS)
+
+ // Error from Device
+ FROM_DEVICE = ErrorDomain(C.VIR_FROM_DEVICE)
+
+ // Error from libssh2 connection transport
+ FROM_SSH = ErrorDomain(C.VIR_FROM_SSH)
+
+ // Error from lockspace
+ FROM_LOCKSPACE = ErrorDomain(C.VIR_FROM_LOCKSPACE)
+
+ // Error from initctl device communication
+ FROM_INITCTL = ErrorDomain(C.VIR_FROM_INITCTL)
+
+ // Error from identity code
+ FROM_IDENTITY = ErrorDomain(C.VIR_FROM_IDENTITY)
+
+ // Error from cgroups
+ FROM_CGROUP = ErrorDomain(C.VIR_FROM_CGROUP)
+
+ // Error from access control manager
+ FROM_ACCESS = ErrorDomain(C.VIR_FROM_ACCESS)
+
+ // Error from systemd code
+ FROM_SYSTEMD = ErrorDomain(C.VIR_FROM_SYSTEMD)
+
+ // Error from bhyve driver
+ FROM_BHYVE = ErrorDomain(C.VIR_FROM_BHYVE)
+
+ // Error from crypto code
+ FROM_CRYPTO = ErrorDomain(C.VIR_FROM_CRYPTO)
+
+ // Error from firewall
+ FROM_FIREWALL = ErrorDomain(C.VIR_FROM_FIREWALL)
+
+ // Erorr from polkit code
+ FROM_POLKIT = ErrorDomain(C.VIR_FROM_POLKIT)
+
+ // Error from thread utils
+ FROM_THREAD = ErrorDomain(C.VIR_FROM_THREAD)
+
+ // Error from admin backend
+ FROM_ADMIN = ErrorDomain(C.VIR_FROM_ADMIN)
+
+ // Error from log manager
+ FROM_LOGGING = ErrorDomain(C.VIR_FROM_LOGGING)
+
+ // Error from Xen xl config code
+ FROM_XENXL = ErrorDomain(C.VIR_FROM_XENXL)
+
+ // Error from perf
+ FROM_PERF = ErrorDomain(C.VIR_FROM_PERF)
+
+ // Error from libssh
+ FROM_LIBSSH = ErrorDomain(C.VIR_FROM_LIBSSH)
+
+ // Error from resoruce control
+ FROM_RESCTRL = ErrorDomain(C.VIR_FROM_RESCTRL)
+)
+
+type Error struct {
+ Code ErrorNumber
+ Domain ErrorDomain
+ Message string
+ Level ErrorLevel
+}
+
+func (err Error) Error() string {
+ return fmt.Sprintf("virError(Code=%d, Domain=%d, Message='%s')",
+ err.Code, err.Domain, err.Message)
+}
+
+func makeError(err *C.virError) Error {
+ ret := Error{
+ Code: ErrorNumber(err.code),
+ Domain: ErrorDomain(err.domain),
+ Message: C.GoString(err.message),
+ Level: ErrorLevel(err.level),
+ }
+ C.virResetError(err)
+ return ret
+}
+
+func makeNotImplementedError(apiname string) Error {
+ return Error{
+ Code: ERR_NO_SUPPORT,
+ Domain: FROM_NONE,
+ Message: fmt.Sprintf("Function '%s' not available in the libvirt library used during Go build", apiname),
+ Level: ERR_ERROR,
+ }
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/error_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/error_compat.h
new file mode 100644
index 00000000..0e416803
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/error_compat.h
@@ -0,0 +1,166 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_ERROR_COMPAT_H__
+#define LIBVIRT_GO_ERROR_COMPAT_H__
+
+/* 1.2.2 */
+
+#ifndef VIR_FROM_BHYVE
+#define VIR_FROM_BHYVE 57
+#endif
+
+
+/* 1.2.3 */
+
+#ifndef VIR_FROM_CRYPTO
+#define VIR_FROM_CRYPTO 58
+#endif
+
+
+/* 1.2.4 */
+
+#ifndef VIR_FROM_FIREWALL
+#define VIR_FROM_FIREWALL 59
+#endif
+
+
+/* 1.2.6 */
+
+#ifndef VIR_ERR_CPU_INCOMPATIBLE
+#define VIR_ERR_CPU_INCOMPATIBLE 91
+#endif
+
+
+/* 1.2.9 */
+
+#ifndef VIR_FROM_POLKIT
+#define VIR_FROM_POLKIT 60
+#endif
+
+
+/* 1.2.12 */
+
+#ifndef VIR_ERR_XML_INVALID_SCHEMA
+#define VIR_ERR_XML_INVALID_SCHEMA 92
+#endif
+
+
+/* 1.2.14 */
+
+#ifndef VIR_FROM_THREAD
+#define VIR_FROM_THREAD 61
+#endif
+
+
+/* 1.2.17 */
+
+#ifndef VIR_FROM_ADMIN
+#define VIR_FROM_ADMIN 62
+#endif
+
+
+/* 1.2.18 */
+
+#ifndef VIR_ERR_MIGRATE_FINISH_OK
+#define VIR_ERR_MIGRATE_FINISH_OK 93
+#endif
+
+
+/* 1.3.0 */
+
+#ifndef VIR_FROM_LOGGING
+#define VIR_FROM_LOGGING 63
+#endif
+
+/* 1.3.2 */
+
+#ifndef VIR_FROM_XENXL
+#define VIR_FROM_XENXL 64
+#endif
+
+
+/* 1.3.3 */
+
+#ifndef VIR_FROM_PERF
+#define VIR_FROM_PERF 65
+#endif
+
+#ifndef VIR_ERR_AUTH_UNAVAILABLE
+#define VIR_ERR_AUTH_UNAVAILABLE 94
+#endif
+
+#ifndef VIR_ERR_NO_SERVER
+#define VIR_ERR_NO_SERVER 95
+#endif
+
+
+/* 1.3.5 */
+
+#ifndef VIR_ERR_NO_CLIENT
+#define VIR_ERR_NO_CLIENT 96
+#endif
+
+
+/* 2.3.0 */
+
+#ifndef VIR_ERR_AGENT_UNSYNCED
+#define VIR_ERR_AGENT_UNSYNCED 97
+#endif
+
+/* 2.5.0 */
+
+#ifndef VIR_ERR_LIBSSH
+#define VIR_ERR_LIBSSH 98
+#endif
+
+#ifndef VIR_FROM_LIBSSH
+#define VIR_FROM_LIBSSH 66
+#endif
+
+/* 3.7.0 */
+
+#ifndef VIR_FROM_RESCTRL
+#define VIR_FROM_RESCTRL 67
+#endif
+
+/* 4.1.0 */
+
+#ifndef VIR_ERR_DEVICE_MISSING
+#define VIR_ERR_DEVICE_MISSING 99
+#endif
+
+/* 4.5.0 */
+
+#ifndef VIR_ERR_INVALID_NWFILTER_BINDING
+#define VIR_ERR_INVALID_NWFILTER_BINDING 100
+#endif
+
+#ifndef VIR_ERR_NO_NWFILTER_BINDING
+#define VIR_ERR_NO_NWFILTER_BINDING 101
+#endif
+
+#endif /* LIBVIRT_GO_ERROR_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/events.go b/src/dma/vendor/github.com/libvirt/libvirt-go/events.go
new file mode 100644
index 00000000..bf2c1f4e
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/events.go
@@ -0,0 +1,258 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdint.h>
+#include "events_wrapper.h"
+*/
+import "C"
+
+type EventHandleType int
+
+const (
+ EVENT_HANDLE_READABLE = EventHandleType(C.VIR_EVENT_HANDLE_READABLE)
+ EVENT_HANDLE_WRITABLE = EventHandleType(C.VIR_EVENT_HANDLE_WRITABLE)
+ EVENT_HANDLE_ERROR = EventHandleType(C.VIR_EVENT_HANDLE_ERROR)
+ EVENT_HANDLE_HANGUP = EventHandleType(C.VIR_EVENT_HANDLE_HANGUP)
+)
+
+// See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventRegisterDefaultImpl
+func EventRegisterDefaultImpl() error {
+ var err C.virError
+ if i := int(C.virEventRegisterDefaultImplWrapper(&err)); i != 0 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventRunDefaultImpl
+func EventRunDefaultImpl() error {
+ var err C.virError
+ if i := int(C.virEventRunDefaultImplWrapper(&err)); i != 0 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+type EventHandleCallback func(watch int, file int, events EventHandleType)
+
+//export eventHandleCallback
+func eventHandleCallback(watch int, fd int, events int, callbackID int) {
+ callbackFunc := getCallbackId(callbackID)
+
+ callback, ok := callbackFunc.(EventHandleCallback)
+ if !ok {
+ panic("Incorrect event handle callback data")
+ }
+
+ callback(watch, fd, (EventHandleType)(events))
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventAddHandle
+func EventAddHandle(fd int, events EventHandleType, callback EventHandleCallback) (int, error) {
+ callbackID := registerCallbackId(callback)
+
+ var err C.virError
+ ret := C.virEventAddHandleWrapper((C.int)(fd), (C.int)(events), (C.int)(callbackID), &err)
+ if ret == -1 {
+ return 0, makeError(&err)
+ }
+
+ return int(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventUpdateHandle
+func EventUpdateHandle(watch int, events EventHandleType) {
+ C.virEventUpdateHandle((C.int)(watch), (C.int)(events))
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventRemoveHandle
+func EventRemoveHandle(watch int) error {
+ var err C.virError
+ ret := C.virEventRemoveHandleWrapper((C.int)(watch), &err)
+ if ret < 0 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+type EventTimeoutCallback func(timer int)
+
+//export eventTimeoutCallback
+func eventTimeoutCallback(timer int, callbackID int) {
+ callbackFunc := getCallbackId(callbackID)
+
+ callback, ok := callbackFunc.(EventTimeoutCallback)
+ if !ok {
+ panic("Incorrect event timeout callback data")
+ }
+
+ callback(timer)
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventAddTimeout
+func EventAddTimeout(freq int, callback EventTimeoutCallback) (int, error) {
+ callbackID := registerCallbackId(callback)
+
+ var err C.virError
+ ret := C.virEventAddTimeoutWrapper((C.int)(freq), (C.int)(callbackID), &err)
+ if ret == -1 {
+ return 0, makeError(&err)
+ }
+
+ return int(ret), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventUpdateTimeout
+func EventUpdateTimeout(timer int, freq int) {
+ C.virEventUpdateTimeout((C.int)(timer), (C.int)(freq))
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventRemoveTimeout
+func EventRemoveTimeout(timer int) error {
+ var err C.virError
+ ret := C.virEventRemoveTimeoutWrapper((C.int)(timer), &err)
+ if ret < 0 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+type EventHandleCallbackInfo struct {
+ callback uintptr
+ opaque uintptr
+ free uintptr
+}
+
+type EventTimeoutCallbackInfo struct {
+ callback uintptr
+ opaque uintptr
+ free uintptr
+}
+
+func (i *EventHandleCallbackInfo) Invoke(watch int, fd int, event EventHandleType) {
+ C.eventHandleCallbackInvoke(C.int(watch), C.int(fd), C.int(event), C.uintptr_t(i.callback), C.uintptr_t(i.opaque))
+}
+
+func (i *EventTimeoutCallbackInfo) Invoke(timer int) {
+ C.eventTimeoutCallbackInvoke(C.int(timer), C.uintptr_t(i.callback), C.uintptr_t(i.opaque))
+}
+
+func (i *EventHandleCallbackInfo) Free() {
+ C.eventHandleCallbackFree(C.uintptr_t(i.free), C.uintptr_t(i.opaque))
+}
+
+func (i *EventTimeoutCallbackInfo) Free() {
+ C.eventTimeoutCallbackFree(C.uintptr_t(i.free), C.uintptr_t(i.opaque))
+}
+
+type EventLoop interface {
+ AddHandleFunc(fd int, event EventHandleType, callback *EventHandleCallbackInfo) int
+ UpdateHandleFunc(watch int, event EventHandleType)
+ RemoveHandleFunc(watch int) int
+ AddTimeoutFunc(freq int, callback *EventTimeoutCallbackInfo) int
+ UpdateTimeoutFunc(timer int, freq int)
+ RemoveTimeoutFunc(timer int) int
+}
+
+var eventLoopImpl EventLoop
+
+// See also https://libvirt.org/html/libvirt-libvirt-event.html#virEventRegisterImpl
+func EventRegisterImpl(impl EventLoop) {
+ eventLoopImpl = impl
+ C.virEventRegisterImplWrapper()
+}
+
+//export eventAddHandleFunc
+func eventAddHandleFunc(fd C.int, event C.int, callback uintptr, opaque uintptr, free uintptr) C.int {
+ if eventLoopImpl == nil {
+ panic("Event loop impl is missing")
+ }
+
+ cbinfo := &EventHandleCallbackInfo{
+ callback: callback,
+ opaque: opaque,
+ free: free,
+ }
+
+ return C.int(eventLoopImpl.AddHandleFunc(int(fd), EventHandleType(event), cbinfo))
+}
+
+//export eventUpdateHandleFunc
+func eventUpdateHandleFunc(watch C.int, event C.int) {
+ if eventLoopImpl == nil {
+ panic("Event loop impl is missing")
+ }
+
+ eventLoopImpl.UpdateHandleFunc(int(watch), EventHandleType(event))
+}
+
+//export eventRemoveHandleFunc
+func eventRemoveHandleFunc(watch C.int) {
+ if eventLoopImpl == nil {
+ panic("Event loop impl is missing")
+ }
+
+ eventLoopImpl.RemoveHandleFunc(int(watch))
+}
+
+//export eventAddTimeoutFunc
+func eventAddTimeoutFunc(freq C.int, callback uintptr, opaque uintptr, free uintptr) C.int {
+ if eventLoopImpl == nil {
+ panic("Event loop impl is missing")
+ }
+
+ cbinfo := &EventTimeoutCallbackInfo{
+ callback: callback,
+ opaque: opaque,
+ free: free,
+ }
+
+ return C.int(eventLoopImpl.AddTimeoutFunc(int(freq), cbinfo))
+}
+
+//export eventUpdateTimeoutFunc
+func eventUpdateTimeoutFunc(timer C.int, freq C.int) {
+ if eventLoopImpl == nil {
+ panic("Event loop impl is missing")
+ }
+
+ eventLoopImpl.UpdateTimeoutFunc(int(timer), int(freq))
+}
+
+//export eventRemoveTimeoutFunc
+func eventRemoveTimeoutFunc(timer C.int) {
+ if eventLoopImpl == nil {
+ panic("Event loop impl is missing")
+ }
+
+ eventLoopImpl.RemoveTimeoutFunc(int(timer))
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/events_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/events_wrapper.go
new file mode 100644
index 00000000..68145893
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/events_wrapper.go
@@ -0,0 +1,193 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdint.h>
+#include <stdlib.h>
+#include "events_wrapper.h"
+
+void eventHandleCallback(int watch, int fd, int events, int callbackID);
+
+static void eventAddHandleHelper(int watch, int fd, int events, void *opaque)
+{
+ eventHandleCallback(watch, fd, events, (int)(intptr_t)opaque);
+}
+
+void eventTimeoutCallback(int timer, int callbackID);
+
+static void eventAddTimeoutHelper(int timer, void *opaque)
+{
+ eventTimeoutCallback(timer, (int)(intptr_t)opaque);
+}
+
+int eventAddHandleFunc(int fd, int event, uintptr_t callback, uintptr_t opaque, uintptr_t freecb);
+void eventUpdateHandleFunc(int watch, int event);
+int eventRemoveHandleFunc(int watch);
+int eventAddTimeoutFunc(int freq, uintptr_t callback, uintptr_t opaque, uintptr_t freecb);
+void eventUpdateTimeoutFunc(int timer, int freq);
+int eventRemoveTimeoutFunc(int timer);
+
+int eventAddHandleFuncHelper(int fd, int event, virEventHandleCallback callback, void *opaque, virFreeCallback freecb)
+{
+ return eventAddHandleFunc(fd, event, (uintptr_t)callback, (uintptr_t)opaque, (uintptr_t)freecb);
+}
+
+void eventUpdateHandleFuncHelper(int watch, int event)
+{
+ eventUpdateHandleFunc(watch, event);
+}
+
+int eventRemoveHandleFuncHelper(int watch)
+{
+ return eventRemoveHandleFunc(watch);
+}
+
+int eventAddTimeoutFuncHelper(int freq, virEventTimeoutCallback callback, void *opaque, virFreeCallback freecb)
+{
+ return eventAddTimeoutFunc(freq, (uintptr_t)callback, (uintptr_t)opaque, (uintptr_t)freecb);
+}
+
+void eventUpdateTimeoutFuncHelper(int timer, int freq)
+{
+ eventUpdateTimeoutFunc(timer, freq);
+}
+
+int eventRemoveTimeoutFuncHelper(int timer)
+{
+ return eventRemoveTimeoutFunc(timer);
+}
+
+
+void virEventRegisterImplWrapper(void)
+{
+ virEventRegisterImpl(eventAddHandleFuncHelper,
+ eventUpdateHandleFuncHelper,
+ eventRemoveHandleFuncHelper,
+ eventAddTimeoutFuncHelper,
+ eventUpdateTimeoutFuncHelper,
+ eventRemoveTimeoutFuncHelper);
+}
+
+void eventHandleCallbackInvoke(int watch, int fd, int events, uintptr_t callback, uintptr_t opaque)
+{
+ ((virEventHandleCallback)callback)(watch, fd, events, (void *)opaque);
+}
+
+void eventTimeoutCallbackInvoke(int timer, uintptr_t callback, uintptr_t opaque)
+{
+ ((virEventTimeoutCallback)callback)(timer, (void *)opaque);
+}
+
+
+void eventHandleCallbackFree(uintptr_t callback, uintptr_t opaque)
+{
+ ((virFreeCallback)callback)((void *)opaque);
+}
+
+void eventTimeoutCallbackFree(uintptr_t callback, uintptr_t opaque)
+{
+ ((virFreeCallback)callback)((void *)opaque);
+}
+
+
+int
+virEventAddHandleWrapper(int fd,
+ int events,
+ int callbackID,
+ virErrorPtr err)
+{
+ int ret = virEventAddHandle(fd, events, eventAddHandleHelper, (void *)(intptr_t)callbackID, NULL);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virEventAddTimeoutWrapper(int timeout,
+ int callbackID,
+ virErrorPtr err)
+{
+ int ret = virEventAddTimeout(timeout, eventAddTimeoutHelper, (void *)(intptr_t)callbackID, NULL);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virEventRegisterDefaultImplWrapper(virErrorPtr err)
+{
+ int ret = virEventRegisterDefaultImpl();
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virEventRemoveHandleWrapper(int watch,
+ virErrorPtr err)
+{
+ int ret = virEventRemoveHandle(watch);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virEventRemoveTimeoutWrapper(int timer,
+ virErrorPtr err)
+{
+ int ret = virEventRemoveTimeout(timer);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virEventRunDefaultImplWrapper(virErrorPtr err)
+{
+ int ret = virEventRunDefaultImpl();
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/events_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/events_wrapper.h
new file mode 100644
index 00000000..62ea9c8a
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/events_wrapper.h
@@ -0,0 +1,82 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_EVENTS_WRAPPER_H__
+#define LIBVIRT_GO_EVENTS_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+
+void
+virEventRegisterImplWrapper(void);
+
+void
+eventHandleCallbackInvoke(int watch,
+ int fd,
+ int events,
+ uintptr_t callback,
+ uintptr_t opaque);
+
+void
+eventTimeoutCallbackInvoke(int timer,
+ uintptr_t callback,
+ uintptr_t opaque);
+
+void
+eventHandleCallbackFree(uintptr_t callback,
+ uintptr_t opaque);
+
+void
+eventTimeoutCallbackFree(uintptr_t callback,
+ uintptr_t opaque);
+
+int
+virEventAddHandleWrapper(int fd,
+ int events,
+ int callbackID,
+ virErrorPtr err);
+
+int
+virEventAddTimeoutWrapper(int timeout,
+ int callbackID,
+ virErrorPtr err);
+
+int
+virEventRegisterDefaultImplWrapper(virErrorPtr err);
+
+int
+virEventRemoveHandleWrapper(int watch,
+ virErrorPtr err);
+
+int
+virEventRemoveTimeoutWrapper(int timer,
+ virErrorPtr err);
+
+int
+virEventRunDefaultImplWrapper(virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_EVENTS_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/interface.go b/src/dma/vendor/github.com/libvirt/libvirt-go/interface.go
new file mode 100644
index 00000000..9b6ebb2b
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/interface.go
@@ -0,0 +1,145 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "interface_wrapper.h"
+*/
+import "C"
+
+import (
+ "unsafe"
+)
+
+type InterfaceXMLFlags int
+
+const (
+ INTERFACE_XML_INACTIVE = InterfaceXMLFlags(C.VIR_INTERFACE_XML_INACTIVE)
+)
+
+type Interface struct {
+ ptr C.virInterfacePtr
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceCreate
+func (n *Interface) Create(flags uint32) error {
+ var err C.virError
+ result := C.virInterfaceCreateWrapper(n.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceDestroy
+func (n *Interface) Destroy(flags uint32) error {
+ var err C.virError
+ result := C.virInterfaceDestroyWrapper(n.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceIsActive
+func (n *Interface) IsActive() (bool, error) {
+ var err C.virError
+ result := C.virInterfaceIsActiveWrapper(n.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceGetMACString
+func (n *Interface) GetMACString() (string, error) {
+ var err C.virError
+ result := C.virInterfaceGetMACStringWrapper(n.ptr, &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ mac := C.GoString(result)
+ return mac, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceGetName
+func (n *Interface) GetName() (string, error) {
+ var err C.virError
+ result := C.virInterfaceGetNameWrapper(n.ptr, &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ name := C.GoString(result)
+ return name, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceGetXMLDesc
+func (n *Interface) GetXMLDesc(flags InterfaceXMLFlags) (string, error) {
+ var err C.virError
+ result := C.virInterfaceGetXMLDescWrapper(n.ptr, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ xml := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return xml, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceUndefine
+func (n *Interface) Undefine() error {
+ var err C.virError
+ result := C.virInterfaceUndefineWrapper(n.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceFree
+func (n *Interface) Free() error {
+ var err C.virError
+ ret := C.virInterfaceFreeWrapper(n.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceRef
+func (c *Interface) Ref() error {
+ var err C.virError
+ ret := C.virInterfaceRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/interface_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/interface_wrapper.go
new file mode 100644
index 00000000..a33aea9e
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/interface_wrapper.go
@@ -0,0 +1,158 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "interface_wrapper.h"
+
+
+int
+virInterfaceCreateWrapper(virInterfacePtr iface,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virInterfaceCreate(iface, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virInterfaceDestroyWrapper(virInterfacePtr iface,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virInterfaceDestroy(iface, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virInterfaceFreeWrapper(virInterfacePtr iface,
+ virErrorPtr err)
+{
+ int ret = virInterfaceFree(iface);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virConnectPtr
+virInterfaceGetConnectWrapper(virInterfacePtr iface,
+ virErrorPtr err)
+{
+ virConnectPtr ret = virInterfaceGetConnect(iface);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virInterfaceGetMACStringWrapper(virInterfacePtr iface,
+ virErrorPtr err)
+{
+ const char * ret = virInterfaceGetMACString(iface);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virInterfaceGetNameWrapper(virInterfacePtr iface,
+ virErrorPtr err)
+{
+ const char * ret = virInterfaceGetName(iface);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virInterfaceGetXMLDescWrapper(virInterfacePtr iface,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virInterfaceGetXMLDesc(iface, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virInterfaceIsActiveWrapper(virInterfacePtr iface,
+ virErrorPtr err)
+{
+ int ret = virInterfaceIsActive(iface);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virInterfaceRefWrapper(virInterfacePtr iface,
+ virErrorPtr err)
+{
+ int ret = virInterfaceRef(iface);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virInterfaceUndefineWrapper(virInterfacePtr iface,
+ virErrorPtr err)
+{
+ int ret = virInterfaceUndefine(iface);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/interface_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/interface_wrapper.h
new file mode 100644
index 00000000..b7cef761
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/interface_wrapper.h
@@ -0,0 +1,76 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_INTERFACE_WRAPPER_H__
+#define LIBVIRT_GO_INTERFACE_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+
+int
+virInterfaceCreateWrapper(virInterfacePtr iface,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virInterfaceDestroyWrapper(virInterfacePtr iface,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virInterfaceFreeWrapper(virInterfacePtr iface,
+ virErrorPtr err);
+
+virConnectPtr
+virInterfaceGetConnectWrapper(virInterfacePtr iface,
+ virErrorPtr err);
+
+const char *
+virInterfaceGetMACStringWrapper(virInterfacePtr iface,
+ virErrorPtr err);
+
+const char *
+virInterfaceGetNameWrapper(virInterfacePtr iface,
+ virErrorPtr err);
+
+char *
+virInterfaceGetXMLDescWrapper(virInterfacePtr iface,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virInterfaceIsActiveWrapper(virInterfacePtr iface,
+ virErrorPtr err);
+
+int
+virInterfaceRefWrapper(virInterfacePtr iface,
+ virErrorPtr err);
+
+int
+virInterfaceUndefineWrapper(virInterfacePtr iface,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_INTERFACE_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/libvirtd.conf b/src/dma/vendor/github.com/libvirt/libvirt-go/libvirtd.conf
new file mode 100644
index 00000000..1c31a241
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/libvirtd.conf
@@ -0,0 +1,6 @@
+listen_tls = 0
+listen_tcp = 1
+tcp_port = "16509"
+listen_addr = "127.0.0.1"
+auth_unix_rw = "none"
+auth_tcp = "sasl"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/libvirtd.sasl b/src/dma/vendor/github.com/libvirt/libvirt-go/libvirtd.sasl
new file mode 100644
index 00000000..9275a70d
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/libvirtd.sasl
@@ -0,0 +1,2 @@
+mech_list: digest-md5
+sasldb_path: /etc/libvirt/passwd.db
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/lxc.go b/src/dma/vendor/github.com/libvirt/libvirt-go/lxc.go
new file mode 100644
index 00000000..1578cab9
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/lxc.go
@@ -0,0 +1,155 @@
+// +build !without_lxc
+
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+// Can't rely on pkg-config for libvirt-lxc since it was not
+// installed until 2.6.0 onwards
+#cgo LDFLAGS: -lvirt-lxc
+#include <stdlib.h>
+#include <string.h>
+#include "lxc_wrapper.h"
+*/
+import "C"
+
+import (
+ "os"
+ "unsafe"
+)
+
+func (d *Domain) LxcOpenNamespace(flags uint32) ([]os.File, error) {
+ var cfdlist *C.int
+
+ var err C.virError
+ ret := C.virDomainLxcOpenNamespaceWrapper(d.ptr, &cfdlist, C.uint(flags), &err)
+ if ret == -1 {
+ return []os.File{}, makeError(&err)
+ }
+ fdlist := make([]os.File, ret)
+ for i := 0; i < int(ret); i++ {
+ var cfd C.int
+ cfd = *(*C.int)(unsafe.Pointer(uintptr(unsafe.Pointer(cfdlist)) + (unsafe.Sizeof(cfd) * uintptr(i))))
+ fdlist[i] = *os.NewFile(uintptr(cfd), "namespace")
+ }
+ defer C.free(unsafe.Pointer(cfdlist))
+ return fdlist, nil
+}
+
+func (d *Domain) LxcEnterNamespace(fdlist []os.File, flags uint32) ([]os.File, error) {
+ var coldfdlist *C.int
+ var ncoldfdlist C.uint
+ cfdlist := make([]C.int, len(fdlist))
+ for i := 0; i < len(fdlist); i++ {
+ cfdlist[i] = C.int(fdlist[i].Fd())
+ }
+
+ var err C.virError
+ ret := C.virDomainLxcEnterNamespaceWrapper(d.ptr, C.uint(len(fdlist)), &cfdlist[0], &ncoldfdlist, &coldfdlist, C.uint(flags), &err)
+ if ret == -1 {
+ return []os.File{}, makeError(&err)
+ }
+ oldfdlist := make([]os.File, ncoldfdlist)
+ for i := 0; i < int(ncoldfdlist); i++ {
+ var cfd C.int
+ cfd = *(*C.int)(unsafe.Pointer(uintptr(unsafe.Pointer(coldfdlist)) + (unsafe.Sizeof(cfd) * uintptr(i))))
+ oldfdlist[i] = *os.NewFile(uintptr(cfd), "namespace")
+ }
+ defer C.free(unsafe.Pointer(coldfdlist))
+ return oldfdlist, nil
+}
+
+func DomainLxcEnterSecurityLabel(model *NodeSecurityModel, label *SecurityLabel, flags uint32) (*SecurityLabel, error) {
+ var cmodel C.virSecurityModel
+ var clabel C.virSecurityLabel
+ var coldlabel C.virSecurityLabel
+
+ cmodelstrlen := len(model.Model)
+ if cmodelstrlen > (C.VIR_SECURITY_MODEL_BUFLEN - 1) {
+ cmodelstrlen = C.VIR_SECURITY_MODEL_BUFLEN - 1
+ }
+ cmodelstr := C.CString(model.Model)
+ defer C.free(unsafe.Pointer(cmodelstr))
+
+ cdoistrlen := len(model.Doi)
+ if cdoistrlen >= (C.VIR_SECURITY_DOI_BUFLEN - 1) {
+ cdoistrlen = C.VIR_SECURITY_DOI_BUFLEN - 1
+ }
+ cdoistr := C.CString(model.Doi)
+ defer C.free(unsafe.Pointer(cdoistr))
+
+ C.memcpy(unsafe.Pointer(&cmodel.model), unsafe.Pointer(cmodelstr), C.size_t(cmodelstrlen))
+ C.memcpy(unsafe.Pointer(&cmodel.doi), unsafe.Pointer(cdoistr), C.size_t(cdoistrlen))
+
+ clabelstrlen := len(label.Label)
+ if clabelstrlen > (C.VIR_SECURITY_LABEL_BUFLEN - 1) {
+ clabelstrlen = C.VIR_SECURITY_LABEL_BUFLEN - 1
+ }
+ clabelstr := C.CString(label.Label)
+ defer C.free(unsafe.Pointer(clabelstr))
+
+ C.memcpy(unsafe.Pointer(&clabel.label), unsafe.Pointer(clabelstr), C.size_t(clabelstrlen))
+ if label.Enforcing {
+ clabel.enforcing = 1
+ } else {
+ clabel.enforcing = 0
+ }
+
+ var err C.virError
+ ret := C.virDomainLxcEnterSecurityLabelWrapper(&cmodel, &clabel, &coldlabel, C.uint(flags), &err)
+ if ret == -1 {
+ return nil, makeError(&err)
+ }
+
+ var oldlabel SecurityLabel
+
+ oldlabel.Label = C.GoString((*C.char)(unsafe.Pointer(&coldlabel.label)))
+ if coldlabel.enforcing != 0 {
+ oldlabel.Enforcing = true
+ } else {
+ oldlabel.Enforcing = false
+ }
+
+ return &oldlabel, nil
+}
+
+func (d *Domain) DomainLxcEnterCGroup(flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 2000000 {
+ return makeNotImplementedError("virDomainLxcEnterCGroup")
+ }
+
+ var err C.virError
+ ret := C.virDomainLxcEnterCGroupWrapper(d.ptr, C.uint(flags), &err)
+
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/lxc_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/lxc_wrapper.go
new file mode 100644
index 00000000..fa3d9103
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/lxc_wrapper.go
@@ -0,0 +1,101 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+// Can't rely on pkg-config for libvirt-lxc since it was not
+// installed until 2.6.0 onwards
+#cgo LDFLAGS: -lvirt-lxc
+#include <assert.h>
+#include "lxc_wrapper.h"
+
+int
+virDomainLxcEnterCGroupWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 2000000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virDomainLxcEnterCGroup(domain, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virDomainLxcEnterNamespaceWrapper(virDomainPtr domain,
+ unsigned int nfdlist,
+ int *fdlist,
+ unsigned int *noldfdlist,
+ int **oldfdlist,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainLxcEnterNamespace(domain, nfdlist, fdlist, noldfdlist, oldfdlist, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainLxcEnterSecurityLabelWrapper(virSecurityModelPtr model,
+ virSecurityLabelPtr label,
+ virSecurityLabelPtr oldlabel,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainLxcEnterSecurityLabel(model, label, oldlabel, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainLxcOpenNamespaceWrapper(virDomainPtr domain,
+ int **fdlist,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainLxcOpenNamespace(domain, fdlist, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/lxc_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/lxc_wrapper.h
new file mode 100644
index 00000000..b3afd6e5
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/lxc_wrapper.h
@@ -0,0 +1,63 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_LXC_COMPAT_H__
+#define LIBVIRT_GO_LXC_COMPAT_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/libvirt-lxc.h>
+#include <libvirt/virterror.h>
+
+
+int
+virDomainLxcEnterCGroupWrapper(virDomainPtr domain,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainLxcEnterNamespaceWrapper(virDomainPtr domain,
+ unsigned int nfdlist,
+ int *fdlist,
+ unsigned int *noldfdlist,
+ int **oldfdlist,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainLxcEnterSecurityLabelWrapper(virSecurityModelPtr model,
+ virSecurityLabelPtr label,
+ virSecurityLabelPtr oldlabel,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainLxcOpenNamespaceWrapper(virDomainPtr domain,
+ int **fdlist,
+ unsigned int flags,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_LXC_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/network.go b/src/dma/vendor/github.com/libvirt/libvirt-go/network.go
new file mode 100644
index 00000000..99954aa5
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/network.go
@@ -0,0 +1,335 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "network_wrapper.h"
+*/
+import "C"
+
+import (
+ "reflect"
+ "time"
+ "unsafe"
+)
+
+type IPAddrType int
+
+const (
+ IP_ADDR_TYPE_IPV4 = IPAddrType(C.VIR_IP_ADDR_TYPE_IPV4)
+ IP_ADDR_TYPE_IPV6 = IPAddrType(C.VIR_IP_ADDR_TYPE_IPV6)
+)
+
+type NetworkXMLFlags int
+
+const (
+ NETWORK_XML_INACTIVE = NetworkXMLFlags(C.VIR_NETWORK_XML_INACTIVE)
+)
+
+type NetworkUpdateCommand int
+
+const (
+ NETWORK_UPDATE_COMMAND_NONE = NetworkUpdateCommand(C.VIR_NETWORK_UPDATE_COMMAND_NONE)
+ NETWORK_UPDATE_COMMAND_MODIFY = NetworkUpdateCommand(C.VIR_NETWORK_UPDATE_COMMAND_MODIFY)
+ NETWORK_UPDATE_COMMAND_DELETE = NetworkUpdateCommand(C.VIR_NETWORK_UPDATE_COMMAND_DELETE)
+ NETWORK_UPDATE_COMMAND_ADD_LAST = NetworkUpdateCommand(C.VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)
+ NETWORK_UPDATE_COMMAND_ADD_FIRST = NetworkUpdateCommand(C.VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST)
+)
+
+type NetworkUpdateSection int
+
+const (
+ NETWORK_SECTION_NONE = NetworkUpdateSection(C.VIR_NETWORK_SECTION_NONE)
+ NETWORK_SECTION_BRIDGE = NetworkUpdateSection(C.VIR_NETWORK_SECTION_BRIDGE)
+ NETWORK_SECTION_DOMAIN = NetworkUpdateSection(C.VIR_NETWORK_SECTION_DOMAIN)
+ NETWORK_SECTION_IP = NetworkUpdateSection(C.VIR_NETWORK_SECTION_IP)
+ NETWORK_SECTION_IP_DHCP_HOST = NetworkUpdateSection(C.VIR_NETWORK_SECTION_IP_DHCP_HOST)
+ NETWORK_SECTION_IP_DHCP_RANGE = NetworkUpdateSection(C.VIR_NETWORK_SECTION_IP_DHCP_RANGE)
+ NETWORK_SECTION_FORWARD = NetworkUpdateSection(C.VIR_NETWORK_SECTION_FORWARD)
+ NETWORK_SECTION_FORWARD_INTERFACE = NetworkUpdateSection(C.VIR_NETWORK_SECTION_FORWARD_INTERFACE)
+ NETWORK_SECTION_FORWARD_PF = NetworkUpdateSection(C.VIR_NETWORK_SECTION_FORWARD_PF)
+ NETWORK_SECTION_PORTGROUP = NetworkUpdateSection(C.VIR_NETWORK_SECTION_PORTGROUP)
+ NETWORK_SECTION_DNS_HOST = NetworkUpdateSection(C.VIR_NETWORK_SECTION_DNS_HOST)
+ NETWORK_SECTION_DNS_TXT = NetworkUpdateSection(C.VIR_NETWORK_SECTION_DNS_TXT)
+ NETWORK_SECTION_DNS_SRV = NetworkUpdateSection(C.VIR_NETWORK_SECTION_DNS_SRV)
+)
+
+type NetworkUpdateFlags int
+
+const (
+ NETWORK_UPDATE_AFFECT_CURRENT = NetworkUpdateFlags(C.VIR_NETWORK_UPDATE_AFFECT_CURRENT)
+ NETWORK_UPDATE_AFFECT_LIVE = NetworkUpdateFlags(C.VIR_NETWORK_UPDATE_AFFECT_LIVE)
+ NETWORK_UPDATE_AFFECT_CONFIG = NetworkUpdateFlags(C.VIR_NETWORK_UPDATE_AFFECT_CONFIG)
+)
+
+type NetworkEventLifecycleType int
+
+const (
+ NETWORK_EVENT_DEFINED = NetworkEventLifecycleType(C.VIR_NETWORK_EVENT_DEFINED)
+ NETWORK_EVENT_UNDEFINED = NetworkEventLifecycleType(C.VIR_NETWORK_EVENT_UNDEFINED)
+ NETWORK_EVENT_STARTED = NetworkEventLifecycleType(C.VIR_NETWORK_EVENT_STARTED)
+ NETWORK_EVENT_STOPPED = NetworkEventLifecycleType(C.VIR_NETWORK_EVENT_STOPPED)
+)
+
+type NetworkEventID int
+
+const (
+ NETWORK_EVENT_ID_LIFECYCLE = NetworkEventID(C.VIR_NETWORK_EVENT_ID_LIFECYCLE)
+)
+
+type Network struct {
+ ptr C.virNetworkPtr
+}
+
+type NetworkDHCPLease struct {
+ Iface string
+ ExpiryTime time.Time
+ Type IPAddrType
+ Mac string
+ Iaid string
+ IPaddr string
+ Prefix uint
+ Hostname string
+ Clientid string
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkFree
+func (n *Network) Free() error {
+ var err C.virError
+ ret := C.virNetworkFreeWrapper(n.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkRef
+func (c *Network) Ref() error {
+ var err C.virError
+ ret := C.virNetworkRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkCreate
+func (n *Network) Create() error {
+ var err C.virError
+ result := C.virNetworkCreateWrapper(n.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkDestroy
+func (n *Network) Destroy() error {
+ var err C.virError
+ result := C.virNetworkDestroyWrapper(n.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkIsActive
+func (n *Network) IsActive() (bool, error) {
+ var err C.virError
+ result := C.virNetworkIsActiveWrapper(n.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkIsPersistent
+func (n *Network) IsPersistent() (bool, error) {
+ var err C.virError
+ result := C.virNetworkIsPersistentWrapper(n.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetAutostart
+func (n *Network) GetAutostart() (bool, error) {
+ var out C.int
+ var err C.virError
+ result := C.virNetworkGetAutostartWrapper(n.ptr, (*C.int)(unsafe.Pointer(&out)), &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ switch out {
+ case 1:
+ return true, nil
+ default:
+ return false, nil
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkSetAutostart
+func (n *Network) SetAutostart(autostart bool) error {
+ var cAutostart C.int
+ switch autostart {
+ case true:
+ cAutostart = 1
+ default:
+ cAutostart = 0
+ }
+ var err C.virError
+ result := C.virNetworkSetAutostartWrapper(n.ptr, cAutostart, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetName
+func (n *Network) GetName() (string, error) {
+ var err C.virError
+ name := C.virNetworkGetNameWrapper(n.ptr, &err)
+ if name == nil {
+ return "", makeError(&err)
+ }
+ return C.GoString(name), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetUUID
+func (n *Network) GetUUID() ([]byte, error) {
+ var cUuid [C.VIR_UUID_BUFLEN](byte)
+ cuidPtr := unsafe.Pointer(&cUuid)
+ var err C.virError
+ result := C.virNetworkGetUUIDWrapper(n.ptr, (*C.uchar)(cuidPtr), &err)
+ if result != 0 {
+ return []byte{}, makeError(&err)
+ }
+ return C.GoBytes(cuidPtr, C.VIR_UUID_BUFLEN), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetUUIDString
+func (n *Network) GetUUIDString() (string, error) {
+ var cUuid [C.VIR_UUID_STRING_BUFLEN](C.char)
+ cuidPtr := unsafe.Pointer(&cUuid)
+ var err C.virError
+ result := C.virNetworkGetUUIDStringWrapper(n.ptr, (*C.char)(cuidPtr), &err)
+ if result != 0 {
+ return "", makeError(&err)
+ }
+ return C.GoString((*C.char)(cuidPtr)), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetBridgeName
+func (n *Network) GetBridgeName() (string, error) {
+ var err C.virError
+ result := C.virNetworkGetBridgeNameWrapper(n.ptr, &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ bridge := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return bridge, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetXMLDesc
+func (n *Network) GetXMLDesc(flags NetworkXMLFlags) (string, error) {
+ var err C.virError
+ result := C.virNetworkGetXMLDescWrapper(n.ptr, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ xml := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return xml, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkUndefine
+func (n *Network) Undefine() error {
+ var err C.virError
+ result := C.virNetworkUndefineWrapper(n.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkUpdate
+func (n *Network) Update(cmd NetworkUpdateCommand, section NetworkUpdateSection, parentIndex int, xml string, flags NetworkUpdateFlags) error {
+ cxml := C.CString(xml)
+ defer C.free(unsafe.Pointer(cxml))
+ var err C.virError
+ result := C.virNetworkUpdateWrapper(n.ptr, C.uint(cmd), C.uint(section), C.int(parentIndex), cxml, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkGetDHCPLeases
+func (n *Network) GetDHCPLeases() ([]NetworkDHCPLease, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002006 {
+ return []NetworkDHCPLease{}, makeNotImplementedError("virNetworkGetDHCPLeases")
+ }
+ var cLeases *C.virNetworkDHCPLeasePtr
+ var err C.virError
+ numLeases := C.virNetworkGetDHCPLeasesWrapper(n.ptr, nil, (**C.virNetworkDHCPLeasePtr)(&cLeases), C.uint(0), &err)
+ if numLeases == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cLeases)),
+ Len: int(numLeases),
+ Cap: int(numLeases),
+ }
+ var leases []NetworkDHCPLease
+ slice := *(*[]C.virNetworkDHCPLeasePtr)(unsafe.Pointer(&hdr))
+ for _, clease := range slice {
+ leases = append(leases, NetworkDHCPLease{
+ Iface: C.GoString(clease.iface),
+ ExpiryTime: time.Unix(int64(clease.expirytime), 0),
+ Type: IPAddrType(clease._type),
+ Mac: C.GoString(clease.mac),
+ Iaid: C.GoString(clease.iaid),
+ IPaddr: C.GoString(clease.ipaddr),
+ Prefix: uint(clease.prefix),
+ Hostname: C.GoString(clease.hostname),
+ Clientid: C.GoString(clease.clientid),
+ })
+ C.virNetworkDHCPLeaseFreeWrapper(clease)
+ }
+ C.free(unsafe.Pointer(cLeases))
+ return leases, nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/network_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/network_compat.h
new file mode 100644
index 00000000..08f0778a
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/network_compat.h
@@ -0,0 +1,86 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_NETWORK_COMPAT_H__
+#define LIBVIRT_GO_NETWORK_COMPAT_H__
+
+/* 1.2.1 */
+
+#ifndef VIR_NETWORK_EVENT_DEFINED
+#define VIR_NETWORK_EVENT_DEFINED 0
+#endif
+
+#ifndef VIR_NETWORK_EVENT_UNDEFINED
+#define VIR_NETWORK_EVENT_UNDEFINED 1
+#endif
+
+#ifndef VIR_NETWORK_EVENT_STARTED
+#define VIR_NETWORK_EVENT_STARTED 2
+#endif
+
+#ifndef VIR_NETWORK_EVENT_STOPPED
+#define VIR_NETWORK_EVENT_STOPPED 3
+#endif
+
+#ifndef VIR_NETWORK_EVENT_ID_LIFECYCLE
+#define VIR_NETWORK_EVENT_ID_LIFECYCLE 0
+#endif
+
+
+#if LIBVIR_VERSION_NUMBER < 1002001
+typedef void (*virConnectNetworkEventGenericCallback)(virConnectPtr conn,
+ virNetworkPtr net,
+ void *opaque);
+#endif
+
+
+/* 1.2.5 */
+
+#ifndef VIR_IP_ADDR_TYPE_IPV4
+#define VIR_IP_ADDR_TYPE_IPV4 0
+#endif
+
+#ifndef VIR_IP_ADDR_TYPE_IPV6
+#define VIR_IP_ADDR_TYPE_IPV6 1
+#endif
+
+#if LIBVIR_VERSION_NUMBER < 1002006
+typedef struct _virNetworkDHCPLease virNetworkDHCPLease;
+typedef virNetworkDHCPLease *virNetworkDHCPLeasePtr;
+struct _virNetworkDHCPLease {
+ char *iface; /* Network interface name */
+ long long expirytime; /* Seconds since epoch */
+ int type; /* virIPAddrType */
+ char *mac; /* MAC address */
+ char *iaid; /* IAID */
+ char *ipaddr; /* IP address */
+ unsigned int prefix; /* IP address prefix */
+ char *hostname; /* Hostname */
+ char *clientid; /* Client ID or DUID */
+};
+#endif
+
+#endif /* LIBVIRT_GO_NETWORK_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/network_events.go b/src/dma/vendor/github.com/libvirt/libvirt-go/network_events.go
new file mode 100644
index 00000000..2d9bddc3
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/network_events.go
@@ -0,0 +1,125 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+/*
+#cgo pkg-config: libvirt
+#include "network_events_wrapper.h"
+*/
+import "C"
+
+type NetworkEventLifecycle struct {
+ Event NetworkEventLifecycleType
+ // TODO: we can make Detail typesafe somehow ?
+ Detail int
+}
+
+type NetworkEventLifecycleCallback func(c *Connect, n *Network, event *NetworkEventLifecycle)
+
+//export networkEventLifecycleCallback
+func networkEventLifecycleCallback(c C.virConnectPtr, n C.virNetworkPtr,
+ event int, detail int,
+ goCallbackId int) {
+
+ network := &Network{ptr: n}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &NetworkEventLifecycle{
+ Event: NetworkEventLifecycleType(event),
+ Detail: detail,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(NetworkEventLifecycleCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, network, eventDetails)
+}
+
+func (c *Connect) NetworkEventLifecycleRegister(net *Network, callback NetworkEventLifecycleCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+ if C.LIBVIR_VERSION_NUMBER < 1002001 {
+ return 0, makeNotImplementedError("virConnectNetworkEventRegisterAny")
+ }
+
+ callbackPtr := unsafe.Pointer(C.networkEventLifecycleCallbackHelper)
+ var cnet C.virNetworkPtr
+ if net != nil {
+ cnet = net.ptr
+ }
+ var err C.virError
+ ret := C.virConnectNetworkEventRegisterAnyWrapper(c.ptr, cnet,
+ C.VIR_NETWORK_EVENT_ID_LIFECYCLE,
+ C.virConnectNetworkEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) NetworkEventDeregister(callbackId int) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002001 {
+ return makeNotImplementedError("virConnectNetworkEventDeregisterAny")
+ }
+ // Deregister the callback
+ var err C.virError
+ ret := int(C.virConnectNetworkEventDeregisterAnyWrapper(c.ptr, C.int(callbackId), &err))
+ if ret < 0 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+func (e NetworkEventLifecycle) String() string {
+ var event string
+ switch e.Event {
+ case NETWORK_EVENT_DEFINED:
+ event = "defined"
+
+ case NETWORK_EVENT_UNDEFINED:
+ event = "undefined"
+
+ case NETWORK_EVENT_STARTED:
+ event = "started"
+
+ case NETWORK_EVENT_STOPPED:
+ event = "stopped"
+
+ default:
+ event = "unknown"
+ }
+
+ return fmt.Sprintf("Network event=%q", event)
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/network_events_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/network_events_wrapper.go
new file mode 100644
index 00000000..4e424baa
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/network_events_wrapper.go
@@ -0,0 +1,79 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include <stdint.h>
+#include "network_events_wrapper.h"
+#include "callbacks_wrapper.h"
+
+extern void networkEventLifecycleCallback(virConnectPtr, virNetworkPtr, int, int, int);
+void networkEventLifecycleCallbackHelper(virConnectPtr c, virNetworkPtr d,
+ int event, int detail, void *data)
+{
+ networkEventLifecycleCallback(c, d, event, detail, (int)(intptr_t)data);
+}
+
+int
+virConnectNetworkEventRegisterAnyWrapper(virConnectPtr c,
+ virNetworkPtr d,
+ int eventID,
+ virConnectNetworkEventGenericCallback cb,
+ long goCallbackId,
+ virErrorPtr err)
+{
+ void* id = (void*)goCallbackId;
+#if LIBVIR_VERSION_NUMBER < 1002001
+ assert(0); // Caller should have checked version
+#else
+ int ret = virConnectNetworkEventRegisterAny(c, d, eventID, cb, id, freeGoCallbackHelper);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+int virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002001
+ assert(0); // Caller should have checked version
+#else
+ int ret = virConnectNetworkEventDeregisterAny(conn, callbackID);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/network_events_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/network_events_wrapper.h
new file mode 100644
index 00000000..789837a1
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/network_events_wrapper.h
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_NETWORK_EVENTS_WRAPPER_H__
+#define LIBVIRT_GO_NETWORK_EVENTS_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "network_compat.h"
+
+void
+networkEventLifecycleCallbackHelper(virConnectPtr c,
+ virNetworkPtr d,
+ int event,
+ int detail,
+ void* data);
+
+int
+virConnectNetworkEventRegisterAnyWrapper(virConnectPtr c,
+ virNetworkPtr d,
+ int eventID,
+ virConnectNetworkEventGenericCallback cb,
+ long goCallbackId,
+ virErrorPtr err);
+
+int
+virConnectNetworkEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_NETWORK_EVENTS_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/network_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/network_wrapper.go
new file mode 100644
index 00000000..2fc443f2
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/network_wrapper.go
@@ -0,0 +1,267 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "network_wrapper.h"
+
+int
+virNetworkCreateWrapper(virNetworkPtr network,
+ virErrorPtr err)
+{
+ int ret = virNetworkCreate(network);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+void
+virNetworkDHCPLeaseFreeWrapper(virNetworkDHCPLeasePtr lease)
+{
+#if LIBVIR_VERSION_NUMBER < 1002006
+ assert(0); // Caller should have checked version
+#else
+ virNetworkDHCPLeaseFree(lease);
+#endif
+}
+
+
+int
+virNetworkDestroyWrapper(virNetworkPtr network,
+ virErrorPtr err)
+{
+ int ret = virNetworkDestroy(network);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkFreeWrapper(virNetworkPtr network,
+ virErrorPtr err)
+{
+ int ret = virNetworkFree(network);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkGetAutostartWrapper(virNetworkPtr network,
+ int *autostart,
+ virErrorPtr err)
+{
+ int ret = virNetworkGetAutostart(network, autostart);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virNetworkGetBridgeNameWrapper(virNetworkPtr network,
+ virErrorPtr err)
+{
+ char * ret = virNetworkGetBridgeName(network);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virConnectPtr
+virNetworkGetConnectWrapper(virNetworkPtr net,
+ virErrorPtr err)
+{
+ virConnectPtr ret = virNetworkGetConnect(net);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkGetDHCPLeasesWrapper(virNetworkPtr network,
+ const char *mac,
+ virNetworkDHCPLeasePtr **leases,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002006
+ assert(0); // Caller should have checked version
+#else
+ int ret = virNetworkGetDHCPLeases(network, mac, leases, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+const char *
+virNetworkGetNameWrapper(virNetworkPtr network,
+ virErrorPtr err)
+{
+ const char * ret = virNetworkGetName(network);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkGetUUIDWrapper(virNetworkPtr network,
+ unsigned char *uuid,
+ virErrorPtr err)
+{
+ int ret = virNetworkGetUUID(network, uuid);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkGetUUIDStringWrapper(virNetworkPtr network,
+ char *buf,
+ virErrorPtr err)
+{
+ int ret = virNetworkGetUUIDString(network, buf);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virNetworkGetXMLDescWrapper(virNetworkPtr network,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virNetworkGetXMLDesc(network, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkIsActiveWrapper(virNetworkPtr net,
+ virErrorPtr err)
+{
+ int ret = virNetworkIsActive(net);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkIsPersistentWrapper(virNetworkPtr net,
+ virErrorPtr err)
+{
+ int ret = virNetworkIsPersistent(net);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkRefWrapper(virNetworkPtr network,
+ virErrorPtr err)
+{
+ int ret = virNetworkRef(network);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkSetAutostartWrapper(virNetworkPtr network,
+ int autostart,
+ virErrorPtr err)
+{
+ int ret = virNetworkSetAutostart(network, autostart);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkUndefineWrapper(virNetworkPtr network,
+ virErrorPtr err)
+{
+ int ret = virNetworkUndefine(network);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNetworkUpdateWrapper(virNetworkPtr network,
+ unsigned int command,
+ unsigned int section,
+ int parentIndex,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virNetworkUpdate(network, command, section, parentIndex, xml, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/network_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/network_wrapper.h
new file mode 100644
index 00000000..405bf89a
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/network_wrapper.h
@@ -0,0 +1,119 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_NETWORK_WRAPPER_H__
+#define LIBVIRT_GO_NETWORK_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "network_compat.h"
+
+int
+virNetworkCreateWrapper(virNetworkPtr network,
+ virErrorPtr err);
+
+void
+virNetworkDHCPLeaseFreeWrapper(virNetworkDHCPLeasePtr lease);
+
+int
+virNetworkDestroyWrapper(virNetworkPtr network,
+ virErrorPtr err);
+
+int
+virNetworkFreeWrapper(virNetworkPtr network,
+ virErrorPtr err);
+
+int
+virNetworkGetAutostartWrapper(virNetworkPtr network,
+ int *autostart,
+ virErrorPtr err);
+
+char *
+virNetworkGetBridgeNameWrapper(virNetworkPtr network,
+ virErrorPtr err);
+
+virConnectPtr
+virNetworkGetConnectWrapper(virNetworkPtr net,
+ virErrorPtr err);
+
+int
+virNetworkGetDHCPLeasesWrapper(virNetworkPtr network,
+ const char *mac,
+ virNetworkDHCPLeasePtr **leases,
+ unsigned int flags,
+ virErrorPtr err);
+
+const char *
+virNetworkGetNameWrapper(virNetworkPtr network,
+ virErrorPtr err);
+
+int
+virNetworkGetUUIDWrapper(virNetworkPtr network,
+ unsigned char *uuid,
+ virErrorPtr err);
+
+int
+virNetworkGetUUIDStringWrapper(virNetworkPtr network,
+ char *buf,
+ virErrorPtr err);
+
+char *
+virNetworkGetXMLDescWrapper(virNetworkPtr network,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNetworkIsActiveWrapper(virNetworkPtr net,
+ virErrorPtr err);
+
+int
+virNetworkIsPersistentWrapper(virNetworkPtr net,
+ virErrorPtr err);
+
+int
+virNetworkRefWrapper(virNetworkPtr network,
+ virErrorPtr err);
+
+int
+virNetworkSetAutostartWrapper(virNetworkPtr network,
+ int autostart,
+ virErrorPtr err);
+
+int
+virNetworkUndefineWrapper(virNetworkPtr network,
+ virErrorPtr err);
+
+int
+virNetworkUpdateWrapper(virNetworkPtr network,
+ unsigned int command,
+ unsigned int section,
+ int parentIndex,
+ const char *xml,
+ unsigned int flags,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_NETWORK_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/node_device.go b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device.go
new file mode 100644
index 00000000..474f288c
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device.go
@@ -0,0 +1,192 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "node_device_wrapper.h"
+*/
+import "C"
+
+import (
+ "unsafe"
+)
+
+type NodeDeviceEventID int
+
+const (
+ NODE_DEVICE_EVENT_ID_LIFECYCLE = NodeDeviceEventID(C.VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE)
+ NODE_DEVICE_EVENT_ID_UPDATE = NodeDeviceEventID(C.VIR_NODE_DEVICE_EVENT_ID_UPDATE)
+)
+
+type NodeDeviceEventLifecycleType int
+
+const (
+ NODE_DEVICE_EVENT_CREATED = NodeDeviceEventLifecycleType(C.VIR_NODE_DEVICE_EVENT_CREATED)
+ NODE_DEVICE_EVENT_DELETED = NodeDeviceEventLifecycleType(C.VIR_NODE_DEVICE_EVENT_DELETED)
+)
+
+type NodeDevice struct {
+ ptr C.virNodeDevicePtr
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceFree
+func (n *NodeDevice) Free() error {
+ var err C.virError
+ ret := C.virNodeDeviceFreeWrapper(n.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceRef
+func (c *NodeDevice) Ref() error {
+ var err C.virError
+ ret := C.virNodeDeviceRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceDestroy
+func (n *NodeDevice) Destroy() error {
+ var err C.virError
+ result := C.virNodeDeviceDestroyWrapper(n.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceReset
+func (n *NodeDevice) Reset() error {
+ var err C.virError
+ result := C.virNodeDeviceResetWrapper(n.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceDettach
+func (n *NodeDevice) Detach() error {
+ var err C.virError
+ result := C.virNodeDeviceDettachWrapper(n.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceDetachFlags
+func (n *NodeDevice) DetachFlags(driverName string, flags uint32) error {
+ cDriverName := C.CString(driverName)
+ defer C.free(unsafe.Pointer(cDriverName))
+ var err C.virError
+ result := C.virNodeDeviceDetachFlagsWrapper(n.ptr, cDriverName, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceReAttach
+func (n *NodeDevice) ReAttach() error {
+ var err C.virError
+ result := C.virNodeDeviceReAttachWrapper(n.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceGetName
+func (n *NodeDevice) GetName() (string, error) {
+ var err C.virError
+ name := C.virNodeDeviceGetNameWrapper(n.ptr, &err)
+ if name == nil {
+ return "", makeError(&err)
+ }
+ return C.GoString(name), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceGetXMLDesc
+func (n *NodeDevice) GetXMLDesc(flags uint32) (string, error) {
+ var err C.virError
+ result := C.virNodeDeviceGetXMLDescWrapper(n.ptr, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ xml := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return xml, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceGetParent
+func (n *NodeDevice) GetParent() (string, error) {
+ var err C.virError
+ result := C.virNodeDeviceGetParentWrapper(n.ptr, &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ defer C.free(unsafe.Pointer(result))
+ return C.GoString(result), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceNumOfCaps
+func (p *NodeDevice) NumOfCaps() (int, error) {
+ var err C.virError
+ result := int(C.virNodeDeviceNumOfCapsWrapper(p.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nodedev.html#virNodeDeviceListCaps
+func (p *NodeDevice) ListCaps() ([]string, error) {
+ const maxCaps = 1024
+ var names [maxCaps](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numCaps := C.virNodeDeviceListCapsWrapper(
+ p.ptr,
+ (**C.char)(namesPtr),
+ maxCaps, &err)
+ if numCaps == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numCaps)
+ for k := 0; k < int(numCaps); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_compat.h
new file mode 100644
index 00000000..32020397
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_compat.h
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_NODE_DEVICE_COMPAT_H__
+#define LIBVIRT_GO_NODE_DEVICE_COMPAT_H__
+
+/* 2.2.0 */
+
+#ifndef VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE
+#define VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE 0
+#endif
+
+#ifndef VIR_NODE_DEVICE_EVENT_ID_UPDATE
+#define VIR_NODE_DEVICE_EVENT_ID_UPDATE 1
+#endif
+
+#ifndef VIR_NODE_DEVICE_EVENT_CREATED
+#define VIR_NODE_DEVICE_EVENT_CREATED 0
+#endif
+
+#ifndef VIR_NODE_DEVICE_EVENT_DELETED
+#define VIR_NODE_DEVICE_EVENT_DELETED 1
+#endif
+
+#if LIBVIR_VERSION_NUMBER < 2002000
+typedef void (*virConnectNodeDeviceEventGenericCallback)(virConnectPtr conn,
+ virNodeDevicePtr dev,
+ void *opaque);
+#endif
+
+
+#endif /* LIBVIRT_GO_NODE_DEVICE_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events.go b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events.go
new file mode 100644
index 00000000..7920a424
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events.go
@@ -0,0 +1,156 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+/*
+#cgo pkg-config: libvirt
+#include "node_device_events_wrapper.h"
+*/
+import "C"
+
+type NodeDeviceEventGenericCallback func(c *Connect, d *NodeDevice)
+
+type NodeDeviceEventLifecycle struct {
+ Event NodeDeviceEventLifecycleType
+ // TODO: we can make Detail typesafe somehow ?
+ Detail int
+}
+
+type NodeDeviceEventLifecycleCallback func(c *Connect, n *NodeDevice, event *NodeDeviceEventLifecycle)
+
+//export nodeDeviceEventLifecycleCallback
+func nodeDeviceEventLifecycleCallback(c C.virConnectPtr, s C.virNodeDevicePtr,
+ event int, detail int,
+ goCallbackId int) {
+
+ node_device := &NodeDevice{ptr: s}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &NodeDeviceEventLifecycle{
+ Event: NodeDeviceEventLifecycleType(event),
+ Detail: detail,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(NodeDeviceEventLifecycleCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, node_device, eventDetails)
+}
+
+//export nodeDeviceEventGenericCallback
+func nodeDeviceEventGenericCallback(c C.virConnectPtr, d C.virNodeDevicePtr,
+ goCallbackId int) {
+
+ node_device := &NodeDevice{ptr: d}
+ connection := &Connect{ptr: c}
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(NodeDeviceEventGenericCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, node_device)
+}
+
+func (c *Connect) NodeDeviceEventLifecycleRegister(device *NodeDevice, callback NodeDeviceEventLifecycleCallback) (int, error) {
+ if C.LIBVIR_VERSION_NUMBER < 2002000 {
+ return 0, makeNotImplementedError("virConnectNodeDeviceEventRegisterAny")
+ }
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.nodeDeviceEventLifecycleCallbackHelper)
+ var cdevice C.virNodeDevicePtr
+ if device != nil {
+ cdevice = device.ptr
+ }
+ var err C.virError
+ ret := C.virConnectNodeDeviceEventRegisterAnyWrapper(c.ptr, cdevice,
+ C.VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE,
+ C.virConnectNodeDeviceEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) NodeDeviceEventUpdateRegister(device *NodeDevice, callback NodeDeviceEventGenericCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.nodeDeviceEventGenericCallbackHelper)
+ var cdevice C.virNodeDevicePtr
+ if device != nil {
+ cdevice = device.ptr
+ }
+ var err C.virError
+ ret := C.virConnectNodeDeviceEventRegisterAnyWrapper(c.ptr, cdevice,
+ C.VIR_NODE_DEVICE_EVENT_ID_UPDATE,
+ C.virConnectNodeDeviceEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) NodeDeviceEventDeregister(callbackId int) error {
+ if C.LIBVIR_VERSION_NUMBER < 2002000 {
+ return makeNotImplementedError("virConnectNodeDeviceEventDeregisterAny")
+ }
+ // Deregister the callback
+ var err C.virError
+ ret := int(C.virConnectNodeDeviceEventDeregisterAnyWrapper(c.ptr, C.int(callbackId), &err))
+ if ret < 0 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+func (e NodeDeviceEventLifecycle) String() string {
+ var event string
+ switch e.Event {
+ case NODE_DEVICE_EVENT_CREATED:
+ event = "created"
+
+ case NODE_DEVICE_EVENT_DELETED:
+ event = "deleted"
+
+ default:
+ event = "unknown"
+ }
+
+ return fmt.Sprintf("NodeDevice event=%q", event)
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events_wrapper.go
new file mode 100644
index 00000000..8b2e624e
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events_wrapper.go
@@ -0,0 +1,88 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include <stdint.h>
+#include "node_device_events_wrapper.h"
+#include "callbacks_wrapper.h"
+
+extern void nodeDeviceEventLifecycleCallback(virConnectPtr, virNodeDevicePtr, int, int, int);
+void nodeDeviceEventLifecycleCallbackHelper(virConnectPtr c, virNodeDevicePtr d,
+ int event, int detail, void *data)
+{
+ nodeDeviceEventLifecycleCallback(c, d, event, detail, (int)(intptr_t)data);
+}
+
+extern void nodeDeviceEventGenericCallback(virConnectPtr, virNodeDevicePtr, int);
+void nodeDeviceEventGenericCallbackHelper(virConnectPtr c, virNodeDevicePtr d, void *data)
+{
+ nodeDeviceEventGenericCallback(c, d, (int)(intptr_t)data);
+}
+
+
+int
+virConnectNodeDeviceEventRegisterAnyWrapper(virConnectPtr c,
+ virNodeDevicePtr d,
+ int eventID,
+ virConnectNodeDeviceEventGenericCallback cb,
+ long goCallbackId,
+ virErrorPtr err)
+{
+ void* id = (void*)goCallbackId;
+#if LIBVIR_VERSION_NUMBER < 2002000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virConnectNodeDeviceEventRegisterAny(c, d, eventID, cb, id, freeGoCallbackHelper);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virConnectNodeDeviceEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 2002000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virConnectNodeDeviceEventDeregisterAny(conn, callbackID);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events_wrapper.h
new file mode 100644
index 00000000..fb691d2c
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_events_wrapper.h
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_NODE_DEVICE_EVENTS_WRAPPER_H__
+#define LIBVIRT_GO_NODE_DEVICE_EVENTS_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "node_device_compat.h"
+
+void
+nodeDeviceEventLifecycleCallbackHelper(virConnectPtr c,
+ virNodeDevicePtr d,
+ int event,
+ int detail,
+ void* data);
+
+void
+nodeDeviceEventGenericCallbackHelper(virConnectPtr c,
+ virNodeDevicePtr d,
+ void* data);
+
+int
+virConnectNodeDeviceEventRegisterAnyWrapper(virConnectPtr c,
+ virNodeDevicePtr d,
+ int eventID,
+ virConnectNodeDeviceEventGenericCallback cb,
+ long goCallbackId,
+ virErrorPtr err);
+
+int
+virConnectNodeDeviceEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_NODE_DEVICE_EVENTS_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_wrapper.go
new file mode 100644
index 00000000..c4e173a3
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_wrapper.go
@@ -0,0 +1,184 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "node_device_wrapper.h"
+
+
+int
+virNodeDeviceDestroyWrapper(virNodeDevicePtr dev,
+ virErrorPtr err)
+{
+ int ret = virNodeDeviceDestroy(dev);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeDeviceDetachFlagsWrapper(virNodeDevicePtr dev,
+ const char *driverName,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virNodeDeviceDetachFlags(dev, driverName, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeDeviceDettachWrapper(virNodeDevicePtr dev,
+ virErrorPtr err)
+{
+ int ret = virNodeDeviceDettach(dev);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeDeviceFreeWrapper(virNodeDevicePtr dev,
+ virErrorPtr err)
+{
+ int ret = virNodeDeviceFree(dev);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virNodeDeviceGetNameWrapper(virNodeDevicePtr dev,
+ virErrorPtr err)
+{
+ const char * ret = virNodeDeviceGetName(dev);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virNodeDeviceGetParentWrapper(virNodeDevicePtr dev,
+ virErrorPtr err)
+{
+ const char * ret = virNodeDeviceGetParent(dev);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virNodeDeviceGetXMLDescWrapper(virNodeDevicePtr dev,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virNodeDeviceGetXMLDesc(dev, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeDeviceListCapsWrapper(virNodeDevicePtr dev,
+ char ** const names,
+ int maxnames,
+ virErrorPtr err)
+{
+ int ret = virNodeDeviceListCaps(dev, names, maxnames);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeDeviceNumOfCapsWrapper(virNodeDevicePtr dev,
+ virErrorPtr err)
+{
+ int ret = virNodeDeviceNumOfCaps(dev);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeDeviceReAttachWrapper(virNodeDevicePtr dev,
+ virErrorPtr err)
+{
+ int ret = virNodeDeviceReAttach(dev);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeDeviceRefWrapper(virNodeDevicePtr dev,
+ virErrorPtr err)
+{
+ int ret = virNodeDeviceRef(dev);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNodeDeviceResetWrapper(virNodeDevicePtr dev,
+ virErrorPtr err)
+{
+ int ret = virNodeDeviceReset(dev);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_wrapper.h
new file mode 100644
index 00000000..7670415c
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/node_device_wrapper.h
@@ -0,0 +1,88 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_NODE_DEVICE_WRAPPER_H__
+#define LIBVIRT_GO_NODE_DEVICE_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "node_device_compat.h"
+
+
+int
+virNodeDeviceDestroyWrapper(virNodeDevicePtr dev,
+ virErrorPtr err);
+
+int
+virNodeDeviceDetachFlagsWrapper(virNodeDevicePtr dev,
+ const char *driverName,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeDeviceDettachWrapper(virNodeDevicePtr dev,
+ virErrorPtr err);
+
+int
+virNodeDeviceFreeWrapper(virNodeDevicePtr dev,
+ virErrorPtr err);
+
+const char *
+virNodeDeviceGetNameWrapper(virNodeDevicePtr dev,
+ virErrorPtr err);
+
+const char *
+virNodeDeviceGetParentWrapper(virNodeDevicePtr dev,
+ virErrorPtr err);
+
+char *
+virNodeDeviceGetXMLDescWrapper(virNodeDevicePtr dev,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNodeDeviceListCapsWrapper(virNodeDevicePtr dev,
+ char **const names,
+ int maxnames,
+ virErrorPtr err);
+
+int
+virNodeDeviceNumOfCapsWrapper(virNodeDevicePtr dev,
+ virErrorPtr err);
+
+int
+virNodeDeviceReAttachWrapper(virNodeDevicePtr dev,
+ virErrorPtr err);
+
+int
+virNodeDeviceRefWrapper(virNodeDevicePtr dev,
+ virErrorPtr err);
+
+int
+virNodeDeviceResetWrapper(virNodeDevicePtr dev,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_NODE_DEVICE_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter.go b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter.go
new file mode 100644
index 00000000..0b55c412
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter.go
@@ -0,0 +1,118 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "nwfilter_wrapper.h"
+*/
+import "C"
+
+import (
+ "unsafe"
+)
+
+type NWFilter struct {
+ ptr C.virNWFilterPtr
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterFree
+func (f *NWFilter) Free() error {
+ var err C.virError
+ ret := C.virNWFilterFreeWrapper(f.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterRef
+func (c *NWFilter) Ref() error {
+ var err C.virError
+ ret := C.virNWFilterRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetName
+func (f *NWFilter) GetName() (string, error) {
+ var err C.virError
+ name := C.virNWFilterGetNameWrapper(f.ptr, &err)
+ if name == nil {
+ return "", makeError(&err)
+ }
+ return C.GoString(name), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterUndefine
+func (f *NWFilter) Undefine() error {
+ var err C.virError
+ result := C.virNWFilterUndefineWrapper(f.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetUUID
+func (f *NWFilter) GetUUID() ([]byte, error) {
+ var cUuid [C.VIR_UUID_BUFLEN](byte)
+ cuidPtr := unsafe.Pointer(&cUuid)
+ var err C.virError
+ result := C.virNWFilterGetUUIDWrapper(f.ptr, (*C.uchar)(cuidPtr), &err)
+ if result != 0 {
+ return []byte{}, makeError(&err)
+ }
+ return C.GoBytes(cuidPtr, C.VIR_UUID_BUFLEN), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetUUIDString
+func (f *NWFilter) GetUUIDString() (string, error) {
+ var cUuid [C.VIR_UUID_STRING_BUFLEN](C.char)
+ cuidPtr := unsafe.Pointer(&cUuid)
+ var err C.virError
+ result := C.virNWFilterGetUUIDStringWrapper(f.ptr, (*C.char)(cuidPtr), &err)
+ if result != 0 {
+ return "", makeError(&err)
+ }
+ return C.GoString((*C.char)(cuidPtr)), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterGetXMLDesc
+func (f *NWFilter) GetXMLDesc(flags uint32) (string, error) {
+ var err C.virError
+ result := C.virNWFilterGetXMLDescWrapper(f.ptr, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ xml := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return xml, nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding.go b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding.go
new file mode 100644
index 00000000..e36c1de2
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding.go
@@ -0,0 +1,125 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "nwfilter_binding_wrapper.h"
+*/
+import "C"
+
+import (
+ "unsafe"
+)
+
+type NWFilterBinding struct {
+ ptr C.virNWFilterBindingPtr
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingFree
+func (f *NWFilterBinding) Free() error {
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return makeNotImplementedError("virNWFilterBindingFree")
+ }
+ var err C.virError
+ ret := C.virNWFilterBindingFreeWrapper(f.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingRef
+func (c *NWFilterBinding) Ref() error {
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return makeNotImplementedError("virNWFilterBindingRef")
+ }
+ var err C.virError
+ ret := C.virNWFilterBindingRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingDelete
+func (f *NWFilterBinding) Delete() error {
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return makeNotImplementedError("virNWFilterBindingDelete")
+ }
+ var err C.virError
+ result := C.virNWFilterBindingDeleteWrapper(f.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingGetPortDev
+func (f *NWFilterBinding) GetPortDev() (string, error) {
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return "", makeNotImplementedError("virNWFilterBindingGetPortDev")
+ }
+ var err C.virError
+ result := C.virNWFilterBindingGetPortDevWrapper(f.ptr, &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ name := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return name, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingGetFilterName
+func (f *NWFilterBinding) GetFilterName() (string, error) {
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return "", makeNotImplementedError("virNWFilterBindingGetFilterName")
+ }
+ var err C.virError
+ result := C.virNWFilterBindingGetFilterNameWrapper(f.ptr, &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ name := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return name, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virNWFilterBindingGetXMLDesc
+func (f *NWFilterBinding) GetXMLDesc(flags uint32) (string, error) {
+ if C.LIBVIR_VERSION_NUMBER < 4005000 {
+ return "", makeNotImplementedError("virNWFilterBindingGetXMLDesc")
+ }
+ var err C.virError
+ result := C.virNWFilterBindingGetXMLDescWrapper(f.ptr, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ xml := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return xml, nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_compat.h
new file mode 100644
index 00000000..1d6fd161
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_compat.h
@@ -0,0 +1,33 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_NWFILTER_BINDING_COMPAT_H__
+#define LIBVIRT_GO_NWFILTER_BINDING_COMPAT_H__
+
+#if LIBVIR_VERSION_NUMBER < 4005000
+typedef struct _virNWFilterBinding *virNWFilterBindingPtr;
+#endif
+
+#endif /* LIBVIRT_GO_NWFILTER_BINDING_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_wrapper.go
new file mode 100644
index 00000000..b0950b5d
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_wrapper.go
@@ -0,0 +1,132 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "nwfilter_binding_wrapper.h"
+
+
+int
+virNWFilterBindingDeleteWrapper(virNWFilterBindingPtr binding,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virNWFilterBindingDelete(binding);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virNWFilterBindingFreeWrapper(virNWFilterBindingPtr binding,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virNWFilterBindingFree(binding);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+const char *
+virNWFilterBindingGetFilterNameWrapper(virNWFilterBindingPtr binding,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ const char * ret = virNWFilterBindingGetFilterName(binding);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+const char *
+virNWFilterBindingGetPortDevWrapper(virNWFilterBindingPtr binding,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ const char * ret = virNWFilterBindingGetPortDev(binding);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+char *
+virNWFilterBindingGetXMLDescWrapper(virNWFilterBindingPtr binding,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ char * ret = virNWFilterBindingGetXMLDesc(binding, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virNWFilterBindingRefWrapper(virNWFilterBindingPtr binding,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 4005000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virNWFilterBindingRef(binding);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_wrapper.h
new file mode 100644
index 00000000..0bcbfb70
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_binding_wrapper.h
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_NWFILTER_BINDING_WRAPPER_H__
+#define LIBVIRT_GO_NWFILTER_BINDING_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "nwfilter_binding_compat.h"
+
+
+int
+virNWFilterBindingDeleteWrapper(virNWFilterBindingPtr binding,
+ virErrorPtr err);
+
+int
+virNWFilterBindingFreeWrapper(virNWFilterBindingPtr binding,
+ virErrorPtr err);
+
+const char *
+virNWFilterBindingGetFilterNameWrapper(virNWFilterBindingPtr binding,
+ virErrorPtr err);
+
+const char *
+virNWFilterBindingGetPortDevWrapper(virNWFilterBindingPtr binding,
+ virErrorPtr err);
+
+char *
+virNWFilterBindingGetXMLDescWrapper(virNWFilterBindingPtr binding,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNWFilterBindingRefWrapper(virNWFilterBindingPtr binding,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_NWFILTER_BINDING_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_wrapper.go
new file mode 100644
index 00000000..809e5278
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_wrapper.go
@@ -0,0 +1,122 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "nwfilter_wrapper.h"
+
+
+int
+virNWFilterFreeWrapper(virNWFilterPtr nwfilter,
+ virErrorPtr err)
+{
+ int ret = virNWFilterFree(nwfilter);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virNWFilterGetNameWrapper(virNWFilterPtr nwfilter,
+ virErrorPtr err)
+{
+ const char * ret = virNWFilterGetName(nwfilter);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNWFilterGetUUIDWrapper(virNWFilterPtr nwfilter,
+ unsigned char *uuid,
+ virErrorPtr err)
+{
+ int ret = virNWFilterGetUUID(nwfilter, uuid);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNWFilterGetUUIDStringWrapper(virNWFilterPtr nwfilter,
+ char *buf,
+ virErrorPtr err)
+{
+ int ret = virNWFilterGetUUIDString(nwfilter, buf);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virNWFilterGetXMLDescWrapper(virNWFilterPtr nwfilter,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virNWFilterGetXMLDesc(nwfilter, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNWFilterRefWrapper(virNWFilterPtr nwfilter,
+ virErrorPtr err)
+{
+ int ret = virNWFilterRef(nwfilter);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virNWFilterUndefineWrapper(virNWFilterPtr nwfilter,
+ virErrorPtr err)
+{
+ int ret = virNWFilterUndefine(nwfilter);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_wrapper.h
new file mode 100644
index 00000000..9a0651cc
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/nwfilter_wrapper.h
@@ -0,0 +1,65 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_NWFILTER_WRAPPER_H__
+#define LIBVIRT_GO_NWFILTER_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+
+
+int
+virNWFilterFreeWrapper(virNWFilterPtr nwfilter,
+ virErrorPtr err);
+
+const char *
+virNWFilterGetNameWrapper(virNWFilterPtr nwfilter,
+ virErrorPtr err);
+
+int
+virNWFilterGetUUIDWrapper(virNWFilterPtr nwfilter,
+ unsigned char *uuid,
+ virErrorPtr err);
+
+int
+virNWFilterGetUUIDStringWrapper(virNWFilterPtr nwfilter,
+ char *buf,
+ virErrorPtr err);
+
+char *
+virNWFilterGetXMLDescWrapper(virNWFilterPtr nwfilter,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virNWFilterRefWrapper(virNWFilterPtr nwfilter,
+ virErrorPtr err);
+
+int
+virNWFilterUndefineWrapper(virNWFilterPtr nwfilter,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_NWFILTER_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/qemu.go b/src/dma/vendor/github.com/libvirt/libvirt-go/qemu.go
new file mode 100644
index 00000000..a2f8507f
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/qemu.go
@@ -0,0 +1,189 @@
+// +build !without_qemu
+
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+// Can't rely on pkg-config for libvirt-qemu since it was not
+// installed until 2.6.0 onwards
+#cgo LDFLAGS: -lvirt-qemu
+#include <stdlib.h>
+#include "qemu_wrapper.h"
+*/
+import "C"
+
+import (
+ "unsafe"
+)
+
+/*
+ * QMP has two different kinds of ways to talk to QEMU. One is legacy (HMP,
+ * or 'human' monitor protocol. The default is QMP, which is all-JSON.
+ *
+ * QMP json commands are of the format:
+ * {"execute" : "query-cpus"}
+ *
+ * whereas the same command in 'HMP' would be:
+ * 'info cpus'
+ */
+
+type DomainQemuMonitorCommandFlags int
+
+const (
+ DOMAIN_QEMU_MONITOR_COMMAND_DEFAULT = DomainQemuMonitorCommandFlags(C.VIR_DOMAIN_QEMU_MONITOR_COMMAND_DEFAULT)
+ DOMAIN_QEMU_MONITOR_COMMAND_HMP = DomainQemuMonitorCommandFlags(C.VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP)
+)
+
+type DomainQemuAgentCommandTimeout int
+
+const (
+ DOMAIN_QEMU_AGENT_COMMAND_MIN = DomainQemuAgentCommandTimeout(C.VIR_DOMAIN_QEMU_AGENT_COMMAND_MIN)
+ DOMAIN_QEMU_AGENT_COMMAND_BLOCK = DomainQemuAgentCommandTimeout(C.VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK)
+ DOMAIN_QEMU_AGENT_COMMAND_DEFAULT = DomainQemuAgentCommandTimeout(C.VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT)
+ DOMAIN_QEMU_AGENT_COMMAND_NOWAIT = DomainQemuAgentCommandTimeout(C.VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT)
+ DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN = DomainQemuAgentCommandTimeout(C.VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN)
+)
+
+type DomainQemuMonitorEventFlags int
+
+const (
+ CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX = DomainQemuMonitorEventFlags(C.VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX)
+ CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCASE = DomainQemuMonitorEventFlags(C.VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCASE)
+)
+
+func (d *Domain) QemuMonitorCommand(command string, flags DomainQemuMonitorCommandFlags) (string, error) {
+ var cResult *C.char
+ cCommand := C.CString(command)
+ defer C.free(unsafe.Pointer(cCommand))
+ var err C.virError
+ result := C.virDomainQemuMonitorCommandWrapper(d.ptr, cCommand, &cResult, C.uint(flags), &err)
+
+ if result != 0 {
+ return "", makeError(&err)
+ }
+
+ rstring := C.GoString(cResult)
+ C.free(unsafe.Pointer(cResult))
+ return rstring, nil
+}
+
+func (d *Domain) QemuAgentCommand(command string, timeout DomainQemuAgentCommandTimeout, flags uint32) (string, error) {
+ cCommand := C.CString(command)
+ defer C.free(unsafe.Pointer(cCommand))
+ var err C.virError
+ result := C.virDomainQemuAgentCommandWrapper(d.ptr, cCommand, C.int(timeout), C.uint(flags), &err)
+
+ if result == nil {
+ return "", makeError(&err)
+ }
+
+ rstring := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return rstring, nil
+}
+
+func (c *Connect) DomainQemuAttach(pid uint32, flags uint32) (*Domain, error) {
+ var err C.virError
+ ptr := C.virDomainQemuAttachWrapper(c.ptr, C.uint(pid), C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &Domain{ptr: ptr}, nil
+}
+
+type DomainQemuMonitorEvent struct {
+ Event string
+ Seconds int64
+ Micros uint
+ Details string
+}
+
+type DomainQemuMonitorEventCallback func(c *Connect, d *Domain, event *DomainQemuMonitorEvent)
+
+//export domainQemuMonitorEventCallback
+func domainQemuMonitorEventCallback(c C.virConnectPtr, d C.virDomainPtr,
+ event *C.char, seconds C.longlong, micros C.uint, details *C.char, goCallbackId int) {
+
+ domain := &Domain{ptr: d}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &DomainQemuMonitorEvent{
+ Event: C.GoString(event),
+ Seconds: int64(seconds),
+ Micros: uint(micros),
+ Details: C.GoString(details),
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(DomainQemuMonitorEventCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, domain, eventDetails)
+
+}
+
+func (c *Connect) DomainQemuMonitorEventRegister(dom *Domain, event string, callback DomainQemuMonitorEventCallback, flags DomainQemuMonitorEventFlags) (int, error) {
+ if C.LIBVIR_VERSION_NUMBER < 1002003 {
+ return 0, makeNotImplementedError("virConnectDomainQemuMonitorEventRegister")
+ }
+
+ cEvent := C.CString(event)
+ defer C.free(unsafe.Pointer(cEvent))
+ goCallBackId := registerCallbackId(callback)
+
+ var cdom C.virDomainPtr
+ if dom != nil {
+ cdom = dom.ptr
+ }
+ var err C.virError
+ ret := C.virConnectDomainQemuMonitorEventRegisterWrapper(c.ptr, cdom,
+ cEvent,
+ C.long(goCallBackId),
+ C.uint(flags), &err)
+ if ret < 0 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) DomainQemuEventDeregister(callbackId int) error {
+ if C.LIBVIR_VERSION_NUMBER < 1002003 {
+ return makeNotImplementedError("virConnectDomainQemuMonitorEventDeregister")
+ }
+
+ // Deregister the callback
+ var err C.virError
+ ret := int(C.virConnectDomainQemuMonitorEventDeregisterWrapper(c.ptr, C.int(callbackId), &err))
+ if ret < 0 {
+ return makeError(&err)
+ }
+ return nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/qemu_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/qemu_compat.h
new file mode 100644
index 00000000..7756d7f8
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/qemu_compat.h
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_QEMU_COMPAT_H__
+#define LIBVIRT_GO_QEMU_COMPAT_H__
+
+/* 1.2.3 */
+
+#if LIBVIR_VERSION_NUMBER < 1002003
+typedef void (*virConnectDomainQemuMonitorEventCallback)(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *event,
+ long long seconds,
+ unsigned int micros,
+ const char *details,
+ void *opaque);
+#endif
+
+#ifndef VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX
+#define VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX (1 << 0)
+#endif
+
+#ifndef VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCASE
+#define VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCASE (1 << 1)
+#endif
+
+/* 1.2.15 */
+
+#ifndef VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN
+#define VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN 60
+#endif
+
+
+#endif /* LIBVIRT_GO_QEMU_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/qemu_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/qemu_wrapper.go
new file mode 100644
index 00000000..20089d22
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/qemu_wrapper.go
@@ -0,0 +1,133 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+// Can't rely on pkg-config for libvirt-qemu since it was not
+// installed until 2.6.0 onwards
+#cgo LDFLAGS: -lvirt-qemu
+#include <assert.h>
+#include <stdint.h>
+#include "qemu_wrapper.h"
+#include "callbacks_wrapper.h"
+
+
+extern void domainQemuMonitorEventCallback(virConnectPtr, virDomainPtr, const char *, long long, unsigned int, const char *, int);
+void domainQemuMonitorEventCallbackHelper(virConnectPtr c, virDomainPtr d,
+ const char *event, long long secs,
+ unsigned int micros, const char *details, void *data)
+{
+ domainQemuMonitorEventCallback(c, d, event, secs, micros, details, (int)(intptr_t)data);
+}
+
+
+int
+virConnectDomainQemuMonitorEventDeregisterWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002003
+ assert(0); // Caller should have checked version
+#else
+ int ret = virConnectDomainQemuMonitorEventDeregister(conn, callbackID);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virConnectDomainQemuMonitorEventRegisterWrapper(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *event,
+ long goCallbackId,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 1002003
+ assert(0); // Caller should have checked version
+#else
+ void *id = (void*)goCallbackId;
+ int ret = virConnectDomainQemuMonitorEventRegister(conn, dom, event, domainQemuMonitorEventCallbackHelper,
+ id, freeGoCallbackHelper, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+char *
+virDomainQemuAgentCommandWrapper(virDomainPtr domain,
+ const char *cmd,
+ int timeout,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virDomainQemuAgentCommand(domain, cmd, timeout, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virDomainPtr
+virDomainQemuAttachWrapper(virConnectPtr conn,
+ unsigned int pid_value,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virDomainPtr ret = virDomainQemuAttach(conn, pid_value, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virDomainQemuMonitorCommandWrapper(virDomainPtr domain,
+ const char *cmd,
+ char **result,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virDomainQemuMonitorCommand(domain, cmd, result, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/qemu_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/qemu_wrapper.h
new file mode 100644
index 00000000..df389c4f
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/qemu_wrapper.h
@@ -0,0 +1,78 @@
+ /*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_DOMAIN_EVENTS_WRAPPER_H__
+#define LIBVIRT_GO_DOMAIN_EVENTS_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/libvirt-qemu.h>
+#include <libvirt/virterror.h>
+#include "qemu_compat.h"
+
+void
+domainQemuMonitorEventCallbackHelper(virConnectPtr c,
+ virDomainPtr d,
+ const char *event,
+ long long secs,
+ unsigned int micros,
+ const char *details,
+ void *data);
+
+int
+virConnectDomainQemuMonitorEventDeregisterWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err);
+
+int
+virConnectDomainQemuMonitorEventRegisterWrapper(virConnectPtr conn,
+ virDomainPtr dom,
+ const char *event,
+ long goCallbackId,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virDomainQemuAgentCommandWrapper(virDomainPtr domain,
+ const char *cmd,
+ int timeout,
+ unsigned int flags,
+ virErrorPtr err);
+
+virDomainPtr
+virDomainQemuAttachWrapper(virConnectPtr conn,
+ unsigned int pid_value,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virDomainQemuMonitorCommandWrapper(virDomainPtr domain,
+ const char *cmd,
+ char **result,
+ unsigned int flags,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_DOMAIN_EVENTS_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/secret.go b/src/dma/vendor/github.com/libvirt/libvirt-go/secret.go
new file mode 100644
index 00000000..c4ef44bd
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/secret.go
@@ -0,0 +1,184 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "secret_wrapper.h"
+*/
+import "C"
+
+import (
+ "unsafe"
+)
+
+type SecretUsageType int
+
+const (
+ SECRET_USAGE_TYPE_NONE = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_NONE)
+ SECRET_USAGE_TYPE_VOLUME = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_VOLUME)
+ SECRET_USAGE_TYPE_CEPH = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_CEPH)
+ SECRET_USAGE_TYPE_ISCSI = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_ISCSI)
+ SECRET_USAGE_TYPE_TLS = SecretUsageType(C.VIR_SECRET_USAGE_TYPE_TLS)
+)
+
+type SecretEventLifecycleType int
+
+const (
+ SECRET_EVENT_DEFINED = SecretEventLifecycleType(C.VIR_SECRET_EVENT_DEFINED)
+ SECRET_EVENT_UNDEFINED = SecretEventLifecycleType(C.VIR_SECRET_EVENT_UNDEFINED)
+)
+
+type SecretEventID int
+
+const (
+ SECRET_EVENT_ID_LIFECYCLE = SecretEventID(C.VIR_SECRET_EVENT_ID_LIFECYCLE)
+ SECRET_EVENT_ID_VALUE_CHANGED = SecretEventID(C.VIR_SECRET_EVENT_ID_VALUE_CHANGED)
+)
+
+type Secret struct {
+ ptr C.virSecretPtr
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretFree
+func (s *Secret) Free() error {
+ var err C.virError
+ ret := C.virSecretFreeWrapper(s.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretRef
+func (c *Secret) Ref() error {
+ var err C.virError
+ ret := C.virSecretRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretUndefine
+func (s *Secret) Undefine() error {
+ var err C.virError
+ result := C.virSecretUndefineWrapper(s.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUUID
+func (s *Secret) GetUUID() ([]byte, error) {
+ var cUuid [C.VIR_UUID_BUFLEN](byte)
+ cuidPtr := unsafe.Pointer(&cUuid)
+ var err C.virError
+ result := C.virSecretGetUUIDWrapper(s.ptr, (*C.uchar)(cuidPtr), &err)
+ if result != 0 {
+ return []byte{}, makeError(&err)
+ }
+ return C.GoBytes(cuidPtr, C.VIR_UUID_BUFLEN), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUUIDString
+func (s *Secret) GetUUIDString() (string, error) {
+ var cUuid [C.VIR_UUID_STRING_BUFLEN](C.char)
+ cuidPtr := unsafe.Pointer(&cUuid)
+ var err C.virError
+ result := C.virSecretGetUUIDStringWrapper(s.ptr, (*C.char)(cuidPtr), &err)
+ if result != 0 {
+ return "", makeError(&err)
+ }
+ return C.GoString((*C.char)(cuidPtr)), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUsageID
+func (s *Secret) GetUsageID() (string, error) {
+ var err C.virError
+ result := C.virSecretGetUsageIDWrapper(s.ptr, &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ return C.GoString(result), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetUsageType
+func (s *Secret) GetUsageType() (SecretUsageType, error) {
+ var err C.virError
+ result := SecretUsageType(C.virSecretGetUsageTypeWrapper(s.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetXMLDesc
+func (s *Secret) GetXMLDesc(flags uint32) (string, error) {
+ var err C.virError
+ result := C.virSecretGetXMLDescWrapper(s.ptr, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ xml := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return xml, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretGetValue
+func (s *Secret) GetValue(flags uint32) ([]byte, error) {
+ var cvalue_size C.size_t
+
+ var err C.virError
+ cvalue := C.virSecretGetValueWrapper(s.ptr, &cvalue_size, C.uint(flags), &err)
+ if cvalue == nil {
+ return nil, makeError(&err)
+ }
+ defer C.free(unsafe.Pointer(cvalue))
+ ret := C.GoBytes(unsafe.Pointer(cvalue), C.int(cvalue_size))
+ return ret, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-secret.html#virSecretSetValue
+func (s *Secret) SetValue(value []byte, flags uint32) error {
+ cvalue := make([]C.uchar, len(value))
+
+ for i := 0; i < len(value); i++ {
+ cvalue[i] = C.uchar(value[i])
+ }
+
+ var err C.virError
+ result := C.virSecretSetValueWrapper(s.ptr, &cvalue[0], C.size_t(len(value)), C.uint(flags), &err)
+
+ if result == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/secret_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_compat.h
new file mode 100644
index 00000000..ba38c68d
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_compat.h
@@ -0,0 +1,61 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_SECRET_COMPAT_H__
+#define LIBVIRT_GO_SECRET_COMPAT_H__
+
+/* 3.0.0 */
+
+#ifndef VIR_SECRET_EVENT_DEFINED
+#define VIR_SECRET_EVENT_DEFINED 0
+#endif
+
+#ifndef VIR_SECRET_EVENT_UNDEFINED
+#define VIR_SECRET_EVENT_UNDEFINED 1
+#endif
+
+#ifndef VIR_SECRET_EVENT_ID_LIFECYCLE
+#define VIR_SECRET_EVENT_ID_LIFECYCLE 0
+#endif
+
+#ifndef VIR_SECRET_EVENT_ID_VALUE_CHANGED
+#define VIR_SECRET_EVENT_ID_VALUE_CHANGED 1
+#endif
+
+
+#if LIBVIR_VERSION_NUMBER < 3000000
+typedef void (*virConnectSecretEventGenericCallback)(virConnectPtr conn,
+ virSecretPtr secret,
+ void *opaque);
+#endif
+
+/* 2.2.1 */
+
+#ifndef VIR_SECRET_USAGE_TYPE_TLS
+#define VIR_SECRET_USAGE_TYPE_TLS 4
+#endif
+
+#endif /* LIBVIRT_GO_SECRET_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/secret_events.go b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_events.go
new file mode 100644
index 00000000..d928e985
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_events.go
@@ -0,0 +1,159 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+/*
+#cgo pkg-config: libvirt
+#include "secret_events_wrapper.h"
+*/
+import "C"
+
+type SecretEventLifecycle struct {
+ Event SecretEventLifecycleType
+ // TODO: we can make Detail typesafe somehow ?
+ Detail int
+}
+
+type SecretEventLifecycleCallback func(c *Connect, n *Secret, event *SecretEventLifecycle)
+
+type SecretEventGenericCallback func(c *Connect, n *Secret)
+
+//export secretEventLifecycleCallback
+func secretEventLifecycleCallback(c C.virConnectPtr, n C.virSecretPtr,
+ event int, detail int,
+ goCallbackId int) {
+
+ secret := &Secret{ptr: n}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &SecretEventLifecycle{
+ Event: SecretEventLifecycleType(event),
+ Detail: detail,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(SecretEventLifecycleCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, secret, eventDetails)
+}
+
+//export secretEventGenericCallback
+func secretEventGenericCallback(c C.virConnectPtr, n C.virSecretPtr,
+ goCallbackId int) {
+
+ secret := &Secret{ptr: n}
+ connection := &Connect{ptr: c}
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(SecretEventGenericCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, secret)
+}
+
+func (c *Connect) SecretEventLifecycleRegister(secret *Secret, callback SecretEventLifecycleCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+ if C.LIBVIR_VERSION_NUMBER < 3000000 {
+ return 0, makeNotImplementedError("virConnectSecretEventRegisterAny")
+ }
+
+ callbackPtr := unsafe.Pointer(C.secretEventLifecycleCallbackHelper)
+ var csecret C.virSecretPtr
+ if secret != nil {
+ csecret = secret.ptr
+ }
+ var err C.virError
+ ret := C.virConnectSecretEventRegisterAnyWrapper(c.ptr, csecret,
+ C.VIR_SECRET_EVENT_ID_LIFECYCLE,
+ C.virConnectSecretEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) SecretEventValueChangedRegister(secret *Secret, callback SecretEventGenericCallback) (int, error) {
+ goCallBackId := registerCallbackId(callback)
+ if C.LIBVIR_VERSION_NUMBER < 3000000 {
+ return 0, makeNotImplementedError("virConnectSecretEventRegisterAny")
+ }
+
+ callbackPtr := unsafe.Pointer(C.secretEventGenericCallbackHelper)
+ var csecret C.virSecretPtr
+ if secret != nil {
+ csecret = secret.ptr
+ }
+ var err C.virError
+ ret := C.virConnectSecretEventRegisterAnyWrapper(c.ptr, csecret,
+ C.VIR_SECRET_EVENT_ID_VALUE_CHANGED,
+ C.virConnectSecretEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) SecretEventDeregister(callbackId int) error {
+ if C.LIBVIR_VERSION_NUMBER < 3000000 {
+ return makeNotImplementedError("virConnectSecretEventDeregisterAny")
+ }
+ // Deregister the callback
+ var err C.virError
+ ret := int(C.virConnectSecretEventDeregisterAnyWrapper(c.ptr, C.int(callbackId), &err))
+ if ret < 0 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+func (e SecretEventLifecycle) String() string {
+ var event string
+ switch e.Event {
+ case SECRET_EVENT_DEFINED:
+ event = "defined"
+
+ case SECRET_EVENT_UNDEFINED:
+ event = "undefined"
+
+ default:
+ event = "unknown"
+ }
+
+ return fmt.Sprintf("Secret event=%q", event)
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/secret_events_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_events_wrapper.go
new file mode 100644
index 00000000..a543e7f5
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_events_wrapper.go
@@ -0,0 +1,88 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include <stdint.h>
+#include "secret_events_wrapper.h"
+#include "callbacks_wrapper.h"
+
+extern void secretEventLifecycleCallback(virConnectPtr, virSecretPtr, int, int, int);
+void secretEventLifecycleCallbackHelper(virConnectPtr c, virSecretPtr d,
+ int event, int detail, void *data)
+{
+ secretEventLifecycleCallback(c, d, event, detail, (int)(intptr_t)data);
+}
+
+extern void secretEventGenericCallback(virConnectPtr, virSecretPtr, int);
+void secretEventGenericCallbackHelper(virConnectPtr c, virSecretPtr d,
+ void *data)
+{
+ secretEventGenericCallback(c, d, (int)(intptr_t)data);
+}
+
+
+int
+virConnectSecretEventRegisterAnyWrapper(virConnectPtr c,
+ virSecretPtr d,
+ int eventID,
+ virConnectSecretEventGenericCallback cb,
+ long goCallbackId,
+ virErrorPtr err)
+{
+ void* id = (void*)goCallbackId;
+#if LIBVIR_VERSION_NUMBER < 3000000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virConnectSecretEventRegisterAny(c, d, eventID, cb, id, freeGoCallbackHelper);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+int virConnectSecretEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3000000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virConnectSecretEventDeregisterAny(conn, callbackID);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/secret_events_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_events_wrapper.h
new file mode 100644
index 00000000..5101bc0b
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_events_wrapper.h
@@ -0,0 +1,58 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_SECRET_EVENTS_WRAPPER_H__
+#define LIBVIRT_GO_SECRET_EVENTS_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "secret_compat.h"
+
+void
+secretEventLifecycleCallbackHelper(virConnectPtr c,
+ virSecretPtr d,
+ int event,
+ int detail,
+ void* data);
+
+void secretEventGenericCallbackHelper(virConnectPtr c,
+ virSecretPtr d,
+ void* data);
+
+int
+virConnectSecretEventRegisterAnyWrapper(virConnectPtr c,
+ virSecretPtr d,
+ int eventID,
+ virConnectSecretEventGenericCallback cb,
+ long goCallbackId,
+ virErrorPtr err);
+
+int
+virConnectSecretEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err);
+
+#endif /* LIBVIRT_GO_SECRET_EVENTS_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/secret_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_wrapper.go
new file mode 100644
index 00000000..96f60f6f
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_wrapper.go
@@ -0,0 +1,175 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "secret_wrapper.h"
+
+
+int
+virSecretFreeWrapper(virSecretPtr secret,
+ virErrorPtr err)
+{
+ int ret = virSecretFree(secret);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virConnectPtr
+virSecretGetConnectWrapper(virSecretPtr secret,
+ virErrorPtr err)
+{
+ virConnectPtr ret = virSecretGetConnect(secret);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virSecretGetUUIDWrapper(virSecretPtr secret,
+ unsigned char *uuid,
+ virErrorPtr err)
+{
+ int ret = virSecretGetUUID(secret, uuid);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virSecretGetUUIDStringWrapper(virSecretPtr secret,
+ char *buf,
+ virErrorPtr err)
+{
+ int ret = virSecretGetUUIDString(secret, buf);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virSecretGetUsageIDWrapper(virSecretPtr secret,
+ virErrorPtr err)
+{
+ const char * ret = virSecretGetUsageID(secret);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virSecretGetUsageTypeWrapper(virSecretPtr secret,
+ virErrorPtr err)
+{
+ int ret = virSecretGetUsageType(secret);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+unsigned char *
+virSecretGetValueWrapper(virSecretPtr secret,
+ size_t *value_size,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ unsigned char * ret = virSecretGetValue(secret, value_size, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virSecretGetXMLDescWrapper(virSecretPtr secret,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virSecretGetXMLDesc(secret, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virSecretRefWrapper(virSecretPtr secret,
+ virErrorPtr err)
+{
+ int ret = virSecretRef(secret);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virSecretSetValueWrapper(virSecretPtr secret,
+ const unsigned char *value,
+ size_t value_size,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virSecretSetValue(secret, value, value_size, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virSecretUndefineWrapper(virSecretPtr secret,
+ virErrorPtr err)
+{
+ int ret = virSecretUndefine(secret);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/secret_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_wrapper.h
new file mode 100644
index 00000000..eca6f0a4
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/secret_wrapper.h
@@ -0,0 +1,86 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_SECRET_WRAPPER_H__
+#define LIBVIRT_GO_SECRET_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "secret_compat.h"
+
+int
+virSecretFreeWrapper(virSecretPtr secret,
+ virErrorPtr err);
+
+virConnectPtr
+virSecretGetConnectWrapper(virSecretPtr secret,
+ virErrorPtr err);
+
+int
+virSecretGetUUIDWrapper(virSecretPtr secret,
+ unsigned char *uuid,
+ virErrorPtr err);
+
+int
+virSecretGetUUIDStringWrapper(virSecretPtr secret,
+ char *buf,
+ virErrorPtr err);
+
+const char *
+virSecretGetUsageIDWrapper(virSecretPtr secret,
+ virErrorPtr err);
+
+int
+virSecretGetUsageTypeWrapper(virSecretPtr secret,
+ virErrorPtr err);
+
+unsigned char *
+virSecretGetValueWrapper(virSecretPtr secret,
+ size_t *value_size,
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virSecretGetXMLDescWrapper(virSecretPtr secret,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virSecretRefWrapper(virSecretPtr secret,
+ virErrorPtr err);
+
+int
+virSecretSetValueWrapper(virSecretPtr secret,
+ const unsigned char *value,
+ size_t value_size,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virSecretUndefineWrapper(virSecretPtr secret,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_SECRET_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool.go b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool.go
new file mode 100644
index 00000000..9bfcc79a
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool.go
@@ -0,0 +1,394 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "storage_pool_wrapper.h"
+*/
+import "C"
+
+import (
+ "reflect"
+ "unsafe"
+)
+
+type StoragePoolState int
+
+const (
+ STORAGE_POOL_INACTIVE = StoragePoolState(C.VIR_STORAGE_POOL_INACTIVE) // Not running
+ STORAGE_POOL_BUILDING = StoragePoolState(C.VIR_STORAGE_POOL_BUILDING) // Initializing pool,not available
+ STORAGE_POOL_RUNNING = StoragePoolState(C.VIR_STORAGE_POOL_RUNNING) // Running normally
+ STORAGE_POOL_DEGRADED = StoragePoolState(C.VIR_STORAGE_POOL_DEGRADED) // Running degraded
+ STORAGE_POOL_INACCESSIBLE = StoragePoolState(C.VIR_STORAGE_POOL_INACCESSIBLE) // Running,but not accessible
+)
+
+type StoragePoolBuildFlags int
+
+const (
+ STORAGE_POOL_BUILD_NEW = StoragePoolBuildFlags(C.VIR_STORAGE_POOL_BUILD_NEW) // Regular build from scratch
+ STORAGE_POOL_BUILD_REPAIR = StoragePoolBuildFlags(C.VIR_STORAGE_POOL_BUILD_REPAIR) // Repair / reinitialize
+ STORAGE_POOL_BUILD_RESIZE = StoragePoolBuildFlags(C.VIR_STORAGE_POOL_BUILD_RESIZE) // Extend existing pool
+ STORAGE_POOL_BUILD_NO_OVERWRITE = StoragePoolBuildFlags(C.VIR_STORAGE_POOL_BUILD_NO_OVERWRITE) // Do not overwrite existing pool
+ STORAGE_POOL_BUILD_OVERWRITE = StoragePoolBuildFlags(C.VIR_STORAGE_POOL_BUILD_OVERWRITE) // Overwrite data
+)
+
+type StoragePoolCreateFlags int
+
+const (
+ STORAGE_POOL_CREATE_NORMAL = StoragePoolCreateFlags(C.VIR_STORAGE_POOL_CREATE_NORMAL)
+ STORAGE_POOL_CREATE_WITH_BUILD = StoragePoolCreateFlags(C.VIR_STORAGE_POOL_CREATE_WITH_BUILD)
+ STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE = StoragePoolCreateFlags(C.VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE)
+ STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE = StoragePoolCreateFlags(C.VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE)
+)
+
+type StoragePoolDeleteFlags int
+
+const (
+ STORAGE_POOL_DELETE_NORMAL = StoragePoolDeleteFlags(C.VIR_STORAGE_POOL_DELETE_NORMAL)
+ STORAGE_POOL_DELETE_ZEROED = StoragePoolDeleteFlags(C.VIR_STORAGE_POOL_DELETE_ZEROED)
+)
+
+type StoragePoolEventID int
+
+const (
+ STORAGE_POOL_EVENT_ID_LIFECYCLE = StoragePoolEventID(C.VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE)
+ STORAGE_POOL_EVENT_ID_REFRESH = StoragePoolEventID(C.VIR_STORAGE_POOL_EVENT_ID_REFRESH)
+)
+
+type StoragePoolEventLifecycleType int
+
+const (
+ STORAGE_POOL_EVENT_DEFINED = StoragePoolEventLifecycleType(C.VIR_STORAGE_POOL_EVENT_DEFINED)
+ STORAGE_POOL_EVENT_UNDEFINED = StoragePoolEventLifecycleType(C.VIR_STORAGE_POOL_EVENT_UNDEFINED)
+ STORAGE_POOL_EVENT_STARTED = StoragePoolEventLifecycleType(C.VIR_STORAGE_POOL_EVENT_STARTED)
+ STORAGE_POOL_EVENT_STOPPED = StoragePoolEventLifecycleType(C.VIR_STORAGE_POOL_EVENT_STOPPED)
+ STORAGE_POOL_EVENT_CREATED = StoragePoolEventLifecycleType(C.VIR_STORAGE_POOL_EVENT_CREATED)
+ STORAGE_POOL_EVENT_DELETED = StoragePoolEventLifecycleType(C.VIR_STORAGE_POOL_EVENT_DELETED)
+)
+
+type StoragePool struct {
+ ptr C.virStoragePoolPtr
+}
+
+type StoragePoolInfo struct {
+ State StoragePoolState
+ Capacity uint64
+ Allocation uint64
+ Available uint64
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolBuild
+func (p *StoragePool) Build(flags StoragePoolBuildFlags) error {
+ var err C.virError
+ result := C.virStoragePoolBuildWrapper(p.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolCreate
+func (p *StoragePool) Create(flags StoragePoolCreateFlags) error {
+ var err C.virError
+ result := C.virStoragePoolCreateWrapper(p.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolDelete
+func (p *StoragePool) Delete(flags StoragePoolDeleteFlags) error {
+ var err C.virError
+ result := C.virStoragePoolDeleteWrapper(p.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolDestroy
+func (p *StoragePool) Destroy() error {
+ var err C.virError
+ result := C.virStoragePoolDestroyWrapper(p.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolFree
+func (p *StoragePool) Free() error {
+ var err C.virError
+ ret := C.virStoragePoolFreeWrapper(p.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolRef
+func (c *StoragePool) Ref() error {
+ var err C.virError
+ ret := C.virStoragePoolRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetAutostart
+func (p *StoragePool) GetAutostart() (bool, error) {
+ var out C.int
+ var err C.virError
+ result := C.virStoragePoolGetAutostartWrapper(p.ptr, (*C.int)(unsafe.Pointer(&out)), &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ switch out {
+ case 1:
+ return true, nil
+ default:
+ return false, nil
+ }
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetInfo
+func (p *StoragePool) GetInfo() (*StoragePoolInfo, error) {
+ var cinfo C.virStoragePoolInfo
+ var err C.virError
+ result := C.virStoragePoolGetInfoWrapper(p.ptr, &cinfo, &err)
+ if result == -1 {
+ return nil, makeError(&err)
+ }
+ return &StoragePoolInfo{
+ State: StoragePoolState(cinfo.state),
+ Capacity: uint64(cinfo.capacity),
+ Allocation: uint64(cinfo.allocation),
+ Available: uint64(cinfo.available),
+ }, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetName
+func (p *StoragePool) GetName() (string, error) {
+ var err C.virError
+ name := C.virStoragePoolGetNameWrapper(p.ptr, &err)
+ if name == nil {
+ return "", makeError(&err)
+ }
+ return C.GoString(name), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetUUID
+func (p *StoragePool) GetUUID() ([]byte, error) {
+ var cUuid [C.VIR_UUID_BUFLEN](byte)
+ cuidPtr := unsafe.Pointer(&cUuid)
+ var err C.virError
+ result := C.virStoragePoolGetUUIDWrapper(p.ptr, (*C.uchar)(cuidPtr), &err)
+ if result != 0 {
+ return []byte{}, makeError(&err)
+ }
+ return C.GoBytes(cuidPtr, C.VIR_UUID_BUFLEN), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetUUIDString
+func (p *StoragePool) GetUUIDString() (string, error) {
+ var cUuid [C.VIR_UUID_STRING_BUFLEN](C.char)
+ cuidPtr := unsafe.Pointer(&cUuid)
+ var err C.virError
+ result := C.virStoragePoolGetUUIDStringWrapper(p.ptr, (*C.char)(cuidPtr), &err)
+ if result != 0 {
+ return "", makeError(&err)
+ }
+ return C.GoString((*C.char)(cuidPtr)), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolGetXMLDesc
+func (p *StoragePool) GetXMLDesc(flags StorageXMLFlags) (string, error) {
+ var err C.virError
+ result := C.virStoragePoolGetXMLDescWrapper(p.ptr, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ xml := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return xml, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolIsActive
+func (p *StoragePool) IsActive() (bool, error) {
+ var err C.virError
+ result := C.virStoragePoolIsActiveWrapper(p.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolIsPersistent
+func (p *StoragePool) IsPersistent() (bool, error) {
+ var err C.virError
+ result := C.virStoragePoolIsPersistentWrapper(p.ptr, &err)
+ if result == -1 {
+ return false, makeError(&err)
+ }
+ if result == 1 {
+ return true, nil
+ }
+ return false, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolSetAutostart
+func (p *StoragePool) SetAutostart(autostart bool) error {
+ var cAutostart C.int
+ switch autostart {
+ case true:
+ cAutostart = 1
+ default:
+ cAutostart = 0
+ }
+ var err C.virError
+ result := C.virStoragePoolSetAutostartWrapper(p.ptr, cAutostart, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolRefresh
+func (p *StoragePool) Refresh(flags uint32) error {
+ var err C.virError
+ result := C.virStoragePoolRefreshWrapper(p.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolUndefine
+func (p *StoragePool) Undefine() error {
+ var err C.virError
+ result := C.virStoragePoolUndefineWrapper(p.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolCreateXML
+func (p *StoragePool) StorageVolCreateXML(xmlConfig string, flags StorageVolCreateFlags) (*StorageVol, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virStorageVolCreateXMLWrapper(p.ptr, cXml, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StorageVol{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolCreateXMLFrom
+func (p *StoragePool) StorageVolCreateXMLFrom(xmlConfig string, clonevol *StorageVol, flags StorageVolCreateFlags) (*StorageVol, error) {
+ cXml := C.CString(string(xmlConfig))
+ defer C.free(unsafe.Pointer(cXml))
+ var err C.virError
+ ptr := C.virStorageVolCreateXMLFromWrapper(p.ptr, cXml, clonevol.ptr, C.uint(flags), &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StorageVol{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolLookupByName
+func (p *StoragePool) LookupStorageVolByName(name string) (*StorageVol, error) {
+ cName := C.CString(name)
+ defer C.free(unsafe.Pointer(cName))
+ var err C.virError
+ ptr := C.virStorageVolLookupByNameWrapper(p.ptr, cName, &err)
+ if ptr == nil {
+ return nil, makeError(&err)
+ }
+ return &StorageVol{ptr: ptr}, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolNumOfVolumes
+func (p *StoragePool) NumOfStorageVolumes() (int, error) {
+ var err C.virError
+ result := int(C.virStoragePoolNumOfVolumesWrapper(p.ptr, &err))
+ if result == -1 {
+ return 0, makeError(&err)
+ }
+ return result, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolListVolumes
+func (p *StoragePool) ListStorageVolumes() ([]string, error) {
+ const maxVols = 1024
+ var names [maxVols](*C.char)
+ namesPtr := unsafe.Pointer(&names)
+ var err C.virError
+ numStorageVols := C.virStoragePoolListVolumesWrapper(
+ p.ptr,
+ (**C.char)(namesPtr),
+ maxVols, &err)
+ if numStorageVols == -1 {
+ return nil, makeError(&err)
+ }
+ goNames := make([]string, numStorageVols)
+ for k := 0; k < int(numStorageVols); k++ {
+ goNames[k] = C.GoString(names[k])
+ C.free(unsafe.Pointer(names[k]))
+ }
+ return goNames, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolListAllVolumes
+func (p *StoragePool) ListAllStorageVolumes(flags uint32) ([]StorageVol, error) {
+ var cList *C.virStorageVolPtr
+ var err C.virError
+ numVols := C.virStoragePoolListAllVolumesWrapper(p.ptr, (**C.virStorageVolPtr)(&cList), C.uint(flags), &err)
+ if numVols == -1 {
+ return nil, makeError(&err)
+ }
+ hdr := reflect.SliceHeader{
+ Data: uintptr(unsafe.Pointer(cList)),
+ Len: int(numVols),
+ Cap: int(numVols),
+ }
+ var pools []StorageVol
+ slice := *(*[]C.virStorageVolPtr)(unsafe.Pointer(&hdr))
+ for _, ptr := range slice {
+ pools = append(pools, StorageVol{ptr})
+ }
+ C.free(unsafe.Pointer(cList))
+ return pools, nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_compat.h
new file mode 100644
index 00000000..4df1a0d7
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_compat.h
@@ -0,0 +1,92 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_STORAGE_POOL_COMPAT_H__
+#define LIBVIRT_GO_STORAGE_POOL_COMPAT_H__
+
+/* 1.3.1 */
+
+#ifndef VIR_STORAGE_POOL_CREATE_NORMAL
+#define VIR_STORAGE_POOL_CREATE_NORMAL 0
+#endif
+
+#ifndef VIR_STORAGE_POOL_CREATE_WITH_BUILD
+#define VIR_STORAGE_POOL_CREATE_WITH_BUILD 1 << 0
+#endif
+
+#ifndef VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE
+#define VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE 1 << 1
+#endif
+
+#ifndef VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE
+#define VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE 1 << 2
+#endif
+
+
+/* 2.0.0 */
+
+#ifndef VIVIR_STORAGE_POOL_EVENT_DEFINED
+#define VIR_STORAGE_POOL_EVENT_DEFINED 0
+#endif
+
+#ifndef VIR_STORAGE_POOL_EVENT_UNDEFINED
+#define VIR_STORAGE_POOL_EVENT_UNDEFINED 1
+#endif
+
+#ifndef VIR_STORAGE_POOL_EVENT_STARTED
+#define VIR_STORAGE_POOL_EVENT_STARTED 2
+#endif
+
+#ifndef VIR_STORAGE_POOL_EVENT_STOPPED
+#define VIR_STORAGE_POOL_EVENT_STOPPED 3
+#endif
+
+#ifndef VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE
+#define VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE 0
+#endif
+
+#ifndef VIR_STORAGE_POOL_EVENT_ID_REFRESH
+#define VIR_STORAGE_POOL_EVENT_ID_REFRESH 1
+#endif
+
+#if LIBVIR_VERSION_NUMBER < 2000000
+typedef void (*virConnectStoragePoolEventGenericCallback)(virConnectPtr conn,
+ virStoragePoolPtr pool,
+ void *opaque);
+#endif
+
+/* 3.8.0 */
+
+#ifndef VIR_STORAGE_POOL_EVENT_CREATED
+#define VIR_STORAGE_POOL_EVENT_CREATED 4
+#endif
+
+#ifndef VIR_STORAGE_POOL_EVENT_DELETED
+#define VIR_STORAGE_POOL_EVENT_DELETED 5
+#endif
+
+
+#endif /* LIBVIRT_GO_STORAGE_POOL_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events.go b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events.go
new file mode 100644
index 00000000..fd1b9979
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events.go
@@ -0,0 +1,174 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+/*
+#cgo pkg-config: libvirt
+#include "storage_pool_events_wrapper.h"
+*/
+import "C"
+
+type StoragePoolEventLifecycle struct {
+ Event StoragePoolEventLifecycleType
+ // TODO: we can make Detail typesafe somehow ?
+ Detail int
+}
+
+type StoragePoolEventLifecycleCallback func(c *Connect, n *StoragePool, event *StoragePoolEventLifecycle)
+
+type StoragePoolEventGenericCallback func(c *Connect, n *StoragePool)
+
+//export storagePoolEventLifecycleCallback
+func storagePoolEventLifecycleCallback(c C.virConnectPtr, s C.virStoragePoolPtr,
+ event int, detail int,
+ goCallbackId int) {
+
+ storage_pool := &StoragePool{ptr: s}
+ connection := &Connect{ptr: c}
+
+ eventDetails := &StoragePoolEventLifecycle{
+ Event: StoragePoolEventLifecycleType(event),
+ Detail: detail,
+ }
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(StoragePoolEventLifecycleCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, storage_pool, eventDetails)
+}
+
+//export storagePoolEventGenericCallback
+func storagePoolEventGenericCallback(c C.virConnectPtr, s C.virStoragePoolPtr,
+ goCallbackId int) {
+
+ storage_pool := &StoragePool{ptr: s}
+ connection := &Connect{ptr: c}
+
+ callbackFunc := getCallbackId(goCallbackId)
+ callback, ok := callbackFunc.(StoragePoolEventGenericCallback)
+ if !ok {
+ panic("Inappropriate callback type called")
+ }
+ callback(connection, storage_pool)
+}
+
+func (c *Connect) StoragePoolEventLifecycleRegister(pool *StoragePool, callback StoragePoolEventLifecycleCallback) (int, error) {
+ if C.LIBVIR_VERSION_NUMBER < 2000000 {
+ return 0, makeNotImplementedError("virConnectStoragePoolEventRegisterAny")
+ }
+
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.storagePoolEventLifecycleCallbackHelper)
+ var cpool C.virStoragePoolPtr
+ if pool != nil {
+ cpool = pool.ptr
+ }
+ var err C.virError
+ ret := C.virConnectStoragePoolEventRegisterAnyWrapper(c.ptr, cpool,
+ C.VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE,
+ C.virConnectStoragePoolEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) StoragePoolEventRefreshRegister(pool *StoragePool, callback StoragePoolEventGenericCallback) (int, error) {
+ if C.LIBVIR_VERSION_NUMBER < 2000000 {
+ return 0, makeNotImplementedError("virConnectStoragePoolEventRegisterAny")
+ }
+
+ goCallBackId := registerCallbackId(callback)
+
+ callbackPtr := unsafe.Pointer(C.storagePoolEventGenericCallbackHelper)
+ var cpool C.virStoragePoolPtr
+ if pool != nil {
+ cpool = pool.ptr
+ }
+ var err C.virError
+ ret := C.virConnectStoragePoolEventRegisterAnyWrapper(c.ptr, cpool,
+ C.VIR_STORAGE_POOL_EVENT_ID_REFRESH,
+ C.virConnectStoragePoolEventGenericCallback(callbackPtr),
+ C.long(goCallBackId), &err)
+ if ret == -1 {
+ freeCallbackId(goCallBackId)
+ return 0, makeError(&err)
+ }
+ return int(ret), nil
+}
+
+func (c *Connect) StoragePoolEventDeregister(callbackId int) error {
+ if C.LIBVIR_VERSION_NUMBER < 2000000 {
+ return makeNotImplementedError("virConnectStoragePoolEventDeregisterAny")
+ }
+
+ // Deregister the callback
+ var err C.virError
+ ret := int(C.virConnectStoragePoolEventDeregisterAnyWrapper(c.ptr, C.int(callbackId), &err))
+ if ret < 0 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+func (e StoragePoolEventLifecycle) String() string {
+ var event string
+ switch e.Event {
+ case STORAGE_POOL_EVENT_DEFINED:
+ event = "defined"
+
+ case STORAGE_POOL_EVENT_UNDEFINED:
+ event = "undefined"
+
+ case STORAGE_POOL_EVENT_STARTED:
+ event = "started"
+
+ case STORAGE_POOL_EVENT_STOPPED:
+ event = "stopped"
+
+ case STORAGE_POOL_EVENT_CREATED:
+ event = "created"
+
+ case STORAGE_POOL_EVENT_DELETED:
+ event = "deleted"
+
+ default:
+ event = "unknown"
+ }
+
+ return fmt.Sprintf("StoragePool event=%q", event)
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events_wrapper.go
new file mode 100644
index 00000000..c5510381
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events_wrapper.go
@@ -0,0 +1,89 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "storage_pool_events_wrapper.h"
+#include "callbacks_wrapper.h"
+#include <stdint.h>
+
+extern void storagePoolEventLifecycleCallback(virConnectPtr, virStoragePoolPtr, int, int, int);
+void storagePoolEventLifecycleCallbackHelper(virConnectPtr c, virStoragePoolPtr d,
+ int event, int detail, void *data)
+{
+ storagePoolEventLifecycleCallback(c, d, event, detail, (int)(intptr_t)data);
+}
+
+extern void storagePoolEventGenericCallback(virConnectPtr, virStoragePoolPtr, int);
+void storagePoolEventGenericCallbackHelper(virConnectPtr c, virStoragePoolPtr d,
+ void *data)
+{
+ storagePoolEventGenericCallback(c, d, (int)(intptr_t)data);
+}
+
+
+int
+virConnectStoragePoolEventRegisterAnyWrapper(virConnectPtr c,
+ virStoragePoolPtr d,
+ int eventID,
+ virConnectStoragePoolEventGenericCallback cb,
+ long goCallbackId,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 2000000
+ assert(0); // Caller should have checked version
+#else
+ void* id = (void*)goCallbackId;
+ int ret = virConnectStoragePoolEventRegisterAny(c, d, eventID, cb, id, freeGoCallbackHelper);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virConnectStoragePoolEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 2000000
+ assert(0); // Caller shouuld have checked version
+#else
+ int ret = virConnectStoragePoolEventDeregisterAny(conn, callbackID);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events_wrapper.h
new file mode 100644
index 00000000..7007f1c0
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_events_wrapper.h
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_STORAGE_POOL_EVENTS_WRAPPER_H__
+#define LIBVIRT_GO_STORAGE_POOL_EVENTS_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "storage_pool_compat.h"
+
+void
+storagePoolEventLifecycleCallbackHelper(virConnectPtr c,
+ virStoragePoolPtr d,
+ int event,
+ int detail,
+ void* data);
+
+void
+storagePoolEventGenericCallbackHelper(virConnectPtr c,
+ virStoragePoolPtr d,
+ void* data);
+
+int
+virConnectStoragePoolEventRegisterAnyWrapper(virConnectPtr c,
+ virStoragePoolPtr d,
+ int eventID,
+ virConnectStoragePoolEventGenericCallback cb,
+ long goCallbackId,
+ virErrorPtr err);
+
+int
+virConnectStoragePoolEventDeregisterAnyWrapper(virConnectPtr conn,
+ int callbackID,
+ virErrorPtr err);
+
+#endif /* LIBVIRT_GO_STORAGE_POOL_EVENTS_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_wrapper.go
new file mode 100644
index 00000000..8534f7c8
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_wrapper.go
@@ -0,0 +1,343 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "storage_pool_wrapper.h"
+
+int
+virStoragePoolBuildWrapper(virStoragePoolPtr pool,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolBuild(pool, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolCreateWrapper(virStoragePoolPtr pool,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolCreate(pool, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolDeleteWrapper(virStoragePoolPtr pool,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolDelete(pool, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolDestroyWrapper(virStoragePoolPtr pool,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolDestroy(pool);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolFreeWrapper(virStoragePoolPtr pool,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolFree(pool);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolGetAutostartWrapper(virStoragePoolPtr pool,
+ int *autostart,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolGetAutostart(pool, autostart);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virConnectPtr
+virStoragePoolGetConnectWrapper(virStoragePoolPtr pool,
+ virErrorPtr err)
+{
+ virConnectPtr ret = virStoragePoolGetConnect(pool);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolGetInfoWrapper(virStoragePoolPtr pool,
+ virStoragePoolInfoPtr info,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolGetInfo(pool, info);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virStoragePoolGetNameWrapper(virStoragePoolPtr pool,
+ virErrorPtr err)
+{
+ const char * ret = virStoragePoolGetName(pool);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolGetUUIDWrapper(virStoragePoolPtr pool,
+ unsigned char *uuid,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolGetUUID(pool, uuid);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolGetUUIDStringWrapper(virStoragePoolPtr pool,
+ char *buf,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolGetUUIDString(pool, buf);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virStoragePoolGetXMLDescWrapper(virStoragePoolPtr pool,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char * ret = virStoragePoolGetXMLDesc(pool, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolIsActiveWrapper(virStoragePoolPtr pool,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolIsActive(pool);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolIsPersistentWrapper(virStoragePoolPtr pool,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolIsPersistent(pool);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolListAllVolumesWrapper(virStoragePoolPtr pool,
+ virStorageVolPtr **vols,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolListAllVolumes(pool, vols, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolListVolumesWrapper(virStoragePoolPtr pool,
+ char ** const names,
+ int maxnames,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolListVolumes(pool, names, maxnames);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolNumOfVolumesWrapper(virStoragePoolPtr pool,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolNumOfVolumes(pool);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolRefWrapper(virStoragePoolPtr pool,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolRef(pool);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolRefreshWrapper(virStoragePoolPtr pool,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolRefresh(pool, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolSetAutostartWrapper(virStoragePoolPtr pool,
+ int autostart,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolSetAutostart(pool, autostart);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStoragePoolUndefineWrapper(virStoragePoolPtr pool,
+ virErrorPtr err)
+{
+ int ret = virStoragePoolUndefine(pool);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStorageVolPtr
+virStorageVolCreateXMLWrapper(virStoragePoolPtr pool,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virStorageVolPtr ret = virStorageVolCreateXML(pool, xmlDesc, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStorageVolPtr
+virStorageVolCreateXMLFromWrapper(virStoragePoolPtr pool,
+ const char *xmlDesc,
+ virStorageVolPtr clonevol,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ virStorageVolPtr ret = virStorageVolCreateXMLFrom(pool, xmlDesc, clonevol, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virStorageVolPtr
+virStorageVolLookupByNameWrapper(virStoragePoolPtr pool,
+ const char *name,
+ virErrorPtr err)
+{
+ virStorageVolPtr ret = virStorageVolLookupByName(pool, name);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_wrapper.h
new file mode 100644
index 00000000..acd121bf
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_pool_wrapper.h
@@ -0,0 +1,150 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_STORAGE_POOL_WRAPPER_H__
+#define LIBVIRT_GO_STORAGE_POOL_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "storage_pool_compat.h"
+
+int
+virStoragePoolBuildWrapper(virStoragePoolPtr pool,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStoragePoolCreateWrapper(virStoragePoolPtr pool,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStoragePoolDeleteWrapper(virStoragePoolPtr pool,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStoragePoolDestroyWrapper(virStoragePoolPtr pool,
+ virErrorPtr err);
+
+int
+virStoragePoolFreeWrapper(virStoragePoolPtr pool,
+ virErrorPtr err);
+
+int
+virStoragePoolGetAutostartWrapper(virStoragePoolPtr pool,
+ int *autostart,
+ virErrorPtr err);
+
+virConnectPtr
+virStoragePoolGetConnectWrapper(virStoragePoolPtr pool,
+ virErrorPtr err);
+
+int
+virStoragePoolGetInfoWrapper(virStoragePoolPtr pool,
+ virStoragePoolInfoPtr info,
+ virErrorPtr err);
+
+const char *
+virStoragePoolGetNameWrapper(virStoragePoolPtr pool,
+ virErrorPtr err);
+
+int
+virStoragePoolGetUUIDWrapper(virStoragePoolPtr pool,
+ unsigned char *uuid,
+ virErrorPtr err);
+
+int
+virStoragePoolGetUUIDStringWrapper(virStoragePoolPtr pool,
+ char *buf,
+ virErrorPtr err);
+
+char *
+virStoragePoolGetXMLDescWrapper(virStoragePoolPtr pool,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStoragePoolIsActiveWrapper(virStoragePoolPtr pool,
+ virErrorPtr err);
+
+int
+virStoragePoolIsPersistentWrapper(virStoragePoolPtr pool,
+ virErrorPtr err);
+
+int
+virStoragePoolListAllVolumesWrapper(virStoragePoolPtr pool,
+ virStorageVolPtr **vols,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStoragePoolListVolumesWrapper(virStoragePoolPtr pool,
+ char **const names,
+ int maxnames,
+ virErrorPtr err);
+
+int
+virStoragePoolNumOfVolumesWrapper(virStoragePoolPtr pool,
+ virErrorPtr err);
+
+int
+virStoragePoolRefWrapper(virStoragePoolPtr pool,
+ virErrorPtr err);
+
+int
+virStoragePoolRefreshWrapper(virStoragePoolPtr pool,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStoragePoolSetAutostartWrapper(virStoragePoolPtr pool,
+ int autostart,
+ virErrorPtr err);
+
+int
+virStoragePoolUndefineWrapper(virStoragePoolPtr pool,
+ virErrorPtr err);
+
+virStorageVolPtr
+virStorageVolCreateXMLWrapper(virStoragePoolPtr pool,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err);
+
+virStorageVolPtr
+virStorageVolCreateXMLFromWrapper(virStoragePoolPtr pool,
+ const char *xmlDesc,
+ virStorageVolPtr clonevol,
+ unsigned int flags,
+ virErrorPtr err);
+
+virStorageVolPtr
+virStorageVolLookupByNameWrapper(virStoragePoolPtr pool,
+ const char *name,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_STORAGE_POOL_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume.go b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume.go
new file mode 100644
index 00000000..bb10813d
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume.go
@@ -0,0 +1,290 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "storage_volume_wrapper.h"
+*/
+import "C"
+
+import (
+ "unsafe"
+)
+
+type StorageVolCreateFlags int
+
+const (
+ STORAGE_VOL_CREATE_PREALLOC_METADATA = StorageVolCreateFlags(C.VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA)
+ STORAGE_VOL_CREATE_REFLINK = StorageVolCreateFlags(C.VIR_STORAGE_VOL_CREATE_REFLINK)
+)
+
+type StorageVolDeleteFlags int
+
+const (
+ STORAGE_VOL_DELETE_NORMAL = StorageVolDeleteFlags(C.VIR_STORAGE_VOL_DELETE_NORMAL) // Delete metadata only (fast)
+ STORAGE_VOL_DELETE_ZEROED = StorageVolDeleteFlags(C.VIR_STORAGE_VOL_DELETE_ZEROED) // Clear all data to zeros (slow)
+ STORAGE_VOL_DELETE_WITH_SNAPSHOTS = StorageVolDeleteFlags(C.VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS) // Force removal of volume, even if in use
+)
+
+type StorageVolResizeFlags int
+
+const (
+ STORAGE_VOL_RESIZE_ALLOCATE = StorageVolResizeFlags(C.VIR_STORAGE_VOL_RESIZE_ALLOCATE) // force allocation of new size
+ STORAGE_VOL_RESIZE_DELTA = StorageVolResizeFlags(C.VIR_STORAGE_VOL_RESIZE_DELTA) // size is relative to current
+ STORAGE_VOL_RESIZE_SHRINK = StorageVolResizeFlags(C.VIR_STORAGE_VOL_RESIZE_SHRINK) // allow decrease in capacity
+)
+
+type StorageVolType int
+
+const (
+ STORAGE_VOL_FILE = StorageVolType(C.VIR_STORAGE_VOL_FILE) // Regular file based volumes
+ STORAGE_VOL_BLOCK = StorageVolType(C.VIR_STORAGE_VOL_BLOCK) // Block based volumes
+ STORAGE_VOL_DIR = StorageVolType(C.VIR_STORAGE_VOL_DIR) // Directory-passthrough based volume
+ STORAGE_VOL_NETWORK = StorageVolType(C.VIR_STORAGE_VOL_NETWORK) //Network volumes like RBD (RADOS Block Device)
+ STORAGE_VOL_NETDIR = StorageVolType(C.VIR_STORAGE_VOL_NETDIR) // Network accessible directory that can contain other network volumes
+ STORAGE_VOL_PLOOP = StorageVolType(C.VIR_STORAGE_VOL_PLOOP) // Ploop directory based volumes
+)
+
+type StorageVolWipeAlgorithm int
+
+const (
+ STORAGE_VOL_WIPE_ALG_ZERO = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_ZERO) // 1-pass, all zeroes
+ STORAGE_VOL_WIPE_ALG_NNSA = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_NNSA) // 4-pass NNSA Policy Letter NAP-14.1-C (XVI-8)
+ STORAGE_VOL_WIPE_ALG_DOD = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_DOD) // 4-pass DoD 5220.22-M section 8-306 procedure
+ STORAGE_VOL_WIPE_ALG_BSI = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_BSI) // 9-pass method recommended by the German Center of Security in Information Technologies
+ STORAGE_VOL_WIPE_ALG_GUTMANN = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_GUTMANN) // The canonical 35-pass sequence
+ STORAGE_VOL_WIPE_ALG_SCHNEIER = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_SCHNEIER) // 7-pass method described by Bruce Schneier in "Applied Cryptography" (1996)
+ STORAGE_VOL_WIPE_ALG_PFITZNER7 = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_PFITZNER7) // 7-pass random
+ STORAGE_VOL_WIPE_ALG_PFITZNER33 = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_PFITZNER33) // 33-pass random
+ STORAGE_VOL_WIPE_ALG_RANDOM = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_RANDOM) // 1-pass random
+ STORAGE_VOL_WIPE_ALG_TRIM = StorageVolWipeAlgorithm(C.VIR_STORAGE_VOL_WIPE_ALG_TRIM) // Trim the underlying storage
+)
+
+type StorageXMLFlags int
+
+const (
+ STORAGE_XML_INACTIVE = StorageXMLFlags(C.VIR_STORAGE_XML_INACTIVE)
+)
+
+type StorageVolInfoFlags int
+
+const (
+ STORAGE_VOL_USE_ALLOCATION = StorageVolInfoFlags(C.VIR_STORAGE_VOL_USE_ALLOCATION)
+ STORAGE_VOL_GET_PHYSICAL = StorageVolInfoFlags(C.VIR_STORAGE_VOL_GET_PHYSICAL)
+)
+
+type StorageVolUploadFlags int
+
+const (
+ STORAGE_VOL_UPLOAD_SPARSE_STREAM = StorageVolUploadFlags(C.VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM)
+)
+
+type StorageVolDownloadFlags int
+
+const (
+ STORAGE_VOL_DOWNLOAD_SPARSE_STREAM = StorageVolDownloadFlags(C.VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM)
+)
+
+type StorageVol struct {
+ ptr C.virStorageVolPtr
+}
+
+type StorageVolInfo struct {
+ Type StorageVolType
+ Capacity uint64
+ Allocation uint64
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolDelete
+func (v *StorageVol) Delete(flags StorageVolDeleteFlags) error {
+ var err C.virError
+ result := C.virStorageVolDeleteWrapper(v.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolFree
+func (v *StorageVol) Free() error {
+ var err C.virError
+ ret := C.virStorageVolFreeWrapper(v.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolRef
+func (c *StorageVol) Ref() error {
+ var err C.virError
+ ret := C.virStorageVolRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetInfo
+func (v *StorageVol) GetInfo() (*StorageVolInfo, error) {
+ var cinfo C.virStorageVolInfo
+ var err C.virError
+ result := C.virStorageVolGetInfoWrapper(v.ptr, &cinfo, &err)
+ if result == -1 {
+ return nil, makeError(&err)
+ }
+ return &StorageVolInfo{
+ Type: StorageVolType(cinfo._type),
+ Capacity: uint64(cinfo.capacity),
+ Allocation: uint64(cinfo.allocation),
+ }, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetInfoFlags
+func (v *StorageVol) GetInfoFlags(flags StorageVolInfoFlags) (*StorageVolInfo, error) {
+ if C.LIBVIR_VERSION_NUMBER < 3000000 {
+ return nil, makeNotImplementedError("virStorageVolGetInfoFlags")
+ }
+
+ var cinfo C.virStorageVolInfo
+ var err C.virError
+ result := C.virStorageVolGetInfoFlagsWrapper(v.ptr, &cinfo, C.uint(flags), &err)
+ if result == -1 {
+ return nil, makeError(&err)
+ }
+ return &StorageVolInfo{
+ Type: StorageVolType(cinfo._type),
+ Capacity: uint64(cinfo.capacity),
+ Allocation: uint64(cinfo.allocation),
+ }, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetKey
+func (v *StorageVol) GetKey() (string, error) {
+ var err C.virError
+ key := C.virStorageVolGetKeyWrapper(v.ptr, &err)
+ if key == nil {
+ return "", makeError(&err)
+ }
+ return C.GoString(key), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetName
+func (v *StorageVol) GetName() (string, error) {
+ var err C.virError
+ name := C.virStorageVolGetNameWrapper(v.ptr, &err)
+ if name == nil {
+ return "", makeError(&err)
+ }
+ return C.GoString(name), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetPath
+func (v *StorageVol) GetPath() (string, error) {
+ var err C.virError
+ result := C.virStorageVolGetPathWrapper(v.ptr, &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ path := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return path, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolGetXMLDesc
+func (v *StorageVol) GetXMLDesc(flags uint32) (string, error) {
+ var err C.virError
+ result := C.virStorageVolGetXMLDescWrapper(v.ptr, C.uint(flags), &err)
+ if result == nil {
+ return "", makeError(&err)
+ }
+ xml := C.GoString(result)
+ C.free(unsafe.Pointer(result))
+ return xml, nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolResize
+func (v *StorageVol) Resize(capacity uint64, flags StorageVolResizeFlags) error {
+ var err C.virError
+ result := C.virStorageVolResizeWrapper(v.ptr, C.ulonglong(capacity), C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolWipe
+func (v *StorageVol) Wipe(flags uint32) error {
+ var err C.virError
+ result := C.virStorageVolWipeWrapper(v.ptr, C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolWipePattern
+func (v *StorageVol) WipePattern(algorithm StorageVolWipeAlgorithm, flags uint32) error {
+ var err C.virError
+ result := C.virStorageVolWipePatternWrapper(v.ptr, C.uint(algorithm), C.uint(flags), &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolUpload
+func (v *StorageVol) Upload(stream *Stream, offset, length uint64, flags StorageVolUploadFlags) error {
+ var err C.virError
+ if C.virStorageVolUploadWrapper(v.ptr, stream.ptr, C.ulonglong(offset),
+ C.ulonglong(length), C.uint(flags), &err) == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStorageVolDownload
+func (v *StorageVol) Download(stream *Stream, offset, length uint64, flags StorageVolDownloadFlags) error {
+ var err C.virError
+ if C.virStorageVolDownloadWrapper(v.ptr, stream.ptr, C.ulonglong(offset),
+ C.ulonglong(length), C.uint(flags), &err) == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virStoragePoolLookupByVolume
+func (v *StorageVol) LookupPoolByVolume() (*StoragePool, error) {
+ var err C.virError
+ poolPtr := C.virStoragePoolLookupByVolumeWrapper(v.ptr, &err)
+ if poolPtr == nil {
+ return nil, makeError(&err)
+ }
+ return &StoragePool{ptr: poolPtr}, nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_compat.h
new file mode 100644
index 00000000..bd3cee9a
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_compat.h
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_STORAGE_VOLUME_COMPAT_H__
+#define LIBVIRT_GO_STORAGE_VOLUME_COMPAT_H__
+
+/* 3.0.0 */
+
+#ifndef VIR_STORAGE_VOL_USE_ALLOCATION
+#define VIR_STORAGE_VOL_USE_ALLOCATION 0
+#endif
+
+#ifndef VIR_STORAGE_VOL_GET_PHYSICAL
+#define VIR_STORAGE_VOL_GET_PHYSICAL 1 << 0
+#endif
+
+
+/* 1.2.13 */
+
+#ifndef VIR_STORAGE_VOL_CREATE_REFLINK
+#define VIR_STORAGE_VOL_CREATE_REFLINK 1<< 1
+#endif
+
+
+/* 1.2.21 */
+
+#ifndef VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS
+#define VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS 1 << 1
+#endif
+
+
+/* 1.3.2 */
+
+#ifndef VIR_STORAGE_VOL_WIPE_ALG_TRIM
+#define VIR_STORAGE_VOL_WIPE_ALG_TRIM 9
+#endif
+
+
+/* 1.3.4 */
+
+#ifndef VIR_STORAGE_VOL_PLOOP
+#define VIR_STORAGE_VOL_PLOOP 5
+#endif
+
+/* 3.4.0 */
+
+#ifndef VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM
+#define VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM (1 << 0)
+#endif
+
+#ifndef VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM
+#define VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM (1 << 0)
+#endif
+
+#endif /* LIBVIRT_GO_STORAGE_VOLUME_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_wrapper.go
new file mode 100644
index 00000000..d41a8a7c
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_wrapper.go
@@ -0,0 +1,249 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <assert.h>
+#include "storage_volume_wrapper.h"
+
+virStoragePoolPtr
+virStoragePoolLookupByVolumeWrapper(virStorageVolPtr vol,
+ virErrorPtr err)
+{
+ virStoragePoolPtr ret = virStoragePoolLookupByVolume(vol);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStorageVolDeleteWrapper(virStorageVolPtr vol,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStorageVolDelete(vol, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStorageVolDownloadWrapper(virStorageVolPtr vol,
+ virStreamPtr stream,
+ unsigned long long offset,
+ unsigned long long length,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStorageVolDownload(vol, stream, offset, length, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStorageVolFreeWrapper(virStorageVolPtr vol,
+ virErrorPtr err)
+{
+ int ret = virStorageVolFree(vol);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+virConnectPtr
+virStorageVolGetConnectWrapper(virStorageVolPtr vol,
+ virErrorPtr err)
+{
+ virConnectPtr ret = virStorageVolGetConnect(vol);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStorageVolGetInfoWrapper(virStorageVolPtr vol,
+ virStorageVolInfoPtr info,
+ virErrorPtr err)
+{
+ int ret = virStorageVolGetInfo(vol, info);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStorageVolGetInfoFlagsWrapper(virStorageVolPtr vol,
+ virStorageVolInfoPtr info,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3000000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virStorageVolGetInfoFlags(vol, info, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+const char *
+virStorageVolGetKeyWrapper(virStorageVolPtr vol,
+ virErrorPtr err)
+{
+ const char *ret = virStorageVolGetKey(vol);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+const char *
+virStorageVolGetNameWrapper(virStorageVolPtr vol,
+ virErrorPtr err)
+{
+ const char *ret = virStorageVolGetName(vol);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virStorageVolGetPathWrapper(virStorageVolPtr vol,
+ virErrorPtr err)
+{
+ char *ret = virStorageVolGetPath(vol);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+char *
+virStorageVolGetXMLDescWrapper(virStorageVolPtr vol,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ char *ret = virStorageVolGetXMLDesc(vol, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStorageVolRefWrapper(virStorageVolPtr vol,
+ virErrorPtr err)
+{
+ int ret = virStorageVolRef(vol);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStorageVolResizeWrapper(virStorageVolPtr vol,
+ unsigned long long capacity,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStorageVolResize(vol, capacity, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStorageVolUploadWrapper(virStorageVolPtr vol,
+ virStreamPtr stream,
+ unsigned long long offset,
+ unsigned long long length,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStorageVolUpload(vol, stream, offset, length, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStorageVolWipeWrapper(virStorageVolPtr vol,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStorageVolWipe(vol, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStorageVolWipePatternWrapper(virStorageVolPtr vol,
+ unsigned int algorithm,
+ unsigned int flags,
+ virErrorPtr err)
+{
+ int ret = virStorageVolWipePattern(vol, algorithm, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_wrapper.h
new file mode 100644
index 00000000..b3ed2a9f
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/storage_volume_wrapper.h
@@ -0,0 +1,116 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_STORAGE_VOLUME_WRAPPER_H__
+#define LIBVIRT_GO_STORAGE_VOLUME_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "storage_volume_compat.h"
+
+virStoragePoolPtr
+virStoragePoolLookupByVolumeWrapper(virStorageVolPtr vol,
+ virErrorPtr err);
+
+int
+virStorageVolDeleteWrapper(virStorageVolPtr vol,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStorageVolDownloadWrapper(virStorageVolPtr vol,
+ virStreamPtr stream,
+ unsigned long long offset,
+ unsigned long long length,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStorageVolFreeWrapper(virStorageVolPtr vol,
+ virErrorPtr err);
+
+virConnectPtr
+virStorageVolGetConnectWrapper(virStorageVolPtr vol,
+ virErrorPtr err);
+
+int
+virStorageVolGetInfoWrapper(virStorageVolPtr vol,
+ virStorageVolInfoPtr info,
+ virErrorPtr err);
+
+int
+virStorageVolGetInfoFlagsWrapper(virStorageVolPtr vol,
+ virStorageVolInfoPtr info,
+ unsigned int flags,
+ virErrorPtr err);
+
+const char *
+virStorageVolGetKeyWrapper(virStorageVolPtr vol,
+ virErrorPtr err);
+
+const char *
+virStorageVolGetNameWrapper(virStorageVolPtr vol,
+ virErrorPtr err);
+
+char *
+virStorageVolGetPathWrapper(virStorageVolPtr vol,
+ virErrorPtr err);
+
+char *
+virStorageVolGetXMLDescWrapper(virStorageVolPtr vol,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStorageVolRefWrapper(virStorageVolPtr vol,
+ virErrorPtr err);
+
+int
+virStorageVolResizeWrapper(virStorageVolPtr vol,
+ unsigned long long capacity,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStorageVolUploadWrapper(virStorageVolPtr vol,
+ virStreamPtr stream,
+ unsigned long long offset,
+ unsigned long long length,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStorageVolWipeWrapper(virStorageVolPtr vol,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStorageVolWipePatternWrapper(virStorageVolPtr vol,
+ unsigned int algorithm,
+ unsigned int flags,
+ virErrorPtr err);
+
+#endif /* LIBVIRT_GO_STORAGE_VOLUME_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/stream.go b/src/dma/vendor/github.com/libvirt/libvirt-go/stream.go
new file mode 100644
index 00000000..4010b11c
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/stream.go
@@ -0,0 +1,418 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdlib.h>
+#include "stream_wrapper.h"
+*/
+import "C"
+import (
+ "io"
+ "unsafe"
+)
+
+type StreamFlags int
+
+const (
+ STREAM_NONBLOCK = StreamFlags(C.VIR_STREAM_NONBLOCK)
+)
+
+type StreamEventType int
+
+const (
+ STREAM_EVENT_READABLE = StreamEventType(C.VIR_STREAM_EVENT_READABLE)
+ STREAM_EVENT_WRITABLE = StreamEventType(C.VIR_STREAM_EVENT_WRITABLE)
+ STREAM_EVENT_ERROR = StreamEventType(C.VIR_STREAM_EVENT_ERROR)
+ STREAM_EVENT_HANGUP = StreamEventType(C.VIR_STREAM_EVENT_HANGUP)
+)
+
+type StreamRecvFlagsValues int
+
+const (
+ STREAM_RECV_STOP_AT_HOLE = StreamRecvFlagsValues(C.VIR_STREAM_RECV_STOP_AT_HOLE)
+)
+
+type Stream struct {
+ ptr C.virStreamPtr
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamAbort
+func (v *Stream) Abort() error {
+ var err C.virError
+ result := C.virStreamAbortWrapper(v.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamFinish
+func (v *Stream) Finish() error {
+ var err C.virError
+ result := C.virStreamFinishWrapper(v.ptr, &err)
+ if result == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamFree
+func (v *Stream) Free() error {
+ var err C.virError
+ ret := C.virStreamFreeWrapper(v.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamRef
+func (c *Stream) Ref() error {
+ var err C.virError
+ ret := C.virStreamRefWrapper(c.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamRecv
+func (v *Stream) Recv(p []byte) (int, error) {
+ var err C.virError
+ n := C.virStreamRecvWrapper(v.ptr, (*C.char)(unsafe.Pointer(&p[0])), C.size_t(len(p)), &err)
+ if n < 0 {
+ return 0, makeError(&err)
+ }
+ if n == 0 {
+ return 0, io.EOF
+ }
+
+ return int(n), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamRecvFlags
+func (v *Stream) RecvFlags(p []byte, flags StreamRecvFlagsValues) (int, error) {
+ if C.LIBVIR_VERSION_NUMBER < 3004000 {
+ return 0, makeNotImplementedError("virStreamRecvFlags")
+ }
+
+ var err C.virError
+ n := C.virStreamRecvFlagsWrapper(v.ptr, (*C.char)(unsafe.Pointer(&p[0])), C.size_t(len(p)), C.uint(flags), &err)
+ if n < 0 {
+ return 0, makeError(&err)
+ }
+ if n == 0 {
+ return 0, io.EOF
+ }
+
+ return int(n), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamRecvHole
+func (v *Stream) RecvHole(flags uint) (int64, error) {
+ if C.LIBVIR_VERSION_NUMBER < 3004000 {
+ return 0, makeNotImplementedError("virStreamSparseRecvHole")
+ }
+
+ var len C.longlong
+ var err C.virError
+ ret := C.virStreamRecvHoleWrapper(v.ptr, &len, C.uint(flags), &err)
+ if ret < 0 {
+ return 0, makeError(&err)
+ }
+
+ return int64(len), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamSend
+func (v *Stream) Send(p []byte) (int, error) {
+ var err C.virError
+ n := C.virStreamSendWrapper(v.ptr, (*C.char)(unsafe.Pointer(&p[0])), C.size_t(len(p)), &err)
+ if n < 0 {
+ return 0, makeError(&err)
+ }
+ if n == 0 {
+ return 0, io.EOF
+ }
+
+ return int(n), nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamSendHole
+func (v *Stream) SendHole(len int64, flags uint32) error {
+ if C.LIBVIR_VERSION_NUMBER < 3004000 {
+ return makeNotImplementedError("virStreamSendHole")
+ }
+
+ var err C.virError
+ ret := C.virStreamSendHoleWrapper(v.ptr, C.longlong(len), C.uint(flags), &err)
+ if ret < 0 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+type StreamSinkFunc func(*Stream, []byte) (int, error)
+type StreamSinkHoleFunc func(*Stream, int64) error
+
+//export streamSinkCallback
+func streamSinkCallback(stream C.virStreamPtr, cdata *C.char, nbytes C.size_t, callbackID int) int {
+ callbackFunc := getCallbackId(callbackID)
+
+ callback, ok := callbackFunc.(StreamSinkFunc)
+ if !ok {
+ panic("Incorrect stream sink func callback")
+ }
+
+ data := make([]byte, int(nbytes))
+ for i := 0; i < int(nbytes); i++ {
+ cdatabyte := (*C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(cdata)) + (unsafe.Sizeof(*cdata) * uintptr(i))))
+ data[i] = (byte)(*cdatabyte)
+ }
+
+ retnbytes, err := callback(&Stream{ptr: stream}, data)
+ if err != nil {
+ return -1
+ }
+
+ return retnbytes
+}
+
+//export streamSinkHoleCallback
+func streamSinkHoleCallback(stream C.virStreamPtr, length C.longlong, callbackID int) int {
+ callbackFunc := getCallbackId(callbackID)
+
+ callback, ok := callbackFunc.(StreamSinkHoleFunc)
+ if !ok {
+ panic("Incorrect stream sink hole func callback")
+ }
+
+ err := callback(&Stream{ptr: stream}, int64(length))
+ if err != nil {
+ return -1
+ }
+
+ return 0
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamRecvAll
+func (v *Stream) RecvAll(handler StreamSinkFunc) error {
+
+ callbackID := registerCallbackId(handler)
+
+ var err C.virError
+ ret := C.virStreamRecvAllWrapper(v.ptr, (C.int)(callbackID), &err)
+ freeCallbackId(callbackID)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamSparseRecvAll
+func (v *Stream) SparseRecvAll(handler StreamSinkFunc, holeHandler StreamSinkHoleFunc) error {
+ if C.LIBVIR_VERSION_NUMBER < 3004000 {
+ return makeNotImplementedError("virStreamSparseSendAll")
+ }
+
+ callbackID := registerCallbackId(handler)
+ holeCallbackID := registerCallbackId(holeHandler)
+
+ var err C.virError
+ ret := C.virStreamSparseRecvAllWrapper(v.ptr, (C.int)(callbackID), (C.int)(holeCallbackID), &err)
+ freeCallbackId(callbackID)
+ freeCallbackId(holeCallbackID)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+type StreamSourceFunc func(*Stream, int) ([]byte, error)
+type StreamSourceHoleFunc func(*Stream) (bool, int64, error)
+type StreamSourceSkipFunc func(*Stream, int64) error
+
+//export streamSourceCallback
+func streamSourceCallback(stream C.virStreamPtr, cdata *C.char, nbytes C.size_t, callbackID int) int {
+ callbackFunc := getCallbackId(callbackID)
+
+ callback, ok := callbackFunc.(StreamSourceFunc)
+ if !ok {
+ panic("Incorrect stream sink func callback")
+ }
+
+ data, err := callback(&Stream{ptr: stream}, (int)(nbytes))
+ if err != nil {
+ return -1
+ }
+
+ nretbytes := int(nbytes)
+ if len(data) < nretbytes {
+ nretbytes = len(data)
+ }
+
+ for i := 0; i < nretbytes; i++ {
+ cdatabyte := (*C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(cdata)) + (unsafe.Sizeof(*cdata) * uintptr(i))))
+ *cdatabyte = (C.char)(data[i])
+ }
+
+ return nretbytes
+}
+
+//export streamSourceHoleCallback
+func streamSourceHoleCallback(stream C.virStreamPtr, cinData *C.int, clength *C.longlong, callbackID int) int {
+ callbackFunc := getCallbackId(callbackID)
+
+ callback, ok := callbackFunc.(StreamSourceHoleFunc)
+ if !ok {
+ panic("Incorrect stream sink hole func callback")
+ }
+
+ inData, length, err := callback(&Stream{ptr: stream})
+ if err != nil {
+ return -1
+ }
+
+ if inData {
+ *cinData = 1
+ } else {
+ *cinData = 0
+ }
+ *clength = C.longlong(length)
+
+ return 0
+}
+
+//export streamSourceSkipCallback
+func streamSourceSkipCallback(stream C.virStreamPtr, length C.longlong, callbackID int) int {
+ callbackFunc := getCallbackId(callbackID)
+
+ callback, ok := callbackFunc.(StreamSourceSkipFunc)
+ if !ok {
+ panic("Incorrect stream sink skip func callback")
+ }
+
+ err := callback(&Stream{ptr: stream}, int64(length))
+ if err != nil {
+ return -1
+ }
+
+ return 0
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamSendAll
+func (v *Stream) SendAll(handler StreamSourceFunc) error {
+
+ callbackID := registerCallbackId(handler)
+
+ var err C.virError
+ ret := C.virStreamSendAllWrapper(v.ptr, (C.int)(callbackID), &err)
+ freeCallbackId(callbackID)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamSparseSendAll
+func (v *Stream) SparseSendAll(handler StreamSourceFunc, holeHandler StreamSourceHoleFunc, skipHandler StreamSourceSkipFunc) error {
+ if C.LIBVIR_VERSION_NUMBER < 3004000 {
+ return makeNotImplementedError("virStreamSparseSendAll")
+ }
+
+ callbackID := registerCallbackId(handler)
+ holeCallbackID := registerCallbackId(holeHandler)
+ skipCallbackID := registerCallbackId(skipHandler)
+
+ var err C.virError
+ ret := C.virStreamSparseSendAllWrapper(v.ptr, (C.int)(callbackID), (C.int)(holeCallbackID), (C.int)(skipCallbackID), &err)
+ freeCallbackId(callbackID)
+ freeCallbackId(holeCallbackID)
+ freeCallbackId(skipCallbackID)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+type StreamEventCallback func(*Stream, StreamEventType)
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamEventAddCallback
+func (v *Stream) EventAddCallback(events StreamEventType, callback StreamEventCallback) error {
+ callbackID := registerCallbackId(callback)
+
+ var err C.virError
+ ret := C.virStreamEventAddCallbackWrapper(v.ptr, (C.int)(events), (C.int)(callbackID), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+//export streamEventCallback
+func streamEventCallback(st C.virStreamPtr, events int, callbackID int) {
+ callbackFunc := getCallbackId(callbackID)
+
+ callback, ok := callbackFunc.(StreamEventCallback)
+ if !ok {
+ panic("Incorrect stream event func callback")
+ }
+
+ callback(&Stream{ptr: st}, StreamEventType(events))
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamEventUpdateCallback
+func (v *Stream) EventUpdateCallback(events StreamEventType) error {
+ var err C.virError
+ ret := C.virStreamEventUpdateCallbackWrapper(v.ptr, (C.int)(events), &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
+
+// See also https://libvirt.org/html/libvirt-libvirt-stream.html#virStreamEventRemoveCallback
+func (v *Stream) EventRemoveCallback() error {
+ var err C.virError
+ ret := C.virStreamEventRemoveCallbackWrapper(v.ptr, &err)
+ if ret == -1 {
+ return makeError(&err)
+ }
+
+ return nil
+}
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/stream_compat.h b/src/dma/vendor/github.com/libvirt/libvirt-go/stream_compat.h
new file mode 100644
index 00000000..92befd58
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/stream_compat.h
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_STREAM_COMPAT_H__
+#define LIBVIRT_GO_STREAM_COMPAT_H__
+
+/* 3.4.0 */
+
+#ifndef VIR_STREAM_RECV_STOP_AT_HOLE
+#define VIR_STREAM_RECV_STOP_AT_HOLE (1 << 0)
+#endif
+
+#endif /* LIBVIRT_GO_STREAM_COMPAT_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/stream_wrapper.go b/src/dma/vendor/github.com/libvirt/libvirt-go/stream_wrapper.go
new file mode 100644
index 00000000..e563a742
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/stream_wrapper.go
@@ -0,0 +1,331 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <stdint.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "stream_wrapper.h"
+
+int streamSourceCallback(virStreamPtr st, char *cdata, size_t nbytes, int callbackID);
+int streamSourceHoleCallback(virStreamPtr st, int *inData, long long *length, int callbackID);
+int streamSourceSkipCallback(virStreamPtr st, long long length, int callbackID);
+
+int streamSinkCallback(virStreamPtr st, const char *cdata, size_t nbytes, int callbackID);
+int streamSinkHoleCallback(virStreamPtr st, long long length, int callbackID);
+
+struct CallbackData {
+ int callbackID;
+ int holeCallbackID;
+ int skipCallbackID;
+};
+
+static int streamSourceCallbackHelper(virStreamPtr st, char *data, size_t nbytes, void *opaque)
+{
+ struct CallbackData *cbdata = opaque;
+
+ return streamSourceCallback(st, data, nbytes, cbdata->callbackID);
+}
+
+static int streamSourceHoleCallbackHelper(virStreamPtr st, int *inData, long long *length, void *opaque)
+{
+ struct CallbackData *cbdata = opaque;
+
+ return streamSourceHoleCallback(st, inData, length, cbdata->holeCallbackID);
+}
+
+static int streamSourceSkipCallbackHelper(virStreamPtr st, long long length, void *opaque)
+{
+ struct CallbackData *cbdata = opaque;
+
+ return streamSourceSkipCallback(st, length, cbdata->skipCallbackID);
+}
+
+static int streamSinkCallbackHelper(virStreamPtr st, const char *data, size_t nbytes, void *opaque)
+{
+ struct CallbackData *cbdata = opaque;
+
+ return streamSinkCallback(st, data, nbytes, cbdata->callbackID);
+}
+
+static int streamSinkHoleCallbackHelper(virStreamPtr st, long long length, void *opaque)
+{
+ struct CallbackData *cbdata = opaque;
+
+ return streamSinkHoleCallback(st, length, cbdata->holeCallbackID);
+}
+
+int
+virStreamAbortWrapper(virStreamPtr stream,
+ virErrorPtr err)
+{
+ int ret = virStreamAbort(stream);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+void
+streamEventCallback(virStreamPtr st, int events, int callbackID);
+
+static void
+streamEventCallbackHelper(virStreamPtr st, int events, void *opaque)
+{
+ streamEventCallback(st, events, (int)(intptr_t)opaque);
+}
+
+int
+virStreamEventAddCallbackWrapper(virStreamPtr stream,
+ int events,
+ int callbackID,
+ virErrorPtr err)
+{
+ int ret = virStreamEventAddCallback(stream, events, streamEventCallbackHelper, (void *)(intptr_t)callbackID, NULL);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStreamEventRemoveCallbackWrapper(virStreamPtr stream,
+ virErrorPtr err)
+{
+ int ret = virStreamEventRemoveCallback(stream);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStreamEventUpdateCallbackWrapper(virStreamPtr stream,
+ int events,
+ virErrorPtr err)
+{
+ int ret = virStreamEventUpdateCallback(stream, events);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStreamFinishWrapper(virStreamPtr stream,
+ virErrorPtr err)
+{
+ int ret = virStreamFinish(stream);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStreamFreeWrapper(virStreamPtr stream,
+ virErrorPtr err)
+{
+ int ret = virStreamFree(stream);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStreamRecvWrapper(virStreamPtr stream,
+ char *data,
+ size_t nbytes,
+ virErrorPtr err)
+{
+ int ret = virStreamRecv(stream, data, nbytes);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStreamRecvAllWrapper(virStreamPtr stream,
+ int callbackID,
+ virErrorPtr err)
+{
+ struct CallbackData cbdata = { .callbackID = callbackID };
+ int ret = virStreamRecvAll(stream, streamSinkCallbackHelper, &cbdata);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStreamRecvFlagsWrapper(virStreamPtr stream,
+ char *data,
+ size_t nbytes,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3004000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virStreamRecvFlags(stream, data, nbytes, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virStreamRecvHoleWrapper(virStreamPtr stream,
+ long long *length,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3004000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virStreamRecvHole(stream, length, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virStreamRefWrapper(virStreamPtr stream,
+ virErrorPtr err)
+{
+ int ret = virStreamRef(stream);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStreamSendWrapper(virStreamPtr stream,
+ const char *data,
+ size_t nbytes,
+ virErrorPtr err)
+{
+ int ret = virStreamSend(stream, data, nbytes);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStreamSendAllWrapper(virStreamPtr stream,
+ int callbackID,
+ virErrorPtr err)
+{
+ struct CallbackData cbdata = { .callbackID = callbackID };
+ int ret = virStreamSendAll(stream, streamSourceCallbackHelper, &cbdata);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
+int
+virStreamSendHoleWrapper(virStreamPtr stream,
+ long long length,
+ unsigned int flags,
+ virErrorPtr err)
+{
+#if LIBVIR_VERSION_NUMBER < 3004000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virStreamSendHole(stream, length, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virStreamSparseRecvAllWrapper(virStreamPtr stream,
+ int callbackID,
+ int holeCallbackID,
+ virErrorPtr err)
+{
+ struct CallbackData cbdata = { .callbackID = callbackID, .holeCallbackID = holeCallbackID };
+#if LIBVIR_VERSION_NUMBER < 3004000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virStreamSparseRecvAll(stream, streamSinkCallbackHelper, streamSinkHoleCallbackHelper, &cbdata);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+int
+virStreamSparseSendAllWrapper(virStreamPtr stream,
+ int callbackID,
+ int holeCallbackID,
+ int skipCallbackID,
+ virErrorPtr err)
+{
+ struct CallbackData cbdata = { .callbackID = callbackID, .holeCallbackID = holeCallbackID, .skipCallbackID = skipCallbackID };
+#if LIBVIR_VERSION_NUMBER < 3004000
+ assert(0); // Caller should have checked version
+#else
+ int ret = virStreamSparseSendAll(stream, streamSourceCallbackHelper, streamSourceHoleCallbackHelper, streamSourceSkipCallbackHelper, &cbdata);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
+#endif
+}
+
+
+*/
+import "C"
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/stream_wrapper.h b/src/dma/vendor/github.com/libvirt/libvirt-go/stream_wrapper.h
new file mode 100644
index 00000000..b9c6e57c
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/stream_wrapper.h
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+#ifndef LIBVIRT_GO_STREAM_WRAPPER_H__
+#define LIBVIRT_GO_STREAM_WRAPPER_H__
+
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include "stream_compat.h"
+
+int
+virStreamAbortWrapper(virStreamPtr stream,
+ virErrorPtr err);
+
+int
+virStreamEventAddCallbackWrapper(virStreamPtr st,
+ int events,
+ int callbackID,
+ virErrorPtr err);
+
+int
+virStreamEventRemoveCallbackWrapper(virStreamPtr stream,
+ virErrorPtr err);
+
+int
+virStreamEventUpdateCallbackWrapper(virStreamPtr stream,
+ int events,
+ virErrorPtr err);
+
+int
+virStreamFinishWrapper(virStreamPtr stream,
+ virErrorPtr err);
+
+int
+virStreamFreeWrapper(virStreamPtr stream,
+ virErrorPtr err);
+
+int
+virStreamRecvWrapper(virStreamPtr stream,
+ char *data,
+ size_t nbytes,
+ virErrorPtr err);
+
+int
+virStreamRecvAllWrapper(virStreamPtr st,
+ int callbackID,
+ virErrorPtr err);
+
+int
+virStreamRecvFlagsWrapper(virStreamPtr st,
+ char *data,
+ size_t nbytes,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStreamRecvHoleWrapper(virStreamPtr,
+ long long *length,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStreamRefWrapper(virStreamPtr stream,
+ virErrorPtr err);
+
+int
+virStreamSendWrapper(virStreamPtr stream,
+ const char *data,
+ size_t nbytes,
+ virErrorPtr err);
+
+int
+virStreamSendAllWrapper(virStreamPtr st,
+ int callbackID,
+ virErrorPtr err);
+
+int
+virStreamSendHoleWrapper(virStreamPtr st,
+ long long length,
+ unsigned int flags,
+ virErrorPtr err);
+
+int
+virStreamSparseRecvAllWrapper(virStreamPtr st,
+ int callbackID,
+ int holeCallbackID,
+ virErrorPtr err);
+
+int
+virStreamSparseSendAllWrapper(virStreamPtr st,
+ int callbackID,
+ int holeCallbackID,
+ int skipCallbackID,
+ virErrorPtr err);
+
+
+#endif /* LIBVIRT_GO_STREAM_WRAPPER_H__ */
diff --git a/src/dma/vendor/github.com/libvirt/libvirt-go/typedparams.go b/src/dma/vendor/github.com/libvirt/libvirt-go/typedparams.go
new file mode 100644
index 00000000..e8ceae07
--- /dev/null
+++ b/src/dma/vendor/github.com/libvirt/libvirt-go/typedparams.go
@@ -0,0 +1,262 @@
+/*
+ * This file is part of the libvirt-go project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Copyright (c) 2013 Alex Zorin
+ * Copyright (C) 2016 Red Hat, Inc.
+ *
+ */
+
+package libvirt
+
+/*
+#cgo pkg-config: libvirt
+#include <libvirt/libvirt.h>
+#include <libvirt/virterror.h>
+#include <stdlib.h>
+#include <string.h>
+*/
+import "C"
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+type typedParamsFieldInfo struct {
+ set *bool
+ i *int
+ ui *uint
+ l *int64
+ ul *uint64
+ b *bool
+ d *float64
+ s *string
+ sl *[]string
+}
+
+func typedParamsUnpackLen(cparams *C.virTypedParameter, nparams int, infomap map[string]typedParamsFieldInfo) (uint, error) {
+ count := uint(0)
+ for i := 0; i < nparams; i++ {
+ var cparam *C.virTypedParameter
+ cparam = (*C.virTypedParameter)(unsafe.Pointer(uintptr(unsafe.Pointer(cparams)) + unsafe.Sizeof(*cparam)*uintptr(i)))
+ name := C.GoString((*C.char)(unsafe.Pointer(&cparam.field)))
+ info, ok := infomap[name]
+ if !ok {
+ // Ignore unknown keys so that we don't break if
+ // run against a newer libvirt that returns more
+ // parameters than we currently have code to
+ // consume
+ continue
+ }
+ switch cparam._type {
+ case C.VIR_TYPED_PARAM_INT:
+ if info.i == nil {
+ return 0, fmt.Errorf("field %s expects an int", name)
+ }
+ *info.i = int(*(*C.int)(unsafe.Pointer(&cparam.value)))
+ *info.set = true
+ case C.VIR_TYPED_PARAM_UINT:
+ if info.ui == nil {
+ return 0, fmt.Errorf("field %s expects a uint", name)
+ }
+ *info.ui = uint(*(*C.uint)(unsafe.Pointer(&cparam.value)))
+ *info.set = true
+ case C.VIR_TYPED_PARAM_LLONG:
+ if info.l == nil {
+ return 0, fmt.Errorf("field %s expects an int64", name)
+ }
+ *info.l = int64(*(*C.longlong)(unsafe.Pointer(&cparam.value)))
+ *info.set = true
+ case C.VIR_TYPED_PARAM_ULLONG:
+ if info.ul == nil {
+ return 0, fmt.Errorf("field %s expects a uint64", name)
+ }
+ *info.ul = uint64(*(*C.ulonglong)(unsafe.Pointer(&cparam.value)))
+ *info.set = true
+ case C.VIR_TYPED_PARAM_DOUBLE:
+ if info.d == nil {
+ return 0, fmt.Errorf("field %s expects a float64", name)
+ }
+ *info.d = float64(*(*C.double)(unsafe.Pointer(&cparam.value)))
+ *info.set = true
+ case C.VIR_TYPED_PARAM_BOOLEAN:
+ if info.b == nil {
+ return 0, fmt.Errorf("field %s expects a bool", name)
+ }
+ *info.b = *(*C.char)(unsafe.Pointer(&cparam.value)) == 1
+ *info.set = true
+ case C.VIR_TYPED_PARAM_STRING:
+ if info.s != nil {
+ *info.s = C.GoString(*(**C.char)(unsafe.Pointer(&cparam.value)))
+ *info.set = true
+ } else if info.sl != nil {
+ *info.sl = append(*info.sl, C.GoString(*(**C.char)(unsafe.Pointer(&cparam.value))))
+ *info.set = true
+ } else {
+ return 0, fmt.Errorf("field %s expects a string/string list", name)
+ }
+ }
+ count++
+ }
+
+ return count, nil
+}
+
+func typedParamsUnpack(cparams []C.virTypedParameter, infomap map[string]typedParamsFieldInfo) (uint, error) {
+ return typedParamsUnpackLen(&cparams[0], len(cparams), infomap)
+}
+
+func typedParamsPackLen(cparams *C.virTypedParameter, nparams int, infomap map[string]typedParamsFieldInfo) error {
+ stringOffsets := make(map[string]uint)
+
+ for i := 0; i < nparams; i++ {
+ var cparam *C.virTypedParameter
+ cparam = (*C.virTypedParameter)(unsafe.Pointer(uintptr(unsafe.Pointer(cparams)) + unsafe.Sizeof(*cparam)*uintptr(i)))
+ name := C.GoString((*C.char)(unsafe.Pointer(&cparam.field)))
+ info, ok := infomap[name]
+ if !ok {
+ // Ignore unknown keys so that we don't break if
+ // run against a newer libvirt that returns more
+ // parameters than we currently have code to
+ // consume
+ continue
+ }
+ if !*info.set {
+ continue
+ }
+ switch cparam._type {
+ case C.VIR_TYPED_PARAM_INT:
+ if info.i == nil {
+ return fmt.Errorf("field %s expects an int", name)
+ }
+ *(*C.int)(unsafe.Pointer(&cparam.value)) = C.int(*info.i)
+ case C.VIR_TYPED_PARAM_UINT:
+ if info.ui == nil {
+ return fmt.Errorf("field %s expects a uint", name)
+ }
+ *(*C.uint)(unsafe.Pointer(&cparam.value)) = C.uint(*info.ui)
+ case C.VIR_TYPED_PARAM_LLONG:
+ if info.l == nil {
+ return fmt.Errorf("field %s expects an int64", name)
+ }
+ *(*C.longlong)(unsafe.Pointer(&cparam.value)) = C.longlong(*info.l)
+ case C.VIR_TYPED_PARAM_ULLONG:
+ if info.ul == nil {
+ return fmt.Errorf("field %s expects a uint64", name)
+ }
+ *(*C.ulonglong)(unsafe.Pointer(&cparam.value)) = C.ulonglong(*info.ul)
+ case C.VIR_TYPED_PARAM_DOUBLE:
+ if info.d == nil {
+ return fmt.Errorf("field %s expects a float64", name)
+ }
+ *(*C.double)(unsafe.Pointer(&cparam.value)) = C.double(*info.d)
+ case C.VIR_TYPED_PARAM_BOOLEAN:
+ if info.b == nil {
+ return fmt.Errorf("field %s expects a bool", name)
+ }
+ if *info.b {
+ *(*C.char)(unsafe.Pointer(&cparam.value)) = 1
+ } else {
+ *(*C.char)(unsafe.Pointer(&cparam.value)) = 0
+ }
+ case C.VIR_TYPED_PARAM_STRING:
+ if info.s != nil {
+ *(**C.char)(unsafe.Pointer(&cparam.value)) = C.CString(*info.s)
+ } else if info.sl != nil {
+ count := stringOffsets[name]
+ *(**C.char)(unsafe.Pointer(&cparam.value)) = C.CString((*info.sl)[count])
+ stringOffsets[name] = count + 1
+ } else {
+ return fmt.Errorf("field %s expects a string", name)
+ }
+ }
+ }
+
+ return nil
+}
+
+func typedParamsPack(cparams []C.virTypedParameter, infomap map[string]typedParamsFieldInfo) error {
+ return typedParamsPackLen(&cparams[0], len(cparams), infomap)
+}
+
+func typedParamsPackNew(infomap map[string]typedParamsFieldInfo) (*[]C.virTypedParameter, error) {
+ nparams := 0
+ for _, value := range infomap {
+ if !*value.set {
+ continue
+ }
+
+ if value.sl != nil {
+ nparams += len(*value.sl)
+ } else {
+ nparams++
+ }
+ }
+
+ cparams := make([]C.virTypedParameter, nparams)
+ nparams = 0
+ for key, value := range infomap {
+ if !*value.set {
+ continue
+ }
+
+ cfield := C.CString(key)
+ defer C.free(unsafe.Pointer(cfield))
+ clen := len(key) + 1
+ if clen > C.VIR_TYPED_PARAM_FIELD_LENGTH {
+ clen = C.VIR_TYPED_PARAM_FIELD_LENGTH
+ }
+ if value.sl != nil {
+ for i := 0; i < len(*value.sl); i++ {
+ cparam := &cparams[nparams]
+ cparam._type = C.VIR_TYPED_PARAM_STRING
+ C.memcpy(unsafe.Pointer(&cparam.field[0]), unsafe.Pointer(cfield), C.size_t(clen))
+ nparams++
+ }
+ } else {
+ cparam := &cparams[nparams]
+ if value.i != nil {
+ cparam._type = C.VIR_TYPED_PARAM_INT
+ } else if value.ui != nil {
+ cparam._type = C.VIR_TYPED_PARAM_UINT
+ } else if value.l != nil {
+ cparam._type = C.VIR_TYPED_PARAM_LLONG
+ } else if value.ul != nil {
+ cparam._type = C.VIR_TYPED_PARAM_ULLONG
+ } else if value.b != nil {
+ cparam._type = C.VIR_TYPED_PARAM_BOOLEAN
+ } else if value.d != nil {
+ cparam._type = C.VIR_TYPED_PARAM_DOUBLE
+ } else if value.s != nil {
+ cparam._type = C.VIR_TYPED_PARAM_STRING
+ }
+ C.memcpy(unsafe.Pointer(&cparam.field[0]), unsafe.Pointer(cfield), C.size_t(clen))
+ nparams++
+ }
+ }
+
+ err := typedParamsPack(cparams, infomap)
+ if err != nil {
+ C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), C.int(nparams))
+ return nil, err
+ }
+ return &cparams, nil
+}