Revision d8819d84 tools/cfgupgrade

b/tools/cfgupgrade
350 350
  UpgradeInstanceIndices(config_data)
351 351

  
352 352

  
353
def DowngradeInstances(config_data):
354
  if "instances" not in config_data:
355
    raise Error("Cannot find the 'instances' key in the configuration!")
356
  for (iname, iobj) in config_data["instances"].items():
357
    DowngradeNicParamsVLAN(iobj["nics"], iname)
358

  
359

  
360
def DowngradeNicParamsVLAN(nics, owner):
361
  for nic in nics:
362
    vlan = nic["nicparams"].get("vlan", None)
363
    if vlan:
364
      logging.warning("Instance with name %s found. Removing VLAN information"
365
                      " %s.", owner, vlan)
366
      del nic["nicparams"]["vlan"]
367

  
368

  
353 369
def DowngradeAll(config_data):
354 370
  # Any code specific to a particular version should be labeled that way, so
355 371
  # it can be removed when updating to the next version.
356 372
  config_data["version"] = constants.BuildVersion(DOWNGRADE_MAJOR,
357 373
                                                  DOWNGRADE_MINOR, 0)
374
  DowngradeInstances(config_data)
358 375

  
359 376

  
360 377
def main():

Also available in: Unified diff