From a9105b24f3f5441bbf03e625dca9999345a70fad Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 22 Feb 2010 18:22:28 +0100
Subject: [PATCH] Catch disk activation errors in watcher

If activating disks fails for some reason, the watcher didn't
catch the exception. With this patch it's caught and logged.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 daemons/ganeti-watcher | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/daemons/ganeti-watcher b/daemons/ganeti-watcher
index 4f8eb935a..32c3ac475 100755
--- a/daemons/ganeti-watcher
+++ b/daemons/ganeti-watcher
@@ -440,7 +440,10 @@ class Watcher(object):
            for name in offline_disk_instances]
     job_id = cli.SendJob(job, cl=client)
 
-    cli.PollJob(job_id, cl=client, feedback_fn=logging.debug)
+    try:
+      cli.PollJob(job_id, cl=client, feedback_fn=logging.debug)
+    except Exception: # pylint: disable-msg=W0703
+      logging.exception("Error while activating disks")
 
 
 def ParseOptions():
-- 
GitLab