Old versions of Ganeti (in particular, 2.5 and earlier) did not
have UUIDs assigned to objects. If we happen to find such an old
configuration, we assign UUIDs now, during the upgrade. However,
we must do this recursively, as disks might have children. Note
that before Ganeti 2.12 this didn't matter, as the UUIDs of the
children where never used or enforced. With the strict type checking
introduced by the switch to haskell, we have to care about those
little details.
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>
nic["network"] = uuid
+def AssignUuid(disk):
+ if not "uuid" in disk:
+ disk["uuid"] = utils.io.NewUUID()
+ if "children" in disk:
+ for d in disk["children"]:
+ AssignUuid(d)
+
+
def _ConvertDiskAndCheckMissingSpindles(iobj, instance):
missing_spindles = False
if "disks" not in iobj:
if not "spindles" in dobj:
missing_spindles = True
- if not "uuid" in dobj:
- dobj["uuid"] = utils.io.NewUUID()
+ AssignUuid(dobj)
return missing_spindles