Starting from Ganeti 2.8 all the disks need to have a UUID. A function for adding a UUID automatically to disks was present, but it didn't consider disks with children (like DRBD).
The function is modified to work recursively. Partially fixes Issue 510. Signed-off-by: Michele Tartara <[email protected]> --- lib/config.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/config.py b/lib/config.py index 38316ad..ec93244 100644 --- a/lib/config.py +++ b/lib/config.py @@ -446,12 +446,23 @@ class ConfigWriter: return lvnames def _AllDisks(self): - """Compute the list of all Disks. + """Compute the list of all Disks (recursively, including children). """ + def DiskAndAllChildren(disk): + """Returns a list containing the given disk and all of his children. + + """ + disks = [disk] + if disk.children: + for child_disk in disk.children: + disks.extend(DiskAndAllChildren(child_disk)) + return disks + disks = [] for instance in self._config_data.instances.values(): - disks.extend(instance.disks) + for disk in instance.disks: + disks.extend(DiskAndAllChildren(disk)) return disks def _AllNICs(self): -- 1.7.10.4
