From ea6e6c2b9ad7642a44f1584c3c9302a3c34c169a Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Fri, 13 Jun 2008 10:14:31 +0000
Subject: [PATCH] Fail job on ganeti exceptions

When a Job raises a ganeti exception a message is printed but nothing is
reported in the job itself. It's better to update the job status, thus
notifying the client, possibly polling for the job result, of what went
wrong.

Reviewed-by: iustinp
---
 daemons/ganeti-masterd | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd
index 72c0fd5c9..8b02ac6af 100755
--- a/daemons/ganeti-masterd
+++ b/daemons/ganeti-masterd
@@ -285,7 +285,9 @@ def PoolWorker(worker_id, incoming_queue):
       try:
         JobRunner(proc, item)
       except errors.GenericError, err:
-        print "ganeti exception %s" % err
+        msg = "ganeti exception %s" % err
+        item.SetStatus(opcodes.Job.STATUS_FAIL, result=[msg])
+        print msg
     finally:
       #utils.Unlock('cmd')
       #utils.LockCleanup()
-- 
GitLab