Commit 57987785 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

objects: Add helper function to fill disk parameters

Signed-off-by: default avatarRené Nussbaumer <>
Reviewed-by: default avatarIustin Pop <>
parent 5fa0375e
......@@ -112,6 +112,19 @@ def FillIPolicy(default_ipolicy, custom_ipolicy, skip_keys=None):
return ret_dict
def FillDiskParams(default_dparams, custom_dparams, skip_keys=None):
"""Fills the disk parameter defaults.
@see FillDict: For parameters and return value
assert frozenset(default_dparams.keys()) == constants.DISK_TEMPLATES
return dict((dt, FillDict(default_dparams[dt], custom_dparams.get(dt, {}),
for dt in constants.DISK_TEMPLATES)
def UpgradeGroupedParams(target, defaults):
"""Update all groups for the target parameter.
......@@ -155,12 +168,7 @@ def UpgradeDiskParams(diskparams):
if diskparams is None:
result = constants.DISK_DT_DEFAULTS.copy()
# Update the disk parameter values for each disk template.
# The code iterates over constants.DISK_TEMPLATES because new templates
# might have been added.
result = dict((dt, FillDict(constants.DISK_DT_DEFAULTS[dt],
diskparams.get(dt, {})))
for dt in constants.DISK_TEMPLATES)
result = FillDiskParams(constants.DISK_DT_DEFAULTS, diskparams)
return result
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