[PATCH 10/12] virsh: Introduce some VIR_DOMAIN_EVENT_* macros representing domain event names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Lin Ma <lma@xxxxxxxx>
---
 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, },
+    { VIR_DOMAIN_EVENT_RTC_CHANGE,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventRTCChangePrint), },
-    { "watchdog",
+    { VIR_DOMAIN_EVENT_WATCHDOG,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventWatchdogPrint), },
-    { "io-error",
+    { VIR_DOMAIN_EVENT_IO_ERROR,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventIOErrorPrint), },
-    { "graphics",
+    { VIR_DOMAIN_EVENT_GRAPHICS,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventGraphicsPrint), },
-    { "io-error-reason",
+    { VIR_DOMAIN_EVENT_IO_ERROR_REASON,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventIOErrorReasonPrint), },
-    { "control-error", virshEventGenericPrint, },
-    { "block-job",
+    { VIR_DOMAIN_EVENT_CONTROL_ERROR, virshEventGenericPrint, },
+    { VIR_DOMAIN_EVENT_BLOCK_JOB,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventBlockJobPrint), },
-    { "disk-change",
+    { VIR_DOMAIN_EVENT_DISK_CHANGE,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventDiskChangePrint), },
-    { "tray-change",
+    { VIR_DOMAIN_EVENT_TRAY_CHANGE,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventTrayChangePrint), },
-    { "pm-wakeup",
+    { VIR_DOMAIN_EVENT_PMWAKEUP,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventPMChangePrint), },
-    { "pm-suspend",
+    { VIR_DOMAIN_EVENT_PMSUSPEND,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventPMChangePrint), },
-    { "balloon-change",
+    { VIR_DOMAIN_EVENT_BALLOON_CHANGE,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventBalloonChangePrint), },
-    { "pm-suspend-disk",
+    { VIR_DOMAIN_EVENT_PMSUSPEND_DISK,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventPMChangePrint), },
-    { "device-removed",
+    { VIR_DOMAIN_EVENT_DEVICE_REMOVED,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventDeviceRemovedPrint), },
-    { "block-job-2",
+    { VIR_DOMAIN_EVENT_BLOCK_JOB_2,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventBlockJobPrint), },
-    { "tunable",
+    { VIR_DOMAIN_EVENT_TUNABLE,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventTunablePrint), },
-    { "agent-lifecycle",
+    { VIR_DOMAIN_EVENT_AGENT_LIFECYCLE,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventAgentLifecyclePrint), },
-    { "device-added",
+    { VIR_DOMAIN_EVENT_DEVICE_ADDED,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventDeviceAddedPrint), },
-    { "migration-iteration",
+    { VIR_DOMAIN_EVENT_MIGRATION_ITERATION,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventMigrationIterationPrint), },
-    { "job-completed",
+    { VIR_DOMAIN_EVENT_JOB_COMPLETED,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventJobCompletedPrint), },
-    { "device-removal-failed",
+    { VIR_DOMAIN_EVENT_DEVICE_REMOVAL_FAILED,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventDeviceRemovalFailedPrint), },
-    { "metadata-change",
+    { VIR_DOMAIN_EVENT_METADATA_CHANGE,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventMetadataChangePrint), },
-    { "block-threshold",
+    { VIR_DOMAIN_EVENT_BLOCK_THRESHOLD,
       VIR_DOMAIN_EVENT_CALLBACK(virshEventBlockThresholdPrint), },
 };
 verify(VIR_DOMAIN_EVENT_ID_LAST == ARRAY_CARDINALITY(vshEventCallbacks));
-- 
2.15.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux