Re: [PATCH 16/19] Make multipath support use device-mapper-multipath to setup mpaths.

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

 



One nit, below...

On Fri, 2010-01-15 at 16:24 -0500, Peter Jones wrote:
> Use device-mapper-multipath's "multipath" tool to find and set up
> multipath devices.
> ---
>  storage/devicelibs/mpath.py |   75 +++++++++++++++++++++++++++-------------
>  storage/devices.py          |   80 ++++++++++++++++++++++++++++++++++++-------
>  2 files changed, 117 insertions(+), 38 deletions(-)
> 
> diff --git a/storage/devicelibs/mpath.py b/storage/devicelibs/mpath.py
> index 4d1b262..247e837 100644
> --- a/storage/devicelibs/mpath.py
> +++ b/storage/devicelibs/mpath.py
> @@ -1,4 +1,5 @@
>  from ..udev import *
> +import iutil
>  
>  def parseMultipathOutput(output):
>      # this function parses output from "multipath -d", so we can use its
> @@ -43,57 +44,81 @@ def identifyMultipaths(devices):
>      # [sr0, sda, sdb, sdc, sdd, sde, sde1]
>  
>      log.info("devices to scan for multipath: %s" % [d['name'] for d in devices])
> -    serials = {}
> +
> +    mpathinfo = iutil.execWithCapture("multipath", ["-d",])
> +    if not mpathinfo:
> +        return devices
> +
> +    devmap = {}
>      non_disk_devices = {}
>      for d in devices:
> -        serial = udev_device_get_serial(d)
> -        if (not udev_device_is_disk(d)) or \
> -                (not d.has_key('ID_SERIAL_SHORT')):
> -            non_disk_devices.setdefault(serial, [])
> -            non_disk_devices[serial].append(d)
> +        if not udev_device_is_disk(d):
> +            non_disk_devices[d['name']] = d
>              log.info("adding %s to non_disk_device list" % (d['name'],))
>              continue
> +        devmap[d['name']] = d
>  
> -        serials.setdefault(serial, [])
> -        serials[serial].append(d)
> -
> +    topology = parseMultipathOutput(mpathinfo)
> +    topomap = {}
>      singlepath_disks = []
>      multipaths = []
> -    for serial, disks in serials.items():
> +
> +    for (name, disks) in topology.items():
> +        # we should really never see a disk here that's non in devmap...
> +        for disk in disks:
> +            if not devmap.has_key(disk) and non_disk_devices.has_key(disk):
> +                log.warning("non-disk device %s is part of an mpath")
> +                devmap[disk] = non_disk_devices[disk]
> +                del non_disk_devices[disk]
> +
> +            topomap[disk] = name
> +
> +    for (mpname, disks) in topology.items():
>          if len(disks) == 1:
> -            log.info("adding %s to singlepath_disks" % (disks[0]['name'],))
> -            singlepath_disks.append(disks[0])
> +            log.info("adding %s to singlepath_disks" % (disks[0],))
> +            singlepath_disks.append(devmap[disk])

s/disk/disks[0]/



_______________________________________________
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