Search in sources :

Example 1 with ListVolumePoolsCmdResponse

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

the class ListVolumePoolsCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        List<PoolVO> poolList = netappMgr.listPools();
        ListResponse<ListVolumePoolsCmdResponse> listResponse = new ListResponse<ListVolumePoolsCmdResponse>();
        List<ListVolumePoolsCmdResponse> responses = new ArrayList<ListVolumePoolsCmdResponse>();
        for (PoolVO pool : poolList) {
            ListVolumePoolsCmdResponse response = new ListVolumePoolsCmdResponse();
            response.setId(pool.getId());
            response.setName(pool.getName());
            response.setAlgorithm(pool.getAlgorithm());
            response.setObjectName("pool");
            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) PoolVO(com.cloud.netapp.PoolVO) ListVolumePoolsCmdResponse(com.cloud.server.api.response.netapp.ListVolumePoolsCmdResponse) ArrayList(java.util.ArrayList)

Aggregations

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