Signed-off-by: Lin Ma
---
include/libvirt/libvirt-domain.h | 201 +++
tools/virsh-domain.c | 50 +-
2 files changed, 226 insertions(+), 25 deletions(-)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 12fd34037e..f7dd510f7f 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -4424,6 +4424,207 @@ typedef enum {
} virDomainEventID;
+/**
+ * VIR_DOMAIN_EVENT_LIFECYCLE:
+ *
+ * Macro for the event name "lifecycle"
+ */
+
+# define VIR_DOMAIN_EVENT_LIFECYCLE "lifecycle"
+
+/**
+ * VIR_DOMAIN_EVENT_REBOOT:
+ *
+ * Macro for the event name "reboot"
+ */
+
+# define VIR_DOMAIN_EVENT_REBOOT "reboot"
+
+/**
+ * VIR_DOMAIN_EVENT_RTC_CHANGE:
+ *
+ * Macro for the event name "rtc-change"
+ */
+
+# define VIR_DOMAIN_EVENT_RTC_CHANGE "rtc-change"
+
+/**
+ * VIR_DOMAIN_EVENT_WATCHDOG:
+ *
+ * Macro for the event name "watchdog"
+ */
+
+# define VIR_DOMAIN_EVENT_WATCHDOG "watchdog"
+
+/**
+ * VIR_DOMAIN_EVENT_IO_ERROR:
+ *
+ * Macro for the event name "io-error"
+ */
+
+# define VIR_DOMAIN_EVENT_IO_ERROR "io-error"
+
+/**
+ * VIR_DOMAIN_EVENT_GRAPHICS:
+ *
+ * Macro for the event name "graphics"
+ */
+
+# define VIR_DOMAIN_EVENT_GRAPHICS "graphics"
+
+/**
+ * VIR_DOMAIN_EVENT_IO_ERROR_REASON:
+ *
+ * Macro for the event name "io-error-reason"
+ */
+
+# define VIR_DOMAIN_EVENT_IO_ERROR_REASON "io-error-reason"
+
+/**
+ * VIR_DOMAIN_EVENT_CONTROL_ERROR:
+ *
+ * Macro for the event name "control-error"
+ */
+
+# define VIR_DOMAIN_EVENT_CONTROL_ERROR "control-error"
+
+/**
+ * VIR_DOMAIN_EVENT_BLOCK_JOB:
+ *
+ * Macro for the event name "block-job"
+ */
+
+# define VIR_DOMAIN_EVENT_BLOCK_JOB "block-job"
+
+/**
+ * VIR_DOMAIN_EVENT_DISK_CHANGE:
+ *
+ * Macro for the event name "disk-change"
+ */
+
+# define VIR_DOMAIN_EVENT_DISK_CHANGE "disk-change"
+
+/**
+ * VIR_DOMAIN_EVENT_TRAY_CHANGE:
+ *
+ * Macro for the event name "tray-change"
+ */
+
+# define VIR_DOMAIN_EVENT_TRAY_CHANGE "tray-change"
+
+/**
+ * VIR_DOMAIN_EVENT_PMWAKEUP:
+ *
+ * Macro for the event name "pm-wakeup"
+ */
+
+# define VIR_DOMAIN_EVENT_PMWAKEUP "pm-wakeup"
+
+/**
+ * VIR_DOMAIN_EVENT_PMSUSPEND:
+ *
+ * Macro for the event name "pm-suspend"
+ */
+
+# define VIR_DOMAIN_EVENT_PMSUSPEND "pm-suspend"
+
+/**
+ * VIR_DOMAIN_EVENT_BALLOON_CHANGE:
+ *
+ * Macro for the event name "balloon-change"
+ */
+
+# define VIR_DOMAIN_EVENT_BALLOON_CHANGE "balloon-change"
+
+/**
+ * VIR_DOMAIN_EVENT_PMSUSPEND_DISK:
+ *
+ * Macro for the event name "pm-suspend-disk"
+ */
+
+# define VIR_DOMAIN_EVENT_PMSUSPEND_DISK "pm-suspend-disk"
+
+/**
+ * VIR_DOMAIN_EVENT_DEVICE_REMOVED:
+ *
+ * Macro for the event name "device-removed"
+ */
+
+# define VIR_DOMAIN_EVENT_DEVICE_REMOVED "device-removed"
+
+/**
+ * VIR_DOMAIN_EVENT_BLOCK_JOB_2:
+ *
+ * Macro for the event name "block-job-2"
+ */
+
+# define VIR_DOMAIN_EVENT_BLOCK_JOB_2 "block-job-2"
+
+/**
+ * VIR_DOMAIN_EVENT_TUNABLE:
+ *
+ * Macro for the event name "tunable"
+ */
+
+# define VIR_DOMAIN_EVENT_TUNABLE "tunable"
+
+/**
+ * VIR_DOMAIN_EVENT_AGENT_LIFECYCLE:
+ *
+ * Macro for the event name "agent-lifecycle"
+ */
+
+# define VIR_DOMAIN_EVENT_AGENT_LIFECYCLE "agent-lifecycle"
+
+/**
+ * VIR_DOMAIN_EVENT_DEVICE_ADDED:
+ *
+ * Macro for the event name "device-added"
+ */
+
+# define VIR_DOMAIN_EVENT_DEVICE_ADDED "device-added"
+
+/**
+ * VIR_DOMAIN_EVENT_MIGRATION_ITERATION:
+ *
+ * Macro for the event name "migration-iteration"
+ */
+
+# define VIR_DOMAIN_EVENT_MIGRATION_ITERATION "migration-iteration"
+
+/**
+ * VIR_DOMAIN_EVENT_JOB_COMPLETED:
+ *
+ * Macro for the event name "job-completed"
+ */
+
+# define VIR_DOMAIN_EVENT_JOB_COMPLETED "job-completed"
+
+/**
+ * VIR_DOMAIN_EVENT_DEVICE_REMOVAL_FAILED:
+ *
+ * Macro for the event name "device-removal-failed"
+ */
+
+# define VIR_DOMAIN_EVENT_DEVICE_REMOVAL_FAILED "device-removal-failed"
+
+/**
+ * VIR_DOMAIN_EVENT_METADATA_CHANGE:
+ *
+ * Macro for the event name "metadata-change"
+ */
+
+# define VIR_DOMAIN_EVENT_METADATA_CHANGE "metadata-change"
+
+/**
+ * VIR_DOMAIN_EVENT_BLOCK_THRESHOLD:
+ *
+ * Macro for the event name "block-threshold"
+ */
+
+# define VIR_DOMAIN_EVENT_BLOCK_THRESHOLD "block-threshold"
+
+
/* Use VIR_DOMAIN_EVENT_CALLBACK() to cast the 'cb' parameter */
int virConnectDomainEventRegisterAny(virConnectPtr conn,
virDomainPtr dom, /* Optional, to filter
*/
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index b35c9adaaa..e21ba0117b 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -13283,53 +13283,53 @@ virshEventBlockThresholdPrint(virConnectPtr conn
ATTRIBUTE_UNUSED,
static vshEventCallback vshEventCallbacks[] = {
-{ "lifecycle",
+{ VIR_DOMAIN_EVENT_LIFECYCLE,
VIR_DOMAIN_EVENT_CALLBACK(virshEventLifecyclePrint), },
-{ "reboot", virshEventGenericPrint, },
-{ "rtc-change",
+{ VIR_DOMAIN_EVENT_REBOOT, virshEventGenericPrint,