Skip to content

Commit ad0870f

Browse files
committed
Fix str conversion
1 parent dd35b7a commit ad0870f

File tree

1 file changed

+1
-1
lines changed
  • plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux

1 file changed

+1
-1
lines changed

plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux/KVMHostInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected static long getCpuSpeed(final NodeInfo nodeInfo) {
9292
cpuInfoMaxFreqFileName), e);
9393
String command = "lscpu | grep -i 'Model name' | head -n 1 | egrep -o '[[:digit:]].[[:digit:]]+GHz' | sed 's/GHz//g'";
9494
String result = Script.runSimpleBashScript(command);
95-
return Long.parseLong(result) * 1000;
95+
return (long) (Float.parseFloat(result) * 1000);
9696
} catch (NullPointerException | NumberFormatException ex) {
9797
LOGGER.error(String.format("Unable to retrieve the CPU speed from file [%s] and lscpu. Using the value [%s] provided by the Libvirt.", cpuInfoMaxFreqFileName, nodeInfo.mhz), ex);
9898
return nodeInfo.mhz;

0 commit comments

Comments
 (0)