From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZDpZ-0001ks-Ka for qemu-devel@nongnu.org; Tue, 08 Sep 2015 04:00:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZDpY-0000ip-Ew for qemu-devel@nongnu.org; Tue, 08 Sep 2015 04:00:41 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:44300 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZDpX-0000h3-O8 for qemu-devel@nongnu.org; Tue, 08 Sep 2015 04:00:40 -0400 From: "Denis V. Lunev" Date: Tue, 8 Sep 2015 11:00:25 +0300 Message-Id: <1441699228-25767-3-git-send-email-den@openvz.org> In-Reply-To: <1441699228-25767-1-git-send-email-den@openvz.org> References: <1441699228-25767-1-git-send-email-den@openvz.org> Subject: [Qemu-devel] [PATCH 2/5] disk_deadlines: add request to resume Virtual Machine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Raushaniya Maksudova , Stefan Hajnoczi , Paolo Bonzini , "Denis V. Lunev" From: Raushaniya Maksudova In some cases one needs to pause and resume a Virtual Machine from inside of Qemu. Currently there are request functions to pause VM (vmstop), but there are no respective ones to resume VM. Signed-off-by: Raushaniya Maksudova Signed-off-by: Denis V. Lunev CC: Stefan Hajnoczi CC: Kevin Wolf CC: Paolo Bonzini --- include/sysemu/sysemu.h | 1 + stubs/vm-stop.c | 5 +++++ vl.c | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 44570d1..a382ae1 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -62,6 +62,7 @@ void qemu_system_shutdown_request(void); void qemu_system_powerdown_request(void); void qemu_register_powerdown_notifier(Notifier *notifier); void qemu_system_debug_request(void); +void qemu_system_vmstart_request(void); void qemu_system_vmstop_request(RunState reason); void qemu_system_vmstop_request_prepare(void); int qemu_shutdown_requested_get(void); diff --git a/stubs/vm-stop.c b/stubs/vm-stop.c index 69fd86b..c8e2cdd 100644 --- a/stubs/vm-stop.c +++ b/stubs/vm-stop.c @@ -10,3 +10,8 @@ void qemu_system_vmstop_request(RunState state) { abort(); } + +void qemu_system_vmstart_request(void) +{ + abort(); +} diff --git a/vl.c b/vl.c index 584ca88..63f10d3 100644 --- a/vl.c +++ b/vl.c @@ -563,6 +563,7 @@ static RunState current_run_state = RUN_STATE_PRELAUNCH; /* We use RUN_STATE_MAX but any invalid value will do */ static RunState vmstop_requested = RUN_STATE_MAX; static QemuMutex vmstop_lock; +static bool vmstart_requested; typedef struct { RunState from; @@ -723,6 +724,19 @@ void qemu_system_vmstop_request(RunState state) qemu_notify_event(); } +static bool qemu_vmstart_requested(void) +{ + bool r = vmstart_requested; + vmstart_requested = false; + return r; +} + +void qemu_system_vmstart_request(void) +{ + vmstart_requested = true; + qemu_notify_event(); +} + void vm_start(void) { RunState requested; @@ -1884,6 +1898,10 @@ static bool main_loop_should_exit(void) if (qemu_vmstop_requested(&r)) { vm_stop(r); } + if (qemu_vmstart_requested()) { + vm_start(); + } + return false; } -- 2.1.4