Revision be9150ea

b/lib/backend.py
2853 2853
  return result
2854 2854

  
2855 2855

  
2856
def BlockdevGrow(disk, amount, dryrun, backingstore):
2856
def BlockdevGrow(disk, amount, dryrun, backingstore, excl_stor):
2857 2857
  """Grow a stack of block devices.
2858 2858

  
2859 2859
  This function is called recursively, with the childrens being the
......
2870 2870
      only, or on "logical" storage only; e.g. DRBD is logical storage,
2871 2871
      whereas LVM, file, RBD are backing storage
2872 2872
  @rtype: (status, result)
2873
  @type excl_stor: boolean
2874
  @param excl_stor: Whether exclusive_storage is active
2873 2875
  @return: a tuple with the status of the operation (True/False), and
2874 2876
      the errors message if status is False
2875 2877

  
......
2879 2881
    _Fail("Cannot find block device %s", disk)
2880 2882

  
2881 2883
  try:
2882
    r_dev.Grow(amount, dryrun, backingstore)
2884
    r_dev.Grow(amount, dryrun, backingstore, excl_stor)
2883 2885
  except errors.BlockDeviceError, err:
2884 2886
    _Fail("Failed to grow block device: %s", err, exc=True)
2885 2887

  
b/lib/server/noded.py
368 368
    amount = params[1]
369 369
    dryrun = params[2]
370 370
    backingstore = params[3]
371
    return backend.BlockdevGrow(cfbd, amount, dryrun, backingstore)
371
    excl_stor = params[4]
372
    return backend.BlockdevGrow(cfbd, amount, dryrun, backingstore, excl_stor)
372 373

  
373 374
  @staticmethod
374 375
  def perspective_blockdev_close(params):
b/lib/storage/base.py
298 298
    for child in self._children:
299 299
      child.SetInfo(text)
300 300

  
301
  def Grow(self, amount, dryrun, backingstore):
301
  def Grow(self, amount, dryrun, backingstore, excl_stor):
302 302
    """Grow the block device.
303 303

  
304 304
    @type amount: integer
......
309 309
    @param backingstore: whether to execute the operation on backing storage
310 310
        only, or on "logical" storage only; e.g. DRBD is logical storage,
311 311
        whereas LVM, file, RBD are backing storage
312
    @type excl_stor: boolean
313
    @param excl_stor: Whether exclusive_storage is active
312 314

  
313 315
    """
314 316
    raise NotImplementedError
b/lib/storage/bdev.py
753 753

  
754 754
    _CheckResult(utils.RunCmd(["lvchange", "--addtag", text, self.dev_path]))
755 755

  
756
  def Grow(self, amount, dryrun, backingstore):
756
  def Grow(self, amount, dryrun, backingstore, excl_stor):
757 757
    """Grow the logical volume.
758 758

  
759 759
    """
......
771 771
    cmd = ["lvextend", "-L", "+%dk" % amount]
772 772
    if dryrun:
773 773
      cmd.append("--test")
774
    if excl_stor:
775
      # Disk growth doesn't grow the number of spindles, so we must stay within
776
      # our assigned volumes
777
      pvlist = list(self.pv_names)
778
    else:
779
      pvlist = []
774 780
    # we try multiple algorithms since the 'best' ones might not have
775 781
    # space available in the right place, but later ones might (since
776 782
    # they have less constraints); also note that only recent LVM
777 783
    # supports 'cling'
778 784
    for alloc_policy in "contiguous", "cling", "normal":
779
      result = utils.RunCmd(cmd + ["--alloc", alloc_policy, self.dev_path])
785
      result = utils.RunCmd(cmd + ["--alloc", alloc_policy, self.dev_path] +
786
                            pvlist)
780 787
      if not result.failed:
781 788
        return
782 789
    base.ThrowError("Can't grow LV %s: %s", self.dev_path, result.output)
......
867 874
    # TODO: implement rename for file-based storage
868 875
    base.ThrowError("Rename is not supported for file-based storage")
869 876

  
870
  def Grow(self, amount, dryrun, backingstore):
877
  def Grow(self, amount, dryrun, backingstore, excl_stor):
871 878
    """Grow the file
872 879

  
873 880
    @param amount: the amount (in mebibytes) to grow with
......
1055 1062
    """
1056 1063
    pass
1057 1064

  
1058
  def Grow(self, amount, dryrun, backingstore):
1065
  def Grow(self, amount, dryrun, backingstore, excl_stor):
1059 1066
    """Grow the logical volume.
1060 1067

  
1061 1068
    """
......
1382 1389
    """
1383 1390
    pass
1384 1391

  
1385
  def Grow(self, amount, dryrun, backingstore):
1392
  def Grow(self, amount, dryrun, backingstore, excl_stor):
1386 1393
    """Grow the Volume.
1387 1394

  
1388 1395
    @type amount: integer
......
1545 1552
    """
1546 1553
    pass
1547 1554

  
1548
  def Grow(self, amount, dryrun, backingstore):
1555
  def Grow(self, amount, dryrun, backingstore, excl_stor):
1549 1556
    """Grow the Volume.
1550 1557

  
1551 1558
    @type amount: integer
b/lib/storage/drbd.py
950 950
    """
951 951
    raise errors.ProgrammerError("Can't rename a drbd device")
952 952

  
953
  def Grow(self, amount, dryrun, backingstore):
953
  def Grow(self, amount, dryrun, backingstore, excl_stor):
954 954
    """Resize the DRBD device and its backing storage.
955 955

  
956 956
    See L{BlockDev.Grow} for parameter description.
......
960 960
      base.ThrowError("drbd%d: Grow called while not attached", self._aminor)
961 961
    if len(self._children) != 2 or None in self._children:
962 962
      base.ThrowError("drbd%d: cannot grow diskless device", self.minor)
963
    self._children[0].Grow(amount, dryrun, backingstore)
963
    self._children[0].Grow(amount, dryrun, backingstore, excl_stor)
964 964
    if dryrun or backingstore:
965 965
      # DRBD does not support dry-run mode and is not backing storage,
966 966
      # so we'll return here

Also available in: Unified diff