JoaoJandre commented on code in PR #6845:
URL: https://github.com/apache/cloudstack/pull/6845#discussion_r1044535277


##########
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java:
##########
@@ -406,7 +408,10 @@ public DeployDestination 
planDeployment(VirtualMachineProfile vmProfile, Deploym
             planner = getDeploymentPlannerByName(plannerName);
         }
 
-        if (vm.getLastHostId() != null && haVmTag == null) {
+        String considerLastHostStr = 
(String)vmProfile.getParameter(VirtualMachineProfile.Param.ConsiderLastHost);
+        boolean considerLastHost = vm.getLastHostId() != null && haVmTag == 
null &&
+                (considerLastHostStr == null || 
Boolean.TRUE.toString().equalsIgnoreCase(considerLastHostStr));

Review Comment:
   ```suggestion
           boolean considerLastHost = vm.getLastHostId() != null && haVmTag == 
null &&
                   
Boolean.TRUE.toString().equalsIgnoreCase(considerLastHostStr);
   ```
   I think we should maintain the current default behavior. That is, if this 
parameter is not informed, the considerLastHost should be false.



##########
api/src/main/java/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java:
##########
@@ -82,6 +82,13 @@ public class StartVMCmd extends BaseAsyncCmd implements 
UserCmd {
                since = "3.0.1")
     private Long hostId;
 
+    @Parameter(name = ApiConstants.CONSIDER_LAST_HOST,
+            type = CommandType.BOOLEAN,
+            description = "True by default, CloudStack will firstly try to 
start the VM on the last host where it run on before stopping, if destination 
host is not specified. " +
+                    "If false, CloudStack will not consider the last host and 
start the VM by normal process.",
+            since = "4.18.0")
+    private Boolean considerLastHost;

Review Comment:
   The default value should be false, to maintain current behavior.



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