Rename the function to virDomainDefCheckDuplicateDiskInfo and make it
check disk serials too.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1245013
---
src/conf/domain_conf.c | 17 ++++++++++++++---
src/conf/domain_conf.h | 2 +-
src/libvirt_private.syms | 2 +-
src/qemu/qemu_process.c | 2 +-
4 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 393ece7..29e55f2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24451,15 +24451,16 @@ virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
int
-virDomainDefCheckDuplicateDiskWWN(virDomainDefPtr def)
+virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
{
size_t i;
size_t j;
for (i = 0; i < def->ndisks; i++) {
- if (def->disks[i]->wwn) {
+ if (def->disks[i]->wwn || def->disks[i]->serial) {
for (j = i + 1; j < def->ndisks; j++) {
- if (STREQ_NULLABLE(def->disks[i]->wwn,
+ if (def->disks[i]->wwn &&
+ STREQ_NULLABLE(def->disks[i]->wwn,
def->disks[j]->wwn)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Disks '%s' and '%s' have
identical WWN"),
@@ -24467,6 +24468,16 @@ virDomainDefCheckDuplicateDiskWWN(virDomainDefPtr def)
def->disks[j]->dst);
return -1;
}
+
+ if (def->disks[i]->serial &&
+ STREQ_NULLABLE(def->disks[i]->serial,
+ def->disks[j]->serial)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Disks '%s' and '%s' have
identical serial"),
+ def->disks[i]->dst,
+ def->disks[j]->dst);
+ return -1;
+ }
}
}
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a101e2a..fd4ef82 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3219,7 +3219,7 @@ virDomainParseMemory(const char *xpath,
bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
ATTRIBUTE_NONNULL(1);
-int virDomainDefCheckDuplicateDiskWWN(virDomainDefPtr def)
+int virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
ATTRIBUTE_NONNULL(1);
#endif /* __DOMAIN_CONF_H */
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c87efa1..c1b7b87 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -200,7 +200,7 @@ virDomainCpuPlacementModeTypeFromString;
virDomainCpuPlacementModeTypeToString;
virDomainDefAddImplicitControllers;
virDomainDefCheckABIStability;
-virDomainDefCheckDuplicateDiskWWN;
+virDomainDefCheckDuplicateDiskInfo;
virDomainDefCheckUnsupportedMemoryHotplug;
virDomainDefClearCCWAddresses;
virDomainDefClearDeviceAliases;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9c107bd..8cd713f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4629,7 +4629,7 @@ int qemuProcessStart(virConnectPtr conn,
}
if (!migrateFrom && !snapshot &&
- virDomainDefCheckDuplicateDiskWWN(vm->def) < 0)
+ virDomainDefCheckDuplicateDiskInfo(vm->def) < 0)
goto cleanup;
/* "volume" type disk's source must be translated before
--
2.4.5