Adam Litke has uploaded a new change for review.

Change subject: Track and log exceptions during thread init
......................................................................

Track and log exceptions during thread init

We are currently tracking and logging exceptions that happen in mom
threads within their run loop.  We should also log exceptions that are
raised during thread initialization.

Change-Id: Iaf2289a401156c9384b4237f631313c4031a6cf2
Signed-off-by: Adam Litke <ali...@redhat.com>
---
M mom/__init__.py
M tests/GeneralTests.py
2 files changed, 18 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/mom refs/changes/37/35437/1

diff --git a/mom/__init__.py b/mom/__init__.py
index 97c0c11..e720b3e 100644
--- a/mom/__init__.py
+++ b/mom/__init__.py
@@ -24,20 +24,24 @@
         # Start threads
         self.logger.info("MOM starting")
         self.config.set('__int__', 'running', '1')
-        host_monitor = HostMonitor(self.config)
-        hypervisor_iface = self.get_hypervisor_interface()
-        if not hypervisor_iface:
-            self.shutdown()
-        guest_manager = GuestManager(self.config, hypervisor_iface)
-        policy_engine = PolicyEngine(self.config, hypervisor_iface, 
host_monitor, \
-                                     guest_manager)
+        try:
+            host_monitor = HostMonitor(self.config)
+            hypervisor_iface = self.get_hypervisor_interface()
+            if not hypervisor_iface:
+                self.shutdown()
+            guest_manager = GuestManager(self.config, hypervisor_iface)
+            policy_engine = PolicyEngine(self.config, hypervisor_iface,
+                                         host_monitor, guest_manager)
 
-        threads = { 'host_monitor': host_monitor,
-                         'guest_manager': guest_manager,
-                         'policy_engine': policy_engine }
-        momFuncs = MOMFuncs(self.config, threads)
-        self._setupAPI(momFuncs)
-        rpc_server = RPCServer(self.config, momFuncs)
+            threads = {'host_monitor': host_monitor,
+                       'guest_manager': guest_manager,
+                       'policy_engine': policy_engine}
+            momFuncs = MOMFuncs(self.config, threads)
+            self._setupAPI(momFuncs)
+            rpc_server = RPCServer(self.config, momFuncs)
+        except Exception as e:
+            self.log.error("Failed to initialize MOM threads", exc_info=True)
+            return
 
         interval = self.config.getint('main', 'main-loop-interval')
         while self.config.getint('__int__', 'running') == 1:
diff --git a/tests/GeneralTests.py b/tests/GeneralTests.py
index 9955b2b..a45478a 100644
--- a/tests/GeneralTests.py
+++ b/tests/GeneralTests.py
@@ -30,7 +30,7 @@
     if not config:
         config = ConfigParser.SafeConfigParser()
         config.add_section('logging')
-        config.set('logging', 'verbosity', 'critical')
+        config.set('logging', 'verbosity', 'error')
 
     mom_instance = mom.MOM("", config)
     t = threading.Thread(target=mom_instance.run)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf2289a401156c9384b4237f631313c4031a6cf2
Gerrit-PatchSet: 1
Gerrit-Project: mom
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <ali...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to