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(a)redhat.com>
---
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 bc6583562a..5b7aa58dd8 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2994,6 +2994,7 @@ virStoragePRDefIsManaged;
virStoragePRDefParseXML;
virStorageSourceBackingStoreClear;
virStorageSourceChainHasManagedPR;
+virStorageSourceChainHasNVMe;
virStorageSourceClear;
virStorageSourceCopy;
virStorageSourceFindByNodeName;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 18aa33fe05..a9ceb697cf 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2157,6 +2157,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 a1294ea608..8afd5d60cb 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -431,6 +431,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