mirror of https://github.com/apache/cloudstack.git
Bug:6510 add VM state check
This commit is contained in:
parent
4a3954690a
commit
4503222409
|
|
@ -299,6 +299,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
throw new InvalidParameterValueException("Fail to reset password for the virtual machine, the template is not password enabled");
|
||||
}
|
||||
|
||||
if (userVm.getState() == State.Error || userVm.getState() == State.Expunging) {
|
||||
s_logger.error("vm is not in the right state: " + vmId);
|
||||
throw new InvalidParameterValueException("Vm with id " + vmId + " is not in the right state");
|
||||
}
|
||||
|
||||
userId = accountAndUserValidation(vmId, account, userId, userVm);
|
||||
|
||||
boolean result = resetVMPasswordInternal(cmd, password);
|
||||
|
|
@ -1571,6 +1576,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
if (vm == null) {
|
||||
throw new CloudRuntimeException("Unable to find virual machine with id " + id);
|
||||
}
|
||||
|
||||
if (vm.getState() == State.Error || vm.getState() == State.Expunging) {
|
||||
s_logger.error("vm is not in the right state: " + id);
|
||||
throw new InvalidParameterValueException("Vm with id " + id + " is not in the right state");
|
||||
}
|
||||
|
||||
String description = "";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue