[libvirt] creating domain with same name and different UUID

Nikola Ciprich extmaillist at linuxbox.cz
Mon Apr 12 10:58:08 UTC 2010


Hello,
I have small problem with libvirt, which I'm trying to solve...
I'm using defineXML function to create KVM machines.
from time to time, I need to delete the domain, and create new one with the same name.
every newly created domain has new UUID.
and this is where the problem starts, defineXML function documentation
tells that previous definition domain would be overriden if it already exists,
but it ends up with following error:

libvir: Domain Config error : operation failed: domain 'vmnci01' already exists with uuid 8d9795b3-461e-11df-9882-00304834195b
Traceback (most recent call last):
  File "/usr/libexec/vm2.py", line 173, in ?
    vm.start()
  File "/usr/libexec/vmmain2.py", line 433, in start
    self.dom = self.svconn.defineXML(self.xmldef.vm.domain.xml())
  File "/usr/lib64/python2.4/site-packages/libvirt.py", line 1120, in defineXML
    if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)
libvirt.libvirtError: operation failed: domain 'vmnci01' already exists with uuid 8d9795b3-461e-11df-9882-00304834195b

If I try to undefine domain first, it still seems to behave weirdly:
[root at vbox1 libexec]# vm __start__ vmnci01
undefining domain...
Starting HVM guest vmnci01
libvir: QEMU error : Domain not found: no domain with matching uuid '8d9795b3-461e-11df-9882-00304834195b'
Traceback (most recent call last):
  File "/usr/libexec/vm2.py", line 173, in ?
    vm.start()
  File "/usr/libexec/vmmain2.py", line 436, in start
    self.dom.create()
  File "/usr/lib64/python2.4/site-packages/libvirt.py", line 300, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid '8d9795b3-461e-11df-9882-00304834195b'
Could anybody help me with this? Am I doing something wrong?
Currently, I'm using libvirt-0.7.6
Thanks a lot in advance!
with best regards
nik

A

-- 
-------------------------------------
Ing. Nikola CIPRICH
LinuxBox.cz, s.r.o.
28. rijna 168, 709 01 Ostrava

tel.:   +420 596 603 142
fax:    +420 596 621 273
mobil:  +420 777 093 799
www.linuxbox.cz

mobil servis: +420 737 238 656
email servis: servis at linuxbox.cz
-------------------------------------




More information about the libvir-list mailing list