[PATCH 1/2] Move apply_chunk_growth outside of a for-cycle
Vratislav Podzimek
vpodzime at redhat.com
Tue May 13 14:15:08 UTC 2014
Otherwise it is for no reason defined again and again.
Related: rhbz#1093144
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
blivet/partitioning.py | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 897e9ba..93ca961 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -1989,6 +1989,24 @@ def lvCompare(lv1, lv2):
return ret
+def apply_chunk_growth(chunk):
+ """ grow the lvs by the amounts the VGChunk calculated """
+ for req in chunk.requests:
+ if not req.device.req_grow:
+ continue
+
+ size = chunk.lengthToSize(req.base + req.growth)
+
+ # reduce the size of thin pools by the pad size
+ if hasattr(req.device, "lvs"):
+ size -= get_pool_padding(size, pesize=req.device.vg.peSize,
+ reverse=True)
+
+ # Base is pe, which means potentially rounded up by as much as
+ # pesize-1. As a result, you can't just add the growth to the
+ # initial size.
+ req.device.size = size
+
def growLVM(storage):
""" Grow LVs according to the sizes of the PVs.
@@ -2024,24 +2042,6 @@ def growLVM(storage):
# add the required padding to the requested pool size
lv.req_size += get_pool_padding(lv.req_size, pesize=vg.peSize)
- def apply_chunk_growth(chunk):
- """ grow the lvs by the amounts the VGChunk calculated """
- for req in chunk.requests:
- if not req.device.req_grow:
- continue
-
- size = chunk.lengthToSize(req.base + req.growth)
-
- # reduce the size of thin pools by the pad size
- if hasattr(req.device, "lvs"):
- size -= get_pool_padding(size, pesize=req.device.vg.peSize,
- reverse=True)
-
- # Base is pe, which means potentially rounded up by as much as
- # pesize-1. As a result, you can't just add the growth to the
- # initial size.
- req.device.size = size
-
# grow regular lvs
chunk = VGChunk(vg, requests=[LVRequest(l) for l in fatlvs])
chunk.growRequests()
--
1.9.0
More information about the anaconda-patches
mailing list