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 */
|
virNodeDeviceDefPtr def; /* device definition */
|
||||||
bool skipUpdateCaps; /* whether to skip checking host caps,
|
bool skipUpdateCaps; /* whether to skip checking host caps,
|
||||||
used by testdriver */
|
used by testdriver */
|
||||||
|
bool active;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _virNodeDeviceObjList {
|
struct _virNodeDeviceObjList {
|
||||||
@ -976,3 +977,18 @@ virNodeDeviceObjSetSkipUpdateCaps(virNodeDeviceObjPtr obj,
|
|||||||
{
|
{
|
||||||
obj->skipUpdateCaps = skipUpdateCaps;
|
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
|
virNodeDeviceObjPtr
|
||||||
virNodeDeviceObjListFindMediatedDeviceByUUID(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListFindMediatedDeviceByUUID(virNodeDeviceObjListPtr devs,
|
||||||
const char *uuid);
|
const char *uuid);
|
||||||
|
|
||||||
|
bool
|
||||||
|
virNodeDeviceObjIsActive(virNodeDeviceObj *obj);
|
||||||
|
|
||||||
|
void
|
||||||
|
virNodeDeviceObjSetActive(virNodeDeviceObj *obj,
|
||||||
|
bool active);
|
||||||
|
@ -1272,6 +1272,7 @@ virNetworkPortDefSaveStatus;
|
|||||||
# conf/virnodedeviceobj.h
|
# conf/virnodedeviceobj.h
|
||||||
virNodeDeviceObjEndAPI;
|
virNodeDeviceObjEndAPI;
|
||||||
virNodeDeviceObjGetDef;
|
virNodeDeviceObjGetDef;
|
||||||
|
virNodeDeviceObjIsActive;
|
||||||
virNodeDeviceObjListAssignDef;
|
virNodeDeviceObjListAssignDef;
|
||||||
virNodeDeviceObjListExport;
|
virNodeDeviceObjListExport;
|
||||||
virNodeDeviceObjListFindByName;
|
virNodeDeviceObjListFindByName;
|
||||||
@ -1284,6 +1285,7 @@ virNodeDeviceObjListGetParentHost;
|
|||||||
virNodeDeviceObjListNew;
|
virNodeDeviceObjListNew;
|
||||||
virNodeDeviceObjListNumOfDevices;
|
virNodeDeviceObjListNumOfDevices;
|
||||||
virNodeDeviceObjListRemove;
|
virNodeDeviceObjListRemove;
|
||||||
|
virNodeDeviceObjSetActive;
|
||||||
|
|
||||||
|
|
||||||
# conf/virnwfilterbindingdef.h
|
# conf/virnwfilterbindingdef.h
|
||||||
|
@ -1544,6 +1544,7 @@ udevAddOneDevice(struct udev_device *device)
|
|||||||
else
|
else
|
||||||
event = virNodeDeviceEventUpdateNew(objdef->name);
|
event = virNodeDeviceEventUpdateNew(objdef->name);
|
||||||
|
|
||||||
|
virNodeDeviceObjSetActive(obj, true);
|
||||||
virNodeDeviceObjEndAPI(&obj);
|
virNodeDeviceObjEndAPI(&obj);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -1930,6 +1931,8 @@ udevSetupSystemDev(void)
|
|||||||
if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def)))
|
if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
virNodeDeviceObjSetActive(obj, true);
|
||||||
|
|
||||||
virNodeDeviceObjEndAPI(&obj);
|
virNodeDeviceObjEndAPI(&obj);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user