From nobody Wed Nov 12 05:23:18 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) 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=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) 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=1568297987; cv=none; d=zoho.com; s=zohoarc; b=NB/VgVvVJ3Nfqqf2pbIOvGS4K2bmz4CO7O3P8tSA/vP1oKJVe47k4UL6Q9XSzRs0/XiYD0ot+GdujVxHf5ZhoCfRpP6urU7JFFprQe4qQPBn1IbD0dUtEpbE3/A4mdJ6/JphzDpY8sH/FSOlSk39SCF6CqwAiAoueN/omvaNm6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568297987; 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=aLrOmyNA2Qcjx3/0w+8z3RQUXl2Qa/nDuCFpGv7H9gg=; b=KpPNc0t6CiMG4zkfKlaxlzMbgufejNg8MEqAZQVL6LadolkIgfOi+EbsxeJGvoDEFEfkl/lkQ+tklFQ9KPH2zrg5AEub/eYNqg6zPrk/pmrFm+XUChOGyjuQdja9kwZ9BfpJ+jpBkwqgVA62eaNA8HYXwYvh6vYiSYix3udttY8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568297987596909.7071458542184; Thu, 12 Sep 2019 07:19:47 -0700 (PDT) Received: from localhost ([::1]:35008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Pwo-00056F-1w for importer@patchew.org; Thu, 12 Sep 2019 10:19:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41778) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8Pas-0006tN-FS for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:57:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8Paq-0006X2-RB for qemu-devel@nongnu.org; Thu, 12 Sep 2019 09:57:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52898) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i8Pan-0006VH-S7; Thu, 12 Sep 2019 09:57:02 -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 316B510F23E1; Thu, 12 Sep 2019 13:57:01 +0000 (UTC) Received: from localhost (unknown [10.40.205.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 31CFC608AB; Thu, 12 Sep 2019 13:56:57 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Thu, 12 Sep 2019 15:56:32 +0200 Message-Id: <20190912135632.13925-5-mreitz@redhat.com> In-Reply-To: <20190912135632.13925-1-mreitz@redhat.com> References: <20190912135632.13925-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Thu, 12 Sep 2019 13:57:01 +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 4/4] iotests: Add test for failing mirror complete X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , qemu-devel@nongnu.org, Markus Armbruster , 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 Reviewed-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Tested-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/041 | 44 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/041.out | 4 ++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 8568426311..84bc6d6581 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -1121,6 +1121,50 @@ class TestOrphanedSource(iotests.QMPTestCase): target=3D'dest-ro') self.assert_qmp(result, 'error/class', 'GenericError') =20 + def test_failing_permission_in_complete(self): + self.assert_no_active_block_jobs() + + # Unshare consistent-read on the target + # (The mirror job does not care) + result =3D self.vm.qmp('blockdev-add', + driver=3D'blkdebug', + node_name=3D'dest-perm', + image=3D'dest', + unshare_child_perms=3D['consistent-read']) + self.assert_qmp(result, 'return', {}) + + result =3D self.vm.qmp('blockdev-mirror', job_id=3D'job', device= =3D'src', + sync=3D'full', target=3D'dest', + filter_node_name=3D'mirror-filter') + self.assert_qmp(result, 'return', {}) + + # Require consistent-read on the source + # (We can only add this node once the job has started, or it + # will complain that it does not want to run on non-root nodes) + result =3D self.vm.qmp('blockdev-add', + driver=3D'blkdebug', + node_name=3D'src-perm', + image=3D'src', + take_child_perms=3D['consistent-read']) + self.assert_qmp(result, 'return', {}) + + # While completing, mirror will attempt to replace src by + # dest, which must fail because src-perm requires + # consistent-read but dest-perm does not share it; thus + # aborting the job when it is supposed to complete + self.complete_and_wait('job', + completion_error=3D'Operation not permitted= ') + + # Assert that all of our nodes are still there (except for the + # mirror filter, which should be gone despite the failure) + nodes =3D self.vm.qmp('query-named-block-nodes')['return'] + nodes =3D list(map(lambda image: image['node-name'], nodes)) + + for expect in ['src', 'src-perm', 'dest', 'dest-perm']: + self.assertTrue(expect in nodes, '%s disappeared' % expect) + self.assertFalse('mirror-filter' in nodes, + 'Mirror filter node did not disappear') + if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'qed'], supported_protocols=3D['file']) diff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out index 2c448b4239..f496be9197 100644 --- a/tests/qemu-iotests/041.out +++ b/tests/qemu-iotests/041.out @@ -1,5 +1,5 @@ -..........................................................................= ................ +..........................................................................= ................. ---------------------------------------------------------------------- -Ran 90 tests +Ran 91 tests =20 OK --=20 2.21.0