From: Daniel Gollub <[email protected]> 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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]> diff --git a/qemu-kvm.c b/qemu-kvm.c index b9dd80b..7111058 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 19464cf..7ca08c1 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 f2ed7f9..1f4a420 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; -- To unsubscribe from this list: send the line "unsubscribe kvm-commits" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
