Search in sources :

Example 31 with DataStoreProvider

use of org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider in project cloudstack by apache.

the class DataStoreProviderManagerImpl method getCacheDataStoreProviders.

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

Example 32 with DataStoreProvider

use of org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider in project cloudstack by apache.

the class DataStoreProviderManagerImpl method getPrimaryDataStoreProviders.

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

Example 33 with DataStoreProvider

use of org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider in project cloudstack by apache.

the class PrimaryDataStoreProviderManagerImpl method getPrimaryDataStore.

@Override
public PrimaryDataStore getPrimaryDataStore(long dataStoreId) {
    StoragePoolVO dataStoreVO = dataStoreDao.findByIdIncludingRemoved(dataStoreId);
    if (dataStoreVO == null) {
        throw new CloudRuntimeException("Unable to locate datastore with id " + dataStoreId);
    }
    String providerName = dataStoreVO.getStorageProviderName();
    DataStoreProvider provider = providerManager.getDataStoreProvider(providerName);
    PrimaryDataStoreImpl dataStore = PrimaryDataStoreImpl.createDataStore(dataStoreVO, driverMaps.get(provider.getName()), provider);
    return dataStore;
}
Also used : CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) PrimaryDataStoreImpl(org.apache.cloudstack.storage.datastore.PrimaryDataStoreImpl) DataStoreProvider(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider) StoragePoolVO(org.apache.cloudstack.storage.datastore.db.StoragePoolVO)

Aggregations

DataStoreProvider (org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider)33 DataStoreLifeCycle (org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle)15 DataStore (org.apache.cloudstack.engine.subsystem.api.storage.DataStore)13 PrimaryDataStoreLifeCycle (org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle)12 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)10 HashMap (java.util.HashMap)10 DataStoreDriver (org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver)10 PrimaryDataStoreDriver (org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver)10 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)9 StoragePoolVO (org.apache.cloudstack.storage.datastore.db.StoragePoolVO)9 URISyntaxException (java.net.URISyntaxException)6 ExecutionException (java.util.concurrent.ExecutionException)6 DataCenterVO (com.cloud.dc.DataCenterVO)5 StorageUnavailableException (com.cloud.exception.StorageUnavailableException)5 ArrayList (java.util.ArrayList)5 AgentUnavailableException (com.cloud.exception.AgentUnavailableException)4 ConnectionException (com.cloud.exception.ConnectionException)4 DiscoveryException (com.cloud.exception.DiscoveryException)4 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)4 OperationTimedoutException (com.cloud.exception.OperationTimedoutException)4