From: Kevin Wolf <1538541@bugs.launchpad.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [Bug 1538541] Re: qcow2 rejects request to use preallocation with backing file
Date: Thu, 28 Jan 2016 13:57:54 -0000 [thread overview]
Message-ID: <20160128135754.31072.33238.malone@gac.canonical.com> (raw)
In-Reply-To: 20160127125558.31349.12989.malonedeb@gac.canonical.com
The idea that qcow2 could just reserve enough space that it will never
need any additional clusters stands on somewhat shaky ground anyway. You
can count in metadata such as refcount tables/blocks and the L1/L2 table
for an image with the full virtual disk size used. This doesn't cover
things like snapshots or in the future bitmaps; I'm not completely sure,
but it might also fail to cover some scenarios that involve discard and
where some space isn't immediately reused due to image fragmentation.
Whether or not a given static size is sufficient for an image depends
primarily on how the image is going to be used.
What you seem to want isn't really qcow2 preallocation (which would
involve, as Max said, preallocating all clusters on the qcow2 level),
but preallocation of the image file in the file system layer to a size
that matches your use of qcow2. I'm afraid that doing this in the
management layer, which actually knows best how it's going to use the
image, makes more sense than letting qemu guess and implement a hack
that preallocates only on the file system, but not the image format
level.
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1538541
Title:
qcow2 rejects request to use preallocation with backing file
Status in QEMU:
New
Bug description:
The 'preallocation=full' option to qemu-img / qcow2 block driver
instructs QEMU to fully allocate the host file to the maximum size
needed by the logical disk size.
$ qemu-img create -f qcow2 -o preallocation=full base.qcow2 200M
Formatting 'base.qcow2', fmt=qcow2 size=209715200 encryption=off cluster_size=65536 preallocation='full' lazy_refcounts=off refcount_bits=16
$ ls -alhs base.qcow2
201M -rw-r--r--. 1 berrange berrange 201M Jan 27 12:49 base.qcow2
When specifying a backing file for the qcow2 file, however, it rejects the preallocation request
$ qemu-img create -f qcow2 -o preallocation=full,backing_file=base.qcow2 front.qcow2 200M
Formatting 'front.qcow2', fmt=qcow2 size=209715200 backing_file='base.qcow2' encryption=off cluster_size=65536 preallocation='full' lazy_refcounts=off refcount_bits=16
qemu-img: front.qcow2: Backing file and preallocation cannot be used at the same time
It might seem like requesting full preallocation is redundant because most data associated with the image will be present in the backing file, as so the top layer is unlikely to ever need the full preallocation. Rejecting this, however, means it is not (officially) possible to reserve disk space for the top layer to guarantee that future copy-on-writes will never get ENOSPC.
OpenStack in particular uses backing files with all images, in order
to avoid the I/O overhead of copying the backing file contents into
the per-VM disk image. It, however, still wants to have a guarantee
that the per-VM image will never hit an ENOSPC scenario.
Currently it has to hack around QEMU's refusal to allow backing_file +
preallocation, by calling 'fallocate' on the qcow2 file after it has
been created. This is an inexact fix though, because it doesn't take
account of fact that qcow2 metadata can takes some MBs of space.
Thus, it would like to see preallocation=full supported in combination
with backing files.
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1538541/+subscriptions
next prev parent reply other threads:[~2016-01-28 14:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-27 12:55 [Qemu-devel] [Bug 1538541] [NEW] qcow2 rejects request to use preallocation with backing file Daniel Berrange
2016-01-27 16:35 ` [Qemu-devel] [Bug 1538541] " Max Reitz
2016-01-27 16:50 ` Daniel Berrange
2016-01-28 13:57 ` Kevin Wolf [this message]
2016-01-28 14:19 ` Daniel Berrange
2016-01-29 13:02 ` Max Reitz
2021-04-22 5:03 ` Thomas Huth
2021-06-22 4:17 ` Launchpad Bug Tracker
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=20160128135754.31072.33238.malone@gac.canonical.com \
--to=1538541@bugs.launchpad.net \
--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 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.