yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-vmdk-refuse-enabling-zeroed-grain-with-flat-images.patch

9ae3a8
From 0cc9ce211d3b571e35b5440fc12a77195b7ee804 Mon Sep 17 00:00:00 2001
9ae3a8
From: Max Reitz <mreitz@redhat.com>
9ae3a8
Date: Wed, 6 Nov 2013 16:53:41 +0100
9ae3a8
Subject: [PATCH 84/87] vmdk: refuse enabling zeroed grain with flat images
9ae3a8
9ae3a8
RH-Author: Max Reitz <mreitz@redhat.com>
9ae3a8
Message-id: <1383756824-6921-19-git-send-email-mreitz@redhat.com>
9ae3a8
Patchwork-id: 55573
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 18/21] vmdk: refuse enabling zeroed grain with flat images
9ae3a8
Bugzilla: 980771
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
9ae3a8
BZ: 980771
9ae3a8
9ae3a8
This is a header flag and we needs sparse for the header.
9ae3a8
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit 52c8d629cac27ad16dd51507b4733d46fa4efc55)
9ae3a8
9ae3a8
Signed-off-by: Max Reitz <mreitz@redhat.com>
9ae3a8
---
9ae3a8
 block/vmdk.c               | 4 ++++
9ae3a8
 tests/qemu-iotests/059     | 4 ++++
9ae3a8
 tests/qemu-iotests/059.out | 4 ++++
9ae3a8
 3 files changed, 12 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/vmdk.c               |    4 ++++
9ae3a8
 tests/qemu-iotests/059     |    4 ++++
9ae3a8
 tests/qemu-iotests/059.out |    4 ++++
9ae3a8
 3 files changed, 12 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/vmdk.c b/block/vmdk.c
9ae3a8
index 96f9415..ccbb0c9 100644
9ae3a8
--- a/block/vmdk.c
9ae3a8
+++ b/block/vmdk.c
9ae3a8
@@ -1664,6 +1664,10 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
9ae3a8
         error_setg(errp, "Flat image can't have backing file");
9ae3a8
         return -ENOTSUP;
9ae3a8
     }
9ae3a8
+    if (flat && zeroed_grain) {
9ae3a8
+        error_setg(errp, "Flat image can't enable zeroed grain");
9ae3a8
+        return -ENOTSUP;
9ae3a8
+    }
9ae3a8
     if (backing_file) {
9ae3a8
         BlockDriverState *bs = bdrv_new("");
9ae3a8
         ret = bdrv_open(bs, backing_file, NULL, 0, NULL, errp);
9ae3a8
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
9ae3a8
index dd6addf..26d4538 100755
9ae3a8
--- a/tests/qemu-iotests/059
9ae3a8
+++ b/tests/qemu-iotests/059
9ae3a8
@@ -71,6 +71,10 @@ echo
9ae3a8
 IMGOPTS="subformat=monolithicFlat" _make_test_img 2G
9ae3a8
 $QEMU_IMG info $TEST_IMG | _filter_testdir
9ae3a8
 
9ae3a8
+echo
9ae3a8
+echo "=== Testing monolithicFlat with zeroed_grain ==="
9ae3a8
+IMGOPTS="subformat=monolithicFlat,zeroed_grain=on" _make_test_img 2G
9ae3a8
+
9ae3a8
 # success, all done
9ae3a8
 echo "*** done"
9ae3a8
 rm -f $seq.full
9ae3a8
diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out
9ae3a8
index dc4f024..2b29ca9 100644
9ae3a8
--- a/tests/qemu-iotests/059.out
9ae3a8
+++ b/tests/qemu-iotests/059.out
9ae3a8
@@ -22,4 +22,8 @@ image: TEST_DIR/t.vmdk
9ae3a8
 file format: vmdk
9ae3a8
 virtual size: 2.0G (2147483648 bytes)
9ae3a8
 disk size: 4.0K
9ae3a8
+
9ae3a8
+=== Testing monolithicFlat with zeroed_grain ===
9ae3a8
+qemu-img: TEST_DIR/t.IMGFMT: Flat image can't enable zeroed grain
9ae3a8
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648
9ae3a8
 *** done
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8