use of org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope in project cloudstack by apache.
the class S3TemplateTest method copyTemplateToCache.
@Test(priority = 2)
public void copyTemplateToCache() {
TemplateInfo template = templateFactory.getTemplate(templateId, DataStoreRole.Image);
DataObject cacheObj = this.cacheMgr.createCacheObject(template, new ZoneScope(dcId));
assertNotNull(cacheObj, "failed to create cache object");
}
use of org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope in project cloudstack by apache.
the class PrimaryDataStoreImpl method getScope.
@Override
public Scope getScope() {
StoragePoolVO vo = dataStoreDao.findById(pdsv.getId());
if (vo.getScope() == ScopeType.CLUSTER) {
return new ClusterScope(vo.getClusterId(), vo.getPodId(), vo.getDataCenterId());
} else if (vo.getScope() == ScopeType.ZONE) {
return new ZoneScope(vo.getDataCenterId());
} else if (vo.getScope() == ScopeType.HOST) {
List<StoragePoolHostVO> poolHosts = poolHostDao.listByPoolId(vo.getId());
if (poolHosts.size() > 0) {
return new HostScope(poolHosts.get(0).getHostId(), vo.getClusterId(), vo.getDataCenterId());
}
s_logger.debug("can't find a local storage in pool host table: " + vo.getId());
}
return null;
}
use of org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope in project cloudstack by apache.
the class TemplateDataStoreDaoImpl method findByTemplateZoneReady.
@Override
public TemplateDataStoreVO findByTemplateZoneReady(long templateId, Long zoneId) {
List<DataStore> imgStores = null;
imgStores = _storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
if (imgStores != null) {
Collections.shuffle(imgStores);
for (DataStore store : imgStores) {
List<TemplateDataStoreVO> sRes = listByTemplateStoreStatus(templateId, store.getId(), State.Ready);
if (sRes != null && sRes.size() > 0) {
return sRes.get(0);
}
}
}
return null;
}
Aggregations