render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
a41c76
From 5ec240811e391f97378d0b6b726e0dee13ae8a40 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <5ec240811e391f97378d0b6b726e0dee13ae8a40@dist-git>
a41c76
From: Laine Stump <laine@redhat.com>
a41c76
Date: Sun, 26 Apr 2020 13:17:03 -0400
a41c76
Subject: [PATCH] conf: during PCI hotplug, require that the controller support
a41c76
 hotplug
a41c76
a41c76
Before this patch we would simply rely on QEMU failing to attach the
a41c76
device. Since we have a flag in the address set telling us which
a41c76
controllers support hotplug, we can fail the operation sooner.
a41c76
a41c76
This also assures that when hotplugging with no provided PCI address,
a41c76
that we skip any controllers with hotplug='off', and attempt to assign
a41c76
the device to a controller that not only supports hotplug, but also
a41c76
has it enabled.
a41c76
a41c76
Signed-off-by: Laine Stump <laine@redhat.com>
a41c76
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
a41c76
(cherry picked from commit 7118bdee1550b6022e7362402ca8204add4cf80b)
a41c76
a41c76
https://bugzilla.redhat.com/1802592
a41c76
Signed-off-by: Laine Stump <laine@redhat.com>
a41c76
Message-Id: <20200426171703.18808-3-laine@redhat.com>
a41c76
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
a41c76
---
a41c76
 src/conf/domain_addr.c | 5 +++++
a41c76
 1 file changed, 5 insertions(+)
a41c76
a41c76
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
a41c76
index ed41eca114..34ea7bc051 100644
a41c76
--- a/src/conf/domain_addr.c
a41c76
+++ b/src/conf/domain_addr.c
a41c76
@@ -936,6 +936,11 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
a41c76
     if (!flags)
a41c76
        return 0;
a41c76
 
a41c76
+    /* This function is only called during hotplug, so we require hotplug
a41c76
+     * support from the controller.
a41c76
+     */
a41c76
+    flags |= VIR_PCI_CONNECT_HOTPLUGGABLE;
a41c76
+
a41c76
     if (!(addrStr = virPCIDeviceAddressAsString(&dev->addr.pci)))
a41c76
         goto cleanup;
a41c76
 
a41c76
-- 
a41c76
2.26.2
a41c76