public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* How to properly turn off guest VM on server shutdown?
@ 2010-01-24 14:33 André Weidemann
  2010-01-24 15:11 ` Daniel Bareiro
  0 siblings, 1 reply; 16+ messages in thread
From: André Weidemann @ 2010-01-24 14:33 UTC (permalink / raw)
  To: kvm

Hi,
is there a mechanism inside qemu-kvm that can shutdown the OS inside a 
VM when the qemu-kvm process receives a kill signal?
I am running Windows7 Pro inside a VM and I would like kvm to shut the 
Windows system down before the process is killed.
I know that VMware can shut down the guest OS when stopping the VMware 
instance. Is there a similar feature in KVM?

Regards
  André

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  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
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Bareiro @ 2010-01-24 15:11 UTC (permalink / raw)
  To: kvm

[-- Attachment #1: Type: text/plain, Size: 901 bytes --]

On Sunday, 24 January 2010 15:33:21 +0100,
André Weidemann wrote:

> Hi,

Hi, André.

> is there a mechanism inside qemu-kvm that can shutdown the OS inside a  
> VM when the qemu-kvm process receives a kill signal?
> I am running Windows7 Pro inside a VM and I would like kvm to shut the  
> Windows system down before the process is killed.
> I know that VMware can shut down the guest OS when stopping the VMware  
> instance. Is there a similar feature in KVM?

It is an interesting question :-)

I know that this can be done with libvirt. I had tested it with
GNU/Linux and it worked. I don't use Windows, so I cannot help you in
this sense.

But also it would interest to me to know if this can be done without
using libvirt.

Regards,
Daniel
-- 
Fingerprint: BFB3 08D6 B4D1 31B2 72B9  29CE 6696 BF1B 14E6 1D37
Powered by Debian GNU/Linux Lenny - Linux user #188.598

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-24 15:11 ` Daniel Bareiro
@ 2010-01-24 15:15   ` Avi Kivity
  2010-01-24 15:29     ` Anthony Liguori
  0 siblings, 1 reply; 16+ messages in thread
From: Avi Kivity @ 2010-01-24 15:15 UTC (permalink / raw)
  To: dbareiro, kvm

On 01/24/2010 05:11 PM, Daniel Bareiro wrote:
> But also it would interest to me to know if this can be done without
> using libvirt.
>    

Well, it can, but you get to duplicate all the libvirt code that does this.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  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:41       ` Avishay Traeger
  0 siblings, 2 replies; 16+ messages in thread
From: Anthony Liguori @ 2010-01-24 15:29 UTC (permalink / raw)
  To: Avi Kivity; +Cc: dbareiro, kvm

On 01/24/2010 09:15 AM, Avi Kivity wrote:
> On 01/24/2010 05:11 PM, Daniel Bareiro wrote:
>> But also it would interest to me to know if this can be done without
>> using libvirt.
>
> Well, it can, but you get to duplicate all the libvirt code that does 
> this.

I don't think it can.  The original question was whether QEMU could 
initiate an ACPI shutdown when it receives a kill signal.  It cannot and 
it's unclear to me if it's a good thing for us to do.

But the origin of the question here is probably, can something 
automatically shut down guests when a machine shutdowns down via the 
normal mechanism.  AFAIK, libvirt does not support this today although 
there are some scripts floating around the intertubes that can drive 
this operation through libvirt.

Regards,

Anthony Liguori


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-24 15:29     ` Anthony Liguori
@ 2010-01-24 17:00       ` Daniel Bareiro
  2010-01-24 17:16         ` Markus Breitländer
  2010-01-24 17:41       ` Avishay Traeger
  1 sibling, 1 reply; 16+ messages in thread
From: Daniel Bareiro @ 2010-01-24 17:00 UTC (permalink / raw)
  To: kvm

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

Hi, Anthony.

On Sunday, 24 January 2010 09:29:08 -0600,
Anthony Liguori wrote:

> But the origin of the question here is probably, can something
> automatically shut down guests when a machine shutdowns down via the
> normal mechanism.  AFAIK, libvirt does not support this today although
> there are some scripts floating around the intertubes that can drive
> this operation through libvirt.

Well.. perhaps I'm confused because I did these tests a long time ago.
But now that you mention it, I believe that I had tried was that,
through virsh commands, the VM shutdown could be done from the VMHost
being it always running.

I suppose that scripts that you mention will call to virsh when shutdown
becomes of the VMHost.

Regards,
Daniel
-- 
Fingerprint: BFB3 08D6 B4D1 31B2 72B9  29CE 6696 BF1B 14E6 1D37
Powered by Debian GNU/Linux Lenny - Linux user #188.598

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-24 17:00       ` Daniel Bareiro
@ 2010-01-24 17:16         ` Markus Breitländer
  2010-01-26 13:46           ` Glennie Vignarajah
  0 siblings, 1 reply; 16+ messages in thread
