[Libvir] Problems with defineXML in python..

I am having some problems getting libvirt under python to work properly. I can setup new domains by using the createLinux() function, but when I attempt to use defineXML() it fails with no reason given other then "virDomainDefineXML() failed". I am using the same XML file for both functions. This is on a Ubuntu 7.04 server running python 2.5 & libvirt 0.1.8 (from the ubuntu universe repo). Here is my test code: import libvirt import sys import xml import random try: conn = libvirt.open(None) except Exception, e: print e if conn == None: print 'Failed to open connection to the hypervisor' sys.exit(1) create = True if create: xmlfile = open('webserv.xml') xmldesc = xmlfile.read() xmlfile.close() try: # webserv = conn.createLinux(xmldesc, 0) webserv = conn.defineXML(xmldesc) except Exception, e: print 'Failed to create webserv: %s' % e sys.exit(1) if webserv is None: print 'whoops this shouldnt happen!' conn.create(webserv) try: print "Domain 0: id %d running %s" % (webserv.ID(), webserv.OSType()) print webserv.info() print webserv.XMLDesc(0) except Exception, e: print e #webserv.shutdown() And the XML file: <domain type='xen' > <name>webserv</name> <os> <type>linux</type> <kernel>/boot/vmlinuz-2.6.19-4-generic-amd64</kernel> <initrd>/boot/initrd.img-2.6.19-4-generic-amd64</initrd> <root>/dev/hda1</root> </os> <memory>1024</memory> <vcpu>1</vcpu> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <interface type='bridge'> <source bridge='xenbr0'/> <mac address='00:16:3e:24:27:a5'/> <script path='vif-bridge'/> </interface> <graphics type='vnc' port='5902'/> <disk type='file' device='disk'> <driver name='tap' type='aio'/> <source file='/virtual/images/webserv/webserv.img'/> <target dev='hda1'/> </disk> <console tty='/dev/pts/4'/> </devices> </domain> Am I missing something simple, or is there a bug? Thanks!

On Tue, Oct 09, 2007 at 09:20:27PM -0600, Mark Dehus wrote:
I am having some problems getting libvirt under python to work properly. I can setup new domains by using the createLinux() function, but when I attempt to use defineXML() it fails with no reason given other then "virDomainDefineXML() failed". I am using the same XML file for both functions.
This is on a Ubuntu 7.04 server running python 2.5 & libvirt 0.1.8 (from the ubuntu universe repo).
Could you please update to the current release (0.3.3), this seems a bit of a lost cause to try to debug bugs which may as well have been fixed for one year (0.1.8 was released Oct 16 2006). There have been so many fixes since then it really doesn't make sense to try to look at the problem without an update first. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (2)
-
Daniel Veillard
-
Mark Dehus