summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2006-02-16 22:50:52 +0000
committerDaniel Veillard <veillard@redhat.com>2006-02-16 22:50:52 +0000
commit98a835a987ed4f90c534dd27c6e51007e47c938e (patch)
tree38f1d523017aa630e694235aa4021dd0c714d4b5 /tests
parent5d1e9d872367351fc878c268c9d7a2183851c23a (diff)
downloadlibvirt-python-split-98a835a987ed4f90c534dd27c6e51007e47c938e.tar.gz
libvirt-python-split-98a835a987ed4f90c534dd27c6e51007e47c938e.tar.xz
libvirt-python-split-98a835a987ed4f90c534dd27c6e51007e47c938e.zip
* configure.in src/Makefile.am: adding dependency to libxml2
* include/libvirt.h* src/libvirt.c src/xend_internal.[ch] src/xml.[ch]: added XML parsing for Xen domain descriptions needed for creates, plugged in a converter to s-exp and xend call. Modified the virDomainCreateLinux() to reflect that XML based description. Seems to work. * python/tests/create.py: added a test case which seems to work not tested much yet * docs/*: regenerated Daniel
Diffstat (limited to 'tests')
-rwxr-xr-xtests/create.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/create.py b/tests/create.py
new file mode 100755
index 0000000..c31eaa4
--- /dev/null
+++ b/tests/create.py
@@ -0,0 +1,46 @@
+#!/usr/bin/python -u
+import libvirt
+import sys
+
+conn = libvirt.openReadOnly(None)
+if conn == None:
+ print 'Failed to open connection to the hypervisor'
+ sys.exit(1)
+
+xmldesc="""<domain type='xen'>
+ <name>test</name>
+ <os>
+ <type>linux</type>
+ <kernel>/boot/vmlinuz-2.6.15-1.43_FC5guest</kernel>
+ <initrd>/boot/initrd-2.6.15-1.43_FC5guest.img</initrd>
+ <cmdline> root=/dev/sda1 ro selinux=0 3</cmdline>
+ </os>
+ <memory>131072</memory>
+ <vcpu>1</vcpu>
+ <devices>
+ <disk type='file'>
+ <source file='/u/fc4.img'/>
+ <target dev='sda1'/>
+ </disk>
+ <interface type='bridge'>
+ <source bridge='xenbr0'/>
+ <mac address='aa:00:00:00:00:12'/>
+ <script path='/etc/xen/scripts/vif-bridge'/>
+ </interface>
+ </devices>
+</domain>
+"""
+dom = conn.createLinux(xmldesc, 0)
+if dom == None:
+ print 'Failed to create a domain'
+ sys.exit(1)
+
+# print dom0
+
+print "Domain: id %d running %s" % (dom.ID(), dom.OSType())
+print dom.info()
+del dom
+del conn
+print "OK"
+
+sys.exit(0)