|
|
c1c534 |
From 2e8ff390a9ee06b68a2591c761d185539beb49d4 Mon Sep 17 00:00:00 2001
|
|
|
c1c534 |
Message-Id: <2e8ff390a9ee06b68a2591c761d185539beb49d4@dist-git>
|
|
|
c1c534 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
c1c534 |
Date: Thu, 30 Nov 2017 17:45:58 +0100
|
|
|
c1c534 |
Subject: [PATCH] qemu: prefer the PCI bus alias from status XML
|
|
|
c1c534 |
MIME-Version: 1.0
|
|
|
c1c534 |
Content-Type: text/plain; charset=UTF-8
|
|
|
c1c534 |
Content-Transfer-Encoding: 8bit
|
|
|
c1c534 |
|
|
|
c1c534 |
For some corner cases, virQEMUCapsHasPCIMultiBus depends on the QEMU
|
|
|
c1c534 |
version, which is by design not stored in the status XML and therefore
|
|
|
c1c534 |
it cannot be fixed for all existing running domains.
|
|
|
c1c534 |
|
|
|
c1c534 |
Prefer the controller alias read from the status XML when formatting
|
|
|
c1c534 |
PCI addresses and only fall back to using virQEMUCapsHasPCIMultiBus
|
|
|
c1c534 |
if the alias is a user alias.
|
|
|
c1c534 |
|
|
|
c1c534 |
This fixes hotplug after daemon restart for domains not using user
|
|
|
c1c534 |
aliases.
|
|
|
c1c534 |
|
|
|
c1c534 |
Partially reverts commit 937f3195.
|
|
|
c1c534 |
|
|
|
c1c534 |
https://bugzilla.redhat.com/show_bug.cgi?id=1518148
|
|
|
c1c534 |
(cherry picked from commit dacfc6b10bcff1c275d21a37edf0bc83e0947492)
|
|
|
c1c534 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c1c534 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c1c534 |
---
|
|
|
c1c534 |
src/qemu/qemu_command.c | 42 ++++++++++++++++++++++--------------------
|
|
|
c1c534 |
1 file changed, 22 insertions(+), 20 deletions(-)
|
|
|
c1c534 |
|
|
|
c1c534 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
c1c534 |
index 624a50d0b3..b462c7cf09 100644
|
|
|
c1c534 |
--- a/src/qemu/qemu_command.c
|
|
|
c1c534 |
+++ b/src/qemu/qemu_command.c
|
|
|
c1c534 |
@@ -318,29 +318,31 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
|
|
|
c1c534 |
|
|
|
c1c534 |
if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
|
|
|
c1c534 |
cont->idx == info->addr.pci.bus) {
|
|
|
c1c534 |
+ contAlias = cont->info.alias;
|
|
|
c1c534 |
contIsPHB = virDomainControllerIsPSeriesPHB(cont);
|
|
|
c1c534 |
contTargetIndex = cont->opts.pciopts.targetIndex;
|
|
|
c1c534 |
|
|
|
c1c534 |
- /* When domain has builtin pci-root controller we don't put it
|
|
|
c1c534 |
- * onto cmd line. Therefore we can't set its alias. In that
|
|
|
c1c534 |
- * case, use the default one. */
|
|
|
c1c534 |
- if (!qemuDomainIsPSeries(domainDef) &&
|
|
|
c1c534 |
- cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) {
|
|
|
c1c534 |
- if (virQEMUCapsHasPCIMultiBus(qemuCaps, domainDef))
|
|
|
c1c534 |
- contAlias = "pci.0";
|
|
|
c1c534 |
- else
|
|
|
c1c534 |
- contAlias = "pci";
|
|
|
c1c534 |
- } else if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) {
|
|
|
c1c534 |
- contAlias = "pcie.0";
|
|
|
c1c534 |
- } else {
|
|
|
c1c534 |
- contAlias = cont->info.alias;
|
|
|
c1c534 |
- if (!contAlias) {
|
|
|
c1c534 |
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
c1c534 |
- _("Device alias was not set for PCI "
|
|
|
c1c534 |
- "controller with index %u required "
|
|
|
c1c534 |
- "for device at address %s"),
|
|
|
c1c534 |
- info->addr.pci.bus, devStr);
|
|
|
c1c534 |
- goto cleanup;
|
|
|
c1c534 |
+ if (!contAlias) {
|
|
|
c1c534 |
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
c1c534 |
+ _("Device alias was not set for PCI "
|
|
|
c1c534 |
+ "controller with index %u required "
|
|
|
c1c534 |
+ "for device at address %s"),
|
|
|
c1c534 |
+ info->addr.pci.bus, devStr);
|
|
|
c1c534 |
+ goto cleanup;
|
|
|
c1c534 |
+ }
|
|
|
c1c534 |
+
|
|
|
c1c534 |
+ if (virDomainDeviceAliasIsUserAlias(contAlias)) {
|
|
|
c1c534 |
+ /* When domain has builtin pci-root controller we don't put it
|
|
|
c1c534 |
+ * onto cmd line. Therefore we can't set its alias. In that
|
|
|
c1c534 |
+ * case, use the default one. */
|
|
|
c1c534 |
+ if (!qemuDomainIsPSeries(domainDef) &&
|
|
|
c1c534 |
+ cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) {
|
|
|
c1c534 |
+ if (virQEMUCapsHasPCIMultiBus(qemuCaps, domainDef))
|
|
|
c1c534 |
+ contAlias = "pci.0";
|
|
|
c1c534 |
+ else
|
|
|
c1c534 |
+ contAlias = "pci";
|
|
|
c1c534 |
+ } else if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) {
|
|
|
c1c534 |
+ contAlias = "pcie.0";
|
|
|
c1c534 |
}
|
|
|
c1c534 |
}
|
|
|
c1c534 |
break;
|
|
|
c1c534 |
--
|
|
|
c1c534 |
2.15.1
|
|
|
c1c534 |
|