GutoVeronezi commented on a change in pull request #4958:
URL: https://github.com/apache/cloudstack/pull/4958#discussion_r622403770
##########
File path:
plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux/KVMHostInfo.java
##########
@@ -78,11 +80,12 @@ public long getOverCommitMemory() {
}
protected static long getCpuSpeed(final NodeInfo nodeInfo) {
- try (final Reader reader = new FileReader(
- "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq")) {
- return Long.parseLong(IOUtils.toString(reader).trim()) / 1000;
+ try (Reader reader = new FileReader(cpuInfoMaxFreqFileName)) {
+ Long cpuInfoMaxFreq =
Long.parseLong(IOUtils.toString(reader).trim());
+ LOGGER.info(String.format("Retrieved value [%s] from file [%s].
Using the value divided by 1000 [%s] as CPU speed value.", cpuInfoMaxFreq,
cpuInfoMaxFreqFileName, cpuInfoMaxFreq / 1000));
+ return cpuInfoMaxFreq / 1000;
} catch (IOException | NumberFormatException e) {
- LOGGER.info("Could not read cpuinfo_max_freq, falling back on
libvirt");
+ LOGGER.error(String.format("Unable to retrieve the CPU speed from
file [%s]. Using using the value [%s] provided by the Libvirt.",
cpuInfoMaxFreqFileName, nodeInfo.mhz), e);
Review comment:
@sureshanaparti done. Thanks!
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]