[PATCH] nodedev: update netdev feature bits before each dumpxml

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As with several other attributes of devices (link status, sriov VF
list, IOMMU group list), the detdev feature bits aren't automatically
updated in the nodedev driver's cache when they change. In order to
get a properly up-to-date list when getting the XML of a device, we
must reget them in update-caps prior to each dumpxml.

Reported-By: Moshe Levi <moshele@xxxxxxxxxxxx>
---

I dislike needing to put in the virBitmapFree and set the pointer to
NULL before re-getting the features, but leaving it out would lead to
a leak of the old bitmap, and I'm not sure I want
virNetDevGetFeatures() to assume a valid pointer when it starts (it
currently assumes the pointer contents is junk, and overwrites it with
a newly allocated *virBitmap).


 src/node_device/node_device_driver.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 768db7f..31741b9 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -58,6 +58,10 @@ static int update_caps(virNodeDeviceObjPtr dev)
         case VIR_NODE_DEV_CAP_NET:
             if (virNetDevGetLinkInfo(cap->data.net.ifname, &cap->data.net.lnk) < 0)
                 return -1;
+            virBitmapFree(cap->data.net.features);
+            cap->data.net.features = NULL;
+            if (virNetDevGetFeatures(cap->data.net.ifname, &cap->data.net.features) < 0)
+                return -1;
             break;
         case VIR_NODE_DEV_CAP_PCI_DEV:
            if (nodeDeviceSysfsGetPCIRelatedDevCaps(dev->def->sysfs_path,
-- 
2.1.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]