Search in sources :

Example 1 with DataStoreDriver

use of com.cloud.engine.subsystem.api.storage.DataStoreDriver in project cosmic by MissionCriticalCloud.

the class CapacityManagerImpl method getUsedBytes.

@Override
public long getUsedBytes(final StoragePoolVO pool) {
    final DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName());
    final DataStoreDriver storeDriver = storeProvider.getDataStoreDriver();
    if (storeDriver instanceof PrimaryDataStoreDriver) {
        final PrimaryDataStoreDriver primaryStoreDriver = (PrimaryDataStoreDriver) storeDriver;
        return primaryStoreDriver.getUsedBytes(pool);
    }
    throw new CloudRuntimeException("Storage driver in CapacityManagerImpl.getUsedBytes(StoragePoolVO) is not a PrimaryDataStoreDriver.");
}
Also used : PrimaryDataStoreDriver(com.cloud.engine.subsystem.api.storage.PrimaryDataStoreDriver) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) DataStoreProvider(com.cloud.engine.subsystem.api.storage.DataStoreProvider) DataStoreDriver(com.cloud.engine.subsystem.api.storage.DataStoreDriver) PrimaryDataStoreDriver(com.cloud.engine.subsystem.api.storage.PrimaryDataStoreDriver)

Example 2 with DataStoreDriver

use of com.cloud.engine.subsystem.api.storage.DataStoreDriver in project cosmic by MissionCriticalCloud.

the class CapacityManagerImpl method getUsedIops.

@Override
public long getUsedIops(final StoragePoolVO pool) {
    final DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName());
    final DataStoreDriver storeDriver = storeProvider.getDataStoreDriver();
    if (storeDriver instanceof PrimaryDataStoreDriver) {
        final PrimaryDataStoreDriver primaryStoreDriver = (PrimaryDataStoreDriver) storeDriver;
        return primaryStoreDriver.getUsedIops(pool);
    }
    throw new CloudRuntimeException("Storage driver in CapacityManagerImpl.getUsedIops(StoragePoolVO) is not a PrimaryDataStoreDriver.");
}
Also used : PrimaryDataStoreDriver(com.cloud.engine.subsystem.api.storage.PrimaryDataStoreDriver) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) DataStoreProvider(com.cloud.engine.subsystem.api.storage.DataStoreProvider) DataStoreDriver(com.cloud.engine.subsystem.api.storage.DataStoreDriver) PrimaryDataStoreDriver(com.cloud.engine.subsystem.api.storage.PrimaryDataStoreDriver)

Example 3 with DataStoreDriver

use of com.cloud.engine.subsystem.api.storage.DataStoreDriver in project cosmic by MissionCriticalCloud.

the class QueryManagerImpl method searchForStoragePools.

@Override
public ListResponse<StoragePoolResponse> searchForStoragePools(final ListStoragePoolsCmd cmd) {
    final Pair<List<StoragePoolJoinVO>, Integer> result = searchForStoragePoolsInternal(cmd);
    final ListResponse<StoragePoolResponse> response = new ListResponse<>();
    final List<StoragePoolResponse> poolResponses = ViewResponseHelper.createStoragePoolResponse(result.first().toArray(new StoragePoolJoinVO[result.first().size()]));
    for (final StoragePoolResponse poolResponse : poolResponses) {
        final DataStore store = dataStoreManager.getPrimaryDataStore(poolResponse.getId());
        if (store != null) {
            final DataStoreDriver driver = store.getDriver();
            if (driver != null && driver.getCapabilities() != null) {
                poolResponse.setCaps(driver.getCapabilities());
            }
        }
    }
    response.setResponses(poolResponses, result.second());
    return response;
}
Also used : StoragePoolResponse(com.cloud.api.response.StoragePoolResponse) ListResponse(com.cloud.api.response.ListResponse) DataStore(com.cloud.engine.subsystem.api.storage.DataStore) StoragePoolJoinVO(com.cloud.api.query.vo.StoragePoolJoinVO) DataStoreDriver(com.cloud.engine.subsystem.api.storage.DataStoreDriver) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with DataStoreDriver

use of com.cloud.engine.subsystem.api.storage.DataStoreDriver in project cosmic by MissionCriticalCloud.

the class QueryManagerImpl method searchForVolumes.

