All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 2/4] block: Add 'ignore-backing' field to BlockdevOptionsGenericCOWFormat
Date: Fri, 11 Sep 2015 11:28:04 -0600	[thread overview]
Message-ID: <55F30F24.3000305@redhat.com> (raw)
In-Reply-To: <1be64a26c9a89ff0af4c2b1299d6c8b58361644a.1441890725.git.berto@igalia.com>

[-- Attachment #1: Type: text/plain, Size: 2011 bytes --]

On 09/10/2015 07:39 AM, Alberto Garcia wrote:
> If set to true, the image will be opened with the BDRV_O_NO_BACKING
> flag. This is useful for creating snapshots using images opened with
> blockdev-add, since they are not supposed to have a backing image
> before the operation.
> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
>  block.c              | 5 +++++
>  qapi/block-core.json | 6 +++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)

> 
> diff --git a/block.c b/block.c
> index 22d3b0e..4be32fb 100644
> --- a/block.c
> +++ b/block.c
> @@ -1469,6 +1469,11 @@ static int bdrv_open_inherit(BlockDriverState **pbs, const char *filename,
>  
>      assert(drvname || !(flags & BDRV_O_PROTOCOL));
>  
> +    if (qdict_get_try_bool(options, "ignore-backing", false)) {
> +        flags |= BDRV_O_NO_BACKING;
> +    }
> +    qdict_del(options, "ignore-backing");

What happens if the user specified "ignore-backing":true, "backing":...?
 Should that be a hard error?

>  { 'struct': 'BlockdevOptionsGenericCOWFormat',
>    'base': 'BlockdevOptionsGenericFormat',
> -  'data': { '*backing': 'BlockdevRef' } }
> +  'data': { '*backing': 'BlockdevRef',
> +            '*ignore-backing': 'bool' } }

Depending on whether the answer to my question is that we already behave
sanely and don't leave a BlockdevRef dangling if the caller mixes the
two approaches, then:
Reviewed-by: Eric Blake <eblake@redhat.com>

But design-wise, would it make sense to support:

"backing":null

as an explicit request to not open a backing file?  Right now, qapi does
not have a way to express 'null' as part of an alternate type; but if it
did, BlockdevRef would merely add 'null' as one of its allowed
alternates.  Then we wouldn't need ignore-backing from the QMP
perspective. But I'm still not sure how it would map to the command line
perspective.

-- 
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 --]

  parent reply	other threads:[~2015-09-11 17:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 13:39 [Qemu-devel] [PATCH v3 0/4] Add 'blockdev-snapshot' command Alberto Garcia
2015-09-10 13:39 ` [Qemu-devel] [PATCH v3 1/4] block: rename BlockdevSnapshot to BlockdevSnapshotSync Alberto Garcia
2015-09-11 17:15   ` Max Reitz
2015-09-10 13:39 ` [Qemu-devel] [PATCH v3 2/4] block: Add 'ignore-backing' field to BlockdevOptionsGenericCOWFormat Alberto Garcia
2015-09-11 17:21   ` Max Reitz
2015-09-11 17:28     ` Kevin Wolf
2015-09-11 17:33       ` Max Reitz
2015-09-14  5:54         ` Alberto Garcia
2015-09-14  8:45           ` Kevin Wolf
2015-09-14 14:20             ` Alberto Garcia
2015-09-11 17:28   ` Eric Blake [this message]
2015-09-11 17:30     ` [Qemu-devel] [Qemu-block] " Eric Blake
2015-09-10 13:39 ` [Qemu-devel] [PATCH v3 3/4] block: add a 'blockdev-snapshot' QMP command Alberto Garcia
2015-09-11 17:58   ` Eric Blake
2015-09-14 14:08     ` Alberto Garcia
2015-09-11 18:11   ` Max Reitz
2015-09-10 13:39 ` [Qemu-devel] [PATCH v3 4/4] block: add tests for the 'blockdev-snapshot' command Alberto Garcia
2015-09-11 18:02   ` Eric Blake

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=55F30F24.3000305@redhat.com \
    --to=eblake@redhat.com \
    --cc=berto@igalia.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 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.