Commit bc3427b7 authored by Aaron Knister's avatar Aaron Knister Committed by Michele Tartara
Browse files

Use KB as the unit for LVM PE size



LogicalVolume.Attach in bdev.py is calling "lvs" and specifying a unit of
Megabytes that is then converted to an integer resulting in the value 0 for
small sizes.

This patch makes Ganeti use KB for the unit instead of MB.

Fixes Issue 347.
Signed-off-by: default avatarAaron Knister <aaron.knister@gmail.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent bfcd1652
......@@ -836,7 +836,7 @@ class LogicalVolume(BlockDev):
"""
self.attached = False
result = utils.RunCmd(["lvs", "--noheadings", "--separator=,",
"--units=m", "--nosuffix",
"--units=k", "--nosuffix",
"-olv_attr,lv_kernel_major,lv_kernel_minor,"
"vg_extent_size,stripes", self.dev_path])
if result.failed:
......@@ -1029,10 +1029,12 @@ class LogicalVolume(BlockDev):
if not self.Attach():
_ThrowError("Can't attach to LV during Grow()")
full_stripe_size = self.pe_size * self.stripe_count
# pe_size is in KB
amount *= 1024
rest = amount % full_stripe_size
if rest != 0:
amount += full_stripe_size - rest
cmd = ["lvextend", "-L", "+%dm" % amount]
cmd = ["lvextend", "-L", "+%dk" % amount]
if dryrun:
cmd.append("--test")
# we try multiple algorithms since the 'best' ones might not have
......
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