qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 2/5] scripts: qmp-shell: add support for [] expressi


From: John Snow
Subject: [Qemu-devel] [PATCH 2/5] scripts: qmp-shell: add support for [] expressions
Date: Tue, 21 Apr 2015 22:02:32 -0400

qmp-shell currently allows you to describe values as
JSON expressions:

key={"key":{"key2":"val"}}

But it does not currently support arrays, which are needed
for serializing and deserializing transactions:

key=[{"type":"drive-backup","data":{...}}]

Add support for arrays.

CAVEAT: The parser is still extremely rudimentary and does not
expect to find spaces in {} nor [] expressions. This patch does
not improve this functionality.

Signed-off-by: John Snow <address@hidden>
---
 scripts/qmp/qmp-shell | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index a9632ec..5347f89 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -102,6 +102,8 @@ class QMPShell(qmp.QEMUMonitorProtocol):
                     value = False
                 elif opt[1].startswith('{'):
                     value = json.loads(opt[1])
+                elif opt[1].startswith('['):
+                    value = json.loads(opt[1])
                 else:
                     value = opt[1]
             optpath = opt[0].split('.')
-- 
2.1.0




reply via email to

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