From nobody Sat Oct 25 21:42:26 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 1521653973342891.5840898322448; Wed, 21 Mar 2018 10:39:33 -0700 (PDT) Received: from localhost ([::1]:56477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhhx-0006P7-27 for importer@patchew.org; Wed, 21 Mar 2018 13:39:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhfz-0004wE-45 for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhfx-0001fq-UX for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:27 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48018 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 1eyhft-0001eK-9O; Wed, 21 Mar 2018 13:37:21 -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 D2B8776FB9; Wed, 21 Mar 2018 17:37:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 806D310B00AB; Wed, 21 Mar 2018 17:37:19 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:03 +0100 Message-Id: <20180321173714.14741-2-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-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]); Wed, 21 Mar 2018 17:37:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Mar 2018 17:37:20 +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 v2 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 | 7 +++---- block/vdi.c | 24 ++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 5b0ad1a8b7..ce774e3d92 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3834,16 +3834,15 @@ # # @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 (allowed values: = off, +# full; 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:26 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 1521654001551941.8272581057323; Wed, 21 Mar 2018 10:40:01 -0700 (PDT) Received: from localhost ([::1]:56483 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhiS-0006oh-Ih for importer@patchew.org; Wed, 21 Mar 2018 13:40:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhfy-0004wC-P6 for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhfx-0001fl-Tj for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53030 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 1eyhfu-0001ee-Rg; Wed, 21 Mar 2018 13:37:22 -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 68631406E897; Wed, 21 Mar 2018 17:37:22 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18BE810B00AB; Wed, 21 Mar 2018 17:37:20 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:04 +0100 Message-Id: <20180321173714.14741-3-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-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]); Wed, 21 Mar 2018 17:37:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 21 Mar 2018 17:37:22 +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 v2 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:26 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 15216542029701007.5712544626275; Wed, 21 Mar 2018 10:43:22 -0700 (PDT) Received: from localhost ([::1]:56505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhli-0001XY-2F for importer@patchew.org; Wed, 21 Mar 2018 13:43:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhg2-0004z1-3Z for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhg0-0001hB-Hk for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48024 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 1eyhfw-0001ex-Co; Wed, 21 Mar 2018 13:37:24 -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 F223E7705E; Wed, 21 Mar 2018 17:37:23 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2DF410B0F2F; Wed, 21 Mar 2018 17:37:22 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:05 +0100 Message-Id: <20180321173714.14741-4-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-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]); Wed, 21 Mar 2018 17:37:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Mar 2018 17:37:24 +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 v2 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 Reviewed-by: Eric Blake --- tests/qemu-iotests/211 | 246 +++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/211.out | 97 ++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 344 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..1edec26517 --- /dev/null +++ b/tests/qemu-iotests/211 @@ -0,0 +1,246 @@ +#!/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 1521654142479291.382857537606; Wed, 21 Mar 2018 10:42:22 -0700 (PDT) Received: from localhost ([::1]:56501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhkf-0000dj-W8 for importer@patchew.org; Wed, 21 Mar 2018 13:42:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhg0-0004xo-Vl for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhg0-0001h3-51 for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58990 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 1eyhfx-0001fd-Vd; Wed, 21 Mar 2018 13:37:26 -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 89F5B7CBBA; Wed, 21 Mar 2018 17:37:25 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 397DD10B00AD; Wed, 21 Mar 2018 17:37:24 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:06 +0100 Message-Id: <20180321173714.14741-5-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-1-kwolf@redhat.com> MIME-Version: 1.0 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]); Wed, 21 Mar 2018 17:37:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 21 Mar 2018 17:37:25 +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:'' Content-Transfer-Encoding: quoted-printable 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 v2 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-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: Eric Blake Reviewed-by: Daniel P. Berrang=C3=A9 --- 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:26 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 1521654302162913.7833919651497; Wed, 21 Mar 2018 10:45:02 -0700 (PDT) Received: from localhost ([::1]:56516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhnI-0003Gl-Ri for importer@patchew.org; Wed, 21 Mar 2018 13:45:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhg2-0004zA-MU for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhg1-0001hr-U8 for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48026 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 1eyhfz-0001ge-Hp; Wed, 21 Mar 2018 13:37:27 -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 2111F76FB9; Wed, 21 Mar 2018 17:37:27 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id C56E710B00AB; Wed, 21 Mar 2018 17:37:25 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:07 +0100 Message-Id: <20180321173714.14741-6-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-1-kwolf@redhat.com> MIME-Version: 1.0 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]); Wed, 21 Mar 2018 17:37:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Mar 2018 17:37:27 +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:'' Content-Transfer-Encoding: quoted-printable 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 v2 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-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: Eric Blake Reviewed-by: Daniel P. Berrang=C3=A9 --- 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:26 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 152165446680052.6523231801674; Wed, 21 Mar 2018 10:47:46 -0700 (PDT) Received: from localhost ([::1]:56532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhpw-0005vj-V3 for importer@patchew.org; Wed, 21 Mar 2018 13:47:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59768) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhg8-00053w-Eo for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhg7-0001k3-Ht for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:36 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53036 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 1eyhg1-0001hL-43; Wed, 21 Mar 2018 13:37:29 -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 AB5E2406E897; Wed, 21 Mar 2018 17:37:28 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C53210B00AB; Wed, 21 Mar 2018 17:37:27 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:08 +0100 Message-Id: <20180321173714.14741-7-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-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]); Wed, 21 Mar 2018 17:37:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 21 Mar 2018 17:37:28 +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 v2 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: Eric Blake --- tests/qemu-iotests/210 | 37 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/210.out | 16 ++++++++++++++++ 2 files changed, 53 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" <0= size"}} +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false}} + +image: json:{"driver": "IMGFMT", "file": {"driver": "file", "filename": "T= EST_DIR/t.IMGFMT"}, "key-secret": "keysec0"} +file format: IMGFMT +virtual size: 0 (0 bytes) *** done --=20 2.13.6 From nobody Sat Oct 25 21:42:26 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 1521654379184326.82169287984823; Wed, 21 Mar 2018 10:46:19 -0700 (PDT) Received: from localhost ([::1]:56525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhoU-0004R2-O8 for importer@patchew.org; Wed, 21 Mar 2018 13:46:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhg9-000555-At for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhg8-0001kh-Ff for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:37 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48032 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 1eyhg2-0001i6-Ll; Wed, 21 Mar 2018 13:37:30 -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 42D487705E; Wed, 21 Mar 2018 17:37:30 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6B5410B0F2F; Wed, 21 Mar 2018 17:37:28 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:09 +0100 Message-Id: <20180321173714.14741-8-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-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]); Wed, 21 Mar 2018 17:37:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Mar 2018 17:37:30 +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 v2 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..5cf16a3b3c 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 INT64_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:26 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 1521654080099145.4538711029478; Wed, 21 Mar 2018 10:41:20 -0700 (PDT) Received: from localhost ([::1]:56493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhjj-00086w-76 for importer@patchew.org; Wed, 21 Mar 2018 13:41:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhgC-00058U-4w for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhg9-0001le-Mm for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48036 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 1eyhg4-0001im-87; Wed, 21 Mar 2018 13:37:32 -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 CDF41EB71E; Wed, 21 Mar 2018 17:37:31 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DF2710B00AD; Wed, 21 Mar 2018 17:37:30 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:10 +0100 Message-Id: <20180321173714.14741-9-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-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]); Wed, 21 Mar 2018 17:37:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Mar 2018 17:37:31 +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 v2 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..e5a1ba77ce --- /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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521654532585438.2402298234474; Wed, 21 Mar 2018 10:48:52 -0700 (PDT) Received: from localhost ([::1]:56537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhr1-0006mI-8n for importer@patchew.org; Wed, 21 Mar 2018 13:48:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhg9-00055L-IB for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhg8-0001kz-OT for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:37 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53040 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 1eyhg5-0001jJ-Qx; Wed, 21 Mar 2018 13:37:33 -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 65A4A406E897; Wed, 21 Mar 2018 17:37:33 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1511810B00AB; Wed, 21 Mar 2018 17:37:31 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:11 +0100 Message-Id: <20180321173714.14741-10-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-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]); Wed, 21 Mar 2018 17:37:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 21 Mar 2018 17:37:33 +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 v2 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:26 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 1521654617476761.5382070642602; Wed, 21 Mar 2018 10:50:17 -0700 (PDT) Received: from localhost ([::1]:56543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhsO-0007qR-Hn for importer@patchew.org; Wed, 21 Mar 2018 13:50:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhgA-00056r-LM for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhg9-0001lR-Fk for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34432 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 1eyhg7-0001jm-Ct; Wed, 21 Mar 2018 13:37:35 -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 F07D6401DEBF; Wed, 21 Mar 2018 17:37:34 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0F4310B00AB; Wed, 21 Mar 2018 17:37:33 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:12 +0100 Message-Id: <20180321173714.14741-11-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-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]); Wed, 21 Mar 2018 17:37:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 21 Mar 2018 17:37:35 +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 v2 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:26 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 1521654136793284.695927337557; Wed, 21 Mar 2018 10:42:16 -0700 (PDT) Received: from localhost ([::1]:56500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhke-0000bx-1E for importer@patchew.org; Wed, 21 Mar 2018 13:42:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhgJ-0005GF-5T for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhgE-0001n3-A5 for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:47 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53046 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 1eyhg8-0001kv-Tw; Wed, 21 Mar 2018 13:37:36 -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 87896406E897; Wed, 21 Mar 2018 17:37:36 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 373F510B0F2F; Wed, 21 Mar 2018 17:37:35 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:13 +0100 Message-Id: <20180321173714.14741-12-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-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]); Wed, 21 Mar 2018 17:37:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 21 Mar 2018 17:37:36 +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 v2 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:26 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 1521654679979647.7732932224932; Wed, 21 Mar 2018 10:51:19 -0700 (PDT) Received: from localhost ([::1]:56552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhtP-0000Jd-5j for importer@patchew.org; Wed, 21 Mar 2018 13:51:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyhgJ-0005GH-6m for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyhgF-0001nN-5R for qemu-devel@nongnu.org; Wed, 21 Mar 2018 13:37:47 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48044 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 1eyhgA-0001lr-IF; Wed, 21 Mar 2018 13:37:38 -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 2208576FB9; Wed, 21 Mar 2018 17:37:38 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-20.ams2.redhat.com [10.36.117.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2E6210B00AD; Wed, 21 Mar 2018 17:37:36 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 21 Mar 2018 18:37:14 +0100 Message-Id: <20180321173714.14741-13-kwolf@redhat.com> In-Reply-To: <20180321173714.14741-1-kwolf@redhat.com> References: <20180321173714.14741-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]); Wed, 21 Mar 2018 17:37:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 21 Mar 2018 17:37:38 +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 v2 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..3a00a0f6d6 --- /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 <