summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2007-07-10 14:37:29 +0000
committerDavid Cantrell <dcantrell@redhat.com>2007-07-10 14:37:29 +0000
commitdde414de7ea98c9c2ee582b414e6005e0451e469 (patch)
treeb0c7a747c300993d4a73d07f3690ec9f19465f95 /isys
parent4fde2a48d5fd868e5756853fe3190035ac6401f2 (diff)
downloadanaconda-dde414de7ea98c9c2ee582b414e6005e0451e469.tar.gz
anaconda-dde414de7ea98c9c2ee582b414e6005e0451e469.tar.xz
anaconda-dde414de7ea98c9c2ee582b414e6005e0451e469.zip
* isys/isys.py (getMpathModel): Use scsi_id to gather WWID information
per mpath device. * iw/partition_ui_helpers_gui.py (createAllowedDrivesStore): Do not strip 'mapper/' from the mpath device name.
Diffstat (limited to 'isys')
-rw-r--r--isys/isys.py87
1 files changed, 52 insertions, 35 deletions
diff --git a/isys/isys.py b/isys/isys.py
index 003ddf6f7..2998a0080 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -943,45 +943,62 @@ def isPaeAvailable():
return isPAE
def getMpathModel(drive):
- dev = drive.replace('mapper/', '')
- args = ["-v", "2", "-l"]
- model = None
-
- mpathout = iutil.execWithCapture("multipath", args, stderr = "/dev/tty5")
- for line in mpathout.split('\n'):
- if line.startswith(dev):
- model = line
- break
-
- if model is None:
- model = "Unknown Multipath Device"
+ info = "Unknown Multipath Device"
+ fulldev = "/dev/mapper/%s" % (drive,)
+
+ # get minor number
+ if os.path.exists(fulldev):
+ minor = os.minor(os.stat(fulldev).st_rdev)
else:
- # if the output lacks a WWID, find that in the bindings file
- if model.find('()') != -1:
- bindings = '/var/lib/multipath/bindings'
-
- if os.path.isfile(bindings):
- f = open(bindings, 'r')
- blines = map(lambda s: s[:-1], f.readlines())
- f.close()
-
- wwid = None
- for line in blines:
- if line.strip().startswith(dev + ' '):
- wwid = line[line.strip().index(' '):].strip()
- wwid = "(%s)" % (wwid,)
- break
+ return info.strip()
+
+ # get slaves
+ slaves = []
+ slavepath = "/sys/block/dm-%d/slaves" % (minor,)
+ if os.path.isdir(slavepath):
+ slaves = os.listdir(slavepath)
+ else:
+ return info.strip()
+
+ # collect "vendor", "model" and "wwid" from a slave
+ vendor = ""
+ model = ""
+ wwid = ""
+ for slave in slaves:
+ # get "vendor"
+ sarg = "/sys/block/%s/device/vendor" % (slave,)
+ f = open(sarg, "r")
+ vendor = f.readline().strip()
+ f.close()
+
+ # get "model"
+ sarg = "/sys/block/%s/device/model" % (slave,)
+ f = open(sarg, "r")
+ model = f.readline().strip()
+ f.close()
+
+ # get "wwid"
+ sarg = "/block/%s" % (slave,)
+ output = iutil.execWithCapture("scsi_id", ["-g", "-u", "-s", sarg],
+ stderr = "/dev/tty5")
+ # may be an EMC device, try special option
+ if output == "":
+ output = iutil.execWithCapture("scsi_id",
+ ["-g", "-u", "-ppre-spc3-83", "-s", sarg],
+ stderr = "/dev/tty5")
+ if output != "":
+ for line in output.split("\n"):
+ if line == '':
+ continue
+ wwid = line
- if wwid is not None:
- model = model.replace('()', wwid)
+ # This loop is enough only the first slave
+ break
- # reduce the info string to just the WWID and make/model
- model = model[len(dev) + 1:]
- model = model.replace('(', '')
- model = model.replace(')', '')
- model = re.sub('\ +dm\-[0-9]+\ +', ' ', model)
+ if vendor != "" and model != "" and wwid != ""
+ info = vendor + "," + model + "," + wwid
- return model.strip()
+ return info.strip()
auditDaemon = _isys.auditdaemon