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

[rhel6-branch] In kickstart, specify multipaths by their wwids.



Aliases like 'mpatha' and 'mpathb' can cange between boots (or when new
devices are connected/disconnected from the system), just like with 'sda'
and 'sdb'. What is called for is being able to target a specific multipath
by its ID. This is achieved by allowing the user to specify a member
device of a multipath ('sda', or through /dev/disk/by-id/) and then
promoting it to the multipath device.

For example, commands like:

ignoredisk ... --only-use=disk/by-id/scsi-<wwid>
part ... --ondisk=disk/by-id/scsi-<wwid>

will make the mpath and the member drives with wwid <wwid> listed in
exclusiveDisks and create a partition on the same mpath.

Resolves: rhbz#677263
Related: rhbz#709653
---
 kickstart.py |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/kickstart.py b/kickstart.py
index 0e89fdb..9a1536a 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -57,6 +57,7 @@ _ = lambda x: gettext.ldgettext("anaconda", x)
 
 import logging
 log = logging.getLogger("anaconda")
+storage_log = logging.getLogger("storage")
 stdoutLog = logging.getLogger("anaconda.stdout")
 from anaconda_log import logger, logLevelMap, setHandlersLevel
 
@@ -205,10 +206,11 @@ def deviceMatches(spec):
     # 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
+        member_names = map(udev_device_get_name, members)
+        if mpath_name == spec or (dev in member_names):
+            # append the entire mpath
             matches.append(mpath_name)
-            matches.extend(map(udev_device_get_name, members))
+            matches.extend(member_names)
 
     return matches
 
@@ -796,6 +798,12 @@ class PartitionData(commands.partition.F12_PartData):
             names = [self.disk, "mapper/" + self.disk]
             for n in names:
                 disk = devicetree.getDeviceByName(udev_resolve_devspec(n))
+                # if this is a multipath member promote it to the real mpath
+                if disk and disk.format.type == "multipath_member":
+                    mpath_device = storage.devicetree.getChildren(disk)[0]
+                    storage_log.info("kickstart: part: promoting %s to %s"
+                                     % (disk.name, mpath_device.name))
+                    disk = mpath_device
                 if not disk:
                     raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in partition command" % n)
 
-- 
1.7.3.3


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