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(a)redhat.com>
---
examples/c/misc/event-test.c | 4 ++++
include/libvirt/libvirt-nodedev.h | 2 ++
tools/virsh-nodedev.c | 4 +++-
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/examples/c/misc/event-test.c b/examples/c/misc/event-test.c
index f164e825e1..bd6218cce6 100644
--- a/examples/c/misc/event-test.c
+++ b/examples/c/misc/event-test.c
@@ -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;
}
diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h
index d304283871..7cd679dac4 100644
--- a/include/libvirt/libvirt-nodedev.h
+++ b/include/libvirt/libvirt-nodedev.h
@@ -197,6 +197,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
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 69422e20f5..428ead7384 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -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)
--
2.26.2