Commit 1a5c7281 authored by Guido Trotter's avatar Guido Trotter
Browse files

Convert SetInstanceParams to concurrency

Grab a lock for the instance we're working on, and update its params.

Reviewed-by: iustinp
parent ea94e1cd
......@@ -4097,6 +4097,10 @@ class LUSetInstanceParams(LogicalUnit):
HPATH = "instance-modify"
_OP_REQP = ["instance_name"]
REQ_BGL = False
def ExpandNames(self):
def BuildHooksEnv(self):
"""Build hooks env.
......@@ -4134,6 +4138,9 @@ class LUSetInstanceParams(LogicalUnit):
This only checks the instance list against the existing names.
# FIXME: all the parameters could be checked before, in ExpandNames, or in
# a separate CheckArguments function, if we implement one, so the operation
# can be aborted without waiting for any lock, should it have an error...
self.mem = getattr(self.op, "mem", None)
self.vcpus = getattr(self.op, "vcpus", None)
self.ip = getattr(self.op, "ip", None)
......@@ -4228,13 +4235,9 @@ class LUSetInstanceParams(LogicalUnit):
" like a valid IP address" %
instance = self.cfg.GetInstanceInfo(
if instance is None:
raise errors.OpPrereqError("No such instance name '%s'" %
self.op.instance_name =
self.instance = instance
self.instance = self.cfg.GetInstanceInfo(self.op.instance_name)
assert self.instance is not None, \
"Cannot retrieve locked instance %s" % self.op.instance_name
def Exec(self, feedback_fn):
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