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