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

Parallelize LUFailoverInstance

Reviewed-by: iustinp
parent 64381ad7
......@@ -2580,6 +2580,16 @@ class LUFailoverInstance(LogicalUnit):
HPATH = "instance-failover"
_OP_REQP = ["instance_name", "ignore_consistency"]
REQ_BGL = False
def ExpandNames(self):
self.needed_locks[locking.LEVEL_NODE] = []
self.recalculate_locks[locking.LEVEL_NODE] = 'replace'
def DeclareLocks(self, level):
if level == locking.LEVEL_NODE:
def BuildHooksEnv(self):
"""Build hooks env.
......@@ -2600,11 +2610,9 @@ class LUFailoverInstance(LogicalUnit):
This checks that the instance is in the cluster.
instance = self.cfg.GetInstanceInfo(
if instance is None:
raise errors.OpPrereqError("Instance '%s' not known" %
self.instance = instance = self.cfg.GetInstanceInfo(self.op.instance_name)
assert self.instance is not None, \
"Cannot retrieve locked instance %s" % self.op.instance_name
if instance.disk_template not in constants.DTS_NET_MIRROR:
raise errors.OpPrereqError("Instance's disk layout is not"
......@@ -2627,8 +2635,6 @@ class LUFailoverInstance(LogicalUnit):
" exist on destination node '%s'" %
(brlist, target_node))
self.instance = instance
def Exec(self, feedback_fn):
"""Failover an instance.
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