Commit 5b7b5d49 authored by Guido Trotter's avatar Guido Trotter
Browse files

Do the secondary check and subsequently allocate the drive on all available

logival volumes. This lets you use more than one when none of them can support
your full drive size.

Reviewed-By: iustinp
parent 191a8385
......@@ -297,12 +297,17 @@ class LogicalVolume(BlockDev):
free_size, pv_name = pvs_info[0]
pvlist = [ pv[1] for pv in pvs_info ]
free_size = sum([ pv[0] for pv in pvs_info ])
# The size constraint should have been checked from the master before
# calling the create function.
if free_size < size:
raise errors.BlockDeviceError, ("Not enough free space: required %s,"
" available %s" % (size, free_size))
result = utils.RunCmd(["lvcreate", "-L%dm" % size, "-n%s" % lv_name,
vg_name, pv_name])
vg_name] + pvlist)
if result.failed:
raise errors.BlockDeviceError(result.fail_reason)
return LogicalVolume(unique_id, children)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment