Skip to content

Commit

Permalink
Merge branch 'master' into unity_host
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjiangyu-ghca authored May 18, 2022
2 parents e6fac2a + effad04 commit 173ce3f
Show file tree
Hide file tree
Showing 42 changed files with 8,029 additions and 95 deletions.
109 changes: 109 additions & 0 deletions delfin/drivers/dell_emc/unity/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

DEFAULT_TIMEOUT = 10
ALERT_TIMEOUT = 20
REST_RETRY_TIMES = 1
TRAP_DESC = {
"1:127486a": ["WARNING", "ALRT_LCC_FW_UPGRADE_FAILED",
"The link control card (LCC) will continue to function with "
Expand Down Expand Up @@ -3454,3 +3455,111 @@
"Performance metrics are unavailable due to a system error."
" Contact your service provider."]
}
IOPS_DESCRIPTION = {
"unit": "IOPS",
"description": "Input/output operations per second"
}
READ_IOPS_DESCRIPTION = {
"unit": "IOPS",
"description": "Read input/output operations per second"
}
WRITE_IOPS_DESCRIPTION = {
"unit": "IOPS",
"description": "Write input/output operations per second"
}
THROUGHPUT_DESCRIPTION = {
"unit": "MB/s",
"description": "Represents how much data is "
"successfully transferred in MB/s"
}
READ_THROUGHPUT_DESCRIPTION = {
"unit": "MB/s",
"description": "Represents how much data read is "
"successfully transferred in MB/s"
}
WRITE_THROUGHPUT_DESCRIPTION = {
"unit": "MB/s",
"description": "Represents how much data write is "
"successfully transferred in MB/s"
}
RESPONSE_TIME_DESCRIPTION = {
"unit": "ms",
"description": "Average time taken for an IO "
"operation in ms"
}
CACHE_HIT_RATIO_DESCRIPTION = {
"unit": "%",
"description": "Percentage of io that are cache hits"
}
READ_CACHE_HIT_RATIO_DESCRIPTION = {
"unit": "%",
"description": "Percentage of read ops that are cache hits"
}
WRITE_CACHE_HIT_RATIO_DESCRIPTION = {
"unit": "%",
"description": "Percentage of write ops that are cache hits"
}
IO_SIZE_DESCRIPTION = {
"unit": "KB",
"description": "The average size of IO requests in KB"
}
READ_IO_SIZE_DESCRIPTION = {
"unit": "KB",
"description": "The average size of read IO requests in KB"
}
WRITE_IO_SIZE_DESCRIPTION = {
"unit": "KB",
"description": "The average size of write IO requests in KB"
}
CPU_USAGE_DESCRIPTION = {
"unit": "%",
"description": "Percentage of CPU usage"
}
MEMORY_USAGE_DESCRIPTION = {
"unit": "%",
"description": "Percentage of DISK memory usage in percentage"
}
SERVICE_TIME = {
"unit": 'ms',
"description": "Service time of the resource in ms"
}
VOLUME_CAP = {
"iops": IOPS_DESCRIPTION,
"readIops": READ_IOPS_DESCRIPTION,
"writeIops": WRITE_IOPS_DESCRIPTION,
"throughput": THROUGHPUT_DESCRIPTION,
"readThroughput": READ_THROUGHPUT_DESCRIPTION,
"writeThroughput": WRITE_THROUGHPUT_DESCRIPTION,
"responseTime": RESPONSE_TIME_DESCRIPTION,
"ioSize": IO_SIZE_DESCRIPTION,
"readIoSize": READ_IO_SIZE_DESCRIPTION,
"writeIoSize": WRITE_IO_SIZE_DESCRIPTION
}
PORT_CAP = {
"iops": IOPS_DESCRIPTION,
"readIops": READ_IOPS_DESCRIPTION,
"writeIops": WRITE_IOPS_DESCRIPTION,
"throughput": THROUGHPUT_DESCRIPTION,
"readThroughput": READ_THROUGHPUT_DESCRIPTION,
"writeThroughput": WRITE_THROUGHPUT_DESCRIPTION
}
DISK_CAP = {
"iops": IOPS_DESCRIPTION,
"readIops": READ_IOPS_DESCRIPTION,
"writeIops": WRITE_IOPS_DESCRIPTION,
"throughput": THROUGHPUT_DESCRIPTION,
"readThroughput": READ_THROUGHPUT_DESCRIPTION,
"writeThroughput": WRITE_THROUGHPUT_DESCRIPTION,
"responseTime": RESPONSE_TIME_DESCRIPTION
}
FILESYSTEM_CAP = {
"iops": IOPS_DESCRIPTION,
"readIops": READ_IOPS_DESCRIPTION,
"writeIops": WRITE_IOPS_DESCRIPTION,
"throughput": THROUGHPUT_DESCRIPTION,
"readThroughput": READ_THROUGHPUT_DESCRIPTION,
"writeThroughput": WRITE_THROUGHPUT_DESCRIPTION,
"ioSize": IO_SIZE_DESCRIPTION,
"readIoSize": READ_IO_SIZE_DESCRIPTION,
"writeIoSize": WRITE_IO_SIZE_DESCRIPTION
}
30 changes: 25 additions & 5 deletions delfin/drivers/dell_emc/unity/rest_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class RestHandler(RestClient):
REST_QTREE_URL = '/api/types/treeQuota/instances'
REST_USERQUOTA_URL = '/api/types/userQuota/instances'
REST_QUOTACONFIG_URL = '/api/types/quotaConfig/instances'
REST_VIRTUAL_DISK_URL = '/api/types/virtualDisk/instances'
STATE_SOLVED = 2

def __init__(self, **kwargs):
Expand Down Expand Up @@ -106,11 +107,19 @@ def logout(self):

def get_rest_info(self, url, data=None, method='GET',
calltimeout=consts.DEFAULT_TIMEOUT):
result_json = None
res = self.call(url, data, method, calltimeout)
if res.status_code == 200:
result_json = res.json()
return result_json
retry_times = consts.REST_RETRY_TIMES
while retry_times >= 0:
try:
res = self.call(url, data, method, calltimeout)
if res.status_code == 200:
return res.json()
err_msg = "rest response abnormal,status_code:%s,res.json:%s" \
% (res.status_code, res.json())
LOG.error(err_msg)
except Exception as e:
LOG.error(e)
retry_times -= 1
return None

def call(self, url, data=None, method='GET',
calltimeout=consts.DEFAULT_TIMEOUT):
Expand Down Expand Up @@ -293,5 +302,16 @@ def get_host_ip(self):
def get_host_lun(self, page):
url = '/api/types/hostLUN/instances?%s&page=%s' % \
('fields=id,host,lun', page)

def get_history_metrics(self, path, page):
url = '/api/types/metricValue/instances?filter=path EQ "%s"&page=%s'\
% (path, page)
result_json = self.get_rest_info(url)
return result_json

def get_virtual_disks(self):
url = '%s?%s' % (RestHandler.REST_VIRTUAL_DISK_URL,
'fields=health,name,spaScsiId,tierType,sizeTotal,'
'id,model,manufacturer,wwn')
result_json = self.get_rest_info(url)
return result_json
Loading

0 comments on commit 173ce3f

Please sign in to comment.