qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/6] block/qapi: Add cache information to query-block
Date: Thu, 18 Sep 2014 13:53:42 +0200	[thread overview]
Message-ID: <20140918115342.GC3761@noname.redhat.com> (raw)
In-Reply-To: <87a95xw5on.fsf@blackfin.pond.sub.org>

Am 18.09.2014 um 13:04 hat Markus Armbruster geschrieben:
> Before this patch, QAPI type BlockdevCacheOptions is used only as a
> member of BlockdevOptionsBase.
> 
> BlockdevOptionsBase is a collection configuration settings.
> Consequently, it's a complex type whose members are optional exactly
> when the configuration setting is optional.  Makes sense.
> 
> Complication: a few options are wrapped in another complex type,
> BlockdevCacheOptions.  It's optional, but that's not sufficient, it's
> members are all optional, too.
> 
> BlockdevCacheOptions is the only complex member of BlockdevOptionsBase.
> The others are all simple or enum.
> 
> In this patch, you reuse BlockdevCacheOptions for a purpose other than
> configuration: *querying* configuration.  In the query result, neither
> the complex type nor its members are optional.  The schema reflects the
> former (the patch hunk has 'cache', not '*cache'), but not the latter.
> 
> Do we want the schema to reflect reality accurately?
> 
> If no, we should still document the places where it doesn't, like this
> one.

That's a fair requirement. If anything is optional in a return value, we
should specify the conditions under which it is there or missing.
Including, of course, if it's always or never there.

> If yes, how can we fix this particular inaccuracy?
> 
> The obvious solution is not to reuse BlockdevCacheOptions.  Create a
> second type, identical except for its members aren't optional.

I can introduce a BlockdevCacheInfo instead. While I'm not completely
excited about having two structs for each option dict (one for
configuring, one for querying), there's precedence for this and it's at
least a small struct this time.

> Another idea is to add means to the schema to declare a member "deep
> optional": not just the member is optional, but if it's present, its
> members are optional, too.  Begs the question whether its member's
> member's are optional.  Hmm.

"deep optional" doesn't sound like it makes a lot of sense conceptually,
even if it might happen to be a hack that gets us the right result in
this one specific case.

> Yet another idea is to declare nesting configuration options stupid, and
> just not do it, but it may be too late for that.
> 
> Other ideas?

I think the choice is between adding BlockdevCacheInfo and changing
documentation while reusing BlockdevCacheOptions. Both are fine with me.
Which one do you prefer?

Kevin

  parent reply	other threads:[~2014-09-18 11:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16 15:36 [Qemu-devel] [PATCH 0/6] block: Single-device query-block(-node) and cache info Kevin Wolf
2014-09-16 15:36 ` [Qemu-devel] [PATCH 1/6] block/qapi: Add cache information to query-block Kevin Wolf
2014-09-18 11:04   ` Markus Armbruster
2014-09-18 11:38     ` Markus Armbruster
2014-09-18 11:53     ` Kevin Wolf [this message]
2014-09-18 12:46       ` Markus Armbruster
2014-09-18 12:49       ` Eric Blake
2014-09-16 15:36 ` [Qemu-devel] [PATCH 2/6] block: Add optional device argument " Kevin Wolf
2014-09-18 11:53   ` Markus Armbruster
2014-09-16 15:36 ` [Qemu-devel] [PATCH 3/6] block: Introduce query-block-node Kevin Wolf
2014-09-18 11:59   ` Markus Armbruster
2014-09-16 15:36 ` [Qemu-devel] [PATCH 4/6] block/hmp: Factor out print_block_info() Kevin Wolf
2014-09-16 15:36 ` [Qemu-devel] [PATCH 5/6] block/hmp: Allow info = NULL in print_block_info() Kevin Wolf
2014-09-16 15:36 ` [Qemu-devel] [PATCH 6/6] block: Allow node-name in HMP 'info block' 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=20140918115342.GC3761@noname.redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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 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).