rhtyd commented on a change in pull request #5506:
URL: https://github.com/apache/cloudstack/pull/5506#discussion_r715409750
##########
File path:
plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux/KVMHostInfo.java
##########
@@ -85,8 +87,18 @@ protected static long getCpuSpeed(final NodeInfo nodeInfo) {
LOGGER.info(String.format("Retrieved value [%s] from file [%s].
This corresponds to a CPU speed of [%s] MHz.", cpuInfoMaxFreq,
cpuInfoMaxFreqFileName, cpuInfoMaxFreq / 1000));
return cpuInfoMaxFreq / 1000;
} catch (IOException | NumberFormatException e) {
- LOGGER.error(String.format("Unable to retrieve the CPU speed from
file [%s]. Using the value [%s] provided by the Libvirt.",
cpuInfoMaxFreqFileName, nodeInfo.mhz), e);
- return nodeInfo.mhz;
+ try {
+ LOGGER.error(String.format("Unable to retrieve the CPU speed
from file [%s]. Trying to fetch it from lscpu",
+ cpuInfoMaxFreqFileName), e);
+ String command = "lscpu | grep -i 'Model name' | head -n 1 |
egrep -o '[[:digit:]].[[:digit:]]+GHz' | sed 's/GHz//g'";
Review comment:
@davidjumani I think standard way is to get from /proc/cpuinfo; `grep
"^[c]pu MHz" /proc/cpuinfo`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]