>>import libvirt
>>con=libvirt.open('xen:///')
> libvirt.getVersion()
7002
>>dom=con.defineXML('<domain
type="xen"><name>rtiago_test2</name><clock
offset="utc"/><vcpu>8</vcpu><on_poweroff>restart</on_poweroff><devices><disk
device="disk" type="file"><source
file="/images/SLC-4-x86.img"/><driver name="file"/><target
bus="xen" dev="xvda1"/></disk><console
tty="/dev/pts/2" type="pty"><source
path="/dev/pts/2"/><target
port="0"/></console></devices><on_crash>restart</on_crash><currentMemory>300000</currentMemory><memory>300000</memory><on_reboot>restart</on_reboot><os><kernel>/root/vmlinuz</kernel><initrd>/root/initrd.img</initrd><type>linux</type><root>/dev/xvda1
ro</root><cmdline>rtiago</cmdline></os></domain>')
>> dom.create()
>>0
>> dom.destroy()
>> 0
>> dom.create()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib64/python2.4/site-packages/libvirt.py", line 287, in create
if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirt.libvirtError: Unknown failure
Every call to create will raise the same exception, It only works if I do a new connection
to the
hypervisor. Is there an workaround??