This function check if a domain has a RAID as a disk.
This function is useful to block snapshot operations on domain
which contain quorum.
Signed-off-by: Matthias Gatto <matthias.gatto(a)outscale.com>
---
src/conf/domain_conf.c | 13 +++++++++++++
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
3 files changed, 15 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5178e57..69d916d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2573,6 +2573,19 @@ virDomainDefNewFull(const char *name,
}
+bool
+virDomainDefHasRAID(virDomainDefPtr def)
+{
+ size_t i;
+
+ for (i = 0; i < def->ndisks; ++i) {
+ if (virStorageSourceIsRAID(def->disks[i]->src))
+ return true;
+ }
+ return true;
+}
+
+
void virDomainObjAssignDef(virDomainObjPtr domain,
virDomainDefPtr def,
bool live,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 90d8e13..d193ab4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2560,6 +2560,7 @@ void virDomainDefClearPCIAddresses(virDomainDefPtr def);
void virDomainDefClearCCWAddresses(virDomainDefPtr def);
void virDomainDefClearDeviceAliases(virDomainDefPtr def);
void virDomainTPMDefFree(virDomainTPMDefPtr def);
+bool virDomainDefHasRAID(virDomainDefPtr def);
typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def,
virDomainDeviceDefPtr dev,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 571b6f7..a0c1a88 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -219,6 +219,7 @@ virDomainDefGetMemoryInitial;
virDomainDefGetSecurityLabelDef;
virDomainDefHasDeviceAddress;
virDomainDefHasMemoryHotplug;
+virDomainDefHasRAID;
virDomainDefMaybeAddController;
virDomainDefMaybeAddInput;
virDomainDefNeedsPlacementAdvice;
--
2.6.2