mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu: prefer the PCI bus alias from status XML
For some corner cases, virQEMUCapsHasPCIMultiBus depends on the QEMU
version, which is by design not stored in the status XML and therefore
it cannot be fixed for all existing running domains.
Prefer the controller alias read from the status XML when formatting
PCI addresses and only fall back to using virQEMUCapsHasPCIMultiBus
if the alias is a user alias.
This fixes hotplug after daemon restart for domains not using user
aliases.
Partially reverts commit 937f3195
.
https://bugzilla.redhat.com/show_bug.cgi?id=1518148
This commit is contained in:
parent
309cd46b40
commit
dacfc6b10b
@ -318,29 +318,31 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
|
||||
|
||||
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
|
||||
cont->idx == info->addr.pci.bus) {
|
||||
contAlias = cont->info.alias;
|
||||
contIsPHB = virDomainControllerIsPSeriesPHB(cont);
|
||||
contTargetIndex = cont->opts.pciopts.targetIndex;
|
||||
|
||||
/* When domain has builtin pci-root controller we don't put it
|
||||
* onto cmd line. Therefore we can't set its alias. In that
|
||||
* case, use the default one. */
|
||||
if (!qemuDomainIsPSeries(domainDef) &&
|
||||
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) {
|
||||
if (virQEMUCapsHasPCIMultiBus(qemuCaps, domainDef))
|
||||
contAlias = "pci.0";
|
||||
else
|
||||
contAlias = "pci";
|
||||
} else if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) {
|
||||
contAlias = "pcie.0";
|
||||
} else {
|
||||
contAlias = cont->info.alias;
|
||||
if (!contAlias) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Device alias was not set for PCI "
|
||||
"controller with index %u required "
|
||||
"for device at address %s"),
|
||||
info->addr.pci.bus, devStr);
|
||||
goto cleanup;
|
||||
if (!contAlias) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Device alias was not set for PCI "
|
||||
"controller with index %u required "
|
||||
"for device at address %s"),
|
||||
info->addr.pci.bus, devStr);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virDomainDeviceAliasIsUserAlias(contAlias)) {
|
||||
/* When domain has builtin pci-root controller we don't put it
|
||||
* onto cmd line. Therefore we can't set its alias. In that
|
||||
* case, use the default one. */
|
||||
if (!qemuDomainIsPSeries(domainDef) &&
|
||||
cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) {
|
||||
if (virQEMUCapsHasPCIMultiBus(qemuCaps, domainDef))
|
||||
contAlias = "pci.0";
|
||||
else
|
||||
contAlias = "pci";
|
||||
} else if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) {
|
||||
contAlias = "pcie.0";
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user