Search in sources :

Example 1 with StorageProviderResponse

use of com.cloud.api.response.StorageProviderResponse in project cosmic by MissionCriticalCloud.

the class ListStorageProvidersCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
    if (getType() == null) {
        throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "need to specify type: either primary or image");
    }
    final List<StorageProviderResponse> providers = this.dataStoreProviderApiService.getDataStoreProviders(getType());
    final ListResponse<StorageProviderResponse> responses = new ListResponse<>();
    for (final StorageProviderResponse provider : providers) {
        provider.setObjectName("dataStoreProvider");
    }
    responses.setResponses(providers);
    responses.setResponseName(this.getCommandName());
    this.setResponseObject(responses);
}
Also used : ServerApiException(com.cloud.api.ServerApiException) ListResponse(com.cloud.api.response.ListResponse) StorageProviderResponse(com.cloud.api.response.StorageProviderResponse)

Example 2 with StorageProviderResponse

use of com.cloud.api.response.StorageProviderResponse in project cosmic by MissionCriticalCloud.

the class DataStoreProviderManagerImpl method getPrimaryDataStoreProviders.

public List<StorageProviderResponse> getPrimaryDataStoreProviders() {
    final List<StorageProviderResponse> providers = new ArrayList<>();
    for (final DataStoreProvider provider : providerMap.values()) {
        if (provider.getTypes().contains(DataStoreProviderType.PRIMARY)) {
            final StorageProviderResponse response = new StorageProviderResponse();
            response.setName(provider.getName());
            response.setType(DataStoreProvider.DataStoreProviderType.PRIMARY.toString());
            providers.add(response);
        }
    }
    return providers;
}
Also used : StorageProviderResponse(com.cloud.api.response.StorageProviderResponse) DataStoreProvider(com.cloud.engine.subsystem.api.storage.DataStoreProvider) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Example 3 with StorageProviderResponse

use of com.cloud.api.response.StorageProviderResponse in project cosmic by MissionCriticalCloud.

the class DataStoreProviderManagerImpl method getImageDataStoreProviders.

public List<StorageProviderResponse> getImageDataStoreProviders() {
    final List<StorageProviderResponse> providers = new ArrayList<>();
    for (final DataStoreProvider provider : providerMap.values()) {
        if (provider.getTypes().contains(DataStoreProviderType.IMAGE)) {
            final StorageProviderResponse response = new StorageProviderResponse();
            response.setName(provider.getName());
            response.setType(DataStoreProvider.DataStoreProviderType.IMAGE.toString());
            providers.add(response);
        }
    }
    return providers;
}
Also used : StorageProviderResponse(com.cloud.api.response.StorageProviderResponse) DataStoreProvider(com.cloud.engine.subsystem.api.storage.DataStoreProvider) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Example 4 with StorageProviderResponse

use of com.cloud.api.response.StorageProviderResponse in project cosmic by MissionCriticalCloud.

the class DataStoreProviderManagerImpl method getCacheDataStoreProviders.

public List<StorageProviderResponse> getCacheDataStoreProviders() {
    final List<StorageProviderResponse> providers = new ArrayList<>();
    for (final DataStoreProvider provider : providerMap.values()) {
        if (provider.getTypes().contains(DataStoreProviderType.ImageCache)) {
            final StorageProviderResponse response = new StorageProviderResponse();
            response.setName(provider.getName());
            response.setType(DataStoreProviderType.ImageCache.toString());
            providers.add(response);
        }
    }
    return providers;
}
Also used : StorageProviderResponse(com.cloud.api.response.StorageProviderResponse) DataStoreProvider(com.cloud.engine.subsystem.api.storage.DataStoreProvider) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Aggregations

StorageProviderResponse (com.cloud.api.response.StorageProviderResponse)4 DataStoreProvider (com.cloud.engine.subsystem.api.storage.DataStoreProvider)3 ArrayList (java.util.ArrayList)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 ServerApiException (com.cloud.api.ServerApiException)1 ListResponse (com.cloud.api.response.ListResponse)1