Commit 79780863 authored by Michele Tartara's avatar Michele Tartara

Properly add the UUID to all the disks

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: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 24f8fca3
......@@ -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):
......
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