[PATCH 4/4] Honor the nompath option.
David Lehman
dlehman at redhat.com
Fri Oct 12 19:57:22 UTC 2012
---
pyanaconda/storage/devicelibs/mpath.py | 12 ++++++++++++
pyanaconda/storage/devicetree.py | 9 ++-------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/storage/devicelibs/mpath.py b/pyanaconda/storage/devicelibs/mpath.py
index 6b08896..2e5efd1 100644
--- a/pyanaconda/storage/devicelibs/mpath.py
+++ b/pyanaconda/storage/devicelibs/mpath.py
@@ -3,6 +3,7 @@ import re
from ..udev import udev_device_is_disk
from pyanaconda import iutil
+from pyanaconda.flags import flags
from pyanaconda.anaconda_log import log_method_call
import logging
@@ -266,6 +267,17 @@ blacklist {
return ret
+ def writeConfig(self, friendly_names=True):
+ if not flags.mpath:
+ # not writing out a multipath.conf will effectively blacklist all
+ # mpath which will prevent any of them from being activated during
+ # install
+ return
+
+ cfg = self.write(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/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index a5c6983..2d30ae4 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -1883,13 +1883,10 @@ class DeviceTree(object):
self.liveBackingDevice = live_device_name
break
- cfg = self.__multipathConfigWriter.write(self.mpathFriendlyNames)
old_devices = {}
if os.access("/etc/multipath.conf", os.W_OK):
- with open("/etc/multipath.conf", "w+") as mpath_cfg:
- mpath_cfg.write(cfg)
-
+ self.__multipathConfigWriter.writeConfig(self.mpathFriendlyNames)
self.topology = devicelibs.mpath.MultipathTopology(udev_get_block_devices())
log.info("devices to scan: %s" %
[d['name'] for d in self.topology.devices_iter()])
@@ -1926,9 +1923,7 @@ 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)
+ self.__multipathConfigWriter.writeConfig(self.mpathFriendlyNames)
else:
log.info("Skipping multipath detection due to running as non-root.")
--
1.7.7.6
More information about the anaconda-patches
mailing list