From: Markus Breitländer @ 2010-01-24 17:16 UTC (permalink / raw)
  To: kvm

Hi!

Does anyone have sample scripts for this job?

I know you can send the 'system_powerdown' command to the qemu-monitor,
this CAN work for windows guests as far as i know.

What other commands could be used in shutdown scripts?

Regards,
  Markus


Am 24.01.2010 18:00, schrieb Daniel Bareiro:
> Hi, Anthony.
> 
> On Sunday, 24 January 2010 09:29:08 -0600,
> Anthony Liguori wrote:
> 
>> But the origin of the question here is probably, can something
>> automatically shut down guests when a machine shutdowns down via the
>> normal mechanism.  AFAIK, libvirt does not support this today although
>> there are some scripts floating around the intertubes that can drive
>> this operation through libvirt.
> 
> Well.. perhaps I'm confused because I did these tests a long time ago.
> But now that you mention it, I believe that I had tried was that,
> through virsh commands, the VM shutdown could be done from the VMHost
> being it always running.
> 
> I suppose that scripts that you mention will call to virsh when shutdown
> becomes of the VMHost.
> 
> Regards,
> Daniel


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-24 15:29     ` Anthony Liguori
  2010-01-24 17:00       ` Daniel Bareiro
@ 2010-01-24 17:41       ` Avishay Traeger
  2010-01-24 18:27         ` Daniel Bareiro
  2010-01-24 18:28         ` Jean-Philippe Menil
  1 sibling, 2 replies; 16+ messages in thread
From: Avishay Traeger @ 2010-01-24 17:41 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Avi Kivity, dbareiro, kvm, kvm-owner

kvm-owner@vger.kernel.org wrote on 01/24/2010 05:29:08 PM:
> Anthony Liguori <anthony@codemonkey.ws>
> But the origin of the question here is probably, can something
> automatically shut down guests when a machine shutdowns down via the
> normal mechanism.  AFAIK, libvirt does not support this today although
> there are some scripts floating around the intertubes that can drive
> this operation through libvirt.

Does the 'system_powerdown' monitor command initiate an ACPI shutdown?  If
so, I guess you can make an rc.d script that calls it during shutdown?

Avishay


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  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
  1 sibling, 1 reply; 16+ messages in thread
From: Daniel Bareiro @ 2010-01-24 18:27 UTC (permalink / raw)
  To: kvm

[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]

On Sunday, 24 January 2010 19:41:42 +0200,
Avishay Traeger wrote:

> > But the origin of the question here is probably, can something
> > automatically shut down guests when a machine shutdowns down via the
> > normal mechanism.  AFAIK, libvirt does not support this today
> > although there are some scripts floating around the intertubes that
> > can drive this operation through libvirt.

> Does the 'system_powerdown' monitor command initiate an ACPI shutdown?
> If so, I guess you can make an rc.d script that calls it during
> shutdown?

Interesting... I didn't know this command of Qemu Monitor.

Doing a test being connected to one of my guest by serial console, I see
that when executing the command from Qemu Monitor, guest does a normal
shutdown. But for this I believe that acpi package (Debian) must be
installed.

Thanks for the information!

Regards,
Daniel
-- 
Fingerprint: BFB3 08D6 B4D1 31B2 72B9  29CE 6696 BF1B 14E6 1D37
Powered by Debian GNU/Linux Lenny - Linux user #188.598

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-24 17:41       ` Avishay Traeger
  2010-01-24 18:27         ` Daniel Bareiro
@ 2010-01-24 18:28         ` Jean-Philippe Menil
  2010-01-24 20:07           ` Jernej Simončič
  1 sibling, 1 reply; 16+ messages in thread
From: Jean-Philippe Menil @ 2010-01-24 18:28 UTC (permalink / raw)
  To: kvm; +Cc: kvm-owner

[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]

Avishay Traeger a écrit :
> kvm-owner@vger.kernel.org wrote on 01/24/2010 05:29:08 PM:
>   
>> Anthony Liguori <anthony@codemonkey.ws>
>> But the origin of the question here is probably, can something
>> automatically shut down guests when a machine shutdowns down via the
>> normal mechanism.  AFAIK, libvirt does not support this today although
>> there are some scripts floating around the intertubes that can drive
>> this operation through libvirt.
>>     
>
> Does the 'system_powerdown' monitor command initiate an ACPI shutdown?  If
> so, I guess you can make an rc.d script that calls it during shutdown?
>
> Avishay
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>   
Under a linux guest with the acpi package , it can be done with libvirt,
and it's work fine.

http://libvirt.org/formatdomain.html :
"||ACPI is useful for power management, for example, with KVM guests it 
is required for graceful shutdown to work."

Maybe the same can be done with windows guest.
I've never tested.

Regards


[-- Attachment #2: jean-philippe_menil.vcf --]
[-- Type: text/x-vcard, Size: 433 bytes --]

begin:vcard
fn:Jean-Philippe Menil
n:Menil;Jean-Philippe
org;quoted-printable:Universit=C3=A9 de Nantes;IRTS - DSI
adr;quoted-printable:;;2, rue de la Houssini=C3=A8re;Nantes;Loire-Atlantique;44322;France
email;internet:jean-philippe.menil@univ-nantes.fr
title;quoted-printable:Administrateur r=C3=A9seau
tel;work:02.51.12.53.92
tel;fax:02.51.12.58.60
x-mozilla-html:FALSE
url:http://www.criun.univ-nantes.fr/
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-24 18:27         ` Daniel Bareiro
@ 2010-01-24 18:45           ` Daniel Bareiro
  0 siblings, 0 replies; 16+ messages in thread
From: Daniel Bareiro @ 2010-01-24 18:45 UTC (permalink / raw)
  To: kvm

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

On Sunday, 24 January 2010 15:27:23 -0300,
Daniel Bareiro wrote:

> > Does the 'system_powerdown' monitor command initiate an ACPI
> > shutdown?  If so, I guess you can make an rc.d script that calls it
> > during shutdown?
 
> Interesting... I didn't know this command of Qemu Monitor.
> 
> Doing a test being connected to one of my guest by serial console, I
> see that when executing the command from Qemu Monitor, guest does a
> normal shutdown. But for this I believe that acpi package (Debian)
> must be installed.

Hmmm... but this does not work in OpenBSD with stock kernel with mpbios
disabled. It will be necessary to configure something additional?

Regards,
Daniel
-- 
Fingerprint: BFB3 08D6 B4D1 31B2 72B9  29CE 6696 BF1B 14E6 1D37
Powered by Debian GNU/Linux Lenny - Linux user #188.598

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-24 18:28         ` Jean-Philippe Menil
@ 2010-01-24 20:07           ` Jernej Simončič
  2010-01-25 18:46             ` Michael Tokarev
  0 siblings, 1 reply; 16+ messages in thread
