Commit c113a9ab authored by Guido Trotter's avatar Guido Trotter
Browse files

Failover and Migrate: acquire node resource locks


Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 081d8528
......@@ -7363,6 +7363,9 @@ class LUInstanceFailover(LogicalUnit):
self.needed_locks[locking.LEVEL_NODE] = []
self.recalculate_locks[locking.LEVEL_NODE] = constants.LOCKS_REPLACE
 
self.needed_locks[locking.LEVEL_NODE_RES] = []
self.recalculate_locks[locking.LEVEL_NODE_RES] = constants.LOCKS_REPLACE
ignore_consistency = self.op.ignore_consistency
shutdown_timeout = self.op.shutdown_timeout
self._migrater = TLMigrateInstance(self, self.op.instance_name,
......@@ -7385,6 +7388,10 @@ class LUInstanceFailover(LogicalUnit):
del self.recalculate_locks[locking.LEVEL_NODE]
else:
self._LockInstancesNodes()
elif level == locking.LEVEL_NODE_RES:
# Copy node locks
self.needed_locks[locking.LEVEL_NODE_RES] = \
self.needed_locks[locking.LEVEL_NODE][:]
 
def BuildHooksEnv(self):
"""Build hooks env.
......@@ -7441,6 +7448,9 @@ class LUInstanceMigrate(LogicalUnit):
self.needed_locks[locking.LEVEL_NODE] = []
self.recalculate_locks[locking.LEVEL_NODE] = constants.LOCKS_REPLACE
 
self.needed_locks[locking.LEVEL_NODE] = []
self.recalculate_locks[locking.LEVEL_NODE] = constants.LOCKS_REPLACE
self._migrater = TLMigrateInstance(self, self.op.instance_name,
cleanup=self.op.cleanup,
failover=False,
......@@ -7460,6 +7470,10 @@ class LUInstanceMigrate(LogicalUnit):
del self.recalculate_locks[locking.LEVEL_NODE]
else:
self._LockInstancesNodes()
elif level == locking.LEVEL_NODE_RES:
# Copy node locks
self.needed_locks[locking.LEVEL_NODE_RES] = \
self.needed_locks[locking.LEVEL_NODE][:]
 
def BuildHooksEnv(self):
"""Build hooks env.
......
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