Resolves: rhbz#821042 --- iw/filter_gui.py | 10 ++-------- storage/devicelibs/mpath.py | 14 ++++++++++++++ storage/devicetree.py | 11 +++++------ 3 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/iw/filter_gui.py b/iw/filter_gui.py index 6da510d..cccebbd 100644 --- a/iw/filter_gui.py +++ b/iw/filter_gui.py @@ -455,10 +455,7 @@ class FilterWindow(InstallWindow): not udev_device_get_md_container(d), udev_get_block_devices())
- mcw = MultipathConfigWriter() - cfg = mcw.write(friendly_names=True) - with open("/etc/multipath.conf", "w+") as mpath_cfg: - mpath_cfg.write(cfg) + writeMultipathConf(friendly_names=True)
(new_singlepaths, new_mpaths, new_partitions) = identifyMultipaths(new_disks) (new_raids, new_nonraids) = self.split_list(lambda d: isRAID(d) and not isCCISS(d), @@ -624,10 +621,7 @@ class FilterWindow(InstallWindow): not udev_device_get_md_container(d), udev_get_block_devices())
- mcw = MultipathConfigWriter() - cfg = mcw.write(friendly_names=True) - with open("/etc/multipath.conf", "w+") as mpath_cfg: - mpath_cfg.write(cfg) + writeMultipathConf(friendly_names=True)
# identifyMultipaths() uses 'multipath -d' and 'multipath -ll' to find # mpath devices. In case there are devices already set up they won't diff --git a/storage/devicelibs/mpath.py b/storage/devicelibs/mpath.py index 789add1..24aeded 100644 --- a/storage/devicelibs/mpath.py +++ b/storage/devicelibs/mpath.py @@ -2,6 +2,7 @@ import re
from ..udev import * +from flags import flags import iutil import logging
@@ -304,6 +305,19 @@ blacklist {
return ret
+def writeMultipathConf(writer=None, friendly_names=True): + if not flags.mpath: + # not writing out a multipath.conf will effectively blacklist all mpaths + # which will prevent any of them from being activated during install + return + + if writer is None: + writer = MultipathConfigWriter() + + cfg = writer.write(friendly_names=friendly_names) + with open("/etc/multipath.conf", "w+") as mpath_cfg: + mpath_cfg.write(cfg) + def flush_mpaths(): iutil.execWithRedirect("multipath", ["-F"]) check_output = iutil.execWithCapture("multipath", ["-ll"]).strip() diff --git a/storage/devicetree.py b/storage/devicetree.py index 9e384f7..6e3c6b2 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -2095,9 +2095,8 @@ class DeviceTree(object): % (livetarget,)) self.protectedDevNames.append(livetarget)
- cfg = self.__multipathConfigWriter.write(self.mpathFriendlyNames) - with open("/etc/multipath.conf", "w+") as mpath_cfg: - mpath_cfg.write(cfg) + devicelibs.mpath.writeMultipathConf(writer=self.__multipathConfigWriter, + friendly_names=self.mpathFriendlyNames)
devices = udev_get_block_devices() (singles, mpaths, partitions) = devicelibs.mpath.identifyMultipaths(devices) @@ -2138,9 +2137,9 @@ class DeviceTree(object): for d in self.devices: if not d.name in whitelist: self.__multipathConfigWriter.addBlacklistDevice(d) - cfg = self.__multipathConfigWriter.write(self.mpathFriendlyNames) - with open("/etc/multipath.conf", "w+") as mpath_cfg: - mpath_cfg.write(cfg) + + devicelibs.mpath.writeMultipathConf(writer=self.__multipathConfigWriter, + friendly_names=self.mpathFriendlyNames)
# Now, loop and scan for devices that have appeared since the two above # blocks or since previous iterations.