Commit 30448dc7 authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

cfgupgrade: Remove spindles on downgrade



Spindles didn't exist in 2.8 and should be removed to downgrade.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent 75a6c8be
......@@ -260,11 +260,29 @@ def UpgradeAll(config_data):
UpgradeInstances(config_data)
def DowngradeDisks(disks, owner):
for disk in disks:
# Remove spindles to downgrade to 2.8
if "spindles" in disk:
logging.warning("Removing spindles (value=%s) from disk %s (%s) of"
" instance %s",
disk["spindles"], disk["iv_name"], disk["uuid"], owner)
del disk["spindles"]
def DowngradeInstances(config_data):
if "instances" not in config_data:
raise Error("Cannot find the 'instances' key in the configuration!")
for (iname, iobj) in config_data["instances"].items():
if "disks" not in iobj:
raise Error("Cannot find 'disks' key for instance %s" % iname)
DowngradeDisks(iobj["disks"], iname)
def DowngradeAll(config_data):
# Unused arguments, pylint: disable=W0613
# Any code specific to a particular version should be labeled that way, so
# it can be removed when updating to the next version.
pass
DowngradeInstances(config_data)
def main():
......
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