[PATCH][rhel6-branch] Fix scanning of non-leaf lvs. (#1213748)

Brian C. Lane bcl at redhat.com
Thu Jun 4 18:38:09 UTC 2015


On Thu, Jun 04, 2015 at 10:45:03AM -0500, David Lehman wrote:
> This fixes a regression introduced with the thinp changes that broke
> the return value of handleVgLvs.
> 
> It also fixes space accounting for raid lvs, log lvs, and metadata lvs
> through consistent key naming in the raid dict.
> ---
>  storage/devicetree.py | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/storage/devicetree.py b/storage/devicetree.py
> index 8d1ed5f..0a4f754 100644
> --- a/storage/devicetree.py
> +++ b/storage/devicetree.py
> @@ -1634,7 +1634,7 @@ class DeviceTree(object):
>                  lv_name = re.sub(r'_[tr]meta.*', '', lv_name[1:-1])
>                  name = "%s-%s" % (vg_name, lv_name)
>                  addRequiredLV(name, "failed to look up raid lv")
> -                raid[lv_name]["meta"] += lv_size
> +                raid[name]["meta"] += lv_size
>                  return
>              elif lv_attr[0] == 'l':
>                  # log volume
> @@ -1691,11 +1691,13 @@ class DeviceTree(object):
>                      # do format handling now
>                      self.addUdevDevice(lv_info)
>  
> -        raid = dict((n.replace("[", "").replace("]", ""),
> +            return ret

Urk. That's some gnarly use of ret in that code.


> +
> +        raid = dict(("%s-%s" % (vg_name, n.replace("[", "").replace("]", "")),
>                       {"copies": 0, "log": 0, "meta": 0})
>                       for n in lv_names)
>          for lv in zip(lv_names, lv_uuids, lv_sizes, lv_attr, lv_types):
> -            addLV(*lv)
> +            ret |= addLV(*lv)

This won't work, most of addLV returns a None. Convert them all to
return ret? Or return False? I think I'd convert to using constants
inside addLV, although I'm not sure if that last return after the
log.error is meant to be False to carry over the ret=True from the block
above.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list