public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-kvm: Handle -no-shutodwn
@ 2009-05-19 21:28 Daniel Gollub
  2009-05-20 11:51 ` Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Gollub @ 2009-05-19 21:28 UTC (permalink / raw)
  To: kvm

Plain QEMU has the parameter -no-shutdown. This avoids termination of the qemu
process when VM got shutdown (e.g. to still use the QEMU-Monitor with stopped
VM). This parameter has no effect on qemu-kvm, today.

This patch introduces identical handling, as in qemu, of -no-shutdown for
qemu-kvm:

 * termination of qemu-kvm process on a VM shutdown get only avoided once
 * second shutdown of VM cause termination of qemu-kvm (like in qemu)

Signed-off-by: Daniel Gollub <gollub@b1-systems.de>

--- 
 qemu-kvm.c |    9 ++++++---
 sysemu.h   |    1 +
 vl.c       |    7 +++++++
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/qemu-kvm.c b/qemu-kvm.c
index 5e4002b..b9926eb 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -597,9 +597,12 @@ int kvm_main_loop(void)
 
     while (1) {
         main_loop_wait(1000);
-        if (qemu_shutdown_requested())
-            break;
-        else if (qemu_powerdown_requested())
+        if (qemu_shutdown_requested()) {
+            if (qemu_no_shutdown()) {
+                vm_stop(0);
+            } else
+                break;
+	} else if (qemu_powerdown_requested())
             qemu_system_powerdown();
         else if (qemu_reset_requested())
 	    qemu_kvm_system_reset();
diff --git a/sysemu.h b/sysemu.h
index 1f45fd6..0dd184d 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -35,6 +35,7 @@ void cpu_disable_ticks(void);
 void qemu_system_reset_request(void);
 void qemu_system_shutdown_request(void);
 void qemu_system_powerdown_request(void);
+int qemu_no_shutdown(void);
 int qemu_shutdown_requested(void);
 int qemu_reset_requested(void);
 int qemu_powerdown_requested(void);
diff --git a/vl.c b/vl.c
index d9f0607..9b2a420 100644
--- a/vl.c
+++ b/vl.c
@@ -3644,6 +3644,13 @@ static int powerdown_requested;
 static int debug_requested;
 static int vmstop_requested;
 
+int qemu_no_shutdown(void)
+{
+    int r = no_shutdown;
+    no_shutdown = 0;
+    return r;
+}
+
 int qemu_shutdown_requested(void)
 {
     int r = shutdown_requested;

-- 
Daniel Gollub                        Geschaeftsfuehrer: Ralph Dehner
FOSS Developer                       Unternehmenssitz:  Vohburg
B1 Systems GmbH                      Amtsgericht:       Ingolstadt
Mobil: +49-(0)-160 47 73 970         Handelsregister:   HRB 3537
EMail: gollub@b1-systems.de          http://www.b1-systems.de

Adresse: B1 Systems GmbH, Osterfeldstraße 7, 85088 Vohburg
http://pgpkeys.pca.dfn.de/pks/lookup?op=get&search=0xED14B95C2F8CA78D

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

* Re: [PATCH] qemu-kvm: Handle -no-shutodwn
  2009-05-19 21:28 [PATCH] qemu-kvm: Handle -no-shutodwn Daniel Gollub
@ 2009-05-20 11:51 ` Avi Kivity
  2009-05-20 12:20   ` Daniel Gollub
  0 siblings, 1 reply; 3+ messages in thread
From: Avi Kivity @ 2009-05-20 11:51 UTC (permalink / raw)
  To: Daniel Gollub; +Cc: kvm

Daniel Gollub wrote:
> Plain QEMU has the parameter -no-shutdown. This avoids termination of the qemu
> process when VM got shutdown (e.g. to still use the QEMU-Monitor with stopped
> VM). This parameter has no effect on qemu-kvm, today.
>
> This patch introduces identical handling, as in qemu, of -no-shutdown for
> qemu-kvm:
>
>  * termination of qemu-kvm process on a VM shutdown get only avoided once
>  * second shutdown of VM cause termination of qemu-kvm (like in qemu)
>
>   

Applied, thanks.

What is the reason for the wierd semantics?  I'd expect -no-shutdown to 
keep functioning even after the first shutdown.

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


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

* Re: [PATCH] qemu-kvm: Handle -no-shutodwn
  2009-05-20 11:51 ` Avi Kivity
@ 2009-05-20 12:20   ` Daniel Gollub
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Gollub @ 2009-05-20 12:20 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

On Wednesday 20 May 2009 01:51:16 pm Avi Kivity wrote:
> Daniel Gollub wrote:
> > Plain QEMU has the parameter -no-shutdown. This avoids termination of the
> > qemu process when VM got shutdown (e.g. to still use the QEMU-Monitor
> > with stopped VM). This parameter has no effect on qemu-kvm, today.
> >
> > This patch introduces identical handling, as in qemu, of -no-shutdown for
> > qemu-kvm:
> >
> >  * termination of qemu-kvm process on a VM shutdown get only avoided once
> >  * second shutdown of VM cause termination of qemu-kvm (like in qemu)
> >
> >  
>
> Applied, thanks.
>
> What is the reason for the wierd semantics?

No idea.

> I'd expect -no-shutdown to
> keep functioning even after the first shutdown.

I would prefer something like this as well. But this way it's 1:1 the same 
behavior as with plain QEMU. I'll prepare a propsoal + patch for changing this 
in QEMU. If this gets accepted i'll changed it for qemu-kvm as well.

Best Regards,
Daniel

-- 
Daniel Gollub                        Geschaeftsfuehrer: Ralph Dehner
FOSS Developer                       Unternehmenssitz:  Vohburg
B1 Systems GmbH                      Amtsgericht:       Ingolstadt
Mobil: +49-(0)-160 47 73 970         Handelsregister:   HRB 3537
EMail: gollub@b1-systems.de          http://www.b1-systems.de

Adresse: B1 Systems GmbH, Osterfeldstraße 7, 85088 Vohburg
http://pgpkeys.pca.dfn.de/pks/lookup?op=get&search=0xED14B95C2F8CA78D

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

end of thread, other threads:[~2009-05-20 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-19 21:28 [PATCH] qemu-kvm: Handle -no-shutodwn Daniel Gollub
2009-05-20 11:51 ` Avi Kivity
2009-05-20 12:20   ` Daniel Gollub

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox