diff options
author | Daniel Veillard <veillard@redhat.com> | 2008-06-10 15:20:25 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2008-06-10 15:20:25 +0000 |
commit | 1b58a90c1a40d555fd82d91e89f8cf0a51042059 (patch) | |
tree | 803bfbe1ceb0281830488057f0211e14a4ef653b | |
parent | 93fe0e8f5d189dd4eecb8554d1691d3575f93817 (diff) | |
download | libvirt-python-v6-1b58a90c1a40d555fd82d91e89f8cf0a51042059.tar.gz libvirt-python-v6-1b58a90c1a40d555fd82d91e89f8cf0a51042059.tar.xz libvirt-python-v6-1b58a90c1a40d555fd82d91e89f8cf0a51042059.zip |
* python/generator.py python/libvir.c python/libvirt-python-api.xml:
Apply patch from Cole Robinson fixing UUIDString for python
Daniel
-rwxr-xr-x | generator.py | 5 | ||||
-rw-r--r-- | libvir.c | 82 | ||||
-rw-r--r-- | libvirt-python-api.xml | 20 |
3 files changed, 105 insertions, 2 deletions
diff --git a/generator.py b/generator.py index 68a7203..1514c02 100755 --- a/generator.py +++ b/generator.py @@ -291,8 +291,10 @@ skip_impl = ( 'virDomainGetInfo', 'virNodeGetInfo', 'virDomainGetUUID', + 'virDomainGetUUIDString', 'virDomainLookupByUUID', 'virNetworkGetUUID', + 'virNetworkGetUUIDString', 'virNetworkLookupByUUID', 'virDomainGetAutostart', 'virNetworkGetAutostart', @@ -305,9 +307,8 @@ skip_impl = ( 'virDomainGetVcpus', 'virDomainPinVcpu', 'virStoragePoolGetUUID', + 'virStoragePoolGetUUIDString', 'virStoragePoolLookupByUUID', - 'virStorageVolGetUUID', - 'virStorageVolLookupByUUID', 'virStoragePoolGetInfo', 'virStorageVolGetInfo', 'virStoragePoolGetAutostart', @@ -864,6 +864,33 @@ libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } static PyObject * +libvirt_virDomainGetUUIDString(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) { + PyObject *py_retval; + char uuidstr[VIR_UUID_STRING_BUFLEN]; + virDomainPtr dom; + PyObject *pyobj_dom; + int c_retval; + + if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetUUIDString", + &pyobj_dom)) + return(NULL); + dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom); + + if (dom == NULL) + return VIR_PY_NONE; + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virDomainGetUUIDString(dom, &uuidstr[0]); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) + return VIR_PY_NONE; + + py_retval = PyString_FromString((char *) &uuidstr[0]); + return(py_retval); +} + +static PyObject * libvirt_virDomainLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; virDomainPtr c_retval; @@ -997,6 +1024,33 @@ libvirt_virNetworkGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } static PyObject * +libvirt_virNetworkGetUUIDString(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) { + PyObject *py_retval; + char uuidstr[VIR_UUID_STRING_BUFLEN]; + virNetworkPtr net; + PyObject *pyobj_net; + int c_retval; + + if (!PyArg_ParseTuple(args, (char *)"O:virNetworkGetUUIDString", + &pyobj_net)) + return(NULL); + net = (virNetworkPtr) PyvirNetwork_Get(pyobj_net); + + if (net == NULL) + return VIR_PY_NONE; + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virNetworkGetUUIDString(net, &uuidstr[0]); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) + return VIR_PY_NONE; + + py_retval = PyString_FromString((char *) &uuidstr[0]); + return(py_retval); +} + +static PyObject * libvirt_virNetworkLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; virNetworkPtr c_retval; @@ -1363,6 +1417,31 @@ libvirt_virStoragePoolGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } +static PyObject * +libvirt_virStoragePoolGetUUIDString(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) { + PyObject *py_retval; + char uuidstr[VIR_UUID_STRING_BUFLEN]; + virStoragePoolPtr pool; + PyObject *pyobj_pool; + int c_retval; + + if (!PyArg_ParseTuple(args, (char *)"O:virStoragePoolGetUUIDString", &pyobj_pool)) + return(NULL); + pool = (virStoragePoolPtr) PyvirStoragePool_Get(pyobj_pool); + + if (pool == NULL) + return VIR_PY_NONE; + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virStoragePoolGetUUIDString(pool, &uuidstr[0]); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) + return VIR_PY_NONE; + + py_retval = PyString_FromString((char *) &uuidstr[0]); + return(py_retval); +} static PyObject * libvirt_virStoragePoolLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -1403,6 +1482,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virDomainGetInfo", libvirt_virDomainGetInfo, METH_VARARGS, NULL}, {(char *) "virNodeGetInfo", libvirt_virNodeGetInfo, METH_VARARGS, NULL}, {(char *) "virDomainGetUUID", libvirt_virDomainGetUUID, METH_VARARGS, NULL}, + {(char *) "virDomainGetUUIDString", libvirt_virDomainGetUUIDString, METH_VARARGS, NULL}, {(char *) "virDomainLookupByUUID", libvirt_virDomainLookupByUUID, METH_VARARGS, NULL}, {(char *) "virRegisterErrorHandler", libvirt_virRegisterErrorHandler, METH_VARARGS, NULL}, {(char *) "virGetLastError", libvirt_virGetLastError, METH_VARARGS, NULL}, @@ -1410,6 +1490,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virConnectListNetworks", libvirt_virConnectListNetworks, METH_VARARGS, NULL}, {(char *) "virConnectListDefinedNetworks", libvirt_virConnectListDefinedNetworks, METH_VARARGS, NULL}, {(char *) "virNetworkGetUUID", libvirt_virNetworkGetUUID, METH_VARARGS, NULL}, + {(char *) "virNetworkGetUUIDString", libvirt_virNetworkGetUUIDString, METH_VARARGS, NULL}, {(char *) "virNetworkLookupByUUID", libvirt_virNetworkLookupByUUID, METH_VARARGS, NULL}, {(char *) "virDomainGetAutostart", libvirt_virDomainGetAutostart, METH_VARARGS, NULL}, {(char *) "virNetworkGetAutostart", libvirt_virNetworkGetAutostart, METH_VARARGS, NULL}, @@ -1428,6 +1509,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virStoragePoolGetInfo", libvirt_virStoragePoolGetInfo, METH_VARARGS, NULL}, {(char *) "virStorageVolGetInfo", libvirt_virStorageVolGetInfo, METH_VARARGS, NULL}, {(char *) "virStoragePoolGetUUID", libvirt_virStoragePoolGetUUID, METH_VARARGS, NULL}, + {(char *) "virStoragePoolGetUUIDString", libvirt_virStoragePoolGetUUIDString, METH_VARARGS, NULL}, {(char *) "virStoragePoolLookupByUUID", libvirt_virStoragePoolLookupByUUID, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; diff --git a/libvirt-python-api.xml b/libvirt-python-api.xml index f415c50..da643d7 100644 --- a/libvirt-python-api.xml +++ b/libvirt-python-api.xml @@ -48,11 +48,31 @@ <return type='char *' info='the 16 bytes string or None in case of error'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> </function> + <function name='virDomainGetUUIDString' file='python'> + <info>Fetch globally unique ID of the domain as a string.</info> + <return type='char *' info='the UUID string or None in case of error'/> + <arg name='pool' type='virDomainPtr' info='a domain object'/> + </function> <function name='virNetworkGetUUID' file='python'> <info>Extract the UUID unique Identifier of a network.</info> <return type='char *' info='the 16 bytes string or None in case of error'/> <arg name='domain' type='virNetworkPtr' info='a network object'/> </function> + <function name='virNetworkGetUUIDString' file='python'> + <info>Fetch globally unique ID of the network as a string.</info> + <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='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'/> + <arg name='pool' type='virStoragePoolPtr' info='a storage pool object'/> + </function> + <function name='virStoragePoolGetUUIDString' file='python'> + <info>Fetch globally unique ID of the storage pool as a string.</info> + <return type='char *' info='the UUID string or None in case of error'/> + <arg name='pool' type='virStoragePoolPtr' info='a storage pool object'/> + </function> <function name='virNetworkGetAutostart' file='python'> <info>Extract the autostart flag for a network.</info> <return type='int' info='the autostart flag, or None in case of error'/> |