@Override
public ListResponse<VolumeResponse> searchForVolumes(final ListVolumesCmd cmd) {
    final Pair<List<VolumeJoinVO>, Integer> result = searchForVolumesInternal(cmd);
    final ListResponse<VolumeResponse> response = new ListResponse<>();
    ResponseView respView = ResponseView.Restricted;
    if (cmd instanceof ListVolumesCmdByAdmin) {
        respView = ResponseView.Full;
    }
    final List<VolumeResponse> volumeResponses = ViewResponseHelper.createVolumeResponse(respView, result.first().toArray(new VolumeJoinVO[result.first().size()]));
    for (final VolumeResponse vr : volumeResponses) {
        final String poolId = vr.getStoragePoolId();
        if (poolId == null) {
            continue;
        }
        final DataStore store = dataStoreManager.getPrimaryDataStore(poolId);
        if (store == null) {
            continue;
        }
        final DataStoreDriver driver = store.getDriver();
        if (driver == null) {
            continue;
        }
        final Map<String, String> caps = driver.getCapabilities();
        if (caps != null) {
            final boolean quiescevm = Boolean.parseBoolean(caps.get(DataStoreCapabilities.VOLUME_SNAPSHOT_QUIESCEVM.toString()));
            vr.setNeedQuiescevm(quiescevm);
        }
    }
    response.setResponses(volumeResponses, result.second());
    return response;
}
Also used : VolumeResponse(com.cloud.api.response.VolumeResponse) ListResponse(com.cloud.api.response.ListResponse) DataStoreDriver(com.cloud.engine.subsystem.api.storage.DataStoreDriver) ListVolumesCmdByAdmin(com.cloud.api.command.admin.volume.ListVolumesCmdByAdmin) ResponseView(com.cloud.api.ResponseObject.ResponseView) DataStore(com.cloud.engine.subsystem.api.storage.DataStore) ArrayList(java.util.ArrayList) List(java.util.List) VolumeJoinVO(com.cloud.api.query.vo.VolumeJoinVO)

Example 5 with DataStoreDriver

use of com.cloud.engine.subsystem.api.storage.DataStoreDriver in project cosmic by MissionCriticalCloud.

the class StorageManagerImpl method getVolumeSizeIncludingHypervisorSnapshotReserve.

private long getVolumeSizeIncludingHypervisorSnapshotReserve(final Volume volume, final StoragePool pool) {
    final DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName());
    final DataStoreDriver storeDriver = storeProvider.getDataStoreDriver();
    if (storeDriver instanceof PrimaryDataStoreDriver) {
        final PrimaryDataStoreDriver primaryStoreDriver = (PrimaryDataStoreDriver) storeDriver;
        return primaryStoreDriver.getVolumeSizeIncludingHypervisorSnapshotReserve(volume, pool);
    }
    return volume.getSize();
}
Also used : PrimaryDataStoreDriver(com.cloud.engine.subsystem.api.storage.PrimaryDataStoreDriver) DataStoreProvider(com.cloud.engine.subsystem.api.storage.DataStoreProvider) DataStoreDriver(com.cloud.engine.subsystem.api.storage.DataStoreDriver) PrimaryDataStoreDriver(com.cloud.engine.subsystem.api.storage.PrimaryDataStoreDriver)

Aggregations

DataStoreDriver (com.cloud.engine.subsystem.api.storage.DataStoreDriver)5 DataStoreProvider (com.cloud.engine.subsystem.api.storage.DataStoreProvider)3 PrimaryDataStoreDriver (com.cloud.engine.subsystem.api.storage.PrimaryDataStoreDriver)3 ListResponse (com.cloud.api.response.ListResponse)2 DataStore (com.cloud.engine.subsystem.api.storage.DataStore)2 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ResponseView (com.cloud.api.ResponseObject.ResponseView)1 ListVolumesCmdByAdmin (com.cloud.api.command.admin.volume.ListVolumesCmdByAdmin)1 StoragePoolJoinVO (com.cloud.api.query.vo.StoragePoolJoinVO)1 VolumeJoinVO (com.cloud.api.query.vo.VolumeJoinVO)1 StoragePoolResponse (com.cloud.api.response.StoragePoolResponse)1 VolumeResponse (com.cloud.api.response.VolumeResponse)1