From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK8i0-00073n-GI for qemu-devel@nongnu.org; Mon, 25 Mar 2013 10:49:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UK8hv-0003tr-O3 for qemu-devel@nongnu.org; Mon, 25 Mar 2013 10:49:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK8hv-0003th-GH for qemu-devel@nongnu.org; Mon, 25 Mar 2013 10:49:07 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2PEn6Oh002139 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Mar 2013 10:49:06 -0400 From: Igor Mammedov Date: Mon, 25 Mar 2013 15:48:46 +0100 Message-Id: <1364222926-31757-1-git-send-email-imammedo@redhat.com> Subject: [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: qemu-devel@nongnu.org Cc: lcapitulino@redhat.com 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 --- 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 -- 1.7.1