From patchwork Fri Feb 25 23:42:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761091 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89615C433EF for ; Fri, 25 Feb 2022 23:46:59 +0000 (UTC) Received: from localhost ([::1]:57218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkIc-0001gi-Jb for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 18:46:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFQ-0006eG-2t; Fri, 25 Feb 2022 18:43:40 -0500 Received: from [2a01:111:f400:fe0e::72e] (port=3086 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFO-0005gS-7T; Fri, 25 Feb 2022 18:43:39 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KuLNc4TAgexm/+Q5XfjLjYcg5wvplj3je7UyuTgoxpEI8+O5atwacuYNmeMrvRjcxd4sNDXXDw7d4FZ/JMJAwI5CiN/3dBR9kob2GbpppwUduF2fO9k02rJ+zp5MuCd6Ro14OatQr3Psv0o8QcbxFytnGHyMZUG0c5wuw0RiC4pbz1wKO8oYtJY4wviUy9Rf+As6D965/sjASFwrhI/bRKUNNXKO7aNJ2UW/HFuDss/Nirk/wwakrPeOvyJvhMBk9E5ZgMLG60NQ3p7Hw91vsv9fXQMpPDIQmMGfgU5n1SHDeOzpxep3tVmm5Sdx11k5rF0glkdu5eMvTOdfnWoOvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iWT+Drz8KsxKARuAufW0n5Xrz2LBbliOHFIe1h3KB/M=; b=DUsfdHracVhkYIDOZhHVpBIeGEhOEPPdYzJP0dkVYIP260/+2ubyGKHJckOOBDCa3rgNRJU8wjrpEDNC0Hd5tv5HloDx1auxaCNIRJmkVVEUYDOKRRUlMF8P5qyMBd8VdPOUdCNjSILr6YQyNYt34jSyZd5Murope9N2R/NWNzOSY3JMRs8edmAacRFX1+Yi4RYi89beSFhEHA7PNl6WE7HCT+JezJ4ZNnAyFJd5NkGp0Lrp56dkC5ZbWfJaUMVBLHDlokJriRnbLqURc0ZpLAoa9xSyDvsGDX3Gdnzg2K8fHXTrI9G9kRVteT/b6IHLFtvco674Jk/oogkl9N8nxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iWT+Drz8KsxKARuAufW0n5Xrz2LBbliOHFIe1h3KB/M=; b=i/5KvoLrmWdOMb9HUOPZlrymou9Y3+mogzGjUY6LtNobvGiqSNnt5T74IV5Ii+P1iqVVmYOCuYShqrpw3C1N39lV0Mw9bmdG8MDrO2gywMEsgooYnHaH8sk0Gc2mAw08cX5fDTEIDSc1+yd1vkbz8VMbe37vLpJoYEi5PLiZWtY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:32 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:32 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 01/11] block-backend: blk_root(): drop const specifier on return type Date: Sat, 26 Feb 2022 00:42:58 +0100 Message-Id: <20220225234308.1754763-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a89e651-0450-4642-9b4a-08d9f8b8a135 X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MBkYNhbuA9Jm7R/ko7gOh9JGFeY1mEy53Zlv8YHU9DA7pZkrHMVZku7PsQDR2UdHtfTLNimbBv8kmF/JbHfhazzsJf437eHaU4JJJq5W9jU1kuDVwbezwvE54tbZXoCKNo7iISZ+eChBuyyKfekztHfeLps/xmwFs9/fbDrYND4brk1nf2WeNRBhaPFyTu4OZ71CBn98B19P23Um7nvWz4AEx8/+xGJR8DvqyBAfPwgZ92d+vInK5FjkxR/c3RFQj5rdLSguyhx/yddeHPBHbx3QjkrmqFzVtSseDepvJQ2bXQq/F8MgVlZm92JmuBo5zwPkDPkvJ9yelV4r/20AYZHnyVUFV2OLos7hFcrdyPaZyrhCrajxytpgL/g88T1BF1yKWnFrrAxnkY/EalScIkr5SQ8Nbe9d+XJHaLXK+g/Q/f4VEjzyRMsluyXS9VBxlFoWrSrr5EafuDdvpC9UTogU7spSPkXpzWQYV33SjiUJMSE8H08fZgBX9QEMMOxfrgxtX1gxqweI4x3MSJXNme7CzwxAyg9ptT1AK32c4WYj3lYzwESLaibMN1de7lvAracxOeynCigojq6G3HozvED4pa3AZ5xNv9IJ0INRGMNsk19uNgjqq2YDzizk0qW0qaRDjqktAI9W3I8ii5yuP1RWy05OcU/fpocoea+F0PIkI6/ekLIjr+Tj3fBy3Sx/4fpWcfGuJ5PbRpVZfpGrSA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SN6d6M4A5dbJLqSfF4I8gs6ZqW0LRes8yO/Hzva0nzu4WfQBFicYdmJfP1JbtPahyjO46Dy7+ZFF7B+1g6ZXhqc6CcZF7OMrp5uVK8NOqwwvSEIQePIi6nZsIBgxvWMD0cLk6AwYknVJ2HEXQooMIIeOXLR1B8MH/P0fsVKNcKOR1nLBOjc/HdEQWqEqBxeza7AbIhNOKvTouyYkSF2WZt4zSPQFEOedyQLOEJVWIblRGa68+H1siTygOYYo2GUguQ+bJebLuCwP5Sr4vZAIWguKKagfzJ33v/xzeWWoHRC0OlbzABlmTJQHCZPk2lFlsG80FE0IoAV3nL8cLIs2DB3IcKcbCwG3zj0HjdzrBdhCOGT/05F96Pr9otT2FPZqz79YaN+Jr37ogSCr3dvnsknopwW5khK2tcb50BPYQt9hoHDq/aagGjEdQFlhXKCYZAengQUWfFwdzhGqWBOfNOAaGsykuiAByC+2LJ5aa0JISuknG4RQjXs3pb1cdXmNb+XlFg/sCWtw2yo6YcJQxXAupRkgljRqUL7NkgiMu/GwdH0oJqOTUnRBDUnmDauyaxXWxmF/zCXwofYKXc51s7C1nzQmD3GpvYFGii7paHwgDH+AKl+adnNRXEioF0TpgaosdHj2ZaXK1ND0+4VlM6/QwikltQ4jk+HXd3owESiv2EyOFkdjS+l2b9s4kNM7Gzsymjmu+IODuxxwGeX9cuc5F2tdbAHLB3zHFXz0KINKpRDhvpJsUJCLYXc78SMBkR5owWAyHwERk4Nf+zaFyY/FStsVUF+8sC7RKO8I9EPEaPLvfJtslL6YbWk5ZXKi/zi8JynFYEZuraLJP58QalOLe1mham3lho0/WJmdnsGbJKzPvCu2QL1NiIQuk65Vy5Ci4i1sP6xLx/2mZAir4pvb5h9Atcb95jAFXmBwZdwOqEKnUksk+cenfnMpUSnmuW7vKeIDbvNVKdd1q6JupxnI+FAWChmPl98DP//IxUDXPJwWt4bHPIJ16b6XlndzaCveW2ZPSim1nU1XPqyNEaOsDrLqZVP8+V3aJDeLcl1o6yKUjQILsbG56kuriTWEcSJL2uODwg+x6oC6cRt0zZFvh1RnDlYogaK794nUD0gHzSy7MPP/cXy65Ay9lMOCjeUQxFFu8JH27d6B5WgSHMxf42OEa+NCvrS/BQ26t1zTnedz50NZXsr4Ha5l1MD0jrbbZBP7SJujWzAyFCWxtjT3+15f+LkPJYS+g0cynaMIf+jEwNBaS7xaJAzyakJt9GFg13AUdtK2pkhXuf3ga0G59mVOcvA+S2+ekmRwPzYE+N/P2rIQfDF9KhPmKbAgZKPVGa590gBu008XSMqkD82t+2LIhzGYddGZ+FNFJXFRgHjR+Ir8uJv/avenWQyWVYhTvor5txL0vX3e9Oz3sVaWPBzXY4XXov630Y+ikuMQLLAfHsMlrGvRH21B4WIZOvXQO43pgtdQxs2KT01aktpIIch9mGP9TnYiJEeaJoGcufPBitOjknH95JOoHVBiQ1wSYoExIW1dmczjYIU5oNHYAuSeeqFi7n98t20s+78XjAk5SlL5C4dR2vTvE4uJPB7dPoSv62VgAuC+0C53WjFxSd4I3yirVwaint4oyedzhtsmXz1UmPibKIjzWw2pRXuiO2n8bsVZ3XMocLFPRkBZBN4P1xyqccAUHZJo1PQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a89e651-0450-4642-9b4a-08d9f8b8a135 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:32.3057 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UshlzCkRCpB/HZpb8dOszO6ktjQc3u23aj8jvxeQljUDZD6DsTAnmIIpxFs5STxCUR6ozpEeq5qNxNClWCGZK0xFaf++qkWz0pMo7Sqhw9M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe0e::72e (failed) Received-SPF: pass client-ip=2a01:111:f400:fe0e::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We'll need get non-const child pointer for graph modifications in further commits. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/sysemu/block-backend.h | 2 +- block/block-backend.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index e5e1524f06..904d70f49c 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -277,7 +277,7 @@ int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in, int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags); -const BdrvChild *blk_root(BlockBackend *blk); +BdrvChild *blk_root(BlockBackend *blk); int blk_make_empty(BlockBackend *blk, Error **errp); diff --git a/block/block-backend.c b/block/block-backend.c index 4ff6b4d785..97913acfcd 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2464,7 +2464,7 @@ int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in, bytes, read_flags, write_flags); } -const BdrvChild *blk_root(BlockBackend *blk) +BdrvChild *blk_root(BlockBackend *blk) { return blk->root; } From patchwork Fri Feb 25 23:42:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96EE1C433F5 for ; Fri, 25 Feb 2022 23:50:08 +0000 (UTC) Received: from localhost ([::1]:36716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkLf-0006uG-Of for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 18:50:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFR-0006gP-RO; Fri, 25 Feb 2022 18:43:41 -0500 Received: from [2a01:111:f400:fe0e::72e] (port=3086 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFQ-0005gS-9E; Fri, 25 Feb 2022 18:43:41 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T+HBAoh+T9tyn39MP6G3JtC6vOwok2GCXU7Zeps5n+e8p99ziLgGbLrnmEZYNbeQbGTsHUv4MG+q9i5/h7UAp03rmslo3A5LYMUHZQug4ED8bugTqF3xGtxkWw7bK9vdGZqpf6+QtclWrBuC08IqLbZytm3zNFdULAO3UVb+Yp1a2DKqhj0CtHe2BUi17lURiDDNBcU6tQOI0HvtAB3v3fvXhUE4/zmik1k9TkMaOifOa37Gj3v/clWcX9OVK9e6TfSZ9y5EMfRJ/cEDSpww4QA8joZ0wy8UrgoylNDsKFryOojF7jNHyPShgJhnMAOHjFWLqCgJxWJQ+jnt7HAnkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cLB5Dv/1GYn5I+CAd03lR75J1viOHLrpmujXJiyH7dc=; b=cED2Ojc8vmjsJIPgKf5E1wxOHjXZUhQzQD7ZNwfoDzcUqWJKBVP3/XRlyFa+d2GElqmf3savemzZKO18nAaP9xxTU/i0qftmGGH9UFz9N7aXmVLFypRpE9sClHjWQkJvxL8t64XYnt3gJqCvtH7n6VkvlInI/7BGekLm1mnVcbHigRCNm4MiYkUvoS4MEY2IuahwGGH4e1lCNCx7hypJvdi7jNCALaK6gN2rrU9+OqI81EFnC5LXNxf6vyp4wGjRZHwctFj4CP7U90DVNssDLrJUvwe3JOHWkHIu6EF9HbndaoXQ7SzsD7XYiXmU4ct6NOb5vJp/1k3M5XlEXQFJNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cLB5Dv/1GYn5I+CAd03lR75J1viOHLrpmujXJiyH7dc=; b=KuDb756m4oakU8SGsKD6FeBfAB+DJb7hkEasC/Gz7gUbOFFeyU/z1XRzsHhyBsH18vZ8xOUHOh2QmnQ9ZzRNrrUDiUyDWT7IlfKMHowPyBGAf3fNqOIXb2vcMpTn7Z6g1e1wGSfbZEdMqAjaXWU1VPC1q7ynSJBJc8R57FYZ/vc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:36 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:36 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 02/11] block/export: add blk_by_export_id() Date: Sat, 26 Feb 2022 00:42:59 +0100 Message-Id: <20220225234308.1754763-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e52b55b-35da-4e66-68ff-08d9f8b8a3b7 X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vRLOrqaj9a3N7pkr5azKWHmH2UhOYo4oTQDK1dsjWYkJbei5ybY2IENYTl6hcVjl61kFFgpsNgtS1EsO/YOvI8HfeI0OK1iIcvvQv9cMWEsthKx/j1txaNMJRsqop07BoxIROT8V+ji+35JM+XaM4KNWTngnZ3hrtVWVfoX7HqELsGVX3GcFPV0BbWVIZVvkZ8d42A3zjsguhaHpSfer2vrO4jlRdFOs+Ttpfhj4vyPL6TdacFzcOkIDZXoKeGqFDBvmzsVeqIeZznwU3yObodE6JPfvD3qAf6x2jDmfEeG/Q/BibZS0DrpoHQdwRayKIzISZk708h3KgrYIUnj79PsieraRF9yiZuoI6zdU6KD5NSr9GemfylLdk4vhSXbBZlDPMhprVmGPwdtIu4l4+f19K+agzf7cCAfG9aWAw9KWy3wkWrwhct5iK3pVyfQFN6O650+oMYo4HRGXLsl12FFr1Y71x9HhmjpDPBp7v8jNH0/EnlZqfzuvBUtDHHIp3AgmoJI/sTNOc7YbzZoV3TnY/ClA7xPTETD8jwpRgr6syX0MhbnnwBErmUZmCrTxts9x0z3Ii1lQOmcWG0mK9XYV4KEL+f9yvYUPyJ6yKA10llnK78v7Xww0eRNrbmIXj1iIHtbZ+ZlPLs+UYe1fuWzNqxVU0ZzxIaw1FTvGq4eDaTrLL2J/G6Yx1Xnllz1JLbL9GtSWxtMcGUrNKGrdNA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kcCOybkBlnB8MTksgmPdZH4gDC80DEtZKNMmOquIWg1eerBv6p89PkPUEeHzbV8FlT8+n1aTq0nbclU8Y0Qq3BI6wMkUqoSb2NpFwkgD9fF+MmsuWmJSjsKSedSLAmZYDMjD2LZIb585ytg+z+VIayJihEntEuNAYolwCIQRS0vljfjPEP4zrJlG3LjbRK5WdScxLtfaMwtPwxCGN1xtlOAOIbPT0/AivJfXbjdYYH18vfAD5mqaTIVEMHWx+E/rzTdn9k/jwy94bfXpaKbJyGxPPpt5HNmCx1vS27Zl3gHIKv9eA6Jx5sSYQlb6XeXQ3HFuDwF4ePAVsKcl/VtEdDnycARmI1Wdr0wXPRgXVoi+vC3YjK1mqMVVKzpHSiexGAup9oqrT9pydd9gibVVVLwNLt6e1GEU6e/JWaUiA6ZszVa7ZuNQE7Mh3cLVOZtwmJTMUQvkPgq0p20ZJU+WwN/9Y2mAJxZTRwNgJ8Y8AH1EJ36LnAfUUpN0KA5z6pT543D2JecisDXCeEZ9vl3R28vAJEjLVl7cE+c0Wq+I8Ec/aLSVyZL2ahqjatm88/tHW0DOClp+MkRHnFl9Ru5XZnJiLKQL0zsPe0C3GCO8XShVt7EtJqJJksedIn0fktsfvGb9mxwFCB3IlcewVj3u2XiYqc6T4VCtpp9m6raDFej/FR0hm3feo8y79sjqBp7EzHfv3HJ162A28rVzdJrZjbCPGCO+DrizGfOr3e592QEsIknhgPOeKRX8gopOd9seyb9szvcpMz/MkcOoLtJZSZFMVuQg0ISLnyIvXJu0JSddtYMqoXgc60cogKbzzkd0IzWCzb+SS+R1N8VPWfAru5nXJMurwJL0QkU2qDJ+dbeHWl5iHFpD9Cph0L3AgrmSWHbkq2lddEDbWLAG6Xh9TrnzGflMNUjEbBRhKaUrdwojECVCLc4RsoMhaWnBSYA49i5fC9WmCf8FCbIgxsAfXkPrlByzrvphrJE5otkfDSE+zrMa/SJnDPYE3uW7f9aQvgI9DdjdLMVU/I8iB2SJd/hIutxZ1P/1dOtl2N5Ha3Ezdcq47wV9eLWhVIkEFUz3fTo+PPO6gwvQ+VWFPD9+ad/uwUlhP76k3+16FHme9tkW/yCgMeAaugBNS+l9bLeRLVB2CW9U+xd2ACkNL9BQup1F/1PXw4EJAf9F1ZIp1Ky0SHEuLmjbivPUlo5rXeNlYcPJcbeNFnoHUGakbi6462+kHRRxU6aeBdzww+wMVRPW4MFpbJbTUs//Z+x4zGFFW0W36rstvDOB+wnHt45SxkaQcwLt73zefRwFTK3bd4rAs14188OtTgbXA8aJj6ycKm7kO2G3bJnHyztxpukph0dCMuyi8nmrvjzg+XjJDHuztbJ11uL+8cDjDeSuXnHyMjOlih7XbyLXm0nWn1bOz4fXSzaqkCNTkkEn5nU7wJ6Ely94v0PRXIpdxDI0rwBrKrV7Fs4Zk2K3/ik+6RkcAuxH9QsQsS3BrGIh0cdcDdvRSxN0UGdmfHuWEJChCxIDm6hZXsd+GHzUcizt7R9sC8bIbAmbJiSyK2N+mRLlKWv+0PsVvMxtQpjEWmQUjoyP6SgVuP0JzJFi0Qq4xJ9fpYZEQu/U542Iz3XSp7M4U56EIH0JbSuY9Un30yzt/P8Yk+J0N6PtHPUPJLyy4dH70ND2md/4JsML+dtsxMcGcbI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e52b55b-35da-4e66-68ff-08d9f8b8a3b7 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:35.9168 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HZ4SnmU+7uw0W5Jwt0jw1OheRSed6YACrbC63so5zWN+ZszsLBifNr9dVGFry7QPhB20saIGwe6Db/9GuYKHcotVNndPm/1GYS3AIcYemGs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe0e::72e (failed) Received-SPF: pass client-ip=2a01:111:f400:fe0e::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/sysemu/block-backend.h | 1 + block/export/export.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 904d70f49c..250c7465a5 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -124,6 +124,7 @@ DeviceState *blk_get_attached_dev(BlockBackend *blk); char *blk_get_attached_dev_id(BlockBackend *blk); BlockBackend *blk_by_dev(void *dev); BlockBackend *blk_by_qdev_id(const char *id, Error **errp); +BlockBackend *blk_by_export_id(const char *id, Error **errp); void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaque); int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset, int64_t bytes, QEMUIOVector *qiov, diff --git a/block/export/export.c b/block/export/export.c index 6d3b9964c8..613b5bc1d5 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -362,3 +362,21 @@ BlockExportInfoList *qmp_query_block_exports(Error **errp) return head; } + +BlockBackend *blk_by_export_id(const char *id, Error **errp) +{ + BlockExport *exp; + + exp = blk_exp_find(id); + if (exp == NULL) { + error_setg(errp, "Export '%s' not found", id); + return NULL; + } + + if (!exp->blk) { + error_setg(errp, "Export '%s' is empty", id); + return NULL; + } + + return exp->blk; +} From patchwork Fri Feb 25 23:43:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761090 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F1B7C433F5 for ; Fri, 25 Feb 2022 23:46:29 +0000 (UTC) Received: from localhost ([::1]:56462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkI6-00014j-C3 for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 18:46:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFU-0006hi-Aq; Fri, 25 Feb 2022 18:43:45 -0500 Received: from [2a01:111:f400:fe0e::72e] (port=3086 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFS-0005gS-Dv; Fri, 25 Feb 2022 18:43:44 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gixuE5UjgXTLddCa3ppIhtRDIz5CfeOwslGByLnO9C9+j/rlqBhy0H47fTz0iwIXt6eZts/4/CxUUef6nH2NXPXVrZtP/aDHZRiDRWWSWmZezmkxye4N470dyg3K1J07hfnQzUFZ9LHbJFDO3dFa8geuG017gDJqBT1T88Uvj6qmc7sGF/dwq6JgtZeM+QEkrEpzBHSINweaJYLrLT8dmvPJEPM5cOI2JteC3IaRTVoK71QqVUPzpqJoa8DYGkfddurMP3sAh7vbFVEt96aqsnTUXEnRs6LQUfah8rWpnCJkdS6ha5+nO1TPnPAx7CbNVG+9jCVAxHc3Ep7eH9khxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/2PicV2bizgw98dzDmL/lwhMa04dpnVpqMr8kAJZsOY=; b=eaVl0x4wUv0nMgW0DvzK2JobQMks1dDlrq6Gfu7rMEehsMGALUftiwHPd5cx3nUENGBGdCnDK5E0U28XlA1zOLo1nrZzNGeyea7vSKVgWcjrewFvlfdsBO4a8Ab89O61D9QZnInbDUNQyGCGfKADIUhiuM11eb2MAI5xIT5t+K+01YDzC35ja//qDUAkB51z19eepLVF71oMyDYqavob9tJwG0PsuO/BPKFEcm5qjlS1SRaBHAC+oSnjyJZ5fRGbwdooNnKtNb2M94jj6mR0unSSQZdCTBrPPnCcibhP2zVo04WqZL1nrh1rI4u4HvCJOaoc1QdjqVc/HXHj/x/vhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/2PicV2bizgw98dzDmL/lwhMa04dpnVpqMr8kAJZsOY=; b=ZGlu5gM8lHUf2RsWjyouKasLAXBePQH2bPhKO8xyuzh7WJXEYp4NPeUD/1oDZApYSUAhEJ1oCi/lupiyZ0WP/HH88egXTjEHWAH9/RRTfjRSb8iTugdBDUILwrsGOPS0OVGKI0phwaPhlC+Cx/k2vq37muPXDiKg7SitH4FXm0w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:37 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:37 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 03/11] block: make bdrv_find_child() function public Date: Sat, 26 Feb 2022 00:43:00 +0100 Message-Id: <20220225234308.1754763-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f4f47ab1-c2b1-4fdb-c878-08d9f8b8a4a5 X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vH8+llE34uG+DW/1kDUXd8oP7a8jB+WeA6d8WL5PKIQJzKzVvSbzLJtcM/71GYD7Vk9Cofa114JX3+p+aOSsbr2HliAFB/tXdz0Sgao7ml7GCUfVNFlPtEdUlDJhr4NeJ8mhLlhbmoZj9OKuPDEE26LT1qwLtfU5tvb5eENXtGg0ahsY7IEWkBoW5WevbbYQygxMbJB0Vy7tkif7R5yVdw4Vn/dPT4ppsKDuvbQ5LkaEQeahEihPHaUIPjzRP+1Zz4RCUZr3i/wYJqV0dyiP0ihePpUBXohjjEYNLzXQkzfNMcIE1DMuGNn3HkmY+cDO91261PbxxLzd+t+iLeHUJHJdKS9Fv7tPowo3B2j1/ckKMFGOCsf3adLBsBDZbs7ba7tRuZfxn/NIOVNaDygFopUHAwz1ioVWMGn1Sn+AvDdkYKMf2GcUl7vrdJhqVygXDlaiQ5wIJejiUipZ5tV5C3TvxmUx4nb4143Ya22ulMDKF4aFdAx4/W3S3fxmsiaOB1F2Bg6IVWPma+CwPi+fj0+xlTOCbMa3gCw2kG4s4mU8HFLHqX3IYuGg4GrAe+qWtNkXyEbUmY+xXLb07uAnBg0Nn30W/G/ppXsST1B6XBzoGwl8mFlEkSfbbq268Nb748PY7Y/QyPuZkppwuX2zPG6HAgHiq4eQWorKA2xW+11aQj18O/61qG9HwCWM8b3ucFkZYxOX2wXYYWhN8XzC4Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W1TaHpwM0MDw6mG6SsuqLDlnPd0rNWtHRw9FZno5p2rycsiwtXuBzNx6zfSaojA0gbKq/b8NmfjvUgrifsvwj7gR2dFOq/H5ngs6IcQxWbsSlP0WYe7pThvfZb6EnDTGSAFxT0RELMSjWrzbTkYY0nI/cckoP+8/H7IEzAHrxE3q8F5k2Tdxy3epENHpnqr/pYB5ibItIN8GgzfYJuBHl0veUfbSrE30fGwUKth9zppF5lnmPwinlex9Gn85zC7Tv7TZk9d+VJjyU92AoqPLomSBX3EqhjO9pjxqqbDpJUG9MnJOcEinBB2TbySS9Z9wd8J6VbkCBKANTG2yIKdQcE31J3qUj+4UQmzSzjPYJ5SEv7u1NYaiyEySP6DKtthdwWXREYBq0UQHovSZJ+ZIFsn0dAayrvStsuagQb7jnQ4rFCg0Ty9cP4PKnOZsjALe+L7viTETpnbOVZWH4Xi9aXsu4EUTnl6J5Bk4Wcmsbs7+Co6+Rx0NzmXdrelcr5Xqs0Lhjk9sJldwSlbpET/OC8VVT6iN2+TZZDenN5/5T5qsr6zAz8D/we2HDgy2jUf3MJ7+48stdOkfrIBEELrSjexAJPH2f4HO5sM5rtVu25sDxI/MZyj9uvCW7+7BQ3H9OWSVEUWfBEu411OnVqflZuDhlnj2rGRTIBJscSsML90q/FX2E5yxW0pPnJFx3SpWCuSbaIiinPIZc+IhK2fQiZlPUu+Ty5Za2tM4RhiZRq9C+N5feTTgjwbpC1RvERgwMQrJoZyt8aUD88DSuJGFWzl15x3OIDbueLfY1qph2K/8YNTjo7ORfczVX+8SeK5/NoKvMY4LWOvmx5h1PKlDK9hYjoFkI4QTviTLfKSyJwbmkZfwYuvRyNz0UQbtQcH65kQesNIQXrdjX9gr5mxB35B7Jy7Qqt3AMOtCUstv0Z6GgSluqQH+bDzubhTx6wmdHhkVDWbOlxRS3V1X0A0o5RS87d25elYm6M3aW7u4P+CJaHcZxW53Ym+SS6/Z8RA3T1h+aiYCh9Cc7/CXkzY7FRHpeLpek8WAxeOnJZB1FcM1xoIKN+Gw5mH0+nivj0pGieG+/HjAz8TV4eqrVSA0xwxLDvA3BohwUvHtivfh219NtlXgCSlTgInRy6emWDdlMjrFxlkoZiffIqSlF+/pQiZs10hkHipeO9aaKO/FnHeWE/7XVMSIRWexXZueqprP8PI/pu0JVE9XCa+1NFR7SMUB3sy84yeKUJiDAZ6A6YFg5o1VzNeFOpQpttDAuKUlw95F5bZiiBT4dq70KAgpSQfQwY/3jmvj8s7tf0lUbJ3kdbG5aPcX3GgAy5MtvXq8N8PM3szlWf2beq5QaDvEwpuP1ABzgTZUwgNMLoTUlp2tIvF5alEYUfluzFV+2AUaSs9q6Y3dE+Ed3sR0MA2IZOl5d3VuHVgfztl052sYcjQzw29FPGLZXjbocIUKe80/iYHNxY8pOmdSHyIN8dRRKtYy3SwJezRaCk9UbzWONrGE+2QF6ef7ZZBYMTpw2ptieECR1+8B1Wvbo7TCTtxSEi96eKW1TqKfzG2EzsqHgDR8ZA2FrMgUCvmpxh15ipRHbkUoE0/JHL9He48fwW/u6wBcceSHUTI2Pns1YYStDKzG8RG1CtLQKvARMpWD0j75Z1cNcUbt5AZ9g0TlxA1haz0nAEtKU09yhcC86XSBz08= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4f47ab1-c2b1-4fdb-c878-08d9f8b8a4a5 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:37.0884 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mVqb0fzLqsNPQAb3nWABFmG9NGbelaAGJ94E9eiYb1c0CPGNPHQvjEb4D0VAB5fJH3jwSNkEDFPfuON7ucjIkVI4FTC2U7NQ7mgxukicz3Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe0e::72e (failed) Received-SPF: pass client-ip=2a01:111:f400:fe0e::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" To be reused soon. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block_int.h | 1 + block.c | 13 +++++++++++++ blockdev.c | 14 -------------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 27008cfb22..e44348e851 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1430,6 +1430,7 @@ BdrvDirtyBitmap *block_dirty_bitmap_remove(const char *node, const char *name, BlockDriverState **bitmap_bs, Error **errp); +BdrvChild *bdrv_find_child(BlockDriverState *parent_bs, const char *child_name); BdrvChild *bdrv_cow_child(BlockDriverState *bs); BdrvChild *bdrv_filter_child(BlockDriverState *bs); BdrvChild *bdrv_filter_or_cow_child(BlockDriverState *bs); diff --git a/block.c b/block.c index b54d59d1fa..601fee163b 100644 --- a/block.c +++ b/block.c @@ -7728,6 +7728,19 @@ int bdrv_make_empty(BdrvChild *c, Error **errp) return 0; } +BdrvChild *bdrv_find_child(BlockDriverState *parent_bs, const char *child_name) +{ + BdrvChild *child; + + QLIST_FOREACH(child, &parent_bs->children, next) { + if (strcmp(child->name, child_name) == 0) { + return child; + } + } + + return NULL; +} + /* * Return the child that @bs acts as an overlay for, and from which data may be * copied in COW or COR operations. Usually this is the backing file. diff --git a/blockdev.c b/blockdev.c index eb9ad9cb89..d20963be2a 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3661,20 +3661,6 @@ out: aio_context_release(aio_context); } -static BdrvChild *bdrv_find_child(BlockDriverState *parent_bs, - const char *child_name) -{ - BdrvChild *child; - - QLIST_FOREACH(child, &parent_bs->children, next) { - if (strcmp(child->name, child_name) == 0) { - return child; - } - } - - return NULL; -} - void qmp_x_blockdev_change(const char *parent, bool has_child, const char *child, bool has_node, const char *node, Error **errp) From patchwork Fri Feb 25 23:43:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8BB66C433F5 for ; Fri, 25 Feb 2022 23:50:05 +0000 (UTC) Received: from localhost ([::1]:36666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkLc-0006s5-FC for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 18:50:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFW-0006jR-Il; Fri, 25 Feb 2022 18:43:46 -0500 Received: from [2a01:111:f400:fe0e::72e] (port=3086 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFU-0005gS-VE; Fri, 25 Feb 2022 18:43:46 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c6Yu8cGK5MILS7547baHHmOHgStdFqFoucWefDJiFnJa/0k2rBitwtDX6qxLvuunOLxln+AQ3razSM0Of+lbuOdBqJ4C3ICDY18YKwzuEEfmusC27RcMrIsITiA5vQai0BGDb2HS700Ur6USmCFYn3DNeUFXRFdhjIVbtEY3gyHgz03exkR0bPacRnQZ6RDlI8AOGQJW9zr3zLSm/WYiNKzoXElbfDlgsMb2yzsvouR4eFuvOKRa0VymLbRmbydq0zq07Xq7iyftQGpG8rO153NG7OQjQhVPioLteAvWiubVJFqLfq3bH8YGuCuOlYWf2L1Ma9dpeByu8l/PwxRcxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VA7gD3vqPfqMhcfLCNGZ3OMC94fZQXbyiFV197DLGnw=; b=oP7BeYiGTXMZ+QANknY18GKRTN180BkHtgd78yZhyjEHO4XrKK27dNNnuM8Q1B7C/fIc/vh03iGY6r1iRxmk3elKpIp8CEgmSXpn47CYO+nh2Q+gUd2DhGC3t7k+YZOjRo1nBrSsLW5OqAAlxgtgqxcN8RoQk1VyrBgUr0ysJsZlTnjQeGuLVmwbuKs8UI4MR8B799MuYp9bFD0HrDsZFUqK0BnJKowzGPlsl4txrYA8+Ax8ShG2Ba0us9E5sGF081R1pWxdx1MGWoTKKhd00/aENohwIR6Nf6e1Z6khwrVODAHAMv0abW02rG9dv70ZwGRx8rMhpzm1/89AP+onkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VA7gD3vqPfqMhcfLCNGZ3OMC94fZQXbyiFV197DLGnw=; b=H8LJym60ISlOITq3p5j5ozMeZVS9+190IUAE4h8m3Vo0+nfH+nmygsQyYRNm/4pLlYrF71eRM6jvEZeOTC7+YP46RgVdzGAFV8otxjaWNZej4SoScPq2vOt1No0vMaOR3HSD/6vYDANpK8ZYrkeUSWqS/ylIOountmZgXMFVOqs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:38 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:38 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 04/11] block: bdrv_replace_child_bs(): move to external transaction Date: Sat, 26 Feb 2022 00:43:01 +0100 Message-Id: <20220225234308.1754763-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f1c04a6f-ccc9-49f4-9af3-08d9f8b8a54a X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cv/Jfqocji2yX5vSUAmS/OI+mU/wXeHc3bvhBUJLrbaK81GxxflxLT+03fvXh+N3WcQxUnIU4FThNjdM8fb+8zoyxJncvIUhpYjMwQqUZmlQWYI76plPAgtVa4ZSP43vUcC13C1Z9fl+9oAOuetLrDCpnbWPE9pGdBLCJMeIIjEFOzALxlhOD+RKVYXELLMBbClJt17Jw7R22xtDEytD/bTpjnuWGu9XH88U6kpJCwc4KOIIxS/6FgnXMBZ6AM5MHZvgLEh4wS8/u5L3trVQGfmsQI39Z7rmhvYua04tKgJaHtseLnW7r64ufu+7J/n+fCVFhAsPmsiPXdeMy9+l8xEZY4735bazA2MHZi7l/vAgtt3seseVZ1a5KlWtuzzrA66d1gLtTpdc3yY7ycCI9m37874Xt3Q2zrbf6gz1R+p/JAeMNSk8GUVCSlTVeWEnwxNcziyBK1MkO/OVj82B+ijKjUKCEMRHnUaXTzh9Zt3PB3UMYGKhtdYab4aOkyvfMKb9BAjp1txyET1ZG5ddcOLGnMF2i6ZTYy5WPyk6l1UYmRZ5CAx4dHEJnDdf8Y3f02FS4MAwt/+MHxaRuUnEprmXqMnkcSbyu270BqGesDgTVdo7VKEP6fi7MtRF/Z84TCX+v85h3c0+Krthm3qcB9djyBoMcPmhOJeUll4n+plBAxJnG1LbFYt4tmwN2ZagdCst1B7b1UvZ0vNtZ1TxRA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0y2hBbaoe16Hm5oe6Iv2H1dGLDPzekTjyhxbSwhqC8FMKOuX6kUzsg377atUuyUUFJZ0C+IaRQTo4nXFhDDGmkYnxMXU1W2TuhpQF3QnwNcnf+8BnJ8TZelL7O7+3MAw9GFM/g7oaq4hshlVgRrgHYdLB29CK7JsmQagfvrLiWI0DT7mk7GbSvsiRR1OgFLcw59wKO+Eb2T7ZF3FRBE1777xelCnuwsY5hh+v/sWlDCFc2zjKPjkLtYrdXci86Mvd0CvPusPf/bpuC9msO+dnfBQyLsNb7PLy4qJpYYxeh3YAbbVpkeAQuaV/u17wCtaEvKzb7F25xYntJY41XkBmR2qhKTQaivh0TUllL7dCs07izjz5TiQIvKha3Cg5FXFftoGOwAPBNXorpHQoFWTzB3RGbz1H22/j2B5TK0ZpOZTt/HbC7rGvxOnI9EXP+BcJwdyMlzhz7Dk10POZp2jozYlsuHVT/zicl+/35/xPDNSAaA2orUMYkgjtCBT/06vjj+WBb50jj72rLP+34fhMDFwsFJcYh9rgbVpZiIJkUVgaI75hS7Y9fnAIZrV7omL7KWsWyqnngoeMsIQAHK0cOIro1ffrx33fKipNSEQEhyJhRQCv08TN70rEnSoSw2DWoDrKY/+OhvGjmorZ6JZuw0Y9P8vCqbDBQqXgk2wTiA83huUBh7ERCpYV5TnOZvDcJCSkmRNTrdwbrYbyd6AmCC0PCujk3gJrBwaoM4PauIdjqpj99JzRz4olmnvb8P0m6fhUf2Pi2rfYZ7PamXeVCKv0Jzs3ztilnI7hjevLJf/Y6Fxv5uol+shBwDoUotd83QtmF3f9Truq3IJrGrBAaram3jj2BkmoXa3WfnlY2Z8RRpzaOjfi4mabVn64rtP2BBc5wApE2bM491egS5bSfY2KvkWqWwbVXsLcvE4EUB5Tmez2VNKgrU4OBOLrIT5b9Vk1eEd7Qj3VHCN5OHuceNk0ES+slmMZUl2yp+uhlLTzXKbM+BoHDqwWCMDk2MFNQPQ0QY3VmtRYz7mH/op6zBfEgyJQ1Oo5j3t3+T9mAgiQctSaUqNVwteJJbYvRxWGoyqoUSafWa/7/45U55FjatCzPN167l4srbJCeayR0YQO/4mdggmypQXddbGwTy4ipMFRSbP+AnQeTQD7hCLf+YvRiU4YNll7tZJRwowV/AUFiu1b4/1c7E2q4sUzZdX4sMoXYKORrqAwjYCKcJ/OxwW6Oio3IRXGn5L2gzxYW5e/7k/cdsnfBqJ/O/rJaT6c3S73jn6tLS3ZS6r2FLQdfeX7O0mHVVbAbDVfTn7JpnM2hGsL1srj0FjE+9WOXQWmjVtcqaF/r5tF2osYUxrcN0urEVUja7+T4dNjB7LDBa++0LsY5a89QPBY/UqnHlo6bIAXm0n9ZNCGQxd13Baem/+TPhjDXtgYLSwTnnbqS9RfQIN8/3cgP50/iJWph6B/w3k5YUrpwPap5llOLVrhSAfiUCZEcJLWXC5ttwDXF4dESvTOYLriWHlIEDLfJilvjIGUZ6la1YVqFEtkM/41+OboJBW6bOJ2YPtfIs4qScSBmQigutn+hpM7/r5v5GompjGJrYes2D3tQX4dCa+5bqP9nU4UKlb4uCJIvzfKJnl3cMq+GZbw9AuQQJLueitKc1lU+ELbjtR1uByXBSjLkkvq3U2brVgdJrrcBE9+js= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1c04a6f-ccc9-49f4-9af3-08d9f8b8a54a X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:38.1217 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2Hunq56/z7yUP/ED7uEyxQ/fZJTIqt+pwK59DjzAkpmRiL2jlyCdDCnefmfLHgNiRf4Up9OQsFEeX+EQeMfMzBlVs15JQ0+BN/y0lXMhHys= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe0e::72e (failed) Received-SPF: pass client-ip=2a01:111:f400:fe0e::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" We'll need this functionality as part of external transaction, so make the whole function to be transaction action. For this we need to introduce a transaction action helper: bdrv_drained(), which calls bdrv_drained_begin() and postpone bdrv_drained_end() to .clean() phase. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/block.h | 2 +- block.c | 42 +++++++++++++++++++++++++++--------------- block/block-backend.c | 8 +++++++- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/include/block/block.h b/include/block/block.h index e1713ee306..1cc1f736c7 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -362,7 +362,7 @@ int bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top, int bdrv_replace_node(BlockDriverState *from, BlockDriverState *to, Error **errp); int bdrv_replace_child_bs(BdrvChild *child, BlockDriverState *new_bs, - Error **errp); + Transaction *tran, Error **errp); BlockDriverState *bdrv_insert_node(BlockDriverState *bs, QDict *node_options, int flags, Error **errp); int bdrv_drop_filter(BlockDriverState *bs, Error **errp); diff --git a/block.c b/block.c index 601fee163b..b2f55ff872 100644 --- a/block.c +++ b/block.c @@ -5204,19 +5204,39 @@ out: return ret; } +static void bdrv_drained_clean(void *opaque) +{ + BlockDriverState *bs = opaque; + + bdrv_drained_end(bs); + bdrv_unref(bs); +} + +TransactionActionDrv bdrv_drained_drv = { + .clean = bdrv_drained_clean, +}; + +/* + * Start drained section on @bs, and finish it in .clean action. + * Reference to @bs is kept, so @bs can't be removed during transaction. + */ +static void bdrv_drained(BlockDriverState *bs, Transaction *tran) +{ + bdrv_ref(bs); + bdrv_drained_begin(bs); + tran_add(tran, &bdrv_drained_drv, bs); +} + /* Not for empty child */ int bdrv_replace_child_bs(BdrvChild *child, BlockDriverState *new_bs, - Error **errp) + Transaction *tran, Error **errp) { - int ret; - Transaction *tran = tran_new(); g_autoptr(GHashTable) found = NULL; g_autoptr(GSList) refresh_list = NULL; BlockDriverState *old_bs = child->bs; - bdrv_ref(old_bs); - bdrv_drained_begin(old_bs); - bdrv_drained_begin(new_bs); + bdrv_drained(old_bs, tran); + bdrv_drained(new_bs, tran); bdrv_replace_child_tran(&child, new_bs, tran, true); /* @new_bs must have been non-NULL, so @child must not have been freed */ @@ -5226,15 +5246,7 @@ int bdrv_replace_child_bs(BdrvChild *child, BlockDriverState *new_bs, refresh_list = bdrv_topological_dfs(refresh_list, found, old_bs); refresh_list = bdrv_topological_dfs(refresh_list, found, new_bs); - ret = bdrv_list_refresh_perms(refresh_list, NULL, tran, errp); - - tran_finalize(tran, ret); - - bdrv_drained_end(old_bs); - bdrv_drained_end(new_bs); - bdrv_unref(old_bs); - - return ret; + return bdrv_list_refresh_perms(refresh_list, NULL, tran, errp); } static void bdrv_delete(BlockDriverState *bs) diff --git a/block/block-backend.c b/block/block-backend.c index 97913acfcd..dbbbc56b2c 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -892,7 +892,13 @@ int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp) */ int blk_replace_bs(BlockBackend *blk, BlockDriverState *new_bs, Error **errp) { - return bdrv_replace_child_bs(blk->root, new_bs, errp); + int ret; + Transaction *tran = tran_new(); + + ret = bdrv_replace_child_bs(blk->root, new_bs, tran, errp); + tran_finalize(tran, ret); + + return ret; } /* From patchwork Fri Feb 25 23:43:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98C33C433EF for ; Fri, 25 Feb 2022 23:50:21 +0000 (UTC) Received: from localhost ([::1]:37316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkLs-0007JB-Nq for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 18:50:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFa-0006u1-At; Fri, 25 Feb 2022 18:43:50 -0500 Received: from [2a01:111:f400:fe02::720] (port=38968 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFY-0005i5-BC; Fri, 25 Feb 2022 18:43:49 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iK519DbCmwia5sKMDMuUudLjRfkNtdwLw8JCEVWzSXdfJjhtdS/RYVS10w+2mZCw5VTojnwcgCT0igms+VEg6IZFJx9m1sFHvpevolIFsT4R4z6/EoNigT2sGNDkOrlN8OhjfzakVGW8bhkReQumpWjP7jzvircG/fwz3J7+P2PL9qY8H8UMyaTXoM+AjJrKMKXo8gbsYZTPgoGQhke2eboivdXssRqBBj+6l82kkM21xtG74rggwR3FOt7So9RiPEoZ24KYU4xaiT4JdoXwryw30RiNtuth+dU/GBXm+vMHSYQu4oFbUUQE/y9JSWfB3LI8JncZtj1UpaCvMnKb/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OCGYcxrw5WThQzdVJG6nsrIqn/8W3u6pxS50aD81kLA=; b=JogEqUnPC9+XBA2TWfyGm6fTt5sl3M+3qsyrPEkBxv31LkCrhWY7Tlp1QJiw0u6JalSE1AvIcxPx5EU7KSX7Tq9Md0ajNc1b5CUbhVEkCtlpImLmuKMKGJ74yRsysofQ0tEkrxkgeIn7TQBlIAJPfGvPMMdKKeko8tnn8SELIXzQECfj7YUg7+rpsJT2RLdzqAPK/V2QSDv1OhqwiHUdjGPg+LFYLfb9B/CVQYwgz5ZnsLyXcQqlvCd3Byo2aCqVkoot1rlKvHUj1Bp6bfn2fKSuwZlFcBN14GY4FxjoUWbPP9I+3DRma4N/MzbdaMs12B3CvP3kic2fErZFX6Vhfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OCGYcxrw5WThQzdVJG6nsrIqn/8W3u6pxS50aD81kLA=; b=RDRIRqx+OCHJrvTC10/ZABqDg3/82/4PqiW1a9uJfch/JBrPQ3n2O7HM4Vb79NY/R0H4MmqcA4o4jT8Gl75VUJlvGlsWn2hMiRzMq+Tgjw7krzyJATBtwZ0gQiBIhftXxYwJ41a2wtKgRK1whXThE6alijgBcgW1h0qJqunhjd0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:40 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:40 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 05/11] qapi: add x-blockdev-replace command Date: Sat, 26 Feb 2022 00:43:02 +0100 Message-Id: <20220225234308.1754763-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9147b8a1-faef-4e4e-15c2-08d9f8b8a5ef X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wy59rUT3EIcAqt+5WzkX9sluJgQPiPuzypp8R4gMXJjf7vDANhppYmkXOpOInXcM8U37tK0bqop5805xflIY6UtITPN2YogeOXbw8PIHbsCpaLelzKR5wVa5/THYyvYBkiZ/yaYXJj7svcxtyLCxaS5oUCwcOfieETZwM9QpoHH05Il8vLXI1AcdTuHz6tti2CAJDabQOfmvpgYDW8iM2aE5WFcR+HqrrguC2SJUFkM+bCv4hRqntStTNjwC7JKb0EXf0bz2NbnniFUFfwodABSRs9OgnUA0jZy88c6Spng89u57NYzleo8vwkvr17qX/wo3PNcMFGMzp8aO1o7kPCUu8adhQ3tI1eHM5dEBm3g6CcYPu/FyElMc1/Wp6T8sdfkGqZzspMxusGAznd+Z5rImTgjkUMbKEcgirn/7dXTZ7RcVL0uwnXFQ5fChbvirOE2FjWTTkpP5g2pBjk75wWpn4l66ZS0rpIdvWz5W4AxrQeMt3g35qWD2QAAy7PQ+FTWFzuxJFoKbmDW7dO9lJUuuJmUzCdAR77pTbGi1N5qyCKzGhHUi+OCwUNkrE3iGDMzkVHZtgh2EIyjZnZvgaJulfpdNOYyy5lQOzPDZqExCe0RYhCeWppGQoK4SMkZyPG+4gpMajetu/f7iwk0fwlR9OxdBe+FDD1536sz1UoQdGXALct9/iRh3t57Du/4zytFxvvKa4V8zCbk4ybfapA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4WRgi3XRD5e7Kz4z52q4E65sN5Ifi0tKI0PCTmdOM68Ie9Lp0SH7j8ZbpJqUBP5HNwHNixnTWtZpmEA3EHfWhIHjQOu9BUaz1Ia22Jo57hQwN4gwz0UFe107isrylz/nsQacIF/lOD2Y3ld4dZhejCVjpbMuPnTm92YSzzrbZ/AiTvG0lMVPH4YoWznFNJk8k3VXjjPZ/2+FkYk2xZbpFffE1dw1HMxzYNqTD7xX+ElYlhg/3ROgRSaZoNJy6thOgXftPEfPhfbHUjeThxtB5Y+Kzpk6bvBpNarYf9maEbJbKYazOIWowz6aY0UJT7GwzC6raGlxAoPCWQ/6grss/cwPOvjKc88gotihp9ijHwTz0JZ9ryU1n30d9SwXOjnGHEMEgqraeVrP0uAF3X0JlNisHKrXGl7wKuEnSykDWiR+SSd8FrO3342Qc5V9s9TxcQoKQEgjH0pFPOhTFq5ArfJFuymxJEsyc6o30BuI79I/46L44zWpFcAhGI4+GRJjefDftk1lLzVuWiFjmcRz4F3BGvUXK0/ncMUWYS7EvkEDbwwT4j8M/+cz1jK1Xdr83hxITrgOI4zd7BuyQiBfno99SjMTwR0kVo6XUn7OuC8kPsAtVvvYeEpXf8hYzk0U7ocVPvkXH27cjCR5ysVMaz1X7FvGrU1asaNpUNnRrdCLwCdVtSHMrwe1PvcSoy5S0zqroJRN6ViFsJYwAttxkGchCPgUV2QQiym5awxE7+SrONkYdGivBr7gfa1tUEONUejI+7G7xm0d1OM6u++13WJDPJUc8gyPlZ+3eZaVldD04USgINVLl9EiCdX9NQWUq3aWk+ykIiZaxidX/Q/e+2czaxTVLVRxSoV4TiiNBdheHmIQCGVSYtgg7sx1QN6L4A/3GBll+H+zz/jdCae2+mzLluQTAxMroDZyMZbBoe4okaESuANcMQX6pmnlEDQk7W/GWU8SNqhzBZuCoO5FwSTKj93YdxNFMJU83WqvSEeRgIcASLRQTD0E0yZAF4MOA3ptyRDNqfhPtqtl1YX2h91MuxPzYzv/K+HCCO0+60GNSBq6uIPotB7xYwHOiKCi0rLMOi7hdx3z+cwAn/ddDbIa4OdDAp5Xja75qdwB6hb2BtzyZksfvbQCs6IOB06RAod5DVP7HCXg4RQJS8fH7aP1wRy94gyLXPCrd40dsvXW4xBkNub4/Epo5gJdrNHSyHq7DllBr24pfX4zxYeGec5dVZDJwciQJNlZvaLIVV0/qZPckmCRwUVjp4nMIhwp9hEn1YlV2BbngX4x05++J3uB+kch3ln+1v6+4jTIoqNLeEeBAVViFSHJ6WwnQl2AOLgJB9Vr0ahhXEsMAiCvqWcquiTsNYpUC0/HUO6wXzGvEmFRHFWnzG9q3yGcy8thBRemCRb6xgmjnFaVJoNSfuNqCqdsYqBWh4Ddr3BUC3iBFVezH72hpxNT1U/LgDZrVkVbeayYDJ65nw2Hb69aTcYsRs/NjHZ/bicA7FcJssCocpyv6Z0H5PP+YS0/bVxNf4joX+pnteTEj/e3Y9+ZNLVNubwtixLV1S6a25SfLTUAWtgn6R3ZPStv3Vwtadw6tdRUrwDkE+3x+gb2PuM/OATYyTBhDcMf8BKffNgp2ENKYXBlUtKRWzfLyp07PstFOFReED7rNd886SRDuPiV9A== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9147b8a1-faef-4e4e-15c2-08d9f8b8a5ef X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:39.9663 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DytduTaBRl8tfr6gcfsJspzBIorwNaKQ3KEX28+KNLDX83j7F48EK9wPTt/6BVdbC3tglGOs5svxJGj2ACusPXHpC31I4hOXN4Xk4ft4/JY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe02::720 (failed) Received-SPF: pass client-ip=2a01:111:f400:fe02::720; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add a command that can replace bs in following BdrvChild structures: - qdev blk root child - block-export blk root child - any child BlockDriverState selected by child-name Signed-off-by: Vladimir Sementsov-Ogievskiy --- qapi/block-core.json | 62 ++++++++++++++++++++++++++++++++++++++++ blockdev.c | 65 ++++++++++++++++++++++++++++++++++++++++++ stubs/blk-by-qdev-id.c | 9 ++++++ stubs/meson.build | 1 + 4 files changed, 137 insertions(+) create mode 100644 stubs/blk-by-qdev-id.c diff --git a/qapi/block-core.json b/qapi/block-core.json index 9a5a3641d0..f760dc21f5 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -5574,3 +5574,65 @@ { 'command': 'blockdev-snapshot-delete-internal-sync', 'data': { 'device': 'str', '*id': 'str', '*name': 'str'}, 'returns': 'SnapshotInfo' } + +## +# @BlockParentType: +# +# Since 7.0 +## +{ 'enum': 'BlockParentType', + 'data': ['qdev', 'driver', 'export'] } + +## +# @BdrvChildRefQdev: +# +# Since 7.0 +## +{ 'struct': 'BdrvChildRefQdev', + 'data': { 'qdev-id': 'str' } } + +## +# @BdrvChildRefExport: +# +# Since 7.0 +## +{ 'struct': 'BdrvChildRefExport', + 'data': { 'export-id': 'str' } } + +## +# @BdrvChildRefDriver: +# +# Since 7.0 +## +{ 'struct': 'BdrvChildRefDriver', + 'data': { 'node-name': 'str', 'child': 'str' } } + +## +# @BlockdevReplace: +# +# Since 7.0 +## +{ 'union': 'BlockdevReplace', + 'base': { + 'parent-type': 'BlockParentType', + 'new-child': 'str' + }, + 'discriminator': 'parent-type', + 'data': { + 'qdev': 'BdrvChildRefQdev', + 'export': 'BdrvChildRefExport', + 'driver': 'BdrvChildRefDriver' + } } + +## +# @x-blockdev-replace: +# +# Replace a block-node associated with device (selected by +# @qdev-id) or with block-export (selected by @export-id) or +# any child of block-node (selected by @node-name and @child) +# with @new-child block-node. +# +# Since 7.0 +## +{ 'command': 'x-blockdev-replace', 'boxed': true, + 'data': 'BlockdevReplace' } diff --git a/blockdev.c b/blockdev.c index d20963be2a..9fd1783be2 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2229,6 +2229,71 @@ static void blockdev_add_abort(BlkActionState *common) bdrv_unref(s->bs); } +static int blockdev_replace(BlockdevReplace *repl, Transaction *tran, + Error **errp) +{ + BdrvChild *child = NULL; + BlockDriverState *new_child_bs; + + if (repl->parent_type == BLOCK_PARENT_TYPE_DRIVER) { + BlockDriverState *parent_bs; + + parent_bs = bdrv_find_node(repl->u.driver.node_name); + if (!parent_bs) { + error_setg(errp, "Block driver node with node-name '%s' not " + "found", repl->u.driver.node_name); + return -EINVAL; + } + + child = bdrv_find_child(parent_bs, repl->u.driver.child); + if (!child) { + error_setg(errp, "Block driver node '%s' doesn't have child " + "named '%s'", repl->u.driver.node_name, + repl->u.driver.child); + return -EINVAL; + } + } else { + /* Other types are similar, they work through blk */ + BlockBackend *blk; + bool is_qdev = repl->parent_type == BLOCK_PARENT_TYPE_QDEV; + const char *id = + is_qdev ? repl->u.qdev.qdev_id : repl->u.export.export_id; + + assert(is_qdev || repl->parent_type == BLOCK_PARENT_TYPE_EXPORT); + + blk = is_qdev ? blk_by_qdev_id(id, errp) : blk_by_export_id(id, errp); + if (!blk) { + return -EINVAL; + } + + child = blk_root(blk); + if (!child) { + error_setg(errp, "%s '%s' is empty, nothing to replace", + is_qdev ? "Device" : "Export", id); + return -EINVAL; + } + } + + assert(child); + assert(child->bs); + + new_child_bs = bdrv_find_node(repl->new_child); + if (!new_child_bs) { + error_setg(errp, "Node '%s' not found", repl->new_child); + return -EINVAL; + } + + return bdrv_replace_child_bs(child, new_child_bs, tran, errp); +} + +void qmp_x_blockdev_replace(BlockdevReplace *repl, Error **errp) +{ + Transaction *tran = tran_new(); + int ret = blockdev_replace(repl, tran, errp); + + tran_finalize(tran, ret); +} + static const BlkActionOps actions[] = { [TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT] = { .instance_size = sizeof(ExternalSnapshotState), diff --git a/stubs/blk-by-qdev-id.c b/stubs/blk-by-qdev-id.c new file mode 100644 index 0000000000..0e751ce4f7 --- /dev/null +++ b/stubs/blk-by-qdev-id.c @@ -0,0 +1,9 @@ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "sysemu/block-backend.h" + +BlockBackend *blk_by_qdev_id(const char *id, Error **errp) +{ + error_setg(errp, "blk '%s' not found", id); + return NULL; +} diff --git a/stubs/meson.build b/stubs/meson.build index d359cbe1ad..90358823fc 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -1,6 +1,7 @@ stub_ss.add(files('bdrv-next-monitor-owned.c')) stub_ss.add(files('blk-commit-all.c')) stub_ss.add(files('blk-exp-close-all.c')) +stub_ss.add(files('blk-by-qdev-id.c')) stub_ss.add(files('blockdev-close-all-bdrv-states.c')) stub_ss.add(files('change-state-handler.c')) stub_ss.add(files('cmos.c')) From patchwork Fri Feb 25 23:43:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761092 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1399EC433EF for ; Fri, 25 Feb 2022 23:47:27 +0000 (UTC) Received: from localhost ([::1]:57748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkJ4-00022P-4Z for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 18:47:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFZ-0006sC-9x; Fri, 25 Feb 2022 18:43:49 -0500 Received: from [2a01:111:f400:fe0e::72e] (port=3086 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFX-0005gS-Az; Fri, 25 Feb 2022 18:43:48 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PSI9V++zplX03HFl8nZxJ7TOd47tnVP8D5O2CIKzU8xYCgCrzcVolHNrk+0GvViKSCUJ8BBHlGgNZwb21YtA7CNl2stqLU0/XxnYjr76Gcultfo7L1GsRCys5lWeOlot80L6vveUGaKM2xYnnQbOnmxpRJJ+8hLX+RjWKOd57bQ9hYheHeSoTCn6k5g69Le055/E/3Pfzfb3hTNn/E6FPx9Rhs9OWwawruVsHgG4/GJrJ3AHdoT7RlLJ8cLWWDUmgj6PaDRXG4gejYmIS0s2SWyheJuMTxFSGKAdc1OMv8C+r6iQtQEedTCG9tzACJM2XFsKh6UKVMvDE+dOZag3Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uAmHzuvr7cTAck8HY5ku8maRymxvp5VpmeTXxb2WcIA=; b=QImI78cQ/XpcdqtdxgzWr9xnb5Ec3m0DrHNyrxdqLwFS96y7Zc5ng/uqLn7czzYPwQ4gEP1SddlbiwgmgQQcvmNjM0VRp4spjsnrfyHjnLdUMzVFkUsBhlp2/Wk9Y/XHzejPNyjSXn0vNGj1eeYXleEp3/Noy3g+hzhTIMzziLYRN9Oop0hsNEI0TMR1I3hEiLeQLeBeZjm+sz2SHMLx1iI0D9ZijvuRM1l+Ulbz2jQ7ZQhsevavVmjucrG0hbhxLVnLT9ALPPRbHCmIfrZXPTVt6G6wK3AsvKmXP2x9KrM7Boz7+hvvaColYL5s6hxWYRE7euQADcP4Ps/jLz3rVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uAmHzuvr7cTAck8HY5ku8maRymxvp5VpmeTXxb2WcIA=; b=DdwG4i1I9pVX3M8LPasMhEIX6drdEDusicHrErvD5/QNR9tb3LDxNhFS7Voj/jFYgkAtaFR7+pmROhVJ6+d3OZWtJEwrPH33vofzR6MKWmYtRwofZjvIthIPJOXFq5D08/N7OMGIyxJWO0G6y8gbeTCpC8aS4lwGPYsldsUOSx8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:41 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:41 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 06/11] qapi: add x-blockdev-replace transaction action Date: Sat, 26 Feb 2022 00:43:03 +0100 Message-Id: <20220225234308.1754763-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cee00592-6548-446c-74cd-08d9f8b8a733 X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WO6fAP8VrfijoWZc+i67vFSH+hvuyd/0dn2tYM+vDjJHSB5BA2C5gEag5EA1+EPOhBJGTv0O+lSChXOGZioerd6wTHDc4ISn3NhmmQ9M+z/1ezrX67UPIFwPL1Cq75UbEqK7EuEUHVhL7U4oaj4goB/mek7MdDr1xua6VFL1jPRL5YQiyszG+yfo1qzJpEfv3XZSvF772cCd2Z9pY5pIe3Wnp7bMPzK4ptu2+o93ka5//IOfsHrbGoioypFj9cyoi9r8Vq+4lT2dVpdfeWq7VHjro4uSyDRn7bUMG5ir/KEBPONNfhbEQDSJcq8VSFG9h+E6EFZ/6kRS8DqAUVujZhWasy9CmokOYfReFCUYzOHYBfiOExBCdiuJOZxSQZeD0G5rUz8cQLgxh8RUleZ0ujc7zlQjj+HHzHc6rAOf2lB5wd0F96LDJv890/gm8Ht4bqf+sckXd/Lj+9hF4toE4tJFz2UNGoS6SePyCjehbrc8j0FXjwU4diJ3VzLtP4z/2m9/BaJLIuD6SGzl1zYXA/34HXVapMAyjMu/tZo6NOeribdGDPaUMrykLQukGErX/idTsQMV0rwad2sdMgZGRYXshnMUSBI0xxv8QEL0JYsTdLetITxNQ6wAxvTtYn3FCn9RsG/8t1YUBxR+fNP6KyH3ENTdrsPCdPIUfWCxTWsuo5V10mZEsOWkCl5fDrgOLt+nWiQkfz8ILgPkGLXgsw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PAzmZr6IrNyjGYk1mS0Y3vnuTpkzDvP/sX+9ogFsf6EeVsk0ArvKD7WWjQQ85Np4E3r+FFA79tSaedExHqPQUIX/q9LMk4fY2IKfxfgg+1lKs2b/b2zxl4x4KQ3mbR2AkA888s2DQ2Tz3c0VYOtTlnTP1NX7yuHC4p2EA6RoGJsmuEXFfw6xHlJ5ABtpbe6VlqN/jGCd0t97xXdCvpdOal5Htc1nBux2N85LJC8xZU6eDl3JpGV29Ua6h5fPpZ4qR9ibG8cBCJlwePgAvxBb7xlToFlXH3VesMWc0ELM6PS/LVAWeM31Ra+e1lXAQdYUZ52M5PJQTctyPntgleIi1B/CVRwt9AGDP95cUYmNj96xsTrf9ts/KCWtgEoT+00Jta2EFTiemhBJEDTLNcUiq9EGKwZviRo8+cNsxFsTevVti1lgSka1INz80zmrTeG3yVIvr0P3hqhmmbsmQLaAVC1UNdNvDcEIAgZcqlViUwCcXmgJ45oLNXshJlwf4m2F+kvE1JAmV3s2I8QSFGZW7zolgtsK5PJAtdtNdE2CzjrVm/qT5l/DLO15WGdFhj2PyL1E9J1GYLa+AnqB1KVj0xXNfEvi1+ytULzKmrBW/whJ6EvJE+AtqvSI9IPmr2fAGApKcy++3/DT9NN/ybl7h3b1Gg0WX9voa3hoqzJGD/PrGMLuTGvoxcrZJGu+rWieljGHWumB4MSaxKmr1hSE30PiXv022nrfBUdmkS0afmCVvvaWF6OxVt7cQjSVx4tRnrlsY5l1/CgfQ63u3x97l2GEDiZ26UjO+Rzr7XyPhl1LNuGVXcpuL7xsjJhwUwETYFuSIGVHmiJ5y3fO7CIix/UQQOFq9WJMS8P/8jchGjD3nAmsPd4O2u6+SnD3IguPCUmp+kQqfPMGMRSkzaGanUMOnAhKeEmDvB4lYtJ8P4Rv2BIf/O5/bYpr+RjHVmdNnysjJYa/+WrBlJASe8DdMlfOXlJaWf62yktIPsRU7Xg1eD9Th1P8Ubc8M4yDNDzYsO2I3wV6bY6TTW1ZiTaSn0Le0/cSECR+2ecW7vdTkP+IFo9JGMX0jxY/VPltxCl4seGq0wkdd2F7Ufc1Ta3nh2SJjDQOGDce5hbrwk35TwsgzUyv1EBCpg5iXsKq06HIjyDgZJkHgf9Ij/MrkZCd7/rvzS97n4ENyDmIU5KNjAj8uFp3BZq9cyId8J2DiN+aNPtoPGeFky4sS7qGxCMxgtbz9ECYpnyZZ3EgbtyaOt8inly5t8vQUwNh2bXdJjtEoH0YSK/u1hoM4dCMP8N/aG5hxoxRzuJIUfgdF4Bs3cujU11w1Bkklrfp7q620K9y6boN2T9crcj6IvjudQ0IKlxPVoufpnOBYAl2+HqezjvNrgPLFtUBc7toYdBD+QBeqtVEXl5svQLUIBaY37fD06kgbzcchh7ZPwXpvIWCV0ao++1tguy+CLoTKcvWLVHkZgKCKMwDQXzDGwPz17zxwFmqu9m6S7Nd+MJ53dZyVWP7j5FKe0Z4MW2+JCOQqZobkTdw6RMbKAvQGFVuEU8mGx4Y7pKe/0L4P8hIYFERIxxlIIzvCgZO4UrnmOLk4C5HCKeZSbrHsy5CYxU/5WZRxpkpM61wD0AkDAXtf3X8Pyz5jB8rswn7Le+lksQLH79lagIa9K5jKgc6MNuiFsd5iw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cee00592-6548-446c-74cd-08d9f8b8a733 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:41.5914 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CGdplenZhS757+r7l0lR8qI8vIIszG7C0aPK6+9sV1HIwVbHrRBKd6UCsxaOT1pJf+xqF7ZrQNrkoNt9k7fLT3OJNne/QicVt2b5eNVFNFA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe0e::72e (failed) Received-SPF: pass client-ip=2a01:111:f400:fe0e::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Support blockdev-replace in a transaction. Signed-off-by: Vladimir Sementsov-Ogievskiy --- qapi/transaction.json | 14 +++++++++++++- blockdev.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/qapi/transaction.json b/qapi/transaction.json index a938dc7d10..48dd2db1ed 100644 --- a/qapi/transaction.json +++ b/qapi/transaction.json @@ -54,10 +54,12 @@ # @blockdev-snapshot-sync: since 1.1 # @drive-backup: Since 1.6 # @blockdev-add: since 7.0 +# @x-blockdev-replace: since 7.0 # # Features: # @deprecated: Member @drive-backup is deprecated. Use member # @blockdev-backup instead. +# @unstable: Member @x-blockdev-replace is experimental # # Since: 1.1 ## @@ -68,6 +70,7 @@ 'blockdev-backup', 'blockdev-snapshot', 'blockdev-snapshot-internal-sync', 'blockdev-snapshot-sync', 'blockdev-add', + { 'name': 'x-blockdev-replace', 'features': [ 'unstable' ] }, { 'name': 'drive-backup', 'features': [ 'deprecated' ] } ] } ## @@ -150,6 +153,14 @@ { 'struct': 'BlockdevAddWrapper', 'data': { 'data': 'BlockdevOptions' } } +## +# @BlockdevReplaceWrapper: +# +# Since: 7.0 +## +{ 'struct': 'BlockdevReplaceWrapper', + 'data': { 'data': 'BlockdevReplace' } } + ## # @TransactionAction: # @@ -174,7 +185,8 @@ 'blockdev-snapshot-internal-sync': 'BlockdevSnapshotInternalWrapper', 'blockdev-snapshot-sync': 'BlockdevSnapshotSyncWrapper', 'blockdev-add': 'BlockdevAddWrapper', - 'drive-backup': 'DriveBackupWrapper' + 'drive-backup': 'DriveBackupWrapper', + 'x-blockdev-replace': 'BlockdevReplaceWrapper' } } ## diff --git a/blockdev.c b/blockdev.c index 9fd1783be2..8ff0e2afe8 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2294,6 +2294,34 @@ void qmp_x_blockdev_replace(BlockdevReplace *repl, Error **errp) tran_finalize(tran, ret); } +typedef struct TranObjState { + BlkActionState common; + Transaction *tran; +} TranObjState; + +static void tran_obj_commit(BlkActionState *common) +{ + TranObjState *s = DO_UPCAST(TranObjState, common, common); + + tran_commit(s->tran); +} + +static void tran_obj_abort(BlkActionState *common) +{ + TranObjState *s = DO_UPCAST(TranObjState, common, common); + + tran_abort(s->tran); +} + +static void blockdev_replace_prepare(BlkActionState *common, Error **errp) +{ + TranObjState *s = DO_UPCAST(TranObjState, common, common); + + s->tran = tran_new(); + + blockdev_replace(common->action->u.x_blockdev_replace.data, s->tran, errp); +} + static const BlkActionOps actions[] = { [TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT] = { .instance_size = sizeof(ExternalSnapshotState), @@ -2372,6 +2400,12 @@ static const BlkActionOps actions[] = { .prepare = blockdev_add_prepare, .abort = blockdev_add_abort, }, + [TRANSACTION_ACTION_KIND_X_BLOCKDEV_REPLACE] = { + .instance_size = sizeof(TranObjState), + .prepare = blockdev_replace_prepare, + .commit = tran_obj_commit, + .abort = tran_obj_abort, + }, /* Where are transactions for MIRROR, COMMIT and STREAM? * Although these blockjobs use transaction callbacks like the backup job, * these jobs do not necessarily adhere to transaction semantics. From patchwork Fri Feb 25 23:43:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761114 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0677C433EF for ; Fri, 25 Feb 2022 23:54:11 +0000 (UTC) Received: from localhost ([::1]:44382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkPa-0003hB-Bt for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 18:54:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFb-0006xo-Il; Fri, 25 Feb 2022 18:43:51 -0500 Received: from [2a01:111:f400:fe0e::72e] (port=3086 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFZ-0005gS-Sf; Fri, 25 Feb 2022 18:43:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hJ1YsyF9FV71hm1MrcIjlQ4Cv2fzvOhMVkuamXgF33iO50iFgnGmUT6zBUFVSVQd464nDp2R0kK5q/FNY5pdZ3zvT0n+w7ZRZsFka16jorG7F0kYVawhaHC7jP+aIpy0H64coIQC3g0UPYzdFHb/jt24lL5ts+0ZELetGmccXOqwrSQCekri9mr/I/aTmS+WJSngANvOk9PkzkcOIo8VS6oz6PLjfZ1IfcmXIhvF1m5I7D2VOHY1gsEsx7CGRNekMP8hMNC4YWR4hsRmeRK1Fq8RUYBHQ4SlEBjOXX4G7YoJ52/MgeNeqiDK5s/y9TDRgoEIyvGjdwZagoiOC2z/pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ahq4V2kJuB7Tb+C7mjrhPOk6UIZtItyx7XF2k96Y4Xc=; b=aCe1P/hCp6GtDpNDLB6a6/qtGrLCWimdPgg93V458FoyMqwYMW30pWFSEPokPLoWbvsmBofIyV9KAHv3xehoPhIflVGQ6eXJXl6euAFlwI0gojRIeIizMGsfMgnBz9kSYFT9VH6t6zINhLP2c+okBBcX337EJn54teNVcn/rznOYr3GQLOEcEEbwXVc3qAC/8lF8nvDBdMug2ALaTBpo6uuWugHmMmoZqMF9vb+D2D3jU3oLivEijMt72+gjDUUNLdkssnh1XzJhpLC1+nZX/wwspBoswqhV9JB8wA46p9OnAw/TwCMexkA3pbbXZ3DY+Fo5y3RrkkODrR2SukFzlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ahq4V2kJuB7Tb+C7mjrhPOk6UIZtItyx7XF2k96Y4Xc=; b=ucwilAzD8GJ65ovxsUIZ3LmOwpNH/SVptrJQ1MFQy4EhHgmnFbhF3hgWDCGKCCwZd6W80KOodcWq5ju0snDS9WLz0tqAMZYLyVP007fBU9hiDEpUNIY9Ry7pdc2tlqhj2CBo+Xa80kUvNsZRtIWq4gij1jXd74Vsn+a/soa0fa8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:42 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:42 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 07/11] block: bdrv_get_xdbg_block_graph(): report export ids Date: Sat, 26 Feb 2022 00:43:04 +0100 Message-Id: <20220225234308.1754763-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2f131334-be87-423b-d3f9-08d9f8b8a7ef X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FlSptU962G33QTUfRDTdCR0TxKQV7cJ0A7rmgvT5pt2zE6aATsSYFbg189PYnJ6GFwiDN97YaswLBFlFvR6cljOIz7+Zm7ezRA2iKArH7b9VinLOk/mNAmZfb80Eqk0HIf5Ga+31A/3jk5frSCgu+e1Xl6J2s+jkxQPPwY1gFcrFKxgMtUDfDDJwMrD+KA38kUg6aOjlYfjdjF91OiH573sv1d9fxlV0uYeuNMHf21ApaWiahIz4bC/SHMuBuf8UhO2gw4QQ90CSMwvseK/QyLTLtjTt1lApoL8DLHrvQq5dQGPa9hH6h3s3yhdfOaL48jxx3oBKJAkYf/6/uQddT13B4hRrBfWmKbwcd3KwVUOH/EwGi/GRNV8t7gRUGuRcKnKLsLxTeN+VdFZm7EqAbMAemrSP0VoGMeIJHJ6RlItq81Q8gUXKbmtm59QU1hC4HXTLfWaR/wk9b02g18fkeBFJq14HskMwHqiu8YQRUdMCaVubcaE02p8Dbi7o4w0JJDG8lignxl5/pXpzlXjnTT+KcJ1Zjzu+Ok9X1jo6ioUXkctwQTTHI90mG0XCAUh9O72nghNMaDzjFUN6cckikaUI7VIocFP5aAho8kXq7GZK9piTDS3DF8AAgumyVvBpFfXNiZm2uL/JDYxt9dof4CyrMv+pMA37BxBQzObrlw8BfyOVsMiW01czAflfSsHF9sB/Lyp1tP28m/t6ZFC7AQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wieumjv8nKsWCNuDRCkNcpjULKg9KmA30GqwPKWwSYiRLgQT8WfISM/G3eyExH7E1a904f9qZqhzM2Ee4ERzscGW3V/o2Uv+Y5mbvUY4xHKisMNFZ+AZ0dobIlXWrd/SpP/4rOMyqQBXsFiqDm3IiLW0XJSBdNeeN3zVl0/IUOlUvSr0cEhMMp5kJfNJwxNUSy+EdN7/+wji0pZubFbf6nvZxDw6guGjJZ8UZUBmeCzaQmXUbDhOxJVOH+Q6UCTn+F5+RczOJtuHVfXOqi+b7BhDLuUaBJ2Dfm/1VjSq+8kbE79rHaGASkiFuaMIcgiTvQsxkmX31oBAP47qqpk1W1gdicEQG4AiAyc4kShhR8YvInph5VkRirH3Qk7xwIX3lRQauza0HjdpFY1DbTi0ma+NnReGDlLVsC4yfV6bsqMC0EBeIFnjUXpqFlbvj7v67u/2xQy7pdGfbQB427C35idVE9HFsO2ZNfIJDp6s8fCW7Hd/KztRKZ7a52AMN2QYPC9doCBViDVnszKVoTOBhCfxxdw0CTpZ1r5N7tM/E+h5wizxKTqxNUsQ5OyJhYMyyFl2xm2XaISQUGJAwwvWiuqCnfKYScudqNrv4Lg8DbMNj57u3TX2DQlQEnMvhIW8FbHM6vYPmieibkIdr8fFiEprun3LH9M4nGtwYWpMwb27hEK3gO0MaDUHXiRzu8/LbZ5FrFHXJpr+MVTvF9KEnzfb4+rer/YbeXOLQxR22w/AdsGrWjYZILYXehNWGhHYmj3yBAUH3T94BiXfxquImXK+XIj7naZQnbZQ0jHXjiZQpvIMgjlIPNoF06oYvI+r8Dt6EWSz25muaGVl/W9I+dyz0OSF3MdKIj3NqIKOAStrl8IrwWtHiyhbUkO393AR0Ld7ljKIFW39xFreB7SaDHzJYfQhovw7LWPnf2kb+YPVK9tLFC0B6jI1PATgI/bXaHY0SuRVdQ+gER3PMdDpz/0/G9bp7oc/VmuYMcM00upcfj4sfnUPP19maWDAzWavfW0ExCiZOAcsbjPb561cOd1GXCQ5PILXBAwDFfzGNqQES0QQ72L1Lz1p1A1/xbSLDyG0Atq5sUmpA9hlnt1S1XJuXNftm8eRjzFtrJbJt7LQ/ZB+Edan4WMQE9EohM2A0KzaHfDooHqrrYITPNnZul4j1z2tsMixSXXtJF6e3sKY5YCHz6b6i98GjAQVsPs8dSR7LGGsHucuWaS6srpgTu7JWxST/1qqsoBTFVW0WBcub+8BJGDQpabwmHm3+SBy5SRSv30J5nNOImAjkYpfzoV69ch6sfj9LQOZZgv5KuoeCQ6MSoFMYEutCEdGwxn313DU9NLCCyEXUe6QhnqK4iWndALJdYwUJFWVyn3byPr/z6GgptFfP2EPQzmxX9bRu9bW4k2T9heyniBH0jKzCogWncEtVr6Y30VZ7fpiBOLfTJRujcxG20SsGgRRqVuPzNQV2YxIHO8Fx2Yyy9NThBnrudQRGM8kmFKT0IlneCftNp5xeJr6oWqkSdvWyfGBNo5fq7Lq4QLin3O27Wbvv2GS5n6nloVmoNq9rI8Qlh0Pq7dC6OjPMSLgsmkvTBFQtj2yBIRDVZ91aBiLD8RyiKrZkhL4CzfOvxkZuDviYPoGMcNaSWvEqLfQZvaTwQlZbjaYA4Qo7co/sbpsrecc5Q== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f131334-be87-423b-d3f9-08d9f8b8a7ef X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:42.6693 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MMaraHuV+8AfvQnrvJIfqa3G6dd/Q93z+NBmjA122ffx5rWs1tqa91F8Kulmxi10TCWozQ/Ep7f+F8LfTXxbqh4mN6wirF2eWzshdEgv6Lo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe0e::72e (failed) Received-SPF: pass client-ip=2a01:111:f400:fe0e::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Currently for block exports we report empty blk names. That's not good. Let's try to find corresponding block export and report its id. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/block/export.h | 1 + block.c | 4 ++++ block/export/export.c | 13 +++++++++++++ stubs/blk-exp-find-by-blk.c | 9 +++++++++ stubs/meson.build | 1 + 5 files changed, 28 insertions(+) create mode 100644 stubs/blk-exp-find-by-blk.c diff --git a/include/block/export.h b/include/block/export.h index 7feb02e10d..172c180819 100644 --- a/include/block/export.h +++ b/include/block/export.h @@ -80,6 +80,7 @@ struct BlockExport { BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp); BlockExport *blk_exp_find(const char *id); +BlockExport *blk_exp_find_by_blk(BlockBackend *blk); void blk_exp_ref(BlockExport *exp); void blk_exp_unref(BlockExport *exp); void blk_exp_request_shutdown(BlockExport *exp); diff --git a/block.c b/block.c index b2f55ff872..24baf58e80 100644 --- a/block.c +++ b/block.c @@ -5979,7 +5979,11 @@ XDbgBlockGraph *bdrv_get_xdbg_block_graph(Error **errp) for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) { char *allocated_name = NULL; const char *name = blk_name(blk); + BlockExport *exp = blk_exp_find_by_blk(blk); + if (!*name && exp) { + name = exp->id; + } if (!*name) { name = allocated_name = blk_get_attached_dev_id(blk); } diff --git a/block/export/export.c b/block/export/export.c index 613b5bc1d5..ca6c8969ca 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -54,6 +54,19 @@ BlockExport *blk_exp_find(const char *id) return NULL; } +BlockExport *blk_exp_find_by_blk(BlockBackend *blk) +{ + BlockExport *exp; + + QLIST_FOREACH(exp, &block_exports, next) { + if (exp->blk == blk) { + return exp; + } + } + + return NULL; +} + static const BlockExportDriver *blk_exp_find_driver(BlockExportType type) { int i; diff --git a/stubs/blk-exp-find-by-blk.c b/stubs/blk-exp-find-by-blk.c new file mode 100644 index 0000000000..2fc1da953b --- /dev/null +++ b/stubs/blk-exp-find-by-blk.c @@ -0,0 +1,9 @@ +#include "qemu/osdep.h" +#include "sysemu/block-backend.h" +#include "block/export.h" + +BlockExport *blk_exp_find_by_blk(BlockBackend *blk) +{ + return NULL; +} + diff --git a/stubs/meson.build b/stubs/meson.build index 90358823fc..92e362a45e 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -2,6 +2,7 @@ stub_ss.add(files('bdrv-next-monitor-owned.c')) stub_ss.add(files('blk-commit-all.c')) stub_ss.add(files('blk-exp-close-all.c')) stub_ss.add(files('blk-by-qdev-id.c')) +stub_ss.add(files('blk-exp-find-by-blk.c')) stub_ss.add(files('blockdev-close-all-bdrv-states.c')) stub_ss.add(files('change-state-handler.c')) stub_ss.add(files('cmos.c')) From patchwork Fri Feb 25 23:43:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 413FAC433EF for ; Fri, 25 Feb 2022 23:57:55 +0000 (UTC) Received: from localhost ([::1]:51014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkTC-0008JL-08 for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 18:57:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFc-00071x-OP; Fri, 25 Feb 2022 18:43:52 -0500 Received: from [2a01:111:f400:fe02::720] (port=38968 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFb-0005i5-0Z; Fri, 25 Feb 2022 18:43:52 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GeVDOiYXWNJPVWyv0kmc25T96xI6m68jvDmUyT/ZOPyXdvA5zFWdWBLRf/5FYJ8aphNj9AzEaJF7U6TIGmDOyrBBlsRX9qjv3/j+QsRh6wUTxIWxqCD8oc/12Uty/2Xn1jrNSfryfB08T0fP4a1kuHF0dVSAF69E3fKyQcIl1KD9gKosWmveKM50YzdztAmsrBi/eM1Qo333p+bt6KScsLSQgzqKypg045TkrGyCEPxGWSj8Fjflewvy0OT/Oh689uzVkjG+7BIuaLu22E11eMgO7uVfvpLNWim9hVaHE3X+xYsHUgjbt47dA/813cEh7/owDWqGeg1scNIb45KWSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=21ZmCof0Lbwk7O6wTjo8ZW7QZb1nHddwvFBPwRRGPoA=; b=A9FCvdMI4uZF93Q9oIw1nNKfi+Pd1dDzR8KX3Gxeob6o7I4JdvG21FEBLXlTqPgeyD03IVMSYKBV1qwEfZjzbTxJ+TEmPwwbOHV6GImrX+hfWPoQML4sfjTUn3Fbm/IVLMfVKFVvaQjBOyMMSnz2wssnAxiS8ZAQHmB+eBQ5emWNPHQtUNXCE/jjQGHI29VopaotGoK2IdvIZFUOnC4fpV8j5a+X7DJwQn+I/BppaSViDuA2ylnaGXWKN6PjFIHMRheWa4PQfKJ5FAjJxYiB11Gcw+mr5fQzbKB7I1mUKNzjDYEHekoD/g0teeDH68TcIuifwDAc1Dde3xmlnUl9qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=21ZmCof0Lbwk7O6wTjo8ZW7QZb1nHddwvFBPwRRGPoA=; b=CPLU61+EMQGQdhnKtv4HpNq+T7KSzybmmGC6jZdLgIsIkt7FbHebsnqjYVAZ6q7kge6uNVxMAGNj4v2Sd8Pxq5rU7LqbJzp1WjiKHowMiqdvpfhecPgx5NRZkDrOCZ5f3eZpWiQZ3P2hPvNbH2nmwR9MUJmZYGW+OWHeySZlOlU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:44 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:44 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 08/11] iotests.py: qemu_img_create: use imgfmt by default Date: Sat, 26 Feb 2022 00:43:05 +0100 Message-Id: <20220225234308.1754763-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4410047e-7462-4324-67ac-08d9f8b8a8a0 X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: amovOHKQQJfZyocOdYabNxcm8KdXXWBpNzDZOqFWXRjvv/2Uh3Q6r2rHoBkeY1wtzjc/3/srFKpGJm3pQ7dWh3b+mXP+CPJNYpUJP5+qbItc1H9HBdkmURXtoNXovDac1ogVFqX+4y/wuzEUnelLdiUd8S6igN0kSIDkBKV1pGm8GVHyWDm3fcCuIyhCYB41rx0DptrQghjcTS246byzKp4ij3cp1VfjdNO/EtMkuCU5kizfbM9aShnPbv98/Y+dWunirtZ20KvKIb6jSy4iId6UKJ/DaKPn5K4ahnc7h7mqIj7olAzTxzvwRQ7ibTHTx+zmNcvmekh5VnktSfLwM10Nmhnt1lKNF7w6eKjk3ZspkMXcPIxe5TVY86A9A0M47P4KwKGK+LvjEZd2o2E1OOzE3ba2UUxGmuPA0U7JQ3Lh8redK0rLzZdd7wWnxnlADgox7yRTJ3Y5zex3cojz7KeCyni5P2KcRuf5qcrLnxOVAgfQXJGLdmGt7Vtao4ODJsAPU/cTxmxTdcNmRvmT3be/0DKwG2ZPqsdtGufzHC2Lk0Ld8VlFZYyDfnq/JjvpAfyXj9BBpMYc2/z+Ran70+r1HHYnrgagTN/XPoLuuOh4UlEQnvqoTvYX3kdXpdFT3PbAAdjoU/4rDZyXK/zy7i91k6+tGbE/c3B/sXqtjqVbFLQd0j3bRcpt2q8l67+PH4Ty5JKZmhkgL+4r3r1UKw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(4744005)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DWcCMvOXFlpUunOjnlVcobG66jhXUZcONHiW5y8mc/tNYLrxaGAY4gjKEcb/FgKUOGM/OqkvcYpIlEKNbKCgsj1cJs/pSugxzhV22DZXvLqnOQyu4LSmRISksZy3FSduYp9ydzWZ9kdddIE8Mns2xn70F2T3m7dgGlCrJxl+tTvm94JtumSYWdkajUfH2rjmtzTov8gId793Lr4mvysrr+aOQYxOUOwE5eNi2TqnIUVnHF1gsLsiI4n91SDshmVixVexnDgRYjCW90/7elfRn/C6V5YybJPskMHwQBA+yOOqavcEjxpvwvFOH7u2Tjw6hiGkkpUIiVh8slzpUbL3BvVnVvVUn9mC+s5owXggSSMUZXmvoaaUK6R6MaMxX3n2x2S3ZKVbWqK8GU61fgzluOHkJsKiiqasaQ1lJ2OwH4+o8KX4+F2CVuICndJTtXvFBIhQocg7Yf7ar7oOHPNfyiyyh2h1Vyl8lgTx5ga1Ayx6D3IYlRwPsyB25YeF82kmmODORZLSQ+/N/NFeLp6cAWtIWKHFLg6dbYoIngGZPzh098jajLRUZXf1M3CLVua6EBKbE2EeolUG1t+pJ3BOyohX8A+ky1NqVgmePCDgnbpsA1CGKUo+Z4FjGWBdH4Nsptpm7HftYvrlwRuZ6mx73wSFG/TBNIUMZhAeP/D99zLnFJib/T3DuYI9aJ13fJudvdSAbQAlf6QzESkiQqBcFaR0JEykJhoh+RRTWwBVL/inHmJa8j4liXRUyJ6UFhqij+VaXd3b+gS5nQX2OyB/S4g0KnoeFFFi7yF5i0B/eLrA52uZl/jL4Af3tL1RumhlB13kIlbN4xviH7gIjaI7Nb+E6jzf7JNOr1W3UNZr4Ml49bKuTHABIWKKD3tJQ7pNqTLXh+biCLx6mI/x8J4gZVKdyP3s920W05NyEyo8uQNaCQJ22sXVuuh55b/wGL32QTbEwb7RDqgFHWEzhFJ3/G1A4WFOZzRgOo66rKkiWsAd8giVCQQ75IefmVGl93QbZbY5RxZigLI9eFoGN7BOVTs0WvsUJFY12rh+axQdbYXU/LU/kE/8Txc1bblDPhyIoDt0pzhV6W7ZkJduIWvTBvXIFCDUJcectHqld+6cxLX3gb5Ms8kNCpAx8g8l3MWCrSPEqHjPRNfD+7oZjTVg4SS9e/moKEwrwe+KCRoaujKr1/R6uN0K8aHm7zQgjkJRpaZ5ZuZg617z7ANsvm9ZbFSavzxeHcyUXosVEjGjyFiF7Ta8vZULVQnlJquJ9gTn+9kTUPsfBh99t0qxO03VvYqWe5jbjHBTLGOi0PJmXLavAYYGhUNX3GYHNWsCIBN5eM6nDMrNoxCEWngM1vxku7vdPgId2V7ta+jPEcWHOngR4hbJhZ3b+qm3uAhkMnSG51crfbuwLjqEAVexwa1ku597FqzqWvb6L6KuuEixNyC6t/OpDl7TTlDHTb9YPRabu7xr2z5uE4kWwnC+RfvjUAq5Fr0kahXK9hDB6VcVoDE2G7j3M/d38cFsViesquZ7dXiz7Fd4xGbzyT6bjvni3861Vn6s2+MJRoa//wfY5JuYIzBVv3Pm/h+uRaiivZu+Nnsisi7jWkEQw2b57RzzA4REp0PBQ4QNxJbPAN7JpEJQcRKGvPlhjoh+utdOMzaSjLJB+lHtpwMIsX+RxxnQkA== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4410047e-7462-4324-67ac-08d9f8b8a8a0 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:44.0296 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nvsPI/rp56J3dlr8uhUGsGBK5t5d1dhdzihMXUkhJzjtwREAi/Sd1Co4tdI1HzQZP3Cc4f2SquaroAfEqEXpQNCiM6rXJkvKpjMAIVqOywk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe02::720 (failed) Received-SPF: pass client-ip=2a01:111:f400:fe02::720; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Less typing: let's use imgfmt by default if user doesn't specify neither -f nor --image-opts. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 6ba65eb1ff..ca17a5c64c 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -233,6 +233,8 @@ def ordered_qmp(qmsg, conv_keys=True): return qmsg def qemu_img_create(*args): + if '-f' not in args and '--image-opts' not in args: + args = ['-f', imgfmt] + list(args) return qemu_img('create', *args) def qemu_img_measure(*args): From patchwork Fri Feb 25 23:43:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761115 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1505C433F5 for ; Fri, 25 Feb 2022 23:54:12 +0000 (UTC) Received: from localhost ([::1]:44574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkPb-0003oz-Up for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 18:54:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFd-000764-Sp; Fri, 25 Feb 2022 18:43:53 -0500 Received: from [2a01:111:f400:fe0e::72e] (port=3086 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFc-0005gS-94; Fri, 25 Feb 2022 18:43:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LCF6oP/PVoFjJ+i6dZ+G53z9WKW1QmJbYBsD8qAnrqBM/qPkYzMfFoNpxCbBPKfaoX/Nhp+B4mnH8hC3+QP6p6cRr21bly6E6oTj68kT5DyfCMp0cv7/Gm/e/u/2heYZfxbia6KTEkYfwF2jRcrFNmxhX0n/nOcsohvmfEKUvAhGNWdgiDsgxb/qebHb/ZTSK/ZU8HQsLwoMRai7adwCSf8IvRjiOv/lT2U32HzxFScrfKze8Cusc8xFFuD7VS0zm2X+k9El0SkI7OHWHeUP+FFYC3KW8B+ysCdPxICc4zzbtoG8g2GbQJrfTBmonZnCF7rZ1qn7fI7d6VdAEA2mKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hpYMv2OtT1O9fgMjd/+Fpj9jh+mObFnCzJVse/WK6KY=; b=gaWLlWHD36mrmDiMYxMcZLdrVvSW7psxUDsAvbCSdl5KWyiy+RJTgyv+EiFrAg25ILMkT/BGYkuOPeioHcKNLrXJyjBUuXUlisvuyf/av1c5VEHEgErMTUY4/3vOjayWV446s/Todpm1+tiSQtKVfV3ijB0GFRYEuaKIVt+bFvyVW9OgSUnZq5U0+dzcWykXMiRCCBPAnu6b1R3yMGNL0bo5bkll7yplUvqGGvVDBeUcaYF/0JwBfATP6nuVWr1uawXQwa0ymWu8dYY+LkOedGu++NCKB+QrO1Fd5/ab+Fp2q/q/Eye4QHQiVm4k1vsNN2SNIX2EOJvn3QxHWVZ/lw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hpYMv2OtT1O9fgMjd/+Fpj9jh+mObFnCzJVse/WK6KY=; b=JwRMh8IttxGJzn5HV4QU/+BE9y+ERbivKtm5EUcydYhrW7LdoDPK2OjWOlSWj/raSgWIreyxGyCSstD1q0a9Jv9Vxo0SD7OjqzrezcGk7lqEqsqDTaMayH+G+DWmHxIoZEmAUg+RPRMsugxmkHEvOQ8lNajLJhBdrex+kyi8hEE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:45 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:45 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 09/11] iotests.py: introduce VM.assert_edges_list() method Date: Sat, 26 Feb 2022 00:43:06 +0100 Message-Id: <20220225234308.1754763-10-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d6a1faf-73b0-4167-f1cf-08d9f8b8a976 X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hmj+PF5Q5ozDuw/3sNzoTrkCzKA+3XuH9uC5l9/QyacKPb3mHwJp8OJpUIPDmT9K0m03ir9RTVEUrQAu7MU3g1SVwrlpe4F3XAW3XkauPaTXAYKqV4deRGvLXXUAlAAuFko+vr/9VylT2rleTJkgkoDlgFVRdQvXMz62SiHsOG+v968+bRzcC7myDbyKXzVmJhfvFsSfCI+39JWtMunA8Y40JdY+aVhJOSGrJBCT8GSQ72O08+9oBbECJH/v29d+Ch964VnScKGQkkl0NuKMN8XcODt5RF3wIO3ePqnLqzIhHlLwUvLUvGbsSJ64TplnW0Mg+n8iqAPqHsOHpBIeW5UacF7YNyx57pF+YGp8h8unWAxdaI2YU/2Oe3RxFTb80frQj78tFipOBmYAnyxQYQS6XV05U9vbQq+1QO9KSkeYZPblctUOe7CmbRs/Xo51fwNEGh5eX54vEIQDW0XGa/xvVMCO0LBr/DQxgbczUcCNTh6rl3MklYbx3UhEf59hH2bW24qtwz5e3kz+1Wm7s4BMjigA+Ic0h28ynOAYLALtQaXjwlwrVg6jE4mBfO2JVOJ+OpesxiWOyccmXPyakKkj+a8ACsB+vfOMArl5tNfO5OlyTslfOq4xNplIPsU9ZvMo2m84w+x/IyuhlPmwGycwqirDMRGzmnHiH7xXriRxhFNAD5oKygCIBUoDGsoMuEs9wsFUmMOd4ujPXyzuLQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: V1/ZxOQiwqxNsK7W5gEseWZJOc7kBJUGxPf3ZxjLXA5DfPSBjaru3Lx34klHqV74J8j/TrX5LAicNokfyMjfQ5UKVTd8FEV2DsRidA5CEvQi4v9Ewq6JRm50XTWNhsWv/PTkuxFkAVExov+BmnjDUFbzI04zdMCYPvZXb3th10cHuaC/xgnIpI9JgUUJXGHrl5F/sqGDoJunTIsr55uB++LNfYCEELpxgqjRbJGMhd59/ps94v4jigv9kedX1qHC0+TGG/pH7g6QoysWiQtQzXrMuYnZtpYjtm+HmGGExDPnO4y5HKhRVIhPDDhP/YIbP/hv5jHW8wXAQ6RIfu9U0ZyJJSNPb3W44wPdF9CTORAGtLFo9A6Z0cvQBmwDIXJi4XIlDXsDFwJ7jvE44RBWMe4GmEAcrE7Gss7N7KGoWkqDCm9EX8eKsXVraqm1bKEXg6JsFxJNPK4Fh2tRkMbLHkAgZhv8gBlRIt4amK19T127a21H9UGp9OXzGFYmM/eE0co9EV8MslrsCM0cx20MwcDURZAEUmWhrOV1sD/ufCpEVeTPhiaPxJrmVlt505umUtED6L3ygQUqqK/fX43in51UQiZdagddLdm4kSTsvtYqRu2flukw7/dNROF/PMdy9KUakGTJgq0IPvjcmJ+2ClN0m16HIb3QQlPRW7rosPi8qPeh9wlCh8e5hjlC3TDclMSrkOwPXi7aDnNwbnLi+u/mlz1/NxCn6CZwSa6Rec1dSuuLLKIezveMJtnPG8IvBxfJ18KXQk8o3pf+q5LM4OSbD95fszpwTGrFbkQDz3a9I9RBTFJDzjX6pgkumaKsL1Mf8NxlTijd/jXGCUspGC7S9nU7yNf7FSFoiz5h8JuRwb0rk6jEOB0yo2nRfQn30rpjmEbvZ0ZFXvW76l7boN3R52ybYOIzTIWC3ZYBoQVRdWTk5f6PVAc2ZzDK6MfXmP3hbALhkP4FOS/iCsEBQQxJCkaeLILtfSuSE3wm1kU0fAhlLgv7FeWK7NjetbTTrZ+ucafo1/ceP80ujX8UgtN848vns0OBYdSgtlg+xqtLTheeKrxPwgb4qs7H0NI2LyUgnNiu0KpRv/++BJi6ztvRaEvTNTWqJiGqQnGGtGyF+ehC1zkgkv4G9xBV9JbZvWtnyALdBzExRGsxsfR3npV5231wcjSTrDaFLsNQlG5SkwzhTAle+pMExc6YaC4GLJ9Cbx1XajKK0q2knU6bBVxTGaODB5paxvLSsF4nh/Zdi9bUGmYxngsSmy4lZRH9OyI2btt73z6QubFcvKLinW5/dh3BIfh0WDKD0/YR4Jespw6K8DnViLPZQpRmq6TW/HM5DdClV8h7/5j5ev5CIOOngeVWRQNfnNMFUz2uRQbMlfY5mmonv8wzRVunCOu+oSFEFT4HAdECEiWYg4bOALUjAhiqjOI5J1U6AJ/S1nR84sYiVVJIxLJUpP+fYB4NNNhUteo87CI4IWNsAM8q0DKB0pCr1BItGRWFHyXlCWA/fM/W5hgLxYaDZ813jhS/jZ+cQHisiugqLKekNF7WLE+lxBHqHQe9smfot+kH38xYbNslN6bBNAkaJRJptu626Ok1l1oZo9IwrZ+jQbOEMPymb+10hKSLlWhlQIpz4twMpsuIZi+BssO2oB2osRz58gsMIYAMR+VkcdPFAG8wMw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d6a1faf-73b0-4167-f1cf-08d9f8b8a976 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:45.3419 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eX90B0trBWHf6VELkFUaEhKifPFN/g4p6+ANf+DIoA8ef4+c2+ufW7ZAz/tag1GpZuJQXA9A/42dDGdcopanvfbEsHcp8FkZmAKYuHkJeOA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe0e::72e (failed) Received-SPF: pass client-ip=2a01:111:f400:fe0e::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add an alternative method to check block graph, to be used in further commit. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index ca17a5c64c..1b48c5b9c9 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -960,6 +960,23 @@ def check_bitmap_status(self, node_name, bitmap_name, fields): return fields.items() <= ret.items() + def get_block_graph(self): + """ + Returns block graph in form of edges list, where each edge is a tuple: + (parent_node_name, child_name, child_node_name) + """ + graph = self.qmp('x-debug-query-block-graph')['return'] + + nodes = {n['id']: n['name'] for n in graph['nodes']} + # Check that all names are unique: + assert len(set(nodes.values())) == len(nodes) + + return [(nodes[e['parent']], e['name'], nodes[e['child']]) + for e in graph['edges']] + + def assert_edges_list(self, edges): + assert sorted(edges) == sorted(self.get_block_graph()) + def assert_block_path(self, root, path, expected_node, graph=None): """ Check whether the node under the given path in the block graph From patchwork Fri Feb 25 23:43:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761120 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC692C433F5 for ; Sat, 26 Feb 2022 00:00:32 +0000 (UTC) Received: from localhost ([::1]:53160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkVj-0001NO-Mc for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 19:00:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFe-00079Q-U9; Fri, 25 Feb 2022 18:43:54 -0500 Received: from [2a01:111:f400:fe02::720] (port=38968 helo=EUR01-DB5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFd-0005i5-AW; Fri, 25 Feb 2022 18:43:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KoE/GtN0nySVH3OoeFydSGOm/Wr2KHo4ThqBhxj117ogaMKM6SJio88RRTHJDJi5tvHNB04vTmuAbyKA/Bf5/l6jhmcJnrkmQLfwN6z6iO+0vTnX7/5614AtKhcZk5siGAbGRnmtxESA3dJTPCCbX7mw3DT9KXt0zEeMv3FBfawCogtCtDwGvyfbPL/D5+rQjwP+En7kvd6Jykgw+A0d31c002v0f3madb46OfZTcVYvU0VsmIg3bGsd0kWxU7JZqS5bRoBevJGaOUZVYHTl3K9pLVS/0s/4DhTXsKgEPR5LFKcnLOSnjmlb/OPPUY92FGal8fYMx8YgSdxtK3Mpyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EovN50qBlzPZ0bVClbI8Q4nS94lEAfr15AVQlSLMwsU=; b=mAL7sDLegRA+i0DoErjNk7J5kjPVyYsKZ1K4vv/zPZFLJfS1oX1WcS2OfkZH0GUGOH1uI/WdKK+3f29Lw86IDtSuuHC1oYyQyWzpVkpwDzrTCnyXOo4A5ztPDRFMpvWf6NJFl1WGuQ3u0EOmGSUCiKhN4FpprLM38T0QgIT1BLFDUeKA4GZo7AZO1vhK4ZXh9M5tIWYZZ6fp+EcTd2MvoDsMAOXxOkB7g+daYmiBT/s0aq5dZxkgYHxhVLv2ysSMaANSxA+GwPd2ZkE0c/1X0GT4i4Zo7Y9f6Z2h/NPyN99GMDMZi4Zdu2Clg15/R46e3H0tHp8pZ+p3bdK7ReL+lA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EovN50qBlzPZ0bVClbI8Q4nS94lEAfr15AVQlSLMwsU=; b=NoeXlRjuszsVFrMZ+EM3U+/EBO2vvuGaq2rNTeKfpjxI2lbn7pWZ3ZjFj9wvEnYOZxMrBX6TIBsSiofV1XLAqPGi1F4q6o0sUcKKIlE3ixkMY1/txgxo0LTGXMXJzuFAwDou+yDwWzWOX5k94is2Ix0EKjbpNSfL+bMVQHyu6J4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:47 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:47 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 10/11] iotests.py: add VM.qmp_check() helper Date: Sat, 26 Feb 2022 00:43:07 +0100 Message-Id: <20220225234308.1754763-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d529dd2b-0640-4b3d-2d43-08d9f8b8aa3d X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V3MyoQcKtlxrNtewyXAdGZDZJFv/DJmVPyziMnrTr4sgPTQH1GgdUFUYnyJAz8+mK/oIhfiYvD1KzD92d1F/OsNX3niUM9/xZhFeZzMQwZPiKx9j7EBHoG3L5bIwuoCvpjetlXE43VzLZcspHFUVBF3NqrnWjssAOGh3REi9GgB2TwvNjmwXYBhOEy6TXqsg+OQzTPU0hJAT+Y/427xe5W4H/AhjiXdupHsNJXtIcu39b827cGth9jv01W5QOATb1xWcvO72nx8mLPE1u6IbjR6nOupYlvKbl+wUZSFFr4rc2L9Z8onB4luSAbXNTXmTeM9MHRx/4XEgDx78Yw9g4FV+kKjUOhLsSFuyci8garV64fAgcE3TXH1jRmVvEB+yxbU9WgV6MYNTGMz1bTLuRX5/uf2491vv6NF7sV+X0bGAeZUsI1k9++pUfpK9e4lMB/++o4U2riADHaIzjojV/DaGyKbaT9ndzkkMjwCtja0CNmPQFcfmVhEtP8WarXJQUjPxGIVWKK1zbT7Br3DLC2/UaXKuPCeKRxnvqQxhe5H6VfIt1pL/P25TyXzKV806vMhlUd7XO6RfwDm+mjDz+u8tobBnCMZElwOUed++tYT8dLQLQh32O0eDgM24aSf4sCa65jtk8vsEw1RzOwbv2iIr2ZwfwJeYE683RkITBtjaj016S+A4RkbfAg0ltKPp3RsR2LO889MWHzCqvnVYlQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(4744005)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B2q6wUaGiPV/B0DqBVyaHxabMsAhB+ZY4uFgwObzuSpn7lWsWaauvGgZr1c5dw5OYwgnPq/35u11eenKLLR3rNbwURqHVKf40qQcibc5nMc+0sPdAgVzhroNrNkwHrSn/hA3U4Z8hA5ta1/Wb43+Q9CAWgPSjJzu5fkafQtEZNYr/fvvFqh8D84D0gTG7LaOwZL59RYLzzMAg5H3F7XC0XFk18GwtVO/GVj/9wvzD9rT04OYiqgfe/DBHcfHc0Qb7EAYoG4zNCEVRAoiqJbqavZmgguq0apcN6A37xhM/2Du2BP1el/lkOho0Lm1JdzdMfEd+Kg9sitixVHkGd4PzT4YGtJseTpAYMft0if9mCDcrHTyALyiqt1+S0zHKAXky5whQ3/QBhG61tRTYyoUs+Sp+lOD6DJsznF6+bL/nuFOk3+uIo2utg8vw2x3lVGnCuRxchJmI18MUEFreNNluDAjWPjhC9roJ8jOd0TjzN4SeFN6iRMWj361s3wEqV7l1s8jOWyskJbawq9UadeK3/2vcPCDlfRUAFPRTruAt1EKaPEA5CkXo568/tE0JqI1ZyD62fCg9hwwC0X5IyqpqJ/l+Utg1YJHCUbSdCOIMpsjdtLPyLy4BxK0CjpWTZa8rcYr+4tokcHHt0GOIHb4OaINDX3OptiDZoT3i2jRxCPFX1fp/VlLd1y7aoH9+MLZ1ASxQmCeTcwhav3RFdwUCfK3aXWZjB9wsbF9WZIJIZk+vTqFLxoR66MUqkz7sxIznOyTawvta8UbasHTdF1DNGB2ty/7k7k/RtrWQwbQ4DLsB81KNOfWqboynw9/OmzTByOZIV7g+8vg3ilEPqMuISvipcVzL33MCp7AyY0MSfZiOBXtAJRH27AdiOF/bkDOGqUjqli+BVl3jOLR10n1noOkAHufDZ5UpJBMXmxh0bCUHXEH/uEdEU/XEi4mbHH3w9nLX4pTBzZhTqJ/QWdb8WXkMuwvcifjF+7GrySaP8i3Oiuw+7M+CayUOr0QAPpxg8sUshQJFizM/bEn26Tswl7UF+5gpvTR7ALcT+t7Mj6amiay8FuodxI7CKNpAqAN+iwP37MUtdsln1SmDApRXxA43dhfePYJw0BnZqpjkQktIhERZkV8UetUtDTjVSwIMlUd/Lm6KRhgEFLNH7PTMFVPy04VOAZgDvGf/DBisRVdQnP1hc6YZoa+Tgdm4AGDNFhwaOSq0D1sRxeZ05bfM4N9nrIQv/tT+I0hhYNBCXTu1j4HKryI5uahX6nB6uqzjeddMVKIQj5hEW0cEV/vRgwP0wujYoNYE7fxAc5eGAPw5Ui9NgZP00hn+MpTghfCS+dvBdxXY7v3Js3ds+ZQHzE+9t1hC021FdH1vzuj0TapJQgwKMAnV0jCbOIjDivcwwkW77NhvTbISSRnqMzpbr5cD7u6647ctJMYHzcXpQzioB1SCNi209Vul1pdLYkC9kgGgaFT0KFNibohARM/OxvxReXaUROCKt78L+XdgMMqCh6ZGcZumVR1Ya0t+ENqz7VnLnZKxgPoxNrNaUKLR3F9S6/dlhUzQvZM3FSrcy7s7vqJMQJaYmU9HqvfX+qGdInc/UvCXeipBU2MVeKv5KuGacnz1Zyoq6hNpf3XdA2L7vTvWBW7Ev1I2iS5fxheJux7JwI9CkqN04ZUeNyH7Q== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d529dd2b-0640-4b3d-2d43-08d9f8b8aa3d X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:47.2794 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: f115asgwFh48it6s4ViEYZHrWuT73NN61leICkK4KEYYAGQeuqZ5WRwjzdAUGBExW0yuJiubYaQ10Zlo8RCCwAqEUfytQIo7PPBsId2nPbk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe02::720 (failed) Received-SPF: pass client-ip=2a01:111:f400:fe02::720; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" I'm tired of this pattern being everywhere. Let's add a helper. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 1b48c5b9c9..dd33970454 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -977,6 +977,10 @@ def get_block_graph(self): def assert_edges_list(self, edges): assert sorted(edges) == sorted(self.get_block_graph()) + def qmp_check(self, *args, **kwargs): + result = self.qmp(*args, **kwargs) + assert result == {'return': {}} + def assert_block_path(self, root, path, expected_node, graph=None): """ Check whether the node under the given path in the block graph From patchwork Fri Feb 25 23:43:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12761116 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD04BC433F5 for ; Fri, 25 Feb 2022 23:55:56 +0000 (UTC) Received: from localhost ([::1]:46902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNkRH-0005Qx-OE for qemu-devel@archiver.kernel.org; Fri, 25 Feb 2022 18:55:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFg-0007Ed-OR; Fri, 25 Feb 2022 18:43:56 -0500 Received: from [2a01:111:f400:fe0e::72e] (port=3086 helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNkFe-0005gS-IX; Fri, 25 Feb 2022 18:43:56 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GEy/xqfoMGnP0+q2E+p5s7Cw2I+IRPnhjD4avBv+y4p6OfThTtObgN0OG+DXN/1JPePjxd91svyZhD/G6dDFb6NfCPsPr9EN6KWCmC/NPA0FxZVvPpAKC7Lhz3wAgZmPPkzVP7RNBRUDLICVahEkF01txoempI2RvTXDRAIx8CBfqjko/jLOaCLDYDTPEPrmgH2Js0FLISwmSaV21/8VVONivio4yp8oWBgasTkyzmEUuJY1YKfJc1lcUYvEp82UA3T6oKhmPYLtsW+mYO57WvWQSRwajgyvdlYeeo4Rq6A9LMJ1IIXdmLjH3m5FZh3ACrcCpcmaWIr9WvLHm8uzNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GcqavZytIBWrKKHgJpXXj3Smp9XmAxkiH4DX1+L2RjQ=; b=bX6b6A2QBYg7eEu9ws1mxTijji2wMfLZBLZPEg62Y+FI24UIx00/fZbQykktLsjYuaX9/RsMDPYLjdoHdIxBjkQnYxxFRT9dBVauv91zvxFu6BLwYeL9bg1rDq+Vr4O4eA1eZLAK7APqhbxah/KKpWqaB566vOheBIJvJitqg5tVYEHLXFv8CGkL0xhTSx5DFTsl1vSBy+YOEJRmzJrRfKxjPxCrts51Qa+kJdtnjQ1VJQXBTEbdntR5jdRaNON+0L2mpkRoIMif0SgR494p4qVJ21/TP7crwKDFJ76USqvIctSQqlrayWCv3U18Oc4apH1Ol5W9qGFaJ9ikpF3+ZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GcqavZytIBWrKKHgJpXXj3Smp9XmAxkiH4DX1+L2RjQ=; b=v/YUA9EmbaVO4wpgqNjl4EIC72SmzE/x28iC6XK0N2ZlVw+49SZhZEIjFmcuzgAkCq6nqI3wXxQUKLQJ5ZKyHzu6GzhyTw/lcCNBgK0mTY6vBnYFzOqVZzl5GhvnNnIEn4fhrrxgIafmDXjQzrfh1oDO6r2/YTDud6zcZSB5/Ks= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by DB8PR08MB4172.eurprd08.prod.outlook.com (2603:10a6:10:af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.21; Fri, 25 Feb 2022 23:43:48 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::49c:67e9:3e24:8714%3]) with mapi id 15.20.5017.021; Fri, 25 Feb 2022 23:43:48 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v3 11/11] iotests: add filter-insertion Date: Sat, 26 Feb 2022 00:43:08 +0100 Message-Id: <20220225234308.1754763-12-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220225234308.1754763-1-vsementsov@virtuozzo.com> References: <20220225234308.1754763-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: VE1PR03CA0006.eurprd03.prod.outlook.com (2603:10a6:802:a0::18) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1181dc66-0401-40dc-af5e-08d9f8b8ab58 X-MS-TrafficTypeDiagnostic: DB8PR08MB4172:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f24uvEAvUrlBLzzQqCvlpZAXLUllKKr6kpG4h9CjRGJJUMk4i9TOeKN+f49QasgB8m3OzzoylZAyKO0Hy3sYu1uhXhXFad1f49GozYIyUD/9FxO8OR6DK+XGdoqMkv0wIlX21HhCk4Po83m5jB9TqUgaR7SzxsGqzoDzvLIIz/dTky/p5F4RdYrIFha5olTxRAY7HxAMLUigrJtlUC0wzFnJv6BlHjXjJd580R2KBlxWSqVLH24yMyTgR5yqMv0Yy3CsRF5/vfQlJQ9Y1EreUVN8qU3Lgj8fUIgIJioBu+sjT9tzOGYk7/0B4JstJxn0EgrtRPIOlug1j/PrwxYA7poZa44NbPnsR2+/NnDTKdSmPa9/qrQqotYRf2/KWFsKt+daNDhNDxqWuWhxyxo/QcAPhJze6l8yBs98530ENN1sQ9fSTnFwgfwNK660vMBV/4Pss4N48ZjdEhZHxpvPcm/0nV2VxoduC6jGYf2Djbbi6CFwiJgjNc7Sdb33iTob5b44xTlU5cv1098DauFpj8LUi6VwuO/QCtEUXVBNrVp7P1Y5xbuQBv05TklVjGXaRLLYbEgFDmyl5kufSAQ4qpUY9IcF98dy5+1hv7iG5v9pkGOEm51e+2I/oDWEu76Ft78oAyCdvPz1TwYZKix0zYRW+IoeVbatRfGNWjXxpYKddjBm9hwJLt/wwk9CuVHW2x7rIeWiROfxNdrdAJq8hqNTtyKqsYCao1tYUx83NAZhg3FC/PZ6yECQpzMfmtSf6oQf4TB46Xf0dYFTg40Xewm8wOKH9dTcEhhPR8wWukqSOjplliNy1wc8rqRReYzo X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(6916009)(6506007)(8676002)(66556008)(5660300002)(83380400001)(6666004)(7416002)(8936002)(52116002)(508600001)(6486002)(6512007)(2616005)(26005)(316002)(36756003)(38350700002)(1076003)(38100700002)(2906002)(86362001)(4326008)(186003)(66946007)(66476007)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pFFIbWdQV2hhPYQZdnhir+x2aizoBGDNJLNb6670Atq662tF5MYSFvukyZofktHgpwEKsxhEGTbJFoNrDvfF7+rXzoywTNwI/i+P4rWbM/OwjEYEA1WjN8jCQXKtd6n7DeImLvXt4Qfah2R4MSYOolDTwDa77eIv8FQweK64wWojqzsr4UFjPuB8N5pxpl2l9jz3NV4/6w86xq6GYcFF+Fl5RasX2kFE3gRMZeUBkZ53UtCWoqIVfdgs34357KvlAfQ8L28CncLU8DaBwpj5+LWW6ghG5Ius5OnlwoOQq558c+n+b7oT1j52IXcksHmJFUtw9lDp6eM9t0f+xuk4wO6BBLiW5N8cEuBDc/WSIEvcgcITqVCoC0EXSDx7tBHg5PpL5T/foHEpWQlVb9soNGnTQYGjdxX2BLwQ8gF61VioJrrInqZERtNWEoS2pm818Ecwqpwg65HbbYQHIonBlSqyGe0PYG4sZJc5jjLUv6AhC5BTsXYeUJctHb7SYNsKQbb5ZopbA6ZzrUEZql+vTX3ysIrnOinb2uZHKr39RCZ1lxqq6uuxRkaifUqakiMSZcSs/0bfagejEuV10f+6u7JM5vWziB19MjPBwClko7vgr6jNsRmJfKM8S+2WBcQAH/bzvC/wcBbX2e4qS42fgW+VELTM7GTx6M6wV1Mke3lT1s2DMrft0N6JOpEImkbkQdmsTUPs9XIwuOaQ3JCqdZocNu3WDa4FICriQimKowYNpQx7O/vfbRIRWzoAxB7m70FBTgw4a4S36iVvtygvuZbuTSJOxedHytTIv2BHYACw3iaPbmc+Px0d5kd7VzoNH5nWUcUZZ4DmBHcNPdXp9/N/evWv9zTyCCGEelR2Mkt1jJ2KWgJDikgitesCv8VxVOhc8D5wLzUrlA86UGbz5Ytj9/RP0S0/yOC2dv0DZewgA+xU01LZiqBi2GrzO9hFsGfWOLsmLSa3hGL8X9A2Bu9tjxpP2uG9wwB/WF+T8OuennUctEB/9XIMZdPgIH0+6FTj+7kWfSUQ+TEA3tDS929Cg+rnOyt4qApIyq3SS3MQ5lsWVRnzAaqBltFjFgaG02Y5PQL5jE21owfScP2snDHfDiptNG598bYyaPFKoZ+2IkfdeOO310D/YdNCQXBpbudgE9ZGwJUS8jBf4UlgcdFEO6wU/cFzJndLLEw17lh4aZTbRqHDC/tZpHQgpDMx60nJf/2u9mJglt27xUjHWnlhPBsGmb7Tw6TbzpGHE1S4ybcQMCujdRVkhnGvuXAx1m4JU7iTx4sPDVs1z4eXCPuMyqI/chhSAewJQwUvOPVrr9ChEpTyc+eI9Hqa8DH4Iz+IALUDtI9LiOMOSCPlprQz32wYGDTTPdjt+O2j852vN5LNFcDE1bUBxa22neawZYxDSkCo0kkKCyvYGe72sd9ROyKgKWKcuu+ilAS5oCpnrGleDuMyZl/U7XvxhffiWQfPKQq8kdeen8Pu2fpR9DvukabDOOxPvEaaDK/ei5ek95x1qU/Q6EOkJxNKW+UFTrIX+P4CWwn2XOCfsLTW3j98iXsJT2+29TidaC2MUC6Ra/BfiF7PcAvROcETfTbhFfwhXxVp7mY782Nay6MJ1phg5oSUw63vVdTKB8j3e4dU4cKFki7tC/mroHxjog9SaMODgt5OroOwdR7tQSfLrw== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1181dc66-0401-40dc-af5e-08d9f8b8ab58 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2022 23:43:48.3741 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iVO6qh4wG7pCGkfrW9833XQNl3AZ6DAxBNubZ6YL70gL9rLMmpyf1FNdg6FiNAt96u999KRt404Ik2kiAyozO9PD/xHucqVz4YeBALJn7QY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4172 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:111:f400:fe0e::72e (failed) Received-SPF: pass client-ip=2a01:111:f400:fe0e::72e; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Demonstrate new API for filter insertion and removal. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/filter-insertion | 253 ++++++++++++++++++ tests/qemu-iotests/tests/filter-insertion.out | 5 + 2 files changed, 258 insertions(+) create mode 100755 tests/qemu-iotests/tests/filter-insertion create mode 100644 tests/qemu-iotests/tests/filter-insertion.out diff --git a/tests/qemu-iotests/tests/filter-insertion b/tests/qemu-iotests/tests/filter-insertion new file mode 100755 index 0000000000..4898d6e043 --- /dev/null +++ b/tests/qemu-iotests/tests/filter-insertion @@ -0,0 +1,253 @@ +#!/usr/bin/env python3 +# +# Tests for inserting and removing filters in a block graph. +# +# Copyright (c) 2022 Virtuozzo International GmbH. +# +# 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 . +# + +import os + +import iotests +from iotests import qemu_img_create, try_remove + + +disk = os.path.join(iotests.test_dir, 'disk') +sock = os.path.join(iotests.sock_dir, 'sock') +size = 1024 * 1024 + + +class TestFilterInsertion(iotests.QMPTestCase): + def setUp(self): + qemu_img_create(disk, str(size)) + + self.vm = iotests.VM() + self.vm.launch() + + self.vm.qmp_check('blockdev-add', { + 'node-name': 'disk0', + 'driver': 'qcow2', + 'file': { + 'node-name': 'file0', + 'driver': 'file', + 'filename': disk + } + }) + + def tearDown(self): + self.vm.shutdown() + os.remove(disk) + try_remove(sock) + + def test_simple_insertion(self): + vm = self.vm + + vm.qmp_check('blockdev-add', { + 'node-name': 'filter', + 'driver': 'preallocate', + 'file': 'file0' + }) + + vm.qmp_check('x-blockdev-replace', { + 'parent-type': 'driver', + 'node-name': 'disk0', + 'child': 'file', + 'new-child': 'filter' + }) + + # Filter inserted: + # disk0 -file-> filter -file-> file0 + vm.assert_edges_list([ + ('disk0', 'file', 'filter'), + ('filter', 'file', 'file0') + ]) + + vm.qmp_check('x-blockdev-replace', { + 'parent-type': 'driver', + 'node-name': 'disk0', + 'child': 'file', + 'new-child': 'file0' + }) + + # Filter replaced, but still exists: + # dik0 -file-> file0 <-file- filter + vm.assert_edges_list([ + ('disk0', 'file', 'file0'), + ('filter', 'file', 'file0') + ]) + + vm.qmp_check('blockdev-del', node_name='filter') + + # Filter removed + # dik0 -file-> file0 + vm.assert_edges_list([ + ('disk0', 'file', 'file0') + ]) + + def test_tran_insert_under_qdev(self): + vm = self.vm + + vm.qmp_check('device_add', driver='virtio-scsi') + vm.qmp_check('device_add', id='sda', driver='scsi-hd', drive='disk0') + + vm.qmp_check('transaction', actions=[ + { + 'type': 'blockdev-add', + 'data': { + 'node-name': 'filter', + 'driver': 'compress', + 'file': 'disk0' + } + }, { + 'type': 'x-blockdev-replace', + 'data': { + 'parent-type': 'qdev', + 'qdev-id': 'sda', + 'new-child': 'filter' + } + } + ]) + + # Filter inserted: + # sda -root-> filter -file-> disk0 -file-> file0 + vm.assert_edges_list([ + # parent_node_name, child_name, child_node_name + ('sda', 'root', 'filter'), + ('filter', 'file', 'disk0'), + ('disk0', 'file', 'file0'), + ]) + + vm.qmp_check('x-blockdev-replace', { + 'parent-type': 'qdev', + 'qdev-id': 'sda', + 'new-child': 'disk0' + }) + vm.qmp_check('blockdev-del', node_name='filter') + + # Filter removed: + # sda -root-> disk0 -file-> file0 + vm.assert_edges_list([ + # parent_node_name, child_name, child_node_name + ('sda', 'root', 'disk0'), + ('disk0', 'file', 'file0'), + ]) + + def test_tran_insert_under_nbd_export(self): + vm = self.vm + + vm.qmp_check('nbd-server-start', + addr={'type': 'unix', 'data': {'path': sock}}) + vm.qmp_check('block-export-add', id='exp1', type='nbd', + node_name='disk0', name='exp1') + vm.qmp_check('block-export-add', id='exp2', type='nbd', + node_name='disk0', name='exp2') + vm.qmp_check('object-add', qom_type='throttle-group', + id='tg', limits={'iops-read': 1}) + + vm.qmp_check('transaction', actions=[ + { + 'type': 'blockdev-add', + 'data': { + 'node-name': 'filter', + 'driver': 'throttle', + 'throttle-group': 'tg', + 'file': 'disk0' + } + }, { + 'type': 'x-blockdev-replace', + 'data': { + 'parent-type': 'export', + 'export-id': 'exp1', + 'new-child': 'filter' + } + } + ]) + + # Only exp1 is throttled, exp2 is not: + # exp1 -root-> filter + # | + # |file + # v + # exp2 -file-> disk0 -file> file0 + vm.assert_edges_list([ + # parent_node_name, child_name, child_node_name + ('exp1', 'root', 'filter'), + ('filter', 'file', 'disk0'), + ('disk0', 'file', 'file0'), + ('exp2', 'root', 'disk0') + ]) + + vm.qmp_check('x-blockdev-replace', { + 'parent-type': 'export', + 'export-id': 'exp2', + 'new-child': 'filter' + }) + + # Both throttled: + # exp1 -root-> filter <-file- exp2 + # | + # |file + # v + # disk0 -file> file0 + vm.assert_edges_list([ + # parent_node_name, child_name, child_node_name + ('exp1', 'root', 'filter'), + ('filter', 'file', 'disk0'), + ('disk0', 'file', 'file0'), + ('exp2', 'root', 'filter') + ]) + + # Check, that filter is in use and can't be removed + result = vm.qmp('blockdev-del', node_name='filter') + self.assert_qmp(result, 'error/desc', 'Node filter is in use') + + vm.qmp_check('transaction', actions=[ + { + 'type': 'x-blockdev-replace', + 'data': { + 'parent-type': 'export', + 'export-id': 'exp1', + 'new-child': 'disk0' + } + }, { + 'type': 'x-blockdev-replace', + 'data': { + 'parent-type': 'export', + 'export-id': 'exp2', + 'new-child': 'disk0' + } + } + ]) + vm.qmp_check('blockdev-del', node_name='filter') + + # Filter removed: + # exp1 -root-> disk0 <-file- exp2 + # | + # |file + # v + # file0 + vm.assert_edges_list([ + # parent_node_name, child_name, child_node_name + ('exp1', 'root', 'disk0'), + ('disk0', 'file', 'file0'), + ('exp2', 'root', 'disk0') + ]) + + +if __name__ == '__main__': + iotests.main( + supported_fmts=['qcow2'], + supported_protocols=['file'] + ) diff --git a/tests/qemu-iotests/tests/filter-insertion.out b/tests/qemu-iotests/tests/filter-insertion.out new file mode 100644 index 0000000000..8d7e996700 --- /dev/null +++ b/tests/qemu-iotests/tests/filter-insertion.out @@ -0,0 +1,5 @@ +... +---------------------------------------------------------------------- +Ran 3 tests + +OK