Handle exceptions properly with iscsi discovery
It fixes issues around exception handling when iscsi discovery fails. Change-Id: I875a41d3eb8d64851da8d1586f53c4f71436b9d0 Closes-bug: #1764682
This commit is contained in:
parent
5100bf00e4
commit
ec454b725d
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2015, 2017 IBM Corp.
|
||||
# Copyright 2015, 2018 IBM Corp.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
@ -220,7 +220,7 @@ class TestISCSIAdapter(test_vol.TestVolumeAdapter):
|
|||
vios_uuid='fake_vios', status='fake_status')
|
||||
|
||||
# Run the method
|
||||
self.assertRaises(pvm_exc.MultipleExceptionsInFeedTask,
|
||||
self.assertRaises(p_exc.VolumeAttachFailed,
|
||||
self.vol_drv.connect_volume, self.slot_mgr)
|
||||
|
||||
@mock.patch('pypowervm.tasks.hdisk.discover_iscsi', autospec=True)
|
||||
|
@ -231,8 +231,8 @@ class TestISCSIAdapter(test_vol.TestVolumeAdapter):
|
|||
operation_name='ISCSIDiscovery', error='fake_err')
|
||||
|
||||
# Run the method
|
||||
self.assertRaises(pvm_exc.MultipleExceptionsInFeedTask,
|
||||
self.vol_drv.connect_volume, self.slot_mgr)
|
||||
self.assertRaises(p_exc.VolumeAttachFailed,
|
||||
self.multi_vol_drv.connect_volume, self.slot_mgr)
|
||||
|
||||
@mock.patch('pypowervm.tasks.partition.get_active_vioses', autospec=True)
|
||||
@mock.patch('pypowervm.tasks.storage.rescan_vstor', autospec=True)
|
||||
|
|
|
@ -119,7 +119,10 @@ class IscsiVolumeAdapter(volume.VscsiVolumeAdapter,
|
|||
discovery_password=discovery_password,
|
||||
multipath=self._is_multipath())
|
||||
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):
|
||||
"""Discovers an hdisk on a single vios for the volume.
|
||||
|
|
Loading…
Reference in New Issue