qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH RFC v2 07/12] VMState test: qmp interface for queryi


From: Sanidhya Kashyap
Subject: [Qemu-devel] [PATCH RFC v2 07/12] VMState test: qmp interface for querying the vmstate testing process
Date: Fri, 25 Jul 2014 21:09:31 +0530

This patch provides the information about an already executing testing
process. I have modified the qmp command to query-test-vmstates from
test-vmstates-get-info.

Signed-off-by: Sanidhya Kashyap <address@hidden>
---
 qapi-schema.json | 34 ++++++++++++++++++++++++++++++++++
 qmp-commands.hx  | 25 +++++++++++++++++++++++++
 savevm.c         | 18 ++++++++++++++++++
 3 files changed, 77 insertions(+)

diff --git a/qapi-schema.json b/qapi-schema.json
index ec48977..a12872f 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3528,3 +3528,37 @@
            '*period':     'int',
            'noqdev':      'bool',
            '*qdevices':   'VMStatesQdevDevices' } }
+
+##
+# @VMStateLogStateInfo
+#
+# VMState testing information
+# Tells about the current iteration, the total iterations
+# that have been provided and the sleep interval
+#
+# @current-iteration: shows the current iteration at which
+# the test is in.
+#
+# @iterations: the allocated total iterations for the vmstate
+# testing process.
+#
+# @period: the allowed sleep interval between each iteration
+#          (in milliseconds).
+#
+# Since 2.2
+##
+{ 'type': 'VMStateLogStateInfo',
+  'data': { 'current-iteration': 'int',
+            'iterations':        'int',
+            'period':            'int' } }
+
+##
+# @query-test-vmstates
+#
+# Get the current parameters value of the vmstate testing process.
+#
+# Returns VMStateLogStateInfo structure.
+#
+# Since 2.2
+##
+{ 'command': 'query-test-vmstates', 'returns': 'VMStateLogStateInfo' }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 6210f56..0a40a88 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3817,3 +3817,28 @@ Example:
         "noqdev": false } }
 <- { "return": {} }
 EQMP
+
+    {
+        .name       = "query-test-vmstates",
+        .args_type  = "",
+        .mhandler.cmd_new = qmp_marshal_input_query_test_vmstates,
+    },
+
+SQMP
+query-test-vmstates-info
+------------------------
+
+Get the parameters information
+
+- "current_iteration": the current iteration going on
+- "iterations:" the total number of assigned iterations
+- "period": the sleep interval between the iteration
+
+Example:
+
+-> { "execute": "query-test-vmstates" }
+<- { "return": {
+            "current_iteration": 3,
+            "iterations": 100,
+            "period": 100 } }
+EQMP
diff --git a/savevm.c b/savevm.c
index b5e53b8..793fee7 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1451,6 +1451,24 @@ void qmp_test_vmstates(bool has_iterations, int64_t 
iterations,
     timer_mod(v->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
 }
 
+VMStateLogStateInfo *qmp_query_test_vmstates(Error **errp)
+{
+    VMStateLogState *v = vmstate_current_state();
+    VMStateLogStateInfo *log_info = NULL;
+
+    if (!v->active_state) {
+        return log_info;
+    }
+
+    log_info = g_malloc0(sizeof(VMStateLogStateInfo));
+
+    log_info->current_iteration = v->current_iteration;
+    log_info->iterations = v->iterations;
+    log_info->period = v->period;
+
+    return log_info;
+}
+
 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]