From patchwork Wed May 15 13:39:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 244079 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E3FFE2C00A8 for ; Wed, 15 May 2013 23:40:21 +1000 (EST) Received: from localhost ([::1]:36833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcbwK-0001uJ-4l for incoming@patchwork.ozlabs.org; Wed, 15 May 2013 09:40:20 -0400 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 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4FDdht5000864 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 15 May 2013 09:39:43 -0400 Received: from localhost (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r4FDdgvH024920; Wed, 15 May 2013 09:39:42 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PULL 1/2] qmp: fix handling of cmd with Equals in qmp-shell X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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':