From nobody Mon Feb 9 19:25:50 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1554928113; cv=none; d=zoho.com; s=zohoarc; b=cEsnkB4mlIxNPsBzbfcOf7Q+/mflkRBlUsRcY1VChJbvFMcyPdU8bxk0BPjDEQ9KuUx1evlevkCdOIo9E4puQOBJhhjCI1X7d3U7RGDKPuIQ3f76KZAgor7ScPjIe2zyCG2244L6/2/HJCx0nE4VNTF+th3yqdIkxzWYt9opzrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554928113; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=QNTRvjcGf9DTbVCy3A4fNUkgUKLOO9pIAHEMWHXq64I=; b=KbvaWIMUsmoEvM2j0djALYvXZmlby/2242qS0wy965uP04oA80Z8yiPBPvjQSe/AisHWPWIQCd/uDOo8VluDS6KuHLu4PyA98PxnQajpbXsK49fOsp9jm/Mb6koD+1CYyWQsRPgL3dGGQpgXWV+kurk9GAVRGVbJSAT6ip7conY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554928113527733.4147944192066; Wed, 10 Apr 2019 13:28:33 -0700 (PDT) Received: from localhost ([127.0.0.1]:37427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEJpR-0005Mv-VB for importer@patchew.org; Wed, 10 Apr 2019 16:28:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEJib-000783-6u for qemu-devel@nongnu.org; Wed, 10 Apr 2019 16:21:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEJia-0004Wx-3v for qemu-devel@nongnu.org; Wed, 10 Apr 2019 16:21:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33736) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hEJiX-0004Uw-DA; Wed, 10 Apr 2019 16:21:09 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB62F89C42; Wed, 10 Apr 2019 20:21:08 +0000 (UTC) Received: from localhost (unknown [10.40.205.69]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C0F45D9D5; Wed, 10 Apr 2019 20:21:08 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Wed, 10 Apr 2019 22:20:33 +0200 Message-Id: <20190410202033.28617-12-mreitz@redhat.com> In-Reply-To: <20190410202033.28617-1-mreitz@redhat.com> References: <20190410202033.28617-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 10 Apr 2019 20:21:08 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 11/11] iotests: Test committing to overridden backing 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-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Max Reitz --- tests/qemu-iotests/040 | 61 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/040.out | 4 +-- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040 index dc3fe57fbd..155c1d8c23 100755 --- a/tests/qemu-iotests/040 +++ b/tests/qemu-iotests/040 @@ -524,5 +524,66 @@ class TestCommitWithFilters(iotests.QMPTestCase): self.assert_qmp(result, 'error/desc', 'Top image file %s not found' % cow3_name) =20 +class TestCommitWithOverriddenBacking(iotests.QMPTestCase): + img_base_a =3D os.path.join(iotests.test_dir, 'base_a.img') + img_base_b =3D os.path.join(iotests.test_dir, 'base_b.img') + img_top =3D os.path.join(iotests.test_dir, 'top.img') + + def setUp(self): + qemu_img('create', '-f', iotests.imgfmt, self.img_base_a, '1M') + qemu_img('create', '-f', iotests.imgfmt, self.img_base_b, '1M') + qemu_img('create', '-f', iotests.imgfmt, '-b', self.img_base_a, \ + self.img_top) + + self.vm =3D iotests.VM() + self.vm.launch() + + # Use base_b instead of base_a as the backing of top + result =3D self.vm.qmp('blockdev-add', **{ + 'node-name': 'top', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': self.img_top + }, + 'backing': { + 'node-name': 'base', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': self.img_base_b + } + } + }) + self.assert_qmp(result, 'return', {}) + + def tearDown(self): + self.vm.shutdown() + os.remove(self.img_top) + os.remove(self.img_base_a) + os.remove(self.img_base_b) + + def test_commit_to_a(self): + # Try committing to base_a (which should fail, as top's + # backing image is base_b instead) + result =3D self.vm.qmp('block-commit', + job_id=3D'commit', + device=3D'top', + base=3Dself.img_base_a) + self.assert_qmp(result, 'error/class', 'GenericError') + + def test_commit_to_b(self): + # Try committing to base_b (which should work, since that is + # actually top's backing image) + result =3D self.vm.qmp('block-commit', + job_id=3D'commit', + device=3D'top', + base=3Dself.img_base_b) + self.assert_qmp(result, 'return', {}) + + self.vm.event_wait('BLOCK_JOB_READY') + self.vm.qmp('block-job-complete', device=3D'commit') + self.vm.event_wait('BLOCK_JOB_COMPLETED') + if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'qed']) diff --git a/tests/qemu-iotests/040.out b/tests/qemu-iotests/040.out index 220a5fa82c..bbcbc202a0 100644 --- a/tests/qemu-iotests/040.out +++ b/tests/qemu-iotests/040.out @@ -1,5 +1,5 @@ -............................................... +................................................. ---------------------------------------------------------------------- -Ran 47 tests +Ran 49 tests =20 OK --=20 2.20.1