use of org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope in project cloudstack by apache.
the class StorageSystemDataMotionStrategy method getZoneScope.
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;
}
use of org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope in project cloudstack by apache.
the class VolumeServiceTest method testCreatePrimaryStorage.
@Test
public void testCreatePrimaryStorage() {
DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider("sample primary data store provider");
Map<String, Object> params = new HashMap<String, Object>();
URI uri = null;
try {
uri = new URI(this.getPrimaryStorageUrl());
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
params.put("url", this.getPrimaryStorageUrl());
params.put("server", uri.getHost());
params.put("path", uri.getPath());
params.put("protocol", StoragePoolType.NetworkFilesystem);
params.put("dcId", dcId.toString());
params.put("hypervisorType", HypervisorType.None);
params.put("clusterId", clusterId.toString());
params.put("name", this.primaryName);
params.put("port", "1");
params.put("roles", DataStoreRole.Primary.toString());
params.put("uuid", UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString());
params.put("providerName", String.valueOf(provider.getName()));
DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
this.primaryStore = lifeCycle.initialize(params);
ClusterScope scope = new ClusterScope(clusterId, podId, dcId);
lifeCycle.attachCluster(this.primaryStore, scope);
}
use of org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope 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;
}
Aggregations