summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Privoznik <mprivozn@redhat.com>2019-08-28 15:36:12 +0200
committerMichal Privoznik <mprivozn@redhat.com>2019-08-29 12:04:56 +0200
commit17937cc337b3697a3d46a9052b5836cd3d6b8a0f (patch)
tree05db89c473d84c62d60ace2ca592207b88d88822
parentd3e647e20bba4606c67072693c4e32aeab23e2e0 (diff)
downloadlibvirt-python-17937cc337b3697a3d46a9052b5836cd3d6b8a0f.tar.gz
Implement virDomainGetGuestInfo
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-rwxr-xr-xgenerator.py1
-rw-r--r--libvirt-override-api.xml7
-rw-r--r--libvirt-override.c36
3 files changed, 44 insertions, 0 deletions
diff --git a/generator.py b/generator.py
index 8922f93..0b0a5a7 100755
--- a/generator.py
+++ b/generator.py
@@ -507,6 +507,7 @@ skip_impl = (
'virNodeGetSEVInfo',
'virNetworkPortGetParameters',
'virNetworkPortSetParameters',
+ 'virDomainGetGuestInfo',
)
lxc_skip_impl = (
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 9c4d71d..b2a6259 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -789,5 +789,12 @@
<arg name='port' type='virNetworkPortPtr' info='pointer to network port object'/>
<arg name='flags' type='int' info='unused, always pass 0'/>
</function>
+ <function name='virDomainGetGuestInfo' file='python'>
+ <info>Get aggregated info from guest agent</info>
+ <return type='char *' info='None in case of error, returns a dictionary of params'/>
+ <arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
+ <arg name='types' type='int' info='optional binary-OR of virDomainGuestInfoTypes'/>
+ <arg name='flags' type='int' info='unused, always pass 0'/>
+ </function>
</symbols>
</api>
diff --git a/libvirt-override.c b/libvirt-override.c
index 42f8198..5567f4a 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -10176,6 +10176,39 @@ libvirt_virNetworkPortGetParameters(PyObject *self ATTRIBUTE_UNUSED,
}
#endif /* LIBVIR_CHECK_VERSION(5, 5, 0) */
+#if LIBVIR_CHECK_VERSION(5, 7, 0)
+static PyObject *
+libvirt_virDomainGetGuestInfo(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *pyobj_dom = NULL;
+ PyObject *dict = NULL;
+ virDomainPtr dom = NULL;
+ virTypedParameterPtr params = NULL;
+ int nparams = 0;
+ unsigned int types;
+ unsigned int flags;
+ int rc;
+
+ if (!PyArg_ParseTuple(args, (char *) "OII:virDomainGetGuestInfo",
+ &pyobj_dom, &types, &flags))
+ return NULL;
+ dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ rc = virDomainGetGuestInfo(dom, types, &params, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (rc < 0)
+ return VIR_PY_NONE;
+
+ dict = getPyVirTypedParameter(params, nparams);
+
+ virTypedParamsFree(params, nparams);
+ return dict;
+}
+#endif /* LIBVIR_CHECK_VERSION(5, 7, 0) */
+
/************************************************************************
* *
* The registration stuff *
@@ -10431,6 +10464,9 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virNetworkPortSetParameters", libvirt_virNetworkPortSetParameters, METH_VARARGS, NULL},
{(char *) "virNetworkPortGetParameters", libvirt_virNetworkPortGetParameters, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(5, 5, 0) */
+#if LIBVIR_CHECK_VERSION(5, 7, 0)
+ {(char *) "virDomainGetGuestInfo", libvirt_virDomainGetGuestInfo, METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(5, 7, 0) */
{NULL, NULL, 0, NULL}
};