Merge "Avoid unhandled exceptions during connecting to iSCSI portals"
This commit is contained in:
commit
2c96fe12d2
@ -626,18 +626,23 @@ class ISCSIConnector(base.BaseLinuxConnector, base_iscsi.BaseISCSIConnector):
|
|||||||
"""
|
"""
|
||||||
device = hctl = None
|
device = hctl = None
|
||||||
portal = props['target_portal']
|
portal = props['target_portal']
|
||||||
session, manual_scan = self._connect_to_iscsi_portal(props)
|
try:
|
||||||
do_scans = rescans > 0 or manual_scan
|
session, manual_scan = self._connect_to_iscsi_portal(props)
|
||||||
# Scan is sent on connect by iscsid, but we must do it manually on
|
except Exception:
|
||||||
# manual scan mode. This scan cannot count towards total rescans.
|
LOG.exception('Exception connecting to %s', portal)
|
||||||
if manual_scan:
|
session = None
|
||||||
num_rescans = -1
|
|
||||||
seconds_next_scan = 0
|
|
||||||
else:
|
|
||||||
num_rescans = 0
|
|
||||||
seconds_next_scan = 4
|
|
||||||
|
|
||||||
if session:
|
if session:
|
||||||
|
do_scans = rescans > 0 or manual_scan
|
||||||
|
# Scan is sent on connect by iscsid, but we must do it manually on
|
||||||
|
# manual scan mode. This scan cannot count towards total rescans.
|
||||||
|
if manual_scan:
|
||||||
|
num_rescans = -1
|
||||||
|
seconds_next_scan = 0
|
||||||
|
else:
|
||||||
|
num_rescans = 0
|
||||||
|
seconds_next_scan = 4
|
||||||
|
|
||||||
data['num_logins'] += 1
|
data['num_logins'] += 1
|
||||||
LOG.debug('Connected to %s', portal)
|
LOG.debug('Connected to %s', portal)
|
||||||
while do_scans:
|
while do_scans:
|
||||||
|
@ -1518,6 +1518,18 @@ Setting up iSCSI targets: unused
|
|||||||
expected.update(failed_logins=1, stopped_threads=1)
|
expected.update(failed_logins=1, stopped_threads=1)
|
||||||
self.assertDictEqual(expected, data)
|
self.assertDictEqual(expected, data)
|
||||||
|
|
||||||
|
@mock.patch.object(iscsi.ISCSIConnector, '_connect_to_iscsi_portal')
|
||||||
|
def test_connect_vol_with_connection_failure(self, connect_mock):
|
||||||
|
data = self._get_connect_vol_data()
|
||||||
|
|
||||||
|
connect_mock.side_effect = Exception()
|
||||||
|
|
||||||
|
self.connector._connect_vol(3, self.CON_PROPS, data)
|
||||||
|
|
||||||
|
expected = self._get_connect_vol_data()
|
||||||
|
expected.update(failed_logins=1, stopped_threads=1)
|
||||||
|
self.assertDictEqual(expected, data)
|
||||||
|
|
||||||
@mock.patch('os_brick.utils._time_sleep', mock.Mock())
|
@mock.patch('os_brick.utils._time_sleep', mock.Mock())
|
||||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'scan_iscsi')
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'scan_iscsi')
|
||||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'device_name_by_hctl',
|
@mock.patch.object(linuxscsi.LinuxSCSI, 'device_name_by_hctl',
|
||||||
|
7
releasenotes/notes/bug-1915678-901a6bd24ecede72.yaml
Normal file
7
releasenotes/notes/bug-1915678-901a6bd24ecede72.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
`Bug #1915678 <https://bugs.launchpad.net/cinder/+bug/1915678>`_: Fix
|
||||||
|
unhandled exception during iscsi volume attachment with multipath enabled
|
||||||
|
that resulted in the cinder-volume service becoming stuck and requiring
|
||||||
|
a restart.
|
Loading…
Reference in New Issue
Block a user