[libvirt] creating domain with same name and different UUID

Daniel P. Berrange berrange at redhat.com
Mon Apr 12 15:14:53 UTC 2010


On Mon, Apr 12, 2010 at 12:58:08PM +0200, Nikola Ciprich wrote:
> 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?

The old python object representing the original virDomainPtr  is likely
not yet garbage collected. Python is rather painful in this respect,
because even assigning None to the object won't immediately garbage
collect it  sometimes.


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list