use of com.cloud.legacymodel.exceptions.OperationTimedoutException in project cosmic by MissionCriticalCloud.
the class ManagementServerImpl method stopSystemVM.
@Override
@ActionEvent(eventType = "", eventDescription = "", async = true)
public VMInstanceVO stopSystemVM(final StopSystemVmCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException {
final Long id = cmd.getId();
// verify parameters
final VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(id, VirtualMachineType.ConsoleProxy, VirtualMachineType.SecondaryStorageVm);
if (systemVm == null) {
final InvalidParameterValueException ex = new InvalidParameterValueException("unable to find a system vm with specified vmId");
ex.addProxyObject(id.toString(), "vmId");
throw ex;
}
try {
if (systemVm.getType() == VirtualMachineType.ConsoleProxy) {
ActionEventUtils.startNestedActionEvent(EventTypes.EVENT_PROXY_STOP, "stopping console proxy Vm");
return stopConsoleProxy(systemVm, cmd.isForced());
} else if (systemVm.getType() == VirtualMachineType.SecondaryStorageVm) {
ActionEventUtils.startNestedActionEvent(EventTypes.EVENT_SSVM_STOP, "stopping secondary storage Vm");
return stopSecondaryStorageVm(systemVm, cmd.isForced());
}
return null;
} catch (final OperationTimedoutException e) {
throw new CloudRuntimeException("Unable to stop " + systemVm, e);
}
}
use of com.cloud.legacymodel.exceptions.OperationTimedoutException in project cosmic by MissionCriticalCloud.
the class AccountManagerImpl method doDisableAccount.
private boolean doDisableAccount(final long accountId) throws ConcurrentOperationException, ResourceUnavailableException {
final List<VMInstanceVO> vms = _vmDao.listByAccountId(accountId);
boolean success = true;
for (final VMInstanceVO vm : vms) {
try {
try {
_itMgr.advanceStop(vm.getUuid(), false);
} catch (final OperationTimedoutException ote) {
s_logger.warn("Operation for stopping vm timed out, unable to stop vm " + vm.getHostName(), ote);
success = false;
}
} catch (final AgentUnavailableException aue) {
s_logger.warn("Agent running on host " + vm.getHostId() + " is unavailable, unable to stop vm " + vm.getHostName(), aue);
success = false;
}
}
return success;
}
Aggregations