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

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

 



/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
+    target = root_path + source
+    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?
-- 
1.7.6

_______________________________________________
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