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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Wed, Jan 13, 2010 at 2:39 AM, Daniel P. Berrange <berrange@xxxxxxxxxx> wrote:
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.


Hmm, got it. If free all the returned virDomainPtr, then the issue is gone.
One frustrated thing is that the API virDomainDefineXML, which returns a virDomainPtr, I need to explicitly free it, even I don't reference it after that function call... Got me crazy to debug it. Maybe it's better to mention it in the API reference?

Another thing is "/* TODO search by UUID first as they are better differenciators */" in virGetDomain, if libvirt does what it said here, my issue will not be an issue again, right?
 

>        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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]