]> xenbits.xensource.com Git - libvirt.git/commitdiff
* python/libvir.c: fixed a bug in the new wrapper
authorDaniel Veillard <veillard@redhat.com>
Wed, 29 Mar 2006 13:33:37 +0000 (13:33 +0000)
committerDaniel Veillard <veillard@redhat.com>
Wed, 29 Mar 2006 13:33:37 +0000 (13:33 +0000)
* python/tests/Makefile.am python/tests/node.py: added a new test for
  the new API
* python/tests/create.py: remove a debug
Daniel

ChangeLog
python/libvir.c
python/tests/Makefile.am
python/tests/create.py
python/tests/node.py [new file with mode: 0755]

index f657eda3df053b967da211cab7641f9b8717d0be..4df5372fa0b861baf7ff434f3e03cb0e4dfe28f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Mar 29 13:34:25 EST 2006 Daniel Veillard <veillard@redhat.com>
+
+       * python/libvir.c: fixed a bug in the new wrapper
+       * python/tests/Makefile.am python/tests/node.py: added a new test for
+         the new API
+       * python/tests/create.py: remove a debug
+
 Wed Mar 29 14:43:56 CEST 2006 Daniel Veillard <veillard@redhat.com>
 
        * include/libvirt.h[.in] include/virterror.h src/driver.h
index ede394956355adaae51a708c1aac6fb83708b957..786d47a60e6b56e710b6e944727da0b07502a276 100644 (file)
@@ -215,8 +215,8 @@ libvirt_virNodeGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
        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, 0, libvirt_constcharPtrWrap(&info.model[0]));
+    PyList_SetItem(py_retval, 1, libvirt_longWrap((long) info.memory >> 10));
     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));
index 58601907867877f5a9cfdafb6f4b5ac74394ff00..dfa52e4f56cd7ffa9e2f314a4f87b7e952b666e7 100644 (file)
@@ -4,7 +4,8 @@ PYTESTS=                \
        basic.py        \
        create.py       \
        uuid.py         \
-       error.py
+       error.py        \
+       node.py
 
 EXTRA_DIST = $(PYTESTS)
 
index b717db18819e4747c5629ced9ba08a045243c6a2..cd62928d497b1b9cde4081b8dbfc9c4fb901e27f 100755 (executable)
@@ -12,6 +12,7 @@ if not os.access("/proc/xen", os.R_OK):
 # Try to provide default OS images paths here, of course non standard
 #
 osroots = [
+  "/u/fc4-2.img",
   "/u/fc4.img",
   "/xen/fc4.img",
 ]
@@ -84,7 +85,7 @@ if dom == None:
     print 'Failed to create a test domain'
     sys.exit(1)
 
-print dom
+print dom
 
 print "Domain: id %d running %s" % (dom.ID(), dom.OSType())
 
diff --git a/python/tests/node.py b/python/tests/node.py
new file mode 100755 (executable)
index 0000000..2e33fb7
--- /dev/null
@@ -0,0 +1,34 @@
+#!/usr/bin/python -u
+import libvirt
+import sys
+import os
+
+if not os.access("/proc/xen", os.R_OK):
+    print 'System is not running a Xen kernel'
+    sys.exit(1)
+
+conn = libvirt.openReadOnly(None)
+if conn == None:
+    print 'Failed to open connection to the hypervisor'
+    sys.exit(1)
+
+try:
+    (model, memory, cpus, mhz, nodes, socket, cores, threads) = conn.getInfo()
+except:
+    print 'Failed to extract the current node informations'
+    sys.exit(1)
+
+print "Xen running on %d %s processors at %d MHz, %d MBytes of memory" % (
+       cpus, model, mhz, memory)
+
+if cpus > nodes * socket * cores * threads:
+    print "Erroneous CPU informations"
+    sys.exit(1)
+
+if cpus < nodes * socket * cores * threads:
+    print "Strange, running in degrated mode, some CPU are not available"
+
+del conn
+print "OK"
+
+sys.exit(0)