ClusterLabs/resource-agents — pull request #83 by raoulbhatia (2012-05-10 12:09:40+00:00)
Title: Med: VirtualDomain: honor virsh "in shutdown" state

Using libvirt 0.9.8 / qemu 1.0 / kvm from kernel 3.2.0,
"virsh list" briefly shows the virtual maschine in a
"in shutdown" state during a regular "virsh shutdown"
operation:

Id Name State
----------------------------------
5 testvm1 running
6 testvm2 running

...
5 testvm1 running
5 testvm1 running
...
5 testvm1 in shutdown
5 testvm1 in shutdown
...
- testvm1 shut off
- testvm1 shut off
...

The VirtualDomain resource agent does not recognize this
state and thus issues a "virsh destroy" command.

This patch correctly handles "in shutdown" as a "this virtual
machine is still running" state.

See also: libvirt's tools/virsh.c:
static const char * vshDomainStateToString(int state)

PS: in the virsh manpage, there is a reference to a "dying" state looks like the "in shutdown" state. most probably there is something messed up :)

http://libvirt.org/git/?p=libvirt.git;a=blob;f=tools/virsh.c;h=dd9292a1f08391146e4a8588042056cd55453e69;hb=HEAD#l19109 vs.
http://libvirt.org/git/?p=libvirt.git;a=blob;f=tools/virsh.pod;h=ef7171702a49cce94999fbe7753047bb5eca40af;hb=HEAD#l371 vs.
http://docs.oracle.com/cd/E19082-01/819-2240/virsh-1m/index.html (as an example from a well known distribution)