qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qmp: fix handling of boolean values in qmp-shell
@ 2013-03-25 14:48 Igor Mammedov
  2013-03-25 15:16 ` Luiz Capitulino
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Mammedov @ 2013-03-25 14:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: lcapitulino

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] qmp: fix handling of boolean values in qmp-shell
  2013-03-25 14:48 [Qemu-devel] [PATCH] qmp: fix handling of boolean values in qmp-shell Igor Mammedov
@ 2013-03-25 15:16 ` Luiz Capitulino
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Capitulino @ 2013-03-25 15:16 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel

On Mon, 25 Mar 2013 15:48:46 +0100
Igor Mammedov <imammedo@redhat.com> 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 <imammedo@redhat.com>

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
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-25 15:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-25 14:48 [Qemu-devel] [PATCH] qmp: fix handling of boolean values in qmp-shell Igor Mammedov
2013-03-25 15:16 ` Luiz Capitulino

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).