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

Re: [rhel6-branch] mpath: create /etc/multipath/bindings file.



ack

On Tue, 2011-01-18 at 12:27 +0100, Ales Kozumplik wrote:
> Resolves: rhbz#640735
> ---
>  storage/__init__.py         |   12 +++++++++---
>  storage/devicelibs/mpath.py |    7 +++++++
>  2 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/storage/__init__.py b/storage/__init__.py
> index 464eebf..efb648a 100644
> --- a/storage/__init__.py
> +++ b/storage/__init__.py
> @@ -2111,9 +2111,15 @@ class FSSet(object):
>  
>          # /etc/multipath.conf
>          multipath_path = os.path.normpath("%s/etc/multipath.conf" % instPath)
> +        bindings_path = os.path.normpath("%s/etc/multipath/bindings" % instPath)
>          multipath_conf = self.multipathConf()
> -        if multipath_conf:
> -            open(multipath_path, "w").write(multipath_conf)
> +        conf_contents = multipath_conf.write()
> +        bindings_contents = multipath_conf.write_bindings()
> +        if conf_contents:
> +            open(multipath_path, "w").write(conf_contents)
> +        if bindings_contents:
> +            iutil.mkdirChain(os.path.dirname(bindings_path))
> +            open(bindings_path, "w").write(bindings_contents)
>  
>      def crypttab(self):
>          # if we are upgrading, do we want to update crypttab?
> @@ -2183,7 +2189,7 @@ class FSSet(object):
>              if not d.name in whitelist:
>                  config.addBlacklistDevice(d)
>  
> -        return config.write()
> +        return config
>  
>      def fstab (self):
>          format = "%-23s %-23s %-7s %-15s %d %d\n"
> diff --git a/storage/devicelibs/mpath.py b/storage/devicelibs/mpath.py
> index fb7e1aa..3f91cba 100644
> --- a/storage/devicelibs/mpath.py
> +++ b/storage/devicelibs/mpath.py
> @@ -303,3 +303,10 @@ blacklist {
>          ret += '}\n'
>  
>          return ret
> +
> +    def write_bindings(self):
> +        ret = "# created by Anaconda\n"
> +        for mpath in self.mpaths:
> +            if ('alias' in mpath.config) and ('wwid' in mpath.config):
> +                ret += "%s %s\n" % (mpath.config['alias'], mpath.config['wwid'])
> +        return ret

-- 
Martin Gracik <mgracik redhat com>


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