summaryrefslogtreecommitdiffstats
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
parent1027aa871cf478a54d77088199da8caabacbe3a0 (diff)
downloadlibvirt-python-split-300aa2d3f92c981cd8df9ccc0546b93251d796cf.tar.gz
libvirt-python-split-300aa2d3f92c981cd8df9ccc0546b93251d796cf.tar.xz
libvirt-python-split-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
-rwxr-xr-xgenerator.py4
-rw-r--r--libvir.c30
-rw-r--r--libvirt-python-api.xml11
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:]
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},
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'/>