On Tue, Sep 23, 2014 at 12:00:22PM +0200, 'Klaus Aehlig' via ganeti-devel wrote:
If the execution of a logical unit indicates that it is
temporarily out of resource (ECODE_TEMP_NORES), then make
the mcpu prepare the the logical unit for retry and restart
again.

Signed-off-by: Klaus Aehlig <[email protected]>
---
lib/mcpu.py | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/lib/mcpu.py b/lib/mcpu.py
index ee87c2c..609e240 100644
--- a/lib/mcpu.py
+++ b/lib/mcpu.py
@@ -582,6 +582,19 @@ class Processor(object):

      try:
        result = self._ExecLU(lu)
+      except errors.OpPrereqError, err:
+        (_, ecode) = err.args
+        if ecode != errors.ECODE_TEMP_NORES:
+          raise
+        logging.debug("Temporarily out of resources; will retry internally")
+        try:
+          lu.PrepareRetry(self.Log)
+          if self._cbs:
+            self._cbs.NotifyRetry()
+        except errors.OpRetryNotSupportedError:
+          logging.debug("LU does not know how to retry.")
+          raise err
+        raise LockAcquireTimeout()
      except AssertionError, err:
        # this is a bit ugly, as we don't know from which phase
        # (prereq, exec) this comes; but it's better than an exception
--
2.1.0.rc2.206.gedb03e5


LGTM

Reply via email to