Revision 1a5c7281 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
4097 | 4097 |
HPATH = "instance-modify" |
4098 | 4098 |
HTYPE = constants.HTYPE_INSTANCE |
4099 | 4099 |
_OP_REQP = ["instance_name"] |
4100 |
REQ_BGL = False |
|
4101 |
|
|
4102 |
def ExpandNames(self): |
|
4103 |
self._ExpandAndLockInstance() |
|
4100 | 4104 |
|
4101 | 4105 |
def BuildHooksEnv(self): |
4102 | 4106 |
"""Build hooks env. |
... | ... | |
4134 | 4138 |
This only checks the instance list against the existing names. |
4135 | 4139 |
|
4136 | 4140 |
""" |
4141 |
# FIXME: all the parameters could be checked before, in ExpandNames, or in |
|
4142 |
# a separate CheckArguments function, if we implement one, so the operation |
|
4143 |
# can be aborted without waiting for any lock, should it have an error... |
|
4137 | 4144 |
self.mem = getattr(self.op, "mem", None) |
4138 | 4145 |
self.vcpus = getattr(self.op, "vcpus", None) |
4139 | 4146 |
self.ip = getattr(self.op, "ip", None) |
... | ... | |
4228 | 4235 |
" like a valid IP address" % |
4229 | 4236 |
self.op.vnc_bind_address) |
4230 | 4237 |
|
4231 |
instance = self.cfg.GetInstanceInfo( |
|
4232 |
self.cfg.ExpandInstanceName(self.op.instance_name)) |
|
4233 |
if instance is None: |
|
4234 |
raise errors.OpPrereqError("No such instance name '%s'" % |
|
4235 |
self.op.instance_name) |
|
4236 |
self.op.instance_name = instance.name |
|
4237 |
self.instance = instance |
|
4238 |
self.instance = self.cfg.GetInstanceInfo(self.op.instance_name) |
|
4239 |
assert self.instance is not None, \ |
|
4240 |
"Cannot retrieve locked instance %s" % self.op.instance_name |
|
4238 | 4241 |
return |
4239 | 4242 |
|
4240 | 4243 |
def Exec(self, feedback_fn): |
Also available in: Unified diff