xemu/block
Serge E. Hallyn efc8243d00 block/vpc.c: Detect too-large vpc file
VHD files technically can be up to 2Tb, but virtual pc is limited
to 127G.  Currently qemu-img refused to create vpc files > 127G,
but it is failing to return error when converting from a non-vpc
VHD file which is >127G.  It returns success, but creates a truncated
converted image.  Also, qemu-img info claims the vpc file is 127G
(and clean).

This patch detects a too-large vpc file and returns -EFBIG.  Without
this patch,

=============================================================
root@ip-10-38-123-242:~/qemu-fixed# qemu-img info /mnt/140g-dynamic.vhd
image: /mnt/140g-dynamic.vhd
file format: vpc
virtual size: 127G (136899993600 bytes)
disk size: 284K
root@ip-10-38-123-242:~/qemu-fixed# qemu-img convert -f vpc -O raw /mnt/140g-dynamic.vhd /mnt/y
root@ip-10-38-123-242:~/qemu-fixed# echo $?
0
root@ip-10-38-123-242:~/qemu-fixed# qemu-img info /mnt/y
image: /mnt/y
file format: raw
virtual size: 127G (136899993600 bytes)
disk size: 0
=============================================================

(The 140G image was truncated with no warning or error.)

With the patch, I get:

=============================================================
root@ip-10-38-123-242:~/qemu-fixed# ./qemu-img info /mnt/140g-dynamic.vhd
qemu-img: Could not open '/mnt/140g-dynamic.vhd': File too large
root@ip-10-38-123-242:~/qemu-fixed# ./qemu-img convert -f vpc -O raw /mnt/140g-dynamic.vhd /mnt/y
qemu-img: Could not open '/mnt/140g-dynamic.vhd': File too large
qemu-img: Could not open '/mnt/140g-dynamic.vhd'
=============================================================

See https://bugs.launchpad.net/qemu/+bug/814222 for details.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-08-01 12:10:28 +02:00
..
blkdebug.c block: Allow bdrv_flush to return errors 2010-11-04 12:52:16 +01:00
blkverify.c block: avoid a warning on 64 bit hosts with long as int64_t 2010-11-04 13:54:37 +01: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: Allow bdrv_flush to return errors 2010-11-04 12:52:16 +01:00
curl.c Fix %lld or %llx printf format use 2010-05-22 08:02:12 +00:00
dmg.c dmg: use qemu block API 2010-05-17 10:20:05 +02:00
nbd.c NBD: Avoid leaking a couple of strings when the NBD device is closed 2011-05-03 11:29:21 +02:00
parallels.c parallels: use qemu block API 2010-05-17 10:20:05 +02:00
qcow2-cache.c qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm 2011-07-19 15:39:22 +02:00
qcow2-cluster.c qcow2: Fix in-flight list after qcow2_cache_put failure 2011-06-15 14:36:15 +02:00
qcow2-refcount.c qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm 2011-07-19 15:39:22 +02:00
qcow2-snapshot.c block/qcow2.c: rename qcow_ functions to qcow2_ 2010-12-17 16:15:01 +01:00
qcow2.c Strip trailing '\n' from error_report()'s first argument 2011-06-24 09:13:36 +01:00
qcow2.h qcow2: Use Qcow2Cache in writeback mode during loadvm/savevm 2011-07-19 15:39:22 +02:00
qcow.c qcow: Avoid direct AIO callback 2011-06-14 17:03:27 +02:00
qed-check.c qed: Fix consistency check on 32-bit hosts 2011-04-27 16:21:00 +02:00
qed-cluster.c qed: Add support for zero clusters 2011-04-13 12:06:41 +02:00
qed-gencb.c qed: Table, L2 cache, and cluster functions 2010-12-17 16:11:04 +01:00
qed-l2-cache.c qed: Table, L2 cache, and cluster functions 2010-12-17 16:11:04 +01:00
qed-table.c qed: Table, L2 cache, and cluster functions 2010-12-17 16:11:04 +01:00
qed.c qemu-img create: Fix displayed default cluster size 2011-06-08 11:56:40 +02:00
qed.h qed: Periodically flush and clear need check bit 2011-05-18 14:38:46 +02:00
raw-posix-aio.h Remove aio_ctx from paio_* interface 2009-10-30 08:39:34 -05:00
raw-posix.c block: Make BlockDriver method bdrv_eject() return void 2011-08-01 12:10:28 +02:00
raw-win32.c block/raw-win32: Drop disabled code for removable host devices 2011-08-01 12:10:28 +02:00
raw.c block: Make BlockDriver method bdrv_eject() return void 2011-08-01 12:10:28 +02:00
rbd.c block/rbd: Remove unused local variable 2011-06-14 10:01:19 +02:00
sheepdog.c Wrap recv to avoid warnings 2011-07-25 14:38:56 +00:00
vdi.c vdi: Avoid direct AIO callback 2011-06-15 14:35:15 +02:00
vmdk.c block: add bdrv_get_allocated_file_size() operation 2011-07-19 15:39:08 +02:00
vpc.c block/vpc.c: Detect too-large vpc file 2011-08-01 12:10:28 +02:00
vvfat.c vvfat: fix a file descriptor leak 2011-01-12 19:48:58 +00:00