Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vmax disk metrics #777

Merged
merged 4 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion delfin/drivers/dell_emc/vmax/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def list_controllers(self, storage_id):
self.array_id, self.uni_version, director)

status = constants.ControllerStatus.NORMAL
if director_info.get('availability', '').upper() != 'ONLINE':
if "OFF" in director_info.get('availability', '').upper():
status = constants.ControllerStatus.OFFLINE

controller = {
Expand Down Expand Up @@ -494,3 +494,20 @@ def get_controller_metrics(self, storage_id,
except Exception:
LOG.error("Failed to get CONTROLLER metrics for VMAX")
raise

def get_disk_metrics(self, storage_id, metrics, start_time, end_time):
"""Get disk performance metrics."""
if int(self.uni_version) < 91:
return []

try:
perf_list = self.rest.get_disk_metrics(
self.array_id, metrics, start_time, end_time)

metrics_array = perf_utils.construct_metrics(
storage_id, consts.DISK_METRICS, consts.DISK_CAP, perf_list)

return metrics_array
except Exception:
LOG.error("Failed to get DISK metrics for VMAX")
raise
14 changes: 14 additions & 0 deletions delfin/drivers/dell_emc/vmax/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@
'readThroughput': 'MBRead',
'writeThroughput': 'MBWritten',
}
DISK_METRICS = {
'iops': 'IOs',
'throughput': 'MBs',
'readThroughput': 'MBReads',
'writeThroughput': 'MBWritten',
'responseTime': 'AvgResponseTime',
}
POOL_METRICS = {
'iops': 'HostIOs',
'readIops': 'HostReads',
Expand Down Expand Up @@ -147,3 +154,10 @@
"writeThroughput": WRITE_THROUGHPUT_DESCRIPTION,
"responseTime": RESPONSE_TIME_DESCRIPTION,
}
DISK_CAP = {
"iops": IOPS_DESCRIPTION,
"throughput": THROUGHPUT_DESCRIPTION,
"readThroughput": READ_THROUGHPUT_DESCRIPTION,
"writeThroughput": WRITE_THROUGHPUT_DESCRIPTION,
"responseTime": RESPONSE_TIME_DESCRIPTION,
}
40 changes: 38 additions & 2 deletions delfin/drivers/dell_emc/vmax/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ def get_feport_metrics(self, array, metrics, start_time, end_time):
"""
feport_metrics = []
for k in metrics.keys():
vmax_key = constants.RDFDIRECTOR_METRICS.get(k)
vmax_key = constants.FEPORT_METRICS.get(k)
if vmax_key:
feport_metrics.append(vmax_key)

Expand Down Expand Up @@ -1092,7 +1092,7 @@ def get_rdfport_metrics(self, array, metrics, start_time, end_time):
if metrics_res:
label = {
'resource_id': key_dict.get('portId'),
'resource_name': 'BEPort_' +
'resource_name': 'RDFPort_' +
director_key_dict.get('directorId') +
'_' + key_dict.get('portId'),
'resource_type': delfin_const.ResourceType.PORT,
Expand All @@ -1119,6 +1119,42 @@ def get_port_metrics(self, array, metrics, start_time, end_time):
array, metrics, start_time, end_time)
return be_metrics, fe_metrics, rdf_metrics

def get_disk_metrics(self, array, metrics, start_time, end_time):
"""Get a disk performance metrics from VMAX unipshere REST API.
:param array: the array serial number
:param metrics: required metrics
:param start_time: start time for collection
:param end_time: end time for collection
:returns: message -- response from unipshere REST API
"""
disk_metrics = []
for k in metrics.keys():
vmax_key = constants.DISK_METRICS.get(k)
if vmax_key:
disk_metrics.append(vmax_key)

keys = self.get_resource_keys(array, 'Disk')
keys_dict = None
if keys:
keys_dict = keys.get('diskInfo', None)

metrics_list = []
for key_dict in keys_dict:
payload = {'diskId': key_dict.get('diskId')}
metrics_res = self.get_resource_metrics(
array, start_time, end_time, 'Disk',
disk_metrics, payload=payload)
if metrics_res:
label = {
'resource_id': key_dict.get('diskId'),
'resource_name': 'Disk_' + key_dict.get('diskId'),
'resource_type': delfin_const.ResourceType.DISK,
'metrics': metrics_res
}
metrics_list.append(label)

return metrics_list

def list_pagination(self, list_info):
"""Process lists under or over the maxPageSize
:param list_info: the object list information
Expand Down
9 changes: 9 additions & 0 deletions delfin/drivers/dell_emc/vmax/vmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ def collect_perf_metrics(self, context, storage_id,
start_time, end_time)
metrics.extend(port_metrics)

# disk metrics
if resource_metrics.get(constants.ResourceType.DISK):
disk_metrics = self.client.get_disk_metrics(
storage_id,
resource_metrics.get(constants.ResourceType.DISK),
start_time, end_time)
metrics.extend(disk_metrics)

except Exception:
LOG.error("Failed to collect metrics from VMAX")
raise
Expand All @@ -155,5 +163,6 @@ def get_capabilities(context, filters=None):
constants.ResourceType.STORAGE_POOL: consts.POOL_CAP,
constants.ResourceType.CONTROLLER: consts.CONTROLLER_CAP,
constants.ResourceType.PORT: consts.PORT_CAP,
constants.ResourceType.DISK: consts.DISK_CAP,
}
}
6 changes: 3 additions & 3 deletions delfin/tests/unit/drivers/dell_emc/vmax/test_vmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def test_list_controllers(self, mock_unisphere_version,
'name': 'DF-1C',
'storage_id': '12345',
'native_controller_id': 'DF-1C',
'status': 'offline',
'status': 'normal',
'location': 'slot_10',
'soft_version': None,
'cpu_info': 'Cores-64',
Expand Down Expand Up @@ -614,8 +614,8 @@ def test_get_capabilities(self, mock_unisphere_version,
self.assertIsInstance(capabilities, dict)
self.assertEqual(capabilities['is_historic'], True)
self.assertIsInstance(capabilities['resource_metrics'], dict)
# Support storage, storage_pool, controller and port metrics
self.assertEqual(len(capabilities['resource_metrics']), 4)
# Support storage, storage_pool, controller, port & disk metrics
self.assertEqual(len(capabilities['resource_metrics']), 5)

@mock.patch.object(VMaxRest, 'get_resource_metrics')
@mock.patch.object(VMaxRest, 'get_resource_keys')
Expand Down