From: Jernej Simončič @ 2010-01-24 20:07 UTC (permalink / raw)
  To: Jean-Philippe Menil on [KVM]; +Cc: Jean-Philippe Menil, kvm-owner

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.

-- 
< Jernej Simončič ><><><><>< http://eternallybored.org/ >

It works better if you plug it in.
       -- Sattinger's Law


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-24 20:07           ` Jernej Simončič
@ 2010-01-25 18:46             ` Michael Tokarev
  2010-01-25 19:09               ` Jan Kiszka
  0 siblings, 1 reply; 16+ messages in thread
From: Michael Tokarev @ 2010-01-25 18:46 UTC (permalink / raw)
  To: Jernej Simončič
  Cc: Jean-Philippe Menil on [KVM], Jean-Philippe Menil, kvm-owner

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.

/mjt

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-25 18:46             ` Michael Tokarev
@ 2010-01-25 19:09               ` Jan Kiszka
  0 siblings, 0 replies; 16+ messages in thread
From: Jan Kiszka @ 2010-01-25 19:09 UTC (permalink / raw)
  To: Michael Tokarev
  Cc: Jernej Simončič, Jean-Philippe Menil on [KVM],
	Jean-Philippe Menil, kvm-owner

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-24 17:16         ` Markus Breitländer
@ 2010-01-26 13:46           ` Glennie Vignarajah
  2010-01-26 14:01             ` Markus Breitländer
  0 siblings, 1 reply; 16+ messages in thread
From: Glennie Vignarajah @ 2010-01-26 13:46 UTC (permalink / raw)
  To: Markus Breitländer; +Cc: kvm

Le 24/01/2010 vers 18:16, dans le message intitulé "Re: How to properly turn 
off guest VM on server shutdown?", Markus Breitländer(Markus Breitländer 
<breitlaender@stud.fh-dortmund.de>) a écrit:

> Hi!

Hello;

> Does anyone have sample scripts for this job?

#!/bin/bash
CONNECT_STRING="qemu:///system"
for MACHINE in $(virsh -c "$CONNECT_STRING" list | awk '/running$/ {print 
$2}') ; do
  virsh -c "$CONNECT_STRING" shutdown $MACHINE
done
sleep 600

This code will shutdown all runnning hosts with acpi en enabled.
I haven't tested it under windows Seven, but under win 2003, you have modify:

 * Using regedit the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\Windows and set the value "ShutdownWarningDialogTimeout" to 
dword:00000001 (this will force shutdown even if users are connected)


AND

 * Goto Control Pannel, admin tools and double-click "Local security settings"
 * Expand "Local policies" and click on "Security Options" (left window pan)
 * On the right side, locate "Shutdown: Allow system to be shutdown..." and 
