Change in vdsm[master]: hba: Rescan using SCSI layer

nsoffer at redhat.com nsoffer at redhat.com
Sun Oct 19 21:32:59 UTC 2014


Nir Soffer has uploaded a new change for review.

Change subject: hba: Rescan using SCSI layer
......................................................................

hba: Rescan using SCSI layer

Commit 66c24c1996 (iscsi: Iscsi rescan cleanup) was little too deep,
disabling rescanning of HBAs.

Before that commit, we were scanning all /sys/class/scsi_host entries.
This includes both iSCSI hosts and HBAs, since HBAs are located at
/sys/class/fc_host and at /sys/class/scsi_host.  The code was similar to
this shell script:

    for path in /sys/class/scsi_host/host*/scan
        do echo "- - -" > $path
    done

This commit replaced this code with simpler invocation of:

    iscsiadm -m session -R

This command locates the active iSCSI session, and scan the scsi_host
sysfs entries used by them. However this does *not* scan fc_hosts, since
they do not have iSCSI sessions.

Tracing iscsiadm on a host with a HBA and one iSCSI session, we can see
that it scans only the iSCSI entry:

    # strace -f iscsiadm -m session -R
    ...
    [pid 11084] open("/sys/class/scsi_host/host12/scan", O_WRONLY) = 3
    [pid 11084] write(3, "- - -", 5)        = 5
    ...

In commit 674337d8f9 (multipath: Rescan also FC devices), we tried to
fix HBA rescanning by using issue_lip.  But issue_lip was proved to be
disruptive, and cannot be used in the normal multipath rescanning flow.

This patch is the minimal fix to restore HBAs rescanning, keeping the
current usage of iscsiadm. Since we use the old safe method, evil
configuration options are not needed.

The replaces commit 48fa75287e (multiapth: Disable hba rescanning by
default), which was first aid, disabling the fix for bug 1123637.

Change-Id: I7deb3047f1b75c4c65d59602b908835515290993
Bug-Url: https://bugzilla.redhat.com/1152587
Relates-To: https://bugzilla.redhat.com/1123637
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/storage/hba.py
M vdsm/storage/multipath.py
3 files changed, 11 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/34245/1

diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index b1f6d28..140019b 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -250,11 +250,6 @@
         ('vol_size_sample_interval', '60',
             'How often should the volume size be checked (seconds).'),
 
-        ('hba_rescan', 'false',
-            'Enable hba scanning when rescanning multipath. Required to '
-            'detect new or removed luns on FCP server. Disabled by default '
-            'since it may be disruptive.'),
-
         ('scsi_rescan_minimal_timeout', '2',
             'The minimum number of seconds to wait for scsi scan to return.'),
 
diff --git a/vdsm/storage/hba.py b/vdsm/storage/hba.py
index 0fb6d46..b745cd7 100644
--- a/vdsm/storage/hba.py
+++ b/vdsm/storage/hba.py
@@ -38,27 +38,23 @@
 
 def rescan():
     """
-    Rescan HBAs connections, updating available devices.
+    Rescan HBAs connections, discovering new LUNs.
 
-    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.
+    This triggers a rescan using the SCSI layer. This procedure is considered
+    disruptive, but we used it successfully until September 2013, during the
+    normal multipath rescanning flow. This procedure will add LUNs, but not
+    remove them.
 
     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)
+    for path in glob.glob(FC_HOST_MASK + '/device/scsi_host/host*/scan'):
+        log.debug("Rescanning %s", path)
         try:
-            with open(path, 'w') as f:
-                f.write('1')
+            with open(path, 'wb', 0) as f:
+                f.write('- - -')
         except IOError as e:
-            logging.error("Error issuing lip: %s", e)
+            logging.error("Error rescanning: %s", e)
 
 
 def getiSCSIInitiators():
diff --git a/vdsm/storage/multipath.py b/vdsm/storage/multipath.py
index 68502ce..ba98866 100644
--- a/vdsm/storage/multipath.py
+++ b/vdsm/storage/multipath.py
@@ -32,7 +32,6 @@
 
 from vdsm import constants
 from vdsm import utils
-from vdsm.config import config
 import misc
 import iscsi
 import supervdsm
@@ -105,9 +104,7 @@
 
     # First rescan iSCSI and FCP connections
     iscsi.rescan()
-
-    if config.getboolean('irs', 'hba_rescan'):
-        supervdsm.getProxy().hbaRescan()
+    supervdsm.getProxy().hbaRescan()
 
     # Now let multipath daemon pick up new devices
     misc.execCmd([constants.EXT_MULTIPATH], sudo=True)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7deb3047f1b75c4c65d59602b908835515290993
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