From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ucbvl-0001ok-EP for qemu-devel@nongnu.org; Wed, 15 May 2013 09:39:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ucbvk-00078X-4F for qemu-devel@nongnu.org; Wed, 15 May 2013 09:39:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ucbvj-00077m-Su for qemu-devel@nongnu.org; Wed, 15 May 2013 09:39:44 -0400 From: Luiz Capitulino Date: Wed, 15 May 2013 09:39:38 -0400 Message-Id: <1368625179-27962-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1368625179-27962-1-git-send-email-lcapitulino@redhat.com> References: <1368625179-27962-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 1/2] 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: aliguori@us.ibm.com From: Zhangleiqiang 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 Signed-off-by: Luiz Capitulino --- 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('=') try: + if(len(opt) > 2): + opt[1] = '='.join(opt[1:]) value = int(opt[1]) except ValueError: if opt[1] == 'true': -- 1.8.1.4