File tree Expand file tree Collapse file tree
kvmagent/kvmagent/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1253,10 +1253,9 @@ def fact(self, req):
12531253 host_cpu_model_name = host_cpu_info [0 ]
12541254 rsp .hostCpuModelName = host_cpu_model_name
12551255
1256- cpuMHz = shell .call ("lscpu | awk '/CPU MHz/{ print $NF }'" )
1257- # in case lscpu doesn't show cpu max mhz
1258- cpuMHz = "2500.0000" if cpuMHz .strip () == '' else cpuMHz
1259- rsp .cpuGHz = '%.2f' % (float (cpuMHz ) / 1000 )
1256+ transient_cpuGHz = '%.2f' % (float (host_cpu_info [1 ]) / 1000 )
1257+ static_cpuGHz_re = re .search ('[0-9.]*GHz' , host_cpu_model_name )
1258+ rsp .cpuGHz = static_cpuGHz_re .group (0 )[:- 3 ] if static_cpuGHz_re else transient_cpuGHz
12601259
12611260 cpu_cores_per_socket = shell .call ("lscpu | awk -F':' '/per socket/{print $NF}'" )
12621261 # On openeuler, lscpu otuputs 'per cluster' instead of 'per socket'
You can’t perform that action at this time.
0 commit comments