[libvirt] Monitoring guest state (xen hvms)

Matthew Donovan matthew at atc-nycorp.com
Tue Sep 23 18:28:38 UTC 2008

I would like to be able to monitor the state of a Xen guest OS via
virDomainGetInfo (and Domain.getInfo() in the Java bindings.)  

When I start, pause, and resume the guest via the libvirt API, it works as
expected.  However, if I shutdown the guest vm by opening a VNC window and
actually selecting "shutdown" via the OS's favorite mechanism (e.g. Start ->
Shutdown in Windows), I lose the state.  In other words, virDomainGetInfo()
returns NOSTATE.

There was some conversation on this list a while ago about
virDomainGetInfo() returning NOSTATE so I added some code and recompiled
libvirt to print the value of the domain_flags returned from the xen
hypervisor.  _When_ it printed this value, it was always zero.  I stress the
"when" part because after the OS completely shuts down, the value of
domain_flags is no longer printed.  

I started virsh and did a list of VMs and the guest is gone.  However, if I
look at "xm list", the domain is still there. 

Is there a reliable way to monitor the guest state when the guest is
shutdown internally (i.e. via the guest OS itself)?


More information about the libvir-list mailing list