aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gollub <gollub@b1-systems.de>2009-05-19 23:28:31 +0200
committerAvi Kivity <avi@redhat.com>2009-05-21 11:56:20 +0300
commit18b35c2a97e55e763a5ec86f1cffec3c8060a4b8 (patch)
tree6e21bf656586c477bdb28b3c9ec416e5da0b6c75
parentc4ad53bc914cdd100e923f3b9abca1bf7ff351a1 (diff)
Handle -no-shutdown correctly
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> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--qemu-kvm.c9
-rw-r--r--sysemu.h1
-rw-r--r--vl.c7
3 files changed, 14 insertions, 3 deletions
diff --git a/qemu-kvm.c b/qemu-kvm.c
index b9dd80ba8..71110583d 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -594,9 +594,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 19464cffb..7ca08c194 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -28,6 +28,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 f2ed7f96d..1f4a420de 100644
--- a/vl.c
+++ b/vl.c
@@ -3587,6 +3587,13 @@ static int reset_requested;
static int shutdown_requested;
static int powerdown_requested;
+int qemu_no_shutdown(void)
+{
+ int r = no_shutdown;
+ no_shutdown = 0;
+ return r;
+}
+
int qemu_shutdown_requested(void)
{
int r = shutdown_requested;