提交 4f1324aa 编写于 作者: P Peter Krempa

qemu: hotplug: Check duplicate disk serial/wwn on hotplug too

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.
上级 e76a848e
......@@ -23988,7 +23988,7 @@ virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
}
static int
int
virDomainDiskDefCheckDuplicateInfo(virDomainDiskDefPtr a,
virDomainDiskDefPtr b)
{
......
......@@ -3153,6 +3153,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);
......
......@@ -257,6 +257,7 @@ virDomainDiskByName;
virDomainDiskCacheTypeFromString;
virDomainDiskCacheTypeToString;
virDomainDiskDefAssignAddress;
virDomainDiskDefCheckDuplicateInfo;
virDomainDiskDefDstDuplicates;
virDomainDiskDefForeachPath;
virDomainDiskDefFree;
......
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册