Re: [libvirt-go PATCH] connect: Add the new libvirt API virConnectGetStoragePoolCapabilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 12, 2019 at 09:43:35AM +0100, Erik Skultety wrote:
> Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>


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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux