On Wed, Feb 24, 2016 at 02:07:18PM +0100, Kevin Wolf wrote: > Am 24.02.2016 um 13:44 hat Peter Lieven geschrieben: > > if the size is forced I would set the chs values to max. this way no > > new creator String is needed and it is even backwards compatible. this > > is what disk2vhd does. > > Does disk2vhd do it this way even if the size is smaller than the > maximum that can be represented with CHS? >
I don't know about disk2vhd, but I just created a 5G dynamic VHD image on Hyper-V, and it produced: cyl: 10402, heads: 16, secs: 63 virtual size: 5.0G (5368709120 bytes) (the virtual size as calculated by CHS in that case would have been 5368430592 bytes) I then tested the reverse - I modified qemu to create a VHD image with 5G as the current_size, but maxed out CHS parameters. I imported it into Hyper-V, and it worked fine - just recognized as a 5G disk with 5368709120 bytes. But with all that, it seems like it may be better to mimic the Hyper-V behavior, and use a new creator app string, with the normal CHS values. > > > Am 24.02.2016 um 13:24 schrieb Jeff Cody <jc...@redhat.com>: > > > > > >> On Wed, Feb 24, 2016 at 11:19:37AM +0100, Kevin Wolf wrote: > > >> Am 24.02.2016 um 01:47 hat Jeff Cody geschrieben: > > >>> When QEMU creates a VHD image, it goes by the original spec, > > >>> calculating the current_size based on the nearest CHS geometry (with an > > >>> exception for disks > 127GB). > > >>> > > >>> Apparently, Azure will only allow images that are sized to the nearest > > >>> MB, and the current_size as calculated from CHS cannot guarantee that. > > >>> > > >>> Allow QEMU to create images similar to how Hyper-V creates images, by > > >>> setting current_size to the specified virtual disk size. This > > >>> introduces an option, force_size, to be passed to the vpc format during > > >>> image creation, e.g.: > > >>> > > >>> qemu-img convert -f raw -o force_size -O vpc test.img test.vhd > > >>> > > >>> Bug reference: https://bugs.launchpad.net/qemu/+bug/1490611 > > >>> > > >>> Signed-off-by: Jeff Cody <jc...@redhat.com> > > >> > > >> We need to set a different creator string here that makes vpc_open() > > >> recognise the image as current_size based. > > >> > > >> Kevin > > > > > > How about "qem2"? I initially thought about just changing the case on > > > "qemu", but I was afraid some other software may treat the app creator > > > string as case-insensitive. > > > > > > I'll also update patch 1, to recognize that string as well. > > I had the same thoughts about our options, and I wasn't fully convinced > of either, so I didn't propose any. I was leaning towards the case > change, though, as I don't think it should make a difference and it > reads nicer. But "qem2" is okay with me, too. > > Kevin