[libvirt-users] Better error codes when stopping a VM that is already stopped

Guido Winkelmann guido-libvi at unknownsite.de
Fri May 21 12:11:47 UTC 2010


Hi,

Sometimes when stopping a virtual domain using virDomainDestroy(), I come 
across a domain that is already stopped. (For example when someone already 
stopped the domain manually using virsh or because the guest OS issued a 
shutdown.) This is a special case that I absolutely need to catch and handle.

Unfortunately, when this happens, and I call virGetLastError() afterwards, I 
always just get the error code VIR_ERR_OPERATION_INVALID, which doesn't look 
very precise to me...

Two questions about this:

Is the domain not running at that moment the only possible condition that can 
trigger this particular error code when calling virDomainDestroy()?

Can't we have a more obvious/precise error code in that case, like 
VIR_ERR_DOMAIN_NOT_RUNNING or something like that?

	Guido Winkelmann




More information about the libvirt-users mailing list