Commit 4e0b4d2d authored by Guido Trotter's avatar Guido Trotter
Browse files

Parallelize LUReinstallInstance

self.recalculate_locks[locking.LEVEL_NODE] could have any value and
everything would work anyway. We'll use the string 'replace' by
convention because in the future we might want an 'append' mode.

Reviewed-by: iustinp
parent c4a2fee1
......@@ -2191,6 +2191,16 @@ class LUReinstallInstance(LogicalUnit):
HPATH = "instance-reinstall"
_OP_REQP = ["instance_name"]
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.
......@@ -2209,11 +2219,10 @@ class LUReinstallInstance(LogicalUnit):
This checks that the instance is in the cluster and is not running.
instance = self.cfg.GetInstanceInfo(
if instance is None:
raise errors.OpPrereqError("Instance '%s' not known" %
instance = self.cfg.GetInstanceInfo(self.op.instance_name)
assert instance is not None, \
"Cannot retrieve locked instance %s" % self.op.instance_name
if instance.disk_template == constants.DT_DISKLESS:
raise errors.OpPrereqError("Instance '%s' has no disks" %
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