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

Re: [libvirt] [PATCH 3/6 v2] Introduce virDomainGetControlInfo API



On Mon, Jun 13, 2011 at 12:13:15PM +0200, Jiri Denemark wrote:
> 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.
> ---
> Notes:
>     Version 2:
>     - really implement python binding
> 
[...]
> diff --git a/python/generator.py b/python/generator.py
> index 7c38fdd..4e3e9fa 100755
> --- a/python/generator.py
> +++ b/python/generator.py
> @@ -306,6 +306,7 @@ skip_impl = (
>      'virGetLastError',
>      'virDomainGetInfo',
>      'virDomainGetState',
> +    'virDomainGetControlInfo',
>      'virDomainGetBlockInfo',
>      'virDomainGetJobInfo',
>      'virNodeGetInfo',
> diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
> index ec08e69..01207d6 100644
> --- a/python/libvirt-override-api.xml
> +++ b/python/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/python/libvirt-override.c b/python/libvirt-override.c
> index 974decb..c6a1d4f 100644
> --- a/python/libvirt-override.c
> +++ b/python/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;
> @@ -3555,6 +3581,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},

  Okay, ACK for the python side addition, could you just make 100%
sure that the VIR_DOMAIN_CONTROL_... values are correctly grabbed by
the the generator and put in the final libvirt.py ?

 thanks,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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