
On Tue, Mar 12, 2019 at 09:49:08AM +0000, Daniel P. Berrangé wrote:
On Tue, Mar 12, 2019 at 09:43:35AM +0100, Erik Skultety wrote:
Signed-off-by: Erik Skultety <eskultet@redhat.com> --- connect.go | 17 +++++++++++++++++ connect_wrapper.go | 13 +++++++++++++ connect_wrapper.h | 4 ++++ 3 files changed, 34 insertions(+)
diff --git a/connect.go b/connect.go index 0d5118c..04badfc 100644 --- a/connect.go +++ b/connect.go @@ -2985,3 +2985,20 @@ func (c *Connect) NWFilterBindingCreateXML(xmlConfig string, flags uint32) (*NWF } return &NWFilterBinding{ptr: ptr}, nil } + +// See also https://libvirt.org/html/libvirt-libvirt-storage.html#virConnectGetStoragePo... +func (c *Connect) GetStoragePoolCapabilities(flags uint32) (string, error) { + if C.LIBVIR_VERSION_NUMBER < 5002000 { + return "", makeNotImplementedError("virConnectGetStoragePoolCapabilities") + } + + var err C.virError + ret := C.virConnectGetStoragePoolCapabilitiesWrapper(c.ptr, C.uint(flags), &err) + if ret == nil { + return "", makeError(&err) + } + + defer C.free(unsafe.Pointer(ret)) + + return C.GoString(ret), nil +} diff --git a/connect_wrapper.go b/connect_wrapper.go index 89727d0..7be3361 100644 --- a/connect_wrapper.go +++ b/connect_wrapper.go @@ -1761,6 +1761,19 @@ virStreamNewWrapper(virConnectPtr conn, }
+char * +virConnectGetStoragePoolCapabilitiesWrapper(virConnectPtr conn, + unsigned int flags, + virErrorPtr err) +{
Need to add
#if LIBVIR_VERSION_NUMBER < 5002000 assert(0); // Caller should have checked version #else
Right, why do we need to add ^this anyway if the Go binding already has that check and since I added both the binding and the wrapper at the same time?
+ char * ret = virConnectGetStoragePoolCapabilities(conn, flags);
No space after the "*"
+ if (!ret) { + virCopyLastError(err); + } + return ret;
#endif
+} + + //////////////////////////////////////////////// */ import "C" diff --git a/connect_wrapper.h b/connect_wrapper.h index 5c282d2..2e57ebd 100644 --- a/connect_wrapper.h +++ b/connect_wrapper.h @@ -726,5 +726,9 @@ virStreamNewWrapper(virConnectPtr conn, unsigned int flags, virErrorPtr err);
+char * +virConnectGetStoragePoolCapabilitiesWrapper(virConnectPtr conn, + unsigned int flags, + virErrorPtr err);
#endif /* LIBVIRT_GO_CONNECT_WRAPPER_H__ */
With the conditional added:
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Will do, thanks. Erik