weizhouapache commented on a change in pull request #5506:
URL: https://github.com/apache/cloudstack/pull/5506#discussion_r797331404



##########
File path: 
plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux/KVMHostInfo.java
##########
@@ -80,13 +82,23 @@ public long getOverCommitMemory() {
     }
 
     protected static long getCpuSpeed(final NodeInfo nodeInfo) {
-        try (Reader reader = new FileReader(cpuInfoMaxFreqFileName)) {
-            Long cpuInfoMaxFreq = 
Long.parseLong(IOUtils.toString(reader).trim());
-            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 {

Review comment:
       agree with @ravening 




-- 
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]


Reply via email to