Re: [go PATCH] Add support for virNetworkPort object and APIs

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

 



On Tue, Jun 18, 2019 at 04:43:35PM +0100, Daniel P. Berrangé wrote:
> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> ---
>  network.go              |  80 ++++++++++++++
>  network_port.go         | 233 ++++++++++++++++++++++++++++++++++++++++
>  network_port_compat.h   |  67 ++++++++++++
>  network_port_wrapper.go | 197 +++++++++++++++++++++++++++++++++
>  network_port_wrapper.h  |  79 ++++++++++++++
>  network_wrapper.go      |  73 +++++++++++++
>  network_wrapper.h       |  23 ++++
>  7 files changed, 752 insertions(+)
>  create mode 100644 network_port.go
>  create mode 100644 network_port_compat.h
>  create mode 100644 network_port_wrapper.go
>  create mode 100644 network_port_wrapper.h


> diff --git a/network_port.go b/network_port.go
> new file mode 100644
> index 0000000..e701c2d
> --- /dev/null
> +++ b/network_port.go


> +func (n *NetworkPort) Delete(flags uint) error {
> +	if C.LIBVIR_VERSION_NUMBER < 5005000 {
> +		return makeNotImplementedError("virNetworkPortDelete")
> +	}
> +
> +	var err C.virError
> +	result := C.virNetworkPortDeleteWrapper(n.ptr, C.uint(flags), &err)
> +	if result == -1 {
> +		return makeError(&err)
> +	}
> +	return nil
> +}
> +
> +// See also https://libvirt.org/html/libvirt-libvirt-network.html#virNetworkPortGetXMLDesc
> +func (d *NetworkPort) GetXMLDesc(flags uint) (string, error) {

This method mmissed the version check. I've fixed locally the same way
as seen in other methods.

> +	var err C.virError
> +	result := C.virNetworkPortGetXMLDescWrapper(d.ptr, C.uint(flags), &err)
> +	if result == nil {
> +		return "", makeError(&err)
> +	}
> +	xml := C.GoString(result)
> +	C.free(unsafe.Pointer(result))
> +	return xml, nil
> +}

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