Handle any exception in ganeti-masterd
authorGuido Trotter <ultrotter@google.com>
Mon, 23 Jun 2008 15:00:16 +0000 (15:00 +0000)
committerGuido Trotter <ultrotter@google.com>
Mon, 23 Jun 2008 15:00:16 +0000 (15:00 +0000)
If an uncaught exception is thrown currently it destroys the calling
thread. This patch changes the behaviour to failing the current job,
logging a message, but trying to keep the daemon up.

Reviewed-by: imsnah

daemons/ganeti-masterd

index 8b02ac6..92718b9 100755 (executable)
@@ -288,6 +288,15 @@ def PoolWorker(worker_id, incoming_queue):
         msg = "ganeti exception %s" % err
         item.SetStatus(opcodes.Job.STATUS_FAIL, result=[msg])
         print msg
+      except Exception, err:
+        msg = "unhandled exception %s" % err
+        item.SetStatus(opcodes.Job.STATUS_FAIL, result=[msg])
+        print msg
+      except:
+        msg = "unhandled unknown exception"
+        item.SetStatus(opcodes.Job.STATUS_FAIL, result=[msg])
+        print msg
+
     finally:
       #utils.Unlock('cmd')
       #utils.LockCleanup()