Blob Blame Raw
From f55c0cefba2a71d4e44003802ac4ca59db0542ad Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Mon, 29 Oct 2012 18:55:51 -0400
Subject: [PATCH] domain: Fix more backtraces from PMSUSPEND status (cherry
 picked from commit
 538420e03239da7870b5b051c043072109f68fda)

---
 src/virtManager/domain.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py
index d536f77..56087b4 100644
--- a/src/virtManager/domain.py
+++ b/src/virtManager/domain.py
@@ -1389,6 +1389,8 @@ class vmmDomain(vmmLibvirtObject):
         elif (hasattr(libvirt, "VIR_DOMAIN_PMSUSPENDED") and
               status == libvirt.VIR_DOMAIN_PMSUSPENDED):
             return _("Suspended")
+
+        logging.debug("Unknown status %d, returning 'Unknown'")
         return _("Unknown")
 
     def _normalize_status(self, status):
@@ -1429,9 +1431,16 @@ class vmmDomain(vmmLibvirtObject):
             libvirt.VIR_DOMAIN_SHUTDOWN: "state_shutoff",
             libvirt.VIR_DOMAIN_SHUTOFF: "state_shutoff",
             libvirt.VIR_DOMAIN_NOSTATE: "state_running",
+            # VIR_DOMAIN_PMSUSPENDED
+            7: "state_paused",
         }
 
-        return status_icons[self.status()]
+        status = self.status()
+        if status not in status_icons:
+            logging.debug("Unknown status %d, using NOSTATE")
+            status = libvirt.VIR_DOMAIN_NOSTATE
+
+        return status_icons[status]
 
     def force_update_status(self):
         """
-- 
1.7.12.1