connect.go | 17 +++++++++++++++++ connect_wrapper.go | 13 +++++++++++++ connect_wrapper.h | 4 ++++ 3 files changed, 34 insertions(+)
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#virConnectGetStoragePoolCapabilities
+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)
+{
+ char * ret = virConnectGetStoragePoolCapabilities(conn, flags);
+ if (!ret) {
+ virCopyLastError(err);
+ }
+ return ret;
+}
+
+
////////////////////////////////////////////////
*/
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__ */
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
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#virConnectGetStoragePoolCapabilities > +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 > + 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> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
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#virConnectGetStoragePoolCapabilities > > +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 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Tue, Mar 12, 2019 at 12:03:32PM +0100, Erik Skultety wrote: > 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#virConnectGetStoragePoolCapabilities > > > +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? This code is the C glue layer - without this, we would not be able to compile against older libvirt. The other place is the pure Go layer and that check just avoids calling the C glue layer, since it would trigger this assert. > > > + 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 Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2024 Red Hat, Inc.