]> git.proxmox.com Git - qemu.git/commitdiff
vmdk: refuse enabling zeroed grain with flat images
authorFam Zheng <famz@redhat.com>
Fri, 11 Oct 2013 07:43:23 +0000 (15:43 +0800)
committerKevin Wolf <kwolf@redhat.com>
Fri, 11 Oct 2013 14:50:01 +0000 (16:50 +0200)
This is a header flag and we needs sparse for the header.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/vmdk.c
tests/qemu-iotests/059
tests/qemu-iotests/059.out

index a1aaea77e992f7735dc905ef552703a894f9b6b6..709aa3deb06cb452fa8c8d2b33a06180a21e0b43 100644 (file)
@@ -1664,6 +1664,10 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
         error_setg(errp, "Flat image can't have backing file");
         return -ENOTSUP;
     }
+    if (flat && zeroed_grain) {
+        error_setg(errp, "Flat image can't enable zeroed grain");
+        return -ENOTSUP;
+    }
     if (backing_file) {
         BlockDriverState *bs = bdrv_new("");
         ret = bdrv_open(bs, backing_file, NULL, 0, NULL, errp);
index 18cdad13413bf9e0b4c05e740ca0099ad462424d..b81c575d9457cc7019cadda7b9a64c2a16b705cc 100755 (executable)
@@ -71,6 +71,10 @@ echo "=== Testing monolithicFlat creation and opening ==="
 IMGOPTS="subformat=monolithicFlat" _make_test_img 2G
 $QEMU_IMG info $TEST_IMG | _filter_testdir
 
+echo
+echo "=== Testing monolithicFlat with zeroed_grain ==="
+IMGOPTS="subformat=monolithicFlat,zeroed_grain=on" _make_test_img 2G
+
 # success, all done
 echo "*** done"
 rm -f $seq.full
index 265cd76169779ca2e833851eae651f481ed3b1cc..9b12efb466fc2fae4e5630e5379c3985b9791561 100644 (file)
@@ -22,4 +22,8 @@ image: TEST_DIR/t.vmdk
 file format: vmdk
 virtual size: 2.0G (2147483648 bytes)
 disk size: 4.0K
+
+=== Testing monolithicFlat with zeroed_grain ===
+qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648
 *** done