Commit b775c337 authored by Iustin Pop's avatar Iustin Pop
Browse files

repair-size: ensure child disks have sane sizes

While this patch doesn't do a full match of on-disk size to config-size
for child devices, it does a sanity check (for DRBD only) that the child
size is not less than the DRBD size. While this would be a strange
occurrence (failed growth and masterd crash or similar), it does prevent
replace-disks from working.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 610e39da
......@@ -1377,6 +1377,29 @@ class LURepairDiskSizes(NoHooksLU):
self.wanted_instances = [self.cfg.GetInstanceInfo(name) for name
in self.wanted_names]
def _EnsureChildSizes(self, disk):
"""Ensure children of the disk have the needed disk size.
This is valid mainly for DRBD8 and fixes an issue where the
children have smaller disk size.
@param disk: an L{ganeti.objects.Disk} object
if disk.dev_type == constants.LD_DRBD8:
assert disk.children, "Empty children for DRBD8?"
fchild = disk.children[0]
mismatch = fchild.size < disk.size
if mismatch:
self.LogInfo("Child disk has size %d, parent %d, fixing",
fchild.size, disk.size)
fchild.size = disk.size
# and we recurse on this child only, not on the metadev
return self._EnsureChildSizes(fchild) or mismatch
return False
def Exec(self, feedback_fn):
"""Verify the size of cluster disks.
......@@ -1422,6 +1445,9 @@ class LURepairDiskSizes(NoHooksLU):
disk.size = size
changed.append((, idx, size))
if self._EnsureChildSizes(disk):
changed.append((, idx, disk.size))
return changed
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