[master 2/2] Use Size method to perform a Size operation (#1200812)

mulkieran installerbot-noreply at redhat.com
Tue Mar 17 12:41:24 UTC 2015


From: mulhern <amulhern at redhat.com>

Related: fed#1200812

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

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/devices/lvm.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
index d5caf1f..2524c72 100644
--- a/blivet/devices/lvm.py
+++ b/blivet/devices/lvm.py
@@ -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")
@@ -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):


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/7b29fe514cd13996277009c96fb1be839a883e07


More information about the anaconda-patches mailing list