]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: ignore assumptions about hotplug requirement when address is from config
authorLaine Stump <laine@laine.org>
Wed, 10 Jun 2015 18:15:25 +0000 (14:15 -0400)
committerLaine Stump <laine@laine.org>
Fri, 26 Jun 2015 17:54:16 +0000 (13:54 -0400)
Certain PCI buses don't support hotplug, and when automatically
assigning PCI addresses for devices, libvirt is very conservative in
its assumptions about whether or not a device will need to be
hotplugged/unplugged in the future. But if the user manually assigns
an address, they likely are aware of any hotplug requirements of the
device (or at least they should be).

In short, after this patch, automatically PCI address assignment will
assume that the device must be plugged in to a hot-pluggable slot, but
manually assignment can place the device in any bus that is
compatible, regardless of whether or not it supports hotplug. If the
user makes a mistake and plugs the device into a bus that doesn't
support hotplug, then later tries to do a hot-unplug, qemu will give
an appropriate error.

(in the future we may want to add a "hotpluggable" attribute to all
devices, with default being "yes" for autoassign, and "no" for manual
assign).

src/conf/domain_addr.c

index 93c60431875c899dc96f2f933a3a4c2c09ab1b13..2be98c5edfac37887610286a2a14c9c79c4ada05 100644 (file)
@@ -50,6 +50,12 @@ virDomainPCIAddressFlagsCompatible(virDevicePCIAddressPtr addr,
          */
         if (busFlags & VIR_PCI_CONNECT_TYPES_ENDPOINT)
             busFlags |= VIR_PCI_CONNECT_TYPES_ENDPOINT;
+        /* Also allow manual specification of bus to override
+         * libvirt's assumptions about whether or not hotplug
+         * capability will be required.
+         */
+        if (devFlags & VIR_PCI_CONNECT_HOTPLUGGABLE)
+            busFlags |= VIR_PCI_CONNECT_HOTPLUGGABLE;
     }
 
     /* If this bus doesn't allow the type of connection (PCI