Skip to content

Commit

Permalink
Add support for multiple arrays of Embedded Unisphere (#697)
Browse files Browse the repository at this point in the history
Co-authored-by: Erik <lynheell@gmail.com>
Co-authored-by: Najmudheen <45681499+NajmudheenCT@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 28, 2021
1 parent ca4b819 commit 4d25845
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
46 changes: 35 additions & 11 deletions delfin/drivers/dell_emc/vmax/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,24 @@ def init_connection(self, access_info):
msg = "Invalid array_id. Expected id: {}". \
format(array['symmetrixId'])
raise exception.InvalidInput(msg)
else:
# Get first local array id
array_ids = array.get('symmetrixId', list())
for array_id in array_ids:
array_info = self.rest.get_array_detail(
version=self.uni_version, array=array_id)
if array_info.get('local'):
LOG.info("Adding local VMAX array {}".
format(array_id))
if not self.array_id:
self.array_id = array_id
break
else:
LOG.info("Skipping remote VMAX array {}".
format(array_id))
if not self.array_id:
msg = "Failed to get VMAX array id from Unisphere"
raise exception.InvalidInput(msg)
except Exception:
LOG.error("Failed to init_connection to VMAX")
raise
Expand Down Expand Up @@ -307,13 +325,18 @@ def list_ports(self, storage_id):
# Get list of Directors
directors = self.rest.get_director_list(self.array_id,
self.uni_version)
switcher = {
'A': constants.PortLogicalType.MANAGEMENT,
'B': constants.PortLogicalType.SERVICE,
'C': constants.PortLogicalType.BACKEND,
}
port_list = []
for director in directors:
except Exception:
LOG.error("Failed to get director list,"
" while getting port metrics from VMAX")
raise
switcher = {
'A': constants.PortLogicalType.MANAGEMENT,
'B': constants.PortLogicalType.SERVICE,
'C': constants.PortLogicalType.BACKEND,
}
port_list = []
for director in directors:
try:
port_keys = self.rest.get_port_list(
self.array_id, self.uni_version, director)
for port_key in port_keys:
Expand Down Expand Up @@ -371,11 +394,12 @@ def list_ports(self, storage_id):
'ipv6_mask': None,
}
port_list.append(port_dict)
return port_list

except Exception:
LOG.error("Failed to get port metrics from VMAX")
raise
except Exception:
LOG.error("Failed to get port list for director: {}"
.format(director))

return port_list

def list_alerts(self, query_para):
"""Get all alerts from an array."""
Expand Down
1 change: 1 addition & 0 deletions delfin/tests/unit/drivers/dell_emc/vmax/test_vmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ def test_list_ports(self, mock_unisphere_version,
ret = driver.list_ports(context)
self.assertDictEqual(ret[0], expected[0])

mock_dirs.side_effect = exception.StorageBackendException
with self.assertRaises(Exception) as exc:
driver.list_ports(context)

Expand Down

0 comments on commit 4d25845

Please sign in to comment.