From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH] qmp: fix handling of boolean values in qmp-shell
Date: Mon, 25 Mar 2013 15:48:46 +0100 [thread overview]
Message-ID: <1364222926-31757-1-git-send-email-imammedo@redhat.com> (raw)
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 <imammedo@redhat.com>
---
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
next reply other threads:[~2013-03-25 14:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-25 14:48 Igor Mammedov [this message]
2013-03-25 15:16 ` [Qemu-devel] [PATCH] qmp: fix handling of boolean values in qmp-shell Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1364222926-31757-1-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).