Merge branch 'stable-2.9' into stable-2.10
[ganeti-local] / lib / jqueue.py
index 9e9d988..6f7bebd 100644 (file)
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -1757,8 +1757,9 @@ class JobQueue(object):
           job.MarkUnfinishedOps(constants.OP_STATUS_QUEUED, None)
           restartjobs.append(job)
         else:
+          to_encode = errors.OpExecError("Unclean master daemon shutdown")
           job.MarkUnfinishedOps(constants.OP_STATUS_ERROR,
-                                "Unclean master daemon shutdown")
+                                _EncodeOpError(to_encode))
           job.Finalize()
 
         self.UpdateJobUnlocked(job)
@@ -2043,6 +2044,8 @@ class JobQueue(object):
     @return: either None or the job object
 
     """
+    assert isinstance(job_id, int), "Job queue: Supplied job id is not an int!"
+
     job = self._memcache.get(job_id, None)
     if job:
       logging.debug("Found job %s in memcache", job_id)