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(a)redhat.com>
---
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 73f5e1fa0f..1b6ee3bfa6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31431,6 +31431,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;
+}
+
+
/**
* virDomainGraphicsDefHasOpenGL:
* @def: domain definition
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index c1b5fc1337..2a067633bd 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3611,6 +3611,9 @@ virDomainDiskGetDetectZeroesMode(virDomainDiskDiscard discard,
bool
virDomainDefHasManagedPR(const virDomainDef *def);
+bool
+virDomainDefHasNVMeDisk(const virDomainDef *def);
+
bool
virDomainGraphicsDefHasOpenGL(const virDomainDef *def);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5b7aa58dd8..15bfae115f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -284,6 +284,7 @@ virDomainDefHasDeviceAddress;
virDomainDefHasManagedPR;
virDomainDefHasMemballoon;
virDomainDefHasMemoryHotplug;
+virDomainDefHasNVMeDisk;
virDomainDefHasUSB;
virDomainDefHasVcpusOffline;
virDomainDefLifecycleActionAllowed;
--
2.21.0