use of com.cloud.engine.subsystem.api.storage.DataStore in project cosmic by MissionCriticalCloud.
the class StorageCacheManagerImpl method getCacheStores.
protected List<DataStore> getCacheStores() {
final QueryBuilder<ImageStoreVO> sc = QueryBuilder.create(ImageStoreVO.class);
sc.and(sc.entity().getRole(), SearchCriteria.Op.EQ, DataStoreRole.ImageCache);
final List<ImageStoreVO> imageStoreVOs = sc.list();
final List<DataStore> stores = new ArrayList<>();
for (final ImageStoreVO vo : imageStoreVOs) {
stores.add(dataStoreManager.getDataStore(vo.getId(), vo.getRole()));
}
return stores;
}
use of com.cloud.engine.subsystem.api.storage.DataStore in project cosmic by MissionCriticalCloud.
the class AbstractHyperVisorStorageMotionStrategy method updateVolumePathsAfterMigration.
protected void updateVolumePathsAfterMigration(final Map<VolumeInfo, DataStore> volumeToPool, final List<VolumeObjectTO> volumeTos) {
for (final Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) {
boolean updated = false;
final VolumeInfo volume = entry.getKey();
final StoragePool pool = (StoragePool) entry.getValue();
for (final VolumeObjectTO volumeTo : volumeTos) {
if (volume.getId() == volumeTo.getId()) {
final VolumeVO volumeVO = volDao.findById(volume.getId());
final Long oldPoolId = volumeVO.getPoolId();
volumeVO.setPath(volumeTo.getPath());
volumeVO.setFolder(pool.getPath());
volumeVO.setPodId(pool.getPodId());
volumeVO.setPoolId(pool.getId());
volumeVO.setLastPoolId(oldPoolId);
volDao.update(volume.getId(), volumeVO);
updated = true;
break;
}
}
if (!updated) {
s_logger.error("Volume path wasn't updated for volume " + volume + " after it was migrated.");
}
}
}
use of com.cloud.engine.subsystem.api.storage.DataStore in project cosmic by MissionCriticalCloud.
the class AbstractHyperVisorStorageMotionStrategy method buildVolumeMapping.
protected List<Pair<VolumeTO, StorageFilerTO>> buildVolumeMapping(final Map<VolumeInfo, DataStore> volumeToPool) {
final List<Pair<VolumeTO, StorageFilerTO>> volumeToFilerto = new ArrayList<>();
for (final Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) {
final VolumeInfo volume = entry.getKey();
final VolumeTO volumeTo = new VolumeTO(volume, storagePoolDao.findById(volume.getPoolId()));
final StorageFilerTO filerTo = new StorageFilerTO((StoragePool) entry.getValue());
volumeToFilerto.add(new Pair<>(volumeTo, filerTo));
}
return volumeToFilerto;
}
use of com.cloud.engine.subsystem.api.storage.DataStore in project cosmic by MissionCriticalCloud.
the class AncientDataMotionStrategy method cacheSnapshotChain.
protected DataObject cacheSnapshotChain(SnapshotInfo snapshot, final Scope scope) {
DataObject leafData = null;
final DataStore store = cacheMgr.getCacheStorage(snapshot, scope);
while (snapshot != null) {
final DataObject cacheData = cacheMgr.createCacheObject(snapshot, store);
if (leafData == null) {
leafData = cacheData;
}
snapshot = snapshot.getParent();
}
return leafData;
}
use of com.cloud.engine.subsystem.api.storage.DataStore in project cosmic by MissionCriticalCloud.
the class TemplateDataFactoryImpl method listTemplateOnCache.
@Override
public List<TemplateInfo> listTemplateOnCache(final long templateId) {
final List<TemplateDataStoreVO> cacheTmpls = templateStoreDao.listOnCache(templateId);
final List<TemplateInfo> tmplObjs = new ArrayList<>();
for (final TemplateDataStoreVO cacheTmpl : cacheTmpls) {
final long storeId = cacheTmpl.getDataStoreId();
final DataStore store = storeMgr.getDataStore(storeId, DataStoreRole.ImageCache);
final TemplateInfo tmplObj = getTemplate(templateId, store);
tmplObjs.add(tmplObj);
}
return tmplObjs;
}
Aggregations