qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Peter Krempa <pkrempa@redhat.com>
Cc: qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: don't add 'driver' to options when refering to backing via node name
Date: Tue, 17 Oct 2017 16:41:00 +0200	[thread overview]
Message-ID: <20171017144100.GC7660@dhcp-200-186.str.redhat.com> (raw)
In-Reply-To: <bdbb9d79839f3149db9cf2ff11a2cc04977e0a64.1507817548.git.pkrempa@redhat.com>

Am 12.10.2017 um 16:14 hat Peter Krempa geschrieben:
> When refering to a backing file of an image via node name
> bdrv_open_backing_file would add the 'driver' option to the option list
> filling it with the backing format driver. This breaks construction of
> the backing chain via -blockdev, as bdrv_open_inherit reports an error
> if both 'reference' and 'options' are provided.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>

If you don't mind, I'd add a specific example to the commit message:

$ qemu-img create -f raw /tmp/backing.raw 64M
$ qemu-img create -f qcow2 -F raw -b /tmp/backing.raw /tmp/test.qcow2
$ qemu-system-x86_64 \
  -blockdev driver=file,filename=/tmp/backing.raw,node-name=backing \
  -blockdev driver=qcow2,file.driver=file,file.filename=/tmp/test.qcow2,node-name=root,backing=backing
qemu-system-x86_64: -blockdev driver=qcow2,file.driver=file,file.filename=/tmp/test.qcow2,node-name=root,backing=backing: Could not open backing file: Cannot reference an existing block device with additional options or a new filename

> diff --git a/block.c b/block.c
> index 46eb1728da..684cb018da 100644
> --- a/block.c
> +++ b/block.c
> @@ -2245,7 +2245,8 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
>          goto free_exit;
>      }
> 
> -    if (bs->backing_format[0] != '\0' && !qdict_haskey(options, "driver")) {
> +    if (!reference &&
> +        bs->backing_format[0] != '\0' && !qdict_haskey(options, "driver")) {
>          qdict_put_str(options, "driver", bs->backing_format);
>      }

Looks good to me.

Kevin

  reply	other threads:[~2017-10-17 14:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 14:14 [Qemu-devel] [PATCH] block: don't add 'driver' to options when refering to backing via node name Peter Krempa
2017-10-17 14:41 ` Kevin Wolf [this message]
2017-10-17 14:44   ` Peter Krempa
2017-10-17 15:11 ` [Qemu-devel] [PATCH 2/1] qemu-iotests: Test backing_fmt with backing node reference Kevin Wolf
2017-10-17 15:16   ` Kevin Wolf
2017-10-17 21:44     ` Eric Blake
2017-10-17 21:41 ` [Qemu-devel] [PATCH] block: don't add 'driver' to options when refering to backing via node name 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=20171017144100.GC7660@dhcp-200-186.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).