Guido Winkelmann
2012-Feb-22 14:06 UTC
[libvirt-users] Bug? virGetLastError() returns NULL after virDomainCreate() if Domain running already
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 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. This is version 0.9.8. I couldn't find anything about this issue in the changelogs for 0.9.9 and 0.9.10, so I'm assuming the issue has not been addressed since. Guido
Eric Blake
2012-Feb-22 18:16 UTC
[libvirt-users] Bug? virGetLastError() returns NULL after virDomainCreate() if Domain running already
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 > runningAny 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 at redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 620 bytes Desc: OpenPGP digital signature URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20120222/3e1e252a/attachment.sig>
Reasonably Related Threads
- Better error codes when stopping a VM that is already stopped
- transient configure turn to persistent configure
- Thread-safety issues with vbox driver ?
- [PATCH libguestfs v3] lib: Handle slow USB devices more gracefully.
- Error creating virtual machine: Error: Error creating new domain (virDomainCreate). Subsystem qemu: internal error