Skip to content

Commit

Permalink
Merge pull request #960 from amanr032/rebase940
Browse files Browse the repository at this point in the history
svc 3par vnx controller add cpu count
  • Loading branch information
skdwriting authored Dec 19, 2022
2 parents f2553bd + 03d94dc commit 9e7404e
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 17 deletions.
7 changes: 5 additions & 2 deletions delfin/drivers/dell_emc/vnx/vnx_block/component_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,18 +306,21 @@ def list_controllers(self, storage_id):
memory_size = int(controller.get('memory_size_for_the_sp',
'0')) * units.Mi
cpu_info = ''
cpu_count = None
if cpus:
cpu_info = cpus.get(
controller.get('serial_number_for_the_sp', ''), '')
if cpu_info:
cpu_count = 1
controller_model = {
'name': controller.get('sp_name'),
'storage_id': storage_id,
'native_controller_id': controller.get('signature_for_the_sp'),
'status': constants.ControllerStatus.NORMAL,
'location': None,
'soft_version': controller.get(
'revision_number_for_the_sp'),
'soft_version': controller.get('revision_number_for_the_sp'),
'cpu_info': cpu_info,
'cpu_count': cpu_count,
'memory_size': str(memory_size)
}
controller_list.append(controller_model)
Expand Down
1 change: 1 addition & 0 deletions delfin/drivers/fujitsu/eternus/eternus_stor.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def list_controllers(self, context):
'location': controller.get('name'),
'soft_version': controller.get('Hard Revision'),
'cpu_info': controller.get('CPU Clock'),
'cpu_count': consts.DIGITAL_CONSTANT.ONE_INT,
'memory_size': str(int(
Tools.get_capacity_size(controller.get('Memory Size'))))
}
Expand Down
4 changes: 4 additions & 0 deletions delfin/drivers/hpe/hpe_3par/component_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,17 @@ def list_controllers(self, storage_id):
'0')) * units.Mi + int(
controller.get('datamem(mb)', '0')) * units.Mi
cpu_info = ''
cpu_count = None
if node_cpu_map and node_cpu_map.get(node_id):
cpu_count = 0
cpu_info_map = node_cpu_map.get(node_id)
cpu_info_keys = list(cpu_info_map.keys())
for cpu_key in cpu_info_keys:
if cpu_info:
cpu_info = '%s%s' % (cpu_info, ',')
cpu_info = '%s%s * %s MHz' % (
cpu_info, cpu_info_map.get(cpu_key), cpu_key)
cpu_count += cpu_info_map.get(cpu_key)
soft_version = None
if node_version_map:
soft_version = node_version_map.get(node_id, '')
Expand All @@ -254,6 +257,7 @@ def list_controllers(self, storage_id):
'location': None,
'soft_version': soft_version,
'cpu_info': cpu_info,
'cpu_count': cpu_count,
'memory_size': str(memory_size)
}
controller_list.append(controller_model)
Expand Down
4 changes: 2 additions & 2 deletions delfin/drivers/hpe/hpe_3par/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@
'0x0a50001': 'File Access Auditing Alerts'
}
NODE_PATTERN = "^\\s*Node\\s+[-]*Name[-]*\\s+[-]*State[-]*\\s+"
CPU_PATTERN = "^\\s*Node\\s+CPU\\s+[-]*Manufacturer[-]*\\s+[-]*Serial[-]*" \
"\\s+CPUSpeed"
CPU_PATTERN = "^\\s*Node\\s+CPU"

DISK_PATTERN = "^\\s*Id\\s+[-]*CagePos[-]*\\s+[-]*Type[-]*\\s+RPM\\s+State\\s+"
DISK_I_PATTERN = "^\\s*Id\\s+[-]*CagePos[-]*\\s+[-]*State[-]*\\s+" \
"[-]*Node_WWN[-]*\\s+[-]*MFR[-]*\\s+[-]*Model[-]*\\s+" \
Expand Down
25 changes: 14 additions & 11 deletions delfin/drivers/hpe/hpe_3par/ssh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class SSHHandler(object):
HPE3PAR_COMMAND_SHOWVV = 'showvv'
HPE3PAR_COMMAND_SHOWVLUN_T = 'showvlun -t'

HPE3PAR_COMMAND_SHOWVV = 'showvv'
HPE3PAR_COMMAND_SRSTATPORT = 'srstatport -attime -groupby ' \
'PORT_N,PORT_S,PORT_P -btsecs %d -etsecs %d'
HPE3PAR_COMMAND_SRSTATPD = 'srstatpd -attime -btsecs %d -etsecs %d'
Expand Down Expand Up @@ -355,6 +354,7 @@ def parse_datas_to_list(self, resource_info, pattern_str, para_map=None):

