diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2007-04-10 23:15:58 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2007-04-10 23:15:58 +0000 |
commit | 09e33225d13297467fd7fd863ea55cbe04b3f486 (patch) | |
tree | 25c8a1ac37f09cbb76bf33fe4a0f750a86b24235 | |
parent | 98ad0d934884e76fe524527774af75bdaac04ee2 (diff) | |
download | libvirt-python-09e33225d13297467fd7fd863ea55cbe04b3f486.tar.gz |
Added vir*GetAutostart APIs to python
-rw-r--r-- | libvir.c | 52 | ||||
-rw-r--r-- | libvirt-python-api.xml | 10 |
2 files changed, 62 insertions, 0 deletions
@@ -570,6 +570,56 @@ libvirt_virNetworkLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) } +PyObject * +libvirt_virDomainGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval, autostart; + virDomainPtr domain; + PyObject *pyobj_domain; + + if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetAutostart", &pyobj_domain)) + return(NULL); + + domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virDomainGetAutostart(domain, &autostart); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) { + Py_INCREF(Py_None); + return Py_None; + } + py_retval = libvirt_intWrap(autostart); + return(py_retval); +} + + +PyObject * +libvirt_virNetworkGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval, autostart; + virNetworkPtr network; + PyObject *pyobj_network; + + if (!PyArg_ParseTuple(args, (char *)"O:virNetworkGetAutostart", &pyobj_network)) + return(NULL); + + network = (virNetworkPtr) PyvirNetwork_Get(pyobj_network); + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval = virNetworkGetAutostart(network, &autostart); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) { + Py_INCREF(Py_None); + return Py_None; + } + py_retval = libvirt_intWrap(autostart); + return(py_retval); +} + + /************************************************************************ * * @@ -594,6 +644,8 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virConnectListDefinedNetworks", libvirt_virConnectListDefinedNetworks, METH_VARARGS, NULL}, {(char *) "virNetworkGetUUID", libvirt_virNetworkGetUUID, METH_VARARGS, NULL}, {(char *) "virNetworkLookupByUUID", libvirt_virNetworkLookupByUUID, METH_VARARGS, NULL}, + {(char *) "virDomainGetAutostart", libvirt_virDomainGetAutostart, METH_VARARGS, NULL}, + {(char *) "virNetworkGetAutostart", libvirt_virNetworkGetAutostart, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; diff --git a/libvirt-python-api.xml b/libvirt-python-api.xml index 28f0185..40cac6d 100644 --- a/libvirt-python-api.xml +++ b/libvirt-python-api.xml @@ -53,5 +53,15 @@ <return type='char *' info='the 16 bytes string or None in case of error'/> <arg name='domain' type='virNetworkPtr' info='a network object'/> </function> + <function name='virNetworkGetAutostart' file='python'> + <info>Extract the autostart flag for a network.</info> + <return type='int' info='the autostart flag, or None in case of error'/> + <arg name='domain' type='virNetworkPtr' info='a network object'/> + </function> + <function name='virDomainGetAutostart' file='python'> + <info>Extract the autostart flag for a domain</info> + <return type='int' info='the autostart flag, or None in case of error'/> + <arg name='domain' type='virDomainPtr' info='a network object'/> + </function> </symbols> </api> |