Revision b775c337 lib/cmdlib.py

b/lib/cmdlib.py
1377 1377
    self.wanted_instances = [self.cfg.GetInstanceInfo(name) for name
1378 1378
                             in self.wanted_names]
1379 1379

  
1380
  def _EnsureChildSizes(self, disk):
1381
    """Ensure children of the disk have the needed disk size.
1382

  
1383
    This is valid mainly for DRBD8 and fixes an issue where the
1384
    children have smaller disk size.
1385

  
1386
    @param disk: an L{ganeti.objects.Disk} object
1387

  
1388
    """
1389
    if disk.dev_type == constants.LD_DRBD8:
1390
      assert disk.children, "Empty children for DRBD8?"
1391
      fchild = disk.children[0]
1392
      mismatch = fchild.size < disk.size
1393
      if mismatch:
1394
        self.LogInfo("Child disk has size %d, parent %d, fixing",
1395
                     fchild.size, disk.size)
1396
        fchild.size = disk.size
1397

  
1398
      # and we recurse on this child only, not on the metadev
1399
      return self._EnsureChildSizes(fchild) or mismatch
1400
    else:
1401
      return False
1402

  
1380 1403
  def Exec(self, feedback_fn):
1381 1404
    """Verify the size of cluster disks.
1382 1405

  
......
1422 1445
          disk.size = size
1423 1446
          self.cfg.Update(instance)
1424 1447
          changed.append((instance.name, idx, size))
1448
        if self._EnsureChildSizes(disk):
1449
          self.cfg.Update(instance)
1450
          changed.append((instance.name, idx, disk.size))
1425 1451
    return changed
1426 1452

  
1427 1453

  

Also available in: Unified diff