Change in vdsm[ovirt-3.5]: multipath: Rescan also FC devices

nsoffer at redhat.com nsoffer at redhat.com
Sun Aug 3 23:40:07 UTC 2014


Hello Xavi Francisco, Elad Ben Aharon, Federico Simoncelli, Allon Mureinik,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/30984

to review the following change.

Change subject: multipath: Rescan also FC devices
......................................................................

multipath: Rescan also FC devices

When rescanning devices, we used to update ISCSI devices, and then run
multipath to update device mapping. However, we never rescanned FC
devices.

We used to believe that "multipath -r" was triggering a rescan of FC
devices and solving this issue. This may have been true in older
versions but certainly does not work with current RHEL release, and was
removed in the previous patch.

This patch adds the missing FC rescan using the issue_lip sysfs api,
recommended in the RHEL Storage Administration Guide.

Bug-Url: https://bugzilla.redhat.com/1071654
Change-Id: I7699504f9771232ee0b880f9c83a51fd5b90f40e
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/27122
Tested-by: Elad Ben Aharon <eladba1990 at gmail.com>
Reviewed-by: Allon Mureinik <amureini at redhat.com>
Reviewed-by: Xavi Francisco <xfrancis at redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/storage/hba.py
M vdsm/storage/multipath.py
M vdsm/supervdsmServer
3 files changed, 33 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/30984/1

diff --git a/vdsm/storage/hba.py b/vdsm/storage/hba.py
index da3feef..050bec5 100644
--- a/vdsm/storage/hba.py
+++ b/vdsm/storage/hba.py
@@ -36,6 +36,31 @@
 NODE_NAME = "node_name"
 
 
+def rescan():
+    """
+    Rescan HBAs connections, updating available devices.
+
+    This operation performs a Loop Initialization Protocol (LIP) and then
+    scans the interconnect and causes the SCSI layer to be updated to reflect
+    the devices currently on the bus. A LIP is, essentially, a bus reset, and
+    will cause device addition and removal.
+
+    Bear in mind that issue_lip is an asynchronous operation. The command may
+    complete before the entire scan has completed.
+
+    Note: Must be executed as root.
+    TODO: Some drivers do not support this operation.
+    """
+    log.info("Rescanning HBAs")
+    for path in glob.glob(FC_HOST_MASK + '/issue_lip'):
+        log.debug("Issuing lip %s", path)
+        try:
+            with open(path, 'w') as f:
+                f.write('1')
+        except IOError as e:
+            logging.error("Error issuing lip: %s", e)
+
+
 def getiSCSIInitiators():
     """
     Get iSCSI initiator name from the default location.
diff --git a/vdsm/storage/multipath.py b/vdsm/storage/multipath.py
index 4de2e64..ba98866 100644
--- a/vdsm/storage/multipath.py
+++ b/vdsm/storage/multipath.py
@@ -102,8 +102,9 @@
     Should only be called from hsm._rescanDevices()
     """
 
-    # First ask iSCSI to rescan all its sessions
+    # First rescan iSCSI and FCP connections
     iscsi.rescan()
+    supervdsm.getProxy().hbaRescan()
 
     # Now let multipath daemon pick up new devices
     misc.execCmd([constants.EXT_MULTIPATH], sudo=True)
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index f9395eb..a63caa2 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -60,6 +60,8 @@
 from network import sourceroutethread
 from network.api import (addNetwork, delNetwork, editNetwork, setupNetworks,
                          setSafeNetworkConfig)
+
+from storage import hba
 from network.tc import setPortMirroring, unsetPortMirroring
 from storage.multipath import getScsiSerial as _getScsiSerial
 from storage.iscsi import getDevIscsiInfo as _getdeviSCSIinfo
@@ -271,6 +273,10 @@
         return setSafeNetworkConfig()
 
     @logDecorator
+    def hbaRescan(self):
+        return hba.rescan()
+
+    @logDecorator
     def udevTrigger(self, guid):
         self.__udevReloadRules(guid)
         cmd = [EXT_UDEVADM, 'trigger', '--verbose', '--action', 'change',


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7699504f9771232ee0b880f9c83a51fd5b90f40e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Elad Ben Aharon <eladba1990 at gmail.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Xavi Francisco <xfrancis at redhat.com>


More information about the vdsm-patches mailing list