All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/4]: Monitor queue
@ 2010-12-06 14:43 Luiz Capitulino
  2010-12-06 14:43 ` [Qemu-devel] [PATCH 1/4] QMP: Fix default response regression Luiz Capitulino
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Luiz Capitulino @ 2010-12-06 14:43 UTC (permalink / raw)
  To: anthony; +Cc: qemu-devel

Anthony,

QMP fixes pull request.

The changes (since 2c90fe2b71df2534884bce96d90cbfcc93aeedb8) are available
in the following repository:

    git://repo.or.cz/qemu/qmp-unstable.git for-anthony

Luiz Capitulino (3):
      QMP: Fix default response regression
      QMP: Drop dead code
      QMP: Simplify monitor_json_emitter()

Wen Congyang (1):
      correct migrate_set_speed's args_type

 monitor.c       |   84 ++++++++++++++++++++++++------------------------------
 qmp-commands.hx |    2 +-
 2 files changed, 38 insertions(+), 48 deletions(-)

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

* [Qemu-devel] [PATCH 1/4] QMP: Fix default response regression
  2010-12-06 14:43 [Qemu-devel] [PULL 0/4]: Monitor queue Luiz Capitulino
@ 2010-12-06 14:43 ` Luiz Capitulino
  2010-12-06 14:43 ` [Qemu-devel] [PATCH 2/4] QMP: Drop dead code Luiz Capitulino
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Luiz Capitulino @ 2010-12-06 14:43 UTC (permalink / raw)
  To: anthony; +Cc: qemu-devel

Commit 030db6e89d dropped do_info() usage from QMP and introduced
qmp_call_query_cmd(). However, the new function doesn't emit QMP's
default OK response when the handler doesn't return data.

Fix that by also calling monitor_protocol_emitter() when
ret_data == NULL, so that the default response is emitted.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/monitor.c b/monitor.c
index ec31eac..1296c40 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4464,10 +4464,8 @@ static void qmp_call_query_cmd(Monitor *mon, const mon_cmd_t *cmd)
         }
     } else {
         cmd->mhandler.info_new(mon, &ret_data);
-        if (ret_data) {
-            monitor_protocol_emitter(mon, ret_data);
-            qobject_decref(ret_data);
-        }
+        monitor_protocol_emitter(mon, ret_data);
+        qobject_decref(ret_data);
     }
 }
 
-- 
1.7.3.3.398.g0b0cd

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

* [Qemu-devel] [PATCH 2/4] QMP: Drop dead code
  2010-12-06 14:43 [Qemu-devel] [PULL 0/4]: Monitor queue Luiz Capitulino
  2010-12-06 14:43 ` [Qemu-devel] [PATCH 1/4] QMP: Fix default response regression Luiz Capitulino
@ 2010-12-06 14:43 ` Luiz Capitulino
  2010-12-06 14:43 ` [Qemu-devel] [PATCH 3/4] QMP: Simplify monitor_json_emitter() Luiz Capitulino
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Luiz Capitulino @ 2010-12-06 14:43 UTC (permalink / raw)
  To: anthony; +Cc: qemu-devel

The first if/else clause in handler_audit() makes no sense for two
reasons:

  1. this function is now called only by QMP code, so testing if
     it's a QMP call makes no sense anymore

  2. the else clause first asserts that there's no error in the
     monitor object, then it tries to free it!

Just drop it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |   74 ++++++++++++++++++++++++++++---------------------------------
 1 files changed, 34 insertions(+), 40 deletions(-)

