[libvirt-users] Bug? virGetLastError() returns NULL after virDomainCreate() if Domain running already

Guido Winkelmann guido-libvi at unknownsite.de
Thu Feb 23 12:40:03 UTC 2012


Am Mittwoch, 22. Februar 2012, 11:26:50 schrieb Eric Blake:
> On 02/22/2012 11:16 AM, Eric Blake wrote:
> > On 02/22/2012 07:06 AM, Guido Winkelmann wrote:
> >> Hi,
> >> 
> >> As the subject line indicates, when I'm calling virDomainCreate() to
> >> start a defined domain, and that command fails because the domain is
> >> already running at that point, virGetLastError() will return NULL,
> >> instead of a proper pointer to an error code.
> >> Libvirt will, however, print an error to the console:
> >> 
> >> libvir: QEMU error : Requested operation is not valid: domain is already
> >> running
> > 
> > Any return of NULL without a last error set is a bug.  I'm trying to
> > chase this down, and hope to have a patch soon.
> 
> I can't reproduce this.  I tested on libvirt 0.9.10, starting with an
> inactive domain 'dom' and using 'virsh dumpxml dom > dom.xml; virsh
> create dom.xml; virsh create dom.xml', and the second create gave me a
> proper error message of "Requested operation is not valid: domain is
> already active as 'dom'".

I cannot reproduce it with virsh either. The problem occured with the C API, 
maybe virsh does some extra testing before start a domain?

Also note that my case did not involve redefining the domain with a new XML 
definition, just starting a domain that had already been defined before.
 
> Can you post the code snippet you are using to get this situation?

Unfortunately, the problem occurs inside a fairly large, and unfortunately not 
Open-Source, C++ program. I will try to reduce it to a minimal testcase as 
soon as I get around to it.

> Could it be that you have a different name and/or UUID in the xml from
> the domain already running (my test obviously reused the same name and
> uuid from what is already running).

No. I'm essentially just using virDomainLookupByName() and then calling 
virDomainCreate() on the returned value. I'm not even touching any uuids.

	Guido




More information about the libvirt-users mailing list