From nobody Mon Feb 9 12:09:30 2026 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492115856226256.5308788351281; Thu, 13 Apr 2017 13:37:36 -0700 (PDT) Received: from localhost ([::1]:50825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cylUk-00064p-Mv for importer@patchew.org; Thu, 13 Apr 2017 16:37:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cylRb-0003TL-CC for qemu-devel@nongnu.org; Thu, 13 Apr 2017 16:34:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cylRW-0002OX-7g for qemu-devel@nongnu.org; Thu, 13 Apr 2017 16:34:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40152) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cylRT-0002Ky-QU; Thu, 13 Apr 2017 16:34:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE7AC80516; Thu, 13 Apr 2017 20:34:10 +0000 (UTC) Received: from localhost (ovpn-204-51.brq.redhat.com [10.40.204.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 526BB627DD; Thu, 13 Apr 2017 20:34:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BE7AC80516 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mreitz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BE7AC80516 From: Max Reitz To: qemu-block@nongnu.org Date: Thu, 13 Apr 2017 22:34:01 +0200 Message-Id: <20170413203401.3213-4-mreitz@redhat.com> In-Reply-To: <20170413203401.3213-1-mreitz@redhat.com> References: <20170413203401.3213-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 13 Apr 2017 20:34:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 3/3] qemu-img/convert: Move bs_n > 1 && -B check down 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: Kevin Wolf , qemu-stable , qemu-devel@nongnu.org, Max Reitz 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 does not make much sense to use a backing image for the target when you concatenate multiple images (because then there is no correspondence between the source images' backing files and the target's); but it was still possible to give one by using -o backing_file=3DX instead of -B X. Fix this by moving the check. (Also, change the error message because -B is not the only way to specify the backing file, evidently.) Cc: qemu-stable Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- qemu-img.c | 14 +++++++------- tests/qemu-iotests/122.out | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 70ffb07447..cfd1986efd 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2113,13 +2113,6 @@ static int img_convert(int argc, char **argv) } =20 =20 - if (bs_n > 1 && out_baseimg) { - error_report("-B makes no sense when concatenating multiple input " - "images"); - ret =3D -1; - goto out; - } - src_flags =3D 0; ret =3D bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough= ); if (ret < 0) { @@ -2229,6 +2222,13 @@ static int img_convert(int argc, char **argv) out_baseimg =3D out_baseimg_param; } =20 + if (bs_n > 1 && out_baseimg) { + error_report("Having a backing file for the target makes no sense = when " + "concatenating multiple input images"); + ret =3D -1; + goto out; + } + /* Check if compression is supported */ if (compress) { bool encryption =3D diff --git a/tests/qemu-iotests/122.out b/tests/qemu-iotests/122.out index 98814de5d6..9317d801ad 100644 --- a/tests/qemu-iotests/122.out +++ b/tests/qemu-iotests/122.out @@ -61,8 +61,8 @@ read 65536/65536 bytes at offset 4194304 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 8388608 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-img: -B makes no sense when concatenating multiple input images -qemu-img: -B makes no sense when concatenating multiple input images +qemu-img: Having a backing file for the target makes no sense when concate= nating multiple input images +qemu-img: Having a backing file for the target makes no sense when concate= nating multiple input images =20 =3D=3D=3D Compression with misaligned allocations and image sizes =3D=3D= =3D =20 --=20 2.12.2