summaryrefslogtreecommitdiffstats
path: root/libvir.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2006-03-29 12:46:03 +0000
committerDaniel Veillard <veillard@redhat.com>2006-03-29 12:46:03 +0000
commit300aa2d3f92c981cd8df9ccc0546b93251d796cf (patch)
treec3939813f3fe9cc748f5ed1be2fa72fb3e149925 /libvir.c
parent1027aa871cf478a54d77088199da8caabacbe3a0 (diff)
downloadlibvirt-python-v6-300aa2d3f92c981cd8df9ccc0546b93251d796cf.tar.gz
libvirt-python-v6-300aa2d3f92c981cd8df9ccc0546b93251d796cf.tar.xz
libvirt-python-v6-300aa2d3f92c981cd8df9ccc0546b93251d796cf.zip
* include/libvirt.h[.in] include/virterror.h src/driver.h
src/internal.h src/libvirt_sym.version src/xen_internal.c src/xs_internal.c: added a new entry point to get node hardware informations virGetNodeInfo, and associated driver hook. * src/xend_internal.c: implemented the node and version information hooks for the Xen Daemon * python/libvir.c python/libvirt-python-api.xml python/generator.py: also added Python bindings for the new call Daniel
Diffstat (limited to 'libvir.c')
-rw-r--r--libvir.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libvir.c b/libvir.c
index 1d97037..ede3949 100644
--- a/libvir.c
+++ b/libvir.c
@@ -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},