[PATCH v2 20/39] virstoragefile: Introduce virStorageSourceChainHasNVMe

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

 



This function will return true if there's a storage source of
type VIR_STORAGE_TYPE_NVME, or false otherwise.

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

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 91b03afb17..4e2a74a31b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3024,6 +3024,7 @@ virStoragePRDefIsManaged;
 virStoragePRDefParseXML;
 virStorageSourceBackingStoreClear;
 virStorageSourceChainHasManagedPR;
+virStorageSourceChainHasNVMe;
 virStorageSourceClear;
 virStorageSourceCopy;
 virStorageSourceFindByNodeName;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 725d68a248..093d2403de 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2161,6 +2161,20 @@ virStorageSourceNVMeDefFree(virStorageSourceNVMeDefPtr def)
 }
 
 
+bool
+virStorageSourceChainHasNVMe(const virStorageSource *src)
+{
+    const virStorageSource *n;
+
+    for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
+        if (n->type == VIR_STORAGE_TYPE_NVME)
+            return true;
+    }
+
+    return false;
+}
+
+
 virSecurityDeviceLabelDefPtr
 virStorageSourceGetSecurityLabelDef(virStorageSourcePtr src,
                                     const char *model)
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 9e79c7c6ef..306f84b383 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -433,6 +433,8 @@ virStorageSourceChainHasManagedPR(virStorageSourcePtr src);
 void virStorageSourceNVMeDefFree(virStorageSourceNVMeDefPtr def);
 VIR_DEFINE_AUTOPTR_FUNC(virStorageSourceNVMeDef, virStorageSourceNVMeDefFree);
 
+bool virStorageSourceChainHasNVMe(const virStorageSource *src);
+
 virSecurityDeviceLabelDefPtr
 virStorageSourceGetSecurityLabelDef(virStorageSourcePtr src,
                                     const char *model);
-- 
2.21.0

--
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