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

[libvirt] [libvirt-python PATCH] Implement virDomainOpenGraphicsFD



---
 generator.py             |  1 +
 libvirt-override-api.xml |  7 +++++++
 libvirt-override.c       | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)

diff --git a/generator.py b/generator.py
index a12c52b..32ae34d 100755
--- a/generator.py
+++ b/generator.py
@@ -464,6 +464,7 @@ skip_impl = (
     'virConnectGetCPUModelNames',
     'virNodeGetFreePages',
     'virNetworkGetDHCPLeases',
+    'virDomainOpenGraphicsFD',
 )
 
 lxc_skip_impl = (
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 09bbbf8..c7b6152 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -640,5 +640,12 @@
       <arg name='flags' type='unsigned int' info='unused, pass 0'/>
       <return type='char *' info="list of leases"/>
     </function>
+    <function name="virDomainOpenGraphicsFD" file='python'>
+      <info>Returns a file descriptor connected to the graphics framebuffer </info>
+      <arg name='domain' type='virDomainPtr' info='a domain object'/>
+      <arg name='idx' type='int' info='index of the graphics framebuffer'/>
+      <arg name='flags' type='unsigned int' info='bitwise OR of virDomainOpenGraphicsFlags'/>
+      <return type='char *' info="list of fds"/>
+    </function>
   </symbols>
 </api>
diff --git a/libvirt-override.c b/libvirt-override.c
index b2271ae..42a4b05 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -7955,6 +7955,40 @@ libvirt_virNetworkGetDHCPLeases(PyObject *self ATTRIBUTE_UNUSED,
 
 #endif /* LIBVIR_CHECK_VERSION(1, 2, 6) */
 
+
+#if LIBVIR_CHECK_VERSION(1, 2, 8)
+
+static PyObject *
+libvirt_virDomainOpenGraphicsFD(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
+{
+    PyObject *py_retval;
+    int c_retval;
+    virDomainPtr domain;
+    PyObject *pyobj_domain;
+    int idx;
+    int fd;
+    unsigned int flags;
+
+    if (!PyArg_ParseTuple(args, (char *)"Oii:virDomainOpenGraphicsFD",
+                          &pyobj_domain, &idx, &flags))
+        return NULL;
+
+    domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+    LIBVIRT_BEGIN_ALLOW_THREADS;
+    c_retval = virDomainOpenGraphicsFD(domain, idx, &fd, flags);
+    LIBVIRT_END_ALLOW_THREADS;
+    if (c_retval < 0)
+        return VIR_PY_NONE;
+
+    py_retval = PyList_New(1);
+    PyList_SetItem(py_retval, 0, libvirt_intWrap(fd));
+    return py_retval;
+}
+
+#endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */
+
+
 /************************************************************************
  *									*
  *			The registration stuff				*
@@ -8140,6 +8174,9 @@ static PyMethodDef libvirtMethods[] = {
     {(char *) "virNodeGetFreePages", libvirt_virNodeGetFreePages, METH_VARARGS, NULL},
     {(char *) "virNetworkGetDHCPLeases", libvirt_virNetworkGetDHCPLeases, METH_VARARGS, NULL},
 #endif /* LIBVIR_CHECK_VERSION(1, 2, 6) */
+#if LIBVIR_CHECK_VERSION(1, 2, 8)
+    {(char *) "virDomainOpenGraphicsFD", libvirt_virDomainOpenGraphicsFD, METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(1, 2, 8) */
     {NULL, NULL, 0, NULL}
 };
 
-- 
1.8.5.5


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