[PATCH 2/2] Take extra RAID metadata into account when growing LV (#1093144)

Vratislav Podzimek vpodzime at redhat.com
Wed May 14 06:24:18 UTC 2014


On Tue, 2014-05-13 at 13:01 -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:09 AM
> > Subject: [PATCH 2/2] Take extra RAID metadata into account when growing LV	(#1093144)
> > 
> > If we create an LV in a VG that has one or more of its PVs on top of RAID, we
> > add 5 extra PEs per disk for the metadata. So when growing an LV we should
> > take
> > that into account and shrink the available pool size with those extents.
> > 
> > Also remove some unused imports.
> > 
> > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > ---
> >  blivet/partitioning.py | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/blivet/partitioning.py b/blivet/partitioning.py
> > index 93ca961..b773881 100644
> > --- a/blivet/partitioning.py
> > +++ b/blivet/partitioning.py
> > @@ -20,8 +20,7 @@
> >  # Red Hat Author(s): Dave Lehman <dlehman at redhat.com>
> >  #
> >  
> > -import sys
> > -import os
> > +import itertools
> >  from operator import add, sub, gt, lt
> >  
> >  import parted
> > @@ -1549,6 +1548,12 @@ class VGChunk(Chunk):
> >              raise ValueError(_("VGChunk requests must be of type "
> >                               "LVRequest"))
> >  
> > +        # (only) we allocate (5 * num_disks) extra extents for LV metadata
> > +        # on RAID (see the devicefactory.LVMFactory._get_total_space method)
> > +        max_raid_disks = max(len(pv.disks) for pv in req.device.vg.pvs if
> > not req.device.exists)
> > +        if max_raid_disks:
> > +            self.pool -= 5 * max_raid_disks
> > +
> >          super(VGChunk, self).addRequest(req)
> >  
> >      def lengthToSize(self, length):
> > --
> > 1.9.0
> > 
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> > 
> 
> 
> If z has no elements max(z) will raise a ValueError; that possibility should be accounted for here.
That should never happen, but better be ready.

> 
> In the generator, req.device.exists is checked every time, but it will always be the same,
> regardless of the value of pv. It would be better outside the generator, I think.
Good catch, that's a leftover from another approach on fixing this bug.
Thanks, fixing locally.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list