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

Re: [rhel6-branch] Copy /etc/multipath/wwids to the sysimage.



On Fri, 2011-08-12 at 14:38 +0200, Ales Kozumplik wrote:
> /etc/multipath/wwids is a list of activated multipaths generated by the
> multipath tools. If it is missing in the sysimage it will be missing in
> the dracut initramfs and that, in rare cases, can cause race between mpath
> and lvm during boot.
> 
> Resolves: rhbz#701371
> ---
>  iutil.py            |   20 ++++++++++++++++++++
>  storage/__init__.py |    1 +
>  2 files changed, 21 insertions(+), 0 deletions(-)
> 
> diff --git a/iutil.py b/iutil.py
> index 596b5d2..5a45415 100644
> --- a/iutil.py
> +++ b/iutil.py
> @@ -22,6 +22,7 @@
>  
>  import glob
>  import os, string, stat, sys
> +import shutil
>  import signal
>  import os.path
>  from errno import *
> @@ -902,6 +903,25 @@ def setup_translations(module):
>          add_po_path(module, TRANSLATIONS_UPDATE_DIR)
>      module.textdomain("anaconda")
>  
> +def copy_to_sysimage(source, root_path=None, anaconda=None):
> +    if not root_path and not anaconda:
> +        raise AttributeError("copy_to_sysimage: "
> +                             "'root_path' or 'anaconda' need to be specified.")
> +    if not os.access(source, os.R_OK):
> +        log.info("copy_to_sysimage: source '%s' does not exist." % source)
> +        return False
> +
> +    root = root_path
> +    if not root:
> +        root = anaconda.rootPath

You're not using "root" anywhere later in the function.

> +    target = root_path + source

I think you meant to use "root" here.

> +    target_dir = os.path.dirname(target)
> +    log.debug("copy_to_sysimage: '%s' -> '%s'." % (source, target))
> +    if not os.path.isdir(target_dir):
> +        os.makedirs(target_dir)
> +    shutil.copy(source, target)
> +    return True
> +
>  def get_sysfs_attr(path, attr):
>      if not attr:
>          log.debug("get_sysfs_attr() called with attr=None")
> diff --git a/storage/__init__.py b/storage/__init__.py
> index 4e1532b..d644b10 100644
> --- a/storage/__init__.py
> +++ b/storage/__init__.py
> @@ -2194,6 +2194,7 @@ class FSSet(object):
>              f.close()
>          else:
>              log.info("not writing out mpath configuration")
> +        iutil.copy_to_sysimage("/etc/multipath/wwids", root_path=instPath)
>  
>      def crypttab(self):
>          # if we are upgrading, do we want to update crypttab?

-- 
Martin Gracik <mgracik redhat com>


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