mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
nodedev: introduce concept of 'active' node devices
we will be able to define mediated devices that can be started or stopped, so we need to be able to indicate whether the device is active or not, similar to other resources (storage pools, domains, etc.) Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
682a65a322
commit
b7a823177b
@ -39,6 +39,7 @@ struct _virNodeDeviceObj {
|
||||
virNodeDeviceDefPtr def; /* device definition */
|
||||
bool skipUpdateCaps; /* whether to skip checking host caps,
|
||||
used by testdriver */
|
||||
bool active;
|
||||
};
|
||||
|
||||
struct _virNodeDeviceObjList {
|
||||
@ -976,3 +977,18 @@ virNodeDeviceObjSetSkipUpdateCaps(virNodeDeviceObjPtr obj,
|
||||
{
|
||||
obj->skipUpdateCaps = skipUpdateCaps;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
virNodeDeviceObjIsActive(virNodeDeviceObj *obj)
|
||||
{
|
||||
return obj->active;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
virNodeDeviceObjSetActive(virNodeDeviceObj *obj,
|
||||
bool active)
|
||||
{
|
||||
obj->active = active;
|
||||
}
|
||||
|
@ -121,3 +121,10 @@ virNodeDeviceObjSetSkipUpdateCaps(virNodeDeviceObjPtr obj,
|
||||
virNodeDeviceObjPtr
|
||||
virNodeDeviceObjListFindMediatedDeviceByUUID(virNodeDeviceObjListPtr devs,
|
||||
const char *uuid);
|
||||
|
||||
bool
|
||||
virNodeDeviceObjIsActive(virNodeDeviceObj *obj);
|
||||
|
||||
void
|
||||
virNodeDeviceObjSetActive(virNodeDeviceObj *obj,
|
||||
bool active);
|
||||
|
@ -1272,6 +1272,7 @@ virNetworkPortDefSaveStatus;
|
||||
# conf/virnodedeviceobj.h
|
||||
virNodeDeviceObjEndAPI;
|
||||
virNodeDeviceObjGetDef;
|
||||
virNodeDeviceObjIsActive;
|
||||
virNodeDeviceObjListAssignDef;
|
||||
virNodeDeviceObjListExport;
|
||||
virNodeDeviceObjListFindByName;
|
||||
@ -1284,6 +1285,7 @@ virNodeDeviceObjListGetParentHost;
|
||||
virNodeDeviceObjListNew;
|
||||
virNodeDeviceObjListNumOfDevices;
|
||||
virNodeDeviceObjListRemove;
|
||||
virNodeDeviceObjSetActive;
|
||||
|
||||
|
||||
# conf/virnwfilterbindingdef.h
|
||||
|
@ -1544,6 +1544,7 @@ udevAddOneDevice(struct udev_device *device)
|
||||
else
|
||||
event = virNodeDeviceEventUpdateNew(objdef->name);
|
||||
|
||||
virNodeDeviceObjSetActive(obj, true);
|
||||
virNodeDeviceObjEndAPI(&obj);
|
||||
|
||||
ret = 0;
|
||||
@ -1930,6 +1931,8 @@ udevSetupSystemDev(void)
|
||||
if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def)))
|
||||
goto cleanup;
|
||||
|
||||
virNodeDeviceObjSetActive(obj, true);
|
||||
|
||||
virNodeDeviceObjEndAPI(&obj);
|
||||
|
||||
ret = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user