[libvirt] [PATCH 2/7] lib: Add reason for a domain reaching the PMSUSPENDED state

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


When libvirt reverts a snapshot in the PMSUSPENDED state we need to
record how it entered this state. Add the "from snapshot" reason.
---
 include/libvirt/libvirt.h.in | 3 +++
 src/conf/domain_conf.c       | 3 ++-
 tools/virsh-domain-monitor.c | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index af339f2..5c13c28 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -223,6 +223,9 @@ typedef enum {

 typedef enum {
     VIR_DOMAIN_PMSUSPENDED_UNKNOWN = 0,
+    VIR_DOMAIN_PMSUSPENDED_FROM_SNAPSHOT = 1, /* restored from a snapshot which
+                                                 was taken while the domain was
+                                                 pmsuspended */

 #ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_PMSUSPENDED_LAST
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1e27165..78a365f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -682,7 +682,8 @@ VIR_ENUM_IMPL(virDomainCrashedReason, VIR_DOMAIN_CRASHED_LAST,
               "panicked")

 VIR_ENUM_IMPL(virDomainPMSuspendedReason, VIR_DOMAIN_PMSUSPENDED_LAST,
-              "unknown")
+              "unknown",
+              "from snapshot")

 VIR_ENUM_IMPL(virDomainSeclabel, VIR_DOMAIN_SECLABEL_LAST,
               "default",
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 8bd58ad..3a598e9 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -213,7 +213,8 @@ VIR_ENUM_IMPL(vshDomainCrashedReason,
 VIR_ENUM_DECL(vshDomainPMSuspendedReason)
 VIR_ENUM_IMPL(vshDomainPMSuspendedReason,
               VIR_DOMAIN_PMSUSPENDED_LAST,
-              N_("unknown"))
+              N_("unknown"),
+              N_("from snapshot"))

 static const char *
 vshDomainStateReasonToString(int state, int reason)
-- 
2.0.0




More information about the libvir-list mailing list