[PATCH 1/2] Move apply_chunk_growth outside of a for-cycle
Vratislav Podzimek
vpodzime at redhat.com
Wed May 14 06:22:52 UTC 2014
On Tue, 2014-05-13 at 12:37 -0400, Anne Mulhern wrote:
>
>
>
> ----- Original Message -----
> > From: "Vratislav Podzimek" <vpodzime at redhat.com>
> > To: anaconda-patches at lists.fedorahosted.org
> > Sent: Tuesday, May 13, 2014 10:15:08 AM
> > Subject: [PATCH 1/2] Move apply_chunk_growth outside of a for-cycle
> >
> > 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
> >
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> >
>
> It's not part of the public interface, so it should either receive
> an underscore or just get moved above the loop.
Good point, adding underscore locally.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list