summaryrefslogtreecommitdiffstats
path: root/storage/devicelibs
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2009-10-12 11:24:30 -0400
committerPeter Jones <pjones@redhat.com>2009-10-12 14:21:54 -0400
commita5cb938be91cb1322d8ad32fb27c892eb90b93d7 (patch)
tree2ca182e1c4a06e5cb625a446bd2c634e83663641 /storage/devicelibs
parent40039ddec4fa25a224f95e4805a1ee89f95a0ebf (diff)
downloadanaconda-a5cb938be91cb1322d8ad32fb27c892eb90b93d7.tar.gz
anaconda-a5cb938be91cb1322d8ad32fb27c892eb90b93d7.tar.xz
anaconda-a5cb938be91cb1322d8ad32fb27c892eb90b93d7.zip
Write multipathd.conf in anaconda so that dracut can find it.
This writes a multipathd.conf that whitelists the devices we're using in our multipath devices. It's a fairly basic configuration, and it doesn't handle ALUA yet.
Diffstat (limited to 'storage/devicelibs')
-rw-r--r--storage/devicelibs/mpath.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/storage/devicelibs/mpath.py b/storage/devicelibs/mpath.py
new file mode 100644
index 000000000..3de91af62
--- /dev/null
+++ b/storage/devicelibs/mpath.py
@@ -0,0 +1,37 @@
+
+class MultipathConfigWriter:
+ def __init__(self):
+ self.blacklist_exceptions = []
+ self.mpaths = []
+
+ def addMultipathDevice(self, mpath):
+ for parent in mpath.parents:
+ self.blacklist_exceptions.append(parent.name)
+ self.mpaths.append(mpath)
+
+ def write(self):
+ ret = ""
+ ret += """\
+# multipath.conf written by anaconda
+
+blacklist {
+ devnode "*"
+}
+
+blacklist_exceptions {
+"""
+ for device in self.blacklist_exceptions:
+ ret += "\tdevnode \"^%s$\"\n" % (device,)
+ ret += """\
+}
+
+multipaths {
+"""
+ for mpath in self.mpaths:
+ ret += "\tmultipath {\n"
+ for k,v in mpath.config.items():
+ ret += "\t\t%s %s\n" % (k, v)
+ ret += "\t}\n\n"
+ ret += "}\n"
+
+ return ret