[libvirt-users] Programmatically force shutdown a guest: possible?

Pasquale Dir phate867 at gmail.com
Sun Mar 30 08:47:23 UTC 2014


Yes, you are right.
Listen, as the documentation is not very exaustive, can you explain briefly
to me how a guest agent works?
After installing it via the apt-get on the hypervisor (I am using ubuntu as
host system) how can I create a script which would do this?
That is waiting for an acpi signal and actually shut down the guest.

And what other operation can you actually do with a guest agent? I would be
interested in getting the current amount of memory the guest is using
too...as libvirt apis just tell me the max memory allocated.


2014-03-29 15:12 GMT+01:00 Eric Blake <eblake at redhat.com>:

> On 03/29/2014 06:21 AM, Pasquale Dir wrote:
> > I am looking at the shutdown method, but if the guest system is a desktop
> > system, like for example ubuntu, it just has the effect to show a box
> > prompting the user for a shutdown/reboot/ and such.
> >
> > I could enter the guest and change this default behaviour and it actually
> > works..but I'd like for a way to send a shutdown command without doing
> so.
> >
> > Is it possible?
>
> Guest shutdown is ALWAYS a cooperative action.  It sounds like your
> guest defaults to an interactive shutdown when an ACPI shutdown request
> is received.  You can install qemu-guest-agent in your guest and send
> shutdown via the agent instead of via ACPI - that may be a bit more
> responsive at doing an immediate shutdown.  But beyond that, no, there
> is no way to guarantee a graceful guest shutdown without guest
> cooperation.  If you must stop a guest, and shutdown is taking too long
> because the guest is not cooperating, then use the 'virsh destroy' command.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140330/8fd178da/attachment.htm>


More information about the libvirt-users mailing list