diff options
author | Daniel Veillard <veillard@redhat.com> | 2006-02-24 12:26:56 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2006-02-24 12:26:56 +0000 |
commit | 8a85b2bf232d251c5c688721b68145fc21bf3581 (patch) | |
tree | ed1b0518f4877a67cb917a2feb84f554d70e70be /libvir.c | |
parent | 2ce9e08fac637cb6a19e5244027b118dbed708c2 (diff) | |
download | libvirt-python-v6-8a85b2bf232d251c5c688721b68145fc21bf3581.tar.gz libvirt-python-v6-8a85b2bf232d251c5c688721b68145fc21bf3581.tar.xz libvirt-python-v6-8a85b2bf232d251c5c688721b68145fc21bf3581.zip |
* python/generator.py python/libvir.c python/libvirt-python-api.xml:
UUID strings can contain zeroes, so the autogenerated conversion
functions don't work.
Daniel
Diffstat (limited to 'libvir.c')
-rw-r--r-- | libvir.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -125,6 +125,29 @@ libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } +PyObject * +libvirt_virDomainLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + virDomainPtr c_retval; + virConnectPtr conn; + PyObject *pyobj_conn; + unsigned char * uuid; + int len; + + if (!PyArg_ParseTuple(args, (char *)"Oz#:virDomainLookupByUUID", &pyobj_conn, &uuid, &len)) + return(NULL); + conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn); + + if ((uuid == NULL) || (len != 16)) { + Py_INCREF(Py_None); + return(Py_None); + } + + c_retval = virDomainLookupByUUID(conn, uuid); + py_retval = libvirt_virDomainPtrWrap((virDomainPtr) c_retval); + return(py_retval); +} + /************************************************************************ * * * The registration stuff * @@ -137,6 +160,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL}, {(char *) "virDomainGetInfo", libvirt_virDomainGetInfo, METH_VARARGS, NULL}, {(char *) "virDomainGetUUID", libvirt_virDomainGetUUID, METH_VARARGS, NULL}, + {(char *) "virDomainLookupByUUID", libvirt_virDomainLookupByUUID, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; |