Received: from eggs.gnu.org ([208.118.235.92]:38358) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKT9U-0001Z2-Lh for qemu-devel@nongnu.org; Tue, 26 Mar 2013 08:38:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKT9R-0002EM-Np for qemu-devel@nongnu.org; Tue, 26 Mar 2013 08:38:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKT9R-0002E8-FN for qemu-devel@nongnu.org; Tue, 26 Mar 2013 08:38:53 -0400 From: Luiz Capitulino Date: Tue, 26 Mar 2013 08:38:45 -0400 Message-Id: <1364301526-11431-4-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1364301526-11431-1-git-send-email-lcapitulino@redhat.com> References: <1364301526-11431-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 3/4] 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: aliguori@us.ibm.com From: Igor Mammedov 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 Signed-off-by: Luiz Capitulino --- QMP/qmp-shell | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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.8.1.4