]> git.proxmox.com Git - mirror_qemu.git/commit
block/vpc: give option to force the current_size field in .bdrv_create
authorJeff Cody <jcody@redhat.com>
Thu, 25 Feb 2016 17:27:29 +0000 (12:27 -0500)
committerKevin Wolf <kwolf@redhat.com>
Mon, 14 Mar 2016 15:46:42 +0000 (16:46 +0100)
commitfb9245c2610932d33ce148b58714fcc7b3c6eb5f
tree175088957c592fe81105439289aaef4e19da4c35
parent798609bbe29df4edf4bbec46927fc12862b02378
block/vpc: give option to force the current_size field in .bdrv_create

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

When using the "force_size" option, the creator app field used by
QEMU will be "qem2" instead of "qemu", to indicate the difference.
In light of this, we also add parsing of the "qem2" field during
vpc_open.

Bug reference: https://bugs.launchpad.net/qemu/+bug/1490611

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/vpc.c