mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
conf: nodedev: Don't refresh host caps in testdriver
Add a 'skipUpdateCaps' bool that we set for test_driver.c nodedevs which will skip accessing host resources via virNodeDeviceUpdateCaps Reviewed-by: Erik Skultety <eskultet@redhat.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
c379576dbc
commit
4afa955365
@ -37,6 +37,8 @@ struct _virNodeDeviceObj {
|
||||
virObjectLockable parent;
|
||||
|
||||
virNodeDeviceDefPtr def; /* device definition */
|
||||
bool skipUpdateCaps; /* whether to skip checking host caps,
|
||||
used by testdriver */
|
||||
};
|
||||
|
||||
struct _virNodeDeviceObjList {
|
||||
@ -806,7 +808,8 @@ virNodeDeviceMatch(virNodeDeviceObjPtr obj,
|
||||
unsigned int flags)
|
||||
{
|
||||
/* Refresh the capabilities first, e.g. due to a driver change */
|
||||
if (virNodeDeviceUpdateCaps(obj->def) < 0)
|
||||
if (!obj->skipUpdateCaps &&
|
||||
virNodeDeviceUpdateCaps(obj->def) < 0)
|
||||
return false;
|
||||
|
||||
/* filter by cap type */
|
||||
@ -915,3 +918,11 @@ virNodeDeviceObjListExport(virConnectPtr conn,
|
||||
virObjectListFree(data.devices);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
virNodeDeviceObjSetSkipUpdateCaps(virNodeDeviceObjPtr obj,
|
||||
bool skipUpdateCaps)
|
||||
{
|
||||
obj->skipUpdateCaps = skipUpdateCaps;
|
||||
}
|
||||
|
@ -109,4 +109,8 @@ virNodeDeviceObjListExport(virConnectPtr conn,
|
||||
virNodeDeviceObjListFilter filter,
|
||||
unsigned int flags);
|
||||
|
||||
void
|
||||
virNodeDeviceObjSetSkipUpdateCaps(virNodeDeviceObjPtr obj,
|
||||
bool skipUpdateCaps);
|
||||
|
||||
#endif /* __VIRNODEDEVICEOBJ_H__ */
|
||||
|
@ -1165,6 +1165,7 @@ testParseNodedevs(testDriverPtr privconn,
|
||||
goto error;
|
||||
}
|
||||
|
||||
virNodeDeviceObjSetSkipUpdateCaps(obj, true);
|
||||
virNodeDeviceObjEndAPI(&obj);
|
||||
}
|
||||
|
||||
@ -5549,6 +5550,7 @@ testNodeDeviceMockCreateVport(testDriverPtr driver,
|
||||
|
||||
if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def)))
|
||||
goto cleanup;
|
||||
virNodeDeviceObjSetSkipUpdateCaps(obj, true);
|
||||
def = NULL;
|
||||
objdef = virNodeDeviceObjGetDef(obj);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user