@Override public boolean getSupportsResigning(long clusterId) { ClusterVO cluster = findById(clusterId); if (cluster == null || cluster.getAllocationState() != Grouping.AllocationState.Enabled) { return false; } ClusterDetailsVO clusterDetailsVO = clusterDetailsDao.findDetail(clusterId, "supportsResign"); if (clusterDetailsVO != null) { String value = clusterDetailsVO.getValue(); return Boolean.parseBoolean(value); } return false; } }
@Override public AllocationState findClusterAllocationState(final ClusterVO cluster) { if (cluster.getAllocationState() == AllocationState.Disabled) { return AllocationState.Disabled; } else if (ApiDBUtils.findPodById(cluster.getPodId()).getAllocationState() == AllocationState.Disabled) { return AllocationState.Disabled; } else { final DataCenterVO zone = ApiDBUtils.findZoneById(cluster.getDataCenterId()); return zone.getAllocationState(); } }
if (p.getCluster() != null && p.getCluster().getAllocationState() != Grouping.AllocationState.Enabled) { if (s_logger.isDebugEnabled()) { s_logger.debug("Cluster name: " + p.getCluster().getName() + ", clusterId: " + clusterId + " is in " + p.getCluster().getAllocationState().name() + " state, skipping this and trying other pod-clusters");
ClusterVO clusterVO = _clusterDao.findById(clusterId); if (clusterVO.getAllocationState() == Grouping.AllocationState.Disabled) { s_logger.debug("Cannot deploy in disabled cluster " + clusterId + ", skipping this cluster"); avoid.addCluster(clusterVO.getId());
@Override public List<Long> listDisabledClusters(long zoneId, Long podId) { GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class); clusterIdSearch.selectFields(clusterIdSearch.entity().getId()); clusterIdSearch.and("dataCenterId", clusterIdSearch.entity().getDataCenterId(), Op.EQ); if (podId != null) { clusterIdSearch.and("podId", clusterIdSearch.entity().getPodId(), Op.EQ); } clusterIdSearch.and("allocationState", clusterIdSearch.entity().getAllocationState(), Op.EQ); clusterIdSearch.done(); SearchCriteria<Long> sc = clusterIdSearch.create(); sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId); if (podId != null) { sc.addAnd("podId", SearchCriteria.Op.EQ, podId); } sc.addAnd("allocationState", SearchCriteria.Op.EQ, Grouping.AllocationState.Disabled); return customSearch(sc, null); }
@Override public List<HostVO> listByDataCenterIdAndHypervisorType(long zoneId, Hypervisor.HypervisorType hypervisorType) { SearchBuilder<ClusterVO> clusterSearch = _clusterDao.createSearchBuilder(); clusterSearch.and("allocationState", clusterSearch.entity().getAllocationState(), SearchCriteria.Op.EQ); clusterSearch.and("hypervisorType", clusterSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ); SearchBuilder<HostVO> hostSearch = createSearchBuilder(); hostSearch.and("dc", hostSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); hostSearch.and("type", hostSearch.entity().getType(), Op.EQ); hostSearch.and("status", hostSearch.entity().getStatus(), Op.EQ); hostSearch.and("resourceState", hostSearch.entity().getResourceState(), Op.EQ); hostSearch.join("clusterSearch", clusterSearch, hostSearch.entity().getClusterId(), clusterSearch.entity().getId(), JoinBuilder.JoinType.INNER); hostSearch.done(); SearchCriteria<HostVO> sc = hostSearch.create(); sc.setParameters("dc", zoneId); sc.setParameters("type", Host.Type.Routing); sc.setParameters("status", Status.Up); sc.setParameters("resourceState", ResourceState.Enabled); sc.setJoinParameters("clusterSearch", "allocationState", Grouping.AllocationState.Enabled); sc.setJoinParameters("clusterSearch", "hypervisorType", hypervisorType.toString()); return listBy(sc); }
sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ); sb.and("clusterType", sb.entity().getClusterType(), SearchCriteria.Op.EQ); sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);