qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v3 2/2] vmdk: refuse enabling zeroed grain with flat images
Date: Fri, 11 Oct 2013 15:43:23 +0800	[thread overview]
Message-ID: <1381477403-25759-3-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1381477403-25759-1-git-send-email-famz@redhat.com>

This is a header flag and we needs sparse for the header.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/vmdk.c               | 4 ++++
 tests/qemu-iotests/059     | 4 ++++
 tests/qemu-iotests/059.out | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/block/vmdk.c b/block/vmdk.c
index 4f8ae77..90340eb 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -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);
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
index dd6addf..26d4538 100755
--- a/tests/qemu-iotests/059
+++ b/tests/qemu-iotests/059
@@ -71,6 +71,10 @@ echo
 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
diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out
index dc4f024..2b29ca9 100644
--- a/tests/qemu-iotests/059.out
+++ b/tests/qemu-iotests/059.out
@@ -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
-- 
1.8.3.1

  parent reply	other threads:[~2013-10-11  7:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11  7:43 [Qemu-devel] [PATCH v3 0/2] vmdk: convert error reporting Fam Zheng
2013-10-11  7:43 ` [Qemu-devel] [PATCH v3 1/2] vmdk: convert error code to use errp Fam Zheng
2013-10-11  7:43 ` Fam Zheng [this message]
2013-10-11 10:03 ` [Qemu-devel] [PATCH v3 0/2] vmdk: convert error reporting Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381477403-25759-3-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).