diff --git a/src/onedb/fsck.rb b/src/onedb/fsck.rb index ae6f6a9f0f..00a8ee8ede 100644 --- a/src/onedb/fsck.rb +++ b/src/onedb/fsck.rb @@ -22,7 +22,7 @@ require 'set' require 'nokogiri' module OneDBFsck - VERSION = "4.5.0" + VERSION = "4.5.80" def db_version VERSION @@ -1368,7 +1368,7 @@ module OneDBFsck oid = doc.root.at_xpath("ID").text.to_i # VM quotas - cpu_used = 0.0 + cpu_used = 0 mem_used = 0 vms_used = 0 vol_used = 0 @@ -1385,9 +1385,8 @@ module OneDBFsck # VM quotas vmdoc.root.xpath("TEMPLATE/CPU").each { |e| # truncate to 2 decimals - cpu = (e.text.to_f * 100).to_i / 100.0 + cpu = (e.text.to_f * 100).to_i cpu_used += cpu - cpu_used = (cpu_used * 100).to_i / 100.0 } vmdoc.root.xpath("TEMPLATE/MEMORY").each { |e| @@ -1457,6 +1456,8 @@ module OneDBFsck # Check if the float value or the string representation mismatch, # but ignoring the precision + cpu_used = (cpu_used / 100.0) + different = ( e.text.to_f != cpu_used || ![sprintf('%.2f', cpu_used), sprintf('%.1f', cpu_used), sprintf('%.0f', cpu_used)].include?(e.text) )