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



##########
File path: server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
##########
@@ -4935,9 +4935,17 @@ public void finalizeStop(VirtualMachineProfile profile, 
Answer answer) {
         boolean deployOnGivenHost = false;
         if (destinationHost != null) {
             s_logger.debug("Destination Host to deploy the VM is specified, 
specifying a deployment plan to deploy the VM");
-            plan = new DataCenterDeployment(vm.getDataCenterId(), 
destinationHost.getPodId(), destinationHost.getClusterId(), 
destinationHost.getId(), null, null);
-            if (!AllowDeployVmIfGivenHostFails.value()) {
-                deployOnGivenHost = true;
+            try {
+                checkVmDestinationServerCapacity(vm, destinationHost);
+                plan = new DataCenterDeployment(vm.getDataCenterId(), 
destinationHost.getPodId(), destinationHost.getClusterId(), 
destinationHost.getId(), null, null);
+                if (!AllowDeployVmIfGivenHostFails.value()) {
+                    deployOnGivenHost = true;
+                }
+            } catch (InvalidParameterValueException ex) {
+                s_logger.error("Cannot deploy the VM to specified host due to: 
" + ex.getMessage());

Review comment:
       We could pass the exception to the log.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to