From: Eric Blake <eblake@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qapi: Document optional arguments' backwards compatibility
Date: Mon, 05 May 2014 08:45:49 -0600 [thread overview]
Message-ID: <5367A41D.70401@redhat.com> (raw)
In-Reply-To: <1399274279-20165-1-git-send-email-famz@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2478 bytes --]
On 05/05/2014 01:17 AM, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
> docs/qapi-code-gen.txt | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt
> index d78921f..d7b19ab 100644
> --- a/docs/qapi-code-gen.txt
> +++ b/docs/qapi-code-gen.txt
> @@ -51,8 +51,10 @@ example of a complex type is:
>
> The use of '*' as a prefix to the name means the member is optional. Optional
> members should always be added to the end of the dictionary to preserve
> -backwards compatibility.
Technically, this is no longer true. It's a dictionary, so adding new
members in any position does not hurt. We might as well erase this
sentence since we have numerous counterexamples where it is not being
followed.
> -
> +backwards compatibility. Even there is no strict restriction for default values
> +of those optional arguments between QEMU's versions, the backwards
> +compatibility should be preserved by keeping the user visible behavior
> +unchanged.
Good idea, but reads a little awkwardly. Maybe:
The default initialization value of an optional argument should not be
changed between versions of QEMU unless the new default maintains
backward compatibility to the user-visible behavior of the old default.
It might also be worth mentioning other rules on default arguments:
On input structures (only mentioned in the 'data' side of a command),
changing from mandatory to optional is safe (older clients will supply
the option, and newer clients can benefit from the default); changing
from optional to mandatory is backwards incompatible (older clients may
be omitting the option, and must continue to work).
On output structures (only mentioned in the 'returns' side of a
command), changing from mandatory to optional is in general unsafe
(older clients may be expecting the field, and could crash if it is
missing), although it can be done if the only way that the optional
argument will be omitted is when it is triggered by the presence of a
new input flag to the command that older clients don't know to send.
Changing from optional to mandatory is safe.
A structure that is used in both input and output of various commands
must consider the backwards compatibility constraints of both directions
of use.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2014-05-05 14:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 7:17 [Qemu-devel] [PATCH] qapi: Document optional arguments' backwards compatibility Fam Zheng
2014-05-05 14:45 ` Eric Blake [this message]
2014-05-06 1:54 ` Fam Zheng
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=5367A41D.70401@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@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).