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

unity change ethport's logictype and THROUGHPUT'units as Ki #999

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions delfin/drivers/dell_emc/unity/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
DEFAULT_TIMEOUT = 10
ALERT_TIMEOUT = 20
REST_RETRY_TIMES = 1
FILESYSTEM_TYPE_VMWARE = 2
TRAP_DESC = {
"1:127486a": ["WARNING", "ALRT_LCC_FW_UPGRADE_FAILED",
"The link control card (LCC) will continue to function with "
Expand Down
5 changes: 3 additions & 2 deletions delfin/drivers/dell_emc/unity/rest_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,15 @@ def get_port_interface(self):
def get_all_filesystems(self):
url = '%s?%s' % (RestHandler.REST_FILESYSTEM_URL,
'fields=id,name,health,sizeAllocated,accessPolicy,'
'sizeTotal,sizeUsed,isThinEnabled,pool,flrVersion')
'sizeTotal,sizeUsed,isThinEnabled,pool,flrVersion,'
'type')
result_json = self.get_rest_info(url)
return result_json

def get_all_filesystems_without_flr(self):
url = '%s?%s' % (RestHandler.REST_FILESYSTEM_URL,
'fields=id,name,health,sizeAllocated,accessPolicy,'
'sizeTotal,sizeUsed,isThinEnabled,pool')
'sizeTotal,sizeUsed,isThinEnabled,pool,type')
result_json = self.get_rest_info(url)
return result_json

