GabrielBrascher commented on a change in pull request #4220:
URL: https://github.com/apache/cloudstack/pull/4220#discussion_r465263348



##########
File path: server/src/main/java/com/cloud/api/query/dao/HostJoinDaoImpl.java
##########
@@ -330,10 +330,10 @@ public HostForMigrationResponse 
newHostForMigrationResponse(HostJoinVO host, Enu
 
                 hostResponse.setHypervisorVersion(host.getHypervisorVersion());
 
-                Float cpuWithOverprovisioning = new Float(host.getCpus() * 
host.getSpeed() * ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId()));
-                String cpuAlloc = decimalFormat.format(((float)cpu / 
cpuWithOverprovisioning * 100f)).toString() + "%";
+                float cpuWithOverprovisioning = new Float(host.getCpus() * 
host.getSpeed() * ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId()));
+                String cpuAlloc = decimalFormat.format(((float)cpu / 
cpuWithOverprovisioning * 100f)) + "%";

Review comment:
       @ravening sorry for the delay. I think that I was clear about my point.
   
   - the method that you extract 
[L464](https://github.com/apache/cloudstack/blob/7febf17aa8c8ba6403deeb160a4af5f6dda5111c/server/src/main/java/com/cloud/api/query/dao/HostJoinDaoImpl.java#L464):
   `decimalFormat.format(((float)resource / resourceWithOverProvision * 
100.0f)) + "%"`
   
   - line 
[314](https://github.com/apache/cloudstack/blob/7febf17aa8c8ba6403deeb160a4af5f6dda5111c/server/src/main/java/com/cloud/api/query/dao/HostJoinDaoImpl.java#L314)
 that I mentioned:
   `decimalFormat.format((float) mem / memWithOverprovisioning * 100.0f) +"%"`
   
   That is why I thought that it could also benefit from 
`calculateResourceAllocatedPercentage`.
   




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to