From nobody Sun Nov 24 23:55:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1719402975; cv=none; d=zohomail.com; s=zohoarc; b=e7yw7Ju2suZY7lYXEvRp+SfEjtuMlyjT3+FZPqw1uGznw+FVOsOzB0btaE6mqsCz2HFSyxrCSmvruSfKFE+BfoPQTGZK7oaFYX/qhbbwlHtLwLgXmcyhgXu0H17YKamAOqkkoOOuj853wFMy7kqSiT0giQj1JVghI2sGkDGFx6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719402975; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2BpnIA0zjzXHw3gjw9gzQ72vpaN5s71FnzZnW95EkHo=; b=NZ3ZM3KsNrND5vPF6GK83FNrlexk0t5hRnRNUFvWWvXfhbqmcUo5uIrPGiGJuhc2Cc94dm2oSpoaLhGddTq449q2qa2H0tySOfs4rLIqsYNd9ds4oJ6MRgGPwI5doT0lQA07uGeU05ivxBiFyxkFysCHYaqTENbEGhy/dz8a7cQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171940297566972.55541209593912; Wed, 26 Jun 2024 04:56:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMRED-0006LN-0S; Wed, 26 Jun 2024 07:54:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMREB-0006KP-1s; Wed, 26 Jun 2024 07:54:19 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMRE4-0007Hb-Ui; Wed, 26 Jun 2024 07:54:18 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c1f:6401:0:640:7e6f:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 2673260AE3; Wed, 26 Jun 2024 14:54:08 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id prOe6Z0rMmI0-3RnPKRXS; Wed, 26 Jun 2024 14:54:07 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719402847; bh=2BpnIA0zjzXHw3gjw9gzQ72vpaN5s71FnzZnW95EkHo=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=sv5rS/eDc36iLXabYoI5odp3k9QPCuVDv8eqjcCxYZ2WsZBG7Y/lsF4c1YwiH9jg6 B9gEbx/ObT0JhiYxf37a3NgEhnGMyObhpaQaVAQxalD9IPPUJ9/FeZyVvenDOcAGUj EwUM0++lT96qqAUtER/pW/38i8RHskf0LVZf//HM= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, armbru@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH v9 1/7] block-backend: blk_root(): drop const specifier on return type Date: Wed, 26 Jun 2024 14:53:44 +0300 Message-Id: <20240626115350.405778-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626115350.405778-1-vsementsov@yandex-team.ru> References: <20240626115350.405778-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1719402976307100001 Content-Type: text/plain; charset="utf-8" We'll need get non-const child pointer for graph modifications in further commits. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/block-backend.c | 2 +- include/sysemu/block-backend-global-state.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index db6f9b92a3..71d5002198 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2879,7 +2879,7 @@ int coroutine_fn blk_co_copy_range(BlockBackend *blk_= in, int64_t off_in, bytes, read_flags, write_flags); } =20 -const BdrvChild *blk_root(BlockBackend *blk) +BdrvChild *blk_root(BlockBackend *blk) { GLOBAL_STATE_CODE(); return blk->root; diff --git a/include/sysemu/block-backend-global-state.h b/include/sysemu/b= lock-backend-global-state.h index 49c12b0fa9..ccb35546a1 100644 --- a/include/sysemu/block-backend-global-state.h +++ b/include/sysemu/block-backend-global-state.h @@ -126,7 +126,7 @@ void blk_set_force_allow_inactivate(BlockBackend *blk); bool blk_register_buf(BlockBackend *blk, void *host, size_t size, Error **= errp); void blk_unregister_buf(BlockBackend *blk, void *host, size_t size); =20 -const BdrvChild *blk_root(BlockBackend *blk); +BdrvChild *blk_root(BlockBackend *blk); =20 int blk_make_empty(BlockBackend *blk, Error **errp); =20 --=20 2.34.1 From nobody Sun Nov 24 23:55:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1719402931; cv=none; d=zohomail.com; s=zohoarc; b=oG5CDW1CEjkpNzQ3dq3yrszRzXk3fiO6TBXfDCnYLvyLpCq46RtepMK1QUdCSi10F+TDSpD9hpok3vp68siWxNiRGasUE+SwykFQ1//uWFvptEpfSfjDVwqDpZrENE2nsubhXKrzv0KGB1YFCfFo1Blc5AwV+sWwMkohuaMiWOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719402931; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7996JJIuMWtqPJW4I6ZBdaagrfZfSU9i4TSJhFAVmxo=; b=kYwzFU2sjHm17BpztRBD0eq5+S86SONrNleOF7VUrJBJRKz9j7/7Wc377r9mGsJ4R0mPpnOAg8z/vZ0WbLQXnNjUUCQmHZct0ES1PPQgKdXCxic31NVT4Z/X8N5twayB6GCPFAlcY3z+j1rQTODaspav+Me1TFgH9A19T+u8+r4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719402931251968.5331449659129; Wed, 26 Jun 2024 04:55:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMRE9-0006JO-TM; Wed, 26 Jun 2024 07:54:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMRE8-0006IG-0v; Wed, 26 Jun 2024 07:54:16 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMRE4-0007Ha-Sw; Wed, 26 Jun 2024 07:54:14 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c1f:6401:0:640:7e6f:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id DA57760DC9; Wed, 26 Jun 2024 14:54:08 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id prOe6Z0rMmI0-jAbEeAik; Wed, 26 Jun 2024 14:54:08 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719402848; bh=7996JJIuMWtqPJW4I6ZBdaagrfZfSU9i4TSJhFAVmxo=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=S6oUNUVgC5yZKE8kaL6vnY6EymsCFzO6GvgMnJonWJTgMi8UFbaV9my88n2EfdXcJ ekpqh7gDIAvP1w9pQfbTQjzR9TAhPRcf332Ye7UngH2tZuZ8TLmTcAr6jEtP0Yrepg E1wdc+NDML7Y4pJgIxGATKLw8aXk72Z2rk3nASFo= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, armbru@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH v9 2/7] block/export: add blk_by_export_id() Date: Wed, 26 Jun 2024 14:53:45 +0300 Message-Id: <20240626115350.405778-3-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626115350.405778-1-vsementsov@yandex-team.ru> References: <20240626115350.405778-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1719402932478100005 Content-Type: text/plain; charset="utf-8" We need it for further blockdev-replace functionality. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/export/export.c | 18 ++++++++++++++++++ include/sysemu/block-backend-global-state.h | 1 + 2 files changed, 19 insertions(+) diff --git a/block/export/export.c b/block/export/export.c index 6d51ae8ed7..57beae7982 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -355,3 +355,21 @@ BlockExportInfoList *qmp_query_block_exports(Error **e= rrp) =20 return head; } + +BlockBackend *blk_by_export_id(const char *id, Error **errp) +{ + BlockExport *exp; + + exp =3D blk_exp_find(id); + if (exp =3D=3D 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; +} diff --git a/include/sysemu/block-backend-global-state.h b/include/sysemu/b= lock-backend-global-state.h index ccb35546a1..410d0cc5c7 100644 --- a/include/sysemu/block-backend-global-state.h +++ b/include/sysemu/block-backend-global-state.h @@ -74,6 +74,7 @@ void blk_detach_dev(BlockBackend *blk, DeviceState *dev); DeviceState *blk_get_attached_dev(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 *opaq= ue); =20 void blk_activate(BlockBackend *blk, Error **errp); --=20 2.34.1 From nobody Sun Nov 24 23:55:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1719402930; cv=none; d=zohomail.com; s=zohoarc; b=XazhrsOIYk0/U8cN9jxDqq+eba2eo7syz3IL796YLsjF5XIwIhohBjVJsnsOYeH7fOQ0lEZuU8AABxfVfIJiywNFW5y68TQ0ayXhOrT2cbJJqoE7fsEmmrqi88tTs7hfcbkUv8ebj1sbYoBEziYJwp+5zXv1b0oo0brlgl5iXyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719402930; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/pnmAqrbOXFL3OPHCDjHkuJp9TZyJdxaMJV1Ci8Hhq0=; b=gq/FwCMN38IOgFtL6/TAFDW1n4ZLMCVEnHQgHFnsLsn5MCR5q5onvaZO83goY4oqMUMGjhn6Hb+afABxA8FgG1myFGeLb/oN3e47sh93XefWSb29AOhYTTAh/cAA+t3b4vevQsa6vIPBYYeBCFGx0Ig9Nneg1el86N4u6mn+PwI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 171940293058381.81485921087699; Wed, 26 Jun 2024 04:55:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMREC-0006Ks-DQ; Wed, 26 Jun 2024 07:54:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMREB-0006KW-8F; Wed, 26 Jun 2024 07:54:19 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMRE4-0007Hi-U5; Wed, 26 Jun 2024 07:54:19 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c1f:6401:0:640:7e6f:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 4D9A060E2D; Wed, 26 Jun 2024 14:54:10 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id prOe6Z0rMmI0-VYC6R2g3; Wed, 26 Jun 2024 14:54:09 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719402849; bh=/pnmAqrbOXFL3OPHCDjHkuJp9TZyJdxaMJV1Ci8Hhq0=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=OArfMQVkPkfaBl9LT7bfNaSMuA+5jJTNC/HaEEU+I2TiHKedpRCB+CigHJQ1rl3n/ SJ+UGYHfX9yntk73eG1NuKdA/hrxrxrVIr9QziUHNDkjujZVf1ThLoMi7s9JO+Uthv mMw4YiEOPSQ4puXEVczZLPzobpkEmMUuIal1z3Ds= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, armbru@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH v9 3/7] block: make bdrv_find_child() function public Date: Wed, 26 Jun 2024 14:53:46 +0300 Message-Id: <20240626115350.405778-4-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626115350.405778-1-vsementsov@yandex-team.ru> References: <20240626115350.405778-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1719402932673100007 Content-Type: text/plain; charset="utf-8" To be reused soon for blockdev-replace functionality. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 13 +++++++++++++ blockdev.c | 14 -------------- include/block/block_int-io.h | 2 ++ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/block.c b/block.c index 468cf5e67d..f6292f459a 100644 --- a/block.c +++ b/block.c @@ -8174,6 +8174,19 @@ int bdrv_make_empty(BdrvChild *c, Error **errp) return 0; } =20 +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) =3D=3D 0) { + return child; + } + } + + return NULL; +} + /* * Return the child that @bs acts as an overlay for, and from which data m= ay be * copied in COW or COR operations. Usually this is the backing file. diff --git a/blockdev.c b/blockdev.c index 835064ed03..ba7e90b06e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3452,20 +3452,6 @@ void qmp_blockdev_del(const char *node_name, Error *= *errp) bdrv_unref(bs); } =20 -static BdrvChild * GRAPH_RDLOCK -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) =3D=3D 0) { - return child; - } - } - - return NULL; -} - void qmp_x_blockdev_change(const char *parent, const char *child, const char *node, Error **errp) { diff --git a/include/block/block_int-io.h b/include/block/block_int-io.h index 4a7cf2b4fd..11ed4aa927 100644 --- a/include/block/block_int-io.h +++ b/include/block/block_int-io.h @@ -130,6 +130,8 @@ bdrv_co_refresh_total_sectors(BlockDriverState *bs, int= 64_t hint); int co_wrapper_mixed_bdrv_rdlock bdrv_refresh_total_sectors(BlockDriverState *bs, int64_t hint); =20 +BdrvChild * GRAPH_RDLOCK +bdrv_find_child(BlockDriverState *parent_bs, const char *child_name); BdrvChild * GRAPH_RDLOCK bdrv_cow_child(BlockDriverState *bs); BdrvChild * GRAPH_RDLOCK bdrv_filter_child(BlockDriverState *bs); BdrvChild * GRAPH_RDLOCK bdrv_filter_or_cow_child(BlockDriverState *bs); --=20 2.34.1 From nobody Sun Nov 24 23:55:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1719402946; cv=none; d=zohomail.com; s=zohoarc; b=Sh0mRQoUMvy5fDM/X1k2LuAGe05e26Lzln3yWHZJVDQNmw6IVEHrz1spD2i/Mis4HbwfA2T47ViVWNH0cBByK9l71dn2fOTz0e0WxdX3/PGn1PZX76mn5rDVEyBvlqzNFr6ul1nUpWoz4L8UabxnsNjbybwn7BzeX2dVoYko8p4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719402946; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mAvKysM9hVI3qWf9FNyafptShcrEuJSSk1u+6XLCCAA=; b=PdvlBkkczGpOroOR7JvmcRre9RazqrfMM8gk764I8K6PpaGN2WP/MELQb9TnwQ9VPVpB2WxQpMX/J763W17AnsDEGMrE5AwEhBBoMZSOWV+Ha1Ufi1rgslvxybhflyS4Ha+AnN4fuZxOoYei0KfnYlF2AbBgMtdGRA/K0cqh8kI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719402946979722.9947134033173; Wed, 26 Jun 2024 04:55:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMREK-0006Na-Or; Wed, 26 Jun 2024 07:54:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMREI-0006N5-Lw; Wed, 26 Jun 2024 07:54:26 -0400 Received: from forwardcorp1a.mail.yandex.net ([2a02:6b8:c0e:500:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMRE5-0007Hn-Ar; Wed, 26 Jun 2024 07:54:26 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c1f:6401:0:640:7e6f:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 13CAB60E30; Wed, 26 Jun 2024 14:54:11 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id prOe6Z0rMmI0-0kNMdzqs; Wed, 26 Jun 2024 14:54:10 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719402850; bh=mAvKysM9hVI3qWf9FNyafptShcrEuJSSk1u+6XLCCAA=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=UobI6RmXiJ4FugewmggHVszZRS5RYCVLwKNO8IqoO+Xu2oiCRJ4/+JuH8CSv3b63M lCd91voPHTXluRLvvcFgRHnHpIvTMKK2ArxFwqP+01ZW+TedY5X4LrxzosGuCICqVf z6mqBpIfdv+5fzlFGLXJfF66uW4m6D5Ex6GnVvRA= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, armbru@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH v9 4/7] qapi: add blockdev-replace command Date: Wed, 26 Jun 2024 14:53:47 +0300 Message-Id: <20240626115350.405778-5-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626115350.405778-1-vsementsov@yandex-team.ru> References: <20240626115350.405778-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a02:6b8:c0e:500:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1719402948106100003 Content-Type: text/plain; charset="utf-8" Add a command that can replace bs in following BdrvChild structures: - qdev blk root child - block-export blk root child - any child of BlockDriverState selected by child-name Signed-off-by: Vladimir Sementsov-Ogievskiy --- blockdev.c | 56 +++++++++++++++++++++++++++ qapi/block-core.json | 88 ++++++++++++++++++++++++++++++++++++++++++ stubs/blk-by-qdev-id.c | 13 +++++++ stubs/meson.build | 1 + 4 files changed, 158 insertions(+) create mode 100644 stubs/blk-by-qdev-id.c diff --git a/blockdev.c b/blockdev.c index ba7e90b06e..2190467022 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3559,6 +3559,62 @@ void qmp_x_blockdev_set_iothread(const char *node_na= me, StrOrNull *iothread, bdrv_try_change_aio_context(bs, new_context, NULL, errp); } =20 +void qmp_blockdev_replace(BlockdevReplace *repl, Error **errp) +{ + BdrvChild *child =3D NULL; + BlockDriverState *new_child_bs; + + if (repl->parent_type =3D=3D BLOCK_PARENT_TYPE_DRIVER) { + BlockDriverState *parent_bs; + + parent_bs =3D 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; + } + + child =3D 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; + } + } else { + /* Other types are similar, they work through blk */ + BlockBackend *blk; + bool is_qdev =3D repl->parent_type =3D=3D BLOCK_PARENT_TYPE_QDEV; + const char *id =3D + is_qdev ? repl->u.qdev.qdev_id : repl->u.export.export_id; + + assert(is_qdev || repl->parent_type =3D=3D BLOCK_PARENT_TYPE_EXPOR= T); + + blk =3D is_qdev ? blk_by_qdev_id(id, errp) : blk_by_export_id(id, = errp); + if (!blk) { + return; + } + + child =3D blk_root(blk); + if (!child) { + error_setg(errp, "%s '%s' is empty, nothing to replace", + is_qdev ? "Device" : "Export", id); + return; + } + } + + assert(child); + assert(child->bs); + + new_child_bs =3D bdrv_find_node(repl->new_child); + if (!new_child_bs) { + error_setg(errp, "Node '%s' not found", repl->new_child); + return; + } + + bdrv_replace_child_bs(child, new_child_bs, errp); +} + QemuOptsList qemu_common_drive_opts =3D { .name =3D "drive", .head =3D QTAILQ_HEAD_INITIALIZER(qemu_common_drive_opts.head), diff --git a/qapi/block-core.json b/qapi/block-core.json index df5e07debd..0a6f08a6e0 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -6148,3 +6148,91 @@ ## { 'struct': 'DummyBlockCoreForceArrays', 'data': { 'unused-block-graph-info': ['BlockGraphInfo'] } } + +## +# @BlockParentType: +# +# @qdev: block device, such as created by device_add, and denoted by +# qdev-id +# +# @driver: block driver node, such as created by blockdev-add, and +# denoted by node-name +# +# @export: block export, such created by block-export-add, and +# denoted by export-id +# +# Since 9.1 +## +{ 'enum': 'BlockParentType', + 'data': ['qdev', 'driver', 'export'] } + +## +# @BdrvChildRefQdev: +# +# @qdev-id: the device's ID or QOM path +# +# Since 9.1 +## +{ 'struct': 'BdrvChildRefQdev', + 'data': { 'qdev-id': 'str' } } + +## +# @BdrvChildRefExport: +# +# @export-id: block export identifier +# +# Since 9.1 +## +{ 'struct': 'BdrvChildRefExport', + 'data': { 'export-id': 'str' } } + +## +# @BdrvChildRefDriver: +# +# @node-name: the node name of the parent block node +# +# @child: name of the child to be replaced, like "file" or "backing" +# +# Since 9.1 +## +{ 'struct': 'BdrvChildRefDriver', + 'data': { 'node-name': 'str', 'child': 'str' } } + +## +# @BlockdevReplace: +# +# @parent-type: type of the parent, which child is to be replaced +# +# @new-child: new child for replacement +# +# Since 9.1 +## +{ 'union': 'BlockdevReplace', + 'base': { + 'parent-type': 'BlockParentType', + 'new-child': 'str' + }, + 'discriminator': 'parent-type', + 'data': { + 'qdev': 'BdrvChildRefQdev', + 'export': 'BdrvChildRefExport', + 'driver': 'BdrvChildRefDriver' + } } + +## +# @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. +# +# Features: +# +# @unstable: This command is experimental. +# +# Since 9.1 +## +{ 'command': 'blockdev-replace', 'boxed': true, + 'features': [ 'unstable' ], + 'data': 'BlockdevReplace' } diff --git a/stubs/blk-by-qdev-id.c b/stubs/blk-by-qdev-id.c new file mode 100644 index 0000000000..5ec9f755ee --- /dev/null +++ b/stubs/blk-by-qdev-id.c @@ -0,0 +1,13 @@ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "sysemu/block-backend.h" + +BlockBackend *blk_by_qdev_id(const char *id, Error **errp) +{ + /* + * We expect this when blockdev-change is called with parent-type=3Dqd= ev, + * but qdev-monitor is not linked in. So no blk_ API is not available. + */ + error_setg(errp, "Parameter 'parent-type' does not accept value 'qdev'= "); + return NULL; +} diff --git a/stubs/meson.build b/stubs/meson.build index 772a3e817d..068998c1a5 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -15,6 +15,7 @@ if have_block 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('get-vm-name.c')) --=20 2.34.1 From nobody Sun Nov 24 23:55:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1719402931; cv=none; d=zohomail.com; s=zohoarc; b=dUPHWmEyWq9vjBKBPk2S2hDWfEMbO1y0QEOvHp2NLLmpuLHkTAghwoJamkXveSbk92URX/fk5gxx4U0T00Q3vEZ1U5xX8rIHK7rwVBcyjnDVLMag2oD57Hqm38DeiTx0RuAdVjEc+Y8Ezl5jEnf3O/c6nMXAWlJ6c31RbXUTShg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719402931; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=I+QF3fGvYELrEM7l+N59iHJKrQZhPHPzowmp1e2a5tw=; b=ejnwFRrnFHqaHxK2rEBtRdXS5qrxCT7k0kEaKnIV1TMBsr+ZU/8FVkH6Uf1rVR6rrBHCFSMTr69W5h0FewWD1LG8/dSR+67o9HAZNeZNLlAV6F1FbMPdGv5zbV/jZIMVRbvbcO/IxC9QdOVgYSvmUCYuDxwyJTctcxoHzk7hLCI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719402931172705.3427110160792; Wed, 26 Jun 2024 04:55:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMREL-0006OC-KN; Wed, 26 Jun 2024 07:54:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMREJ-0006NH-Am; Wed, 26 Jun 2024 07:54:27 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMRE5-0007Hx-DY; Wed, 26 Jun 2024 07:54:27 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c1f:6401:0:640:7e6f:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id C73EA60E31; Wed, 26 Jun 2024 14:54:11 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id prOe6Z0rMmI0-mrNAPsry; Wed, 26 Jun 2024 14:54:11 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719402851; bh=I+QF3fGvYELrEM7l+N59iHJKrQZhPHPzowmp1e2a5tw=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=Az1t7s2xJXSNg2ThBBYNl5LD5KkoPWZoz2woraYmqbv6rHNWRIjzPLJN1J5R4wud2 AofZ5WdXYGgkoNRpfIPRVvQ7rnSTPzsC409/UL523D5t8lCr+Gq/K/99XBzQ/kwXJc pMT+kaSqV5LrZxzTsc0sRM9IwP3ZopynXSqTQxzg= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, armbru@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH v9 5/7] block: bdrv_get_xdbg_block_graph(): report export ids Date: Wed, 26 Jun 2024 14:53:48 +0300 Message-Id: <20240626115350.405778-6-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626115350.405778-1-vsementsov@yandex-team.ru> References: <20240626115350.405778-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1719402932676100008 Content-Type: text/plain; charset="utf-8" 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 --- block.c | 4 ++++ block/export/export.c | 13 +++++++++++++ include/block/export.h | 1 + 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/block.c b/block.c index f6292f459a..601475e835 100644 --- a/block.c +++ b/block.c @@ -6326,7 +6326,11 @@ XDbgBlockGraph *bdrv_get_xdbg_block_graph(Error **er= rp) for (blk =3D blk_all_next(NULL); blk; blk =3D blk_all_next(blk)) { char *allocated_name =3D NULL; const char *name =3D blk_name(blk); + BlockExport *exp =3D blk_exp_find_by_blk(blk); =20 + if (!*name && exp) { + name =3D exp->id; + } if (!*name) { name =3D allocated_name =3D blk_get_attached_dev_id(blk); } diff --git a/block/export/export.c b/block/export/export.c index 57beae7982..8744a1171e 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -60,6 +60,19 @@ BlockExport *blk_exp_find(const char *id) return NULL; } =20 +BlockExport *blk_exp_find_by_blk(BlockBackend *blk) +{ + BlockExport *exp; + + QLIST_FOREACH(exp, &block_exports, next) { + if (exp->blk =3D=3D blk) { + return exp; + } + } + + return NULL; +} + static const BlockExportDriver *blk_exp_find_driver(BlockExportType type) { int i; diff --git a/include/block/export.h b/include/block/export.h index f2fe0f8078..16863d37cf 100644 --- a/include/block/export.h +++ b/include/block/export.h @@ -82,6 +82,7 @@ struct BlockExport { =20 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/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 068998c1a5..cbe30f94e8 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -16,6 +16,7 @@ if have_block 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('get-vm-name.c')) --=20 2.34.1 From nobody Sun Nov 24 23:55:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1719402975; cv=none; d=zohomail.com; s=zohoarc; b=d//SGOh37XNvZiINTDjaBH8CLRHb1nWR3Qo5HyIyNLZkWldiKW2cetPnUxZBPLG8HYUf8FeR81q0qoKGJWeUdZ89igFu7tpHxvJVOEmdzIDPw3IhNCvoYIYjfxN6qlKJaTaneIyIY1ecuvAJQqCi++H+7aYW+pIFYQOJlWsuZmw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719402975; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qvWYqS4f2DNusvrY+jo8XyNuToSaQtroc57GXqvMQw8=; b=N129hSn1NO2TNLNKJlHw584a2YKcw+vRSjDF7OpJ50seke/GeTNbj8U+kmmTOw5YlV0abcA9Yj8SNvCwFKKOOZdUYusnAdnQ7N79Wv+0xZPw/+TNkRsP3Ab8xLQatBPwE/6H7fA+g/8FK5z1tcla6xvwOk5XI90fVEf54zgrHDs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719402975428540.5261233319775; Wed, 26 Jun 2024 04:56:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMREA-0006KM-TD; Wed, 26 Jun 2024 07:54:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMRE8-0006Io-Km; Wed, 26 Jun 2024 07:54:16 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMRE6-0007I7-39; Wed, 26 Jun 2024 07:54:16 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c1f:6401:0:640:7e6f:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 7582A60DF8; Wed, 26 Jun 2024 14:54:12 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id prOe6Z0rMmI0-MJCzt2oG; Wed, 26 Jun 2024 14:54:11 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719402852; bh=qvWYqS4f2DNusvrY+jo8XyNuToSaQtroc57GXqvMQw8=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=n0BMhm/yJ74iLHjocigXeMvme2zmvARNuQVk7um02dpVTlJ4mLCfprYFlm2pUoRW/ 7c/VZOkKRR04elKp15TOYhAU1WeGzKl9M80PmQTrtwfT5imphIfcNyCm8R7c5Tbdi1 AubIatTAn0kWvuy9ABjEOgA/b9yg7elmuFE3hnHc= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, armbru@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH v9 6/7] iotests.py: introduce VM.assert_edges_list() method Date: Wed, 26 Jun 2024 14:53:49 +0300 Message-Id: <20240626115350.405778-7-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626115350.405778-1-vsementsov@yandex-team.ru> References: <20240626115350.405778-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1719402976319100002 Content-Type: text/plain; charset="utf-8" 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 ea48af4a7b..8a5fd01eac 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1108,6 +1108,23 @@ def check_bitmap_status(self, node_name, bitmap_name= , fields): =20 return fields.items() <=3D ret.items() =20 + def get_block_graph(self): + """ + Returns block graph in form of edges list, where each edge is a tu= ple: + (parent_node_name, child_name, child_node_name) + """ + graph =3D self.qmp('x-debug-query-block-graph')['return'] + + nodes =3D {n['id']: n['name'] for n in graph['nodes']} + # Check that all names are unique: + assert len(set(nodes.values())) =3D=3D 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) =3D=3D sorted(self.get_block_graph()) + def assert_block_path(self, root, path, expected_node, graph=3DNone): """ Check whether the node under the given path in the block graph --=20 2.34.1 From nobody Sun Nov 24 23:55:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1719402947; cv=none; d=zohomail.com; s=zohoarc; b=PJOoK3jj4giMwS67fWHqLvf79728aJ1NhIzS4QI2Tydnvy/T8mjIVm7SAzJd7mt/qCjiNmkcTAPNPiUTtb3J7U3jB3rT8KuCnfaKv8SS0P+3ESrNUGe3w31sGeFdhfprhRmSwrJ7+LW54uTWohjdcv8vlxyQoe49zQ3rrKwxypI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719402947; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fSQRoBzjhgoDrc00kC26HOrCVdxQAb1MOa8uUFy8syc=; b=ny7UEgwIQ2trrO1fGBQvfHqKG2KyohQO79QIXQltvKqYuEhvTAEvEz3+EOclrPzJIm6vr/Sm8eJ9j9rLnmuTTzbFyJPy86Fs027uy84DXk/O9RRGVhPDEDQo3h6df2qHhoLyG8pLhbBdoSPhpJjIJlO9+UChidelsn+tVx2oI/k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719402947635530.0978132138033; Wed, 26 Jun 2024 04:55:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMREH-0006Mq-42; Wed, 26 Jun 2024 07:54:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMREE-0006Lz-5a; Wed, 26 Jun 2024 07:54:22 -0400 Received: from forwardcorp1a.mail.yandex.net ([178.154.239.72]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMRE7-0007IL-4r; Wed, 26 Jun 2024 07:54:21 -0400 Received: from mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net [IPv6:2a02:6b8:c1f:6401:0:640:7e6f:0]) by forwardcorp1a.mail.yandex.net (Yandex) with ESMTPS id 6CD0660E2C; Wed, 26 Jun 2024 14:54:13 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6b8:b081:b645::1:29]) by mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id prOe6Z0rMmI0-d469pGrj; Wed, 26 Jun 2024 14:54:12 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1719402852; bh=fSQRoBzjhgoDrc00kC26HOrCVdxQAb1MOa8uUFy8syc=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=xQIOOjwsjyIdzeueTFPccoIBGikRydQfacuztRhjzu4dnQobWK/d1VKwtYY9s2lo6 XRneVYrrBro+3qDPEDMFQJLsLD2gQylFmErfIW8b2Se6RcT5h3tAVgj5XNOLl1VKJm XBfge6sG7EFc9SDfdCl1rsv+2Fhi2bZ5IVBORD54= Authentication-Results: mail-nwsmtp-smtp-corp-main-69.vla.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, armbru@redhat.com, eblake@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH v9 7/7] iotests: add filter-insertion Date: Wed, 26 Jun 2024 14:53:50 +0300 Message-Id: <20240626115350.405778-8-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626115350.405778-1-vsementsov@yandex-team.ru> References: <20240626115350.405778-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.72; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1a.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1719402948113100004 Content-Type: text/plain; charset="utf-8" Demonstrate new blockdev-replace API for filter insertion and removal. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/filter-insertion | 236 ++++++++++++++++++ tests/qemu-iotests/tests/filter-insertion.out | 5 + 2 files changed, 241 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..02a0978f96 --- /dev/null +++ b/tests/qemu-iotests/tests/filter-insertion @@ -0,0 +1,236 @@ +#!/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 =3D os.path.join(iotests.test_dir, 'disk') +sock =3D os.path.join(iotests.sock_dir, 'sock') +size =3D 1024 * 1024 + + +class TestFilterInsertion(iotests.QMPTestCase): + def setUp(self): + qemu_img_create('-f', iotests.imgfmt, disk, str(size)) + + self.vm =3D iotests.VM() + self.vm.launch() + + self.vm.cmd('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 =3D self.vm + + vm.cmd('blockdev-add', { + 'node-name': 'filter', + 'driver': 'blkdebug', + 'image': 'file0' + }) + + vm.cmd('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', 'image', 'file0') + ]) + + vm.cmd('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', 'image', 'file0') + ]) + + vm.cmd('blockdev-del', node_name=3D'filter') + + # Filter removed + # dik0 -file-> file0 + vm.assert_edges_list([ + ('disk0', 'file', 'file0') + ]) + + def test_insert_under_qdev(self): + vm =3D self.vm + + vm.cmd('device_add', driver=3D'virtio-scsi') + vm.cmd('device_add', id=3D'sda', driver=3D'scsi-hd', + drive=3D'disk0') + + vm.cmd('blockdev-add', { + 'node-name': 'filter', + 'driver': 'compress', + 'file': 'disk0' + }) + + vm.cmd('blockdev-replace', { + '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.cmd('blockdev-replace', { + 'parent-type': 'qdev', + 'qdev-id': 'sda', + 'new-child': 'disk0' + }) + vm.cmd('blockdev-del', node_name=3D'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_insert_under_nbd_export(self): + vm =3D self.vm + + vm.cmd('nbd-server-start', + addr=3D{'type': 'unix', 'data': {'path': sock}}) + vm.cmd('block-export-add', id=3D'exp1', type=3D'nbd', + node_name=3D'disk0', name=3D'exp1') + vm.cmd('block-export-add', id=3D'exp2', type=3D'nbd', + node_name=3D'disk0', name=3D'exp2') + vm.cmd('object-add', qom_type=3D'throttle-group', + id=3D'tg', limits=3D{'iops-read': 1}) + + vm.cmd('blockdev-add', { + 'node-name': 'filter', + 'driver': 'throttle', + 'throttle-group': 'tg', + 'file': 'disk0' + }) + + vm.cmd('blockdev-replace', { + '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.cmd('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 =3D vm.qmp('blockdev-del', node_name=3D'filter') + self.assert_qmp(result, 'error/desc', 'Node filter is in use') + + vm.cmd('blockdev-replace', { + 'parent-type': 'export', + 'export-id': 'exp1', + 'new-child': 'disk0' + }) + + vm.cmd('blockdev-replace', { + 'parent-type': 'export', + 'export-id': 'exp2', + 'new-child': 'disk0' + }) + vm.cmd('blockdev-del', node_name=3D'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__ =3D=3D '__main__': + iotests.main( + supported_fmts=3D['qcow2'], + supported_protocols=3D['file'] + ) diff --git a/tests/qemu-iotests/tests/filter-insertion.out b/tests/qemu-iot= ests/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 --=20 2.34.1