Expand Down
15 changes: 11 additions & 4 deletions delfin/drivers/dell_emc/unity/unity.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ def get_eth_ports(self):
ipv6, ip_content.get('ipAddress'))
ipv6_mask = UnityStorDriver.handle_port_ip(
ipv6_mask, ip_content.get('netmask'))
logical_type = ''
if '_mgmt' in content.get('id') or '_srm' in content.get('id'):
logical_type = constants.PortLogicalType.MANAGEMENT
port_result = {
'name': content.get('name'),
'storage_id': self.storage_id,
Expand All @@ -391,7 +394,7 @@ def get_eth_ports(self):
'connection_status': conn_status,
'health_status': status,
'type': constants.PortType.ETH,
'logical_type': '',
'logical_type': logical_type,
'speed': int(content.get('speed')) * units.M
if content.get('speed') is not None else None,
'max_speed': int(content.get('speed')) * units.M
Expand Down Expand Up @@ -520,7 +523,9 @@ def list_filesystems(self, context):
fs_entries = files.get('entries')
for file in fs_entries:
content = file.get('content')
if not content:
# exclude the type is vmware
if not content or content.get('type') == \
consts.FILESYSTEM_TYPE_VMWARE:
continue
health_value = content.get('health', {}).get('value')
if health_value in UnityStorDriver.HEALTH_OK:
Expand Down Expand Up @@ -1025,10 +1030,12 @@ def package_metrics(storage_id, resource_type, metrics, metrics_list):
'type': 'RAW',
'unit': unit
}
if 'THROUGHPUT' in metric.get('type').upper() or \
'RESPONSETIME' in metric.get('type').upper():
if 'RESPONSETIME' in metric.get('type').upper():
for tm in metric.get('values'):
metric['values'][tm] = metric['values'][tm] / units.k
if 'THROUGHPUT' in metric.get('type').upper():
for tm in metric.get('values'):
metric['values'][tm] = metric['values'][tm] / units.Ki
value = constants.metric_struct(name=metric.get('type'),
labels=labels,
values=metric.get('values'))
Expand Down
2 changes: 1 addition & 1 deletion delfin/drivers/ibm/storwize_svc/ssh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ def count_metric_data(last_data, now_data, interval, target, metric_type,
elif 'IOSIZE' in metric_type.upper():
value = value / units.Ki
elif 'IOPS' in metric_type.upper():
value = int(value / interval)
value = value / interval
elif 'RESPONSETIME' in metric_type.upper():
value = value / interval
value = round(value, 3)
Expand Down
36 changes: 12 additions & 24 deletions delfin/tests/unit/drivers/dell_emc/unity/test_emc_unity.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@
"entries": [
{
"content": {
"id": "spa_eth0",
"id": "spa_srm",
"speed": 10000,
"connectorType": 1,
"requestedSpeed": 0,
Expand All @@ -420,7 +420,7 @@
"maxMtu": 9000,
"bond": False,
"isLinkUp": True,
"macAddress": "00:50:56:81:E1:50",
"macAddress": "00:50:56:81:E1:55",
"isRSSCapable": False,
"isRDMACapable": False,
"requestedMtu": 1500,
Expand Down Expand Up @@ -616,7 +616,7 @@
"ipAddress": "192.168.3.111",
"ipProtocolVersion": 4,
"ipPort": {
"id": "spa_eth1"
"id": "spa_mgmt"
}
}
}
Expand Down Expand Up @@ -662,17 +662,17 @@
{
'name': 'SP A Ethernet Port 0',
'storage_id': '12345',
'native_port_id': 'spa_eth0',
'native_port_id': 'spa_srm',
'location': 'SP A Ethernet Port 0',
'connection_status': 'connected',
'health_status': 'normal',
'type': 'eth',
'logical_type': '',
'logical_type': 'management',
'speed': 10000000000,
'max_speed': 10000000000,
'native_parent_id': 'spa',
'wwn': '',
'mac_address': '00:50:56:81:E1:50',
'mac_address': '00:50:56:81:E1:55',
'ipv4': None,
'ipv4_mask': None,
'ipv6': None,
Expand All @@ -691,8 +691,8 @@
'native_parent_id': 'spa',
'wwn': '',
'mac_address': '00:50:56:81:E8:4B',
'ipv4': '192.168.3.111',
'ipv4_mask': '255.255.255.0',
'ipv4': None,
'ipv4_mask': None,
'ipv6': None,
'ipv6_mask': None
}, {
Expand Down Expand Up @@ -739,14 +739,14 @@
'connection_status': 'connected',
'health_status': 'normal',
'type': 'eth',
'logical_type': '',
'logical_type': 'management',
'speed': 10000000000,
'max_speed': 10000000000,
'native_parent_id': 'spa',
'wwn': '',
'mac_address': '00:50:56:81:E5:05',
'ipv4': None,
'ipv4_mask': None,
'ipv4': '192.168.3.111',
'ipv4_mask': '255.255.255.0',
'ipv6': None,
'ipv6_mask': None
}, {
Expand Down Expand Up @@ -954,7 +954,7 @@
{
"content": {
"id": "fs_22",
"type": 1,
"type": 2,
"flrVersion": 0,
"supportedProtocols": 2,
"health": {
Expand Down Expand Up @@ -1050,18 +1050,6 @@
'free_capacity': 3746258944,
'worm': 'non_worm',
'security_mode': 'native'
}, {
'name': 'FS_MULTI1',
'storage_id': '12345',
'native_filesystem_id': 'fs_22',
'native_pool_id': 'pool_1',
'status': 'normal',
'type': 'thin',
'total_capacity': 107374182400,
'used_capacity': 1620303872,
'free_capacity': 105753878528,
'worm': 'non_worm',
'security_mode': 'native'
}
]
GET_ALL_QTREE = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import time
from unittest import TestCase, mock

import six
from oslo_log import log
from oslo_utils import units

from delfin.common import constants
from delfin.drivers.pure.flasharray import consts
Expand Down Expand Up @@ -1777,13 +1775,10 @@ def test_list_masking_views(self):
def test_collect_perf_metrics(self):
RestHandler.rest_call = mock.Mock(
side_effect=[storage_id_info, drive_metrics])
localtime = time.mktime(time.localtime()) * units.k
storage_id = 12345
start_time = localtime - 1000 * 60 * 60 * 24 * 364
end_time = localtime
metrics = self.driver.collect_perf_metrics(
context, storage_id, storage_resource_metrics, start_time,
end_time)
context, storage_id, storage_resource_metrics, 1619257043000,
1653385043000)
storage_metrics = [
constants.metric_struct(
name='iops',
Expand Down Expand Up @@ -1968,8 +1963,8 @@ def test_collect_perf_metrics(self):
RestHandler.rest_call = mock.Mock(
side_effect=[volume_metrics_info])
metrics = self.driver.collect_perf_metrics(
context, storage_id, volume_resource_metrics, start_time,
end_time)
context, storage_id, volume_resource_metrics, 1619257043000,
1653385043000)
self.assertListEqual(metrics, volume_metrics)

def test_get_capabilities(self):
Expand Down