Search in sources :

Example 1 with UnmanageVMInstanceResponse

use of org.apache.cloudstack.api.response.UnmanageVMInstanceResponse in project cloudstack by apache.

the class UnmanageVMInstanceCmd method execute.

// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
    UnmanageVMInstanceResponse response = new UnmanageVMInstanceResponse();
    try {
        CallContext.current().setEventDetails("VM ID = " + vmId);
        boolean result = unmanagedVMsManager.unmanageVMInstance(vmId);
        response.setSuccess(result);
        if (result) {
            response.setDetails("VM unmanaged successfully");
        }
    } catch (Exception e) {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
    }
    response.setResponseName(getCommandName());
    response.setObjectName(getCommandName());
    this.setResponseObject(response);
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) UnmanageVMInstanceResponse(org.apache.cloudstack.api.response.UnmanageVMInstanceResponse) NetworkRuleConflictException(com.cloud.exception.NetworkRuleConflictException) ServerApiException(org.apache.cloudstack.api.ServerApiException) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) ResourceAllocationException(com.cloud.exception.ResourceAllocationException) ConcurrentOperationException(com.cloud.exception.ConcurrentOperationException) InsufficientCapacityException(com.cloud.exception.InsufficientCapacityException)

Aggregations

ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)1 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)1 NetworkRuleConflictException (com.cloud.exception.NetworkRuleConflictException)1 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)1 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)1 ServerApiException (org.apache.cloudstack.api.ServerApiException)1 UnmanageVMInstanceResponse (org.apache.cloudstack.api.response.UnmanageVMInstanceResponse)1