Handle exceptions properly with iscsi discovery
It fixes issues around exception handling when iscsi discovery
fails.
Change-Id: I875a41d3eb8d64851da8d1586f53c4f71436b9d0
Closes-bug: #1764682
(cherry picked from commit ec454b725d)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2015, 2017 IBM Corp.
|
# Copyright 2015, 2018 IBM Corp.
|
||||||
#
|
#
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
@@ -217,7 +217,7 @@ class TestISCSIAdapter(test_vol.TestVolumeAdapter):
|
|||||||
vios_uuid='fake_vios', status='fake_status')
|
vios_uuid='fake_vios', status='fake_status')
|
||||||
|
|
||||||
# Run the method
|
# Run the method
|
||||||
self.assertRaises(pvm_exc.MultipleExceptionsInFeedTask,
|
self.assertRaises(p_exc.VolumeAttachFailed,
|
||||||
self.vol_drv.connect_volume, self.slot_mgr)
|
self.vol_drv.connect_volume, self.slot_mgr)
|
||||||
|
|
||||||
@mock.patch('pypowervm.tasks.hdisk.discover_iscsi', autospec=True)
|
@mock.patch('pypowervm.tasks.hdisk.discover_iscsi', autospec=True)
|
||||||
@@ -228,8 +228,8 @@ class TestISCSIAdapter(test_vol.TestVolumeAdapter):
|
|||||||
operation_name='ISCSIDiscovery', error='fake_err')
|
operation_name='ISCSIDiscovery', error='fake_err')
|
||||||
|
|
||||||
# Run the method
|
# Run the method
|
||||||
self.assertRaises(pvm_exc.MultipleExceptionsInFeedTask,
|
self.assertRaises(p_exc.VolumeAttachFailed,
|
||||||
self.vol_drv.connect_volume, self.slot_mgr)
|
self.multi_vol_drv.connect_volume, self.slot_mgr)
|
||||||
|
|
||||||
@mock.patch('pypowervm.tasks.partition.get_active_vioses', autospec=True)
|
@mock.patch('pypowervm.tasks.partition.get_active_vioses', autospec=True)
|
||||||
@mock.patch('pypowervm.tasks.storage.rescan_vstor', autospec=True)
|
@mock.patch('pypowervm.tasks.storage.rescan_vstor', autospec=True)
|
||||||
|
|||||||
@@ -119,7 +119,10 @@ class IscsiVolumeAdapter(volume.VscsiVolumeAdapter,
|
|||||||
discovery_password=discovery_password,
|
discovery_password=discovery_password,
|
||||||
multipath=self._is_multipath())
|
multipath=self._is_multipath())
|
||||||
except (pvm_exc.ISCSIDiscoveryFailed, pvm_exc.JobRequestFailed) as e:
|
except (pvm_exc.ISCSIDiscoveryFailed, pvm_exc.JobRequestFailed) as e:
|
||||||
LOG.warning(e)
|
msg_args = {'vios': vios_w.uuid, 'err': six.text_type(e)}
|
||||||
|
LOG.warning("iSCSI discovery on VIOS %(vios)s failed with "
|
||||||
|
"error: %(err)s", msg_args)
|
||||||
|
return None, None
|
||||||
|
|
||||||
def _discover_volume_on_vios(self, vios_w):
|
def _discover_volume_on_vios(self, vios_w):
|
||||||
"""Discovers an hdisk on a single vios for the volume.
|
"""Discovers an hdisk on a single vios for the volume.
|
||||||
|
|||||||
Reference in New Issue
Block a user