Search in sources :

Example 1 with DataStoreDriver

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

the class CapacityManagerImpl method getUsedBytes.

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

Example 2 with DataStoreDriver

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

the class QueryManagerImpl method searchForStoragePools.

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

Example 3 with DataStoreDriver

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

the class StorageManagerImpl method getDataObjectSizeIncludingHypervisorSnapshotReserve.

private long getDataObjectSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool pool) {
    DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName());
    DataStoreDriver storeDriver = storeProvider.getDataStoreDriver();
    if (storeDriver instanceof PrimaryDataStoreDriver) {
        PrimaryDataStoreDriver primaryStoreDriver = (PrimaryDataStoreDriver) storeDriver;
        VolumeInfo volumeInfo = volFactory.getVolume(volume.getId());
        return primaryStoreDriver.getDataObjectSizeIncludingHypervisorSnapshotReserve(volumeInfo, pool);
    }
    return volume.getSize();
}
Also used : PrimaryDataStoreDriver(org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver) DataStoreProvider(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider) PrimaryDataStoreDriver(org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver) DataStoreDriver(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver) VolumeInfo(org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo)

Example 4 with DataStoreDriver

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

the class CapacityManagerImpl method getUsedIops.

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

Example 5 with DataStoreDriver

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

the class StorageManagerImpl method getBytesRequiredForTemplate.

private long getBytesRequiredForTemplate(VMTemplateVO tmpl, StoragePool pool) {
    DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(pool.getStorageProviderName());
    DataStoreDriver storeDriver = storeProvider.getDataStoreDriver();
    if (storeDriver instanceof PrimaryDataStoreDriver) {
        PrimaryDataStoreDriver primaryStoreDriver = (PrimaryDataStoreDriver) storeDriver;
        TemplateInfo templateInfo = tmplFactory.getReadyTemplateOnImageStore(tmpl.getId(), pool.getDataCenterId());
        return primaryStoreDriver.getBytesRequiredForTemplate(templateInfo, pool);
    }
    return tmpl.getSize();
}
Also used : TemplateInfo(org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo) PrimaryDataStoreDriver(org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver) DataStoreProvider(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider) PrimaryDataStoreDriver(org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver) DataStoreDriver(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver)

Aggregations

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