We do the check on VM start, but the user could still hotplug a disk
with a conflicting serial or WWN. Reuse the checker function to fix the
issue.
---
src/conf/domain_conf.c | 2 +-
src/conf/domain_conf.h | 3 +++
src/libvirt_private.syms | 1 +
src/qemu/qemu_hotplug.c | 3 +++
4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2ef6609..8a7a989 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -23920,7 +23920,7 @@ virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
}
-static int
+int
virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
virDomainDiskDefPtr b)
{
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9fdfdf2..cbf01bf 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3144,6 +3144,9 @@ virDomainParseMemory(const char *xpath,
bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
ATTRIBUTE_NONNULL(1);
+int virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
+ virDomainDiskDefPtr b)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int virDomainDefCheckDuplicateDiskInfo(virDomainDefPtr def)
ATTRIBUTE_NONNULL(1);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 69be352..bf25473 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -256,6 +256,7 @@ virDomainDiskByName;
virDomainDiskCacheTypeFromString;
virDomainDiskCacheTypeToString;
virDomainDiskDefAssignAddress;
+virDomainDiskDefCheckDuplicateInfo;
virDomainDiskDefDstDuplicates;
virDomainDiskDefForeachPath;
virDomainDiskDefFree;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 2e5cf64..18a5a12 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -799,6 +799,9 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
_("target %s already exists"), disk->dst);
goto cleanup;
}
+
+ if (virDomainDiskDefCheckDuplicateInfo(vm->def->disks[i], disk) <
0)
+ goto cleanup;
}
switch ((virDomainDiskBus) disk->bus) {
--
2.6.2