[PATCH v4 1/2] Introduce new VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT sub-event

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

 



When domain is reverted to a snapshot and domain state is changed
libvirt emits <NEW STATE>_FROM_SNAPSHOT event. This new introduced
event could be emitted if there was no changes in state but domain
configuration was changed by a snapshot.
---
 examples/object-events/event-test.c | 2 ++
 include/libvirt/libvirt-domain.h    | 1 +
 tools/virsh-domain.c                | 3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index dcae981..afac100 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -110,6 +110,8 @@ static const char *eventDetailToString(int event, int detail) {
                 ret = "Updated";
             else if (detail == VIR_DOMAIN_EVENT_DEFINED_RENAMED)
                 ret = "Renamed";
+            else if (detail == VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT)
+                ret = "Snapshot";
             break;
         case VIR_DOMAIN_EVENT_UNDEFINED:
             if (detail == VIR_DOMAIN_EVENT_UNDEFINED_REMOVED)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 65f1618..fc1e2f4 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -2330,6 +2330,7 @@ typedef enum {
     VIR_DOMAIN_EVENT_DEFINED_ADDED = 0,     /* Newly created config file */
     VIR_DOMAIN_EVENT_DEFINED_UPDATED = 1,   /* Changed config file */
     VIR_DOMAIN_EVENT_DEFINED_RENAMED = 2,   /* Domain was renamed */
+    VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT = 3,   /* Config was restored from a snapshot */
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_EVENT_DEFINED_LAST
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 6dd75e2..440d84e 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -11386,7 +11386,8 @@ VIR_ENUM_IMPL(virshDomainEventDefined,
               VIR_DOMAIN_EVENT_DEFINED_LAST,
               N_("Added"),
               N_("Updated"),
-              N_("Renamed"))
+              N_("Renamed"),
+              N_("Snapshot"))
 
 VIR_ENUM_DECL(virshDomainEventUndefined)
 VIR_ENUM_IMPL(virshDomainEventUndefined,
-- 
1.8.3.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]