Revision 5b7b5d49
b/lib/bdev.py | ||
---|---|---|
297 | 297 |
vg_name) |
298 | 298 |
pvs_info.sort() |
299 | 299 |
pvs_info.reverse() |
300 |
free_size, pv_name = pvs_info[0] |
|
300 |
|
|
301 |
pvlist = [ pv[1] for pv in pvs_info ] |
|
302 |
free_size = sum([ pv[0] for pv in pvs_info ]) |
|
303 |
|
|
304 |
# The size constraint should have been checked from the master before |
|
305 |
# calling the create function. |
|
301 | 306 |
if free_size < size: |
302 | 307 |
raise errors.BlockDeviceError, ("Not enough free space: required %s," |
303 | 308 |
" available %s" % (size, free_size)) |
304 | 309 |
result = utils.RunCmd(["lvcreate", "-L%dm" % size, "-n%s" % lv_name, |
305 |
vg_name, pv_name])
|
|
310 |
vg_name] + pvlist)
|
|
306 | 311 |
if result.failed: |
307 | 312 |
raise errors.BlockDeviceError(result.fail_reason) |
308 | 313 |
return LogicalVolume(unique_id, children) |
Also available in: Unified diff