Revision 5275a77f

b/test/py/cfgupgrade_unittest.py
392 392
    _RunUpgrade(self.tmpdir, False, True, downgrade=True)
393 393
    oldconf = self._LoadTestDataConfig(oldconfname)
394 394
    newconf = self._LoadConfig()
395

  
396
    # downgrade from 2.10 to 2.9 does not add physical_id to disks, which is ok
397
    for inst in oldconf["instances"].values():
398
      for disk in inst["disks"]:
399
        del disk["physical_id"]
400

  
395 401
    self.assertEqual(oldconf, newconf)
396 402

  
397 403
  def testDowngradeFullConfigBackwardFrom_2_7(self):
b/tools/cfgupgrade
173 173
  return ret
174 174

  
175 175

  
176
def RemovePhysicalId(disk):
177
  if "children" in disk:
178
    for d in disk["children"]:
179
      RemovePhysicalId(d)
180
  if "physical_id" in disk:
181
    del disk["physical_id"]
182

  
183

  
176 184
def UpgradeInstances(config_data):
177 185
  network2uuid = dict((n["name"], n["uuid"])
178 186
                      for n in config_data["networks"].values())
......
194 202
      raise Error("Instance '%s' doesn't have a disks entry?!" % instance)
195 203
    disks = iobj["disks"]
196 204
    for idx, dobj in enumerate(disks):
205
      RemovePhysicalId(dobj)
206

  
197 207
      expected = "disk/%s" % idx
198 208
      current = dobj.get("iv_name", "")
199 209
      if current != expected:

Also available in: Unified diff