With the change to the new locking system, there is no
need any more to create locks at run time. As a consequence
of this, no check happens at "lock addition" that the lock
doesn't exist already. Fix the old comment still claiming this
and repeat the instance existence check at CheckPrereq.

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

diff --git a/lib/cmdlib/instance_create.py b/lib/cmdlib/instance_create.py
index a5201f3..235aa1f 100644
--- a/lib/cmdlib/instance_create.py
+++ b/lib/cmdlib/instance_create.py
@@ -338,7 +338,7 @@ class LUInstanceCreate(LogicalUnit):
     self.needed_locks = {}
 
     # this is just a preventive check, but someone might still add this
-    # instance in the meantime, and creation will fail at lock-add time
+    # instance in the meantime; we check again in CheckPrereq
     CheckInstanceExistence(self, self.op.instance_name)
 
     self.add_locks[locking.LEVEL_INSTANCE] = self.op.instance_name
@@ -678,6 +678,7 @@ class LUInstanceCreate(LogicalUnit):
     """Check prerequisites.
 
     """
+    CheckInstanceExistence(self, self.op.instance_name)
     # Check that the optimistically acquired groups are correct wrt the
     # acquired nodes
     owned_groups = frozenset(self.owned_locks(locking.LEVEL_NODEGROUP))
-- 
2.1.0.rc2.206.gedb03e5

Reply via email to