From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59427) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhci-0001No-26 for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:41:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XAhcZ-0001Zr-0m for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:41:32 -0400 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:65037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XAhcY-0001Zj-PP for qemu-devel@nongnu.org; Fri, 25 Jul 2014 11:41:22 -0400 Received: by mail-pa0-f53.google.com with SMTP id kq14so6186784pab.26 for ; Fri, 25 Jul 2014 08:41:21 -0700 (PDT) From: Sanidhya Kashyap Date: Fri, 25 Jul 2014 21:09:35 +0530 Message-Id: <1406302776-2306-12-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com> References: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com> Subject: [Qemu-devel] [PATCH RFC v2 11/12] VMState test: cancel mechanism for an already running vmstate testing process List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Sanidhya Kashyap , "Dr. David Alan Gilbert" , Juan Quintela Signed-off-by: Sanidhya Kashyap --- qapi-schema.json | 9 +++++++++ qmp-commands.hx | 19 +++++++++++++++++++ savevm.c | 16 ++++++++++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/qapi-schema.json b/qapi-schema.json index 13e922e..91f1672 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3574,3 +3574,12 @@ ## { 'command' : 'test-vmstates-set-period', 'data' : { 'period': 'int' } } + +## +# @log-dirty-bitmap-cancel +# +# cancel the testing vmstates process +# +# Since 2.2 +## +{ 'command': 'test-vmstates-cancel' } diff --git a/qmp-commands.hx b/qmp-commands.hx index 2f019b0..1035885 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3865,3 +3865,22 @@ Example: <- { "return": {} } EQMP + { + .name = "test-vmstates-cancel", + .args_type = "", + .mhandler.cmd_new = qmp_marshal_input_test_vmstates_cancel, + }, + +SQMP +test-vmstates-cancel +-------------- + +Cancel the current vmstate testing process. + +Arguments: None. + +Example: + +-> { "execute": "test-vmstates-cancel" } +<- { "return": {} } +EQMP diff --git a/savevm.c b/savevm.c index 8b75691..66597db 100644 --- a/savevm.c +++ b/savevm.c @@ -1365,8 +1365,12 @@ static void vmstate_test_cb(void *opaque) if (saved_vm_running) { vm_start(); } - timer_mod(v->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + - v->period); + if (v->active_state) { + timer_mod(v->timer, v->period + + qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); + } else { + goto testing_end; + } return; } @@ -1482,6 +1486,14 @@ void qmp_test_vmstates_set_period(int64_t period, Error **errp) v->period = period; } +void qmp_test_vmstates_cancel(Error **errp) +{ + VMStateLogState *v = vmstate_current_state(); + if (v->active_state) { + v->active_state = false; + } +} + void qmp_xen_save_devices_state(const char *filename, Error **errp) { QEMUFile *f; -- 1.9.3