Commit 9c8971d7 authored by Guido Trotter's avatar Guido Trotter
Browse files

LUCreateInstance: keep src node lock on import

Currently the node lock also guards against removing the import at the
wrong time, so if we're importing an instance image we want to keep the
source node locked. In the future we might want to put export locks at a
different level than node locks.

Reviewed-by: iustinp
parent bbe19c17
......@@ -3941,8 +3941,15 @@ class LUCreateInstance(LogicalUnit):
# Remove the temp. assignements for the instance's drbds
self.cfg.ReleaseDRBDMinors(instance)
# Unlock all the nodes
self.context.glm.release(locking.LEVEL_NODE)
del self.acquired_locks[locking.LEVEL_NODE]
if self.op.mode == constants.INSTANCE_IMPORT:
nodes_keep = [self.op.src_node]
nodes_release = [node for node in self.acquired_locks[locking.LEVEL_NODE]
if node != self.op.src_node]
self.context.glm.release(locking.LEVEL_NODE, nodes_release)
self.acquired_locks[locking.LEVEL_NODE] = nodes_keep
else:
self.context.glm.release(locking.LEVEL_NODE)
del self.acquired_locks[locking.LEVEL_NODE]
if self.op.wait_for_sync:
disk_abort = not _WaitForSync(self, iobj)
......
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