]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nodedev: add DEFINED/UNDEFINED lifecycle events
authorJonathon Jongsma <jjongsma@redhat.com>
Thu, 9 Jul 2020 15:56:51 +0000 (10:56 -0500)
committerJonathon Jongsma <jjongsma@redhat.com>
Wed, 7 Apr 2021 20:07:45 +0000 (15:07 -0500)
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>
examples/c/misc/event-test.c
include/libvirt/libvirt-nodedev.h
tools/virsh-nodedev.c

index 76d4f3f6e82328b9860b64beab6170a976d5fe75..10c707e66b5b571957ff93e5e885ee55ffac9797 100644 (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;
     }
index 2deead07911ef3fc4a3e49c9576f27d6da792a0f..77d814935e16a2f28328fb97f8aced5df5a9f4d5 100644 (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
index fedc8497f8650c0b2803b34b91dac9bdff20b99d..b9fe9b8be1ae3248bebee7986e9cc1acb7f0ad60 100644 (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)