Skip to content

Commit

Permalink
Merge branch 'master' into hpe_3par_20221028
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanyu-ghca authored Oct 28, 2022
2 parents dff317c + ddcdd27 commit e54f68c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
15 changes: 8 additions & 7 deletions delfin/drivers/hitachi/vsp/rest_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ def get_token(self):

def login(self):
try:
succeed = False
succeed = self.get_device_id()
return succeed
self.get_device_id()
except Exception as e:
LOG.error("Login error: %s", six.text_type(e))
raise e
Expand Down Expand Up @@ -170,13 +168,14 @@ def logout(self):

def get_device_id(self):
try:
succeed = False
if self.session is None:
self.init_http_head()
storage_systems = self.get_system_info()
system_info = storage_systems.get('data')
for system in system_info:
succeed = True
self.storage_device_id = system.get('storageDeviceId')
self.device_model = system.get('model')
self.serial_number = system.get('serialNumber')
if system.get('svpIp'):
if system.get('svpIp') == self.rest_host:
self.storage_device_id = system.get('storageDeviceId')
Expand All @@ -190,8 +189,10 @@ def get_device_id(self):
self.serial_number = system.get('serialNumber')
break
if self.storage_device_id is None:
LOG.error("Get device id fail,model or something is wrong")
return succeed
error_msg = f'Get device id fail,' \
f'system info:{storage_systems}'
LOG.error(error_msg)
raise exception.StorageBackendException(error_msg)
except Exception as e:
LOG.error("Get device id error: %s", six.text_type(e))
raise e
Expand Down
31 changes: 21 additions & 10 deletions delfin/drivers/ibm/storwize_svc/ssh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ class SSHHandler(object):
'fc': constants.DiskPhysicalType.FC,
'sas_direct': constants.DiskPhysicalType.SAS
}
DISK_STATUS_MAP = {
'online': constants.DiskStatus.NORMAL,
'offline': constants.DiskStatus.OFFLINE,
'excluded': constants.DiskStatus.ABNORMAL,
'degraded_paths': constants.DiskStatus.DEGRADED,
'degraded_ports': constants.DiskStatus.DEGRADED,
'degraded': constants.DiskStatus.DEGRADED
}
VOLUME_PERF_METRICS = {
'readIops': 'ro',
'writeIops': 'wo',
Expand Down Expand Up @@ -280,6 +288,9 @@ def get_storage(self):
'total_mdisk_capacity'))
subscribed_capacity = self.parse_string(storage_map.get(
'virtual_capacity'))
total_capacity = int(free_capacity + used_capacity)
if total_capacity > raw_capacity:
raw_capacity = total_capacity
firmware_version = ''
if storage_map.get('code_level') is not None:
firmware_version = storage_map.get('code_level').split(' ')[0]
Expand All @@ -291,7 +302,7 @@ def get_storage(self):
'serial_number': serial_number,
'firmware_version': firmware_version,
'location': location,
'total_capacity': int(free_capacity + used_capacity),
'total_capacity': total_capacity,
'raw_capacity': int(raw_capacity),
'subscribed_capacity': int(subscribed_capacity),
'used_capacity': int(used_capacity),
Expand Down Expand Up @@ -544,9 +555,8 @@ def list_disks(self, storage_id):
deltail_info = self.exec_ssh_command(detail_command)
disk_map = {}
self.handle_detail(deltail_info, disk_map, split=' ')
status = constants.DiskStatus.NORMAL
if disk_map.get('status') == 'offline':
status = constants.DiskStatus.OFFLINE
status = SSHHandler.DISK_STATUS_MAP.get(
disk_map.get('status'), constants.DiskStatus.ABNORMAL)
physical_type = SSHHandler.DISK_PHYSICAL_TYPE.get(
disk_map.get('fabric_type'),
constants.DiskPhysicalType.UNKNOWN)
Expand Down Expand Up @@ -806,8 +816,9 @@ def count_metric_data(last_data, now_data, interval, target, metric_type,
value = value / interval / units.Mi
elif 'IOSIZE' in metric_type.upper():
value = value / units.Ki
elif 'IOPS' in metric_type.upper() or 'RESPONSETIME' \
in metric_type.upper():
elif 'IOPS' in metric_type.upper():
value = int(value / interval)
elif 'RESPONSETIME' in metric_type.upper():
value = value / interval
value = round(value, 3)
if metric_map.get(res_id):
Expand Down Expand Up @@ -929,12 +940,12 @@ def package_xml_data(file_data, file_time, resource_type):
rht = 0
wht = 0
if resource_type == constants.ResourceType.PORT:
rb = int(file_data.get('cbr')) + int(file_data.get('hbr')) + int(
rb = (int(file_data.get('cbr')) + int(file_data.get('hbr')) + int(
file_data.get('lnbr')) + int(
file_data.get('rmbr')) * SSHHandler.BYTES_TO_BIT
wb = int(file_data.get('cbt')) + int(file_data.get('hbt')) + int(
file_data.get('rmbr'))) * SSHHandler.BYTES_TO_BIT
wb = (int(file_data.get('cbt')) + int(file_data.get('hbt')) + int(
file_data.get('lnbt')) + int(
file_data.get('rmbt')) * SSHHandler.BYTES_TO_BIT
file_data.get('rmbt'))) * SSHHandler.BYTES_TO_BIT
ro = int(file_data.get('cer')) + int(file_data.get('her')) + int(
file_data.get('lner')) + int(file_data.get('rmer'))
wo = int(file_data.get('cet')) + int(file_data.get('het')) + int(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def __init__(self):
'firmware_version': '7.4.0.11',
'location': 'local',
'total_capacity': 8961019766374,
'raw_capacity': 8906044184985,
'raw_capacity': 8961019766374,
'subscribed_capacity': 0,
'used_capacity': 5552533720268,
'free_capacity': 3408486046105
Expand Down

0 comments on commit e54f68c

Please sign in to comment.