qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH RFC v2 11/12] VMState test: cancel mechanism for an


From: Sanidhya Kashyap
Subject: [Qemu-devel] [PATCH RFC v2 11/12] VMState test: cancel mechanism for an already running vmstate testing process
Date: Fri, 25 Jul 2014 21:09:35 +0530

Signed-off-by: Sanidhya Kashyap <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]