Commit c877d159 authored by Klaus Aehlig's avatar Klaus Aehlig Committed by Hrvoje Ribicic
Browse files

Recursively clear serial numbers

Disk objects, in general, are of recursive nature. Therefore,
when downgrading them, do so recursively.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarHrvoje Ribicic <>
parent aff02701
......@@ -478,6 +478,17 @@ def DowngradeInstances(config_data):
def DowngradeTopLevelDisks(config_data):
"""Downgrade the disks from config top level citizens."""
def RemoveSerialNumber(disk):
if "serial_no" in disk:
del disk["serial_no"]
if "ctime" in disk:
del disk["ctime"]
if "mtime" in disk:
del disk["mtime"]
if "children" in disk:
for subdisk in disk["children"]:
if "instances" not in config_data:
raise Error("Can't find the 'instances' key in the configuration!")
......@@ -489,9 +500,7 @@ def DowngradeTopLevelDisks(config_data):
disks = list()
for disk_uuid in iobj["disks"]:
disk_obj = config_data["disks"][disk_uuid]
del disk_obj["serial_no"]
del disk_obj["ctime"]
del disk_obj["mtime"]
del config_data["disks"][disk_uuid]
iobj["disks"] = disks
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