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 | 15 ++++++++++++++-
src/conf/domain_conf.h | 2 +-
src/libvirt_private.syms | 2 +-
src/qemu/qemu_process.c | 2 +-
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 393ece7..e9d61db 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24451,7 +24451,7 @@ virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
int
-virDomainDefCheckDuplicateDiskWWN(virDomainDefPtr def)
+virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
{
size_t i;
size_t j;
@@ -24469,6 +24469,19 @@ virDomainDefCheckDuplicateDiskWWN(virDomainDefPtr def)
}
}
}
+
+ if (def->disks[i]->serial) {
+ for (j = i + 1; j < def->ndisks; j++) {
+ if (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;
+ }
+ }
+ }
}
return 0;
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