Search in sources :

Example 21 with ServerApiException

use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.

the class AssociateLunCmd method execute.

@Override
public void execute() {
    try {
        AssociateLunCmdResponse response = new AssociateLunCmdResponse();
        String[] returnVals = null;
        returnVals = netappMgr.associateLun(getGuestIQN(), getLunName());
        response.setLun(returnVals[0]);
        response.setIpAddress(returnVals[2]);
        response.setTargetIQN(returnVals[1]);
        response.setObjectName("lun");
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } catch (ServerException e) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
    } catch (InvalidParameterValueException e) {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
    }
}
Also used : ServerException(java.rmi.ServerException) ServerApiException(org.apache.cloudstack.api.ServerApiException) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) AssociateLunCmdResponse(com.cloud.server.api.response.netapp.AssociateLunCmdResponse)

Example 22 with ServerApiException

use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.

the class DeleteVolumePoolCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        netappMgr.deletePool(poolName);
        DeleteVolumePoolCmdResponse response = new DeleteVolumePoolCmdResponse();
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } catch (InvalidParameterValueException e) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
    } catch (ResourceInUseException e) {
        throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString());
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) ResourceInUseException(com.cloud.exception.ResourceInUseException) DeleteVolumePoolCmdResponse(com.cloud.server.api.response.netapp.DeleteVolumePoolCmdResponse)

Example 23 with ServerApiException

use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.

the class DestroyVolumeOnFilerCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        netappMgr.destroyVolumeOnFiler(ipAddr, aggrName, volumeName);
        DeleteVolumeOnFilerCmdResponse response = new DeleteVolumeOnFilerCmdResponse();
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } catch (InvalidParameterValueException e) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
    } catch (ResourceInUseException e) {
        throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString());
    } catch (ServerException e) {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
    }
}
Also used : ServerException(java.rmi.ServerException) ServerApiException(org.apache.cloudstack.api.ServerApiException) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) DeleteVolumeOnFilerCmdResponse(com.cloud.server.api.response.netapp.DeleteVolumeOnFilerCmdResponse) ResourceInUseException(com.cloud.exception.ResourceInUseException)

Example 24 with ServerApiException

use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.

the class DissociateLunCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        netappMgr.disassociateLun(guestIQN, path);
        DissociateLunCmdResponse response = new DissociateLunCmdResponse();
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } catch (InvalidParameterValueException e) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
    } catch (ServerException e) {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
    }
}
Also used : ServerException(java.rmi.ServerException) ServerApiException(org.apache.cloudstack.api.ServerApiException) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) DissociateLunCmdResponse(com.cloud.server.api.response.netapp.DissociateLunCmdResponse)

Example 25 with ServerApiException

use of org.apache.cloudstack.api.ServerApiException in project cloudstack by apache.

the class ListDedicatedHostsCmd method execute.

@Override
public void execute() {
    Pair<List<? extends DedicatedResourceVO>, Integer> result = dedicatedService.listDedicatedHosts(this);
    ListResponse<DedicateHostResponse> response = new ListResponse<DedicateHostResponse>();
    List<DedicateHostResponse> Responses = new ArrayList<DedicateHostResponse>();
    if (result != null) {
        for (DedicatedResources resource : result.first()) {
            DedicateHostResponse hostResponse = dedicatedService.createDedicateHostResponse(resource);
            Responses.add(hostResponse);
        }
        response.setResponses(Responses, result.second());
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to list dedicated hosts");
    }
}
Also used : DedicateHostResponse(org.apache.cloudstack.api.response.DedicateHostResponse) ListResponse(org.apache.cloudstack.api.response.ListResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) DedicatedResources(com.cloud.dc.DedicatedResources) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) DedicatedResourceVO(com.cloud.dc.DedicatedResourceVO)

Aggregations

ServerApiException (org.apache.cloudstack.api.ServerApiException)628 SuccessResponse (org.apache.cloudstack.api.response.SuccessResponse)154 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)143 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)104 ArrayList (java.util.ArrayList)74 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)55 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)51 ListResponse (org.apache.cloudstack.api.response.ListResponse)49 ResourceAllocationException (com.cloud.exception.ResourceAllocationException)47 UserVm (com.cloud.uservm.UserVm)47 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)43 UserVmResponse (org.apache.cloudstack.api.response.UserVmResponse)42 Account (com.cloud.user.Account)32 Host (com.cloud.host.Host)30 NetworkRuleConflictException (com.cloud.exception.NetworkRuleConflictException)29 Volume (com.cloud.storage.Volume)25 Test (org.junit.Test)23 VolumeResponse (org.apache.cloudstack.api.response.VolumeResponse)20 VirtualMachineTemplate (com.cloud.template.VirtualMachineTemplate)15 UserAccount (com.cloud.user.UserAccount)15