qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>, qemu-block <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] qemu-img behavior for locating backing files
Date: Thu, 2 Apr 2015 11:38:49 +0200	[thread overview]
Message-ID: <20150402093849.GE6541@noname.str.redhat.com> (raw)
In-Reply-To: <551C19F9.3020409@redhat.com>

Am 01.04.2015 um 18:16 hat John Snow geschrieben:
> Kevin, what's the correct behavior for qemu-img and relative paths
> when creating a new qcow2 file?
> 
> Example:
> 
> (in e.g. /home/qemu/build/ or anywhere not /home: )
> qemu-img create -f qcow2 base.qcow2 32G
> qemu-img create -f qcow2 -F qcow2 -b base.qcow2 /home/overlay.qcow2
> 
> In 1.7.0., this produces a warning that the base object cannot be
> found (because it does not exist at that location relative to
> overlay.qcow2), but qemu-img will create the qcow2 for you
> regardless.
> 
> 2.0, 2.1 and 2.2 all will create the image successfully, with no warnings.
> 
> 2.3-rc1/master as they exist now will emit an error message and
> create no image.
> 
> Since this is a change in behavior for the pending release, is this
> the correct/desired behavior?

Part one of the answer is easy: qemu-img create should succeed if, and
only if, a usable image is created. This requires that the backing file
exists.

Part two is a bit harder: Should base.qcow2 be found in the current
directory even if the new image is somewhere else? We must give
preference to an existing base.qcow2 relative to the new image path, but
if it doesn't exist, we could in theory try to find it relative to the
working directory.

If we then find it, we have two options: Either we use that image
(probably with an absolute path then?) or we print a useful error
message that instructs the user how relative paths work with images.
I think the latter is better because the other option feels like too
much magic.

In any case, the behaviour you describe for 2.3-rc1 seems to be the best
that we've had until now; 1.7.0 looks like the second best. We should
probably "document" the 2.3-rc1 behaviour with a qemu-iotests case.

Oh, and we still have a bug: If you specify an image size, qemu-img
doesn't check at all whether the backing file exists.

Kevin

  parent reply	other threads:[~2015-04-02  9:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01 16:16 [Qemu-devel] qemu-img behavior for locating backing files John Snow
2015-04-01 16:28 ` Eric Blake
2015-04-02  9:38 ` Kevin Wolf [this message]
2015-04-07  0:31   ` John Snow
2015-04-07  8:44     ` Kevin Wolf
2015-04-07 15:55       ` John Snow

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=20150402093849.GE6541@noname.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=jsnow@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).