Revision 31e63dbf
b/lib/cmdlib.py | ||
---|---|---|
3996 | 3996 |
HPATH = "disk-grow" |
3997 | 3997 |
HTYPE = constants.HTYPE_INSTANCE |
3998 | 3998 |
_OP_REQP = ["instance_name", "disk", "amount"] |
3999 |
REQ_BGL = False |
|
4000 |
|
|
4001 |
def ExpandNames(self): |
|
4002 |
self._ExpandAndLockInstance() |
|
4003 |
self.needed_locks[locking.LEVEL_NODE] = [] |
|
4004 |
self.recalculate_locks[locking.LEVEL_NODE] = 'replace' |
|
4005 |
|
|
4006 |
def DeclareLocks(self, level): |
|
4007 |
if level == locking.LEVEL_NODE: |
|
4008 |
self._LockInstancesNodes() |
|
3999 | 4009 |
|
4000 | 4010 |
def BuildHooksEnv(self): |
4001 | 4011 |
"""Build hooks env. |
... | ... | |
4020 | 4030 |
This checks that the instance is in the cluster. |
4021 | 4031 |
|
4022 | 4032 |
""" |
4023 |
instance = self.cfg.GetInstanceInfo( |
|
4024 |
self.cfg.ExpandInstanceName(self.op.instance_name)) |
|
4025 |
if instance is None: |
|
4026 |
raise errors.OpPrereqError("Instance '%s' not known" % |
|
4027 |
self.op.instance_name) |
|
4033 |
instance = self.cfg.GetInstanceInfo(self.op.instance_name) |
|
4034 |
assert instance is not None, \ |
|
4035 |
"Cannot retrieve locked instance %s" % self.op.instance_name |
|
4036 |
|
|
4028 | 4037 |
self.instance = instance |
4029 |
self.op.instance_name = instance.name |
|
4030 | 4038 |
|
4031 | 4039 |
if instance.disk_template not in (constants.DT_PLAIN, constants.DT_DRBD8): |
4032 | 4040 |
raise errors.OpPrereqError("Instance's disk layout does not support" |
Also available in: Unified diff