Merge "Dell PowerMax: Added exception handling after the masking view REST call."

This commit is contained in:
Zuul 2025-03-01 21:08:22 +00:00 committed by Gerrit Code Review
commit 3a79d86376
3 changed files with 44 additions and 21 deletions

View File

@ -869,10 +869,10 @@ class PowerMaxRestTest(test.TestCase):
def test_find_mv_connections_for_vol_missing_host_lun_address(self):
with mock.patch.object(self.rest, 'get_resource',
return_value=self.data.maskingview_no_lun):
host_lun_id = self.rest.find_mv_connections_for_vol(
self.data.array, self.data.masking_view_name_f,
self.data.device_id)
self.assertIsNone(host_lun_id)
self.assertRaises(exception.VolumeBackendAPIException,
self.rest.find_mv_connections_for_vol,
self.data.array, self.data.masking_view_name_f,
self.data.device_id)
def test_find_mv_connections_for_vol_failed(self):
# no masking view info retrieved
@ -883,9 +883,10 @@ class PowerMaxRestTest(test.TestCase):
# no connection info received
with mock.patch.object(self.rest, 'get_resource',
return_value={'no_conn': 'no_info'}):
host_lun_id2 = self.rest.find_mv_connections_for_vol(
self.data.array, self.data.masking_view_name_f, device_id)
self.assertIsNone(host_lun_id2)
self.assertRaises(exception.VolumeBackendAPIException,
self.rest.find_mv_connections_for_vol,
self.data.array, self.data.masking_view_name_f,
self.data.device_id)
def test_get_storage_groups_from_volume(self):
array = self.data.array

View File

@ -1623,7 +1623,7 @@ class PowerMaxRest(object):
self.delete_resource(array, SLOPROVISIONING,
"volume", device_id)
@retry(retry_exc_tuple, interval=2, retries=3)
@retry(retry_exc_tuple, interval=2, retries=8)
def find_mv_connections_for_vol(self, array, maskingview, device_id):
"""Find the host_lun_id for a volume in a masking view.
@ -1646,28 +1646,42 @@ class PowerMaxRest(object):
try:
masking_view_conn = connection_info.get(
'maskingViewConnection')
if masking_view_conn and isinstance(
masking_view_conn, list):
if (masking_view_conn and isinstance(
masking_view_conn, list) and
len(masking_view_conn) > 0):
host_lun_id = masking_view_conn[0].get(
'host_lun_address')
if host_lun_id:
host_lun_id = int(host_lun_id, 16)
else:
exception_message = (
_('Unable to get host_lun_address for '
'device %(dev)s on masking view %(mv)s. '
'Retrying...')
% {'dev': device_id, 'mv': maskingview})
exception_message = (_("Unable to get "
"host_lun_address for device "
"%(dev)s on masking view "
"%(mv)s. Retrying...")
% {"dev": device_id,
"mv": maskingview})
LOG.warning(exception_message)
raise exception.VolumeBackendAPIException(
message=exception_message)
else:
exception_message = (_("Unable to retrieve connection "
"information for volume %(vol)s "
"in masking view %(mv)s. "
"Retrying...")
% {"vol": device_id,
"mv": maskingview})
LOG.warning(exception_message)
raise exception.VolumeBackendAPIException(
message=exception_message)
except Exception as e:
exception_message = (
_("Unable to retrieve connection information "
"for volume %(vol)s in masking view %(mv)s. "
"Exception received: %(e)s. Retrying...")
% {'vol': device_id, 'mv': maskingview,
'e': e})
exception_message = (_("Unable to retrieve connection "
"information for volume %(vol)s "
"in masking view %(mv)s. "
"Exception received: %(e)s. "
"Retrying...")
% {"vol": device_id,
"mv": maskingview,
"e": e})
LOG.warning(exception_message)
raise exception.VolumeBackendAPIException(
message=exception_message)

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Dell PowerMax Driver `bug #2081742
<https://bugs.launchpad.net/cinder/+bug/2081742>`_: The REST
API calls for the masking view connection do not return
the HostLUN ID immediately. To address this, an exception
has been added to implement a retry mechanism.