From nobody Fri Apr 11 15:57:59 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.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 1493412465596236.21159421362768; Fri, 28 Apr 2017 13:47:45 -0700 (PDT) Received: from localhost ([::1]:38774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d4Cno-00052I-4o for importer@patchew.org; Fri, 28 Apr 2017 16:47:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d4CbF-000217-2m for qemu-devel@nongnu.org; Fri, 28 Apr 2017 16:34:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d4CbE-0001Pp-AH for qemu-devel@nongnu.org; Fri, 28 Apr 2017 16:34:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50168) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d4Cb8-0001LV-1A; Fri, 28 Apr 2017 16:34:38 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC47823E6F2; Fri, 28 Apr 2017 20:34:36 +0000 (UTC) Received: from noname.redhat.com (ovpn-117-227.ams2.redhat.com [10.36.117.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47D7D9533F; Fri, 28 Apr 2017 20:34:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EC47823E6F2 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EC47823E6F2 From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 28 Apr 2017 22:33:29 +0200 Message-Id: <1493411622-5343-22-git-send-email-kwolf@redhat.com> In-Reply-To: <1493411622-5343-1-git-send-email-kwolf@redhat.com> References: <1493411622-5343-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 28 Apr 2017 20:34:37 +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] [PULL 21/34] 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: kwolf@redhat.com, qemu-devel@nongnu.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" From: Max Reitz 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.) Signed-off-by: Max Reitz Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- qemu-img.c | 13 +++++++------ tests/qemu-iotests/122.out | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index e0503ae..7044884 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2089,12 +2089,6 @@ static int img_convert(int argc, char **argv) } =20 =20 - if (s.src_num > 1 && out_baseimg) { - error_report("-B makes no sense when concatenating multiple input " - "images"); - goto fail_getopt; - } - /* ret is still -EINVAL until here */ ret =3D bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough= ); if (ret < 0) { @@ -2208,6 +2202,13 @@ static int img_convert(int argc, char **argv) } s.target_has_backing =3D (bool) out_baseimg; =20 + if (s.src_num > 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 (s.compressed) { bool encryption =3D diff --git a/tests/qemu-iotests/122.out b/tests/qemu-iotests/122.out index 98814de..9317d80 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 1.8.3.1