1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

M #-: Fix CPU capacity

For some versions of lscpu scaling is also returned in the form:

CPU(s):                          8
CPU(s) scaling MHz:              55%

So /CPU\(s\)/ matches both lines and the TOTAL_CPU value is not properly
computed
This commit is contained in:
Ruben S. Montero 2022-09-23 00:25:45 +02:00
parent e31c5deec0
commit 62c265b502
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -44,7 +44,7 @@ class LinuxHost
@net = {}
cpuinfo.split(/\n/).each do |line|
if line =~ /^CPU\(s\)/
if line =~ /^CPU\(s\):/
@cpu[:total] = line.split(':')[1].strip.to_i * 100
elsif line =~ /^CPU MHz:/
@cpu[:speed] = Float(line.split(':')[1].strip.split(' ')[0]).round