From patchwork Fri Oct 11 07:43:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 282545 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A505D2C0432 for ; Fri, 11 Oct 2013 18:44:17 +1100 (EST) Received: from localhost ([::1]:52892 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUXOQ-0006i0-PS for incoming@patchwork.ozlabs.org; Fri, 11 Oct 2013 03:44:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUXNs-0006Xh-0Z for qemu-devel@nongnu.org; Fri, 11 Oct 2013 03:43:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUXNk-0006R9-VI for qemu-devel@nongnu.org; Fri, 11 Oct 2013 03:43:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUXNk-0006R4-Ly for qemu-devel@nongnu.org; Fri, 11 Oct 2013 03:43:32 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9B7hWCO010018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 11 Oct 2013 03:43:32 -0400 Received: from T430s.nay.redhat.com ([10.66.6.118]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9B7hOPA027981; Fri, 11 Oct 2013 03:43:30 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Fri, 11 Oct 2013 15:43:23 +0800 Message-Id: <1381477403-25759-3-git-send-email-famz@redhat.com> In-Reply-To: <1381477403-25759-1-git-send-email-famz@redhat.com> References: <1381477403-25759-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v3 2/2] vmdk: refuse enabling zeroed grain with flat images X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This is a header flag and we needs sparse for the header. Signed-off-by: Fam Zheng --- 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