From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, qemu-block@nongnu.org,
quintela@redhat.com, dgilbert@redhat.com, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH for-2.10 10/10] migration: Use JSON null instead of "" to reset parameter to default
Date: Tue, 18 Jul 2017 20:37:12 +0200 [thread overview]
Message-ID: <87inipk2w7.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <1aa2bff6-8798-cfd4-e969-b98064dd7d4c@redhat.com> (Eric Blake's message of "Tue, 18 Jul 2017 12:46:35 -0500")
Eric Blake <eblake@redhat.com> writes:
> On 07/18/2017 08:41 AM, Markus Armbruster wrote:
>> migrate-set-parameters sets migration parameters according to is
>> arguments like this:
>>
>> * Present means "set the parameter to this value"
>>
>> * Absent means "leave the parameter unchanged"
>>
>> * Except for parameters tls_creds and tls_hostname, "" means "reset
>> the parameter to its default value
>>
>> The first two are perfectly normal: presence of the parameter makes
>> the command do something.
>>
>> The third one overloads the parameter with a second meaning. The
>> overloading is *implicit*, i.e. it's not visible in the types. Works
>> here, because "" is neither a valid TLS credentials ID, nor a valid
>> host name.
>>
>> Pressing argument values the schema accepts, but are semantically
>> invalid, into service to mean "reset to default" is not general, as
>> suitable invalid values need not exist. I also find it ugly.
>>
>> To clean this up, we could add a separate flag argument to ask for
>> "reset to default", or add a distinct value to @tls_creds and
>> @tls_hostname. This commit implements the latter: add JSON null to
>> the values of @tls_creds and @tls_hostname, deprecate "".
>>
>> Because we're so close to the 2.10 freeze, implement it in the
>> stupidest way possible: have qmp_migrate_set_parameters() rewrite null
>> to "" before anything else can see the null. The proper way to do it
>> would be rewriting "" to null, but that requires fixing up code to
>> work with null. Add TODO comments for that.
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>> +++ b/qapi-schema.json
>> @@ -116,6 +116,13 @@
>> { 'command': 'qmp_capabilities' }
>>
>> ##
>> +# @StrOrNull:
>
> A little light on the documentation.
>
>> +##
>> +{ 'alternate': 'StrOrNull',
>> + 'data': { 's': 'str',
>> + 'n': 'null' } }
>> +
>> +##
>> # @LostTickPolicy:
>> #
>> # Policy for handling lost ticks in timer devices.
>> @@ -1098,8 +1105,8 @@
>> '*decompress-threads': 'int',
>> '*cpu-throttle-initial': 'int',
>> '*cpu-throttle-increment': 'int',
>> - '*tls-creds': 'str',
>> - '*tls-hostname': 'str',
>> + '*tls-creds': 'StrOrNull',
>> + '*tls-hostname': 'StrOrNull',
>> '*max-bandwidth': 'int',
>> '*downtime-limit': 'int',
>> '*x-checkpoint-delay': 'int',
>
> By splitting input from output, you guarantee that 'null' won't appear
> in the output and break an unsuspecting client, but that new clients can
> introspect the existence of null and use that instead of "" on input.
Yes.
We don't want null in output. My unsharing makes that syntactically
impossible. Nice bonus, not why I went that route. I did because it
reduces code churn quite a bit, which is what we need right now.
Likewise, we don't want absent members in output. The sharing (commit
de63ab6) made that syntactically possible. My unsharing doesn't make it
impossible, because it refrains from removing the '*' from
MigrationParameters.
If we decide not to restore the sharing, we should make absent members
syntactically impossible.
If we decice to restore the sharing, null in output will become
syntactically possible.
We'll have to pick our poison: tighter schema or more concise schema.
We picked concise last time.
> Reviewed-by: Eric Blake <eblake@redhat.com>
Thanks!
next prev parent reply other threads:[~2017-07-18 18:37 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 13:41 [Qemu-devel] [PATCH for-2.10 00/10] Correct two minor QMP interface design flaws Markus Armbruster
2017-07-18 13:41 ` [Qemu-devel] [PATCH for-2.10 01/10] qapi: Separate type QNull from QObject Markus Armbruster
2017-07-18 14:24 ` Eric Blake
2017-07-18 15:44 ` Daniel P. Berrange
2017-07-18 13:41 ` [Qemu-devel] [PATCH for-2.10 02/10] qapi: Use QNull for a more regular visit_type_null() Markus Armbruster
2017-07-18 14:36 ` Eric Blake
2017-07-18 15:05 ` Markus Armbruster
2017-07-18 15:46 ` Daniel P. Berrange
2017-07-18 13:41 ` [Qemu-devel] [PATCH for-2.10 03/10] qapi: Introduce a first class 'null' type Markus Armbruster
2017-07-18 14:53 ` Eric Blake
2017-07-18 14:54 ` Eric Blake
2017-07-18 15:21 ` Markus Armbruster
2017-07-18 19:43 ` Markus Armbruster
2017-07-18 19:47 ` Eric Blake
2017-07-18 20:02 ` Markus Armbruster
2017-07-18 20:08 ` Eric Blake
2017-07-18 20:27 ` Markus Armbruster
2017-07-18 15:20 ` Markus Armbruster
2017-07-18 15:47 ` Daniel P. Berrange
2017-07-18 13:41 ` [Qemu-devel] [PATCH for-2.10 04/10] tests/test-qobject-input-visitor: Drop redundant test Markus Armbruster
2017-07-18 15:13 ` Eric Blake
2017-07-18 15:47 ` Daniel P. Berrange
2017-07-18 13:41 ` [Qemu-devel] [PATCH for-2.10 05/10] block: Use JSON null instead of "" to disable backing file Markus Armbruster
2017-07-18 15:53 ` Daniel P. Berrange
2017-07-18 17:27 ` Eric Blake
2017-07-18 13:41 ` [Qemu-devel] [PATCH for-2.10 06/10] hmp: Clean up and simplify hmp_migrate_set_parameter() Markus Armbruster
2017-07-18 15:54 ` Daniel P. Berrange
2017-07-18 17:09 ` Dr. David Alan Gilbert
2017-07-18 17:34 ` Eric Blake
2017-07-18 18:28 ` Markus Armbruster
2017-07-18 13:41 ` [Qemu-devel] [PATCH for-2.10 07/10] migration: Clean up around tls_creds, tls_hostname Markus Armbruster
2017-07-18 15:57 ` Daniel P. Berrange
2017-07-18 17:36 ` Eric Blake
2017-07-18 17:37 ` Dr. David Alan Gilbert
2017-07-18 13:41 ` [Qemu-devel] [PATCH for-2.10 08/10] migration: Add TODO comments on duplication of QAPI_CLONE() Markus Armbruster
2017-07-18 15:57 ` Daniel P. Berrange
2017-07-18 17:36 ` Eric Blake
2017-07-18 13:41 ` [Qemu-devel] [PATCH for-2.10 09/10] migration: Unshare MigrationParameters struct for now Markus Armbruster
2017-07-18 16:01 ` Daniel P. Berrange
2017-07-18 17:42 ` Eric Blake
2017-07-18 13:41 ` [Qemu-devel] [PATCH for-2.10 10/10] migration: Use JSON null instead of "" to reset parameter to default Markus Armbruster
2017-07-18 16:03 ` Daniel P. Berrange
2017-07-18 17:46 ` Eric Blake
2017-07-18 18:37 ` Markus Armbruster [this message]
2017-07-18 18:39 ` Markus Armbruster
2017-07-18 19:09 ` Eric Blake
2017-07-18 19:32 ` Markus Armbruster
2017-07-18 19:55 ` Eric Blake
2017-07-18 17:52 ` Dr. David Alan Gilbert
2017-07-18 19:24 ` Markus Armbruster
2017-07-19 8:32 ` Daniel P. Berrange
2017-07-18 14:02 ` [Qemu-devel] [PATCH for-2.10 00/10] Correct two minor QMP interface design flaws no-reply
2017-07-18 16:08 ` Daniel P. Berrange
2017-07-19 6:12 ` Kevin Wolf
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=87inipk2w7.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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.