Search in sources :

Example 1 with StorageNetworkIpRange

use of com.cloud.legacymodel.dc.StorageNetworkIpRange in project cosmic by MissionCriticalCloud.

the class CreateStorageNetworkIpRangeCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        final StorageNetworkIpRange result = _storageNetworkService.createIpRange(this);
        final StorageNetworkIpRangeResponse response = _responseGenerator.createStorageNetworkIpRangeResponse(result);
        response.setResponseName(getCommandName());
        setResponseObject(response);
    } catch (final Exception e) {
        s_logger.warn("Create storage network IP range failed", e);
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) StorageNetworkIpRange(com.cloud.legacymodel.dc.StorageNetworkIpRange) StorageNetworkIpRangeResponse(com.cloud.api.response.StorageNetworkIpRangeResponse) ServerApiException(com.cloud.api.ServerApiException) InsufficientCapacityException(com.cloud.legacymodel.exceptions.InsufficientCapacityException) ResourceUnavailableException(com.cloud.legacymodel.exceptions.ResourceUnavailableException) ConcurrentOperationException(com.cloud.legacymodel.exceptions.ConcurrentOperationException) ResourceAllocationException(com.cloud.legacymodel.exceptions.ResourceAllocationException)

Example 2 with StorageNetworkIpRange

use of com.cloud.legacymodel.dc.StorageNetworkIpRange in project cosmic by MissionCriticalCloud.

the class UpdateStorageNetworkIpRangeCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        final StorageNetworkIpRange result = _storageNetworkService.updateIpRange(this);
        final StorageNetworkIpRangeResponse response = _responseGenerator.createStorageNetworkIpRangeResponse(result);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } catch (final Exception e) {
        s_logger.warn("Update storage network IP range failed", e);
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
    }
}
Also used : ServerApiException(com.cloud.api.ServerApiException) StorageNetworkIpRange(com.cloud.legacymodel.dc.StorageNetworkIpRange) StorageNetworkIpRangeResponse(com.cloud.api.response.StorageNetworkIpRangeResponse) ServerApiException(com.cloud.api.ServerApiException) InsufficientCapacityException(com.cloud.legacymodel.exceptions.InsufficientCapacityException) ResourceUnavailableException(com.cloud.legacymodel.exceptions.ResourceUnavailableException) ConcurrentOperationException(com.cloud.legacymodel.exceptions.ConcurrentOperationException) ResourceAllocationException(com.cloud.legacymodel.exceptions.ResourceAllocationException)

Example 3 with StorageNetworkIpRange

use of com.cloud.legacymodel.dc.StorageNetworkIpRange in project cosmic by MissionCriticalCloud.

the class ListStorageNetworkIpRangeCmd method execute.

// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
    try {
        final List<StorageNetworkIpRange> results = _storageNetworkService.listIpRange(this);
        final ListResponse<StorageNetworkIpRangeResponse> response = new ListResponse<>();
        final List<StorageNetworkIpRangeResponse> resList = new ArrayList<>(results.size());
        for (final StorageNetworkIpRange r : results) {
            final StorageNetworkIpRangeResponse resp = _responseGenerator.createStorageNetworkIpRangeResponse(r);
            resList.add(resp);
        }
        response.setResponses(resList);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } catch (final Exception e) {
        s_logger.warn("Failed to list storage network ip range for rangeId=" + getRangeId() + " podId=" + getPodId() + " zoneId=" + getZoneId());
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
    }
}
Also used : ListResponse(com.cloud.api.response.ListResponse) ServerApiException(com.cloud.api.ServerApiException) StorageNetworkIpRange(com.cloud.legacymodel.dc.StorageNetworkIpRange) StorageNetworkIpRangeResponse(com.cloud.api.response.StorageNetworkIpRangeResponse) ArrayList(java.util.ArrayList) ServerApiException(com.cloud.api.ServerApiException) InsufficientCapacityException(com.cloud.legacymodel.exceptions.InsufficientCapacityException) ResourceUnavailableException(com.cloud.legacymodel.exceptions.ResourceUnavailableException) ConcurrentOperationException(com.cloud.legacymodel.exceptions.ConcurrentOperationException) ResourceAllocationException(com.cloud.legacymodel.exceptions.ResourceAllocationException)

Aggregations

ServerApiException (com.cloud.api.ServerApiException)3 StorageNetworkIpRangeResponse (com.cloud.api.response.StorageNetworkIpRangeResponse)3 StorageNetworkIpRange (com.cloud.legacymodel.dc.StorageNetworkIpRange)3 ConcurrentOperationException (com.cloud.legacymodel.exceptions.ConcurrentOperationException)3 InsufficientCapacityException (com.cloud.legacymodel.exceptions.InsufficientCapacityException)3 ResourceAllocationException (com.cloud.legacymodel.exceptions.ResourceAllocationException)3 ResourceUnavailableException (com.cloud.legacymodel.exceptions.ResourceUnavailableException)3 ListResponse (com.cloud.api.response.ListResponse)1 ArrayList (java.util.ArrayList)1