[libvirt] [BUG?] "no domain with matching uuid" error, when vm restarts

Daniel P. Berrange berrange at redhat.com
Wed Jan 13 10:39:08 UTC 2010


On Tue, Jan 12, 2010 at 04:06:32PM -0800, su disheng wrote:
> Hi,
>     In the following libvirt API calling sequence, I always get an error "no
> domain with matching uuid"
>         Connect _conn = new Connect("qemu:///system", false);
>          _conn.domainDefineXML(kvm_guest_xml);
>          Domain dm = _conn.domainLookupByName(kvm_guest_name);
>          dm.create();
> 
>          /* stop, undefine, and re-start the vm*/
>          dm.shutdown();
>          dm.undefine();
>          dm.domainDefineXML(kvm_guest_xml);
>          /****A****/
>          Domain dm = _conn.domainLookupByName(kvm_guest_name);
>          dm.create()  /********Error!!!!**/
> 
>        if I close the connection, and re-connect qemu at the end of
> /****A****/, then everything is OK.

I think the first 'dm'  object you create is not being freed / garbage
collected. This means the underlying libvirt virDomainPtr object is
not released. And so when you then _conn.domainLookupByName() after
'****A****'  you are still getting an handle to the old object and
thus the stale UUID.


>        From the log, seems that uuid is not updated immediately, for this
> connection, the uuid is in the stale state?
>        I am using libvirt 0.6.3, if it's a bug, does it fixed in the latest
> code? or Have I need to close the connection for each vm shutdown/re-define?

You should not need to close the connection, provided you ensure all the
'Domain' objects are freed/garbage collected

Alternatively, if you wish to re-use the same name,then you could try
auto-generating the  UUID yourself, so you use the same UUID when
defining the domain for the second time


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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