Search in sources :

Example 1 with PowerOperation

use of org.apache.cloudstack.outofbandmanagement.OutOfBandManagement.PowerOperation in project cloudstack by apache.

the class IssueOutOfBandManagementPowerActionCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
    final Host host = _resourceService.getHost(getHostId());
    if (host == null) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find host by ID: " + getHostId());
    }
    final PowerOperation powerOperation = PowerOperation.valueOf(getPowerAction());
    CallContext.current().setEventDetails("Host Id: " + host.getId() + " Action: " + powerOperation.toString());
    CallContext.current().putContextParameter(Host.class, host.getUuid());
    final OutOfBandManagementResponse response = outOfBandManagementService.executeOutOfBandManagementPowerOperation(host, powerOperation, getActionTimeout());
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : OutOfBandManagementResponse(org.apache.cloudstack.api.response.OutOfBandManagementResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) Host(com.cloud.host.Host) PowerOperation(org.apache.cloudstack.outofbandmanagement.OutOfBandManagement.PowerOperation)

Aggregations

Host (com.cloud.host.Host)1 ServerApiException (org.apache.cloudstack.api.ServerApiException)1 OutOfBandManagementResponse (org.apache.cloudstack.api.response.OutOfBandManagementResponse)1 PowerOperation (org.apache.cloudstack.outofbandmanagement.OutOfBandManagement.PowerOperation)1