Change in vdsm[master]: iscsi: Add FC scan to forceScsiScan

ykaplan at redhat.com ykaplan at redhat.com
Wed Mar 20 17:35:50 UTC 2013


Yeela Kaplan has uploaded a new change for review.

Change subject: iscsi: Add FC scan to forceScsiScan
......................................................................

iscsi: Add FC scan to forceScsiScan

Change-Id: I9f740d9048aabbfaecba55cff338c57f31a20801
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=883390
Signed-off-by: Yeela Kaplan <ykaplan at redhat.com>
---
M vdsm/storage/iscsi.py
M vdsm/storage/multipath.py
M vdsm/supervdsmServer.py
3 files changed, 28 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/13221/1

diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index bc93f5c..bd2cf3b 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -43,7 +43,8 @@
 IscsiTarget = namedtuple("IscsiTarget", "portal, tpgt, iqn")
 
 ISCSI_DEFAULT_PORT = 3260
-SCAN_PATTERN = "/sys/class/scsi_host/host*/scan"
+SCAN_SCSI_PATTERN = "/sys/class/scsi_host/host*/scan"
+SCAN_FC_PATTERN = "/sys/class/fc_host/host*/issue_lip"
 
 IscsiSession = namedtuple("IscsiSession", "id, iface, target, credentials")
 
@@ -373,30 +374,31 @@
 
 
 @misc.samplingmethod
-def forceIScsiScan():
+def forceScsiScan():
     processes = []
     minTimeout = config.getint('irs', 'scsi_rescan_minimal_timeout')
     maxTimeout = config.getint('irs', 'scsi_rescan_maximal_timeout')
-    for hba in glob.glob(SCAN_PATTERN):
-        cmd = [constants.EXT_DD, 'of=' + hba]
-        p = misc.execCmd(cmd, sudo=False, sync=False)
-        try:
-            p.stdin.write("- - -")
-            p.stdin.flush()
-            p.stdin.close()
-        except OSError as e:
-            if p.wait(0) is False:
-                log.error("pid %s still running", p.pid)
-            log.warning("Error in rescan of hba:%s with returncode:%s and "
-                        "error message: %s", hba, p.returncode,
-                        p.stderr.read(1000))
-            if e.errno != errno.EPIPE:
-                raise
-            else:
-                log.warning("Ignoring error in rescan of hba %s: ",
-                            hba, exc_info=True)
-                continue
-        processes.append((hba, p))
+    for pattern in [(SCAN_SCSI_PATTERN, "- - -"), (SCAN_FC_PATTERN, "1")]:
+        for hba in glob.glob(pattern[0]):
+            cmd = [constants.EXT_DD, 'of=' + hba]
+            p = misc.execCmd(cmd, sudo=False, sync=False)
+            try:
+                p.stdin.write(pattern[1])
+                p.stdin.flush()
+                p.stdin.close()
+            except OSError as e:
+                if p.wait(0) is False:
+                    log.error("pid %s still running", p.pid)
+                log.warning("Error in rescan of hba:%s with returncode:%s and "
+                            "error message: %s", hba, p.returncode,
+                            p.stderr.read(1000))
+                if e.errno != errno.EPIPE:
+                    raise
+                else:
+                    log.warning("Ignoring error in rescan of hba %s: ",
+                                hba, exc_info=True)
+                    continue
+            processes.append((hba, p))
     if (minTimeout > maxTimeout or minTimeout < 0):
         minTimeout = 2
         maxTimeout = 30
diff --git a/vdsm/storage/multipath.py b/vdsm/storage/multipath.py
index 94801ca..2b01347 100644
--- a/vdsm/storage/multipath.py
+++ b/vdsm/storage/multipath.py
@@ -104,7 +104,7 @@
     # First ask iSCSI to rescan all its sessions
     iscsi.rescan()
 
-    supervdsm.getProxy().forceIScsiScan()
+    supervdsm.getProxy().forceScsiScan()
 
     # Now let multipath daemon pick up new devices
     misc.execCmd([constants.EXT_MULTIPATH], sudo=True)
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py
index 75d73e3..63f167a 100755
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer.py
@@ -37,7 +37,7 @@
 
 from lsblk import getLsBlk as _getLsBlk
 from storage.multipath import getScsiSerial as _getScsiSerial
-from storage.iscsi import forceIScsiScan as _forceIScsiScan
+from storage.iscsi import forceScsiScan as _forceScsiScan
 from storage.iscsi import getDevIscsiInfo as _getdeviSCSIinfo
 from storage.iscsi import readSessionInfo as _readSessionInfo
 from supervdsm import _SuperVdsmManager
@@ -124,8 +124,8 @@
         return _getScsiSerial(*args, **kwargs)
 
     @logDecorator
-    def forceIScsiScan(self, *args, **kwargs):
-        return _forceIScsiScan(*args, **kwargs)
+    def forceScsiScan(self, *args, **kwargs):
+        return _forceScsiScan(*args, **kwargs)
 
     @logDecorator
     def removeDeviceMapping(self, devName):


--
To view, visit http://gerrit.ovirt.org/13221
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f740d9048aabbfaecba55cff338c57f31a20801
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan at redhat.com>


More information about the vdsm-patches mailing list