On Tue, Jun 16, 2015 at 12:03:55PM -0400, Laine Stump wrote: > As with several other attributes of devices (link status, sriov VF > list, IOMMU group list), the detdev feature bits aren't automatically s/det/net/ > 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). > Setting it to NULL is not strictly required, since the GetFeatures() call will always overwrite it. Maybe the code would be nicer if virBitmapFree also cleared the pointer and virNetDevGetFeatures returned the bitmap instead of an int? > > 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, ACK with the typo fixed. Jan
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list