qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Bug 1257334 <1257334@bugs.launchpad.net>
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Bug 1257334] [NEW] diffuse handling of image creation from another	path
Date: Wed, 4 Dec 2013 11:23:43 +0100	[thread overview]
Message-ID: <20131204102343.GD19096@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <20131203152228.11970.2938.malonedeb@soybean.canonical.com>

On Tue, Dec 03, 2013 at 03:22:28PM -0000, Florian Miksch wrote:
Hi,
This does not look like a bug.  Please see the explanation below...

Inlining Florian's reproducer script so we can discuss it via email:

> #!/bin/bash
> # This script does create a backing image and overlay to
> # reproduce the reported bug.
> #...
>  
> mkdir a
> # Create an image from another path e.g. in the directory 'a'
> qemu-img create -f qcow2 a/blob.img 10G
>  
> # Create an overlay image from another path in the same directory
> qemu-img create -f qcow2 -b a/blob.img a/ovl.img
>  
> # Get Info in the new directory
> cd a
> qemu-img info ovl.img
> # Output:
> #       image: ovl.img
> #       file format: qcow2
> #       virtual size: 10G (10737418240 bytes)
> #       disk size: 196K
> #       cluster_size: 65536
> #       backing file: a/blob.img
>  
> # Get the Info from another directory
> cd ..
> qemu-img info a/ovl.img
> # Output:
> #       image: a/ovl.img
> #       file format: qcow2
> #       virtual size: 10G (10737418240 bytes)
> #       disk size: 196K
> #       cluster_size: 65536
> #       backing file: a/blob.img (actual path: a/a/blob.img)
>  
> # Bug:
> #       Compare 'image'
> #       Compare 'backing file'
> #       Look at 'actual path'

The behavior you are showing here is explained as follows:

Backing file paths can be relative or absolute and are stored inside
the image file.  In this case you are providing a relative backing
file path.

Relative backing file paths are interpreted against the image filename.
In other words:

  join_path(dirname('a/ovl.img'), 'a/blob.img') -> 'a/a/blob.img'

>  
> # 'qemu-img info' takes the recommended path as name of the image
> # and the actual path is then: a/a/blob.img    
>  
> qemu-img commit a/ovl.img
> # Now commit fails  
> # --> ERROR "No such file or directory

The problem was:
> qemu-img create -f qcow2 -b a/blob.img a/ovl.img

If you want to use a relative backing file path, remember that it is
relative to the image file:

cd a && qemu-img create -f qcow2 -b blob.img ovl.img

Then 'qemu-img commit a/ovl.img' will work as expected.

Stefan

  reply	other threads:[~2013-12-04 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03 15:22 [Qemu-devel] [Bug 1257334] [NEW] diffuse handling of image creation from another path Florian Miksch
2013-12-04 10:23 ` Stefan Hajnoczi [this message]
2016-09-28 14:57 ` [Qemu-devel] [Bug 1257334] " T. Huth

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=20131204102343.GD19096@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=1257334@bugs.launchpad.net \
    --cc=kwolf@redhat.com \
    --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).