It will be used in next patch for event name completion.
Signed-off-by: Lin Ma <lma(a)suse.com>
---
src/conf/domain_event.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
src/conf/domain_event.h | 3 +++
src/libvirt_private.syms | 1 +
3 files changed, 66 insertions(+)
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 97520706c9..f8bd457b34 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1968,6 +1968,68 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
}
+const char *
+virDomainEventGetName(int event)
+{
+ virResetLastError();
+
+ switch (event) {
+ case VIR_DOMAIN_EVENT_ID_LIFECYCLE:
+ return VIR_DOMAIN_EVENT_LIFECYCLE;
+ case VIR_DOMAIN_EVENT_ID_REBOOT:
+ return VIR_DOMAIN_EVENT_REBOOT;
+ case VIR_DOMAIN_EVENT_ID_RTC_CHANGE:
+ return VIR_DOMAIN_EVENT_RTC_CHANGE;
+ case VIR_DOMAIN_EVENT_ID_WATCHDOG:
+ return VIR_DOMAIN_EVENT_WATCHDOG;
+ case VIR_DOMAIN_EVENT_ID_IO_ERROR:
+ return VIR_DOMAIN_EVENT_IO_ERROR;
+ case VIR_DOMAIN_EVENT_ID_GRAPHICS:
+ return VIR_DOMAIN_EVENT_GRAPHICS;
+ case VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON:
+ return VIR_DOMAIN_EVENT_IO_ERROR_REASON;
+ case VIR_DOMAIN_EVENT_ID_CONTROL_ERROR:
+ return VIR_DOMAIN_EVENT_CONTROL_ERROR;
+ case VIR_DOMAIN_EVENT_ID_BLOCK_JOB:
+ return VIR_DOMAIN_EVENT_BLOCK_JOB;
+ case VIR_DOMAIN_EVENT_ID_DISK_CHANGE:
+ return VIR_DOMAIN_EVENT_DISK_CHANGE;
+ case VIR_DOMAIN_EVENT_ID_TRAY_CHANGE:
+ return VIR_DOMAIN_EVENT_TRAY_CHANGE;
+ case VIR_DOMAIN_EVENT_ID_PMWAKEUP:
+ return VIR_DOMAIN_EVENT_PMWAKEUP;
+ case VIR_DOMAIN_EVENT_ID_PMSUSPEND:
+ return VIR_DOMAIN_EVENT_PMSUSPEND;
+ case VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE:
+ return VIR_DOMAIN_EVENT_BALLOON_CHANGE;
+ case VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK:
+ return VIR_DOMAIN_EVENT_PMSUSPEND_DISK;
+ case VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED:
+ return VIR_DOMAIN_EVENT_DEVICE_REMOVED;
+ case VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2:
+ return VIR_DOMAIN_EVENT_BLOCK_JOB_2;
+ case VIR_DOMAIN_EVENT_ID_TUNABLE:
+ return VIR_DOMAIN_EVENT_TUNABLE;
+ case VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE:
+ return VIR_DOMAIN_EVENT_AGENT_LIFECYCLE;
+ case VIR_DOMAIN_EVENT_ID_DEVICE_ADDED:
+ return VIR_DOMAIN_EVENT_DEVICE_ADDED;
+ case VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION:
+ return VIR_DOMAIN_EVENT_MIGRATION_ITERATION;
+ case VIR_DOMAIN_EVENT_ID_JOB_COMPLETED:
+ return VIR_DOMAIN_EVENT_JOB_COMPLETED;
+ case VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED:
+ return VIR_DOMAIN_EVENT_DEVICE_REMOVAL_FAILED;
+ case VIR_DOMAIN_EVENT_ID_METADATA_CHANGE:
+ return VIR_DOMAIN_EVENT_METADATA_CHANGE;
+ case VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD:
+ return VIR_DOMAIN_EVENT_BLOCK_THRESHOLD;
+ default:
+ return NULL;
+ }
+}
+
+
virObjectEventPtr
virDomainQemuMonitorEventNew(int id,
const char *name,
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index 3992a29c58..9c3a1e3b88 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -327,4 +327,7 @@ virDomainQemuMonitorEventNew(int id,
const char *details)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
+const char *
+virDomainEventGetName(int event);
+
#endif
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 92b5e0fa2b..0b6c414b66 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -641,6 +641,7 @@ virDomainEventWatchdogNewFromDom;
virDomainEventWatchdogNewFromObj;
virDomainQemuMonitorEventNew;
virDomainQemuMonitorEventStateRegisterID;
+virDomainEventGetName;
# conf/domain_nwfilter.h
--
2.15.1