qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Sanidhya Kashyap <sanidhya.iiith@gmail.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] [PATCH RFC v2 03/12] VMState test: query command to extract the qdevified device names
Date: Fri, 25 Jul 2014 21:09:27 +0530	[thread overview]
Message-ID: <1406302776-2306-4-git-send-email-sanidhya.iiith@gmail.com> (raw)
In-Reply-To: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com>

I have provided a qmp interface for getting the list of qdevified devices
that have been registered with SaveVMHandlers.

Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
---
 qapi-schema.json | 22 ++++++++++++++++++++++
 qmp-commands.hx  | 25 +++++++++++++++++++++++++
 savevm.c         | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 81 insertions(+)

diff --git a/qapi-schema.json b/qapi-schema.json
index b11aad2..996e6b5 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3480,3 +3480,25 @@
 # Since: 2.1
 ##
 { 'command': 'rtc-reset-reinjection' }
+
+##
+# @VMstatesQdevDevices
+#
+# list of qdevified devices that are registered with SaveStateEntry
+#
+# @device: list of qdevified device names
+#
+# Since 2.2
+##
+{ 'type': 'VMStatesQdevDevices',
+  'data': { 'device': ['str'] } }
+
+##
+# @query-qdev-devices
+#
+# returns the VMStatesQdevDevices that have the associated value
+#
+# Since 2.2
+##
+{ 'command': 'query-qdev-devices',
+  'returns': 'VMStatesQdevDevices' }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 4be4765..2e20032 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3755,3 +3755,28 @@ Example:
 <- { "return": {} }
 
 EQMP
+
+    {
+        .name       = "query-qdev-devices",
+        .args_type  = "",
+        .mhandler.cmd_new = qmp_marshal_input_query_qdev_devices,
+    },
+
+SQMP
+query-qdev-devices
+------------------
+
+Shows registered Qdevified devices
+
+
+Example (1):
+
+-> { "execute": "query-qdev-devices" }
+<- { "return": [
+       {
+         "devices": [ "kvm-tpr-opt", "piix4_pm" ]
+       }
+     ]
+   }
+
+EQMP
diff --git a/savevm.c b/savevm.c
index 0255fa0..7c1600a 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1167,6 +1167,40 @@ void do_savevm(Monitor *mon, const QDict *qdict)
     }
 }
 
+static strList *create_qdev_list(const char *name, strList *list)
+{
+    strList *temp_list;
+    int len;
+
+    if (!list) {
+        list = g_malloc0(sizeof(strList));
+        len = strlen(name);
+        list->value = g_malloc0(sizeof(char)*(len+1));
+        strcpy(list->value, name);
+        list->next = NULL;
+        return list;
+    }
+    temp_list = g_malloc0(sizeof(strList));
+    len = strlen(name);
+    temp_list->value = g_malloc0(sizeof(char)*(len+1));
+    strcpy(temp_list->value, name);
+    temp_list->next = list;
+    list = temp_list;
+    return list;
+}
+
+VMStatesQdevDevices *qmp_query_qdev_devices(Error **errp)
+{
+    VMStatesQdevResetEntry *qre;
+    VMStatesQdevDevices *qdev_devices = g_malloc0(sizeof(VMStatesQdevDevices));
+
+    QTAILQ_FOREACH(qre, &vmstate_reset_handlers, entry) {
+        qdev_devices->device = create_qdev_list(qre->device_name,
+                                                 qdev_devices->device);
+    }
+    return qdev_devices;
+}
+
 void qmp_xen_save_devices_state(const char *filename, Error **errp)
 {
     QEMUFile *f;
-- 
1.9.3

  parent reply	other threads:[~2014-07-25 15:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 15:39 [Qemu-devel] [PATCH RFC v2 00/12] VMState testing Sanidhya Kashyap
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 01/12] QEMUSizedBuffer/QEMUFile Sanidhya Kashyap
2014-07-28 21:32   ` Eric Blake
2014-08-06 11:11     ` Dr. David Alan Gilbert
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 02/12] reset handler for qdevified devices Sanidhya Kashyap
2014-07-29 12:43   ` Juan Quintela
2014-07-25 15:39 ` Sanidhya Kashyap [this message]
2014-07-28 21:47   ` [Qemu-devel] [PATCH RFC v2 03/12] VMState test: query command to extract the qdevified device names Eric Blake
2014-07-29 12:45   ` Juan Quintela
2014-07-29 15:14     ` Eric Blake
2014-07-29 17:37     ` Sanidhya Kashyap
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 04/12] VMState test: hmp interface for showing qdevified devices Sanidhya Kashyap
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 05/12] VMstate test: basic VMState testing mechanism Sanidhya Kashyap
2014-07-28 21:52   ` Eric Blake
2014-07-29 13:40   ` Juan Quintela
2014-07-29 17:59     ` Sanidhya Kashyap
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 06/12] VMState test: hmp interface for vmstate testing Sanidhya Kashyap
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 07/12] VMState test: qmp interface for querying the vmstate testing process Sanidhya Kashyap
2014-07-29 15:17   ` Eric Blake
2014-07-29 16:40     ` Eric Blake
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 08/12] VMState test: hmp " Sanidhya Kashyap
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 09/12] VMState test: update period of " Sanidhya Kashyap
2014-07-29 16:48   ` Eric Blake
2014-07-29 18:04     ` Sanidhya Kashyap
2014-07-29 19:42       ` Eric Blake
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 10/12] VMState test: hmp interface for period update Sanidhya Kashyap
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 11/12] VMState test: cancel mechanism for an already running vmstate testing process Sanidhya Kashyap
2014-07-29 16:50   ` Eric Blake
2014-07-25 15:39 ` [Qemu-devel] [PATCH RFC v2 12/12] VMState test: hmp interface for cancel mechanism Sanidhya Kashyap
2014-07-29 16:52   ` Eric Blake
2014-07-29 18:06     ` Sanidhya Kashyap
2014-07-30  5:48     ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406302776-2306-4-git-send-email-sanidhya.iiith@gmail.com \
    --to=sanidhya.iiith@gmail.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).