Merge "PowerMax Driver - Empty port info response"

This commit is contained in:
Zuul 2022-07-01 11:19:11 +00:00 committed by Gerrit Code Review
commit 441ad3c5af
4 changed files with 30 additions and 11 deletions

View File

@ -324,7 +324,7 @@ class PowerMaxProvisionTest(test.TestCase):
# cannot retrieve srp
array = self.data.array
array_info = {'srpName': self.data.failed_resource}
ref_stats = (0, 0, 0, 0, False)
ref_stats = (0, 0, 0, 0)
stats = self.provision.get_srp_pool_stats(array, array_info)
self.assertEqual(ref_stats, stats)
# cannot report on all stats

View File

@ -2495,22 +2495,31 @@ class PowerMaxRestTest(test.TestCase):
@mock.patch.object(
rest.PowerMaxRest, 'get_request',
side_effect=[tpd.PowerMaxData.director_port_keys_empty,
tpd.PowerMaxData.director_port_keys_multiple])
tpd.PowerMaxData.director_port_keys_multiple,
{}])
def test_get_ip_interface_physical_port_exceptions(self, mck_get):
array_id = self.data.array
virtual_port = self.data.iscsi_dir_virtual_port
ip_address = self.data.ip
# No physical port keys returned
self.assertRaises(
exception.VolumeBackendAPIException,
self.rest.get_ip_interface_physical_port,
array_id, virtual_port, ip_address)
with self.assertRaisesRegex(
exception.VolumeBackendAPIException,
'are not associated a physical director:port.'):
self.rest.get_ip_interface_physical_port(
array_id, virtual_port, ip_address)
# Multiple physical port keys returned
self.assertRaises(
exception.VolumeBackendAPIException,
self.rest.get_ip_interface_physical_port,
array_id, virtual_port, ip_address)
with self.assertRaisesRegex(
exception.VolumeBackendAPIException,
'associated with more than one physical director:port.'):
self.rest.get_ip_interface_physical_port(
array_id, virtual_port, ip_address)
# Empty response
with self.assertRaisesRegex(
exception.VolumeBackendAPIException,
'Unable to get port IP interface from Virtual port'):
self.rest.get_ip_interface_physical_port(
array_id, virtual_port, ip_address)
@mock.patch.object(rest.PowerMaxRest, 'get_volume_snaps',
return_value=[{'snap_name': 'snap_name',

View File

@ -462,7 +462,7 @@ class PowerMaxProvision(object):
LOG.error("Unable to retrieve srp instance of %(srpName)s on "
"array %(array)s.",
{'srpName': srp, 'array': array})
return 0, 0, 0, 0, False
return 0, 0, 0, 0
try:
srp_capacity = srp_details['srp_capacity']
total_capacity_gb = srp_capacity['usable_total_tb'] * units.Ki

View File

@ -1816,6 +1816,16 @@ class PowerMaxRest(object):
port_info = self.get_request(
target_uri, 'port IP interface', params)
if not port_info:
msg = (_(
"Unable to get port IP interface from Virtual port %(vp)s "
"using IP address %(ip)s. Please check iSCSI configuration "
"of backend array %(arr)s." % {
'vp': virtual_port, 'ip': ip_address, 'arr': array_id}
))
LOG.error(msg)
raise exception.VolumeBackendAPIException(message=msg)
port_key = port_info.get('symmetrixPortKey', [])
if len(port_key) == 1: