From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZGx3-0005F7-AU for qemu-devel@nongnu.org; Mon, 06 May 2013 04:39:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZGx0-0001hk-C3 for qemu-devel@nongnu.org; Mon, 06 May 2013 04:39:17 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:40365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZGwy-0001hR-S7 for qemu-devel@nongnu.org; Mon, 06 May 2013 04:39:14 -0400 From: Zhangleiqiang Date: Mon, 6 May 2013 08:37:47 +0000 Message-ID: <3A6795EA1206904E94BEC8EF9DF109AE05D4C2C8@szxeml510-mbx.china.huawei.com> Content-Language: zh-CN Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: [Qemu-devel] [PATCH] qmp: fix handling of cmd with Equals in qmp-shell List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-devel@nongnu.org" Cc: Zhangleiqiang , "armbru@redhat.com" , "lcapitulino@redhat.com" qmp: fix handling of cmd with equal mark in qmp-shell qmp-shell splits the argument and value of input command by equal mark("=3D"). 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=3Dnbd+unix:///drive0?socket=3D/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 --- 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 =3D arg.split('=3D') try: + if(len(opt) > 2): + opt[1] =3D '=3D'.join(opt[1:]) value =3D int(opt[1]) except ValueError: if opt[1] =3D=3D 'true': --=20 1.8.1.4 ---------- Leiqzhang Best Regards