Search in sources :

Example 41 with OperationTimedoutException

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);
    }
}
Also used : OperationTimedoutException(com.cloud.legacymodel.exceptions.OperationTimedoutException) InvalidParameterValueException(com.cloud.legacymodel.exceptions.InvalidParameterValueException) CloudRuntimeException(com.cloud.legacymodel.exceptions.CloudRuntimeException) VMInstanceVO(com.cloud.vm.VMInstanceVO) ActionEvent(com.cloud.event.ActionEvent)

Example 42 with OperationTimedoutException

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;
}
Also used : OperationTimedoutException(com.cloud.legacymodel.exceptions.OperationTimedoutException) AgentUnavailableException(com.cloud.legacymodel.exceptions.AgentUnavailableException) VMInstanceVO(com.cloud.vm.VMInstanceVO)

Aggregations

OperationTimedoutException (com.cloud.legacymodel.exceptions.OperationTimedoutException)42 AgentUnavailableException (com.cloud.legacymodel.exceptions.AgentUnavailableException)32 CloudRuntimeException (com.cloud.legacymodel.exceptions.CloudRuntimeException)24 Answer (com.cloud.legacymodel.communication.answer.Answer)16 HostVO (com.cloud.host.HostVO)14 ResourceUnavailableException (com.cloud.legacymodel.exceptions.ResourceUnavailableException)12 AgentControlAnswer (com.cloud.legacymodel.communication.answer.AgentControlAnswer)10 UnPlugNicAnswer (com.cloud.legacymodel.communication.answer.UnPlugNicAnswer)9 ConcurrentOperationException (com.cloud.legacymodel.exceptions.ConcurrentOperationException)9 NoTransitionException (com.cloud.legacymodel.exceptions.NoTransitionException)9 CheckVirtualMachineAnswer (com.cloud.legacymodel.communication.answer.CheckVirtualMachineAnswer)8 PlugNicAnswer (com.cloud.legacymodel.communication.answer.PlugNicAnswer)8 RestoreVMSnapshotAnswer (com.cloud.legacymodel.communication.answer.RestoreVMSnapshotAnswer)8 StartAnswer (com.cloud.legacymodel.communication.answer.StartAnswer)8 Commands (com.cloud.agent.manager.Commands)7 ClusterVMMetaDataSyncAnswer (com.cloud.legacymodel.communication.answer.ClusterVMMetaDataSyncAnswer)7 RebootAnswer (com.cloud.legacymodel.communication.answer.RebootAnswer)7 StopAnswer (com.cloud.legacymodel.communication.answer.StopAnswer)7 Host (com.cloud.legacymodel.dc.Host)6 VolumeObjectTO (com.cloud.legacymodel.to.VolumeObjectTO)6