rafaelweingartner commented on a change in pull request #2482: 
CLOUDSTACK-10321: CPU Cap for KVM
URL: https://github.com/apache/cloudstack/pull/2482#discussion_r173748358
 
 

 ##########
 File path: 
plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
 ##########
 @@ -1984,6 +1984,24 @@ protected String getUuid(String uuid) {
         return uuid;
     }
 
+    /**
+     * Set quota and period tags on 'ctd' when CPU limit use is set
+     */
+    protected void setQuotaAndPeriod(VirtualMachineTO vmTO, CpuTuneDef ctd) {
+        if (vmTO.getLimitCpuUse() && vmTO.getCpuQuotaPercentage() != null) {
+            Double cpuQuotaPercentage = vmTO.getCpuQuotaPercentage();
+            int period = CpuTuneDef.DEFAULT_PERIOD;
+            int quota = (int) (period * cpuQuotaPercentage);
+            if (quota < CpuTuneDef.MIN_QUOTA) {
+                quota = CpuTuneDef.MIN_QUOTA;
 
 Review comment:
   what about some logging and documentation explaining why and when this 
happen?
   
   The logginf to show this change is useful for operators to understand why 
the value they configure is not being used.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

Reply via email to