You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/03/12 13:01:31 UTC

[GitHub] nvazquez commented on a change in pull request #2482: CLOUDSTACK-10321: CPU Cap for KVM

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

 ##########
 File path: server/src/com/cloud/hypervisor/KVMGuru.java
 ##########
 @@ -52,10 +59,49 @@ protected KVMGuru() {
         super();
     }
 
+    /**
+     * Retrieve host max CPU speed
+     */
+    protected double getHostCPUSpeed(HostVO host) {
+        return host.getSpeed();
+    }
+
+    protected double getVmSpeed(VirtualMachineTO to) {
+        return to.getMaxSpeed() != null ? to.getMaxSpeed() : to.getSpeed();
+    }
+
+    /**
+    * Set VM CPU quota percentage with respect to host CPU on 'to' if CPU limit option is set
+    * @param to vm to
+    * @param vmProfile vm profile
+    */
+    protected void setVmQuotaPercentage(VirtualMachineTO to, VirtualMachineProfile vmProfile) {
+        if (to.getLimitCpuUse()) {
+            VirtualMachine vm = vmProfile.getVirtualMachine();
+            HostVO host = _hostDao.findById(vm.getHostId());
+            if (host == null) {
+                throw new CloudRuntimeException("Host with id: " + vm.getHostId() + " not found");
 
 Review comment:
   Agreed on the others below, but actually we won't have the host UUID at this point, only the ID reference on the VM. One way to get it could be to search host including the removed ones. Do you think we should do that?

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


With regards,
Apache Git Services