nvazquez commented on code in PR #12062:
URL: https://github.com/apache/cloudstack/pull/12062#discussion_r2527599189
##########
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java:
##########
@@ -456,6 +448,31 @@ public DeployDestination
planDeployment(VirtualMachineProfile vmProfile, Deploym
return dest;
}
+ private Host checkDeployInVmLastHost(VirtualMachineProfile vmProfile,
VirtualMachine vm) {
+ String considerLastHostStr =
(String)vmProfile.getParameter(VirtualMachineProfile.Param.ConsiderLastHost);
+ String haVmTag =
(String)vmProfile.getParameter(VirtualMachineProfile.Param.HaTag);
+ boolean considerLastHost = vm.getLastHostId() != null && haVmTag ==
null &&
+ (considerLastHostStr == null ||
Boolean.TRUE.toString().equalsIgnoreCase(considerLastHostStr));
Review Comment:
Hi @sureshanaparti I'm not clear why the first part of this OR operator
would make it consider the last host. I would assume if the ConsiderLastHost
parameter is not set that this evaluates to false?
##########
server/src/main/java/com/cloud/deploy/DeploymentPlanningManagerImpl.java:
##########
@@ -456,6 +448,31 @@ public DeployDestination
planDeployment(VirtualMachineProfile vmProfile, Deploym
return dest;
}
+ private Host checkDeployInVmLastHost(VirtualMachineProfile vmProfile,
VirtualMachine vm) {
+ String considerLastHostStr =
(String)vmProfile.getParameter(VirtualMachineProfile.Param.ConsiderLastHost);
+ String haVmTag =
(String)vmProfile.getParameter(VirtualMachineProfile.Param.HaTag);
+ boolean considerLastHost = vm.getLastHostId() != null && haVmTag ==
null &&
+ (considerLastHostStr == null ||
Boolean.TRUE.toString().equalsIgnoreCase(considerLastHostStr));
+ if (!considerLastHost) {
+ return null;
+ }
+
+ logger.debug("This VM has last host_id: {}", vm.getLastHostId());
+ HostVO lastHost = _hostDao.findById(vm.getLastHostId());
+ if (lastHost == null) {
+ logger.debug("Unable to deploy VM {} in the last host, last host
doesn't exist", vm.getName());
+ return null;
+ }
+
+ logger.debug("VM's last host is {}, trying to choose the same host if
it is not in maintenance state", lastHost);
+ if (lastHost.isInMaintenanceStates()) {
Review Comment:
Probably checking other states as well? Or migrating only to enabled and
running hosts?
--
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]