From: Markus Armbruster <armbru@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: Michael Roth <michael.roth@amd.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: Adding a handshake to qemu-guest-agent
Date: Mon, 14 Feb 2022 15:14:37 +0100 [thread overview]
Message-ID: <87czjpilgy.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFn=p-b-gfeDgFfivtJ6tOixyydRb1kS8rS+H41RjiVZ-3Sgsw@mail.gmail.com> (John Snow's message of "Fri, 11 Feb 2022 14:38:20 -0500")
Cc: the qemu-ga maintainer
John Snow <jsnow@redhat.com> writes:
> [Moving our discussion upstream, because it stopped being brief and simple.]
Motivation: qemu-ga doesn't do capability negotiation as specified in
docs/interop/qmp-spec.txt.
Reminder: qmp-spec.txt specifies the server shall send a greeting
containing the capabilities on offer. The client shall send a
qmp_capabilities command before any other command.
We can't just fix qemu-ga to comply, because it would break existing
clients.
We could document its behavior in qmp-spec.txt. Easy enough, but also
kind of sad.
Is there a way to add capability negotiation to qemu-ga without breaking
existing clients? We obviously have to make it optional.
The obvious idea "make qmp_capabilities optional" doesn't work, because
the client needs to receive the greeting before sending
qmp_capabilities, to learn what capabilities are on offer.
This leads to...
> What about something like this:
>
> Add a new "request-negotiation" command to qemu-guest-agent 7.0.0.
>
> [Modern client to unknown server]
> 1. A modern client connects to a server of unknown version, and
> without waiting, issues the "request-negotiation" command.
> 2. An old server will reply with CommandNotFound. We are done negotiating.
> 3. A modern server will reply with the greeting in the traditional
> format, but as a reply object (to preserve "execute" semantics.)
> 4. The modern client will now issue qmp-capabilities as normal.
> 5. The server replies with success or failure as normal.
> 6. Connection is fully established.
>
> [Old client to unknown server]
> 1. An old client connects to an unknown version server.
> 2. A command is issued some time later.
> 2a. The server is old, the command worked as anticipated.
> 2b. The server is new, the command fails with CommandNotFound and
> urges the use of 'request-negotiation'.
A new server could accept the command, too. This way, negotiation
remains optional, unlike in "normal" QMP. Old clients don't negotiate,
and get default capabilities.
> Compatibility matrix summary:
> Old client on old server: Works just fine, as always.
> Old client on new server: Will fail; the new server requires the
> negotiation step to be performed. This is a tractable problem.
> POSSIBLY we need to send some kind of "warning event" for two versions
> before making it genuinely mandatory. Also tractable.
With optional negotiation, this works fine, too.
> New client on old server: Works, albeit with a single failed execute
> command now in the log file.
> New client on new server: Works, though handshaking is now permanently
> a little chattier than with any other QMP server.
>
> ***The QMP spec will need to be updated*** to state: the asynchronous
> greeting is mandatory on all QMP implementations, EXCEPT for the
> qemu-guest-agent, which for historical reasons, uses an alternate
> handshaking process, ...
>
> Compatibility concerns:
> - We must never remove the 'request-negotiation' command from QGA,
> forever-and-ever, unless we also make a new error class for
> "NegotiationRequired" that's distinct from "CommandNotFound", but
> that's more divergence. Supporting the negotiation request command
> forever-and-ever is probably fine.
Yup.
> - QGA is now officially on a different flavor of QMP protocol. You
> still need to know in advance if you are connecting to QGA or anything
> else. That's still a little sad, but maybe that's just simply an
> impossible goal.
>
> Bonus:
> - If an execution ID is used when sending "request-negotiation", we
> know that the server is at least version 4.0.0 if it responds to us
> using that ID. A modern client can then easily distinguish between
> pre-4.0, post-4.0 and post-7.0 servers. It's a useful probe.
Mike, thoughts?
next prev parent reply other threads:[~2022-02-14 14:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAFn=p-anWO3dpvcECpW6J1ExJLw01DhXvTYtC5FUi5p7kQ2tig@mail.gmail.com>
[not found] ` <87pmnwqzq7.fsf@pond.sub.org>
[not found] ` <CAFn=p-YVdQDbzUsQm97=FyuZN_m3jCsFzjTpguRPjtH3PezTMg@mail.gmail.com>
[not found] ` <87zgmze0im.fsf@pond.sub.org>
2022-02-11 19:38 ` Adding a handshake to qemu-guest-agent John Snow
2022-02-14 14:14 ` Markus Armbruster [this message]
2022-02-15 19:36 ` Michael Roth
2022-02-16 9:12 ` Markus Armbruster
2022-02-16 20:51 ` Michael Roth
2022-02-23 17:07 ` John Snow
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=87czjpilgy.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=jsnow@redhat.com \
--cc=michael.roth@amd.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.