The vir{Domain,Network}GetAutostart() methods are missing from the python binding because they used an int * as a parameter. The attached patch adds a hand-written impl of these two APIs for the python binding. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
Index: libvir.c =================================================================== RCS file: /data/cvs/libvirt/python/libvir.c,v retrieving revision 1.20 diff -u -p -r1.20 libvir.c --- libvir.c 9 Mar 2007 15:42:50 -0000 1.20 +++ libvir.c 2 Apr 2007 21:39:43 -0000 @@ -570,6 +570,56 @@ libvirt_virNetworkLookupByUUID(PyObject } +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} }; Index: libvirt-python-api.xml =================================================================== RCS file: /data/cvs/libvirt/python/libvirt-python-api.xml,v retrieving revision 1.6 diff -u -p -r1.6 libvirt-python-api.xml --- libvirt-python-api.xml 9 Mar 2007 15:42:50 -0000 1.6 +++ libvirt-python-api.xml 2 Apr 2007 21:39:43 -0000 @@ -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>