[libvirt-python][PATCH] Add support for virDomainGetGuestVcpus

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

 



This function has virTypedParameterPtr as one of the args and our
generator is unable to deal with that. Therefore we must provide
implementation.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 generator.py       |  1 +
 libvirt-override.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/generator.py b/generator.py
index 92ac7a7..82f13e9 100755
--- a/generator.py
+++ b/generator.py
@@ -491,6 +491,7 @@ skip_impl = (
     'virDomainInterfaceAddresses',
     'virDomainGetPerfEvents',
     'virDomainSetPerfEvents',
+    'virDomainGetGuestVcpus',
 )
 
 lxc_skip_impl = (
diff --git a/libvirt-override.c b/libvirt-override.c
index 3075681..9c5dd84 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -8915,6 +8915,38 @@ libvirt_virConnectStoragePoolEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED,
 
     return libvirt_intWrap(ret);
 }
+
+static PyObject *
+libvirt_virDomainGetGuestVcpus(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:virDomainGetScedulerParametersFlags",
+                          &pyobj_domain, &flags))
+        return NULL;
+    domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+    LIBVIRT_BEGIN_ALLOW_THREADS;
+    i_retval = virDomainGetGuestVcpus(domain, &params, &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(2, 0, 0)*/
 
 
@@ -9128,6 +9160,7 @@ static PyMethodDef libvirtMethods[] = {
 #if LIBVIR_CHECK_VERSION(2, 0, 0)
     {(char *) "virConnectStoragePoolEventRegisterAny", libvirt_virConnectStoragePoolEventRegisterAny, METH_VARARGS, NULL},
     {(char *) "virConnectStoragePoolEventDeregisterAny", libvirt_virConnectStoragePoolEventDeregisterAny, METH_VARARGS, NULL},
+    {(char *) "virDomainGetGuestVcpus", libvirt_virDomainGetGuestVcpus, METH_VARARGS, NULL},
 #endif /* LIBVIR_CHECK_VERSION(2, 0, 0) */
     {NULL, NULL, 0, NULL}
 };
-- 
2.8.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]