From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK98H-0000tj-5f for qemu-devel@nongnu.org; Mon, 25 Mar 2013 11:16:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UK98E-0006ZZ-Rh for qemu-devel@nongnu.org; Mon, 25 Mar 2013 11:16:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK98E-0006ZO-Ky for qemu-devel@nongnu.org; Mon, 25 Mar 2013 11:16:18 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2PFGH4l025332 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Mar 2013 11:16:18 -0400 Date: Mon, 25 Mar 2013 11:16:16 -0400 From: Luiz Capitulino Message-ID: <20130325111616.35ee0115@redhat.com> In-Reply-To: <1364222926-31757-1-git-send-email-imammedo@redhat.com> References: <1364222926-31757-1-git-send-email-imammedo@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qmp: fix handling of boolean values in qmp-shell List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org On Mon, 25 Mar 2013 15:48:46 +0100 Igor Mammedov wrote: > qmp-shell converts only integer arguments and the rest > is assumed to be strings which are faithfully sent as > quoted strings by json. But QEMU refuses to accept qmp > command with boolean argument whose value is escaped > as string. > > Fix it by special-casing true/false keywords and store > value as corresponding boolean. > > Signed-off-by: Igor Mammedov Applied to the qmp branch, thanks. > --- > QMP/qmp-shell | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/QMP/qmp-shell b/QMP/qmp-shell > index 24b665c..d126e63 100755 > --- a/QMP/qmp-shell > +++ b/QMP/qmp-shell > @@ -101,7 +101,12 @@ class QMPShell(qmp.QEMUMonitorProtocol): > try: > value = int(opt[1]) > except ValueError: > - value = opt[1] > + if opt[1] == 'true': > + value = True > + elif opt[1] == 'false': > + value = False > + else: > + value = opt[1] > qmpcmd['arguments'][opt[0]] = value > return qmpcmd >