]> git.proxmox.com Git - qemu.git/commit
block/vdi: Fix image opening and creation for odd disk sizes
authorKevin Wolf <kwolf@redhat.com>
Wed, 14 Jul 2010 09:50:47 +0000 (11:50 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 14 Jul 2010 09:50:47 +0000 (11:50 +0200)
commit6fd82592cec15256a6dcfe516a7ce6c99f1912b7
tree44fbd61f233d2e89770eca25aa19397b5d1d47d1
parent39187b5192bf16a6bbd3f272bef88f92e61b4c02
block/vdi: Fix image opening and creation for odd disk sizes

The fix is based on a patch from Kevin Wolf. Here his comment:

"The number of blocks needs to be rounded up to cover all of the virtual hard
disk. Without this fix, we can't even open our own images if their size is not
a multiple of the block size."

While Kevin's patch addressed vdi_create, my modification also fixes
vdi_open which now accepts images with odd disk sizes.

v3:
Don't allow reading of disk images with too large disk sizes.
Neither VBoxManage nor old versions of qemu-img read such images.
This change requires rounding of odd disk sizes before we do the checks.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: François Revol <revol@free.fr>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit f21dc3a4652eeb82117d7d55d975278fe1444b26)

Conflicts:

block/vdi.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/vdi.c