本文整理了Java中org.apache.cloudstack.engine.subsystem.api.storage.DataStore.getScope()
方法的一些代码示例,展示了DataStore.getScope()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataStore.getScope()
方法的具体详情如下:
包路径:org.apache.cloudstack.engine.subsystem.api.storage.DataStore
类名称:DataStore
方法名:getScope
暂无
代码示例来源:origin: apache/cloudstack
@Override
public boolean isRegionStore(DataStore store) {
if (store.getScope().getScopeType() == ScopeType.ZONE && store.getScope().getScopeId() == null)
return true;
else
return false;
}
代码示例来源:origin: apache/cloudstack
protected EndPoint findEndpointForPrimaryStorage(DataStore store) {
return findEndPointInScope(store.getScope(), findOneHostOnPrimaryStorage, store.getId());
}
代码示例来源:origin: apache/cloudstack
protected EndPoint findEndpointForImageStorage(DataStore store) {
Long dcId = null;
Scope storeScope = store.getScope();
if (storeScope.getScopeType() == ScopeType.ZONE) {
dcId = storeScope.getScopeId();
}
// find ssvm that can be used to download data to store. For zone-wide
// image store, use SSVM for that zone. For region-wide store,
// we can arbitrarily pick one ssvm to do that task
List<HostVO> ssAHosts = listUpAndConnectingSecondaryStorageVmHost(dcId);
if (ssAHosts == null || ssAHosts.isEmpty()) {
return null;
}
Collections.shuffle(ssAHosts);
HostVO host = ssAHosts.get(0);
return RemoteHostEndPoint.getHypervisorHostEndPoint(host);
}
代码示例来源:origin: apache/cloudstack
private Scope pickCacheScopeForCopy(DataObject srcData, DataObject destData) {
Scope srcScope = srcData.getDataStore().getScope();
Scope destScope = destData.getDataStore().getScope();
Scope selectedScope = null;
if (srcScope.getScopeId() != null) {
selectedScope = getZoneScope(srcScope);
} else if (destScope.getScopeId() != null) {
selectedScope = getZoneScope(destScope);
} else {
s_logger.warn("Cannot find a zone-wide scope for movement that needs a cache storage");
}
return selectedScope;
}
代码示例来源:origin: apache/cloudstack
private Scope pickCacheScopeForCopy(DataObject srcData, DataObject destData) {
Scope srcScope = srcData.getDataStore().getScope();
Scope destScope = destData.getDataStore().getScope();
Scope selectedScope = null;
if (srcScope.getScopeId() != null) {
selectedScope = getZoneScope(srcScope);
} else if (destScope.getScopeId() != null) {
selectedScope = getZoneScope(destScope);
} else {
LOGGER.warn("Cannot find a zone-wide scope for movement that needs a cache storage");
}
return selectedScope;
}
代码示例来源:origin: apache/cloudstack
@Override
public EndPoint select(DataObject object) {
DataStore store = object.getDataStore();
EndPoint ep = select(store);
if (ep != null) {
return ep;
}
if (object instanceof TemplateInfo) {
TemplateInfo tmplInfo = (TemplateInfo)object;
if (store.getScope().getScopeType() == ScopeType.ZONE && store.getScope().getScopeId() == null && tmplInfo.getTemplateType() == TemplateType.SYSTEM) {
return LocalHostEndpoint.getEndpoint(); // for bootstrap system vm template downloading to region image store
}
}
return null;
}
代码示例来源:origin: apache/cloudstack
@Override
public List<EndPoint> selectAll(DataStore store) {
List<EndPoint> endPoints = new ArrayList<EndPoint>();
if (store.getScope().getScopeType() == ScopeType.HOST) {
HostVO host = hostDao.findById(store.getScope().getScopeId());
endPoints.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host));
} else if (store.getScope().getScopeType() == ScopeType.CLUSTER) {
QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
sc.and(sc.entity().getClusterId(), Op.EQ, store.getScope().getScopeId());
sc.and(sc.entity().getStatus(), Op.EQ, Status.Up);
List<HostVO> hosts = sc.list();
for (HostVO host : hosts) {
endPoints.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host));
}
} else {
throw new CloudRuntimeException("shouldn't use it for other scope");
}
return endPoints;
}
}
代码示例来源:origin: apache/cloudstack
@Override
public void downloadBootstrapSysTemplate(DataStore store) {
Set<VMTemplateVO> toBeDownloaded = new HashSet();
List<VMTemplateVO> rtngTmplts = _templateDao.listAllSystemVMTemplates();
for (VMTemplateVO rtngTmplt : rtngTmplts) {
toBeDownloaded.add(rtngTmplt);
}
List<HypervisorType> availHypers = _clusterDao.getAvailableHypervisorInZone(store.getScope().getScopeId());
if (availHypers.isEmpty()) {
/*
* This is for cloudzone, local secondary storage resource started
* before cluster created
*/
availHypers.add(HypervisorType.KVM);
}
/* Baremetal need not to download any template */
availHypers.remove(HypervisorType.BareMetal);
availHypers.add(HypervisorType.None); // bug 9809: resume ISO
// download.
for (VMTemplateVO template : toBeDownloaded) {
if (availHypers.contains(template.getHypervisorType())) {
// only download sys template applicable for current hypervisor
TemplateDataStoreVO tmpltHost = _vmTemplateStoreDao.findByStoreTemplate(store.getId(), template.getId());
if (tmpltHost == null || tmpltHost.getState() != ObjectInDataStoreStateMachine.State.Ready) {
TemplateInfo tmplt = _templateFactory.getTemplate(template.getId(), DataStoreRole.Image);
createTemplateAsync(tmplt, store, null);
}
}
}
}
代码示例来源:origin: apache/cloudstack
protected EndPoint findEndPointForImageMove(DataStore srcStore, DataStore destStore) {
// find any xenserver/kvm host in the scope
Scope srcScope = srcStore.getScope();
Scope destScope = destStore.getScope();
Scope selectedScope = null;
Long poolId = null;
// assumption, at least one of scope should be zone, find the least
// scope
if (srcScope.getScopeType() != ScopeType.ZONE) {
selectedScope = srcScope;
poolId = srcStore.getId();
} else if (destScope.getScopeType() != ScopeType.ZONE) {
selectedScope = destScope;
poolId = destStore.getId();
} else {
// if both are zone scope
if (srcStore.getRole() == DataStoreRole.Primary) {
selectedScope = srcScope;
poolId = srcStore.getId();
} else if (destStore.getRole() == DataStoreRole.Primary) {
selectedScope = destScope;
poolId = destStore.getId();
}
}
return findEndPointInScope(selectedScope, findOneHostOnPrimaryStorage, poolId);
}
代码示例来源:origin: apache/cloudstack
Long zoneId = imageStore.getScope().getScopeId();
if (zoneId != null) {
DataCenterVO zone = _dcDao.findById(zoneId);
代码示例来源:origin: apache/cloudstack
} else if (plan.getDataCenterId() == exstPoolDcId) {
DataStore dataStore = dataStoreMgr.getPrimaryDataStore(pool.getId());
if (dataStore != null && dataStore.getScope() != null && dataStore.getScope().getScopeType() == ScopeType.ZONE) {
canReusePool = true;
代码示例来源:origin: apache/cloudstack
needCache = true;
SnapshotInfo snapshot = (SnapshotInfo) srcData;
srcData = cacheSnapshotChain(snapshot, snapshot.getDataStore().getScope());
代码示例来源:origin: apache/cloudstack
Long zoneId_is = imageStore.getScope().getScopeId();
if (zoneId != null) {
DataCenterVO zone = _dcDao.findById(zoneId_is);
代码示例来源:origin: apache/cloudstack
int _copyvolumewait = NumbersUtil.parseInt(value, Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
Scope destScope = getZoneScope(destData.getDataStore().getScope());
DataStore cacheStore = cacheMgr.getCacheStorage(destScope);
if (cacheStore == null) {
代码示例来源:origin: apache/cloudstack
if (result.isSuccess()) {
if (imageStore.getScope().getScopeType() == ScopeType.REGION) {
associateTemplateToZone(templateId, null);
} else if (imageStore.getScope().getScopeType() == ScopeType.ZONE) {
Long zoneId = ((ImageStoreEntity)imageStore).getDataCenterId();
VMTemplateZoneVO templateZone = new VMTemplateZoneVO(zoneId, templateId, new Date());
代码示例来源:origin: apache/cloudstack
" at the end of registering template!");
Scope dsScope = ds.getScope();
if (dsScope.getScopeId() != null) {
UsageEventUtils.publishUsageEvent(etype, template.getAccountId(), dsScope.getScopeId(), template.getId(), template.getName(), null, null,
代码示例来源:origin: apache/cloudstack
DataStore storeForNewVol = dataStoreMgr.getPrimaryDataStore(newVolume.getPoolId());
Scope storeForExistingStoreScope = storeForExistingVol.getScope();
if (storeForExistingStoreScope == null) {
throw new CloudRuntimeException("Can't get scope of data store: " + storeForExistingVol.getId());
Scope storeForNewStoreScope = storeForNewVol.getScope();
if (storeForNewStoreScope == null) {
throw new CloudRuntimeException("Can't get scope of data store: " + storeForNewVol.getId());
代码示例来源:origin: apache/cloudstack
" at the end of registering template!");
Scope dsScope = ds.getScope();
if (dsScope.getScopeType() == ScopeType.ZONE) {
if (dsScope.getScopeId() != null) {
代码示例来源:origin: apache/cloudstack
@Override
public void createAsync(DataStore dataStore, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
Long maxTemplateSizeInBytes = getMaxTemplateSizeInBytes();
VirtualMachineTemplate tmpl = _templateDao.findById(data.getId());
DataStore cacheStore = cacheManager.getCacheStorage(dataStore.getScope());
DownloadCommand dcmd = new DownloadCommand((TemplateObjectTO)(data.getTO()), maxTemplateSizeInBytes);
dcmd.setCacheStore(cacheStore.getTO());
dcmd.setProxy(getHttpProxy());
EndPoint ep = _epSelector.select(data);
if (ep == null) {
String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
s_logger.error(errMsg);
throw new CloudRuntimeException(errMsg);
}
CreateContext<CreateCmdResult> context = new CreateContext<CreateCmdResult>(callback, data);
AsyncCallbackDispatcher<SwiftImageStoreDriverImpl, DownloadAnswer> caller = AsyncCallbackDispatcher.create(this);
caller.setContext(context);
if (data.getType() == DataObjectType.TEMPLATE) {
caller.setCallback(caller.getTarget().createTemplateAsyncCallback(null, null));
} else if (data.getType() == DataObjectType.VOLUME) {
caller.setCallback(caller.getTarget().createVolumeAsyncCallback(null, null));
}
ep.sendMessageAsync(dcmd, caller);
}
代码示例来源:origin: apache/cloudstack
s_logger.warn("No entry found in volume_store_ref for volume id: " + vo.getId() + " and image store id: " + ds.getId() + " at the end of uploading volume!");
Scope dsScope = ds.getScope();
if (dsScope.getScopeType() == ScopeType.ZONE) {
if (dsScope.getScopeId() != null) {
内容来源于网络,如有侵权,请联系作者删除!