Skip to content

Commit 3fd9250

Browse files
authored
Prevent starting a VM in destroyed state (or any state but Stopped) (#5165)
* Prevent starting a VM in destroyed state (or any state but Stopped)
1 parent f7cc3c9 commit 3fd9250

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,8 +881,9 @@ public Ternary<VMInstanceVO, ReservationContext, ItWorkVO> doInTransaction(final
881881
}
882882

883883
if (state != State.Stopped) {
884-
s_logger.debug("VM " + vm + " is not in a state to be started: " + state);
885-
return null;
884+
String msg = String.format("Cannot start %s in %s state", vm, state);
885+
s_logger.warn(msg);
886+
throw new CloudRuntimeException(msg);
886887
}
887888
}
888889

0 commit comments

Comments
 (0)