]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
node_device: update sriov/iommu info before dumpxml of a device
authorLaine Stump <laine@laine.org>
Mon, 11 May 2015 17:40:21 +0000 (13:40 -0400)
committerLaine Stump <laine@laine.org>
Mon, 18 May 2015 14:33:05 +0000 (10:33 -0400)
Because reloading a PF driver with a different number of VFs doesn't
result in any sort of event sent from udev to the libvirt node_device
driver, libvirt's cache of that info can be out of date when a request
arrives for the info about a device. To fix this, we refresh that data
at the time of the dumpxml request, similar to what is already done
for netdev link info and SCSI host capabilities.

Since the same is true for iommu group information (for example, some
other device in the same iommu group could have been detached from the
host), we also create a function to update the iommu group info from
sysfs, and a common function that does both. (a later patch will call
this common function from the udev and hal backends).

This resolves:

  https://bugzilla.redhat.com/show_bug.cgi?id=981546

src/node_device/node_device_driver.c

index c9db00a21ae9757bd08cd4b63c4c5f6ca16ff4f2..34ba1fad278d498200455d5a000d58e76b54ceda 100644 (file)
@@ -59,12 +59,16 @@ static int update_caps(virNodeDeviceObjPtr dev)
             if (virNetDevGetLinkInfo(cap->data.net.ifname, &cap->data.net.lnk) < 0)
                 return -1;
             break;
+        case VIR_NODE_DEV_CAP_PCI_DEV:
+           if (nodeDeviceSysfsGetPCIRelatedDevCaps(dev->def->sysfs_path,
+                                                   &dev->def->caps->data) < 0)
+              return -1;
+           break;
 
         /* all types that (supposedly) don't require any updates
          * relative to what's in the cache.
          */
         case VIR_NODE_DEV_CAP_SYSTEM:
-        case VIR_NODE_DEV_CAP_PCI_DEV:
         case VIR_NODE_DEV_CAP_USB_DEV:
         case VIR_NODE_DEV_CAP_USB_INTERFACE:
         case VIR_NODE_DEV_CAP_SCSI_TARGET: