[rhel6-branch] multipath: allow mapper/mpath<X> specfifications in kickstart.

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

 



Resolves: rhbz#696876
Resolves: rhbz#675322
---
 kickstart.py |   34 +++++++++++++++++++++++++++++-----
 1 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/kickstart.py b/kickstart.py
index 56d67af..0e89fdb 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -21,6 +21,7 @@
 from storage.deviceaction import *
 from storage.devices import LUKSDevice
 from storage.devicelibs.lvm import getPossiblePhysicalExtents
+from storage.devicelibs.mpath import MultipathConfigWriter, identifyMultipaths
 from storage.formats import getFormat
 from storage.partitioning import clearPartitions
 from storage.partitioning import shouldClear
@@ -59,6 +60,10 @@ log = logging.getLogger("anaconda")
 stdoutLog = logging.getLogger("anaconda.stdout")
 from anaconda_log import logger, logLevelMap, setHandlersLevel
 
+# deviceMatches is called early, before any multipaths can possibly be coalesced
+# so it needs to know about them in some additional way
+multipaths = None
+
 class AnacondaKSScript(Script):
     def run(self, chroot, serial, intf = None):
         if self.inChroot:
@@ -175,18 +180,36 @@ def getEscrowCertificate(anaconda, url):
 
     return anaconda.id.escrowCertificates[url]
 
-def deviceMatches(spec):
-    if not spec.startswith("/dev/"):
-        spec = os.path.normpath("/dev/" + spec)
+def detect_multipaths():
+    global multipaths
+    mcw = MultipathConfigWriter()
+    cfg = mcw.write()
+    with open("/etc/multipath.conf", "w+") as mpath_cfg:
+        mpath_cfg.write(cfg)
+    devices = udev_get_block_devices()
+    (singles, multipaths, partitions) = identifyMultipaths(devices)
 
-    matches = udev_resolve_glob(spec)
-    dev = udev_resolve_devspec(spec)
+def deviceMatches(spec):
+    full_spec = spec
+    if not full_spec.startswith("/dev/"):
+        full_spec = os.path.normpath("/dev/" + full_spec)
 
+    # the regular case
+    matches = udev_resolve_glob(full_spec)
+    dev = udev_resolve_devspec(full_spec)
     # udev_resolve_devspec returns None if there's no match, but we don't
     # want that ending up in the list.
     if dev and dev not in matches:
         matches.append(dev)
 
+    # now see if any mpaths and mpath members match
+    for members in multipaths:
+        mpath_name = udev_device_get_multipath_name(members[0])
+        if mpath_name == spec:
+            # append the mpath
+            matches.append(mpath_name)
+            matches.extend(map(udev_device_get_name, members))
+
     return matches
 
 # Remove any existing formatting on a device, but do not remove the partition
@@ -1301,6 +1324,7 @@ def parseKickstart(anaconda, file):
     storage.zfcp.ZFCP().startup()
     # Note we do NOT call dasd.startup() here, that does not online drives, but
     # only checks if they need formatting, which requires zerombr to be known
+    detect_multipaths()
 
     try:
         ksparser.readKickstart(file)
-- 
1.7.3.3

_______________________________________________
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