]> git.proxmox.com Git - qemu.git/commitdiff
qmp: fix handling of cmd with Equals in qmp-shell
authorZhangleiqiang <zhangleiqiang@huawei.com>
Mon, 6 May 2013 08:31:23 +0000 (08:31 +0000)
committerLuiz Capitulino <lcapitulino@redhat.com>
Wed, 15 May 2013 12:58:43 +0000 (08:58 -0400)
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:

    {
"execute":"block-backup",
"arguments":{"target":"nbd+unix:///drive0?socket"}
}

    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 <zhangleiqiang@huawei.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
QMP/qmp-shell

index d126e63ad19a696179ddf92b13a8873ec45fceff..73cb3b6cef4eb2f04e25ed586fc8a675679ace4a 100755 (executable)
@@ -99,6 +99,8 @@ class QMPShell(qmp.QEMUMonitorProtocol):
         for arg in cmdargs[1:]:
             opt = arg.split('=')
             try:
+                if(len(opt) > 2):
+                    opt[1] = '='.join(opt[1:])
                 value = int(opt[1])
             except ValueError:
                 if opt[1] == 'true':