Commit ef66500f authored by Michael Hanselmann's avatar Michael Hanselmann Committed by Guido Trotter
Browse files

Fix locking mistake introduced in commit 5cc1f887



The node resource locks were not set correctly on instance import.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 7e723913
...@@ -9849,8 +9849,6 @@ class LUInstanceCreate(LogicalUnit): ...@@ -9849,8 +9849,6 @@ class LUInstanceCreate(LogicalUnit):
# specifying a group on instance creation and then selecting nodes from # specifying a group on instance creation and then selecting nodes from
# that group # that group
self.needed_locks[locking.LEVEL_NODE] = locking.ALL_SET self.needed_locks[locking.LEVEL_NODE] = locking.ALL_SET
self.needed_locks[locking.LEVEL_NODE_RES] = \
_CopyLockList(self.needed_locks[locking.LEVEL_NODE])
self.needed_locks[locking.LEVEL_NODE_ALLOC] = locking.ALL_SET self.needed_locks[locking.LEVEL_NODE_ALLOC] = locking.ALL_SET
else: else:
self.op.pnode = _ExpandNodeName(self.cfg, self.op.pnode) self.op.pnode = _ExpandNodeName(self.cfg, self.op.pnode)
...@@ -9859,9 +9857,6 @@ class LUInstanceCreate(LogicalUnit): ...@@ -9859,9 +9857,6 @@ class LUInstanceCreate(LogicalUnit):
self.op.snode = _ExpandNodeName(self.cfg, self.op.snode) self.op.snode = _ExpandNodeName(self.cfg, self.op.snode)
nodelist.append(self.op.snode) nodelist.append(self.op.snode)
self.needed_locks[locking.LEVEL_NODE] = nodelist self.needed_locks[locking.LEVEL_NODE] = nodelist
# Lock resources of instance's primary and secondary nodes (copy to
# prevent accidential modification)
self.needed_locks[locking.LEVEL_NODE_RES] = list(nodelist)
   
# in case of import lock the source node too # in case of import lock the source node too
if self.op.mode == constants.INSTANCE_IMPORT: if self.op.mode == constants.INSTANCE_IMPORT:
...@@ -9887,6 +9882,9 @@ class LUInstanceCreate(LogicalUnit): ...@@ -9887,6 +9882,9 @@ class LUInstanceCreate(LogicalUnit):
self.op.src_path = src_path = \ self.op.src_path = src_path = \
utils.PathJoin(pathutils.EXPORT_DIR, src_path) utils.PathJoin(pathutils.EXPORT_DIR, src_path)
   
self.needed_locks[locking.LEVEL_NODE_RES] = \
_CopyLockList(self.needed_locks[locking.LEVEL_NODE])
def _RunAllocator(self): def _RunAllocator(self):
"""Run the allocator based on input opcode. """Run the allocator based on input opcode.
   
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment