qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] vpc max table entries calculation error


From: Kevin Wolf
Subject: Re: [Qemu-devel] vpc max table entries calculation error
Date: Wed, 7 Dec 2016 14:16:19 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Am 29.11.2016 um 22:07 hat Nick Owens geschrieben:
> i'm writing to discuss an issue in qemu's vpc creation.
> 
> when creating a dynamic-type vpc image with qemu-img like so:
> 
> $ qemu-img create -f vpc vhd.vhd 100M
> Formatting 'vhd.vhd', fmt=vpc size=104857600
> 
> and then inspecting the file (with a tool i wrote; it's also easy to see in
> a hex dump):
> 
> $ vhd-inspect ./vhd.vhd
>                                   MaxTableEntries: 51
> BlockSize: 2097152
> PhysicalSize: 104865792
> VirtualSize: 104865792
> PhysicalSize/BlockSize = 50
> 
> we see that the MaxTableEntries differs from the PhysicalSize/BlockSize.

You did an integer division, which you can't really do because with only
50 blocks it couldn't describe the part of the image after the last
complete block. The real value is PhysicalSize/BlockSize = 50.00390625,
and rounding up is the only sane thing to do to give you an image with
this specific size.

> so, i am not sure what the right fix is here, as it seems vpc is very
> messy, but i do think that this is a bug because the incorrect
> MaxTableEntries causes other tools to miscompute the real disk size. when
> these dynamic-type vpcs with incorrect MaxTableEntries are converted to
> fixed-type and uploaded to Microsoft Azure, it results in the hypervisor
> rejecting the image.
> 
> does someone have an idea about the correct way to fix this?

You must use a multiple of the block size for the image size if you want
an exact result without any rounding. You'll have to use force_size=on
because adjusting the size to CHS will most likely fail to keep the size
at a multiple of the block size.

Yes, calling VHD "very messy" seems to be quite accurate. Creating an
image that works the same way both on Azure and the original Virtual PC
is almost impossible.

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]