[PATCH 4/7] virstoragefile: Introduce virStorageSourceChainGetManagedPRAlias

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When processing a pr-manager related event from qemu we will know
pr-manager alias. So we need a helper to traverse backing chain
and return any managed alias it finds so that the caller can
compare these two aliases to learn if it is a managed helper or
not.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/libvirt_private.syms  |  1 +
 src/util/virstoragefile.c | 14 ++++++++++++++
 src/util/virstoragefile.h |  3 +++
 3 files changed, 18 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 3e304907b9..98ff8a5aa6 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2840,6 +2840,7 @@ virStoragePRDefIsEqual;
 virStoragePRDefIsManaged;
 virStoragePRDefParseXML;
 virStorageSourceBackingStoreClear;
+virStorageSourceChainGetManagedPRAlias;
 virStorageSourceChainHasManagedPR;
 virStorageSourceClear;
 virStorageSourceCopy;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 58f67278da..3f2bca4970 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2041,6 +2041,20 @@ virStorageSourceChainHasManagedPR(virStorageSourcePtr src)
 }
 
 
+const char *
+virStorageSourceChainGetManagedPRAlias(virStorageSourcePtr src)
+{
+    virStorageSourcePtr n;
+
+    for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
+        if (virStoragePRDefIsManaged(src->pr))
+            return src->pr->mgralias;
+    }
+
+    return NULL;
+}
+
+
 virSecurityDeviceLabelDefPtr
 virStorageSourceGetSecurityLabelDef(virStorageSourcePtr src,
                                     const char *model)
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 991098e6c6..eb5b2b2a45 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -404,6 +404,9 @@ bool virStoragePRDefIsManaged(virStoragePRDefPtr prd);
 bool
 virStorageSourceChainHasManagedPR(virStorageSourcePtr src);
 
+const char *
+virStorageSourceChainGetManagedPRAlias(virStorageSourcePtr src);
+
 virSecurityDeviceLabelDefPtr
 virStorageSourceGetSecurityLabelDef(virStorageSourcePtr src,
                                     const char *model);
-- 
2.16.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux