From patchwork Tue Mar 26 12:38:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 231188 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 889282C0079 for ; Tue, 26 Mar 2013 23:39:35 +1100 (EST) Received: from localhost ([::1]:56970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKTA5-0001hk-On for incoming@patchwork.ozlabs.org; Tue, 26 Mar 2013 08:39:33 -0400 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 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 r2QCcq5M023178 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 26 Mar 2013 08:38:52 -0400 Received: from localhost (ovpn-113-125.phx2.redhat.com [10.3.113.125]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2QCcqVE017450; Tue, 26 Mar 2013 08:38:52 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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 3/4] qmp: fix handling of boolean values 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: 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