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

netapp version updated 9.10 Performance Collection #647

Merged
merged 2 commits into from
Aug 28, 2023
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
2 changes: 1 addition & 1 deletion delfin/drivers/netapp/dataontap/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}

PATTERN = re.compile('^[-]{3,}')
FLOAT_PATTERN = r"\d\.\d"
FLOAT_PATTERN = r"\d\.\d*"
IP_PATTERN = re.compile(r'(([01]{0,1}\d{0,1}\d|2[0-4]\d|25[0-5])\.){3}'
r'([01]{0,1}\d{0,1}\d|2[0-4]\d|25[0-5])$')
IQN_PATTERN = re.compile('^[i][q][n].')
Expand Down
24 changes: 12 additions & 12 deletions delfin/drivers/netapp/dataontap/netapp_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def login(self):
or 'command not found' in result:
raise exception.InvalidIpOrPort()
version = self.get_storage_version()
if version >= 9.6:
if version >= 96:
self.rest_client.do_call(
constant.CLUSTER_PERF_URL, None, 'GET')
except Exception as e:
Expand Down Expand Up @@ -1211,23 +1211,23 @@ def get_storage_version(self):
version_list = \
re.findall(constant.FLOAT_PATTERN, storage_version[0])
for ver_info in version_list:
if float(ver_info) >= 9.0:
return float(ver_info)
return 9.0
if int(ver_info.replace(".", "")) >= 90:
return int(ver_info.replace(".", ""))
return 90

@staticmethod
def get_cap_by_version(version, capabilities):
if version >= 9.6:
if version >= 96:
capabilities['resource_metrics']['storage'] = \
constant.STORAGE_CAPABILITIES
if version >= 9.7:
if version >= 97:
capabilities['resource_metrics']['storagePool'] = \
constant.POOL_CAPABILITIES
capabilities['resource_metrics']['port'] = \
constant.PORT_CAPABILITIES
capabilities['resource_metrics']['filesystem'] = \
constant.FS_CAPABILITIES
if version >= 9.8:
if version >= 98:
capabilities['resource_metrics']['volume'] = \
constant.VOLUME_CAPABILITIES
return capabilities
Expand All @@ -1242,20 +1242,20 @@ def get_capabilities(filters):
version_List = \
re.findall(
constant.FLOAT_PATTERN, filters.get('firmware_version'))
version = 9.0
version = 90
for ver_info in version_List:
if float(ver_info) >= 9.0:
version = float(ver_info)
if int(ver_info.replace(".", "")) >= 90:
version = int(ver_info.replace(".", ""))
break
NetAppHandler.get_cap_by_version(version, capabilities)
return capabilities
cap_map = {}
for i in range(0, 10):
for i in range(0, 11):
capabilities = {
'is_historic': True,
'resource_metrics': {}
}
version = float('9.' + str(i))
version = int('9' + str(i))
NetAppHandler.get_cap_by_version(version, capabilities)
cap_map[version] = capabilities
return cap_map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def test_get_storage_performance(self):

def test_get_capabilities_is_None(self):
data = self.netapp_client.get_capabilities(context, None)
self.assertEqual(data[9.8]['resource_metrics']['storage']
self.assertEqual(data[98]['resource_metrics']['storage']
['throughput']['unit'], 'MB/s')

def test_get_capabilities(self):
Expand Down
Loading