[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 2/4] Add getDasdPorts() to storage/dasd.py.



Reimplement the old isys.getDasdPorts() function in Python.
---
 storage/dasd.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/storage/dasd.py b/storage/dasd.py
index 591dde0..2052843 100644
--- a/storage/dasd.py
+++ b/storage/dasd.py
@@ -33,6 +33,23 @@ import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
 P_ = lambda x, y, z: gettext.ldngettext("anaconda", x, y, z)
 
+def getDasdPorts():
+    """ Return comma delimited string of valid DASD ports. """
+    ports = []
+
+    f = open("/proc/dasd/devices", "r")
+    lines = map(lambda x: x.strip(), f.readlines())
+    f.close()
+
+    for line in lines:
+        if "unknown" in line:
+            continue
+
+        if "(FBA )" in line or "(ECKD)" in line:
+            ports.append(line.split('(')[0])
+
+    return ','.join(ports)
+
 class DASD:
     """ Controlling class for DASD interaction before the storage code in
         anaconda has initialized.
-- 
1.6.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]