qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH for-2.10 05/10] block: Use JSON null instead of


From: Eric Blake
Subject: Re: [Qemu-block] [PATCH for-2.10 05/10] block: Use JSON null instead of "" to disable backing file
Date: Tue, 18 Jul 2017 12:27:50 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/18/2017 08:41 AM, Markus Armbruster wrote:
> BlockdevRef is an alternate of BlockdevOptions (inline definition) and
> str (reference to an existing block device by name).  BlockdevRef
> value "" is special: "no block device should be referenced."  It's
> actually interpreted that way in just one place: optional member
> @backing of COW formats.  Semantics:
> 
> * Present means "use this block device" as backing storage
> 
> * Absent means "default to the one stored in the image"
> 
> * Except "" means "don't use backing storage at all"
> 
> The first two are perfectly normal: when the parameter is absent, it
> defaults to an implied value, but the value's meaning is the same.
> 
> 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 not a value block device ID.
> 
> Pressing argument values the schema accepts, but are semantically
> invalid, into service to mean "do something else entirely" 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 suppress
> @backing, or add a distinct value to @backing.  This commit implements
> the latter: add JSON null to the values of @backing, deprecate "".
> 
> Because we're so close to the 2.10 freeze, implement it in the
> stupidest way possible: have qmp_blockdev_add() rewrite null to ""
> before anything else can see the null.  Works, because BlockdevRef
> occurs only within arguments of blockdev-add.  The proper way to do it
> would be rewriting "" to null, preferably in a cleaner way, but that
> requires fixing up code to work with null.  Add a TODO comment for
> that.
> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]