Search in sources :

Example 1 with ListLunsCmdResponse

use of com.cloud.server.api.response.netapp.ListLunsCmdResponse in project cloudstack by apache.

the class ListLunsCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        List<LunVO> lunList = netappMgr.listLunsOnFiler(poolName);
        ListResponse<ListLunsCmdResponse> listResponse = new ListResponse<ListLunsCmdResponse>();
        List<ListLunsCmdResponse> responses = new ArrayList<ListLunsCmdResponse>();
        for (LunVO lun : lunList) {
            ListLunsCmdResponse response = new ListLunsCmdResponse();
            response.setId(lun.getId());
            response.setIqn(lun.getTargetIqn());
            response.setName(lun.getLunName());
            response.setVolumeId(lun.getVolumeId());
            response.setObjectName("lun");
            responses.add(response);
        }
        listResponse.setResponses(responses);
        listResponse.setResponseName(getCommandName());
        this.setResponseObject(listResponse);
    } catch (InvalidParameterValueException e) {
        throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
    }
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) ServerApiException(org.apache.cloudstack.api.ServerApiException) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) ListLunsCmdResponse(com.cloud.server.api.response.netapp.ListLunsCmdResponse) ArrayList(java.util.ArrayList) LunVO(com.cloud.netapp.LunVO)

Aggregations

InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)1 LunVO (com.cloud.netapp.LunVO)1 ListLunsCmdResponse (com.cloud.server.api.response.netapp.ListLunsCmdResponse)1 ArrayList (java.util.ArrayList)1 ServerApiException (org.apache.cloudstack.api.ServerApiException)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1