summaryrefslogtreecommitdiffstats
path: root/tests/node.py
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2006-03-29 13:33:37 +0000
committerDaniel Veillard <veillard@redhat.com>2006-03-29 13:33:37 +0000
commit506fb7d8868efb4eb24b003b42cce14f9a0b8847 (patch)
tree4aabd4da6e9e3503943fca4386be4677031eddaa /tests/node.py
parent300aa2d3f92c981cd8df9ccc0546b93251d796cf (diff)
downloadlibvirt-python-v6-506fb7d8868efb4eb24b003b42cce14f9a0b8847.tar.gz
libvirt-python-v6-506fb7d8868efb4eb24b003b42cce14f9a0b8847.tar.xz
libvirt-python-v6-506fb7d8868efb4eb24b003b42cce14f9a0b8847.zip
* python/libvir.c: fixed a bug in the new wrapperv0.1.1v0.1.0LIBVIRT_0_1_1LIBVIRT_0_1_0
* python/tests/Makefile.am python/tests/node.py: added a new test for the new API * python/tests/create.py: remove a debug Daniel
Diffstat (limited to 'tests/node.py')
-rwxr-xr-xtests/node.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/node.py b/tests/node.py
new file mode 100755
index 0000000..2e33fb7
--- /dev/null
+++ b/tests/node.py
@@ -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)