Commit b1a38185 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Correctly downgrade the new node paramter



In other words, remove "cpu_speed" from all "nodeparams"
where it is present, be it cluster, group, or node. Note
that upgrading is no problem, as the default value will
be used implicitly.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent 8fd6c773
......@@ -405,12 +405,19 @@ def UpgradeAll(config_data):
# DOWNGRADE ------------------------------------------------------------
def DowngradeNodeParams(config_object):
if "ndparams" in config_object:
if "cpu_speed" in config_object["ndparams"]:
del config_object["ndparams"]["cpu_speed"]
def DowngradeCluster(config_data):
cluster = config_data.get("cluster", None)
if not cluster:
raise Error("Cannot find the 'cluster' key in the configuration")
DowngradeNodeParams(cluster)
if "osparams_private_cluster" in cluster:
del cluster["osparams_private_cluster"]
......@@ -421,6 +428,16 @@ def DowngradeCluster(config_data):
del cluster["zeroing_image"]
def DowngradeGroups(config_data):
for group in config_data["nodegroups"].values():
DowngradeNodeParams(group)
def DowngradeNodes(config_data):
for group in config_data["nodes"].values():
DowngradeNodeParams(group)
def DowngradeInstances(config_data):
instances = config_data.get("instances", None)
if instances is None:
......@@ -437,6 +454,8 @@ def DowngradeAll(config_data):
config_data["version"] = version.BuildVersion(DOWNGRADE_MAJOR,
DOWNGRADE_MINOR, 0)
DowngradeCluster(config_data)
DowngradeGroups(config_data)
DowngradeNodes(config_data)
DowngradeInstances(config_data)
......
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