def parse_datas_to_map(self, resource_info, pattern_str, para_map=None):
obj_model = {}
titles = []
titles_size = 9999
try:
pattern = re.compile(pattern_str)
Expand All @@ -374,7 +374,8 @@ def parse_datas_to_map(self, resource_info, pattern_str, para_map=None):
obj_model = self.parse_node_cpu(cols_size,
titles_size,
str_info,
obj_model)
obj_model,
titles)
else:
if cols_size >= titles_size:
key_position = para_map.get('key_position')
Expand Down Expand Up @@ -421,17 +422,19 @@ def parse_node_table(self, cols_size, titles_size, str_info, obj_list,
obj_list.append(obj_model)
return obj_list

def parse_node_cpu(self, cols_size, titles_size, str_info, obj_map):
def parse_node_cpu(self, cols_size, titles_size, str_info, obj_map,
titles):
if cols_size >= titles_size:
node_id = str_info[0]
cpu_info = str_info[4]
if obj_map.get(node_id):
obj_map[node_id][cpu_info] = obj_map.get(node_id).get(
cpu_info, 0) + 1
if 'Cores' in titles:
node_id = str_info[0]
cpu_info = ' '.join(str_info[5:])
cpu_map = obj_map.setdefault(node_id, {})
cpu_map[cpu_info] = int(str_info[2])
else:
cpu_info_map = {}
cpu_info_map[cpu_info] = 1
obj_map[node_id] = cpu_info_map
node_id = str_info[0]
cpu_info = str_info[4]
cpu_map = obj_map.setdefault(node_id, {})
cpu_map[cpu_info] = cpu_map.get(cpu_info, 0) + 1
return obj_map

def parse_metric_table(self, cols_size, titles_size, str_info,
Expand Down
4 changes: 4 additions & 0 deletions delfin/drivers/hpe/hpe_msa/ssh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ def list_storage_controller(self, storage_id):
if health == 'OK':
status = constants.StoragePoolStatus.NORMAL
cpu_info = data.get('sc-cpu-type')
cpu_count = None
if cpu_info:
cpu_count = 1
memory_size = data.get('system-memory-size')
if memory_size is not None:
memory_size += "MB"
Expand All @@ -213,6 +216,7 @@ def list_storage_controller(self, storage_id):
'location': data.get('position'),
'soft_version': data.get('sc-fw'),
'cpu_info': cpu_info,
'cpu_count': cpu_count,
'memory_size': int(system_memory_size)
}
controller_arr.append(data_map)
Expand Down
4 changes: 3 additions & 1 deletion delfin/drivers/ibm/storwize_svc/ssh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ def list_controllers(self, storage_id):
cpu_info = self.exec_ssh_command(cpu_cmd)
self.handle_detail(cpu_info, cpu_map, split=',')
cpu_actual = cpu_map.get('cpu_actual')
cpu_count = cpu_map.get('cpu_count')
status = SSHHandler.CONTRL_STATUS_MAP.get(
control_map.get('status'),
constants.ControllerStatus.UNKNOWN)
Expand All @@ -530,7 +531,8 @@ def list_controllers(self, storage_id):
'soft_version':
control_map.get('code_level', '').split(' ')[0],
'location': control_map.get('name'),
'cpu_info': cpu_actual
'cpu_info': cpu_actual,
'cpu_count': int(cpu_count)
}
controller_list.append(controller_result)
return controller_list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@
'location': None,
'soft_version': '05.33.000.5.038',
'cpu_info': 'JFSP 1.8GHZ 4C CPU GEN3',
'cpu_count': 1,
'memory_size': '17179869184'
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ def __init__(self):
'location': 'CM#0',
'soft_version': 'AA',
'cpu_info': '1.40GHz',
'cpu_count': 1,
'memory_size': '4294967296'
}]
POOL_RESULT = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,7 @@ def __init__(self):
'location': None,
'soft_version': '3.2.2.204',
'cpu_info': '4 * 2327 MHz',
'cpu_count': 4,
'memory_size': '10737418240'
}]
DISK_RESULT = [
Expand Down
4 changes: 4 additions & 0 deletions delfin/tests/unit/drivers/hpe/hpe_msa/test_constans.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<PROPERTY name="system-memory-size">6144</PROPERTY>
<PROPERTY name="sc-fw">GLS210R04-01</PROPERTY>
<PROPERTY name="sc-cpu-type">Gladden</PROPERTY>
<PROPERTY name="cpu_count">1</PROPERTY>
<PROPERTY name="health">OK</PROPERTY>
<PROPERTY name="position">Top</PROPERTY>
</OBJECT>
Expand All @@ -22,6 +23,7 @@
<PROPERTY name="system-memory-size">6144</PROPERTY>
<PROPERTY name="sc-fw">GLS210R04-01</PROPERTY>
<PROPERTY name="sc-cpu-type">Gladden</PROPERTY>
<PROPERTY name="cpu_count">1</PROPERTY>
<PROPERTY name="health">OK</PROPERTY>
<PROPERTY name="position">Bottom</PROPERTY>
</OBJECT>
Expand Down Expand Up @@ -1114,6 +1116,7 @@
'location': 'Top',
'soft_version': 'GLS210R04-01',
'cpu_info': 'Gladden',
'cpu_count': 1,
'memory_size': 6442450944
},
{
Expand All @@ -1124,6 +1127,7 @@
'location': 'Bottom',
'soft_version': 'GLS210R04-01',
'cpu_info': 'Gladden',
'cpu_count': 1,
'memory_size': 6442450944
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,8 @@ def __init__(self):
'status': 'normal',
'soft_version': '7.8.1.11',
'location': 'node_165084',
'cpu_info': '6 core Intel(R) Xeon(R) CPU E5645 @ 2.40GHz'
'cpu_info': '6 core Intel(R) Xeon(R) CPU E5645 @ 2.40GHz',
'cpu_count': 1
}
]

Expand Down

0 comments on commit 9e7404e

Please sign in to comment.