Skip to content

Commit

Permalink
Use Size method to perform a Size operation (#1200812)
Browse files Browse the repository at this point in the history
Related: fed#1200812

It should not be necessary to invoke an lvm plugin to round a Size.

Signed-off-by: mulhern <amulhern@redhat.com>
  • Loading branch information
mulkieran committed Mar 17, 2015
1 parent de7efc6 commit 7b29fe5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions blivet/devices/lvm.py
Expand Up @@ -35,7 +35,7 @@
from ..formats import getFormat
from ..storage_log import log_method_call
from .. import udev
from ..size import Size, KiB, MiB
from ..size import Size, KiB, MiB, ROUND_UP, ROUND_DOWN

import logging
log = logging.getLogger("blivet")
Expand Down Expand Up @@ -373,8 +373,7 @@ def freeExtents(self):
def align(self, size, roundup=False):
""" Align a size to a multiple of physical extent size. """
size = util.numeric_type(size)

return Size(blockdev.lvm_round_size_to_pe(size, self.peSize, roundup))
return size.roundToNearest(self.peSize, rounding=ROUND_UP if roundup else ROUND_DOWN)

@property
def pvs(self):
Expand Down

0 comments on commit 7b29fe5

Please sign in to comment.