qemu/block
Stefan Weil f21dc3a465 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>
2010-05-17 10:20:05 +02:00
..
blkdebug.c block: Avoid unchecked casts for AIOCBs 2010-05-17 10:20:05 +02:00
bochs.c bochs: use qemu block API 2010-05-17 10:20:05 +02:00
cloop.c cloop: use qemu block API 2010-05-17 10:20:04 +02:00
cow.c block: Open the underlying image file in generic code 2010-05-03 10:07:30 +02:00
curl.c block: Open the underlying image file in generic code 2010-05-03 10:07:30 +02:00
dmg.c dmg: use qemu block API 2010-05-17 10:20:05 +02:00
nbd.c block: Open the underlying image file in generic code 2010-05-03 10:07:30 +02:00
parallels.c parallels: use qemu block API 2010-05-17 10:20:05 +02:00
qcow2-cluster.c block: Open the underlying image file in generic code 2010-05-03 10:07:30 +02:00
qcow2-refcount.c qcow2: Remove abort on free_clusters failure 2010-05-03 10:07:32 +02:00
qcow2-snapshot.c block: Open the underlying image file in generic code 2010-05-03 10:07:30 +02:00
qcow2.c block: Avoid unchecked casts for AIOCBs 2010-05-17 10:20:05 +02:00
qcow2.h qcow2: Implement bdrv_truncate() for growing images 2010-05-03 10:07:32 +02:00
qcow.c block: Avoid unchecked casts for AIOCBs 2010-05-17 10:20:05 +02:00
raw-posix-aio.h Remove aio_ctx from paio_* interface 2009-10-30 08:39:34 -05:00
raw-posix.c raw-posix: Use pread/pwrite instead of lseek+read/write 2010-05-03 10:07:31 +02:00
raw-win32.c block: Open the underlying image file in generic code 2010-05-03 10:07:30 +02:00
raw.c block: Open the underlying image file in generic code 2010-05-03 10:07:30 +02:00
vdi.c block/vdi: Fix image opening and creation for odd disk sizes 2010-05-17 10:20:05 +02:00
vmdk.c vmdk: Convert to bdrv_open 2010-05-03 10:07:31 +02:00
vpc.c block/vpc: Fix conversion from size to disk geometry 2010-05-17 10:20:05 +02:00
vvfat.c block: Open the underlying image file in generic code 2010-05-03 10:07:30 +02:00