nodedev: add DEFINED/UNDEFINED lifecycle events

Since a mediated device can be persistently defined by the mdevctl
backend, we need additional lifecycle events beyond CREATED/DELETED to
indicate that e.g. the device has been stopped but the device definition
still exists.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Jonathon Jongsma 2020-07-09 10:56:51 -05:00
parent d4375403ff
commit 94187b8004
3 changed files with 9 additions and 1 deletions

View File

@ -381,6 +381,10 @@ nodeDeviceEventToString(int event)
return "Created";
case VIR_NODE_DEVICE_EVENT_DELETED:
return "Deleted";
case VIR_NODE_DEVICE_EVENT_DEFINED:
return "Defined";
case VIR_NODE_DEVICE_EVENT_UNDEFINED:
return "Undefined";
case VIR_NODE_DEVICE_EVENT_LAST:
break;
}

View File

@ -196,6 +196,8 @@ int virConnectNodeDeviceEventDeregisterAny(virConnectPtr conn,
typedef enum {
VIR_NODE_DEVICE_EVENT_CREATED = 0,
VIR_NODE_DEVICE_EVENT_DELETED = 1,
VIR_NODE_DEVICE_EVENT_DEFINED = 2,
VIR_NODE_DEVICE_EVENT_UNDEFINED = 3,
# ifdef VIR_ENUM_SENTINELS
VIR_NODE_DEVICE_EVENT_LAST

View File

@ -775,7 +775,9 @@ VIR_ENUM_DECL(virshNodeDeviceEvent);
VIR_ENUM_IMPL(virshNodeDeviceEvent,
VIR_NODE_DEVICE_EVENT_LAST,
N_("Created"),
N_("Deleted"));
N_("Deleted"),
N_("Defined"),
N_("Undefined"));
static const char *
virshNodeDeviceEventToString(int event)