@Override public boolean attachCluster(DataStore dataStore, ClusterScope scope) { StoragePoolVO dataStoreVO = dataStoreDao.findById(dataStore.getId()); dataStoreVO.setDataCenterId(scope.getZoneId()); dataStoreVO.setPodId(scope.getPodId()); dataStoreVO.setClusterId(scope.getScopeId()); dataStoreVO.setStatus(StoragePoolStatus.Attaching); dataStoreVO.setScope(scope.getScopeType()); dataStoreDao.update(dataStoreVO.getId(), dataStoreVO); attachCluster(dataStore); dataStoreVO = dataStoreDao.findById(dataStore.getId()); dataStoreVO.setStatus(StoragePoolStatus.Up); dataStoreDao.update(dataStoreVO.getId(), dataStoreVO); return true; }
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; }
@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; }
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; }
store = lifeCycle.initialize(params); if (scopeType == ScopeType.CLUSTER) { ClusterScope clusterScope = new ClusterScope(clusterId, podId, zoneId); lifeCycle.attachCluster(store, clusterScope); } else if (scopeType == ScopeType.ZONE) {