From 3fd92502bb31ebd247b48ea746f5b970c064e437 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Fri, 9 Jul 2021 15:11:30 +0530 Subject: [PATCH] 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) --- .../main/java/com/cloud/vm/VirtualMachineManagerImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java index 0cb766e7b6e..9ec5779790a 100755 --- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java @@ -881,8 +881,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac } if (state != State.Stopped) { - s_logger.debug("VM " + vm + " is not in a state to be started: " + state); - return null; + String msg = String.format("Cannot start %s in %s state", vm, state); + s_logger.warn(msg); + throw new CloudRuntimeException(msg); } }