
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.
This looks like a bug to me, and I'm fairly certain that earlier version would return an error code of VIR_ERR_OPERATION_INVALID at that point. Or maybe that was just virDomainDestroy(), and I'm just blindly assuming that virDomainCreate() will work analogously...
Anyway, no error code is bad, because I can't tell what happened.
If the create xml matches the already running xml, we could perhaps argue that this should return the already-running domain instead of NULL. But that seems like it might be more confusing, as we must not allow a second create attempt with xml that doesn't match what is currently running (you have to use hotplug apis to alter a running domain xml, not re-creation). -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org