Re: [PATCH 2/5] correctly delete a SCSI device provided by a zFCP LUN on s390

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

 



This one looks good, applying it to master.

On Fri, 10 Jul 2009, Steffen Maier wrote:

Parsing of /proc/scsi/scsi updated to work with latest zFCP.
Matching SCSI ID correctly with all of zFCP device, WWPN, and LUN.
Synchronization with udev_settle.
Error case is handled gracefully and reports user readable error message.
---
storage/zfcp.py |   31 ++++++++++++++++++++++---------
1 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/storage/zfcp.py b/storage/zfcp.py
index 2584268..7bb31b9 100644
--- a/storage/zfcp.py
+++ b/storage/zfcp.py
@@ -135,26 +135,39 @@ class ZFCPDevice:
        f = open("/proc/scsi/scsi", "r")
        lines = f.readlines()
        f.close()
+        # alternatively iterate over /sys/bus/scsi/devices/*:0:*:*/

        for line in lines:
            if not line.startswith("Host"):
                continue
            scsihost = string.split(line)
            host = scsihost[1]
-            channel = scsihost[3]
+            channel = "0"
            id = scsihost[5]
            lun = scsihost[7]
-            scsidev = "%s:%s:%s:%s" % (host[4], channel[1], id[1], lun[1])
-            fcpsysfs = "%s/%s/fcp_lun" % (scsidevsysfs, scsidev)
-            fcpdel = "%s/%s/delete" % (scsidevsysfs, scsidev)
+            scsidev = "%s:%s:%s:%s" % (host[4:], channel, id, lun)
+            fcpsysfs = "%s/%s" % (scsidevsysfs, scsidev)
+            scsidel = "%s/%s/delete" % (scsidevsysfs, scsidev)

-            f = open(fcpsysfs, "r")
-            fcplunsysfs = f.readline()
+            f = open("%s/hba_id" %(fcpsysfs), "r")
+            fcphbasysfs = f.readline().strip()
            f.close()
+            f = open("%s/wwpn" %(fcpsysfs), "r")
+            fcpwwpnsysfs = f.readline().strip()
+            f.close()
+            f = open("%s/fcp_lun" %(fcpsysfs), "r")
+            fcplunsysfs = f.readline().strip()
+            f.close()
+
+            if fcphbasysfs == self.devnum \
+                    and fcpwwpnsysfs == self.wwpn \
+                    and fcplunsysfs == self.fcplun:
+                loggedWriteLineToFile(scsidel, "1")
+                udev_settle()
+                return

-            if fcplunsysfs[:6] == self.fcplun[:6]:
-                loggedWriteLineToFile(fcpdel, "1")
-                break
+        log.warn("no scsi device found to delete for zfcp %s %s %s"
+                 %(self.devnum, self.wwpn, self.fcplun))

    def offlineDevice(self):
        offline = "%s/%s/online" %(zfcpsysfs, self.devnum)


--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
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