Skip to content

Commit e26a127

Browse files
author
ye.tian
committed
Merge branch 'revert-50acd6b6' into '5.1.0'
Revert "Merge branch 'fix_64280' into '5.1.0'" See merge request zstackio/zstack-utility!4654
2 parents c0bf759 + a93e461 commit e26a127

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

kvmagent/kvmagent/plugins/host_plugin.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff 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'

0 commit comments

Comments
 (0)