Revision 24c06acb

b/lib/storage/base.py
109 109
    raise NotImplementedError
110 110

  
111 111
  @classmethod
112
  def Create(cls, unique_id, children, size, params, excl_stor):
112
  def Create(cls, unique_id, children, size, spindles, params, excl_stor):
113 113
    """Create the device.
114 114

  
115 115
    If the device cannot be created, it will return None
......
126 126
    @param children: for hierarchical devices, the child devices
127 127
    @type size: float
128 128
    @param size: size in MiB
129
    @type spindles: int
130
    @param spindles: number of physical disk to dedicate to the device
129 131
    @type params: dict
130 132
    @param params: device-specific options/parameters
131 133
    @type excl_stor: bool
b/lib/storage/bdev.py
230 230
    return map((lambda pv: pv.name), empty_pvs)
231 231

  
232 232
  @classmethod
233
  def Create(cls, unique_id, children, size, params, excl_stor):
233
  def Create(cls, unique_id, children, size, spindles, params, excl_stor):
234 234
    """Create a new logical volume.
235 235

  
236 236
    """
......
265 265
        for m in err_msgs:
266 266
          logging.warning(m)
267 267
      req_pvs = cls._ComputeNumPvs(size, pvs_info)
268
      if spindles:
269
        if spindles < req_pvs:
270
          base.ThrowError("Requested number of spindles (%s) is not enough for"
271
                          " a disk of %d MB (at least %d spindles needed)",
272
                          spindles, size, req_pvs)
273
        else:
274
          req_pvs = spindles
268 275
      pvlist = cls._GetEmptyPvNames(pvs_info, req_pvs)
269 276
      current_pvs = len(pvlist)
270 277
      if current_pvs < req_pvs:
271
        base.ThrowError("Not enough empty PVs to create a disk of %d MB:"
272
                        " %d available, %d needed", size, current_pvs, req_pvs)
278
        base.ThrowError("Not enough empty PVs (spindles) to create a disk of %d"
279
                        " MB: %d available, %d needed",
280
                        size, current_pvs, req_pvs)
273 281
      assert current_pvs == len(pvlist)
274 282
      if stripes > current_pvs:
275 283
        # No warning issued for this, as it's no surprise
......
836 844
      base.ThrowError("Can't stat %s: %s", self.dev_path, err)
837 845

  
838 846
  @classmethod
839
  def Create(cls, unique_id, children, size, params, excl_stor):
847
  def Create(cls, unique_id, children, size, spindles, params, excl_stor):
840 848
    """Create a new file.
841 849

  
842 850
    @param size: the size of file in MiB
......
904 912
    self.Attach()
905 913

  
906 914
  @classmethod
907
  def Create(cls, unique_id, children, size, params, excl_stor):
915
  def Create(cls, unique_id, children, size, spindles, params, excl_stor):
908 916
    """Create a new device
909 917

  
910 918
    This is a noop, we only return a PersistentBlockDevice instance
......
1004 1012
    self.Attach()
1005 1013

  
1006 1014
  @classmethod
1007
  def Create(cls, unique_id, children, size, params, excl_stor):
1015
  def Create(cls, unique_id, children, size, spindles, params, excl_stor):
1008 1016
    """Create a new rbd device.
1009 1017

  
1010 1018
    Provision a new rbd volume inside a RADOS pool.
......
1358 1366
    self.Attach()
1359 1367

  
1360 1368
  @classmethod
1361
  def Create(cls, unique_id, children, size, params, excl_stor):
1369
  def Create(cls, unique_id, children, size, spindles, params, excl_stor):
1362 1370
    """Create a new extstorage device.
1363 1371

  
1364 1372
    Provision a new volume using an extstorage provider, which will
......
1803 1811
  _VerifyDiskType(disk.dev_type)
1804 1812
  _VerifyDiskParams(disk)
1805 1813
  device = DEV_MAP[disk.dev_type].Create(disk.physical_id, children, disk.size,
1806
                                         disk.params, excl_stor)
1814
                                         disk.spindles, disk.params, excl_stor)
1807 1815
  return device
b/lib/storage/drbd.py
1001 1001
      base.ThrowError("Can't initialize meta device: %s", result.output)
1002 1002

  
1003 1003
  @classmethod
1004
  def Create(cls, unique_id, children, size, params, excl_stor):
1004
  def Create(cls, unique_id, children, size, spindles, params, excl_stor):
1005 1005
    """Create a new DRBD8 device.
1006 1006

  
1007 1007
    Since DRBD devices are not created per se, just assembled, this

Also available in: Unified diff