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 2021/08/24 05:11:29 UTC

[GitHub] [cloudstack] davidjumani commented on a change in pull request #5339: server: check server capacity when start/deploy or migrate a vm

davidjumani commented on a change in pull request #5339:
URL: https://github.com/apache/cloudstack/pull/5339#discussion_r694497464



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -5988,6 +5996,18 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr
         return findMigratedVm(vm.getId(), vm.getType());
     }
 
+    private void checkVmDestinationServerCapacity(VMInstanceVO vm, Host destinationHost) {
+        // check server capacity
+        ServiceOfferingVO offering = _offeringDao.findById(vm.getId(), vm.getServiceOfferingId());
+        boolean hostHasCapacity = _capacityMgr.checkIfHostHasCpuCapability(destinationHost.getId(), offering.getCpu(), offering.getSpeed())

Review comment:
       Would it be simpler to use `checkIfHostHasCpuCapabilityAndCapacity`




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org