[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] QMP: allow dot separated dict path arguments in qmp
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH] QMP: allow dot separated dict path arguments in qmp-shell |
Date: |
Tue, 11 Feb 2014 18:45:05 +0800 |
As another convinience to allow using commands that expect a dict as
argument, this patch adds support for foo.bar=value syntax, similar to
command line argument style:
(QEMU) blockdev-add options.driver=file options.id=drive1 options.filename=...
Signed-off-by: Fam Zheng <address@hidden>
--
Applies on top of Stefan's patch
[PATCH] QMP: allow JSON dict arguments in qmp-shell
Signed-off-by: Fam Zheng <address@hidden>
---
scripts/qmp/qmp-shell | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index d374b35..9c84551 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -112,7 +112,14 @@ class QMPShell(qmp.QEMUMonitorProtocol):
value = json.loads(opt[1])
else:
value = opt[1]
- qmpcmd['arguments'][opt[0]] = value
+ optpath = opt[0].split('.')
+ parent = qmpcmd['arguments']
+ for p in optpath[:-1]:
+ if not p in parent:
+ d = dict()
+ parent[p] = d
+ parent = d
+ parent[optpath[-1]] = value
return qmpcmd
def _execute_cmd(self, cmdline):
--
1.8.5.4
- [Qemu-devel] [PATCH] QMP: allow dot separated dict path arguments in qmp-shell,
Fam Zheng <=