Github user koushik-das commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/656#discussion_r36168376 --- Diff: server/src/com/cloud/ha/HighAvailabilityManagerImpl.java --- @@ -261,25 +264,21 @@ public void scheduleRestartForVmsOnHost(final HostVO host, boolean investigate) // send an email alert that the host is down, include VMs HostPodVO podVO = _podDao.findById(host.getPodId()); String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); + _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host is down, " + hostDesc, + "Host [" + hostDesc + "] is down." + ((sb != null) ? sb.toString() : "")); - _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host is down, " + hostDesc, "Host [" + hostDesc + - "] is down." + - ((sb != null) ? sb.toString() : "")); - - if (vms != null) { - for (VMInstanceVO vm : vms) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Notifying HA Mgr of to restart vm " + vm.getId() + "-" + vm.getInstanceName()); - } - vm = _instanceDao.findByUuid(vm.getUuid()); - Long hostId = vm.getHostId(); - if (hostId != null && !hostId.equals(host.getId())) { - s_logger.debug("VM " + vm.getInstanceName() + " is not on down host " + host.getId() + " it is on other host " - + hostId + " VM HA is done"); - continue; - } - scheduleRestart(vm, investigate); + for (VMInstanceVO vm : reorderedVMList) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Notifying HA Mgr of to restart vm " + vm.getId() + "-" + vm.getInstanceName()); + } + vm = _instanceDao.findByUuid(vm.getUuid()); + Long hostId = vm.getHostId(); + if (hostId != null && !hostId.equals(host.getId())) { --- End diff -- @DaanHoogland The host check you are referring to existed even before this PR. One reason for the check is to ensure that the VM has not moved to another host since the time it was fetched using listByHostId(). If it has moved to another host (and vmsync has updated the host id) then no need to perform restart/HA.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---