From: Max Reitz <mreitz@redhat.com>
To: Lucian Petrut <petrutlucian94@gmail.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, Lucian Petrut <lpetrut@cloudbasesolutions.com>,
Peter Lieven <pl@kamp.de>
Subject: Re: [Qemu-devel] block/vpc: Fix vhd extra sectors issue
Date: Mon, 16 Nov 2015 21:58:49 +0100 [thread overview]
Message-ID: <564A4389.6010903@redhat.com> (raw)
In-Reply-To: <1447428724-28116-1-git-send-email-lpetrut@cloudbasesolutions.com>
[-- Attachment #1: Type: text/plain, Size: 2219 bytes --]
On 13.11.2015 16:32, Lucian Petrut wrote:
>
> At the moment, qemu-img extends new image virtual sizes based
> on the CHS algorithm provided by the VHD specs in order to
> ensure that the disk geometry (and payload as seen by some
> guests which use the CHS value) can fit in the requested disk.
>
> This patch drops this behavior, as it breaks compatibility with
> Azure, which requires the MB alignment to be preserved.
>
> Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
> ---
> Proposed fix for https://bugs.launchpad.net/qemu/+bug/1490611
>
> block/vpc.c | 32 ++++++++------------------------
> 1 file changed, 8 insertions(+), 24 deletions(-)
>
CC-ing Peter.
Looks right, considering page 7 of the spec:
(http://download.microsoft.com/download/f/f/e/ffef50a5-07dd-4cf8-aaa3-442c0673a029/Virtual%20Hard%20Disk%20Format%20Spec_10_18_06.doc)
"When the user creates a hard disk of a certain size, the size of the
hard disk image in the virtual machine is smaller than that created by
the user. This is because CHS value calculated from the hard disk size
is rounded down."
However, this patch looks incomplete, note the comment you are removing:
"This ensures that qemu-img convert doesn't truncate images". This is
because vpc_open() prefers the CHS size over the current_size value, and
as far as I remember there was indeed a good reason for that (some
application had invalid values for current_size, or something like that).
So at the very least, we will have to change vpc_open() to always use
the value from footer->current_size and ignore
footer->{cyls,heads,secs_per_cyl}, otherwise qemu will always consider
these images smaller than they actually are (which is bad, at least when
converting images).
But I'd like to know from Peter whether he remembers the reason why
vpc_open() tries to ignore footer->current_size in the first place...
Max
PS: If possible, the "From: " header in an emailed patch should match
the Signed-off-by line. I think. It doesn't state that in
http://wiki.qemu.org/Contribute/SubmitAPatch, but the commit looks
strange otherwise. So I guess if it isn't reasonably possible, it's not
too bad. :-)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2015-11-16 20:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-13 15:32 [Qemu-devel] block/vpc: Fix vhd extra sectors issue Lucian Petrut
2015-11-16 9:17 ` Kevin Wolf
2015-11-16 12:22 ` Jeff Cody
2015-11-16 12:48 ` Peter Lieven
2015-11-16 20:58 ` Max Reitz [this message]
2015-11-16 21:08 ` Max Reitz
2015-11-17 18:46 ` Eric Blake
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=564A4389.6010903@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=lpetrut@cloudbasesolutions.com \
--cc=petrutlucian94@gmail.com \
--cc=pl@kamp.de \
--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).