Skip to content

Commit

Permalink
svc controller add cpu info
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjiangyu-ghca committed Jun 17, 2022
1 parent 5a55352 commit 40b771f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
11 changes: 10 additions & 1 deletion 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
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

0 comments on commit 40b771f

Please sign in to comment.