From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXZ9x-0003xi-Pr for qemu-devel@nongnu.org; Tue, 08 Apr 2014 12:46:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXZ9s-0001yX-Hy for qemu-devel@nongnu.org; Tue, 08 Apr 2014 12:46:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXZ9s-0001yR-A6 for qemu-devel@nongnu.org; Tue, 08 Apr 2014 12:46:00 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s38GjxTT014129 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 8 Apr 2014 12:45:59 -0400 Message-ID: <534427C6.7090101@redhat.com> Date: Tue, 08 Apr 2014 10:45:58 -0600 From: Eric Blake MIME-Version: 1.0 References: <1396974411-18051-1-git-send-email-jferlan@redhat.com> In-Reply-To: <1396974411-18051-1-git-send-email-jferlan@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oFVxHxdl9DbH9QjP9Qv7T0pe3kQrInMO5" Subject: Re: [Qemu-devel] [libvirt] [PATCH] qemu: Adjust size for qcow2/qed if not on sector boundary List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Ferlan , libvir-list@redhat.com, "qemu-devel@nongnu.org" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --oFVxHxdl9DbH9QjP9Qv7T0pe3kQrInMO5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 04/08/2014 10:26 AM, John Ferlan wrote: > https://bugzilla.redhat.com/show_bug.cgi?id=3D1002813 >=20 > If qemuDomainBlockResize() is passed a size not on a KiB boundary - tha= t > is passed a size based in bytes (VIR_DOMAIN_BLOCK_RESIZE_BYTES), then > depending on the source format (qcow2 or qed), the value passed must > be on a sector (or 512 byte) boundary. Since other libvirt code quietly= > adjusts the capacity values, then do so here as well - of course ensuri= ng > that adjustment still fits. qed may require aligned multiples for size, but I thought that qcow2 can support an unaligned size (uncommon, but not technically impossible) - after all, the 'size' field in the qcow2 header (bytes 24-31) is an 8-byte value in bytes, not a count of sectors. Maybe we should try the user's size, and only then fall back to a rounded up alignment if the unaligned size fails. Hmm, now that I've experimented a bit: $ qemu-img create -f qcow2 img 12345 Formatting 'img', fmt=3Dqcow2 size=3D12345 encryption=3Doff cluster_size=3D= 65536 lazy_refcounts=3Doff $ qemu-img info img image: img file format: qcow2 virtual size: 12K (12288 bytes) disk size: 196K cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false Wait a second - qemu-img rounded DOWN. That's wrong - it allocated less bytes than I requested. I think we need to first figure out what's going on with the qemu side, on whether qemu should be supporting unaligned requestes, before trying to paper around it in libvirt. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --oFVxHxdl9DbH9QjP9Qv7T0pe3kQrInMO5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTRCfGAAoJEKeha0olJ0NqpMMH/1m2Cs52BwEdhujYmW4d5Z3v 9jnDIgCESTHP9N3YWd87CFdBZlWrfMYZSBU7oBXuPEgglA31tfeXekZPAm44sjAK tUtGeXfOtAuu+kzVfV6CUMNWv6mZQgaLlFiCcaQfnxYdu5JWPDXXNxcGFdGx3fCE 6CuKYT/qpbBTRjhO5L+1QzjzqDBSXp0qR5MOSrQYvNcWuz7SCdDRq9cVkYe6KWx0 tkZNKzu1H4WbPGw4CexAAhx7FaqvFWjdF/nzsEjbqb32EgTJKaEmNVkHNZGRV/8C tk9j7eL9/YMIkC/ZjTjgufFS4swy79RH8f7EeSJQIPqFwcQDsrBHdUzy132j+6I= =FCmz -----END PGP SIGNATURE----- --oFVxHxdl9DbH9QjP9Qv7T0pe3kQrInMO5--