- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope
类的一些代码示例,展示了ZoneScope
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneScope
类的具体详情如下:
包路径:org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope
类名称:ZoneScope
暂无
代码示例来源:origin: apache/cloudstack
private Scope getZoneScope(Scope scope) {
ZoneScope zoneScope;
if (scope instanceof ClusterScope) {
ClusterScope clusterScope = (ClusterScope)scope;
zoneScope = new ZoneScope(clusterScope.getZoneId());
} else if (scope instanceof HostScope) {
HostScope hostScope = (HostScope)scope;
zoneScope = new ZoneScope(hostScope.getZoneId());
} else {
zoneScope = (ZoneScope)scope;
}
return zoneScope;
}
代码示例来源:origin: apache/cloudstack
@Override
public boolean attachZone(DataStore dataStore, ZoneScope scope, Hypervisor.HypervisorType hypervisorType) {
dataStoreHelper.attachZone(dataStore);
List<HostVO> xenServerHosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(Hypervisor.HypervisorType.XenServer, scope.getScopeId());
List<HostVO> vmWareServerHosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(Hypervisor.HypervisorType.VMware, scope.getScopeId());
List<HostVO> kvmHosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(Hypervisor.HypervisorType.KVM, scope.getScopeId());
List<HostVO> hosts = new ArrayList<HostVO>();
hosts.addAll(xenServerHosts);
hosts.addAll(vmWareServerHosts);
hosts.addAll(kvmHosts);
for (HostVO host : hosts) {
try {
_storageMgr.connectHostToSharedPool(host.getId(), dataStore.getId());
} catch (Exception e) {
logger.warn("Unable to establish a connection between " + host + " and " + dataStore, e);
}
}
return true;
}
代码示例来源:origin: apache/cloudstack
@Override
public Scope getScope() {
return new ZoneScope(imageDataStoreVO.getDataCenterId());
}
代码示例来源:origin: apache/cloudstack
@Override
public boolean attachZone(DataStore dataStore, ZoneScope scope, HypervisorType hypervisorType) {
List<HostVO> xenServerHosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(HypervisorType.XenServer, scope.getScopeId());
List<HostVO> vmWareServerHosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(HypervisorType.VMware, scope.getScopeId());
List<HostVO> kvmHosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(HypervisorType.KVM, scope.getScopeId());
List<HostVO> hosts = new ArrayList<>();
hosts.addAll(xenServerHosts);
hosts.addAll(vmWareServerHosts);
hosts.addAll(kvmHosts);
for (HostVO host : hosts) {
try {
_storageMgr.connectHostToSharedPool(host.getId(), dataStore.getId());
} catch (Exception e) {
s_logger.warn("Unable to establish a connection between " + host + " and " + dataStore, e);
}
}
_dataStoreHelper.attachZone(dataStore);
return true;
}
代码示例来源:origin: apache/cloudstack
private Scope getZoneScope(Scope destScope) {
ZoneScope zoneScope = null;
if (destScope instanceof ClusterScope) {
ClusterScope clusterScope = (ClusterScope)destScope;
zoneScope = new ZoneScope(clusterScope.getZoneId());
} else if (destScope instanceof HostScope) {
HostScope hostScope = (HostScope)destScope;
zoneScope = new ZoneScope(hostScope.getZoneId());
} else {
zoneScope = (ZoneScope)destScope;
}
return zoneScope;
}
代码示例来源:origin: apache/cloudstack
@Override
public List<ImageStoreVO> findImageCacheByScope(ZoneScope scope) {
SearchCriteria<ImageStoreVO> sc = createSearchCriteria();
sc.addAnd("role", SearchCriteria.Op.EQ, DataStoreRole.ImageCache);
if (scope.getScopeId() != null) {
sc.addAnd("scope", SearchCriteria.Op.EQ, ScopeType.ZONE);
sc.addAnd("dcId", SearchCriteria.Op.EQ, scope.getScopeId());
}
return listBy(sc);
}
代码示例来源:origin: apache/cloudstack
@Override
public DataStore getImageStore(long zoneId) {
List<DataStore> stores = getImageStoresByScope(new ZoneScope(zoneId));
if (stores == null || stores.size() == 0) {
return null;
}
return imageDataStoreMgr.getImageStore(stores);
}
代码示例来源:origin: apache/cloudstack
@Override
public boolean attachZone(DataStore dataStore, ZoneScope scope, HypervisorType hypervisorType) {
List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(hypervisorType, scope.getScopeId());
s_logger.debug("In createPool. Attaching the pool to each of the hosts.");
List<HostVO> poolHosts = new ArrayList<HostVO>();
for (HostVO host : hosts) {
try {
storageMgr.connectHostToSharedPool(host.getId(), dataStore.getId());
poolHosts.add(host);
} catch (Exception e) {
s_logger.warn("Unable to establish a connection between " + host + " and " + dataStore, e);
}
}
if (poolHosts.isEmpty()) {
s_logger.warn("No host can access storage pool " + dataStore + " in this zone.");
primaryDataStoreDao.expunge(dataStore.getId());
throw new CloudRuntimeException("Failed to create storage pool as it is not accessible to hosts.");
}
dataStoreHelper.attachZone(dataStore, hypervisorType);
return true;
}
代码示例来源:origin: apache/cloudstack
@Override
public DataStore getImageCacheStore(long zoneId) {
List<DataStore> stores = getImageCacheStores(new ZoneScope(zoneId));
if (stores == null || stores.size() == 0) {
return null;
}
return imageDataStoreMgr.getImageStore(stores);
}
代码示例来源:origin: apache/cloudstack
@Override
public List<ImageStoreVO> findByScope(ZoneScope scope) {
SearchCriteria<ImageStoreVO> sc = createSearchCriteria();
sc.addAnd("role", SearchCriteria.Op.EQ, DataStoreRole.Image);
if (scope.getScopeId() != null) {
SearchCriteria<ImageStoreVO> scc = createSearchCriteria();
scc.addOr("scope", SearchCriteria.Op.EQ, ScopeType.REGION);
scc.addOr("dcId", SearchCriteria.Op.EQ, scope.getScopeId());
sc.addAnd("scope", SearchCriteria.Op.SC, scc);
}
// we should return all image stores if cross-zone scope is passed
// (scopeId = null)
return listBy(sc);
}
代码示例来源:origin: apache/cloudstack
@Override
public TemplateDataStoreVO findByTemplateZoneDownloadStatus(long templateId, Long zoneId, Status... status) {
// get all elgible image stores
List<DataStore> imgStores = _storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
if (imgStores != null) {
for (DataStore store : imgStores) {
List<TemplateDataStoreVO> sRes = listByTemplateStoreDownloadStatus(templateId, store.getId(), status);
if (sRes != null && sRes.size() > 0) {
Collections.shuffle(sRes);
return sRes.get(0);
}
}
}
return null;
}
代码示例来源:origin: apache/cloudstack
@Override
public boolean attachZone(DataStore dataStore, ZoneScope scope, HypervisorType hypervisorType) {
List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(hypervisorType, scope.getScopeId());
s_logger.debug("In createPool. Attaching the pool to each of the hosts.");
List<HostVO> poolHosts = new ArrayList<HostVO>();
for (HostVO host : hosts) {
try {
storageMgr.connectHostToSharedPool(host.getId(), dataStore.getId());
poolHosts.add(host);
} catch (StorageConflictException se) {
primaryDataStoreDao.expunge(dataStore.getId());
throw new CloudRuntimeException("Storage has already been added as local storage to host: " + host.getName());
} catch (Exception e) {
s_logger.warn("Unable to establish a connection between " + host + " and " + dataStore, e);
}
}
if (poolHosts.isEmpty()) {
s_logger.warn("No host can access storage pool " + dataStore + " in this zone.");
primaryDataStoreDao.expunge(dataStore.getId());
throw new CloudRuntimeException("Failed to create storage pool as it is not accessible to hosts.");
}
dataStoreHelper.attachZone(dataStore, hypervisorType);
return true;
}
代码示例来源:origin: apache/cloudstack
@Override
public List<DataStore> getImageStoreByTemplate(long templateId, Long zoneId) {
// find all eligible image stores for this zone scope
List<DataStore> imageStores = _dataStoreMgr.getImageStoresByScope(new ZoneScope(zoneId));
if (imageStores == null || imageStores.size() == 0) {
return null;
}
List<DataStore> stores = new ArrayList<DataStore>();
for (DataStore store : imageStores) {
// check if the template is stored there
List<TemplateDataStoreVO> storeTmpl = _tmplStoreDao.listByTemplateStore(templateId, store.getId());
if (storeTmpl != null && storeTmpl.size() > 0) {
stores.add(store);
}
}
return stores;
}
代码示例来源:origin: apache/cloudstack
@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;
}
代码示例来源:origin: apache/cloudstack
@Override
public TemplateDataStoreVO findByTemplateZoneStagingDownloadStatus(long templateId, Long zoneId, Status... status) {
// get all elgible image stores
List<DataStore> cacheStores = _storeMgr.getImageCacheStores(new ZoneScope(zoneId));
if (cacheStores != null) {
for (DataStore store : cacheStores) {
List<TemplateDataStoreVO> sRes = listByTemplateStoreDownloadStatus(templateId, store.getId(),
status);
if (sRes != null && sRes.size() > 0) {
Collections.shuffle(sRes);
return sRes.get(0);
}
}
}
return null;
}
代码示例来源:origin: apache/cloudstack
@Override
public List<TemplateDataStoreVO> listByTemplateZoneDownloadStatus(long templateId, Long zoneId, Status... status) {
// get all elgible image stores
List<DataStore> imgStores = _storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
if (imgStores != null) {
List<TemplateDataStoreVO> result = new ArrayList<TemplateDataStoreVO>();
for (DataStore store : imgStores) {
List<TemplateDataStoreVO> sRes = listByTemplateStoreDownloadStatus(templateId, store.getId(), status);
if (sRes != null && sRes.size() > 0) {
result.addAll(sRes);
}
}
return result;
}
return null;
}
代码示例来源:origin: apache/cloudstack
@Override
public TemplateDataStoreVO findByTemplateZone(long templateId, Long zoneId, DataStoreRole role) {
// get all elgible image stores
List<DataStore> imgStores = null;
if (role == DataStoreRole.Image) {
imgStores = _storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
} else if (role == DataStoreRole.ImageCache) {
imgStores = _storeMgr.getImageCacheStores(new ZoneScope(zoneId));
}
if (imgStores != null) {
for (DataStore store : imgStores) {
List<TemplateDataStoreVO> sRes = listByTemplateStore(templateId, store.getId());
if (sRes != null && sRes.size() > 0) {
return sRes.get(0);
}
}
}
return null;
}
代码示例来源:origin: apache/cloudstack
@Override
public List<DataStore> listImageCacheStores(Scope scope) {
if (scope.getScopeType() != ScopeType.ZONE) {
s_logger.debug("only support zone wide image cache stores");
return null;
}
List<ImageStoreVO> stores = dataStoreDao.findImageCacheByScope(new ZoneScope(scope.getScopeId()));
List<DataStore> imageStores = new ArrayList<DataStore>();
for (ImageStoreVO store : stores) {
imageStores.add(getImageStore(store.getId()));
}
return imageStores;
}
代码示例来源:origin: apache/cloudstack
List<DataStore> imageStores = storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
if (imageStores == null || imageStores.size() == 0) {
throw new CloudRuntimeException("Unable to find image store to download template " + profile.getTemplate());
代码示例来源:origin: apache/cloudstack
@Override
public TemplateInfo prepareIso(long isoId, long dcId, Long hostId, Long poolId) {
TemplateInfo tmplt;
boolean bypassed = false;
if (_tmplFactory.isTemplateMarkedForDirectDownload(isoId)) {
tmplt = _tmplFactory.getReadyBypassedTemplateOnPrimaryStore(isoId, poolId, hostId);
bypassed = true;
} else {
tmplt = _tmplFactory.getTemplate(isoId, DataStoreRole.Image, dcId);
}
if (tmplt == null || tmplt.getFormat() != ImageFormat.ISO) {
s_logger.warn("ISO: " + isoId + " does not exist in vm_template table");
return null;
}
if (!bypassed && tmplt.getDataStore() != null && !(tmplt.getDataStore().getTO() instanceof NfsTO)) {
// if it is s3, need to download into cache storage first
Scope destScope = new ZoneScope(dcId);
TemplateInfo cacheData = (TemplateInfo)cacheMgr.createCacheObject(tmplt, destScope);
if (cacheData == null) {
s_logger.error("Failed in copy iso from S3 to cache storage");
return null;
}
return cacheData;
} else {
return tmplt;
}
}
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneState类的一些代码示例,展示了ZoneState类的具体用法。这些代
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts类的一些代码示例,展示
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName类的一些代码示例,展示了ZoneAndName类的具体用法
本文整理了Java中org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope.getScopeId()方法的一些代码示例,展示了Zone
本文整理了Java中org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope.()方法的一些代码示例,展示了ZoneScope.()的具
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneState.string()方法的一些代码示例,展示了ZoneState
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts.getZone()方
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName.getName()方法的一些代码示例,展示了ZoneAn
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneSecurityGroupNameAndPorts.()方法的一些代码示
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName.equals()方法的一些代码示例,展示了ZoneAnd
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName.fromZoneAndName()方法的一些代码示例,展
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId.getId()方法的一些代码示例,展示了ZoneAndId.
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName.string()方法的一些代码示例,展示了ZoneAnd
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName.slashEncode()方法的一些代码示例,展示了Zo
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId.fromZoneAndId()方法的一些代码示例,展示了Zo
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndName.slashEncodeZoneAndName()方法的一
本文整理了Java中org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId.fromSlashEncoded()方法的一些代码示例,展示
我是一名优秀的程序员,十分优秀!