From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOPn2-00006D-6o for qemu-devel@nongnu.org; Wed, 27 Jan 2016 08:05:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOPmy-0000ev-3N for qemu-devel@nongnu.org; Wed, 27 Jan 2016 08:05:40 -0500 Received: from indium.canonical.com ([91.189.90.7]:43843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOPmx-0000er-R6 for qemu-devel@nongnu.org; Wed, 27 Jan 2016 08:05:36 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1aOPmx-0001Vy-2i for ; Wed, 27 Jan 2016 13:05:35 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 11AE82E8086 for ; Wed, 27 Jan 2016 13:05:35 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Wed, 27 Jan 2016 12:55:58 -0000 From: Daniel Berrange <1538541@bugs.launchpad.net> Sender: bounces@canonical.com Message-Id: <20160127125558.31349.12989.malonedeb@gac.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1538541] [NEW] qcow2 rejects request to use preallocation with backing file Reply-To: Bug 1538541 <1538541@bugs.launchpad.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Public bug reported: The 'preallocation=3Dfull' 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=3Dfull base.qcow2 200M Formatting 'base.qcow2', fmt=3Dqcow2 size=3D209715200 encryption=3Doff clus= ter_size=3D65536 preallocation=3D'full' lazy_refcounts=3Doff refcount_bits= =3D16 $ 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=3Dfull,backing_file=3Dbase.qcow= 2 front.qcow2 200M Formatting 'front.qcow2', fmt=3Dqcow2 size=3D209715200 backing_file=3D'base= .qcow2' encryption=3Doff cluster_size=3D65536 preallocation=3D'full' lazy_r= efcounts=3Doff refcount_bits=3D16 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 t= he top layer is unlikely to ever need the full preallocation. Rejecting th= is, however, means it is not (officially) possible to reserve disk space fo= r the top layer to guarantee that future copy-on-writes will never get ENOS= PC. 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=3Dfull supported in combination with backing files. ** Affects: qemu Importance: Undecided Status: New -- = 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=3Dfull' 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=3Dfull base.qcow2 200M Formatting 'base.qcow2', fmt=3Dqcow2 size=3D209715200 encryption=3Doff cl= uster_size=3D65536 preallocation=3D'full' lazy_refcounts=3Doff refcount_bit= s=3D16 $ 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 th= e preallocation request $ qemu-img create -f qcow2 -o preallocation=3Dfull,backing_file=3Dbase.qc= ow2 front.qcow2 200M Formatting 'front.qcow2', fmt=3Dqcow2 size=3D209715200 backing_file=3D'ba= se.qcow2' encryption=3Doff cluster_size=3D65536 preallocation=3D'full' lazy= _refcounts=3Doff refcount_bits=3D16 qemu-img: front.qcow2: Backing file and preallocation cannot be used at t= he same time = It might seem like requesting full preallocation is redundant because mos= t 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 EN= OSPC. 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=3Dfull supported in combination with backing files. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1538541/+subscriptions