All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 01/12] qapi-schema: use generated marshaller for 'qmp_capabilities'
Date: Fri, 05 Aug 2016 12:52:46 +0200	[thread overview]
Message-ID: <87lh0b32td.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20160721140030.28383-2-marcandre.lureau@redhat.com> (marcandre lureau's message of "Thu, 21 Jul 2016 18:00:19 +0400")

marcandre.lureau@redhat.com writes:

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> qapi'fy the 'qmp_capabilities' command.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> ---
>  monitor.c        |  4 ++--
>  qapi-schema.json | 21 +++++++++++++++++++++
>  qmp-commands.hx  |  2 +-
>  3 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 5d68a5d..cb1a0c7 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -617,7 +617,7 @@ static void monitor_qapi_event_init(void)
>      qmp_event_set_func_emit(monitor_qapi_event_queue);
>  }
>  
> -static void qmp_capabilities(QDict *params, QObject **ret_data, Error **errp)
> +void qmp_qmp_capabilities(Error **errp)
>  {
>      cur_mon->qmp.in_command_mode = true;
>  }
> @@ -3649,7 +3649,7 @@ static int monitor_can_read(void *opaque)
>  static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd,
>                               Error **errp)
>  {
> -    bool is_cap = cmd->mhandler.cmd_new == qmp_capabilities;
> +    bool is_cap = cmd->mhandler.cmd_new == qmp_marshal_qmp_capabilities;
>  
>      if (is_cap && mon->qmp.in_command_mode) {
>          error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 5658723..03c15d8 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -20,6 +20,27 @@
>  # QAPI introspection
>  { 'include': 'qapi/introspect.json' }
>  
> +##
> +# @qmp_capabilities:
> +#
> +# Enable QMP capabilities.
> +#
> +# Arguments: None.
> +#
> +# Example:
> +#
> +# -> { "execute": "qmp_capabilities" }
> +# <- { "return": {} }
> +#
> +# Notes: This command is valid exactly when first connecting: it must be
> +# issued before any other command will be accepted, and will fail once the
> +# monitor is accepting other commands.

Pointer to docs/qmp-spec.txt wouldn't hurt.

> +#
> +# Since: 0.13
> +#
> +##
> +{ 'command': 'qmp_capabilities' }
> +
>  ##
>  # @LostTickPolicy:
>  #
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index c8d360a..13707ac 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -2209,7 +2209,7 @@ EQMP
>          .args_type  = "",
>          .params     = "",
>          .help       = "enable QMP capabilities",
> -        .mhandler.cmd_new = qmp_capabilities,
> +        .mhandler.cmd_new = qmp_marshal_qmp_capabilities,
>      },
>  
>  SQMP

According to docs/qmp-spec.txt section 4, the command is for negotiating
capabilities:

    Clients should use the qmp_capabilities command to enable
    capabilities advertised in the Server's greeting (section '2.2
    Server Greeting') they support.

It neglects to specify how that might be done, though.

Section 2.2 specifies the greeting's member "capabilities" as
json-array, without saying anything about its members.

Section 2.2.1 seems to imply the members are strings, which makes some
sense.

To actually support capabilities negotiation, the command needs an
argument matching the greeting's capabilities array.  The argument must
be optional, defaulting to the empty array.  No need to add that now.

Clarifying the docs would be nice, but it's not this patch's job.

Reviewed-by: Markus Armbruster <armbru@redhat.com>

  reply	other threads:[~2016-08-05 10:52 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21 14:00 [Qemu-devel] [PATCH v2 00/12] qapi: remove the 'middle' mode marcandre.lureau
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 01/12] qapi-schema: use generated marshaller for 'qmp_capabilities' marcandre.lureau
2016-08-05 10:52   ` Markus Armbruster [this message]
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 02/12] qapi-schema: add 'device_add' marcandre.lureau
2016-07-21 20:44   ` Eric Blake
2016-07-22  7:13     ` Marc-André Lureau
2016-08-05 12:10   ` Markus Armbruster
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 03/12] monitor: register gen:false commands manually marcandre.lureau
2016-07-21 20:50   ` Eric Blake
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 04/12] monitor: remove usage of generated marshal functions marcandre.lureau
2016-08-05 12:17   ` Markus Armbruster
2016-08-05 12:22     ` Marc-André Lureau
2016-08-05 13:43       ` Markus Armbruster
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 05/12] monitor: register the qapi generated commands marcandre.lureau
2016-07-21 20:56   ` Eric Blake
2016-08-05 12:42   ` Markus Armbruster
2016-08-08 10:10     ` Paolo Bonzini
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 06/12] monitor: remove mhandler.cmd_new marcandre.lureau
2016-07-21 21:02   ` Eric Blake
2016-07-22  7:20     ` Marc-André Lureau
2016-08-05 12:52   ` Markus Armbruster
2016-08-05 13:00     ` Marc-André Lureau
2016-08-05 13:44       ` Markus Armbruster
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 07/12] monitor: implement 'qmp_query_commands' without qmp_cmds marcandre.lureau
2016-07-21 22:51   ` Eric Blake
2016-08-05 13:25   ` Markus Armbruster
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 08/12] build-sys: remove qmp-commands-old.h marcandre.lureau
2016-07-21 22:52   ` Eric Blake
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 09/12] qapi: remove the "middle" mode marcandre.lureau
2016-07-21 22:55   ` Eric Blake
2016-07-22  7:35     ` Marc-André Lureau
2016-08-05 13:31   ` Markus Armbruster
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 10/12] monitor: use qmp_dispatch() marcandre.lureau
2016-08-05 14:43   ` Markus Armbruster
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 11/12] qmp: update qmp_query_spice fallback marcandre.lureau
2016-08-05 13:40   ` Markus Armbruster
2016-08-05 13:43     ` Marc-André Lureau
2016-08-05 14:38       ` Markus Armbruster
2016-07-21 14:00 ` [Qemu-devel] [PATCH v2 12/12] Drop qmp-commands.hx marcandre.lureau
2016-08-05 14:56   ` Markus Armbruster
2016-08-05 18:32     ` Marc-André Lureau
2016-08-09 13:08       ` Markus Armbruster
2016-08-09 14:50         ` Marc-André Lureau
2016-08-09 16:32           ` Markus Armbruster

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=87lh0b32td.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=marcandre.lureau@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 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.