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

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

 



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

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux