From nobody Mon Feb 9 03:31:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1527787868725105.51414604249487; Thu, 31 May 2018 10:31:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D45673159739; Thu, 31 May 2018 17:31:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B8CC608EF; Thu, 31 May 2018 17:31:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 606A31800C9D; Thu, 31 May 2018 17:31:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4VHUcYZ030241 for ; Thu, 31 May 2018 13:30:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83224208C6C2; Thu, 31 May 2018 17:30:38 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27DA9208C6C1 for ; Thu, 31 May 2018 17:30:38 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 31 May 2018 19:30:22 +0200 Message-Id: <964e21ccd18027d0ff1228758d34c56c43f220eb.1527787717.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/4] util: storage: Add helper for determining whether a backing chain requires PR X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 31 May 2018 17:31:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" With blockdev support we will need to introspect whether any of the backing chain members requires PR rather just one of them. Add a helper and reuse it in virDomainDefHasManagedPR. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- src/conf/domain_conf.c | 2 +- src/libvirt_private.syms | 1 + src/util/virstoragefile.c | 14 ++++++++++++++ src/util/virstoragefile.h | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bfe863d76d..be78d388df 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29928,7 +29928,7 @@ virDomainDefHasManagedPR(const virDomainDef *def) size_t i; for (i =3D 0; i < def->ndisks; i++) { - if (virStoragePRDefIsManaged(def->disks[i]->src->pr)) + if (virStorageSourceChainHasManagedPR(def->disks[i]->src)) return true; } diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6001635916..68a1056f83 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2813,6 +2813,7 @@ virStoragePRDefIsEqual; virStoragePRDefIsManaged; virStoragePRDefParseXML; virStorageSourceBackingStoreClear; +virStorageSourceChainHasManagedPR; virStorageSourceClear; virStorageSourceCopy; virStorageSourceFindByNodeName; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 54de2c1c30..6c71d0cdf9 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2025,6 +2025,20 @@ virStoragePRDefIsManaged(virStoragePRDefPtr prd) } +bool +virStorageSourceChainHasManagedPR(virStorageSourcePtr src) +{ + virStorageSourcePtr n; + + for (n =3D src; virStorageSourceIsBacking(n); n =3D n->backingStore) { + if (virStoragePRDefIsManaged(src->pr)) + return true; + } + + return false; +} + + virSecurityDeviceLabelDefPtr virStorageSourceGetSecurityLabelDef(virStorageSourcePtr src, const char *model) diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 1631c4cf66..b1ff5142fb 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -401,6 +401,9 @@ bool virStoragePRDefIsEqual(virStoragePRDefPtr a, virStoragePRDefPtr b); bool virStoragePRDefIsManaged(virStoragePRDefPtr prd); +bool +virStorageSourceChainHasManagedPR(virStorageSourcePtr src); + virSecurityDeviceLabelDefPtr virStorageSourceGetSecurityLabelDef(virStorageSourcePtr src, const char *model); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list