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)
This commit is contained in:
Pearl Dsilva 2021-07-09 15:11:30 +05:30 committed by GitHub
parent f7cc3c9316
commit 3fd92502bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}
}