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. --- lib/cmdlib.py | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 4d20e10..a9b3bac 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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 + else: + return False + def Exec(self, feedback_fn): """Verify the size of cluster disks. @@ -1422,6 +1445,9 @@ class LURepairDiskSizes(NoHooksLU): disk.size = size self.cfg.Update(instance) changed.append((instance.name, idx, size)) + if self._EnsureChildSizes(disk): + self.cfg.Update(instance) + changed.append((instance.name, idx, disk.size)) return changed -- 1.6.3.3