render / rpms / libvirt

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