[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [python PATCH] Implement virDomainGetGuestInfo



Signed-off-by: Michal Privoznik <mprivozn redhat com>
---
 generator.py             |  1 +
 libvirt-override-api.xml |  7 +++++++
 libvirt-override.c       | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 44 insertions(+)

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}
 };
 
-- 
2.21.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]