Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
generator.py | 1 +
libvirt-override-api.xml | 7 +++++
libvirt-override.c | 64 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 72 insertions(+)
diff --git a/generator.py b/generator.py
index 433c1f2..913dab8 100755
--- a/generator.py
+++ b/generator.py
@@ -489,6 +489,7 @@ skip_impl = (
'virDomainGetDiskErrors',
'virNodeGetMemoryParameters',
'virNodeSetMemoryParameters',
+ 'virConnectSetIdentity',
'virNodeGetCPUMap',
'virDomainMigrate3',
'virDomainMigrateToURI3',
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index b2a6259..7a0d4c5 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -796,5 +796,12 @@
<arg name='types' type='int' info='optional binary-OR of
virDomainGuestInfoTypes'/>
<arg name='flags' type='int' info='unused, always pass
0'/>
</function>
+ <function name='virConnectSetIdentity' file='libvirt-host'
module='libvirt-host'>
+ <info>Override the default identity information associated with the
connection.</info>
+ <return type='int' info='0 if the identity change was accepted, -1
on error'/>
+ <arg name='conn' type='virConnectPtr' info='pointer to the
hypervisor connection'/>
+ <arg name='params' type='virTypedParameterPtr'
info='parameters containing the identity attributes'/>
+ <arg name='flags' type='unsigned int' info='currently
unused, pass 0'/>
+ </function>
</symbols>
</api>
diff --git a/libvirt-override.c b/libvirt-override.c
index ff2cfdf..72edca9 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -10209,6 +10209,67 @@ libvirt_virDomainGetGuestInfo(PyObject *self ATTRIBUTE_UNUSED,
}
#endif /* LIBVIR_CHECK_VERSION(5, 7, 0) */
+
+#if LIBVIR_CHECK_VERSION(5, 8, 0)
+static virPyTypedParamsHint virPyConnectSetIdentityParams[] = {
+ { VIR_CONNECT_IDENTITY_USER_NAME, VIR_TYPED_PARAM_STRING },
+ { VIR_CONNECT_IDENTITY_UNIX_USER_ID, VIR_TYPED_PARAM_ULLONG },
+ { VIR_CONNECT_IDENTITY_GROUP_NAME, VIR_TYPED_PARAM_STRING },
+ { VIR_CONNECT_IDENTITY_UNIX_GROUP_ID, VIR_TYPED_PARAM_ULLONG },
+ { VIR_CONNECT_IDENTITY_PROCESS_ID, VIR_TYPED_PARAM_LLONG },
+ { VIR_CONNECT_IDENTITY_PROCESS_TIME, VIR_TYPED_PARAM_ULLONG },
+ { VIR_CONNECT_IDENTITY_SASL_USER_NAME, VIR_TYPED_PARAM_STRING },
+ { VIR_CONNECT_IDENTITY_X509_DISTINGUISHED_NAME, VIR_TYPED_PARAM_STRING },
+ { VIR_CONNECT_IDENTITY_SELINUX_CONTEXT, VIR_TYPED_PARAM_STRING },
+};
+
+static PyObject *
+libvirt_virConnectSetIdentity(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ virConnectPtr conn;
+ PyObject *pyobj_conn, *dict;
+ PyObject *ret = NULL;
+ int i_retval;
+ int nparams = 0;
+ unsigned int flags;
+ virTypedParameterPtr params = NULL;
+
+ if (!PyArg_ParseTuple(args,
+ (char *)"OOI:virConnectSetIdentity",
+ &pyobj_conn, &dict, &flags))
+ return NULL;
+ conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
+
+ if (!PyDict_Check(dict)) {
+ PyErr_Format(PyExc_TypeError, "migration params must be a
dictionary");
+ return NULL;
+ }
+
+ if (virPyDictToTypedParams(dict, ¶ms, &nparams,
+ virPyConnectSetIdentityParams,
+ VIR_N_ELEMENTS(virPyConnectSetIdentityParams)) < 0) {
+ return NULL;
+ }
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virConnectSetIdentity(conn, params, nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_INT_FAIL;
+ goto cleanup;
+ }
+
+ ret = VIR_PY_INT_SUCCESS;
+
+ cleanup:
+ virTypedParamsFree(params, nparams);
+ return ret;
+}
+#endif /* LIBVIR_CHECK_VERSION(5, 8, 0) */
+
+
/************************************************************************
* *
* The registration stuff *
@@ -10467,6 +10528,9 @@ static PyMethodDef libvirtMethods[] = {
#if LIBVIR_CHECK_VERSION(5, 7, 0)
{(char *) "virDomainGetGuestInfo", libvirt_virDomainGetGuestInfo,
METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(5, 7, 0) */
+#if LIBVIR_CHECK_VERSION(5, 8, 0)
+ {(char *) "virConnectSetIdentity", libvirt_virConnectSetIdentity,
METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(5, 8, 0) */
{NULL, NULL, 0, NULL}
};
--
2.21.0