Revision b3f0d718 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
13583 | 13583 |
|
13584 | 13584 |
if self.op.diskparams: |
13585 | 13585 |
for templ in constants.DISK_TEMPLATES: |
13586 |
if templ not in self.op.diskparams: |
|
13587 |
self.op.diskparams[templ] = {} |
|
13588 |
utils.ForceDictType(self.op.diskparams[templ], constants.DISK_DT_TYPES) |
|
13586 |
if templ in self.op.diskparams: |
|
13587 |
utils.ForceDictType(self.op.diskparams[templ], |
|
13588 |
constants.DISK_DT_TYPES) |
|
13589 |
self.new_diskparams = self.op.diskparams |
|
13589 | 13590 |
else: |
13590 |
self.op.diskparams = self.cfg.GetClusterInfo().diskparams
|
|
13591 |
self.new_diskparams = None
|
|
13591 | 13592 |
|
13592 | 13593 |
if self.op.ipolicy: |
13593 | 13594 |
cluster = self.cfg.GetClusterInfo() |
... | ... | |
13621 | 13622 |
uuid=self.group_uuid, |
13622 | 13623 |
alloc_policy=self.op.alloc_policy, |
13623 | 13624 |
ndparams=self.op.ndparams, |
13624 |
diskparams=self.op.diskparams,
|
|
13625 |
diskparams=self.new_diskparams,
|
|
13625 | 13626 |
ipolicy=self.op.ipolicy, |
13626 | 13627 |
hv_state_static=self.new_hv_state, |
13627 | 13628 |
disk_state_static=self.new_disk_state) |
... | ... | |
13904 | 13905 |
self.needed_locks[locking.LEVEL_INSTANCE] = \ |
13905 | 13906 |
self.cfg.GetNodeGroupInstances(self.group_uuid) |
13906 | 13907 |
|
13908 |
@staticmethod |
|
13909 |
def _UpdateAndVerifyDiskParams(old, new): |
|
13910 |
"""Updates and verifies disk parameters. |
|
13911 |
|
|
13912 |
""" |
|
13913 |
new_params = _GetUpdatedParams(old, new) |
|
13914 |
utils.ForceDictType(new_params, constants.DISK_DT_TYPES) |
|
13915 |
return new_params |
|
13916 |
|
|
13907 | 13917 |
def CheckPrereq(self): |
13908 | 13918 |
"""Check prerequisites. |
13909 | 13919 |
|
... | ... | |
13926 | 13936 |
self.new_ndparams = new_ndparams |
13927 | 13937 |
|
13928 | 13938 |
if self.op.diskparams: |
13929 |
self.new_diskparams = dict() |
|
13930 |
for templ in constants.DISK_TEMPLATES: |
|
13931 |
if templ not in self.op.diskparams: |
|
13932 |
self.op.diskparams[templ] = {} |
|
13933 |
new_templ_params = _GetUpdatedParams(self.group.diskparams[templ], |
|
13934 |
self.op.diskparams[templ]) |
|
13935 |
utils.ForceDictType(new_templ_params, constants.DISK_DT_TYPES) |
|
13936 |
self.new_diskparams[templ] = new_templ_params |
|
13939 |
diskparams = self.group.diskparams |
|
13940 |
new_diskparams = dict((dt, |
|
13941 |
self._UpdateAndVerifyDiskParams(diskparams[dt], |
|
13942 |
self.op.diskparams[dt])) |
|
13943 |
for dt in constants.DISK_TEMPLATES |
|
13944 |
if dt in self.op.diskparams) |
|
13945 |
self.new_diskparams = objects.FillDiskParams(diskparams, new_diskparams) |
|
13937 | 13946 |
|
13938 | 13947 |
if self.op.hv_state: |
13939 | 13948 |
self.new_hv_state = _MergeAndVerifyHvState(self.op.hv_state, |
Also available in: Unified diff