[libvirt] [PATCH 1/7] event: Add transition reason for PMSUSPENDED state from snapshot ops

Peter Krempa pkrempa at redhat.com
Fri Jul 18 16:11:51 UTC 2014


Add event reason to support transitions to PM suspended state from
snapshot revert operations.
---
 examples/object-events/event-test.c | 3 +++
 include/libvirt/libvirt.h.in        | 3 +++
 tools/virsh-domain.c                | 3 ++-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/examples/object-events/event-test.c b/examples/object-events/event-test.c
index 2a5a83b..84c878e 100644
--- a/examples/object-events/event-test.c
+++ b/examples/object-events/event-test.c
@@ -210,6 +210,9 @@ static const char *eventDetailToString(int event, int detail) {
             case VIR_DOMAIN_EVENT_PMSUSPENDED_DISK:
                 ret = "Disk";
                 break;
+            case VIR_DOMAIN_EVENT_PMSUSPENDED_FROM_SNAPSHOT:
+                ret = "Snapshot";
+                break;
             }
             break;
         case VIR_DOMAIN_EVENT_CRASHED:
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index ad6785f..af339f2 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -3693,6 +3693,9 @@ typedef enum {
 typedef enum {
     VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY = 0, /* Guest was PM suspended to memory */
     VIR_DOMAIN_EVENT_PMSUSPENDED_DISK = 1, /* Guest was PM suspended to disk */
+    VIR_DOMAIN_EVENT_PMSUSPENDED_FROM_SNAPSHOT = 2, /* Guest changed state to
+                                                       PM suspended due to
+                                                       snapshot operation */

 #ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_EVENT_PMSUSPENDED_LAST
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ba47258..cade830 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10686,7 +10686,8 @@ VIR_ENUM_DECL(vshDomainEventPMSuspended)
 VIR_ENUM_IMPL(vshDomainEventPMSuspended,
               VIR_DOMAIN_EVENT_PMSUSPENDED_LAST,
               N_("Memory"),
-              N_("Disk"))
+              N_("Disk"),
+              N_("Snapshot"))

 VIR_ENUM_DECL(vshDomainEventCrashed)
 VIR_ENUM_IMPL(vshDomainEventCrashed,
-- 
2.0.0




More information about the libvir-list mailing list