提交 d18feadc 编写于 作者: E Erik Skultety

conf: nodedev: Refresh capabilities before touching them

Most of them are static, however in case of PCI and SCSI_HOST devices,
the nested capabilities can change dynamically, e.g. due to a driver
change (from host_pci_driver -> vfio_pci).
Signed-off-by: NErik Skultety <eskultet@redhat.com>
Suggested-by: NWu Zongyong <cordius.wu@huawei.com>
上级 36546e3c
......@@ -2515,6 +2515,9 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def,
tmp[ncaps] = cap; \
} while (0)
if (virNodeDeviceUpdateCaps(def) < 0)
goto cleanup;
if (want_list && VIR_ALLOC_N(tmp, VIR_NODE_DEV_CAP_LAST - 1) < 0)
goto cleanup;
......
......@@ -811,6 +811,10 @@ static bool
virNodeDeviceMatch(virNodeDeviceObjPtr obj,
unsigned int flags)
{
/* Refresh the capabilities first, e.g. due to a driver change */
if (virNodeDeviceUpdateCaps(obj->def) < 0)
return false;
/* filter by cap type */
if (flags & VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP) {
if (!(MATCH(SYSTEM) ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册