mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Enforce WWN to be unique among VM's disks
Operating systems use the identifier to name the disks. As the name suggests the ID should be unique. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1208009
This commit is contained in:
parent
c35b011087
commit
714b38cb23
@ -2453,7 +2453,8 @@
|
|||||||
<dt><code>wwn</code></dt>
|
<dt><code>wwn</code></dt>
|
||||||
<dd>If present, this element specifies the WWN (World Wide Name)
|
<dd>If present, this element specifies the WWN (World Wide Name)
|
||||||
of a virtual hard disk or CD-ROM drive. It must be composed
|
of a virtual hard disk or CD-ROM drive. It must be composed
|
||||||
of 16 hexadecimal digits.
|
of 16 hexadecimal digits and must be unique (at least among
|
||||||
|
disks of a single domain)
|
||||||
<span class='since'>Since 0.10.1</span>
|
<span class='since'>Since 0.10.1</span>
|
||||||
</dd>
|
</dd>
|
||||||
<dt><code>vendor</code></dt>
|
<dt><code>vendor</code></dt>
|
||||||
|
@ -23186,3 +23186,28 @@ virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virDomainDefCheckDuplicateDiskWWN(virDomainDefPtr def)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
size_t j;
|
||||||
|
|
||||||
|
for (i = 0; i < def->ndisks; i++) {
|
||||||
|
if (def->disks[i]->wwn) {
|
||||||
|
for (j = i + 1; j < def->ndisks; j++) {
|
||||||
|
if (STREQ_NULLABLE(def->disks[i]->wwn,
|
||||||
|
def->disks[j]->wwn)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("Disks '%s' and '%s' have identical WWN"),
|
||||||
|
def->disks[i]->dst,
|
||||||
|
def->disks[j]->dst);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -3080,4 +3080,7 @@ virDomainParseMemory(const char *xpath,
|
|||||||
bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
|
bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
|
int virDomainDefCheckDuplicateDiskWWN(virDomainDefPtr def)
|
||||||
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
#endif /* __DOMAIN_CONF_H */
|
#endif /* __DOMAIN_CONF_H */
|
||||||
|
@ -198,6 +198,7 @@ virDomainCpuPlacementModeTypeFromString;
|
|||||||
virDomainCpuPlacementModeTypeToString;
|
virDomainCpuPlacementModeTypeToString;
|
||||||
virDomainDefAddImplicitControllers;
|
virDomainDefAddImplicitControllers;
|
||||||
virDomainDefCheckABIStability;
|
virDomainDefCheckABIStability;
|
||||||
|
virDomainDefCheckDuplicateDiskWWN;
|
||||||
virDomainDefCheckUnsupportedMemoryHotplug;
|
virDomainDefCheckUnsupportedMemoryHotplug;
|
||||||
virDomainDefClearCCWAddresses;
|
virDomainDefClearCCWAddresses;
|
||||||
virDomainDefClearDeviceAliases;
|
virDomainDefClearDeviceAliases;
|
||||||
|
@ -4568,6 +4568,9 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (virDomainDefCheckDuplicateDiskWWN(vm->def) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
/* "volume" type disk's source must be translated before
|
/* "volume" type disk's source must be translated before
|
||||||
* cgroup and security setting.
|
* cgroup and security setting.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user