Revision f032d55c tools/cfgupgrade

b/tools/cfgupgrade
111 111
      group["networks"] = {}
112 112

  
113 113

  
114
def UpgradeInstances(config_data):
115
  network2uuid = dict((n["name"], n["uuid"])
116
                      for n in config_data["networks"].values())
117
  for inst in config_data["instances"].values():
118
    for nic in inst["nics"]:
119
      name = nic.get("network", None)
120
      if name:
121
        uuid = network2uuid.get(name, None)
122
        if uuid:
123
          print("NIC with network name %s found."
124
                " Substituting with uuid %s." % (name, uuid))
125
          nic["network"] = uuid
126

  
127

  
114 128
def main():
115 129
  """Main program.
116 130

  
......
294 308

  
295 309
  UpgradeNetworks(config_data)
296 310
  UpgradeGroups(config_data)
311
  UpgradeInstances(config_data)
297 312

  
298 313
  try:
299 314
    logging.info("Writing configuration file to %s", options.CONFIG_DATA_PATH)

Also available in: Unified diff