The generator creates broken code for all these methods. Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> --- generator.py | 3 ++ libvirt-override-api.xml | 16 ++++++++ libvirt-override.c | 83 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+)
diff --git a/generator.py b/generator.py index cba9d47..426f007 100755 --- a/generator.py +++ b/generator.py @@ -430,6 +430,9 @@ skip_impl = ( 'virNetworkGetUUID', 'virNetworkGetUUIDString', 'virNetworkLookupByUUID', + 'virNetworkPortGetUUID', + 'virNetworkPortGetUUIDString', + 'virNetworkPortLookupByUUID', 'virDomainGetAutostart', 'virNetworkGetAutostart', 'virDomainBlockStats', diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 7a0d4c5..4ab403c 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -64,6 +64,12 @@ <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='uuid' type='const unsigned char *' info='the UUID string for the network, must be 16 bytes'/> </function> + <function name='virNetworkPortLookupByUUID' file='python'> + <info>Try to lookup a port on the given network based on its UUID.</info> + <return type='virNetworkPortPtr' info='a new network port object or NULL in case of failure'/> + <arg name='net' type='virNetworkPtr' info='pointer to the network object'/> + <arg name='uuid' type='const unsigned char *' info='the UUID string for the network port, must be 16 bytes'/> + </function> <function name='virDomainGetInfo' file='python'> <info>Extract information about a domain. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.</info> <return type='char *' info='the list of information or None in case of error'/> @@ -153,6 +159,16 @@ <return type='char *' info='the UUID string or None in case of error'/> <arg name='net' type='virNetworkPtr' info='a network object'/> </function> + <function name='virNetworkPortGetUUID' file='python'> + <info>Extract the UUID unique Identifier of a network port.</info> + <return type='char *' info='the 16 bytes string or None in case of error'/> + <arg name='domain' type='virNetworkPortPtr' info='a network port object'/> + </function> + <function name='virNetworkPortGetUUIDString' file='python'> + <info>Fetch globally unique ID of the network port as a string.</info> + <return type='char *' info='the UUID string or None in case of error'/> + <arg name='net' type='virNetworkPortPtr' info='a network port object'/> + </function> <function name='virStoragePoolGetUUID' file='python'> <info>Extract the UUID unique Identifier of a storage pool.</info> <return type='char *' info='the 16 bytes string or None in case of error'/> diff --git a/libvirt-override.c b/libvirt-override.c index 4e4c00a..2b39ace 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -10185,6 +10185,86 @@ libvirt_virNetworkPortGetParameters(PyObject *self ATTRIBUTE_UNUSED, virTypedParamsFree(params, nparams); return dict; } + +static PyObject * +libvirt_virNetworkPortGetUUID(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + unsigned char uuid[VIR_UUID_BUFLEN]; + virNetworkPortPtr port; + PyObject *pyobj_port; + int c_retval; + + if (!PyArg_ParseTuple(args, (char *)"O:virNetworkPortGetUUID", &pyobj_port)) + return NULL; + port = (virNetworkPortPtr) PyvirNetworkPort_Get(pyobj_port); + + if (port == NULL) + return VIR_PY_NONE; + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virNetworkPortGetUUID(port, &uuid[0]); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) + return VIR_PY_NONE; + + return libvirt_charPtrSizeWrap((char *) &uuid[0], VIR_UUID_BUFLEN); +} + +static PyObject * +libvirt_virNetworkPortGetUUIDString(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + char uuidstr[VIR_UUID_STRING_BUFLEN]; + virNetworkPortPtr port; + PyObject *pyobj_port; + int c_retval; + + if (!PyArg_ParseTuple(args, (char *)"O:virNetworkPortGetUUIDString", + &pyobj_port)) + return NULL; + port = (virNetworkPortPtr) PyvirNetworkPort_Get(pyobj_port); + + if (port == NULL) + return VIR_PY_NONE; + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virNetworkPortGetUUIDString(port, &uuidstr[0]); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) + return VIR_PY_NONE; + + return libvirt_constcharPtrWrap((char *) &uuidstr[0]); +} + +static PyObject * +libvirt_virNetworkPortLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + virNetworkPortPtr c_retval; + virNetworkPtr net; + PyObject *pyobj_net; + unsigned char *uuid; + int len; + + if (!PyArg_ParseTuple(args, (char *)"Oz#:virNetworkPortLookupByUUID", + &pyobj_net, &uuid, &len)) + return NULL; + net = (virNetworkPtr) PyvirNetwork_Get(pyobj_net); + + if ((uuid == NULL) || (len != VIR_UUID_BUFLEN)) + return VIR_PY_NONE; + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virNetworkPortLookupByUUID(net, uuid); + LIBVIRT_END_ALLOW_THREADS; + + return libvirt_virNetworkPortPtrWrap((virNetworkPortPtr) c_retval); +} + + #endif /* LIBVIR_CHECK_VERSION(5, 5, 0) */ #if LIBVIR_CHECK_VERSION(5, 7, 0) @@ -10535,6 +10615,9 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virNetworkListAllPorts", libvirt_virNetworkListAllPorts, METH_VARARGS, NULL}, {(char *) "virNetworkPortSetParameters", libvirt_virNetworkPortSetParameters, METH_VARARGS, NULL}, {(char *) "virNetworkPortGetParameters", libvirt_virNetworkPortGetParameters, METH_VARARGS, NULL}, + {(char *) "virNetworkPortGetUUID", libvirt_virNetworkPortGetUUID, METH_VARARGS, NULL}, + {(char *) "virNetworkPortGetUUIDString", libvirt_virNetworkPortGetUUIDString, METH_VARARGS, NULL}, + {(char *) "virNetworkPortLookupByUUID", libvirt_virNetworkPortLookupByUUID, METH_VARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(5, 5, 0) */ #if LIBVIR_CHECK_VERSION(5, 7, 0) {(char *) "virDomainGetGuestInfo", libvirt_virDomainGetGuestInfo, METH_VARARGS, NULL}, -- 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list