Patchwork qmp: fix handling of cmd with Equals in qmp-shell

mail settings
Submitter Zhangleiqiang
Date May 6, 2013, 8:37 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/241603/
State New
Headers show


Zhangleiqiang - May 6, 2013, 8:37 a.m.
qmp: fix handling of cmd with equal mark in qmp-shell

    qmp-shell splits the argument and value of input command
	by equal mark("="). But there are commands whose values
	include equal mark themselves, and the json built by
	qmp-shell will not correct. For example, when using NBD as
	the target of block-backup command, the input
	"block-backup target=nbd+unix:///drive0?socket=/tmp/nbd.sock"
	will fail, because the json built will be as follows:


    Fix it by joining the sections split by equal mark excluding the
	first section in __build_cmd function when the length of sections
	is larger than two.

Signed-off-by: zhangleiqiang <>
 QMP/qmp-shell | 2 ++
 1 file changed, 2 insertions(+)


diff --git a/QMP/qmp-shell b/QMP/qmp-shell
index d126e63..73cb3b6 100755
--- a/QMP/qmp-shell
+++ b/QMP/qmp-shell
@@ -99,6 +99,8 @@  class QMPShell(qmp.QEMUMonitorProtocol):
         for arg in cmdargs[1:]:
             opt = arg.split('=')
+                if(len(opt) > 2):
+                    opt[1] = '='.join(opt[1:])
                 value = int(opt[1])
             except ValueError:
                 if opt[1] == 'true':