[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[rhel5-branch] Validate the user-chosen name of an mpath device.
- From: Ales Kozumplik <akozumpl redhat com>
- To: anaconda-devel-list redhat com
- Subject: [rhel5-branch] Validate the user-chosen name of an mpath device.
- Date: Tue, 1 Mar 2011 18:53:25 +0100
Related: rhbz#572862
---
iutil.py | 10 ++++++++++
kickstart.py | 4 ++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/iutil.py b/iutil.py
index 8b3e6b9..c482b18 100644
--- a/iutil.py
+++ b/iutil.py
@@ -444,6 +444,16 @@ def cpuFeatureFlags():
return []
+def valid_dm_name(name):
+ """ Tests whether name is a good name for a dm device
+
+ Sometimes the user could call the device 'devp3' and then how is
+ bootloaderInfo.getDiskPart() to tell it's not a partition?
+ """
+ if re.search("p\d{1,2}$", name):
+ return False
+ return True
+
def writeRpmPlatform(root="/"):
import rhpl.arch
diff --git a/kickstart.py b/kickstart.py
index 1f414c5..46c6c1f 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -393,6 +393,10 @@ class AnacondaKSHandlers(KickstartHandlers):
newname = ""
it = True
for path in mpath.paths:
+ if not iutil.valid_dm_name(path.name):
+ msg = "Invalid name for a multipath device '%s' "\
+ "(resembles a partition?)." % path.name
+ raise KickstartValueError, formatErrorMsg(self.lineno, msg)
dev = path.device
log.debug("Searching for mpath having '%s' as a member, the scsi id or wwpn:lunid" % (dev,))
log.debug("mpath '%s' has members %s" % (mp.name, list(mp.members)))
--
1.7.3.3
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]