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

Anne Mulhern amulhern at redhat.com
Tue May 13 17:01:29 UTC 2014





----- 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.

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.

- mulhern


More information about the anaconda-patches mailing list