Create wrapper functions for each connect C API that accepts a
virErrorPtr parameter. This avoids accessing a thread local from a
goroutine which may race with other goroutines doing native API calls in
the same OS thread.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
connect.go | 700 ++++++++++--------
connect_wrapper.go | 1725 +++++++++++++++++++++++++++++++++++++++++---
connect_wrapper.h | 697 ++++++++++++++++--
error_test.go | 44 --
4 files changed, 2677 insertions(+), 489 deletions(-)
delete mode 100644 error_test.go
diff --git a/connect.go b/connect.go
index 5ea8c48..29e4fb0 100644
--- a/connect.go
+++ b/connect.go
@@ -309,8 +309,10 @@ func releaseConnectionData(c *Connect) {
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virGetVersion
func GetVersion() (uint32, error) {
var version C.ulong
- if err := C.virGetVersion(&version, nil, nil); err < 0 {
- return 0, GetLastError()
+ var err C.virError
+ ret := C.virGetVersionWrapper(&version, nil, nil, &err)
+ if ret < 0 {
+ return 0, makeError(&err)
}
return uint32(version), nil
}
@@ -322,9 +324,10 @@ func NewConnect(uri string) (*Connect, error) {
cUri = C.CString(uri)
defer C.free(unsafe.Pointer(cUri))
}
- ptr := C.virConnectOpen(cUri)
+ var err C.virError
+ ptr := C.virConnectOpenWrapper(cUri, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Connect{ptr: ptr}, nil
}
@@ -395,10 +398,11 @@ func NewConnectWithAuth(uri string, auth *ConnectAuth, flags
ConnectFlags) (*Con
callbackID := registerCallbackId(auth.Callback)
- ptr := C.virConnectOpenAuthWrapper(cUri, &ccredtype[0], C.uint(len(auth.CredType)),
C.int(callbackID), C.uint(flags))
+ 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, GetLastError()
+ return nil, makeError(&err)
}
return &Connect{ptr: ptr}, nil
}
@@ -410,18 +414,20 @@ func NewConnectReadOnly(uri string) (*Connect, error) {
cUri = C.CString(uri)
defer C.free(unsafe.Pointer(cUri))
}
- ptr := C.virConnectOpenReadOnly(cUri)
+ var err C.virError
+ ptr := C.virConnectOpenReadOnlyWrapper(cUri, &err)
if ptr == nil {
- return nil, GetLastError()
+ 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) {
- result := int(C.virConnectClose(c.ptr))
+ var err C.virError
+ result := int(C.virConnectCloseWrapper(c.ptr, &err))
if result == -1 {
- return result, GetLastError()
+ return result, makeError(&err)
}
if result == 0 {
// No more reference to this connection, release data.
@@ -433,9 +439,10 @@ func (c *Connect) Close() (int, error) {
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectRef
func (c *Connect) Ref() error {
- ret := C.virConnectRef(c.ptr)
+ var err C.virError
+ ret := C.virConnectRefWrapper(c.ptr, &err)
if ret == -1 {
- return GetLastError()
+ return makeError(&err)
}
return nil
}
@@ -449,11 +456,11 @@ type CloseCallback func(conn *Connect, reason ConnectCloseReason)
func (c *Connect) RegisterCloseCallback(callback CloseCallback) error {
c.UnregisterCloseCallback()
goCallbackId := registerCallbackId(callback)
- callbackPtr := unsafe.Pointer(C.closeCallbackHelper)
- res := C.virConnectRegisterCloseCallbackHelper(c.ptr,
C.virConnectCloseFunc(callbackPtr), C.long(goCallbackId))
+ var err C.virError
+ res := C.virConnectRegisterCloseCallbackWrapper(c.ptr, C.long(goCallbackId), &err)
if res != 0 {
freeCallbackId(goCallbackId)
- return GetLastError()
+ return makeError(&err)
}
connData := getConnectionData(c)
connData.closeCallbackId = &goCallbackId
@@ -466,10 +473,10 @@ func (c *Connect) UnregisterCloseCallback() error {
if connData.closeCallbackId == nil {
return nil
}
- callbackPtr := unsafe.Pointer(C.closeCallbackHelper)
- res := C.virConnectUnregisterCloseCallback(c.ptr, C.virConnectCloseFunc(callbackPtr))
+ var err C.virError
+ res := C.virConnectUnregisterCloseCallbackWrapper(c.ptr, &err)
if res != 0 {
- return GetLastError()
+ return makeError(&err)
}
connData.closeCallbackId = nil
return nil
@@ -487,9 +494,10 @@ func closeCallback(conn C.virConnectPtr, reason ConnectCloseReason,
goCallbackId
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetCapabilities
func (c *Connect) GetCapabilities() (string, error) {
- str := C.virConnectGetCapabilities(c.ptr)
+ var err C.virError
+ str := C.virConnectGetCapabilitiesWrapper(c.ptr, &err)
if str == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
capabilities := C.GoString(str)
C.free(unsafe.Pointer(str))
@@ -499,9 +507,10 @@ func (c *Connect) GetCapabilities() (string, error) {
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetInfo
func (c *Connect) GetNodeInfo() (*NodeInfo, error) {
var cinfo C.virNodeInfo
- result := C.virNodeGetInfo(c.ptr, &cinfo)
+ var err C.virError
+ result := C.virNodeGetInfoWrapper(c.ptr, &cinfo, &err)
if result == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NodeInfo{
Model: C.GoString((*C.char)(unsafe.Pointer(&cinfo.model[0]))),
@@ -521,9 +530,10 @@ func (ni *NodeInfo) GetMaxCPUs() uint32 {
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetHostname
func (c *Connect) GetHostname() (string, error) {
- str := C.virConnectGetHostname(c.ptr)
+ var err C.virError
+ str := C.virConnectGetHostnameWrapper(c.ptr, &err)
if str == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
hostname := C.GoString(str)
C.free(unsafe.Pointer(str))
@@ -533,17 +543,20 @@ func (c *Connect) GetHostname() (string, error) {
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetLibVersion
func (c *Connect) GetLibVersion() (uint32, error) {
var version C.ulong
- if err := C.virConnectGetLibVersion(c.ptr, &version); err < 0 {
- return 0, GetLastError()
+ 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) {
- str := C.virConnectGetType(c.ptr)
+ var err C.virError
+ str := C.virConnectGetTypeWrapper(c.ptr, &err)
if str == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
hypDriver := C.GoString(str)
return hypDriver, nil
@@ -551,9 +564,10 @@ func (c *Connect) GetType() (string, error) {
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsAlive
func (c *Connect) IsAlive() (bool, error) {
- result := C.virConnectIsAlive(c.ptr)
+ var err C.virError
+ result := C.virConnectIsAliveWrapper(c.ptr, &err)
if result == -1 {
- return false, GetLastError()
+ return false, makeError(&err)
}
if result == 1 {
return true, nil
@@ -563,9 +577,10 @@ func (c *Connect) IsAlive() (bool, error) {
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsEncrypted
func (c *Connect) IsEncrypted() (bool, error) {
- result := C.virConnectIsEncrypted(c.ptr)
+ var err C.virError
+ result := C.virConnectIsEncryptedWrapper(c.ptr, &err)
if result == -1 {
- return false, GetLastError()
+ return false, makeError(&err)
}
if result == 1 {
return true, nil
@@ -575,9 +590,10 @@ func (c *Connect) IsEncrypted() (bool, error) {
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectIsSecure
func (c *Connect) IsSecure() (bool, error) {
- result := C.virConnectIsSecure(c.ptr)
+ var err C.virError
+ result := C.virConnectIsSecureWrapper(c.ptr, &err)
if result == -1 {
- return false, GetLastError()
+ return false, makeError(&err)
}
if result == 1 {
return true, nil
@@ -589,12 +605,13 @@ func (c *Connect) IsSecure() (bool, error) {
func (c *Connect) ListDefinedDomains() ([]string, error) {
var names [1024](*C.char)
namesPtr := unsafe.Pointer(&names)
- numDomains := C.virConnectListDefinedDomains(
+ var err C.virError
+ numDomains := C.virConnectListDefinedDomainsWrapper(
c.ptr,
(**C.char)(namesPtr),
- 1024)
+ 1024, &err)
if numDomains == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
goNames := make([]string, numDomains)
for k := 0; k < int(numDomains); k++ {
@@ -608,9 +625,10 @@ func (c *Connect) ListDefinedDomains() ([]string, error) {
func (c *Connect) ListDomains() ([]uint32, error) {
var cDomainsIds [512](uint32)
cDomainsPointer := unsafe.Pointer(&cDomainsIds)
- numDomains := C.virConnectListDomains(c.ptr, (*C.int)(cDomainsPointer), 512)
+ var err C.virError
+ numDomains := C.virConnectListDomainsWrapper(c.ptr, (*C.int)(cDomainsPointer), 512,
&err)
if numDomains == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return cDomainsIds[:numDomains], nil
@@ -621,12 +639,13 @@ func (c *Connect) ListInterfaces() ([]string, error) {
const maxIfaces = 1024
var names [maxIfaces](*C.char)
namesPtr := unsafe.Pointer(&names)
- numIfaces := C.virConnectListInterfaces(
+ var err C.virError
+ numIfaces := C.virConnectListInterfacesWrapper(
c.ptr,
(**C.char)(namesPtr),
- maxIfaces)
+ maxIfaces, &err)
if numIfaces == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
goNames := make([]string, numIfaces)
for k := 0; k < int(numIfaces); k++ {
@@ -641,12 +660,13 @@ func (c *Connect) ListNetworks() ([]string, error) {
const maxNets = 1024
var names [maxNets](*C.char)
namesPtr := unsafe.Pointer(&names)
- numNetworks := C.virConnectListNetworks(
+ var err C.virError
+ numNetworks := C.virConnectListNetworksWrapper(
c.ptr,
(**C.char)(namesPtr),
- maxNets)
+ maxNets, &err)
if numNetworks == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
goNames := make([]string, numNetworks)
for k := 0; k < int(numNetworks); k++ {
@@ -661,12 +681,13 @@ func (c *Connect) ListNWFilters() ([]string, error) {
const maxFilters = 1024
var names [maxFilters](*C.char)
namesPtr := unsafe.Pointer(&names)
- numNWFilters := C.virConnectListNWFilters(
+ var err C.virError
+ numNWFilters := C.virConnectListNWFiltersWrapper(
c.ptr,
(**C.char)(namesPtr),
- maxFilters)
+ maxFilters, &err)
if numNWFilters == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
goNames := make([]string, numNWFilters)
for k := 0; k < int(numNWFilters); k++ {
@@ -681,12 +702,13 @@ func (c *Connect) ListStoragePools() ([]string, error) {
const maxPools = 1024
var names [maxPools](*C.char)
namesPtr := unsafe.Pointer(&names)
- numStoragePools := C.virConnectListStoragePools(
+ var err C.virError
+ numStoragePools := C.virConnectListStoragePoolsWrapper(
c.ptr,
(**C.char)(namesPtr),
- maxPools)
+ maxPools, &err)
if numStoragePools == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
goNames := make([]string, numStoragePools)
for k := 0; k < int(numStoragePools); k++ {
@@ -701,12 +723,13 @@ func (c *Connect) ListSecrets() ([]string, error) {
const maxSecrets = 1024
var uuids [maxSecrets](*C.char)
uuidsPtr := unsafe.Pointer(&uuids)
- numSecrets := C.virConnectListSecrets(
+ var err C.virError
+ numSecrets := C.virConnectListSecretsWrapper(
c.ptr,
(**C.char)(uuidsPtr),
- maxSecrets)
+ maxSecrets, &err)
if numSecrets == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
goUuids := make([]string, numSecrets)
for k := 0; k < int(numSecrets); k++ {
@@ -723,12 +746,13 @@ func (c *Connect) ListDevices(cap string, flags uint32) ([]string,
error) {
const maxNodeDevices = 1024
var uuids [maxNodeDevices](*C.char)
uuidsPtr := unsafe.Pointer(&uuids)
- numNodeDevices := C.virNodeListDevices(
+ var err C.virError
+ numNodeDevices := C.virNodeListDevicesWrapper(
c.ptr, ccap,
(**C.char)(uuidsPtr),
- maxNodeDevices, C.uint(flags))
+ maxNodeDevices, C.uint(flags), &err)
if numNodeDevices == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
goUuids := make([]string, numNodeDevices)
for k := 0; k < int(numNodeDevices); k++ {
@@ -740,9 +764,10 @@ func (c *Connect) ListDevices(cap string, flags uint32) ([]string,
error) {
// See also
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainLookupByID
func (c *Connect) LookupDomainById(id uint32) (*Domain, error) {
- ptr := C.virDomainLookupByID(c.ptr, C.int(id))
+ var err C.virError
+ ptr := C.virDomainLookupByIDWrapper(c.ptr, C.int(id), &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Domain{ptr: ptr}, nil
}
@@ -751,9 +776,10 @@ func (c *Connect) LookupDomainById(id uint32) (*Domain, error) {
func (c *Connect) LookupDomainByName(id string) (*Domain, error) {
cName := C.CString(id)
defer C.free(unsafe.Pointer(cName))
- ptr := C.virDomainLookupByName(c.ptr, cName)
+ var err C.virError
+ ptr := C.virDomainLookupByNameWrapper(c.ptr, cName, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Domain{ptr: ptr}, nil
}
@@ -762,9 +788,10 @@ func (c *Connect) LookupDomainByName(id string) (*Domain, error) {
func (c *Connect) LookupDomainByUUIDString(uuid string) (*Domain, error) {
cUuid := C.CString(uuid)
defer C.free(unsafe.Pointer(cUuid))
- ptr := C.virDomainLookupByUUIDString(c.ptr, cUuid)
+ var err C.virError
+ ptr := C.virDomainLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Domain{ptr: ptr}, nil
}
@@ -779,9 +806,10 @@ func (c *Connect) LookupDomainByUUID(uuid []byte) (*Domain, error) {
for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
cUuid[i] = C.uchar(uuid[i])
}
- ptr := C.virDomainLookupByUUID(c.ptr, &cUuid[0])
+ var err C.virError
+ ptr := C.virDomainLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Domain{ptr: ptr}, nil
}
@@ -790,9 +818,10 @@ func (c *Connect) LookupDomainByUUID(uuid []byte) (*Domain, error) {
func (c *Connect) DomainCreateXML(xmlConfig string, flags DomainCreateFlags) (*Domain,
error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virDomainCreateXML(c.ptr, cXml, C.uint(flags))
+ var err C.virError
+ ptr := C.virDomainCreateXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Domain{ptr: ptr}, nil
}
@@ -805,9 +834,10 @@ func (c *Connect) DomainCreateXMLWithFiles(xmlConfig string, files
[]os.File, fl
for i := 0; i < len(files); i++ {
cfiles[i] = C.int(files[i].Fd())
}
- ptr := C.virDomainCreateXMLWithFiles(c.ptr, cXml, C.uint(len(files)), (&cfiles[0]),
C.uint(flags))
+ 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, GetLastError()
+ return nil, makeError(&err)
}
return &Domain{ptr: ptr}, nil
}
@@ -816,9 +846,10 @@ func (c *Connect) DomainCreateXMLWithFiles(xmlConfig string, files
[]os.File, fl
func (c *Connect) DomainDefineXML(xmlConfig string) (*Domain, error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virDomainDefineXML(c.ptr, cXml)
+ var err C.virError
+ ptr := C.virDomainDefineXMLWrapper(c.ptr, cXml, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Domain{ptr: ptr}, nil
}
@@ -830,9 +861,10 @@ func (c *Connect) DomainDefineXMLFlags(xmlConfig string, flags
DomainDefineFlags
}
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virDomainDefineXMLFlagsWrapper(c.ptr, cXml, C.uint(flags))
+ var err C.virError
+ ptr := C.virDomainDefineXMLFlagsWrapper(c.ptr, cXml, C.uint(flags), &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Domain{ptr: ptr}, nil
}
@@ -842,12 +874,13 @@ func (c *Connect) ListDefinedInterfaces() ([]string, error) {
const maxIfaces = 1024
var names [maxIfaces](*C.char)
namesPtr := unsafe.Pointer(&names)
- numIfaces := C.virConnectListDefinedInterfaces(
+ var err C.virError
+ numIfaces := C.virConnectListDefinedInterfacesWrapper(
c.ptr,
(**C.char)(namesPtr),
- maxIfaces)
+ maxIfaces, &err)
if numIfaces == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
goNames := make([]string, numIfaces)
for k := 0; k < int(numIfaces); k++ {
@@ -862,12 +895,13 @@ func (c *Connect) ListDefinedNetworks() ([]string, error) {
const maxNets = 1024
var names [maxNets](*C.char)
namesPtr := unsafe.Pointer(&names)
- numNetworks := C.virConnectListDefinedNetworks(
+ var err C.virError
+ numNetworks := C.virConnectListDefinedNetworksWrapper(
c.ptr,
(**C.char)(namesPtr),
- maxNets)
+ maxNets, &err)
if numNetworks == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
goNames := make([]string, numNetworks)
for k := 0; k < int(numNetworks); k++ {
@@ -882,12 +916,13 @@ func (c *Connect) ListDefinedStoragePools() ([]string, error) {
const maxPools = 1024
var names [maxPools](*C.char)
namesPtr := unsafe.Pointer(&names)
- numStoragePools := C.virConnectListDefinedStoragePools(
+ var err C.virError
+ numStoragePools := C.virConnectListDefinedStoragePoolsWrapper(
c.ptr,
(**C.char)(namesPtr),
- maxPools)
+ maxPools, &err)
if numStoragePools == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
goNames := make([]string, numStoragePools)
for k := 0; k < int(numStoragePools); k++ {
@@ -899,90 +934,100 @@ func (c *Connect) ListDefinedStoragePools() ([]string, error) {
// See also
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectNumOfDefin...
func (c *Connect) NumOfDefinedDomains() (int, error) {
- result := int(C.virConnectNumOfDefinedDomains(c.ptr))
+ var err C.virError
+ result := int(C.virConnectNumOfDefinedDomainsWrapper(c.ptr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-interface.html#virConnectNumOfDe...
func (c *Connect) NumOfDefinedInterfaces() (int, error) {
- result := int(C.virConnectNumOfDefinedInterfaces(c.ptr))
+ var err C.virError
+ result := int(C.virConnectNumOfDefinedInterfacesWrapper(c.ptr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-network.html#virConnectNumOfDefi...
func (c *Connect) NumOfDefinedNetworks() (int, error) {
- result := int(C.virConnectNumOfDefinedNetworks(c.ptr))
+ var err C.virError
+ result := int(C.virConnectNumOfDefinedNetworksWrapper(c.ptr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectNumOfDefi...
func (c *Connect) NumOfDefinedStoragePools() (int, error) {
- result := int(C.virConnectNumOfDefinedStoragePools(c.ptr))
+ var err C.virError
+ result := int(C.virConnectNumOfDefinedStoragePoolsWrapper(c.ptr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectNumOfDomains
func (c *Connect) NumOfDomains() (int, error) {
- result := int(C.virConnectNumOfDomains(c.ptr))
+ var err C.virError
+ result := int(C.virConnectNumOfDomainsWrapper(c.ptr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectNumOfStor...
func (c *Connect) NumOfStoragePools() (int, error) {
- result := int(C.virConnectNumOfStoragePools(c.ptr))
+ var err C.virError
+ result := int(C.virConnectNumOfStoragePoolsWrapper(c.ptr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-interface.html#virConnectNumOfIn...
func (c *Connect) NumOfInterfaces() (int, error) {
- result := int(C.virConnectNumOfInterfaces(c.ptr))
+ var err C.virError
+ result := int(C.virConnectNumOfInterfacesWrapper(c.ptr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-network.html#virConnectNumOfNetw...
func (c *Connect) NumOfNetworks() (int, error) {
- result := int(C.virConnectNumOfNetworks(c.ptr))
+ var err C.virError
+ result := int(C.virConnectNumOfNetworksWrapper(c.ptr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virConnectNumOfNWF...
func (c *Connect) NumOfNWFilters() (int, error) {
- result := int(C.virConnectNumOfNWFilters(c.ptr))
+ var err C.virError
+ result := int(C.virConnectNumOfNWFiltersWrapper(c.ptr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-secret.html#virConnectNumOfSecrets
func (c *Connect) NumOfSecrets() (int, error) {
- result := int(C.virConnectNumOfSecrets(c.ptr))
+ var err C.virError
+ result := int(C.virConnectNumOfSecretsWrapper(c.ptr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
@@ -991,9 +1036,10 @@ func (c *Connect) NumOfSecrets() (int, error) {
func (c *Connect) NumOfDevices(cap string, flags uint32) (int, error) {
ccap := C.CString(cap)
defer C.free(unsafe.Pointer(ccap))
- result := int(C.virNodeNumOfDevices(c.ptr, ccap, C.uint(flags)))
+ var err C.virError
+ result := int(C.virNodeNumOfDevicesWrapper(c.ptr, ccap, C.uint(flags), &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
@@ -1002,9 +1048,10 @@ func (c *Connect) NumOfDevices(cap string, flags uint32) (int,
error) {
func (c *Connect) NetworkDefineXML(xmlConfig string) (*Network, error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virNetworkDefineXML(c.ptr, cXml)
+ var err C.virError
+ ptr := C.virNetworkDefineXMLWrapper(c.ptr, cXml, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Network{ptr: ptr}, nil
}
@@ -1013,9 +1060,10 @@ func (c *Connect) NetworkDefineXML(xmlConfig string) (*Network,
error) {
func (c *Connect) NetworkCreateXML(xmlConfig string) (*Network, error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virNetworkCreateXML(c.ptr, cXml)
+ var err C.virError
+ ptr := C.virNetworkCreateXMLWrapper(c.ptr, cXml, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Network{ptr: ptr}, nil
}
@@ -1024,9 +1072,10 @@ func (c *Connect) NetworkCreateXML(xmlConfig string) (*Network,
error) {
func (c *Connect) LookupNetworkByName(name string) (*Network, error) {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
- ptr := C.virNetworkLookupByName(c.ptr, cName)
+ var err C.virError
+ ptr := C.virNetworkLookupByNameWrapper(c.ptr, cName, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Network{ptr: ptr}, nil
}
@@ -1035,9 +1084,10 @@ func (c *Connect) LookupNetworkByName(name string) (*Network,
error) {
func (c *Connect) LookupNetworkByUUIDString(uuid string) (*Network, error) {
cUuid := C.CString(uuid)
defer C.free(unsafe.Pointer(cUuid))
- ptr := C.virNetworkLookupByUUIDString(c.ptr, cUuid)
+ var err C.virError
+ ptr := C.virNetworkLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Network{ptr: ptr}, nil
}
@@ -1052,29 +1102,32 @@ func (c *Connect) LookupNetworkByUUID(uuid []byte) (*Network,
error) {
for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
cUuid[i] = C.uchar(uuid[i])
}
- ptr := C.virNetworkLookupByUUID(c.ptr, &cUuid[0])
+ var err C.virError
+ ptr := C.virNetworkLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
if ptr == nil {
- return nil, GetLastError()
+ 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 {
- res := int(C.virConnectSetKeepAlive(c.ptr, C.int(interval), C.uint(count)))
+ 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 GetLastError()
+ return makeError(&err)
}
}
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetSysinfo
func (c *Connect) GetSysinfo(flags uint32) (string, error) {
- cStr := C.virConnectGetSysinfo(c.ptr, C.uint(flags))
+ var err C.virError
+ cStr := C.virConnectGetSysinfoWrapper(c.ptr, C.uint(flags), &err)
if cStr == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
info := C.GoString(cStr)
C.free(unsafe.Pointer(cStr))
@@ -1083,9 +1136,10 @@ func (c *Connect) GetSysinfo(flags uint32) (string, error) {
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetURI
func (c *Connect) GetURI() (string, error) {
- cStr := C.virConnectGetURI(c.ptr)
+ var err C.virError
+ cStr := C.virConnectGetURIWrapper(c.ptr, &err)
if cStr == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
uri := C.GoString(cStr)
C.free(unsafe.Pointer(cStr))
@@ -1099,9 +1153,10 @@ func (c *Connect) GetMaxVcpus(typeAttr string) (int, error) {
cTypeAttr = C.CString(typeAttr)
defer C.free(unsafe.Pointer(cTypeAttr))
}
- result := int(C.virConnectGetMaxVcpus(c.ptr, cTypeAttr))
+ var err C.virError
+ result := int(C.virConnectGetMaxVcpusWrapper(c.ptr, cTypeAttr, &err))
if result == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return result, nil
}
@@ -1110,9 +1165,10 @@ func (c *Connect) GetMaxVcpus(typeAttr string) (int, error) {
func (c *Connect) InterfaceDefineXML(xmlConfig string, flags uint32) (*Interface, error)
{
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virInterfaceDefineXML(c.ptr, cXml, C.uint(flags))
+ var err C.virError
+ ptr := C.virInterfaceDefineXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Interface{ptr: ptr}, nil
}
@@ -1121,9 +1177,10 @@ func (c *Connect) InterfaceDefineXML(xmlConfig string, flags
uint32) (*Interface
func (c *Connect) LookupInterfaceByName(name string) (*Interface, error) {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
- ptr := C.virInterfaceLookupByName(c.ptr, cName)
+ var err C.virError
+ ptr := C.virInterfaceLookupByNameWrapper(c.ptr, cName, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Interface{ptr: ptr}, nil
}
@@ -1132,9 +1189,10 @@ func (c *Connect) LookupInterfaceByName(name string) (*Interface,
error) {
func (c *Connect) LookupInterfaceByMACString(mac string) (*Interface, error) {
cName := C.CString(mac)
defer C.free(unsafe.Pointer(cName))
- ptr := C.virInterfaceLookupByMACString(c.ptr, cName)
+ var err C.virError
+ ptr := C.virInterfaceLookupByMACStringWrapper(c.ptr, cName, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Interface{ptr: ptr}, nil
}
@@ -1143,9 +1201,10 @@ func (c *Connect) LookupInterfaceByMACString(mac string)
(*Interface, error) {
func (c *Connect) StoragePoolDefineXML(xmlConfig string, flags uint32) (*StoragePool,
error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virStoragePoolDefineXML(c.ptr, cXml, C.uint(flags))
+ var err C.virError
+ ptr := C.virStoragePoolDefineXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &StoragePool{ptr: ptr}, nil
}
@@ -1154,9 +1213,10 @@ func (c *Connect) StoragePoolDefineXML(xmlConfig string, flags
uint32) (*Storage
func (c *Connect) StoragePoolCreateXML(xmlConfig string, flags StoragePoolCreateFlags)
(*StoragePool, error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virStoragePoolCreateXML(c.ptr, cXml, C.uint(flags))
+ var err C.virError
+ ptr := C.virStoragePoolCreateXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &StoragePool{ptr: ptr}, nil
}
@@ -1165,9 +1225,10 @@ func (c *Connect) StoragePoolCreateXML(xmlConfig string, flags
StoragePoolCreate
func (c *Connect) LookupStoragePoolByName(name string) (*StoragePool, error) {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
- ptr := C.virStoragePoolLookupByName(c.ptr, cName)
+ var err C.virError
+ ptr := C.virStoragePoolLookupByNameWrapper(c.ptr, cName, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &StoragePool{ptr: ptr}, nil
}
@@ -1176,9 +1237,10 @@ func (c *Connect) LookupStoragePoolByName(name string)
(*StoragePool, error) {
func (c *Connect) LookupStoragePoolByUUIDString(uuid string) (*StoragePool, error) {
cUuid := C.CString(uuid)
defer C.free(unsafe.Pointer(cUuid))
- ptr := C.virStoragePoolLookupByUUIDString(c.ptr, cUuid)
+ var err C.virError
+ ptr := C.virStoragePoolLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &StoragePool{ptr: ptr}, nil
}
@@ -1193,9 +1255,10 @@ func (c *Connect) LookupStoragePoolByUUID(uuid []byte)
(*StoragePool, error) {
for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
cUuid[i] = C.uchar(uuid[i])
}
- ptr := C.virStoragePoolLookupByUUID(c.ptr, &cUuid[0])
+ var err C.virError
+ ptr := C.virStoragePoolLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &StoragePool{ptr: ptr}, nil
}
@@ -1207,9 +1270,10 @@ func (c *Connect) LookupStoragePoolByTargetPath(path string)
(*StoragePool, erro
}
cPath := C.CString(path)
defer C.free(unsafe.Pointer(cPath))
- ptr := C.virStoragePoolLookupByTargetPathWrapper(c.ptr, cPath)
+ var err C.virError
+ ptr := C.virStoragePoolLookupByTargetPathWrapper(c.ptr, cPath, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &StoragePool{ptr: ptr}, nil
}
@@ -1218,9 +1282,10 @@ func (c *Connect) LookupStoragePoolByTargetPath(path string)
(*StoragePool, erro
func (c *Connect) NWFilterDefineXML(xmlConfig string) (*NWFilter, error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virNWFilterDefineXML(c.ptr, cXml)
+ var err C.virError
+ ptr := C.virNWFilterDefineXMLWrapper(c.ptr, cXml, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NWFilter{ptr: ptr}, nil
}
@@ -1229,9 +1294,10 @@ func (c *Connect) NWFilterDefineXML(xmlConfig string) (*NWFilter,
error) {
func (c *Connect) LookupNWFilterByName(name string) (*NWFilter, error) {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
- ptr := C.virNWFilterLookupByName(c.ptr, cName)
+ var err C.virError
+ ptr := C.virNWFilterLookupByNameWrapper(c.ptr, cName, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NWFilter{ptr: ptr}, nil
}
@@ -1240,9 +1306,10 @@ func (c *Connect) LookupNWFilterByName(name string) (*NWFilter,
error) {
func (c *Connect) LookupNWFilterByUUIDString(uuid string) (*NWFilter, error) {
cUuid := C.CString(uuid)
defer C.free(unsafe.Pointer(cUuid))
- ptr := C.virNWFilterLookupByUUIDString(c.ptr, cUuid)
+ var err C.virError
+ ptr := C.virNWFilterLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NWFilter{ptr: ptr}, nil
}
@@ -1257,9 +1324,10 @@ func (c *Connect) LookupNWFilterByUUID(uuid []byte) (*NWFilter,
error) {
for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
cUuid[i] = C.uchar(uuid[i])
}
- ptr := C.virNWFilterLookupByUUID(c.ptr, &cUuid[0])
+ var err C.virError
+ ptr := C.virNWFilterLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NWFilter{ptr: ptr}, nil
}
@@ -1271,9 +1339,10 @@ func (c *Connect) LookupNWFilterBindingByPortDev(name string)
(*NWFilterBinding,
}
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
- ptr := C.virNWFilterBindingLookupByPortDevWrapper(c.ptr, cName)
+ var err C.virError
+ ptr := C.virNWFilterBindingLookupByPortDevWrapper(c.ptr, cName, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NWFilterBinding{ptr: ptr}, nil
}
@@ -1282,9 +1351,10 @@ func (c *Connect) LookupNWFilterBindingByPortDev(name string)
(*NWFilterBinding,
func (c *Connect) LookupStorageVolByKey(key string) (*StorageVol, error) {
cKey := C.CString(key)
defer C.free(unsafe.Pointer(cKey))
- ptr := C.virStorageVolLookupByKey(c.ptr, cKey)
+ var err C.virError
+ ptr := C.virStorageVolLookupByKeyWrapper(c.ptr, cKey, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &StorageVol{ptr: ptr}, nil
}
@@ -1293,9 +1363,10 @@ func (c *Connect) LookupStorageVolByKey(key string) (*StorageVol,
error) {
func (c *Connect) LookupStorageVolByPath(path string) (*StorageVol, error) {
cPath := C.CString(path)
defer C.free(unsafe.Pointer(cPath))
- ptr := C.virStorageVolLookupByPath(c.ptr, cPath)
+ var err C.virError
+ ptr := C.virStorageVolLookupByPathWrapper(c.ptr, cPath, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &StorageVol{ptr: ptr}, nil
}
@@ -1304,9 +1375,10 @@ func (c *Connect) LookupStorageVolByPath(path string) (*StorageVol,
error) {
func (c *Connect) SecretDefineXML(xmlConfig string, flags uint32) (*Secret, error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virSecretDefineXML(c.ptr, cXml, C.uint(flags))
+ var err C.virError
+ ptr := C.virSecretDefineXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Secret{ptr: ptr}, nil
}
@@ -1321,9 +1393,10 @@ func (c *Connect) LookupSecretByUUID(uuid []byte) (*Secret, error)
{
for i := 0; i < C.VIR_UUID_BUFLEN; i++ {
cUuid[i] = C.uchar(uuid[i])
}
- ptr := C.virSecretLookupByUUID(c.ptr, &cUuid[0])
+ var err C.virError
+ ptr := C.virSecretLookupByUUIDWrapper(c.ptr, &cUuid[0], &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Secret{ptr: ptr}, nil
}
@@ -1332,9 +1405,10 @@ func (c *Connect) LookupSecretByUUID(uuid []byte) (*Secret, error)
{
func (c *Connect) LookupSecretByUUIDString(uuid string) (*Secret, error) {
cUuid := C.CString(uuid)
defer C.free(unsafe.Pointer(cUuid))
- ptr := C.virSecretLookupByUUIDString(c.ptr, cUuid)
+ var err C.virError
+ ptr := C.virSecretLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Secret{ptr: ptr}, nil
}
@@ -1343,9 +1417,10 @@ func (c *Connect) LookupSecretByUUIDString(uuid string) (*Secret,
error) {
func (c *Connect) LookupSecretByUsage(usageType SecretUsageType, usageID string)
(*Secret, error) {
cUsageID := C.CString(usageID)
defer C.free(unsafe.Pointer(cUsageID))
- ptr := C.virSecretLookupByUsage(c.ptr, C.int(usageType), cUsageID)
+ var err C.virError
+ ptr := C.virSecretLookupByUsageWrapper(c.ptr, C.int(usageType), cUsageID, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Secret{ptr: ptr}, nil
}
@@ -1354,9 +1429,10 @@ func (c *Connect) LookupSecretByUsage(usageType SecretUsageType,
usageID string)
func (c *Connect) LookupDeviceByName(id string) (*NodeDevice, error) {
cName := C.CString(id)
defer C.free(unsafe.Pointer(cName))
- ptr := C.virNodeDeviceLookupByName(c.ptr, cName)
+ var err C.virError
+ ptr := C.virNodeDeviceLookupByNameWrapper(c.ptr, cName, &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NodeDevice{ptr: ptr}, nil
}
@@ -1367,9 +1443,10 @@ func (c *Connect) LookupDeviceSCSIHostByWWN(wwnn, wwpn string,
flags uint32) (*N
cWwpn := C.CString(wwpn)
defer C.free(unsafe.Pointer(cWwnn))
defer C.free(unsafe.Pointer(cWwpn))
- ptr := C.virNodeDeviceLookupSCSIHostByWWN(c.ptr, cWwnn, cWwpn, C.uint(flags))
+ var err C.virError
+ ptr := C.virNodeDeviceLookupSCSIHostByWWNWrapper(c.ptr, cWwnn, cWwpn, C.uint(flags),
&err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NodeDevice{ptr: ptr}, nil
}
@@ -1378,9 +1455,10 @@ func (c *Connect) LookupDeviceSCSIHostByWWN(wwnn, wwpn string,
flags uint32) (*N
func (c *Connect) DeviceCreateXML(xmlConfig string, flags uint32) (*NodeDevice, error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virNodeDeviceCreateXML(c.ptr, cXml, C.uint(flags))
+ var err C.virError
+ ptr := C.virNodeDeviceCreateXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NodeDevice{ptr: ptr}, nil
}
@@ -1388,9 +1466,10 @@ func (c *Connect) DeviceCreateXML(xmlConfig string, flags uint32)
(*NodeDevice,
// See also
https://libvirt.org/html/libvirt-libvirt-interface.html#virConnectListAll...
func (c *Connect) ListAllInterfaces(flags ConnectListAllInterfacesFlags) ([]Interface,
error) {
var cList *C.virInterfacePtr
- numIfaces := C.virConnectListAllInterfaces(c.ptr, (**C.virInterfacePtr)(&cList),
C.uint(flags))
+ var err C.virError
+ numIfaces := C.virConnectListAllInterfacesWrapper(c.ptr,
(**C.virInterfacePtr)(&cList), C.uint(flags), &err)
if numIfaces == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
@@ -1409,9 +1488,10 @@ func (c *Connect) ListAllInterfaces(flags
ConnectListAllInterfacesFlags) ([]Inte
// See also
https://libvirt.org/html/libvirt-libvirt-network.html#virConnectListAllNe...
func (c *Connect) ListAllNetworks(flags ConnectListAllNetworksFlags) ([]Network, error)
{
var cList *C.virNetworkPtr
- numNets := C.virConnectListAllNetworks(c.ptr, (**C.virNetworkPtr)(&cList),
C.uint(flags))
+ var err C.virError
+ numNets := C.virConnectListAllNetworksWrapper(c.ptr, (**C.virNetworkPtr)(&cList),
C.uint(flags), &err)
if numNets == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
@@ -1430,9 +1510,10 @@ func (c *Connect) ListAllNetworks(flags
ConnectListAllNetworksFlags) ([]Network,
// See also
https://libvirt.org/html/libvirt-libvirt-domain.html#virConnectListAllDom...
func (c *Connect) ListAllDomains(flags ConnectListAllDomainsFlags) ([]Domain, error) {
var cList *C.virDomainPtr
- numDomains := C.virConnectListAllDomains(c.ptr, (**C.virDomainPtr)(&cList),
C.uint(flags))
+ var err C.virError
+ numDomains := C.virConnectListAllDomainsWrapper(c.ptr, (**C.virDomainPtr)(&cList),
C.uint(flags), &err)
if numDomains == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
@@ -1451,9 +1532,10 @@ func (c *Connect) ListAllDomains(flags ConnectListAllDomainsFlags)
([]Domain, er
// See also
https://libvirt.org/html/libvirt-libvirt-nwfilter.html#virConnectListAllN...
func (c *Connect) ListAllNWFilters(flags uint32) ([]NWFilter, error) {
var cList *C.virNWFilterPtr
- numNWFilters := C.virConnectListAllNWFilters(c.ptr, (**C.virNWFilterPtr)(&cList),
C.uint(flags))
+ var err C.virError
+ numNWFilters := C.virConnectListAllNWFiltersWrapper(c.ptr,
(**C.virNWFilterPtr)(&cList), C.uint(flags), &err)
if numNWFilters == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
@@ -1475,9 +1557,10 @@ func (c *Connect) ListAllNWFilterBindings(flags uint32)
([]NWFilterBinding, erro
if C.LIBVIR_VERSION_NUMBER < 4005000 {
return []NWFilterBinding{},
GetNotImplementedError("virConnectListAllNWFilterBindings")
}
- numNWFilters := C.virConnectListAllNWFilterBindingsWrapper(c.ptr,
(**C.virNWFilterBindingPtr)(&cList), C.uint(flags))
+ var err C.virError
+ numNWFilters := C.virConnectListAllNWFilterBindingsWrapper(c.ptr,
(**C.virNWFilterBindingPtr)(&cList), C.uint(flags), &err)
if numNWFilters == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
@@ -1496,9 +1579,10 @@ func (c *Connect) ListAllNWFilterBindings(flags uint32)
([]NWFilterBinding, erro
// See also
https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectListAllSt...
func (c *Connect) ListAllStoragePools(flags ConnectListAllStoragePoolsFlags)
([]StoragePool, error) {
var cList *C.virStoragePoolPtr
- numPools := C.virConnectListAllStoragePools(c.ptr, (**C.virStoragePoolPtr)(&cList),
C.uint(flags))
+ var err C.virError
+ numPools := C.virConnectListAllStoragePoolsWrapper(c.ptr,
(**C.virStoragePoolPtr)(&cList), C.uint(flags), &err)
if numPools == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
@@ -1517,9 +1601,10 @@ func (c *Connect) ListAllStoragePools(flags
ConnectListAllStoragePoolsFlags) ([]
// See also
https://libvirt.org/html/libvirt-libvirt-secret.html#virConnectListAllSec...
func (c *Connect) ListAllSecrets(flags ConnectListAllSecretsFlags) ([]Secret, error) {
var cList *C.virSecretPtr
- numPools := C.virConnectListAllSecrets(c.ptr, (**C.virSecretPtr)(&cList),
C.uint(flags))
+ var err C.virError
+ numPools := C.virConnectListAllSecretsWrapper(c.ptr, (**C.virSecretPtr)(&cList),
C.uint(flags), &err)
if numPools == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
@@ -1538,9 +1623,10 @@ func (c *Connect) ListAllSecrets(flags ConnectListAllSecretsFlags)
([]Secret, er
// See also
https://libvirt.org/html/libvirt-libvirt-nodedev.html#virConnectListAllNo...
func (c *Connect) ListAllNodeDevices(flags ConnectListAllNodeDeviceFlags) ([]NodeDevice,
error) {
var cList *C.virNodeDevicePtr
- numPools := C.virConnectListAllNodeDevices(c.ptr, (**C.virNodeDevicePtr)(&cList),
C.uint(flags))
+ var err C.virError
+ numPools := C.virConnectListAllNodeDevicesWrapper(c.ptr,
(**C.virNodeDevicePtr)(&cList), C.uint(flags), &err)
if numPools == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(cList)),
@@ -1558,27 +1644,30 @@ func (c *Connect) ListAllNodeDevices(flags
ConnectListAllNodeDeviceFlags) ([]Nod
// See also
https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceChang...
func (c *Connect) InterfaceChangeBegin(flags uint32) error {
- ret := C.virInterfaceChangeBegin(c.ptr, C.uint(flags))
+ var err C.virError
+ ret := C.virInterfaceChangeBeginWrapper(c.ptr, C.uint(flags), &err)
if ret == -1 {
- return GetLastError()
+ return makeError(&err)
}
return nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceChang...
func (c *Connect) InterfaceChangeCommit(flags uint32) error {
- ret := C.virInterfaceChangeCommit(c.ptr, C.uint(flags))
+ var err C.virError
+ ret := C.virInterfaceChangeCommitWrapper(c.ptr, C.uint(flags), &err)
if ret == -1 {
- return GetLastError()
+ return makeError(&err)
}
return nil
}
// See also
https://libvirt.org/html/libvirt-libvirt-interface.html#virInterfaceChang...
func (c *Connect) InterfaceChangeRollback(flags uint32) error {
- ret := C.virInterfaceChangeRollback(c.ptr, C.uint(flags))
+ var err C.virError
+ ret := C.virInterfaceChangeRollbackWrapper(c.ptr, C.uint(flags), &err)
if ret == -1 {
- return GetLastError()
+ return makeError(&err)
}
return nil
}
@@ -1598,10 +1687,11 @@ func (c *Connect) AllocPages(pageSizes map[int]int64, startCell
int, cellCount u
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))
+ (*C.ulonglong)(unsafe.Pointer(&ccounts)), C.int(startCell), C.uint(cellCount),
C.uint(flags), &err)
if ret == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return int(ret), nil
@@ -1611,9 +1701,10 @@ func (c *Connect) AllocPages(pageSizes map[int]int64, startCell
int, cellCount u
func (c *Connect) GetCPUMap(flags uint32) (map[int]bool, uint, error) {
var ccpumap *C.uchar
var conline C.uint
- ret := C.virNodeGetCPUMap(c.ptr, &ccpumap, &conline, C.uint(flags))
+ var err C.virError
+ ret := C.virNodeGetCPUMapWrapper(c.ptr, &ccpumap, &conline, C.uint(flags),
&err)
if ret == -1 {
- return map[int]bool{}, 0, GetLastError()
+ return map[int]bool{}, 0, makeError(&err)
}
defer C.free(unsafe.Pointer(ccpumap))
@@ -1649,15 +1740,16 @@ type NodeCPUStats struct {
func (c *Connect) GetCPUStats(cpuNum int, flags uint32) (*NodeCPUStats, error) {
var nparams C.int
- ret := C.virNodeGetCPUStats(c.ptr, C.int(cpuNum), nil, &nparams, C.uint(0))
+ var err C.virError
+ ret := C.virNodeGetCPUStatsWrapper(c.ptr, C.int(cpuNum), nil, &nparams, C.uint(0),
&err)
if ret == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
params := make([]C.virNodeCPUStats, nparams)
- ret = C.virNodeGetCPUStats(c.ptr, C.int(cpuNum),
(*C.virNodeCPUStats)(unsafe.Pointer(¶ms[0])), &nparams, C.uint(flags))
+ ret = C.virNodeGetCPUStatsWrapper(c.ptr, C.int(cpuNum),
(*C.virNodeCPUStats)(unsafe.Pointer(¶ms[0])), &nparams, C.uint(flags),
&err)
if ret == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
stats := &NodeCPUStats{}
@@ -1692,9 +1784,10 @@ func (c *Connect) GetCPUStats(cpuNum int, flags uint32)
(*NodeCPUStats, error) {
// 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)
- ret := C.virNodeGetCellsFreeMemory(c.ptr, (*C.ulonglong)(unsafe.Pointer(&cmem[0])),
C.int(startCell), C.int(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{}, GetLastError()
+ return []uint64{}, makeError(&err)
}
mem := make([]uint64, ret)
@@ -1707,9 +1800,10 @@ func (c *Connect) GetCellsFreeMemory(startCell int, maxCells int)
([]uint64, err
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetFreeMemory
func (c *Connect) GetFreeMemory() (uint64, error) {
- ret := C.virNodeGetFreeMemory(c.ptr)
+ var err C.virError
+ ret := C.virNodeGetFreeMemoryWrapper(c.ptr, &err)
if ret == 0 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return (uint64)(ret), nil
@@ -1727,10 +1821,11 @@ func (c *Connect) GetFreePages(pageSizes []uint64, startCell int,
maxCells uint,
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))
+ C.uint(maxCells), (*C.ulonglong)(unsafe.Pointer(&ccounts)), C.uint(flags),
&err)
if ret == -1 {
- return []uint64{}, GetLastError()
+ return []uint64{}, makeError(&err)
}
counts := make([]uint64, ret)
@@ -1804,22 +1899,23 @@ func (c *Connect) GetMemoryParameters(flags uint32)
(*NodeMemoryParameters, erro
var nparams C.int
- ret := C.virNodeGetMemoryParameters(c.ptr, nil, &nparams, C.uint(0))
+ var err C.virError
+ ret := C.virNodeGetMemoryParametersWrapper(c.ptr, nil, &nparams, C.uint(0),
&err)
if ret == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
cparams := make([]C.virTypedParameter, nparams)
- ret = C.virNodeGetMemoryParameters(c.ptr,
(*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags))
+ ret = C.virNodeGetMemoryParametersWrapper(c.ptr,
(*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags),
&err)
if ret == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])),
nparams)
- _, err := typedParamsUnpack(cparams, info)
- if err != nil {
- return nil, err
+ _, gerr := typedParamsUnpack(cparams, info)
+ if gerr != nil {
+ return nil, gerr
}
return params, nil
@@ -1840,15 +1936,16 @@ type NodeMemoryStats struct {
func (c *Connect) GetMemoryStats(cellNum int, flags uint32) (*NodeMemoryStats, error) {
var nparams C.int
- ret := C.virNodeGetMemoryStats(c.ptr, C.int(cellNum), nil, &nparams, 0)
+ var err C.virError
+ ret := C.virNodeGetMemoryStatsWrapper(c.ptr, C.int(cellNum), nil, &nparams, 0,
&err)
if ret == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
params := make([]C.virNodeMemoryStats, nparams)
- ret = C.virNodeGetMemoryStats(c.ptr, C.int(cellNum),
(*C.virNodeMemoryStats)(unsafe.Pointer(¶ms[0])), &nparams, C.uint(flags))
+ ret = C.virNodeGetMemoryStatsWrapper(c.ptr, C.int(cellNum),
(*C.virNodeMemoryStats)(unsafe.Pointer(¶ms[0])), &nparams, C.uint(flags),
&err)
if ret == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
stats := &NodeMemoryStats{}
@@ -1882,9 +1979,10 @@ type NodeSecurityModel struct {
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetSecurityModel
func (c *Connect) GetSecurityModel() (*NodeSecurityModel, error) {
var cmodel C.virSecurityModel
- ret := C.virNodeGetSecurityModel(c.ptr, &cmodel)
+ var err C.virError
+ ret := C.virNodeGetSecurityModelWrapper(c.ptr, &cmodel, &err)
if ret == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NodeSecurityModel{
@@ -1899,34 +1997,36 @@ func (c *Connect) SetMemoryParameters(params
*NodeMemoryParameters, flags uint32
var nparams C.int
- ret := C.virNodeGetMemoryParameters(c.ptr, nil, &nparams, 0)
+ var err C.virError
+ ret := C.virNodeGetMemoryParametersWrapper(c.ptr, nil, &nparams, 0, &err)
if ret == -1 {
- return GetLastError()
+ return makeError(&err)
}
cparams := make([]C.virTypedParameter, nparams)
- ret = C.virNodeGetMemoryParameters(c.ptr,
(*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0)
+ ret = C.virNodeGetMemoryParametersWrapper(c.ptr,
(*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
if ret == -1 {
- return GetLastError()
+ return makeError(&err)
}
defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])),
nparams)
- err := typedParamsPack(cparams, info)
- if err != nil {
- return err
+ gerr := typedParamsPack(cparams, info)
+ if gerr != nil {
+ return gerr
}
- ret = C.virNodeSetMemoryParameters(c.ptr,
(*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags))
+ 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 {
- ret := C.virNodeSuspendForDuration(c.ptr, C.uint(target), C.ulonglong(duration),
C.uint(flags))
+ var err C.virError
+ ret := C.virNodeSuspendForDurationWrapper(c.ptr, C.uint(target), C.ulonglong(duration),
C.uint(flags), &err)
if ret == -1 {
- return GetLastError()
+ return makeError(&err)
}
return nil
}
@@ -1938,10 +2038,11 @@ func (c *Connect) DomainSaveImageDefineXML(file string, xml
string, flags Domain
cxml := C.CString(xml)
defer C.free(unsafe.Pointer(cxml))
- ret := C.virDomainSaveImageDefineXML(c.ptr, cfile, cxml, C.uint(flags))
+ var err C.virError
+ ret := C.virDomainSaveImageDefineXMLWrapper(c.ptr, cfile, cxml, C.uint(flags),
&err)
if ret == -1 {
- return GetLastError()
+ return makeError(&err)
}
return nil
@@ -1952,10 +2053,11 @@ func (c *Connect) DomainSaveImageGetXMLDesc(file string, flags
DomainXMLFlags) (
cfile := C.CString(file)
defer C.free(unsafe.Pointer(cfile))
- ret := C.virDomainSaveImageGetXMLDesc(c.ptr, cfile, C.uint(flags))
+ var err C.virError
+ ret := C.virDomainSaveImageGetXMLDescWrapper(c.ptr, cfile, C.uint(flags), &err)
if ret == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
defer C.free(unsafe.Pointer(ret))
@@ -1971,9 +2073,10 @@ func (c *Connect) BaselineCPU(xmlCPUs []string, flags
ConnectBaselineCPUFlags) (
defer C.free(unsafe.Pointer(cxmlCPUs[i]))
}
- ret := C.virConnectBaselineCPU(c.ptr, &cxmlCPUs[0], C.uint(len(xmlCPUs)),
C.uint(flags))
+ var err C.virError
+ ret := C.virConnectBaselineCPUWrapper(c.ptr, &cxmlCPUs[0], C.uint(len(xmlCPUs)),
C.uint(flags), &err)
if ret == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
defer C.free(unsafe.Pointer(ret))
@@ -2010,10 +2113,11 @@ func (c *Connect) BaselineHypervisorCPU(emulator string, arch
string, machine st
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))
+ &cxmlCPUs[0], C.uint(len(xmlCPUs)), C.uint(flags), &err)
if ret == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
defer C.free(unsafe.Pointer(ret))
@@ -2026,9 +2130,10 @@ func (c *Connect) CompareCPU(xmlDesc string, flags
ConnectCompareCPUFlags) (CPUC
cxmlDesc := C.CString(xmlDesc)
defer C.free(unsafe.Pointer(cxmlDesc))
- ret := C.virConnectCompareCPU(c.ptr, cxmlDesc, C.uint(flags))
+ 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, GetLastError()
+ return CPU_COMPARE_ERROR, makeError(&err)
}
return CPUCompareResult(ret), nil
@@ -2061,9 +2166,10 @@ func (c *Connect) CompareHypervisorCPU(emulator string, arch
string, machine str
cxmlDesc := C.CString(xmlDesc)
defer C.free(unsafe.Pointer(cxmlDesc))
- ret := C.virConnectCompareHypervisorCPUWrapper(c.ptr, cemulator, carch, cmachine,
cvirttype, cxmlDesc, C.uint(flags))
+ 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, GetLastError()
+ return CPU_COMPARE_ERROR, makeError(&err)
}
return CPUCompareResult(ret), nil
@@ -2076,9 +2182,10 @@ func (c *Connect) DomainXMLFromNative(nativeFormat string,
nativeConfig string,
cnativeConfig := C.CString(nativeConfig)
defer C.free(unsafe.Pointer(cnativeConfig))
- ret := C.virConnectDomainXMLFromNative(c.ptr, cnativeFormat, cnativeConfig,
C.uint(flags))
+ var err C.virError
+ ret := C.virConnectDomainXMLFromNativeWrapper(c.ptr, cnativeFormat, cnativeConfig,
C.uint(flags), &err)
if ret == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
defer C.free(unsafe.Pointer(ret))
@@ -2093,9 +2200,10 @@ func (c *Connect) DomainXMLToNative(nativeFormat string, domainXml
string, flags
cdomainXml := C.CString(domainXml)
defer C.free(unsafe.Pointer(cdomainXml))
- ret := C.virConnectDomainXMLToNative(c.ptr, cnativeFormat, cdomainXml, C.uint(flags))
+ var err C.virError
+ ret := C.virConnectDomainXMLToNativeWrapper(c.ptr, cnativeFormat, cdomainXml,
C.uint(flags), &err)
if ret == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
defer C.free(unsafe.Pointer(ret))
@@ -2109,9 +2217,10 @@ func (c *Connect) GetCPUModelNames(arch string, flags uint32)
([]string, error)
defer C.free(unsafe.Pointer(carch))
var cmodels **C.char
- ret := C.virConnectGetCPUModelNames(c.ptr, carch, &cmodels, C.uint(flags))
+ var err C.virError
+ ret := C.virConnectGetCPUModelNamesWrapper(c.ptr, carch, &cmodels, C.uint(flags),
&err)
if ret == -1 {
- return []string{}, GetLastError()
+ return []string{}, makeError(&err)
}
models := make([]string, int(ret))
@@ -2152,9 +2261,10 @@ func (c *Connect) GetDomainCapabilities(emulatorbin string, arch
string, machine
defer C.free(unsafe.Pointer(cvirttype))
}
- ret := C.virConnectGetDomainCapabilitiesWrapper(c.ptr, cemulatorbin, carch, cmachine,
cvirttype, C.uint(flags))
+ var err C.virError
+ ret := C.virConnectGetDomainCapabilitiesWrapper(c.ptr, cemulatorbin, carch, cmachine,
cvirttype, C.uint(flags), &err)
if ret == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
defer C.free(unsafe.Pointer(ret))
@@ -2165,9 +2275,10 @@ func (c *Connect) GetDomainCapabilities(emulatorbin string, arch
string, machine
// See also
https://libvirt.org/html/libvirt-libvirt-host.html#virConnectGetVersion
func (c *Connect) GetVersion() (uint32, error) {
var hvVer C.ulong
- ret := C.virConnectGetVersion(c.ptr, &hvVer)
+ var err C.virError
+ ret := C.virConnectGetVersionWrapper(c.ptr, &hvVer, &err)
if ret == -1 {
- return 0, GetLastError()
+ return 0, makeError(&err)
}
return uint32(hvVer), nil
@@ -2182,9 +2293,10 @@ func (c *Connect) FindStoragePoolSources(pooltype string, srcSpec
string, flags
csrcSpec := C.CString(srcSpec)
defer C.free(unsafe.Pointer(csrcSpec))
}
- ret := C.virConnectFindStoragePoolSources(c.ptr, cpooltype, csrcSpec, C.uint(flags))
+ var err C.virError
+ ret := C.virConnectFindStoragePoolSourcesWrapper(c.ptr, cpooltype, csrcSpec,
C.uint(flags), &err)
if ret == nil {
- return "", GetLastError()
+ return "", makeError(&err)
}
defer C.free(unsafe.Pointer(ret))
@@ -2196,8 +2308,9 @@ func (c *Connect) FindStoragePoolSources(pooltype string, srcSpec
string, flags
func (c *Connect) DomainRestore(srcFile string) error {
cPath := C.CString(srcFile)
defer C.free(unsafe.Pointer(cPath))
- if result := C.virDomainRestore(c.ptr, cPath); result == -1 {
- return GetLastError()
+ var err C.virError
+ if result := C.virDomainRestoreWrapper(c.ptr, cPath, &err); result == -1 {
+ return makeError(&err)
}
return nil
}
@@ -2211,17 +2324,19 @@ func (c *Connect) DomainRestoreFlags(srcFile, xmlConf string,
flags DomainSaveRe
cXmlConf = C.CString(xmlConf)
defer C.free(unsafe.Pointer(cXmlConf))
}
- if result := C.virDomainRestoreFlags(c.ptr, cPath, cXmlConf, C.uint(flags)); result ==
-1 {
- return GetLastError()
+ 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) {
- virStream := C.virStreamNew(c.ptr, C.uint(flags))
+ var err C.virError
+ virStream := C.virStreamNewWrapper(c.ptr, C.uint(flags), &err)
if virStream == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &Stream{
@@ -2665,18 +2780,19 @@ func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes
DomainStatsTypes,
}
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))
+ 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))
+ ret = C.virConnectGetAllDomainStatsWrapper(c.ptr, C.uint(statsTypes), &cstats,
C.uint(flags), &err)
}
if ret == -1 {
- return []DomainStats{}, GetLastError()
+ return []DomainStats{}, makeError(&err)
}
defer C.virDomainStatsRecordListFreeWrapper(cstats)
@@ -2692,9 +2808,9 @@ func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes
DomainStatsTypes,
state := &DomainStatsState{}
stateInfo := getDomainStatsStateFieldInfo(state)
- count, err := typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
stateInfo)
- if err != nil {
- return []DomainStats{}, err
+ count, gerr := typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
stateInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
}
if count != 0 {
domstats.State = state
@@ -2703,9 +2819,9 @@ func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes
DomainStatsTypes,
cpu := &DomainStatsCPU{}
cpuInfo := getDomainStatsCPUFieldInfo(cpu)
- count, err = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), cpuInfo)
- if err != nil {
- return []DomainStats{}, err
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), cpuInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
}
if count != 0 {
domstats.Cpu = cpu
@@ -2714,9 +2830,9 @@ func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes
DomainStatsTypes,
balloon := &DomainStatsBalloon{}
balloonInfo := getDomainStatsBalloonFieldInfo(balloon)
- count, err = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
balloonInfo)
- if err != nil {
- return []DomainStats{}, err
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
balloonInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
}
if count != 0 {
domstats.Balloon = balloon
@@ -2725,9 +2841,9 @@ func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes
DomainStatsTypes,
perf := &DomainStatsPerf{}
perfInfo := getDomainStatsPerfFieldInfo(perf)
- count, err = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), perfInfo)
- if err != nil {
- return []DomainStats{}, err
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), perfInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
}
if count != 0 {
domstats.Perf = perf
@@ -2736,9 +2852,9 @@ func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes
DomainStatsTypes,
lengths := domainStatsLengths{}
lengthsInfo := getDomainStatsLengthsFieldInfo(&lengths)
- count, err = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
lengthsInfo)
- if err != nil {
- return []DomainStats{}, err
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
lengthsInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
}
if !lengths.VcpuMaximumSet && lengths.VcpuCurrentSet {
@@ -2752,9 +2868,9 @@ func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes
DomainStatsTypes,
vcpu := DomainStatsVcpu{}
vcpuInfo := getDomainStatsVcpuFieldInfo(j, &vcpu)
- count, err = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
vcpuInfo)
- if err != nil {
- return []DomainStats{}, err
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
vcpuInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
}
if count == 0 {
vcpu.StateSet = true
@@ -2770,9 +2886,9 @@ func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes
DomainStatsTypes,
block := DomainStatsBlock{}
blockInfo := getDomainStatsBlockFieldInfo(j, &block)
- count, err = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
blockInfo)
- if err != nil {
- return []DomainStats{}, err
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
blockInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
}
if count != 0 {
domstats.Block[j] = block
@@ -2786,9 +2902,9 @@ func (c *Connect) GetAllDomainStats(doms []*Domain, statsTypes
DomainStatsTypes,
net := DomainStatsNet{}
netInfo := getDomainStatsNetFieldInfo(j, &net)
- count, err = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams), netInfo)
- if err != nil {
- return []DomainStats{}, err
+ count, gerr = typedParamsUnpackLen(cdomstats.params, int(cdomstats.nparams),
netInfo)
+ if gerr != nil {
+ return []DomainStats{}, gerr
}
if count != 0 {
domstats.Net[j] = net
@@ -2846,16 +2962,17 @@ func (c *Connect) GetSEVInfo(flags uint32) (*NodeSEVParameters,
error) {
var cparams *C.virTypedParameter
var nparams C.int
- ret := C.virNodeGetSEVInfoWrapper(c.ptr,
(*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags))
+ var err C.virError
+ ret := C.virNodeGetSEVInfoWrapper(c.ptr,
(*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags),
&err)
if ret == -1 {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
defer C.virTypedParamsFree(cparams, nparams)
- _, err := typedParamsUnpackLen(cparams, int(nparams), info)
- if err != nil {
- return nil, err
+ _, gerr := typedParamsUnpackLen(cparams, int(nparams), info)
+ if gerr != nil {
+ return nil, gerr
}
return params, nil
@@ -2868,9 +2985,10 @@ func (c *Connect) NWFilterBindingCreateXML(xmlConfig string, flags
uint32) (*NWF
}
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
- ptr := C.virNWFilterBindingCreateXMLWrapper(c.ptr, cXml, C.uint(flags))
+ var err C.virError
+ ptr := C.virNWFilterBindingCreateXMLWrapper(c.ptr, cXml, C.uint(flags), &err)
if ptr == nil {
- return nil, GetLastError()
+ return nil, makeError(&err)
}
return &NWFilterBinding{ptr: ptr}, nil
}
diff --git a/connect_wrapper.go b/connect_wrapper.go
index d714fb9..17800a2 100644
--- a/connect_wrapper.go
+++ b/connect_wrapper.go
@@ -29,6 +29,7 @@ package libvirt
/*
#cgo pkg-config: libvirt
#include <assert.h>
+#include <stdio.h>
#include "connect_wrapper.h"
#include "callbacks_wrapper.h"
@@ -38,14 +39,6 @@ void closeCallbackHelper(virConnectPtr conn, int reason, void *opaque)
closeCallback(conn, reason, (long)opaque);
}
-int virConnectRegisterCloseCallbackHelper(virConnectPtr c, virConnectCloseFunc cb, long
goCallbackId)
-{
- void *id = (void*)goCallbackId;
- return virConnectRegisterCloseCallback(c, cb, id, freeGoCallbackHelper);
-}
-
-#include <stdio.h>
-
extern int connectAuthCallback(virConnectCredentialPtr, unsigned int, int);
int connectAuthCallbackHelper(virConnectCredentialPtr cred, unsigned int ncred, void
*cbdata)
{
@@ -54,188 +47,1720 @@ int connectAuthCallbackHelper(virConnectCredentialPtr cred,
unsigned int ncred,
return connectAuthCallback(cred, ncred, *callbackID);
}
-virConnectPtr virConnectOpenAuthWrapper(const char *name, int *credtype, uint ncredtype,
int callbackID, unsigned int flags)
-{
- virConnectAuth auth = {
- .credtype = credtype,
- .ncredtype = ncredtype,
- .cb = connectAuthCallbackHelper,
- .cbdata = &callbackID,
- };
- return virConnectOpenAuth(name, &auth, flags);
+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;
}
-int virNodeGetFreePagesWrapper(virConnectPtr conn,
- unsigned int npages,
- unsigned int *pages,
- int startcell,
- unsigned int cellcount,
- unsigned long long *counts,
- unsigned int flags)
+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 < 1002006
+#if LIBVIR_VERSION_NUMBER < 4004000
assert(0); // Caller should have checked version
#else
- return virNodeGetFreePages(conn, npages, pages, startcell, cellcount, counts,
flags);
+ char * ret = virConnectBaselineHypervisorCPU(conn, emulator, arch, machine, virttype,
xmlCPUs, ncpus, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-char * virConnectGetDomainCapabilitiesWrapper(virConnectPtr conn,
- const char *emulatorbin,
- const char *arch,
- const char *machine,
- const char *virttype,
- unsigned int flags)
+
+int
+virConnectCloseWrapper(virConnectPtr conn,
+ virErrorPtr err)
{
-#if LIBVIR_VERSION_NUMBER < 1002007
+ 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
- return virConnectGetDomainCapabilities(conn, emulatorbin, arch, machine, virttype,
flags);
+ int ret = virConnectCompareHypervisorCPU(conn, emulator, arch, machine, virttype,
xmlCPU, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-int virConnectGetAllDomainStatsWrapper(virConnectPtr conn,
- unsigned int stats,
- virDomainStatsRecordPtr **retStats,
- unsigned int flags)
+
+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
- return virConnectGetAllDomainStats(conn, stats, retStats, flags);
+ int ret = virConnectGetAllDomainStats(conn, stats, retStats, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-int virDomainListGetStatsWrapper(virDomainPtr *doms,
- unsigned int stats,
- virDomainStatsRecordPtr **retStats,
- unsigned int flags)
+
+int
+virConnectGetCPUModelNamesWrapper(virConnectPtr conn,
+ const char *arch,
+ char ** *models,
+ unsigned int flags,
+ virErrorPtr err)
{
-#if LIBVIR_VERSION_NUMBER < 1002008
+ 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
- return virDomainListGetStats(doms, stats, retStats, flags);
+ char * ret = virConnectGetDomainCapabilities(conn, emulatorbin, arch, machine,
virttype, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-void virDomainStatsRecordListFreeWrapper(virDomainStatsRecordPtr *stats)
+
+char *
+virConnectGetHostnameWrapper(virConnectPtr conn,
+ virErrorPtr err)
{
+ char * ret = virConnectGetHostname(conn);
+ 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)
+
+int
+virConnectGetLibVersionWrapper(virConnectPtr conn,
+ unsigned long *libVer,
+ virErrorPtr err)
{
-#if LIBVIR_VERSION_NUMBER < 1002009
+ 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
- return virNodeAllocPages(conn, npages, pageSizes, pageCounts, startCell, cellCount,
flags);
+ int ret = virConnectListAllNWFilterBindings(conn, bindings, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-virDomainPtr virDomainDefineXMLFlagsWrapper(virConnectPtr conn,
- const char *xml,
- unsigned int flags)
+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,
+ uint 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
- return virDomainDefineXMLFlags(conn, xml, flags);
+ virDomainPtr ret = virDomainDefineXMLFlags(conn, xml, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-virStoragePoolPtr virStoragePoolLookupByTargetPathWrapper(virConnectPtr conn,
- const char *path)
+
+int
+virDomainListGetStatsWrapper(virDomainPtr *doms,
+ unsigned int stats,
+ virDomainStatsRecordPtr **retStats,
+ unsigned int flags,
+ virErrorPtr err)
{
-#if LIBVIR_VERSION_NUMBER < 4001000
+#if LIBVIR_VERSION_NUMBER < 1002008
assert(0); // Caller should have checked version
#else
- return virStoragePoolLookupByTargetPath(conn, path);
+ int ret = virDomainListGetStats(doms, stats, retStats, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-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)
+
+virDomainPtr
+virDomainLookupByIDWrapper(virConnectPtr conn,
+ int id,
+ virErrorPtr err)
{
-#if LIBVIR_VERSION_NUMBER < 4004000
+ 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
- return virConnectBaselineHypervisorCPU(conn, emulator, arch, machine, virttype,
xmlCPUs, ncpus, flags);
+ virDomainStatsRecordListFree(stats);
#endif
}
-int virConnectCompareHypervisorCPUWrapper(virConnectPtr conn,
- const char *emulator,
- const char *arch,
- const char *machine,
- const char *virttype,
- const char *xmlCPU,
- unsigned int flags)
+
+int
+virGetVersionWrapper(unsigned long *libVer,
+ const char *type,
+ unsigned long *typeVer,
+ virErrorPtr err)
{
-#if LIBVIR_VERSION_NUMBER < 4004000
+ 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
- return virConnectCompareHypervisorCPU(conn, emulator, arch, machine, virttype,
xmlCPU, flags);
+ virNWFilterBindingPtr ret = virNWFilterBindingCreateXML(conn, xml, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-int virNodeGetSEVInfoWrapper(virConnectPtr conn,
- virTypedParameterPtr *params,
- int *nparams,
- unsigned int flags)
+
+virNWFilterBindingPtr
+virNWFilterBindingLookupByPortDevWrapper(virConnectPtr conn,
+ const char *portdev,
+ virErrorPtr err)
{
#if LIBVIR_VERSION_NUMBER < 4005000
assert(0); // Caller should have checked version
#else
- return virNodeGetSEVInfo(conn, params, nparams, flags);
+ virNWFilterBindingPtr ret = virNWFilterBindingLookupByPortDev(conn, portdev);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-int virConnectListAllNWFilterBindingsWrapper(virConnectPtr conn,
- virNWFilterBindingPtr **bindings,
- unsigned int flags)
+
+virNWFilterPtr
+virNWFilterDefineXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ virErrorPtr err)
{
-#if LIBVIR_VERSION_NUMBER < 4005000
+ 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
- return virConnectListAllNWFilterBindings(conn, bindings, flags);
+ int ret = virNodeAllocPages(conn, npages, pageSizes, pageCounts, startCell,
cellCount, flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-virNWFilterBindingPtr virNWFilterBindingCreateXMLWrapper(virConnectPtr conn,
- const char *xml,
- unsigned int flags)
+
+virNodeDevicePtr
+virNodeDeviceCreateXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err)
{
-#if LIBVIR_VERSION_NUMBER < 4005000
+ 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
- return virNWFilterBindingCreateXML(conn, xml, flags);
+ int ret = virNodeGetFreePages(conn, npages, pages, startCell, cellCount, counts,
flags);
+ if (ret < 0) {
+ virCopyLastError(err);
+ }
+ return ret;
#endif
}
-virNWFilterBindingPtr virNWFilterBindingLookupByPortDevWrapper(virConnectPtr conn,
- const char *portdev)
+
+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
- return virNWFilterBindingLookupByPortDev(conn, portdev);
+ 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/connect_wrapper.h b/connect_wrapper.h
index 726d29c..e91811f 100644
--- a/connect_wrapper.h
+++ b/connect_wrapper.h
@@ -41,21 +41,82 @@ virConnectRegisterCloseCallbackHelper(virConnectPtr c,
virConnectCloseFunc cb,
long goCallbackId);
-virConnectPtr
-virConnectOpenAuthWrapper(const char *name,
- int *credtype,
- uint ncredtype,
- int callbackID,
- unsigned int flags);
+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
-virNodeGetFreePagesWrapper(virConnectPtr conn,
- unsigned int npages,
- unsigned int *pages,
- int startcell,
- unsigned int cellcount,
- unsigned long long *counts,
- unsigned int flags);
+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,
@@ -63,24 +124,415 @@ virConnectGetDomainCapabilitiesWrapper(virConnectPtr conn,
const char *arch,
const char *machine,
const char *virttype,
- unsigned int flags);
+ unsigned int flags,
+ virErrorPtr err);
+
+char *
+virConnectGetHostnameWrapper(virConnectPtr conn,
+ virErrorPtr err);
int
-virConnectGetAllDomainStatsWrapper(virConnectPtr conn,
- unsigned int stats,
- virDomainStatsRecordPtr **retStats,
- unsigned int flags);
+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,
+ uint 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);
+ 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,
@@ -88,54 +540,191 @@ virNodeAllocPagesWrapper(virConnectPtr conn,
unsigned long long *pageCounts,
int startCell,
unsigned int cellCount,
- unsigned int flags);
+ unsigned int flags,
+ virErrorPtr err);
-virDomainPtr
-virDomainDefineXMLFlagsWrapper(virConnectPtr conn,
- const char *xml,
- unsigned int flags);
+virNodeDevicePtr
+virNodeDeviceCreateXMLWrapper(virConnectPtr conn,
+ const char *xmlDesc,
+ unsigned int flags,
+ virErrorPtr err);
-virStoragePoolPtr
-virStoragePoolLookupByTargetPathWrapper(virConnectPtr conn,
- const char *path);
+virNodeDevicePtr
+virNodeDeviceLookupByNameWrapper(virConnectPtr conn,
+ const char *name,
+ 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);
+virNodeDevicePtr
+virNodeDeviceLookupSCSIHostByWWNWrapper(virConnectPtr conn,
+ const char *wwnn,
+ const char *wwpn,
+ 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);
+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);
+ unsigned int flags,
+ virErrorPtr err);
int
-virConnectListAllNWFilterBindingsWrapper(virConnectPtr conn,
- virNWFilterBindingPtr **bindings,
- unsigned int flags);
+virNodeGetSecurityModelWrapper(virConnectPtr conn,
+ virSecurityModelPtr secmodel,
+ virErrorPtr err);
-virNWFilterBindingPtr
-virNWFilterBindingCreateXMLWrapper(virConnectPtr conn,
- const char *xml,
- unsigned int flags);
+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);
-virNWFilterBindingPtr
-virNWFilterBindingLookupByPortDevWrapper(virConnectPtr conn,
- const char *portdev);
#endif /* LIBVIRT_GO_CONNECT_WRAPPER_H__ */
diff --git a/error_test.go b/error_test.go
deleted file mode 100644
index c2ea462..0000000
--- a/error_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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 (
- "reflect"
- "testing"
-)
-
-func TestGetLastError(t *testing.T) {
- _, err := NewConnect("invalid_transport:///default")
- if err == nil {
- t.Fatalf("Expected an error when creating invalid connection")
- }
- got := GetLastError()
- expected := Error{0, 0, "Missing error", 0}
- if !reflect.DeepEqual(got, expected) {
- t.Errorf("Expected error %+v, got %+v", expected, got)
- }
-}
--
2.17.1