diff options
-rwxr-xr-x | generator.py | 4 | ||||
-rw-r--r-- | libvir.c | 30 | ||||
-rw-r--r-- | libvirt-python-api.xml | 11 |
3 files changed, 42 insertions, 3 deletions
diff --git a/generator.py b/generator.py index af44cae..497f3b4 100755 --- a/generator.py +++ b/generator.py @@ -261,6 +261,7 @@ foreign_encoding_args = ( skip_impl = ( 'virConnectListDomainsID', 'virDomainGetInfo', + 'virNodeGetInfo', 'virDomainGetUUID', 'virDomainLookupByUUID', ) @@ -562,6 +563,9 @@ def nameFixup(name, classe, type, file): elif name[0:9] == "virDomain": func = name[9:] func = string.lower(func[0:1]) + func[1:] + elif name[0:7] == "virNode": + func = name[7:] + func = string.lower(func[0:1]) + func[1:] elif name[0:10] == "virConnect": func = name[10:] func = string.lower(func[0:1]) + func[1:] @@ -197,6 +197,35 @@ libvirt_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } +static PyObject * +libvirt_virNodeGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + virConnectPtr conn; + PyObject *pyobj_conn; + virNodeInfo info; + + if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetInfo", &pyobj_conn)) + return(NULL); + conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn); + + c_retval = virNodeGetInfo(conn, &info); + if (c_retval < 0) { + Py_INCREF(Py_None); + return(Py_None); + } + py_retval = PyList_New(8); + PyList_SetItem(py_retval, 0, libvirt_charPtrWrap(&info.model[0])); + PyList_SetItem(py_retval, 1, libvirt_longWrap((long) info.memory)); + PyList_SetItem(py_retval, 2, libvirt_intWrap((int) info.cpus)); + PyList_SetItem(py_retval, 3, libvirt_intWrap((int) info.mhz)); + PyList_SetItem(py_retval, 4, libvirt_intWrap((int) info.nodes)); + PyList_SetItem(py_retval, 5, libvirt_intWrap((int) info.sockets)); + PyList_SetItem(py_retval, 6, libvirt_intWrap((int) info.cores)); + PyList_SetItem(py_retval, 7, libvirt_intWrap((int) info.threads)); + return(py_retval); +} + PyObject * libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -255,6 +284,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virConnectClose", libvirt_virConnectClose, METH_VARARGS, NULL}, {(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL}, {(char *) "virDomainGetInfo", libvirt_virDomainGetInfo, METH_VARARGS, NULL}, + {(char *) "virNodeGetInfo", libvirt_virNodeGetInfo, METH_VARARGS, NULL}, {(char *) "virDomainGetUUID", libvirt_virDomainGetUUID, METH_VARARGS, NULL}, {(char *) "virDomainLookupByUUID", libvirt_virDomainLookupByUUID, METH_VARARGS, NULL}, {(char *) "virRegisterErrorHandler", libvirt_virRegisterErrorHandler, METH_VARARGS, NULL}, diff --git a/libvirt-python-api.xml b/libvirt-python-api.xml index 3b75525..302ba02 100644 --- a/libvirt-python-api.xml +++ b/libvirt-python-api.xml @@ -12,12 +12,17 @@ <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='uuid' type='const unsigned char *' info='the UUID string for the domain, must be 16 bytes'/> </function> - <function name='virDomainGetInfo' file='libvir' module='python'> - <info>Extract information about a domain. Note that if the connection used to get the domain is limited only a partial set of the informations can be extracted.</info> + <function name='virDomainGetInfo' file='python'> + <info>Extract informations about a domain. Note that if the connection used to get the domain is limited only a partial set of the informations can be extracted.</info> <return type='int *' info='the list of informations or None in case of error'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> </function> - <function name='virDomainGetUUID' file='libvir' module='python'> + <function name='virNodeGetInfo' file='python'> + <info>Extract hardware informations about the Node.</info> + <return type='int *' info='the list of informations or None in case of error'/> + <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> + </function> + <function name='virDomainGetUUID' file='python'> <info>Extract the UUID unique Identifier of a domain.</info> <return type='char *' info='the 16 bytes string or None in case of error'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> |