mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-26 06:25:19 +00:00
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: Erik Skultety <eskultet@redhat.com> Suggested-by: Wu Zongyong <cordius.wu@huawei.com>
This commit is contained in:
parent
36546e3cdb
commit
d18feadc0c
@ -2515,6 +2515,9 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def,
|
|||||||
tmp[ncaps] = cap; \
|
tmp[ncaps] = cap; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
if (virNodeDeviceUpdateCaps(def) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (want_list && VIR_ALLOC_N(tmp, VIR_NODE_DEV_CAP_LAST - 1) < 0)
|
if (want_list && VIR_ALLOC_N(tmp, VIR_NODE_DEV_CAP_LAST - 1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -811,6 +811,10 @@ static bool
|
|||||||
virNodeDeviceMatch(virNodeDeviceObjPtr obj,
|
virNodeDeviceMatch(virNodeDeviceObjPtr obj,
|
||||||
unsigned int flags)
|
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 */
|
/* filter by cap type */
|
||||||
if (flags & VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP) {
|
if (flags & VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP) {
|
||||||
if (!(MATCH(SYSTEM) ||
|
if (!(MATCH(SYSTEM) ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user