....provided we failed to obtain enough resources with opportunistic
locking. In this case, we fall back to full (non-opportunistic) lock
allocation.

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

diff --git a/lib/cmdlib/instance.py b/lib/cmdlib/instance.py
index cf7dea9..0ad343d 100644
--- a/lib/cmdlib/instance.py
+++ b/lib/cmdlib/instance.py
@@ -1799,6 +1799,16 @@ class LUInstanceCreate(LogicalUnit):
 
     return self.cfg.GetNodeNames(list(self.cfg.GetInstanceNodes(iobj.uuid)))
 
+  def PrepareRetry(self, feedback_fn):
+    # A temporary lack of resources can only happen if opportunistic locking
+    # is used.
+    assert self.op.opportunistic_locking
+
+    logging.info("Opportunistic locking did not suceed, falling back to"
+                 " full lock allocation")
+    feedback_fn("* falling back to full lock allocation")
+    self.op.opportunistic_locking = False
+
 
 class LUInstanceRename(LogicalUnit):
   """Rename an instance.
-- 
2.1.0.rc2.206.gedb03e5

Reply via email to