summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Denemark <jdenemar@redhat.com>2011-05-24 11:28:50 +0300
committerJiri Denemark <jdenemar@redhat.com>2011-06-16 18:26:12 +0200
commit9dd7a8d1018bf1dfcaa6dc13087cb6e16da706b4 (patch)
treeb3a8134b13148c76fcaaa97f2b9183b824efb2cd
parentb3ad3d4c8241b4f6680f9ca1c9df2ff7a64de155 (diff)
downloadlibvirt-python-split-9dd7a8d1018bf1dfcaa6dc13087cb6e16da706b4.tar.gz
libvirt-python-split-9dd7a8d1018bf1dfcaa6dc13087cb6e16da706b4.tar.xz
libvirt-python-split-9dd7a8d1018bf1dfcaa6dc13087cb6e16da706b4.zip
Introduce virDomainGetControlInfo API
The API can be used to query current state of an interface to VMM used to control a domain. In QEMU world this translates into monitor connection.
-rwxr-xr-xgenerator.py1
-rw-r--r--libvirt-override-api.xml6
-rw-r--r--libvirt-override.c27
3 files changed, 34 insertions, 0 deletions
diff --git a/generator.py b/generator.py
index 39c3ca7..cf5ceb5 100755
--- a/generator.py
+++ b/generator.py
@@ -312,6 +312,7 @@ skip_impl = (
'virGetLastError',
'virDomainGetInfo',
'virDomainGetState',
+ 'virDomainGetControlInfo',
'virDomainGetBlockInfo',
'virDomainGetJobInfo',
'virNodeGetInfo',
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 4bdd5de..b800941 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -54,6 +54,12 @@
<arg name='domain' type='virDomainPtr' info='a domain object'/>
<arg name='flags' type='unsigned int' info='additional flags'/>
</function>
+ <function name='virDomainGetControlInfo' file='python'>
+ <info>Extract details about current state of control interface to a domain.</info>
+ <return type='int *' info='the list of information or None in case of error'/>
+ <arg name='domain' type='virDomainPtr' info='a domain object'/>
+ <arg name='flags' type='unsigned int' info='additional flags'/>
+ </function>
<function name='virDomainGetBlockInfo' file='python'>
<info>Extract information about a domain block device size</info>
<return type='int *' info='the list of information or None in case of error'/>
diff --git a/libvirt-override.c b/libvirt-override.c
index 61d5b7d..897c450 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -1100,6 +1100,32 @@ libvirt_virDomainGetState(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
}
static PyObject *
+libvirt_virDomainGetControlInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
+ PyObject *py_retval;
+ int c_retval;
+ virDomainPtr domain;
+ PyObject *pyobj_domain;
+ virDomainControlInfo info;
+ unsigned int flags;
+
+ if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainGetControlInfo",
+ &pyobj_domain, &flags))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ c_retval = virDomainGetControlInfo(domain, &info, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+ if (c_retval < 0)
+ return VIR_PY_NONE;
+ py_retval = PyList_New(3);
+ PyList_SetItem(py_retval, 0, libvirt_intWrap(info.state));
+ PyList_SetItem(py_retval, 1, libvirt_intWrap(info.details));
+ PyList_SetItem(py_retval, 2, libvirt_longlongWrap(info.stateTime));
+ return py_retval;
+}
+
+static PyObject *
libvirt_virDomainGetBlockInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *py_retval;
int c_retval;
@@ -3657,6 +3683,7 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virConnectDomainEventDeregisterAny", libvirt_virConnectDomainEventDeregisterAny, METH_VARARGS, NULL},
{(char *) "virDomainGetInfo", libvirt_virDomainGetInfo, METH_VARARGS, NULL},
{(char *) "virDomainGetState", libvirt_virDomainGetState, METH_VARARGS, NULL},
+ {(char *) "virDomainGetControlInfo", libvirt_virDomainGetControlInfo, METH_VARARGS, NULL},
{(char *) "virDomainGetBlockInfo", libvirt_virDomainGetBlockInfo, METH_VARARGS, NULL},
{(char *) "virNodeGetInfo", libvirt_virNodeGetInfo, METH_VARARGS, NULL},
{(char *) "virDomainGetUUID", libvirt_virDomainGetUUID, METH_VARARGS, NULL},