qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	Adam Litke <agl@us.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] block: fix the use of protocols in backing files
Date: Thu, 28 Oct 2010 10:35:02 +0100	[thread overview]
Message-ID: <20101028093502.GC11647@redhat.com> (raw)
In-Reply-To: <AANLkTi=MCm17meqMt_ZpkX-DuLWyT-J=MN5XNxK+K1V5@mail.gmail.com>

On Thu, Oct 28, 2010 at 09:30:09AM +0100, Stefan Hajnoczi wrote:
> On Wed, Oct 27, 2010 at 7:19 PM, Anthony Liguori <aliguori@us.ibm.com> wrote:
> > Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> >
> > diff --git a/block.c b/block.c
> > index 1a965b2..00b6f21 100644
> > --- a/block.c
> > +++ b/block.c
> > @@ -603,10 +603,16 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
> >         BlockDriver *back_drv = NULL;
> >
> >         bs->backing_hd = bdrv_new("");
> > -        path_combine(backing_filename, sizeof(backing_filename),
> > -                     filename, bs->backing_file);
> > -        if (bs->backing_format[0] != '\0')
> > -            back_drv = bdrv_find_format(bs->backing_format);
> > +        back_drv = bdrv_find_protocol(bs->backing_file);
> > +        if (!back_drv) {
> > +            path_combine(backing_filename, sizeof(backing_filename),
> > +                         filename, bs->backing_file);
> > +            if (bs->backing_format[0] != '\0')
> > +                back_drv = bdrv_find_format(bs->backing_format);
> > +        } else {
> > +            pstrcpy(backing_filename, sizeof(backing_filename),
> > +                    bs->backing_file);
> > +        }
> >
> >         /* backing files always opened read-only */
> >         back_flags =
> > --
> > 1.7.0.4
> 
> I think this makes sense.
> 
> Now it is possible to specify backing files that are relative to
> QEMU's current working directory using file:filename.  I don't see
> harm in this.

Shouldn't a backing file be treated as relative to the image file pointing
to it, rather than the QEMU working directory. eg so you can do

  # qemu-img create backing.img
  # qemu-img create -o backing_file=file:backing.img main.img
  
And have main.img be able to resolve backing.img in its same directory,
no matter what directory QEMU itself is executing from

Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

  parent reply	other threads:[~2010-10-28  9:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 18:19 [Qemu-devel] [PATCH] block: fix the use of protocols in backing files Anthony Liguori
2010-10-27 19:22 ` malc
2010-10-27 19:42   ` Anthony Liguori
2010-10-28  8:30 ` Stefan Hajnoczi
2010-10-28  8:50   ` Kevin Wolf
2010-10-28  9:35   ` Daniel P. Berrange [this message]
2010-10-28  9:45     ` Stefan Hajnoczi
2010-10-28  9:49     ` Kevin Wolf
2010-10-28  9:51       ` Daniel P. Berrange
2010-10-28 14:10         ` Anthony Liguori
2010-11-04 12:54 ` Kevin Wolf
2010-11-04 13:14   ` Anthony Liguori
2010-11-04 13:31     ` 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=20101028093502.GC11647@redhat.com \
    --to=berrange@redhat.com \
    --cc=agl@us.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@linux.vnet.ibm.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).