Skip to content

Commit dc17cb7

Browse files
code improvements
1 parent 68694c4 commit dc17cb7

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,13 @@ protected Long restart(final HaWorkVO work) {
645645
boolean isHostRemoved = false;
646646
if (host == null) {
647647
host = _hostDao.findByIdIncludingRemoved(work.getHostId());
648-
if (host != null) {
649-
logger.debug("VM {} is now no longer on host {} as the host is removed", vm, host);
650-
isHostRemoved = true;
648+
if (host == null) {
649+
logger.debug("VM {} is now no longer on host {}, the host doesn't exist", vm, work.getHostId());
650+
return null;
651651
}
652+
653+
logger.debug("VM {} is now no longer on host {} as the host is removed", vm, host);
654+
isHostRemoved = true;
652655
}
653656

654657
DataCenterVO dcVO = _dcDao.findById(host.getDataCenterId());
@@ -749,7 +752,7 @@ protected Long restart(final HaWorkVO work) {
749752
return null; // VM doesn't require HA
750753
}
751754

752-
if ((host == null || host.getRemoved() != null || host.getState() != Status.Up)
755+
if ((host.getRemoved() != null || host.getState() != Status.Up)
753756
&& !volumeMgr.canVmRestartOnAnotherServer(vm.getId())) {
754757
if (logger.isDebugEnabled()) {
755758
logger.debug("VM {} can not restart on another server.", vm);

0 commit comments

Comments
 (0)