From: Jan Kiszka <jan.kiszka@siemens.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: "Jernej Simončič" <jernej.listsonly@ena.si>,
"Jean-Philippe Menil on [KVM]" <kvm@vger.kernel.org>,
"Jean-Philippe Menil" <jean-philippe.menil@univ-nantes.fr>,
kvm-owner@vger.kernel.org
Subject: Re: How to properly turn off guest VM on server shutdown?
Date: Mon, 25 Jan 2010 20:09:25 +0100 [thread overview]
Message-ID: <4B5DEC65.4030502@siemens.com> (raw)
In-Reply-To: <4B5DE70A.7050709@msgid.tls.msk.ru>
Michael Tokarev wrote:
> Jernej Simončič wrote:
>> On Sunday, January 24, 2010, 19:28:47, Jean-Philippe Menil wrote:
>>
>>> Maybe the same can be done with windows guest.
>> Should work with any Windows, and verified to work with Vista x64
>> guest.
>
> The only problem is that windows does not want to shut down when you
> need it.
>
> All versions of windows server requires enabling something in the
> registry - to notice the "power down" events to start with.
>
> If a windows machine is used by someone else (open files, logged in
> user etc), it brings a dialog box in response to "power down" event
> asking if you _really_ want to shut down since this machine is
> used over network.
>
> And finally, quite often during screensaver "work" windows notices
> the "power down" event only after some other event such as mouse
> move or a keypress.
>
> In order to shut down my windows guests I come to this version:
>
> {
> # moving mouse helps windows (xp) to notice the powerdown event
> echo mouse_move 1 1
> sleep .1
> echo system_powerdown
> sleep 1
> # also for windows, if it asks "ok to shutdown if in use?"
> echo sendkey ret
> sleep .1
> } | \
> nc -U -w2 -q2 $run/$name/mon > /dev/null
>
>
> That's netcat connecting to the guest's monitor which is a unix socket.
>
> The script performs similar task for all guests in first cycle,
> next it repeats the procedure but now waits for $max_guest_waittime,
> which should be sufficient for any guest to shut down. If the guest
> did not shut down in time, the script simple kills the guest.
>
> Note that "sleep 1" in the above is not necessary sufficient, as
> (windows) guest might be in swap and might need some time to
> draw the dialog box.
A cleaner alternative might be emulating the monitoring interface of
some standard UPS. It's somehow the same scenario: The virtual power is
about to vanish, let's inform the guest to shut down properly. And when
choosing a serial link, that should even be possible without modifying QEMU.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
prev parent reply other threads:[~2010-01-25 19:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-24 14:33 How to properly turn off guest VM on server shutdown? André Weidemann
2010-01-24 15:11 ` Daniel Bareiro
2010-01-24 15:15 ` Avi Kivity
2010-01-24 15:29 ` Anthony Liguori
2010-01-24 17:00 ` Daniel Bareiro
2010-01-24 17:16 ` Markus Breitländer
2010-01-26 13:46 ` Glennie Vignarajah
2010-01-26 14:01 ` Markus Breitländer
2010-01-26 15:55 ` Kenni Lund
2010-01-24 17:41 ` Avishay Traeger
2010-01-24 18:27 ` Daniel Bareiro
2010-01-24 18:45 ` Daniel Bareiro
2010-01-24 18:28 ` Jean-Philippe Menil
2010-01-24 20:07 ` Jernej Simončič
2010-01-25 18:46 ` Michael Tokarev
2010-01-25 19:09 ` Jan Kiszka [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B5DEC65.4030502@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=jean-philippe.menil@univ-nantes.fr \
--cc=jernej.listsonly@ena.si \
--cc=kvm-owner@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mjt@tls.msk.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox