Revision 765ada2b
b/lib/objects.py | ||
---|---|---|
149 | 149 |
@type diskparams: dict |
150 | 150 |
@param diskparams: disk parameters to upgrade |
151 | 151 |
@rtype: dict |
152 |
@return: the upgraded disk parameters dit |
|
152 |
@return: the upgraded disk parameters dict
|
|
153 | 153 |
|
154 | 154 |
""" |
155 |
result = dict() |
|
156 | 155 |
if diskparams is None: |
157 | 156 |
result = constants.DISK_DT_DEFAULTS.copy() |
158 | 157 |
else: |
159 | 158 |
# Update the disk parameter values for each disk template. |
160 | 159 |
# The code iterates over constants.DISK_TEMPLATES because new templates |
161 | 160 |
# might have been added. |
162 |
for template in constants.DISK_TEMPLATES: |
|
163 |
if template not in diskparams: |
|
164 |
result[template] = constants.DISK_DT_DEFAULTS[template].copy() |
|
165 |
else: |
|
166 |
result[template] = FillDict(constants.DISK_DT_DEFAULTS[template], |
|
167 |
diskparams[template]) |
|
161 |
result = dict((dt, FillDict(constants.DISK_DT_DEFAULTS[dt], |
|
162 |
diskparams.get(dt, {}))) |
|
163 |
for dt in constants.DISK_TEMPLATES) |
|
168 | 164 |
|
169 | 165 |
return result |
170 | 166 |
|
Also available in: Unified diff