From patchwork Sat Aug 9 06:26:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanidhya Kashyap X-Patchwork-Id: 378727 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0CE0A1400AA for ; Sat, 9 Aug 2014 16:32:02 +1000 (EST) Received: from localhost ([::1]:54279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XG0C8-0001OV-8L for incoming@patchwork.ozlabs.org; Sat, 09 Aug 2014 02:32:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XG09r-0006HC-VT for qemu-devel@nongnu.org; Sat, 09 Aug 2014 02:29:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XG09g-0001cT-04 for qemu-devel@nongnu.org; Sat, 09 Aug 2014 02:29:39 -0400 Received: from mail-qc0-x22c.google.com ([2607:f8b0:400d:c01::22c]:53603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XG09f-0001bX-Ql for qemu-devel@nongnu.org; Sat, 09 Aug 2014 02:29:27 -0400 Received: by mail-qc0-f172.google.com with SMTP id i8so113309qcq.31 for ; Fri, 08 Aug 2014 23:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o0Vw2lJgoqQGrk6DGyPHOEkdZS+MbA670LjAGcWW748=; b=v2LMcrhCa4wvrJ7TC3opObI+hxmK2ZTuFBtmHrlSQ5AiKiDnO/nUho146p+LE4X7De 69S/iSYEyHX8M/bgFs7jcug72vRH4Qc9zzH5gLmPAFb90RZrYO6/gNBhkRbtGzv7CxED Awe69MYDi45eCidZJjBlNsLmTh+vUpv98nH/op9yxAZjTAMwYNEMmyv1f+ZKFu87Pkn7 fzqXw+7iJP8coZSk+jpgUVTR7xo+f2VoSeqaULVGBzRgSy3DXJYxDTBH3F1xewvslJZw p1gOGupIh+V+hdwGuRZvBQIveknaiU3SC61+QvsLx8DLWrAfAy4Ad40PuV9Untlb66b6 Hn6Q== X-Received: by 10.229.212.138 with SMTP id gs10mr43377751qcb.7.1407565767391; Fri, 08 Aug 2014 23:29:27 -0700 (PDT) Received: from localhost.localdomain ([172.56.1.233]) by mx.google.com with ESMTPSA id w11sm9479489qax.30.2014.08.08.23.29.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Aug 2014 23:29:26 -0700 (PDT) From: Sanidhya Kashyap To: qemu list Date: Sat, 9 Aug 2014 02:26:33 -0400 Message-Id: <1407565595-18861-5-git-send-email-sanidhya.iiith@gmail.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1407565595-18861-1-git-send-email-sanidhya.iiith@gmail.com> References: <1407565595-18861-1-git-send-email-sanidhya.iiith@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::22c Cc: Sanidhya Kashyap , "Dr. David Alan Gilbert" , Juan Quintela Subject: [Qemu-devel] [RFC PATCH v3 4/6] VMState test: querying the vmstate testing process X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch has been updated to provide the following information: * Added a new return value in the form of devices' info that provides the device name as well as the version number. * provides the hmp interface - info test_vmstates and qmp interface - query-test-vmstates to obtain the information about the running vmstate testing process. Signed-off-by: Sanidhya Kashyap --- hmp-commands.hx | 4 +++- hmp.c | 31 +++++++++++++++++++++++++++++++ hmp.h | 1 + monitor.c | 7 +++++++ qapi-schema.json | 37 +++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 28 ++++++++++++++++++++++++++++ savevm.c | 29 +++++++++++++++++++++++++++++ 7 files changed, 136 insertions(+), 1 deletion(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index e16e1ac..1a28e63 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1770,6 +1770,8 @@ show migration status show current migration capabilities @item info migrate_cache_size show current migration XBZRLE cache size +@item info test_vmstates +show current vmstates testing process info @item info balloon show balloon information @item info qtree @@ -1799,13 +1801,13 @@ ETEXI "period: (optional) sleep interval in milliseconds between each iteration", .mhandler.cmd = hmp_test_vmstates, }, + STEXI @item test_vmstates @findex test_vmstates dumps and reads the device state's data from the memory for testing purpose ETEXI - STEXI @end table ETEXI diff --git a/hmp.c b/hmp.c index ca7664e..5d66975 100644 --- a/hmp.c +++ b/hmp.c @@ -1754,3 +1754,34 @@ void hmp_test_vmstates(Monitor *mon, const QDict *qdict) error_free(err); } } + +void hmp_info_test_vmstates(Monitor *mon, const QDict *qdict) +{ + VMStateLogStateInfo *log_info = qmp_query_test_vmstates(NULL); + QemuDeviceList *device_list = log_info->devices; + Error *err = NULL; + + if (log_info) { + monitor_printf(mon, "current-iteration: %"PRId64 "\n" + "iterations: %"PRId64 "\n" + "period: %"PRId64 "\n", log_info->current_iteration, + log_info->iterations, log_info->period); + if (device_list) { + monitor_printf(mon, "devices:\n"); + while (device_list) { + monitor_printf(mon, "device_name: %s, ", + device_list->value->device_name); + monitor_printf(mon, "version: %ld\n", + device_list->value->version); + device_list = device_list->next; + } + } + } + + if (err) { + monitor_printf(mon, "test-vmstates: %s\n", error_get_pretty(err)); + error_free(err); + } + + qapi_free_VMStateLogStateInfo(log_info); +} diff --git a/hmp.h b/hmp.h index 56fb865..881964a 100644 --- a/hmp.h +++ b/hmp.h @@ -39,6 +39,7 @@ void hmp_info_pci(Monitor *mon, const QDict *qdict); void hmp_info_block_jobs(Monitor *mon, const QDict *qdict); void hmp_info_tpm(Monitor *mon, const QDict *qdict); void hmp_info_devices(Monitor *mon, const QDict *qdict); +void hmp_info_test_vmstates(Monitor *mon, const QDict *qdict); void hmp_quit(Monitor *mon, const QDict *qdict); void hmp_stop(Monitor *mon, const QDict *qdict); void hmp_system_reset(Monitor *mon, const QDict *qdict); diff --git a/monitor.c b/monitor.c index 2431686..66a4d1f 100644 --- a/monitor.c +++ b/monitor.c @@ -2925,6 +2925,13 @@ static mon_cmd_t info_cmds[] = { .mhandler.cmd = hmp_info_devices, }, { + .name = "test_vmstates", + .args_type = "", + .params = "", + .help = "show the current vmstates testing information", + .mhandler.cmd = hmp_info_test_vmstates, + }, + { .name = NULL, }, }; diff --git a/qapi-schema.json b/qapi-schema.json index 4c810d7..b7408df 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3528,3 +3528,40 @@ 'data': {'*iterations': 'int', '*period': 'int', '*devices': [ 'QemuDevice' ] } } + +## +# @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). +# +# @devices: returns the list of devices that are being tested +# +# Since 2.2 +## +{ 'type': 'VMStateLogStateInfo', + 'data': { 'current-iteration': 'int', + 'iterations': 'int', + 'period': 'int', + 'devices': [ 'QemuDevice' ] } } + +## +# @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 ae2bdca..84f8fc8 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3831,3 +3831,31 @@ Example: "period": 100, } } <- { "return": {} } EQMP + + { + .name = "query-test-vmstates", + .args_type = "", + .mhandler.cmd_new = qmp_marshal_input_query_test_vmstates, + }, + +SQMP +query-test-vmstates +------------------- + +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 +- "devices": list of devices that are being tested + +Example: + +-> { "execute": "query-test-vmstates" } +<- { "return": { + "current_iteration": 3, + "iterations": 100, + "period": 100, + "devices": [ { 'device': 'hpet', 'version': 2 }, + { 'device': 'mc146818rtc', 'version': 3 } ] } } +EQMP diff --git a/savevm.c b/savevm.c index cd67c5d..2709035 100644 --- a/savevm.c +++ b/savevm.c @@ -1411,6 +1411,35 @@ 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 = test_vmstates_get_current_state(); + VMStateLogStateInfo *log_info = NULL; + DeviceInfoEntry *de; + + 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; + log_info->devices = NULL; + if (QTAILQ_EMPTY(&v->device_list)) { + log_info->devices = qmp_query_devices(NULL); + } else { + QTAILQ_FOREACH(de, &v->device_list, entry) { + log_info->devices = create_device_list(de->device->device_name, + de->device->version, + log_info->devices); + } + } + + return log_info; +} + /* * ---------------------------------------------------------------------------- */