diff options
author | Daniel Veillard <veillard@redhat.com> | 2006-03-29 13:33:37 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2006-03-29 13:33:37 +0000 |
commit | 880f4e9ae20070c6c988b20730a7819b7b023d16 (patch) | |
tree | d0fba6b62fea2c9406c769102587217cf648c7f9 /python/tests | |
parent | * include/libvirt.h[.in] include/virterror.h src/driver.h (diff) | |
download | libvirt-880f4e9ae20070c6c988b20730a7819b7b023d16.tar.gz libvirt-880f4e9ae20070c6c988b20730a7819b7b023d16.tar.bz2 libvirt-880f4e9ae20070c6c988b20730a7819b7b023d16.zip |
* 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
Daniel
Diffstat (limited to 'python/tests')
-rw-r--r-- | python/tests/Makefile.am | 3 | ||||
-rwxr-xr-x | python/tests/create.py | 3 | ||||
-rwxr-xr-x | python/tests/node.py | 34 |
3 files changed, 38 insertions, 2 deletions
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index 586019078..dfa52e4f5 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -4,7 +4,8 @@ PYTESTS= \ basic.py \ create.py \ uuid.py \ - error.py + error.py \ + node.py EXTRA_DIST = $(PYTESTS) diff --git a/python/tests/create.py b/python/tests/create.py index b717db188..cd62928d4 100755 --- a/python/tests/create.py +++ b/python/tests/create.py @@ -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 index 000000000..2e33fb70c --- /dev/null +++ b/python/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) |