Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
18 changes: 11 additions & 7 deletions delfin/drivers/ibm/storwize_svc/ssh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ def list_controllers(self, storage_id):
deltail_info = self.exec_ssh_command(detail_command)
control_map = {}
self.handle_detail(deltail_info, control_map, split=' ')
cpu_map = {}
cpu_cmd = 'lsnodehw -delim , %s' % control_id
cpu_info = self.exec_ssh_command(cpu_cmd)
if 'command not found' in cpu_info:
cpu_cmd = 'lsnodecanisterhw -delim , %s' % control_id
cpu_info = self.exec_ssh_command(cpu_cmd)
self.handle_detail(cpu_info, cpu_map, split=',')
cpu_actual = cpu_map.get('cpu_actual')
status = SSHHandler.CONTRL_STATUS_MAP.get(
control_map.get('status'),
constants.ControllerStatus.UNKNOWN)
Expand All @@ -510,7 +518,8 @@ def list_controllers(self, storage_id):
'status': status,
'soft_version':
control_map.get('code_level', '').split(' ')[0],
'location': control_map.get('name')
'location': control_map.get('name'),
'cpu_info': cpu_actual
}
controller_list.append(controller_result)
return controller_list
Expand Down Expand Up @@ -817,12 +826,7 @@ def count_metric_data(last_data, now_data, interval, target, metric_type,

@staticmethod
def count_difference(now_value, last_value):
value = 0
if now_value >= last_value:
value = now_value - last_value
else:
value = now_value
return value
return now_value if now_value < last_value else now_value - last_value

@staticmethod
def handle_volume_cach_hit(now_data, last_data):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,14 +486,48 @@ def __init__(self):
serial_number 75PVZNA
machine_signature 0214-784E-C029-0147
"""

get_controller_cpu = """id,2
name,node_165084
status,online
IO_group_id,0
IO_group_name,io_grp0
hardware,CG8
actual_different,no
actual_valid,yes
memory_configured,24
memory_actual,24
memory_valid,yes
cpu_count,1
cpu_socket,1
cpu_configured,6 core Intel(R) Xeon(R) CPU E5645 @ 2.40GHz
cpu_actual,6 core Intel(R) Xeon(R) CPU E5645 @ 2.40GHz
cpu_valid,yes
adapter_count,3
adapter_location,1
adapter_configured,Four port 8Gb/s FC adapter
adapter_actual,Four port 8Gb/s FC adapter
adapter_valid,yes
adapter_location,0
adapter_configured,Two port 1Gb/s Ethernet adapter
adapter_actual,Two port 1Gb/s Ethernet adapter
adapter_valid,yes
adapter_location,2
adapter_configured,none
adapter_actual,none
adapter_valid,yes
ports_different,no
"""

controller_result = [
{
'name': 'node_165084',
'storage_id': '12345',
'native_controller_id': '2',
'status': 'normal',
'soft_version': '7.8.1.11',
'location': 'node_165084'
'location': 'node_165084',
'cpu_info': '6 core Intel(R) Xeon(R) CPU E5645 @ 2.40GHz'
}
]

Expand Down Expand Up @@ -1553,7 +1587,8 @@ def test_clear_alert(self):
@mock.patch.object(SSHPool, 'get')
def test_list_controllers(self, mock_ssh_get, mock_control):
mock_ssh_get.return_value = {paramiko.SSHClient()}
mock_control.side_effect = [get_all_controllers, get_single_controller]
mock_control.side_effect = [get_all_controllers, get_single_controller,
get_controller_cpu]
controller = self.driver.list_controllers(context)
self.assertEqual(controller, controller_result)

Expand Down