From nobody Sat Oct 25 21:42:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521567603472849.2152088006175; Tue, 20 Mar 2018 10:40:03 -0700 (PDT) Received: from localhost ([::1]:50948 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLEs-0002zq-Dl for importer@patchew.org; Tue, 20 Mar 2018 13:39:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLBk-000071-5B for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLBj-0000Pr-2a for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:44 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55220 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBg-0000OF-Oe; Tue, 20 Mar 2018 13:36:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F539EBFF3; Tue, 20 Mar 2018 17:36:40 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id F387C10B0F5B; Tue, 20 Mar 2018 17:36:38 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:21 +0100 Message-Id: <20180320173632.25480-2-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 20 Mar 2018 17:36:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 20 Mar 2018 17:36:40 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 01/12] vdi: Change 'static' create option to 'preallocation' in QMP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" What static=3Don really does is what we call metadata preallocation for other block drivers. While we can still change the QMP interface, make it more consistent by using 'preallocation' for VDI, too. This doesn't implement any new functionality, so the only supported preallocation modes are 'off' and 'metadata' for now. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- qapi/block-core.json | 6 ++---- block/vdi.c | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 5b0ad1a8b7..f6673f2b13 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3834,16 +3834,14 @@ # # @file Node to create the image format on # @size Size of the virtual disk in bytes -# @static Whether to create a statically (true) or -# dynamically (false) allocated image -# (default: false, i.e. dynamic) +# @preallocation Preallocation mode for the new image (default: off) # # Since: 2.12 ## { 'struct': 'BlockdevCreateOptionsVdi', 'data': { 'file': 'BlockdevRef', 'size': 'size', - '*static': 'bool' } } + '*preallocation': 'PreallocMode' } } =20 ## # @BlockdevVhdxSubformat: diff --git a/block/vdi.c b/block/vdi.c index d939b034c4..73c059e69d 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -728,7 +728,7 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreate= Options *create_options, int ret =3D 0; uint64_t bytes =3D 0; uint32_t blocks; - uint32_t image_type =3D VDI_TYPE_DYNAMIC; + uint32_t image_type; VdiHeader header; size_t i; size_t bmap_size; @@ -744,9 +744,22 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreat= eOptions *create_options, =20 /* Validate options and set default values */ bytes =3D vdi_opts->size; - if (vdi_opts->q_static) { + + if (!vdi_opts->has_preallocation) { + vdi_opts->preallocation =3D PREALLOC_MODE_OFF; + } + switch (vdi_opts->preallocation) { + case PREALLOC_MODE_OFF: + image_type =3D VDI_TYPE_DYNAMIC; + break; + case PREALLOC_MODE_METADATA: image_type =3D VDI_TYPE_STATIC; + break; + default: + error_setg(errp, "Preallocation mode not supported for vdi"); + return -EINVAL; } + #ifndef CONFIG_VDI_STATIC_IMAGE if (image_type =3D=3D VDI_TYPE_STATIC) { ret =3D -ENOTSUP; @@ -874,6 +887,7 @@ static int coroutine_fn vdi_co_create_opts(const char *= filename, QemuOpts *opts, BlockdevCreateOptions *create_options =3D NULL; BlockDriverState *bs_file =3D NULL; uint64_t block_size =3D DEFAULT_CLUSTER_SIZE; + bool is_static =3D false; Visitor *v; Error *local_err =3D NULL; int ret; @@ -895,6 +909,9 @@ static int coroutine_fn vdi_co_create_opts(const char *= filename, QemuOpts *opts, goto done; } #endif + if (qemu_opt_get_bool_del(opts, BLOCK_OPT_STATIC, false)) { + is_static =3D true; + } =20 qdict =3D qemu_opts_to_qdict_filtered(opts, NULL, &vdi_create_opts, tr= ue); =20 @@ -913,6 +930,9 @@ static int coroutine_fn vdi_co_create_opts(const char *= filename, QemuOpts *opts, =20 qdict_put_str(qdict, "driver", "vdi"); qdict_put_str(qdict, "file", bs_file->node_name); + if (is_static) { + qdict_put_str(qdict, "preallocation", "metadata"); + } =20 /* Get the QAPI object */ v =3D qobject_input_visitor_new_keyval(QOBJECT(qdict)); --=20 2.13.6 From nobody Sat Oct 25 21:42:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521567531801945.3412171806783; Tue, 20 Mar 2018 10:38:51 -0700 (PDT) Received: from localhost ([::1]:50939 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLDm-0001YE-VW for importer@patchew.org; Tue, 20 Mar 2018 13:38:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLBl-00008o-OL for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLBk-0000QX-Qx for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:45 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49582 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBi-0000PF-AN; Tue, 20 Mar 2018 13:36:42 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D833F4001852; Tue, 20 Mar 2018 17:36:41 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89CB010B0F5B; Tue, 20 Mar 2018 17:36:40 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:22 +0100 Message-Id: <20180320173632.25480-3-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 20 Mar 2018 17:36:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 20 Mar 2018 17:36:41 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 02/12] vdi: Fix build with CONFIG_VDI_DEBUG X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use qemu_uuid_unparse() instead of uuid_unparse() to make vdi.c compile again when CONFIG_VDI_DEBUG is set. In order to prevent future bitrot, replace '#ifdef CONFIG_VDI_DEBUG' by 'if (VDI_DEBUG)' so that the compiler always sees the code. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/vdi.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/block/vdi.c b/block/vdi.c index 73c059e69d..4a2d1ff88d 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -235,7 +235,6 @@ static void vdi_header_to_le(VdiHeader *header) qemu_uuid_bswap(&header->uuid_parent); } =20 -#if defined(CONFIG_VDI_DEBUG) static void vdi_header_print(VdiHeader *header) { char uuid[37]; @@ -257,16 +256,15 @@ static void vdi_header_print(VdiHeader *header) logout("block extra 0x%04x\n", header->block_extra); logout("blocks tot. 0x%04x\n", header->blocks_in_image); logout("blocks all. 0x%04x\n", header->blocks_allocated); - uuid_unparse(header->uuid_image, uuid); + qemu_uuid_unparse(&header->uuid_image, uuid); logout("uuid image %s\n", uuid); - uuid_unparse(header->uuid_last_snap, uuid); + qemu_uuid_unparse(&header->uuid_last_snap, uuid); logout("uuid snap %s\n", uuid); - uuid_unparse(header->uuid_link, uuid); + qemu_uuid_unparse(&header->uuid_link, uuid); logout("uuid link %s\n", uuid); - uuid_unparse(header->uuid_parent, uuid); + qemu_uuid_unparse(&header->uuid_parent, uuid); logout("uuid parent %s\n", uuid); } -#endif =20 static int coroutine_fn vdi_co_check(BlockDriverState *bs, BdrvCheckResult= *res, BdrvCheckMode fix) @@ -387,9 +385,9 @@ static int vdi_open(BlockDriverState *bs, QDict *option= s, int flags, } =20 vdi_header_to_cpu(&header); -#if defined(CONFIG_VDI_DEBUG) - vdi_header_print(&header); -#endif + if (VDI_DEBUG) { + vdi_header_print(&header); + } =20 if (header.disk_size > VDI_DISK_SIZE_MAX) { error_setg(errp, "Unsupported VDI image size (size is 0x%" PRIx64 @@ -825,9 +823,9 @@ static int coroutine_fn vdi_co_do_create(BlockdevCreate= Options *create_options, qemu_uuid_generate(&header.uuid_image); qemu_uuid_generate(&header.uuid_last_snap); /* There is no need to set header.uuid_link or header.uuid_parent here= . */ -#if defined(CONFIG_VDI_DEBUG) - vdi_header_print(&header); -#endif + if (VDI_DEBUG) { + vdi_header_print(&header); + } vdi_header_to_le(&header); ret =3D blk_pwrite(blk, offset, &header, sizeof(header), 0); if (ret < 0) { --=20 2.13.6 From nobody Sat Oct 25 21:42:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521568059385203.57500119632607; Tue, 20 Mar 2018 10:47:39 -0700 (PDT) Received: from localhost ([::1]:51006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLMI-0001gF-GE for importer@patchew.org; Tue, 20 Mar 2018 13:47:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLBq-0000EV-UU for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLBp-0000SL-53 for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:50 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37040 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBj-0000Q4-Se; Tue, 20 Mar 2018 13:36:43 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E976D145C; Tue, 20 Mar 2018 17:36:43 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F7BD10B0F5B; Tue, 20 Mar 2018 17:36:41 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:23 +0100 Message-Id: <20180320173632.25480-4-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 20 Mar 2018 17:36:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 20 Mar 2018 17:36:43 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 03/12] qemu-iotests: Test vdi image creation with QMP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Kevin Wolf --- tests/qemu-iotests/211 | 256 +++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/211.out | 98 +++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 355 insertions(+) create mode 100755 tests/qemu-iotests/211 create mode 100644 tests/qemu-iotests/211.out diff --git a/tests/qemu-iotests/211 b/tests/qemu-iotests/211 new file mode 100755 index 0000000000..6bf1ca784c --- /dev/null +++ b/tests/qemu-iotests/211 @@ -0,0 +1,256 @@ +#!/bin/bash +# +# Test VDI and file image creation +# +# Copyright (C) 2018 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dkwolf@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +status=3D1 # failure is the default! + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt vdi +_supported_proto file +_supported_os Linux + +function do_run_qemu() +{ + echo Testing: "$@" + $QEMU -nographic -qmp stdio -serial none "$@" + echo +} + +function run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \ + | _filter_qemu | _filter_imgfmt \ + | _filter_actual_image_size +} + +echo +echo "=3D=3D=3D Successful image creation (defaults) =3D=3D=3D" +echo + +size=3D$((128 * 1024 * 1024)) + +run_qemu < Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521567774961976.5951995254669; Tue, 20 Mar 2018 10:42:54 -0700 (PDT) Received: from localhost ([::1]:50974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLHi-0005fE-45 for importer@patchew.org; Tue, 20 Mar 2018 13:42:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLBq-0000E9-NA for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLBp-0000So-W8 for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:50 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39566 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBn-0000RH-8L; Tue, 20 Mar 2018 13:36:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CD53540704A2; Tue, 20 Mar 2018 17:36:46 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id A902E10B0F5B; Tue, 20 Mar 2018 17:36:43 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:24 +0100 Message-Id: <20180320173632.25480-5-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 20 Mar 2018 17:36:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 20 Mar 2018 17:36:46 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 04/12] qemu-iotests: Enable 025 for luks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We want to test resizing even for luks. The only change that is needed is to explicitly zero out new space for luks because it's undefined. Signed-off-by: Kevin Wolf Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake --- tests/qemu-iotests/025 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025 index f5e672e6b3..70dd5f10aa 100755 --- a/tests/qemu-iotests/025 +++ b/tests/qemu-iotests/025 @@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.filter . ./common.pattern =20 -_supported_fmt raw qcow2 qed +_supported_fmt raw qcow2 qed luks _supported_proto file sheepdog rbd nfs _supported_os Linux =20 @@ -62,6 +62,13 @@ length EOF _check_test_img =20 +# bdrv_truncate() doesn't zero the new space, so we need to do that explic= itly. +# We still want to test automatic zeroing for other formats even though +# bdrv_truncate() doesn't guarantee it. +if [ "$IMGFMT" =3D=3D "luks" ]; then + $QEMU_IO -c "write -z $small_size $((big_size - small_size))" "$TEST_I= MG" > /dev/null +fi + echo echo "=3D=3D=3D Verifying image size after reopen" $QEMU_IO -c "length" "$TEST_IMG" --=20 2.13.6 From nobody Sat Oct 25 21:42:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521567674550622.746195925081; Tue, 20 Mar 2018 10:41:14 -0700 (PDT) Received: from localhost ([::1]:50964 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLG5-0004Ap-Iv for importer@patchew.org; Tue, 20 Mar 2018 13:41:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLBr-0000FE-IX for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLBq-0000TK-RY for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:51 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49068 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBo-0000Rq-Pa; Tue, 20 Mar 2018 13:36:48 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 619814026129; Tue, 20 Mar 2018 17:36:48 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1337310B0F5B; Tue, 20 Mar 2018 17:36:46 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:25 +0100 Message-Id: <20180320173632.25480-6-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 20 Mar 2018 17:36:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 20 Mar 2018 17:36:48 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 05/12] luks: Turn another invalid assertion into check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Commit e39e959e fixed an invalid assertion in the .bdrv_length implementation, but left a similar assertion in place for .bdrv_truncate. Instead of crashing when the user requests a too large image size, fail gracefully. A file size of exactly INT64_MAX caused failure before, but is actually legal. Signed-off-by: Kevin Wolf Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake --- block/crypto.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/crypto.c b/block/crypto.c index e0b8856f74..bc6c7e3795 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -357,7 +357,11 @@ static int block_crypto_truncate(BlockDriverState *bs,= int64_t offset, BlockCrypto *crypto =3D bs->opaque; uint64_t payload_offset =3D qcrypto_block_get_payload_offset(crypto->block); - assert(payload_offset < (INT64_MAX - offset)); + + if (payload_offset > INT64_MAX - offset) { + error_setg(errp, "The requested file size is too large"); + return -EFBIG; + } =20 offset +=3D payload_offset; =20 --=20 2.13.6 From nobody Sat Oct 25 21:42:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521568193676255.61997763592683; Tue, 20 Mar 2018 10:49:53 -0700 (PDT) Received: from localhost ([::1]:51022 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLOS-0003q7-Tb for importer@patchew.org; Tue, 20 Mar 2018 13:49:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLBt-0000H0-64 for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLBs-0000U8-Gm for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49072 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBq-0000Sv-H5; Tue, 20 Mar 2018 13:36:50 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EA9F74026788; Tue, 20 Mar 2018 17:36:49 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C28110B0F5B; Tue, 20 Mar 2018 17:36:48 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:26 +0100 Message-Id: <20180320173632.25480-7-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 20 Mar 2018 17:36:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 20 Mar 2018 17:36:49 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 06/12] qemu-iotests: Test invalid resize on luks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This tests that the .bdrv_truncate implementation for luks doesn't crash for invalid image sizes. Signed-off-by: Kevin Wolf Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/qemu-iotests/210 | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/qemu-iotests/210 b/tests/qemu-iotests/210 index 96a5213e77..e607c0d296 100755 --- a/tests/qemu-iotests/210 +++ b/tests/qemu-iotests/210 @@ -204,6 +204,43 @@ run_qemu -blockdev driver=3Dfile,filename=3D"$TEST_IMG= _FILE",node-name=3Dnode0 \ { "execute": "quit" } EOF =20 +echo +echo "=3D=3D=3D Resize image with invalid sizes =3D=3D=3D" +echo + +run_qemu -blockdev driver=3Dfile,filename=3D"$TEST_IMG_FILE",node-name=3Dn= ode0 \ + -blockdev driver=3Dluks,file=3Dnode0,key-secret=3Dkeysec0,node-na= me=3Dnode1 \ + -object secret,id=3Dkeysec0,data=3D"foo" < Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521567838410334.5872638870694; Tue, 20 Mar 2018 10:43:58 -0700 (PDT) Received: from localhost ([::1]:50981 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLIj-0006iR-Aa for importer@patchew.org; Tue, 20 Mar 2018 13:43:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLBy-0000Kj-7b for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLBv-0000VM-Ix for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:36:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49588 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBr-0000Tk-UP; Tue, 20 Mar 2018 13:36:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 80C734001852; Tue, 20 Mar 2018 17:36:51 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31AA11208F60; Tue, 20 Mar 2018 17:36:50 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:27 +0100 Message-Id: <20180320173632.25480-8-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 20 Mar 2018 17:36:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 20 Mar 2018 17:36:51 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 07/12] parallels: Check maximum cluster size on create X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It's unclear what the real maximum cluster size is for the Parallels format, but let's at least make sure that we don't get integer overflows in our .bdrv_co_create implementation. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- block/parallels.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 2da5e56a9d..e4ca018c2e 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -526,6 +526,11 @@ static int coroutine_fn parallels_co_create(BlockdevCr= eateOptions* opts, cl_size =3D DEFAULT_CLUSTER_SIZE; } =20 + /* XXX What is the real limit here? This is an insanely large maximum.= */ + if (cl_size >=3D UINT64_MAX / MAX_PARALLELS_IMAGE_FACTOR) { + error_setg(errp, "Cluster size is too large"); + return -EINVAL; + } if (total_size >=3D MAX_PARALLELS_IMAGE_FACTOR * cl_size) { error_setg(errp, "Image size is too large for this cluster size"); return -E2BIG; --=20 2.13.6 From nobody Sat Oct 25 21:42:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521568423528299.49818874018627; Tue, 20 Mar 2018 10:53:43 -0700 (PDT) Received: from localhost ([::1]:51046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLS4-00066I-MR for importer@patchew.org; Tue, 20 Mar 2018 13:53:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLC0-0000Mz-2o for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:37:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLBy-0000Wi-Cb for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:37:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39572 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBt-0000UQ-G3; Tue, 20 Mar 2018 13:36:53 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1515E40704AD; Tue, 20 Mar 2018 17:36:53 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB14B10B0F5B; Tue, 20 Mar 2018 17:36:51 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:28 +0100 Message-Id: <20180320173632.25480-9-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 20 Mar 2018 17:36:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 20 Mar 2018 17:36:53 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 08/12] qemu-iotests: Test parallels image creation with QMP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Kevin Wolf --- tests/qemu-iotests/212 | 326 +++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/212.out | 111 +++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 438 insertions(+) create mode 100755 tests/qemu-iotests/212 create mode 100644 tests/qemu-iotests/212.out diff --git a/tests/qemu-iotests/212 b/tests/qemu-iotests/212 new file mode 100755 index 0000000000..112a8420ce --- /dev/null +++ b/tests/qemu-iotests/212 @@ -0,0 +1,326 @@ +#!/bin/bash +# +# Test parallels and file image creation +# +# Copyright (C) 2018 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dkwolf@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +status=3D1 # failure is the default! + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt parallels +_supported_proto file +_supported_os Linux + +function do_run_qemu() +{ + echo Testing: "$@" + $QEMU -nographic -qmp stdio -serial none "$@" + echo +} + +function run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \ + | _filter_qemu | _filter_imgfmt \ + | _filter_actual_image_size +} + +echo +echo "=3D=3D=3D Successful image creation (defaults) =3D=3D=3D" +echo + +size=3D$((128 * 1024 * 1024)) + +run_qemu < Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521568317859458.22217035933033; Tue, 20 Mar 2018 10:51:57 -0700 (PDT) Received: from localhost ([::1]:51038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLQL-00052j-S7 for importer@patchew.org; Tue, 20 Mar 2018 13:51:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLC0-0000N1-3U for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:37:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLBz-0000X1-9c for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:37:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54762 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBv-0000Uw-0Q; Tue, 20 Mar 2018 13:36:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E9A28160F99; Tue, 20 Mar 2018 17:36:54 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4FEDC10B0F5B; Tue, 20 Mar 2018 17:36:53 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:29 +0100 Message-Id: <20180320173632.25480-10-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 20 Mar 2018 17:36:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 20 Mar 2018 17:36:54 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 09/12] vhdx: Require power-of-two block size on create X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Images with a non-power-of-two block size are invalid and cannot be opened. Reject such block sizes when creating an image. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Jeff Cody --- block/vhdx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/vhdx.c b/block/vhdx.c index f1b97f4b49..ca211a3196 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1877,6 +1877,10 @@ static int coroutine_fn vhdx_co_create(BlockdevCreat= eOptions *opts, error_setg_errno(errp, EINVAL, "Block size must be a multiple of 1= MB"); return -EINVAL; } + if (!is_power_of_2(block_size)) { + error_setg(errp, "Block size must be a power of two"); + return -EINVAL; + } if (block_size > VHDX_BLOCK_SIZE_MAX) { error_setg_errno(errp, EINVAL, "Block size must not exceed %d", VHDX_BLOCK_SIZE_MAX); --=20 2.13.6 From nobody Sat Oct 25 21:42:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521567975785286.2108097548845; Tue, 20 Mar 2018 10:46:15 -0700 (PDT) Received: from localhost ([::1]:50998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLKw-0000cb-Uv for importer@patchew.org; Tue, 20 Mar 2018 13:46:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLC0-0000NN-6H for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:37:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLBz-0000X9-Bd for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:37:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54766 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBw-0000Vh-KT; Tue, 20 Mar 2018 13:36:56 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 344878163C52; Tue, 20 Mar 2018 17:36:56 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9C3C11701CA; Tue, 20 Mar 2018 17:36:54 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:30 +0100 Message-Id: <20180320173632.25480-11-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 20 Mar 2018 17:36:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 20 Mar 2018 17:36:56 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 10/12] vhdx: Don't use error_setg_errno() with constant errno X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" error_setg_errno() is meant for cases where we got an errno from the OS that can add useful extra information to an error message. It's pointless if we pass a constant errno, these cases should use plain error_setg(). Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Jeff Cody --- block/vhdx.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/block/vhdx.c b/block/vhdx.c index ca211a3196..0e48179b81 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1822,7 +1822,7 @@ static int coroutine_fn vhdx_co_create(BlockdevCreate= Options *opts, /* Validate options and set default values */ image_size =3D vhdx_opts->size; if (image_size > VHDX_MAX_IMAGE_SIZE) { - error_setg_errno(errp, EINVAL, "Image size too large; max of 64TB"= ); + error_setg(errp, "Image size too large; max of 64TB"); return -EINVAL; } =20 @@ -1832,7 +1832,7 @@ static int coroutine_fn vhdx_co_create(BlockdevCreate= Options *opts, log_size =3D vhdx_opts->log_size; } if (log_size < MiB || (log_size % MiB) !=3D 0) { - error_setg_errno(errp, EINVAL, "Log size must be a multiple of 1 M= B"); + error_setg(errp, "Log size must be a multiple of 1 MB"); return -EINVAL; } =20 @@ -1874,7 +1874,7 @@ static int coroutine_fn vhdx_co_create(BlockdevCreate= Options *opts, } =20 if (block_size < MiB || (block_size % MiB) !=3D 0) { - error_setg_errno(errp, EINVAL, "Block size must be a multiple of 1= MB"); + error_setg(errp, "Block size must be a multiple of 1 MB"); return -EINVAL; } if (!is_power_of_2(block_size)) { @@ -1882,8 +1882,7 @@ static int coroutine_fn vhdx_co_create(BlockdevCreate= Options *opts, return -EINVAL; } if (block_size > VHDX_BLOCK_SIZE_MAX) { - error_setg_errno(errp, EINVAL, "Block size must not exceed %d", - VHDX_BLOCK_SIZE_MAX); + error_setg(errp, "Block size must not exceed %d", VHDX_BLOCK_SIZE_= MAX); return -EINVAL; } =20 --=20 2.13.6 From nobody Sat Oct 25 21:42:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521567746098353.68533577627636; Tue, 20 Mar 2018 10:42:26 -0700 (PDT) Received: from localhost ([::1]:50969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLHF-0005DY-7g for importer@patchew.org; Tue, 20 Mar 2018 13:42:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLC0-0000OG-WE for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:37:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLC0-0000Y1-9M for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:37:01 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55230 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBy-0000WS-9l; Tue, 20 Mar 2018 13:36:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD210F8FD0; Tue, 20 Mar 2018 17:36:57 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F24710B0F5B; Tue, 20 Mar 2018 17:36:56 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:31 +0100 Message-Id: <20180320173632.25480-12-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 20 Mar 2018 17:36:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 20 Mar 2018 17:36:57 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 11/12] vhdx: Check for 4 GB maximum log size on creation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It's unclear what the real maximum is, but we use an uint32_t to store the log size in vhdx_co_create(), so we should check that the given value fits in 32 bits. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Jeff Cody --- block/vhdx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/vhdx.c b/block/vhdx.c index 0e48179b81..a1a0302799 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -1829,6 +1829,10 @@ static int coroutine_fn vhdx_co_create(BlockdevCreat= eOptions *opts, if (!vhdx_opts->has_log_size) { log_size =3D DEFAULT_LOG_SIZE; } else { + if (vhdx_opts->log_size > UINT32_MAX) { + error_setg(errp, "Log size must be smaller than 4 GB"); + return -EINVAL; + } log_size =3D vhdx_opts->log_size; } if (log_size < MiB || (log_size % MiB) !=3D 0) { --=20 2.13.6 From nobody Sat Oct 25 21:42:17 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521567921489445.7484199206244; Tue, 20 Mar 2018 10:45:21 -0700 (PDT) Received: from localhost ([::1]:50990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLK4-0008Gy-Ab for importer@patchew.org; Tue, 20 Mar 2018 13:45:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyLC7-0000Vp-Ea for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:37:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyLC4-0000ar-9R for qemu-devel@nongnu.org; Tue, 20 Mar 2018 13:37:07 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49596 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eyLBz-0000XI-Nk; Tue, 20 Mar 2018 13:36:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 526254001852; Tue, 20 Mar 2018 17:36:59 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com [10.36.117.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03C4F10B0F5B; Tue, 20 Mar 2018 17:36:57 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 20 Mar 2018 18:36:32 +0100 Message-Id: <20180320173632.25480-13-kwolf@redhat.com> In-Reply-To: <20180320173632.25480-1-kwolf@redhat.com> References: <20180320173632.25480-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 20 Mar 2018 17:36:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 20 Mar 2018 17:36:59 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH for-2.12 12/12] qemu-iotests: Test vhdx image creation with QMP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Kevin Wolf --- tests/qemu-iotests/213 | 349 +++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/213.out | 121 ++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 471 insertions(+) create mode 100755 tests/qemu-iotests/213 create mode 100644 tests/qemu-iotests/213.out diff --git a/tests/qemu-iotests/213 b/tests/qemu-iotests/213 new file mode 100755 index 0000000000..7e44accb06 --- /dev/null +++ b/tests/qemu-iotests/213 @@ -0,0 +1,349 @@ +#!/bin/bash +# +# Test vhdx and file image creation +# +# Copyright (C) 2018 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dkwolf@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +status=3D1 # failure is the default! + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt vhdx +_supported_proto file +_supported_os Linux + +function do_run_qemu() +{ + echo Testing: "$@" + $QEMU -nographic -qmp stdio -serial none "$@" + echo +} + +function run_qemu() +{ + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \ + | _filter_qemu | _filter_imgfmt \ + | _filter_actual_image_size +} + +echo +echo "=3D=3D=3D Successful image creation (defaults) =3D=3D=3D" +echo + +size=3D$((128 * 1024 * 1024)) + +run_qemu <