diff --git a/monitor.c b/monitor.c
index 1296c40..1e8b1fc 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3891,49 +3891,43 @@ void monitor_set_error(Monitor *mon, QError *qerror)
 
 static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret)
 {
-    if (monitor_ctrl_mode(mon)) {
-        if (ret && !monitor_has_error(mon)) {
-            /*
-             * If it returns failure, it must have passed on error.
-             *
-             * Action: Report an internal error to the client if in QMP.
-             */
-            qerror_report(QERR_UNDEFINED_ERROR);
-            MON_DEBUG("command '%s' returned failure but did not pass an error\n",
-                      cmd->name);
-        }
+    if (ret && !monitor_has_error(mon)) {
+        /*
+         * If it returns failure, it must have passed on error.
+         *
+         * Action: Report an internal error to the client if in QMP.
+         */
+        qerror_report(QERR_UNDEFINED_ERROR);
+        MON_DEBUG("command '%s' returned failure but did not pass an error\n",
+                  cmd->name);
+    }
 
 #ifdef CONFIG_DEBUG_MONITOR
-        if (!ret && monitor_has_error(mon)) {
-            /*
-             * If it returns success, it must not have passed an error.
-             *
-             * Action: Report the passed error to the client.
-             */
-            MON_DEBUG("command '%s' returned success but passed an error\n",
-                      cmd->name);
-        }
-
-        if (mon_print_count_get(mon) > 0 && strcmp(cmd->name, "info") != 0) {
-            /*
-             * Handlers should not call Monitor print functions.
-             *
-             * Action: Ignore them in QMP.
-             *
-             * (XXX: we don't check any 'info' or 'query' command here
-             * because the user print function _is_ called by do_info(), hence
-             * we will trigger this check. This problem will go away when we
-             * make 'query' commands real and kill do_info())
-             */
-            MON_DEBUG("command '%s' called print functions %d time(s)\n",
-                      cmd->name, mon_print_count_get(mon));
-        }
-#endif
-    } else {
-        assert(!monitor_has_error(mon));
-        QDECREF(mon->error);
-        mon->error = NULL;
+    if (!ret && monitor_has_error(mon)) {
+        /*
+         * If it returns success, it must not have passed an error.
+         *
+         * Action: Report the passed error to the client.
+         */
+        MON_DEBUG("command '%s' returned success but passed an error\n",
+                  cmd->name);
+    }
+
+    if (mon_print_count_get(mon) > 0 && strcmp(cmd->name, "info") != 0) {
+        /*
+         * Handlers should not call Monitor print functions.
+         *
+         * Action: Ignore them in QMP.
+         *
+         * (XXX: we don't check any 'info' or 'query' command here
+         * because the user print function _is_ called by do_info(), hence
+         * we will trigger this check. This problem will go away when we
+         * make 'query' commands real and kill do_info())
+         */
+        MON_DEBUG("command '%s' called print functions %d time(s)\n",
+                  cmd->name, mon_print_count_get(mon));
     }
+#endif
 }
 
 static void handle_user_command(Monitor *mon, const char *cmdline)
-- 
1.7.3.3.398.g0b0cd

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

* [Qemu-devel] [PATCH 3/4] QMP: Simplify monitor_json_emitter()
  2010-12-06 14:43 [Qemu-devel] [PULL 0/4]: Monitor queue Luiz Capitulino
  2010-12-06 14:43 ` [Qemu-devel] [PATCH 1/4] QMP: Fix default response regression Luiz Capitulino
  2010-12-06 14:43 ` [Qemu-devel] [PATCH 2/4] QMP: Drop dead code Luiz Capitulino
@ 2010-12-06 14:43 ` Luiz Capitulino
  2010-12-06 14:43 ` [Qemu-devel] [PATCH 4/4] correct migrate_set_speed's args_type Luiz Capitulino
  2010-12-17 14:48 ` [Qemu-devel] [PULL 0/4]: Monitor queue Anthony Liguori
  4 siblings, 0 replies; 6+ messages in thread
From: Luiz Capitulino @ 2010-12-06 14:43 UTC (permalink / raw)
  To: anthony; +Cc: qemu-devel

Use the ternary operator instead of an if (also fixes bad indentation).

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/monitor.c b/monitor.c
index 1e8b1fc..f1aebc1 100644
--- a/monitor.c
+++ b/monitor.c
@@ -351,10 +351,8 @@ static void monitor_json_emitter(Monitor *mon, const QObject *data)
 {
     QString *json;
 
-    if (mon->flags & MONITOR_USE_PRETTY)
-	json = qobject_to_json_pretty(data);
-    else
-	json = qobject_to_json(data);
+    json = mon->flags & MONITOR_USE_PRETTY ? qobject_to_json_pretty(data) :
+                                             qobject_to_json(data);
     assert(json != NULL);
 
     qstring_append_chr(json, '\n');
-- 
1.7.3.3.398.g0b0cd

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

* [Qemu-devel] [PATCH 4/4] correct migrate_set_speed's args_type
  2010-12-06 14:43 [Qemu-devel] [PULL 0/4]: Monitor queue Luiz Capitulino
                   ` (2 preceding siblings ...)
  2010-12-06 14:43 ` [Qemu-devel] [PATCH 3/4] QMP: Simplify monitor_json_emitter() Luiz Capitulino
@ 2010-12-06 14:43 ` Luiz Capitulino
  2010-12-17 14:48 ` [Qemu-devel] [PULL 0/4]: Monitor queue Anthony Liguori
  4 siblings, 0 replies; 6+ messages in thread
From: Luiz Capitulino @ 2010-12-06 14:43 UTC (permalink / raw)
  To: anthony; +Cc: qemu-devel, Wen Congyang

From: Wen Congyang <wency@cn.fujitsu.com>

The args_type of migrate_set_speed in qmp-commands.hx is wrong.
When we set migrate speed by json, qemu will be core dumped.

This bug was caused by 07de3e60b05 and hence affects master only.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 qmp-commands.hx |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qmp-commands.hx b/qmp-commands.hx
index e5f157f..3486223 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -495,7 +495,7 @@ EQMP
 
     {
         .name       = "migrate_set_speed",
-        .args_type  = "value:f",
+        .args_type  = "value:o",
         .params     = "value",
         .help       = "set maximum speed (in bytes) for migrations",
         .user_print = monitor_user_noop,
-- 
1.7.3.3.398.g0b0cd

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

* Re: [Qemu-devel] [PULL 0/4]: Monitor queue
  2010-12-06 14:43 [Qemu-devel] [PULL 0/4]: Monitor queue Luiz Capitulino
                   ` (3 preceding siblings ...)
  2010-12-06 14:43 ` [Qemu-devel] [PATCH 4/4] correct migrate_set_speed's args_type Luiz Capitulino
@ 2010-12-17 14:48 ` Anthony Liguori
  4 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2010-12-17 14:48 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: qemu-devel

On 12/06/2010 08:43 AM, Luiz Capitulino wrote:
> Anthony,
>
> QMP fixes pull request.
>
> The changes (since 2c90fe2b71df2534884bce96d90cbfcc93aeedb8) are available
> in the following repository:
>
>      git://repo.or.cz/qemu/qmp-unstable.git for-anthony
>    

Pulled.  Thanks.

Regards,

Anthony Liguori
> Luiz Capitulino (3):
>        QMP: Fix default response regression
>        QMP: Drop dead code
>        QMP: Simplify monitor_json_emitter()
>
> Wen Congyang (1):
>        correct migrate_set_speed's args_type
>
>   monitor.c       |   84 ++++++++++++++++++++++++------------------------------
>   qmp-commands.hx |    2 +-
>   2 files changed, 38 insertions(+), 48 deletions(-)
>
>
>
>    

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

end of thread, other threads:[~2010-12-17 14:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-06 14:43 [Qemu-devel] [PULL 0/4]: Monitor queue Luiz Capitulino
2010-12-06 14:43 ` [Qemu-devel] [PATCH 1/4] QMP: Fix default response regression Luiz Capitulino
2010-12-06 14:43 ` [Qemu-devel] [PATCH 2/4] QMP: Drop dead code Luiz Capitulino
2010-12-06 14:43 ` [Qemu-devel] [PATCH 3/4] QMP: Simplify monitor_json_emitter() Luiz Capitulino
2010-12-06 14:43 ` [Qemu-devel] [PATCH 4/4] correct migrate_set_speed's args_type Luiz Capitulino
2010-12-17 14:48 ` [Qemu-devel] [PULL 0/4]: Monitor queue Anthony Liguori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.