enable the option(this allows to powerdown on ctr-alt-del screen".

HTH

-- 
http://www.glennie.fr
If the only tool you have is hammer, you tend to see every problem as a nail.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-26 13:46           ` Glennie Vignarajah
@ 2010-01-26 14:01             ` Markus Breitländer
  2010-01-26 15:55               ` Kenni Lund
  0 siblings, 1 reply; 16+ messages in thread
From: Markus Breitländer @ 2010-01-26 14:01 UTC (permalink / raw)
  Cc: kvm

Hello Glennie,

Am 26.01.2010 14:46, schrieb Glennie Vignarajah:
> Le 24/01/2010 vers 18:16, dans le message intitulé "Re: How to properly turn 
> off guest VM on server shutdown?", Markus Breitländer(Markus Breitländer 
> <breitlaender@stud.fh-dortmund.de>) a écrit:
> 
>> Hi!
> 
> Hello;
> 
>> Does anyone have sample scripts for this job?
> 
> #!/bin/bash
> CONNECT_STRING="qemu:///system"
> for MACHINE in $(virsh -c "$CONNECT_STRING" list | awk '/running$/ {print 
> $2}') ; do
>   virsh -c "$CONNECT_STRING" shutdown $MACHINE
> done
> sleep 600
> 
> This code will shutdown all runnning hosts with acpi en enabled.
> I haven't tested it under windows Seven, but under win 2003, you have modify:
> 
>  * Using regedit the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows 
> NT\CurrentVersion\Windows and set the value "ShutdownWarningDialogTimeout" to 
> dword:00000001 (this will force shutdown even if users are connected)
> 
> 
> AND
> 
>  * Goto Control Pannel, admin tools and double-click "Local security settings"
>  * Expand "Local policies" and click on "Security Options" (left window pan)
>  * On the right side, locate "Shutdown: Allow system to be shutdown..." and 
> enable the option(this allows to powerdown on ctr-alt-del screen".
> 
> HTH

I was thinking about a script that doesn't use virsh.

I would be intrested in what commands virsh uses in it's 'shutdown'
command...

I haven't been working on my own script yet. Up to know i have in mind
to use qemu monitor command 'system_powerdown' and maybe ssh into linux
boxes to get em down (but the latter is not really nice).
By the way when testing manually, i experianced you might want to use
the 'system_powerdown' command twice / execute it two times shortly
after another to get windows machines down.

Greets,
  Markus


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: How to properly turn off guest VM on server shutdown?
  2010-01-26 14:01             ` Markus Breitländer
@ 2010-01-26 15:55               ` Kenni Lund
  0 siblings, 0 replies; 16+ messages in thread
From: Kenni Lund @ 2010-01-26 15:55 UTC (permalink / raw)
  To: Markus Breitländer; +Cc: kvm

2010/1/26 Markus Breitländer <breitlaender@stud.fh-dortmund.de>:
> Hello Glennie,
>
> Am 26.01.2010 14:46, schrieb Glennie Vignarajah:
>> Le 24/01/2010 vers 18:16, dans le message intitulé "Re: How to properly turn
>> off guest VM on server shutdown?", Markus Breitländer(Markus Breitländer
>> <breitlaender@stud.fh-dortmund.de>) a écrit:
>>
>>> Hi!
>>
>> Hello;
>>
>>> Does anyone have sample scripts for this job?
>>
>> #!/bin/bash
>> CONNECT_STRING="qemu:///system"
>> for MACHINE in $(virsh -c "$CONNECT_STRING" list | awk '/running$/ {print
>> $2}') ; do
>>   virsh -c "$CONNECT_STRING" shutdown $MACHINE
>> done
>> sleep 600
>>
>> This code will shutdown all runnning hosts with acpi en enabled.
>> I haven't tested it under windows Seven, but under win 2003, you have modify:
>>
>>  * Using regedit the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
>> NT\CurrentVersion\Windows and set the value "ShutdownWarningDialogTimeout" to
>> dword:00000001 (this will force shutdown even if users are connected)
>>
>>
>> AND
>>
>>  * Goto Control Pannel, admin tools and double-click "Local security settings"
>>  * Expand "Local policies" and click on "Security Options" (left window pan)
>>  * On the right side, locate "Shutdown: Allow system to be shutdown..." and
>> enable the option(this allows to powerdown on ctr-alt-del screen".
>>
>> HTH
>
> I was thinking about a script that doesn't use virsh.

I suppose you can start your guest with
-monitor unix:/${SOCKETFILE},server,nowait

and then do something like:
socat - unix-connect:${SOCKETFILE} <<EOF
system_powerdown
EOF

Best Regards
Kenni Lund

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-01-26 15:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox