Commit 2a27dac3 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix upgrading of ndparams



Currently, we only upgrade the ndparams if they are missing
completely, which creates problems if we add any new parameters on an
already-upgraded cluster.

Fix this by adding an UpgradeNDParams function.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 765ada2b
......@@ -165,6 +165,21 @@ def UpgradeDiskParams(diskparams):
return result
def UpgradeNDParams(ndparams):
"""Upgrade ndparams structure.
@type ndparams: dict
@param ndparams: disk parameters to upgrade
@rtype: dict
@return: the upgraded node parameters dict
"""
if ndparams is None:
ndparams = {}
return FillDict(constants.NDC_DEFAULTS, ndparams)
def MakeEmptyIPolicy():
"""Create empty IPolicy dictionary.
......@@ -1473,8 +1488,7 @@ class Cluster(TaggableObject):
if self.osparams is None:
self.osparams = {}
if self.ndparams is None:
self.ndparams = constants.NDC_DEFAULTS
self.ndparams = UpgradeNDParams(self.ndparams)
self.beparams = UpgradeGroupedParams(self.beparams,
constants.BEC_DEFAULTS)
......
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