Skip to content

Commit

Permalink
Fix vsp driver issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangyutan authored Nov 27, 2020
1 parent ae88070 commit deb23be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
11 changes: 4 additions & 7 deletions delfin/drivers/ibm/storwize_svc/ssh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def parse_alert(alert):
alert_model['alert_id'] = str(alert_id)
alert_model['alert_name'] = alert_name
alert_model['severity'] = severity
alert_model['category'] = 'Fault'
alert_model['category'] = constants.Category.FAULT
alert_model['type'] = constants.EventType.EQUIPMENT_ALARM
alert_model['sequence_number'] = SSHHandler. \
handle_split(alert.get(SSHHandler.OID_SEQ_NUMBER), '=', 1)
Expand Down Expand Up @@ -130,7 +130,7 @@ def do_exec(command_str, ssh):
raise exception.SSHConnectTimeout()
elif 'No authentication methods available' in err \
or 'Authentication failed' in err:
raise exception.SSHInvalidUsernameOrPassword()
raise exception.InvalidUsernameOrPassword()
elif 'not a valid RSA private key file' in err:
raise exception.InvalidPrivateKey()
else:
Expand Down Expand Up @@ -192,7 +192,7 @@ def get_storage(self):
raw_capacity = self.parse_string(storage_map.get(
'total_drive_raw_capacity'))
subscribed_capacity = self.parse_string(storage_map.get(
'total_allocated_extent_capacity'))
'virtual_capacity'))
s = {
'name': storage_map.get('name'),
'vendor': 'IBM',
Expand Down Expand Up @@ -248,8 +248,6 @@ def list_storage_pools(self, storage_id):
total_cap = self.parse_string(pool_map.get('capacity'))
free_cap = self.parse_string(pool_map.get('free_capacity'))
used_cap = self.parse_string(pool_map.get('used_capacity'))
subscribed_cap = self.parse_string(pool_map.
get('real_capacity'))
p = {
'name': pool_map.get('name'),
'storage_id': storage_id,
Expand All @@ -258,7 +256,6 @@ def list_storage_pools(self, storage_id):
'status': status,
'storage_type': constants.StorageType.BLOCK,
'total_capacity': int(total_cap),
'subscribed_capacity': int(subscribed_cap),
'used_capacity': int(used_cap),
'free_capacity': int(free_cap)
}
Expand Down Expand Up @@ -380,7 +377,7 @@ def list_alerts(self, query_para):
'alert_id': event_id,
'alert_name': alert_name,
'severity': severity,
'category': 'Fault',
'category': constants.Category.FAULT,
'type': 'EquipmentAlarm',
'sequence_number': alert_map.get('sequence_number'),
'occur_time': time_stamp,
Expand Down
3 changes: 2 additions & 1 deletion delfin/drivers/ibm/storwize_svc/storwize_svc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from delfin.drivers import driver
from delfin.drivers.ibm.storwize_svc import ssh_handler
from delfin.drivers.ibm.storwize_svc.ssh_handler import SSHHandler


class StorwizeSVCDriver(driver.StorageDriver):
Expand Down Expand Up @@ -46,7 +47,7 @@ def remove_trap_config(self, context, trap_config):

@staticmethod
def parse_alert(context, alert):
return ssh_handler.SSHHandler().parse_alert(alert)
return SSHHandler.parse_alert(alert)

def clear_alert(self, context, alert):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def test_ssh_pool_put(self):
ssh_pool.remove(ssh)

def test_parse_alert(self):
SSHHandler.parse_alert(trap_info)
self.driver.parse_alert(context, trap_info)

def test_reset_connection(self):
self.driver.reset_connection(context, **ACCESS_INFO)
Expand Down

0 comments on commit deb23be

Please sign in to comment.