Commit d8819d84 authored by Sebastian Gebhard's avatar Sebastian Gebhard Committed by Klaus Aehlig
Browse files

Adopt cfgupgrade to support vlan parameter



This patch updates cfgupgrade to support vlans.
Downgrade will remove the vlan information and give a warning.
Signed-off-by: default avatarSebastian Gebhard <sege@fs.ei.tum.de>
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 7e4ac0c2
......@@ -350,11 +350,28 @@ def UpgradeAll(config_data):
UpgradeInstanceIndices(config_data)
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():
DowngradeNicParamsVLAN(iobj["nics"], iname)
def DowngradeNicParamsVLAN(nics, owner):
for nic in nics:
vlan = nic["nicparams"].get("vlan", None)
if vlan:
logging.warning("Instance with name %s found. Removing VLAN information"
" %s.", owner, vlan)
del nic["nicparams"]["vlan"]
def DowngradeAll(config_data):
# Any code specific to a particular version should be labeled that way, so
# it can be removed when updating to the next version.
config_data["version"] = constants.BuildVersion(DOWNGRADE_MAJOR,
DOWNGRADE_MINOR, 0)
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