Re: [rhel6-branch 1/3] mpath: log the /etc/multipath.conf contents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I personally don't like the 2 map calls on one line, imho it looks
clearer like this:

	map(lambda line: log.debug(line.rstrip()), conf)

You don't need that string import this way. In the other hand, python
even discourages from using map (don't ask me why), so maybe even better
would be writing it like this:

	[log.debug(line.rstrip()) for line in conf]

But that's just my opinion man...

other than that ACK for all three patches.

On Tue, 2010-12-14 at 10:49 +0100, Ales Kozumplik wrote:
> Related: rhbz#636570
> ---
>  storage/devicelibs/mpath.py |   13 +++++++++++--
>  1 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/storage/devicelibs/mpath.py b/storage/devicelibs/mpath.py
> index 944b5d6..ea4cfa7 100644
> --- a/storage/devicelibs/mpath.py
> +++ b/storage/devicelibs/mpath.py
> @@ -3,6 +3,10 @@ import re
>  
>  from ..udev import *
>  import iutil
> +import logging
> +import string
> +
> +log = logging.getLogger("storage")
>  
>  def parseMultipathOutput(output):
>      # this function parses output from "multipath -d", so we can use its
> @@ -60,7 +64,7 @@ def parseMultipathOutput(output):
>              pass
>          elif dmatch:
>              devices.append(dmatch.groups()[0].replace('!','/'))
> -    
> +
>      if name and devices:
>          mpaths[name] = devices
>  
> @@ -77,12 +81,17 @@ def identifyMultipaths(devices):
>      # [sda, sdd], [[sdb, sdc]], [sr0, sda1, sdd1, sdd2]]
>      log.info("devices to scan for multipath: %s" % [d['name'] for d in devices])
>  
> +    with open("/etc/multipath.conf") as conf:
> +        log.debug("/etc/multipath.conf contents:")
> +        map(log.debug, map(string.rstrip, conf))
> +        log.debug("(end of /etc/multipath.conf)")
> +
>      topology = parseMultipathOutput(iutil.execWithCapture("multipath", ["-d",]))
>      # find the devices that aren't in topology, and add them into it...
>      topodevs = reduce(lambda x,y: x.union(y), topology.values(), set())
>      for name in set([d['name'] for d in devices]).difference(topodevs):
>          topology[name] = [name]
> -    
> +
>      devmap = {}
>      non_disk_devices = {}
>      for d in devices:

-- 
Martin Gracik <mgracik@xxxxxxxxxx>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux