Change in vdsm[master]: domainMonitor: Log exceptions in domain monitor thread

nsoffer at redhat.com nsoffer at redhat.com
Wed Nov 20 21:18:05 UTC 2013


Nir Soffer has uploaded a new change for review.

Change subject: domainMonitor: Log exceptions in domain monitor thread
......................................................................

domainMonitor: Log exceptions in domain monitor thread

DomainMonitorThread does not handle exceptions in the thread main
function, making it harder to debug and understand unexpected failures
in the field. The patch log unhandled exceptions.

Change-Id: I743c59bffa99ab9868f1878ca96b7d979a703efb
Relates-To: https://bugzilla.redhat.com/1022352
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/storage/domainMonitor.py
1 file changed, 22 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/21487/1

diff --git a/vdsm/storage/domainMonitor.py b/vdsm/storage/domainMonitor.py
index 4f4b823..1f37ca3 100644
--- a/vdsm/storage/domainMonitor.py
+++ b/vdsm/storage/domainMonitor.py
@@ -156,26 +156,31 @@
         return self.status.copy()
 
     def _monitorLoop(self):
-        self.log.debug("Starting domain monitor for %s", self.sdUUID)
+        try:
+            self.log.debug("Starting domain monitor for %s", self.sdUUID)
 
-        while not self.stopEvent.is_set():
-            try:
-                self._monitorDomain()
-            except:
-                self.log.error("The domain monitor for %s failed unexpectedly",
-                               self.sdUUID, exc_info=True)
-            self.stopEvent.wait(self.interval)
+            while not self.stopEvent.is_set():
+                try:
+                    self._monitorDomain()
+                except:
+                    self.log.error("The domain monitor for %s failed"
+                                   " unexpectedly", self.sdUUID, exc_info=True)
+                self.stopEvent.wait(self.interval)
 
-        self.log.debug("Stopping domain monitor for %s", self.sdUUID)
+            self.log.debug("Stopping domain monitor for %s", self.sdUUID)
 
-        # If this is an ISO domain we didn't acquire the host id and releasing
-        # it is superfluous.
-        if self.domain and not self.isIsoDomain:
-            try:
-                self.domain.releaseHostId(self.hostId, unused=True)
-            except:
-                self.log.debug("Unable to release the host id %s for domain "
-                               "%s", self.hostId, self.sdUUID, exc_info=True)
+            # If this is an ISO domain we didn't acquire the host id and
+            # releasing it is superfluous.
+            if self.domain and not self.isIsoDomain:
+                try:
+                    self.domain.releaseHostId(self.hostId, unused=True)
+                except:
+                    self.log.debug("Unable to release the host id %s for"
+                                   " domain %s", self.hostId, self.sdUUID,
+                                   exc_info=True)
+        except Exception:
+            self.log.exception("Unhandled exception in domain monitor for"
+                               " %s", self.sdUUID)
 
     def _monitorDomain(self):
         self.nextStatus.clear()


-- 
To view, visit http://gerrit.ovirt.org/21487
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I743c59bffa99ab9868f1878ca96b7d979a703efb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list