[PATCH v2 21/39] domain_conf: Introduce virDomainDefHasNVMeDisk

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

 



This function will return true if any of disks (or their backing
chain) for given domain contains an NVMe disk.

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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fe540c195e..98ee1f4058 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31640,6 +31640,20 @@ virDomainDefHasManagedPR(const virDomainDef *def)
 }
 
 
+bool
+virDomainDefHasNVMeDisk(const virDomainDef *def)
+{
+    size_t i;
+
+    for (i = 0; i < def->ndisks; i++) {
+        if (virStorageSourceChainHasNVMe(def->disks[i]->src))
+            return true;
+    }
+
+    return false;
+}
+
+
 bool
 virDomainDefHasVFIOHostdev(const virDomainDef *def)
 {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index bf5d1a154b..ada2c70a8b 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3666,6 +3666,9 @@ virDomainDiskGetDetectZeroesMode(virDomainDiskDiscard discard,
 bool
 virDomainDefHasManagedPR(const virDomainDef *def);
 
+bool
+virDomainDefHasNVMeDisk(const virDomainDef *def);
+
 bool
 virDomainDefHasVFIOHostdev(const virDomainDef *def);
 
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4e2a74a31b..d383dbe929 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -297,6 +297,7 @@ virDomainDefHasManagedPR;
 virDomainDefHasMdevHostdev;
 virDomainDefHasMemballoon;
 virDomainDefHasMemoryHotplug;
+virDomainDefHasNVMeDisk;
 virDomainDefHasUSB;
 virDomainDefHasVcpusOffline;
 virDomainDefHasVFIOHostdev;
-- 
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