summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgenerator.py3
-rw-r--r--libvir.c79
-rw-r--r--libvirt-python-api.xml16
3 files changed, 98 insertions, 0 deletions
diff --git a/generator.py b/generator.py
index 4dbad1c..c25ff55 100755
--- a/generator.py
+++ b/generator.py
@@ -328,6 +328,9 @@ skip_impl = (
'virDomainPinVcpu',
'virSecretGetValue',
'virSecretSetValue',
+ 'virSecretGetUUID',
+ 'virSecretGetUUIDString',
+ 'virSecretLookupByUUID',
'virStoragePoolGetUUID',
'virStoragePoolGetUUIDString',
'virStoragePoolLookupByUUID',
diff --git a/libvir.c b/libvir.c
index 0c00b80..d4f1eb2 100644
--- a/libvir.c
+++ b/libvir.c
@@ -1563,6 +1563,82 @@ libvirt_virNodeDeviceListCaps(PyObject *self ATTRIBUTE_UNUSED,
}
static PyObject *
+libvirt_virSecretGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ unsigned char uuid[VIR_UUID_BUFLEN];
+ virSecretPtr secret;
+ PyObject *pyobj_secret;
+ int c_retval;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:virSecretGetUUID", &pyobj_secret))
+ return(NULL);
+ secret = (virSecretPtr) PyvirSecret_Get(pyobj_secret);
+
+ if (secret == NULL)
+ return VIR_PY_NONE;
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virSecretGetUUID(secret, &uuid[0]);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (c_retval < 0)
+ return VIR_PY_NONE;
+ py_retval = PyString_FromStringAndSize((char *) &uuid[0], VIR_UUID_BUFLEN);
+
+ return(py_retval);
+}
+
+static PyObject *
+libvirt_virSecretGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args) {
+ PyObject *py_retval;
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virSecretPtr dom;
+ PyObject *pyobj_dom;
+ int c_retval;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:virSecretGetUUIDString",
+ &pyobj_dom))
+ return(NULL);
+ dom = (virSecretPtr) PyvirSecret_Get(pyobj_dom);
+
+ if (dom == NULL)
+ return VIR_PY_NONE;
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virSecretGetUUIDString(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_virSecretLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ virSecretPtr c_retval;
+ virConnectPtr conn;
+ PyObject *pyobj_conn;
+ unsigned char * uuid;
+ int len;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oz#:virSecretLookupByUUID", &pyobj_conn, &uuid, &len))
+ return(NULL);
+ conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
+
+ if ((uuid == NULL) || (len != VIR_UUID_BUFLEN))
+ return VIR_PY_NONE;
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virSecretLookupByUUID(conn, uuid);
+ LIBVIRT_END_ALLOW_THREADS;
+ py_retval = libvirt_virSecretPtrWrap((virSecretPtr) c_retval);
+ return(py_retval);
+}
+
+
+static PyObject *
libvirt_virConnectListSecrets(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args) {
PyObject *py_retval;
@@ -2358,6 +2434,9 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virEventInvokeTimeoutCallback", libvirt_virEventInvokeTimeoutCallback, METH_VARARGS, NULL},
{(char *) "virNodeListDevices", libvirt_virNodeListDevices, METH_VARARGS, NULL},
{(char *) "virNodeDeviceListCaps", libvirt_virNodeDeviceListCaps, METH_VARARGS, NULL},
+ {(char *) "virSecretGetUUID", libvirt_virSecretGetUUID, METH_VARARGS, NULL},
+ {(char *) "virSecretGetUUIDString", libvirt_virSecretGetUUIDString, METH_VARARGS, NULL},
+ {(char *) "virSecretLookupByUUID", libvirt_virSecretLookupByUUID, METH_VARARGS, NULL},
{(char *) "virConnectListSecrets", libvirt_virConnectListSecrets, METH_VARARGS, NULL},
{(char *) "virSecretGetValue", libvirt_virSecretGetValue, METH_VARARGS, NULL},
{(char *) "virSecretSetValue", libvirt_virSecretSetValue, METH_VARARGS, NULL},
diff --git a/libvirt-python-api.xml b/libvirt-python-api.xml
index e5c1fb9..148b89b 100644
--- a/libvirt-python-api.xml
+++ b/libvirt-python-api.xml
@@ -190,5 +190,21 @@
<arg name='value' type='const char *' info='The secret value'/>
<arg name='flags' type='unsigned int' info='flags (unused; pass 0)'/>
</function>
+ <function name='virSecretLookupByUUID' file='python'>
+ <info>Try to lookup a secret on the given hypervisor based on its UUID.</info>
+ <return type='virSecretPtr' info='a new secret object or NULL in case of failure'/>
+ <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
+ <arg name='uuid' type='const unsigned char *' info='the UUID string for the secret, must be 16 bytes'/>
+ </function>
+ <function name='virSecretGetUUID' file='python'>
+ <info>Extract the UUID unique Identifier of a secret.</info>
+ <return type='char *' info='the 16 bytes string or None in case of error'/>
+ <arg name='secret' type='virSecretPtr' info='a secret object'/>
+ </function>
+ <function name='virSecretGetUUIDString' file='python'>
+ <info>Fetch globally unique ID of the secret as a string.</info>
+ <return type='char *' info='the UUID string or None in case of error'/>
+ <arg name='secret' type='virSecretPtr' info='a secret object'/>
+ </function>
</symbols>
</api>