Change in vdsm[master]: multipath: Fix devices rescanning

nsoffer at redhat.com nsoffer at redhat.com
Sun Apr 27 22:48:42 UTC 2014


Nir Soffer has uploaded a new change for review.

Change subject: multipath: Fix devices rescanning
......................................................................

multipath: Fix devices rescanning

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

Since commit dbf2089488 (Jul 9 2013) multipath call was change to use
the -r flag, forcing a reload of the device map. This was tested to fix
a case where new lun is created on the storage server, while a host was
connected, and the new device is not available when issuing the
getDeviceList command. According to a comment on gerrit, the change was
tested for ISCSI and FC storage types, but there is no documentation of
the testing procedure. The related bug has no information about what was
tested.

We currently have two bugs related multipath rescanning:

- Bug 1078879 tell us that invoking multipath with the -r flag sometimes
  triggers a segfault in the multipathd daemon. In the bug, multipath
  developer suggests that as long as multipathd daemon is running,
  there is no need to invoke multipath to detect new devices, and
  "multipath -r really isn't useful for much of anything".

- Bug 1071654 tell us that devices rescanning is broken on FC storage
  domains (although the -r flag is used). The bug suggest to use
  issue_lip sysfs api, which is also recommended in the RHEL storage
  administration manual.

This patch removes the -r flag, which seem to be useless currently, and
adds the missing FC rescan using the recommended sysfs api.

To be on the safe side, I left the multipath call as it was since the
first multipath commit in 2009. We will work with kernel and multipath
developers further on removing this call if it is indeed unneeded.

Bug-Url: https://bugzilla.redhat.com/1078879
Bug-Url: https://bugzilla.redhat.com/1071654
Relates-to: http://gerrit.ovirt.org/17263
Change-Id: I7699504f9771232ee0b880f9c83a51fd5b90f40e
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/storage/hba.py
M vdsm/storage/multipath.py
M vdsm/supervdsmServer
3 files changed, 34 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/27122/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 82d435d..ba98866 100644
--- a/vdsm/storage/multipath.py
+++ b/vdsm/storage/multipath.py
@@ -102,12 +102,12 @@
     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
-    cmd = [constants.EXT_MULTIPATH, "-r"]
-    misc.execCmd(cmd, sudo=True)
+    misc.execCmd([constants.EXT_MULTIPATH], sudo=True)
 
 
 def isEnabled():
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index ffcedb8..dc6f602 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -58,6 +58,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
@@ -253,6 +255,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/27122
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7699504f9771232ee0b880f9c83a51fd5b90f40e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list