Revision c7a02959 tools/cfgupgrade

b/tools/cfgupgrade
54 54
#: Target major version we will upgrade to
55 55
TARGET_MAJOR = 2
56 56
#: Target minor version we will upgrade to
57
TARGET_MINOR = 10
57
TARGET_MINOR = 11
58 58
#: Target major version for downgrade
59 59
DOWNGRADE_MAJOR = 2
60 60
#: Target minor version for downgrade
61
DOWNGRADE_MINOR = 9
61
DOWNGRADE_MINOR = 10
62 62

  
63 63
# map of legacy device types
64 64
# (mapping differing old LD_* constants to new DT_* constants)
......
394 394
  UpgradeInstanceIndices(config_data)
395 395

  
396 396

  
397
def DowngradeInstances(config_data):
398
  if "instances" not in config_data:
399
    raise Error("Cannot find the 'instances' key in the configuration!")
400
  for (iname, iobj) in config_data["instances"].items():
401
    DowngradeNicParamsVLAN(iobj["nics"], iname)
402

  
403

  
404
def DowngradeNicParamsVLAN(nics, owner):
405
  for nic in nics:
406
    vlan = nic["nicparams"].get("vlan", None)
407
    if vlan:
408
      logging.warning("Instance with name %s found. Removing VLAN information"
409
                      " %s.", owner, vlan)
410
      del nic["nicparams"]["vlan"]
411

  
412

  
413 397
def DowngradeAll(config_data):
414 398
  # Any code specific to a particular version should be labeled that way, so
415 399
  # it can be removed when updating to the next version.
416 400
  config_data["version"] = version.BuildVersion(DOWNGRADE_MAJOR,
417 401
                                                DOWNGRADE_MINOR, 0)
418
  DowngradeInstances(config_data)
419 402

  
420 403

  
421 404
def main():
......
536 519
                   config_minor, config_revision))
537 520
    DowngradeAll(config_data)
538 521

  
539
  # Upgrade from 2.{0..9} to 2.10
540
  elif config_major == 2 and config_minor in range(0, 10):
522
  # Upgrade from 2.{0..10} to 2.11
523
  elif config_major == 2 and config_minor in range(0, 11):
541 524
    if config_revision != 0:
542 525
      logging.warning("Config revision is %s, not 0", config_revision)
543 526
    UpgradeAll(config_data)

Also available in: Unified diff