Skip to content
Snippets Groups Projects
Commit 904910c4 authored by Iustin Pop's avatar Iustin Pop
Browse files

Upgrade wrong iv_names at cfgupgrade time


Since Ganeti 2.6 does warn about disks with wrong iv_names, it would
be better to fix them when upgrading to 2.6.

Not sure if this is too brittle and whether we want to add more
safeguards on the contents of the config/instance/disks before
touching them.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent ad48eacc
No related branches found
No related tags found
No related merge requests found
......@@ -188,6 +188,21 @@ def main():
config_data["version"] = constants.BuildVersion(TARGET_MAJOR,
TARGET_MINOR, 0)
if "instances" not in config_data:
raise Error("Can't find the 'instances' key in the configuration!")
for instance, iobj in config_data["instances"].items():
if "disks" not in iobj:
raise Error("Instance '%s' doesn't have a disks entry?!" % instance)
disks = iobj["disks"]
for idx, dobj in enumerate(disks):
expected = "disk/%s" % idx
current = dobj.get("iv_name", "")
if current != expected:
logging.warning("Updating iv_name for instance %s/disk %s"
" from '%s' to '%s'",
instance, idx, current, expected)
dobj["iv_name"] = expected
elif config_major == TARGET_MAJOR and config_minor == TARGET_MINOR:
logging.info("No changes necessary")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment