From: Marc Hartmayer <mhartmay(a)linux.ibm.com>
This patch adds the Python binding for the virDomainGetStateParams
API. The Python side can be generated automatically, the C side not.
Reviewed-by: Bjoern Walk <bwalk(a)linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.ibm.com>
---
generator.py | 1 +
libvirt-override-api.xml | 6 ++++++
libvirt-override.c | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+)
diff --git a/generator.py b/generator.py
index bd7ff112..1f6ffb9a 100755
--- a/generator.py
+++ b/generator.py
@@ -495,6 +495,7 @@ skip_impl = (
'virConnectBaselineHypervisorCPU',
'virDomainGetLaunchSecurityInfo',
'virNodeGetSEVInfo',
+ 'virDomainGetStateParams',
)
lxc_skip_impl = (
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 4e8d6c03..c49e244c 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -746,5 +746,11 @@
<arg name='conn' type='virConnectPtr' info='pointer to
hypervisor connection'/>
<arg name='flags' type='int' info='unused, always pass
0'/>
</function>
+ <function name='virDomainGetStateParams' file='python'>
+ <info>Extract domain state. Each state is accompanied by a reason (if known)
and optional detailed information.</info>
+ <arg name='dom' type='virDomainPtr' info='pointer to the
domain'/>
+ <arg name='flags' type='unsigned int' info='extra flags; not
used yet, so callers should always pass 0'/>
+ <return type='char *' info="dictionary of state data"/>
+ </function>
</symbols>
</api>
diff --git a/libvirt-override.c b/libvirt-override.c
index e74c7dda..355b9fd5 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -9881,6 +9881,41 @@ libvirt_virNodeGetSEVInfo(PyObject *self ATTRIBUTE_UNUSED,
#endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */
+#if LIBVIR_CHECK_VERSION(4, 6, 0)
+static PyObject *
+libvirt_virDomainGetStateParams(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *pyobj_domain;
+ virDomainPtr domain;
+ virTypedParameterPtr params = NULL;
+ int nparams = 0;
+ unsigned int flags;
+ int i_retval;
+ PyObject *ret = NULL;
+
+ if (!PyArg_ParseTuple(args, (char *)"OI:virDomainGetStateParams",
+ &pyobj_domain, &flags))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetStateParams(domain, ¶ms, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_NONE;
+ goto cleanup;
+ }
+
+ ret = getPyVirTypedParameter(params, nparams);
+cleanup:
+ virTypedParamsFree(params, nparams);
+ return ret;
+}
+#endif /* LIBVIR_CHECK_VERSION(4, 6, 0) */
+
+
/************************************************************************
* *
* The registration stuff *
@@ -10124,6 +10159,9 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetLaunchSecurityInfo",
libvirt_virDomainGetLaunchSecurityInfo, METH_VARARGS, NULL},
{(char *) "virNodeGetSEVInfo", libvirt_virNodeGetSEVInfo, METH_VARARGS,
NULL},
#endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */
+#if LIBVIR_CHECK_VERSION(4, 6, 0)
+ {(char *) "virDomainGetStateParams", libvirt_virDomainGetStateParams,
METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(4, 6, 0) */
{NULL, NULL, 0, NULL}
};
--
2.17.0