@Override public AllocationState findPodAllocationState(final HostPodVO pod) { if (pod.getAllocationState() == AllocationState.Disabled) { return AllocationState.Disabled; } else { final DataCenterVO zone = ApiDBUtils.findZoneById(pod.getDataCenterId()); return zone.getAllocationState(); } }
@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.getPod().getAllocationState() != Grouping.AllocationState.Enabled) { if (s_logger.isDebugEnabled()) { s_logger.debug("Pod name: " + p.getPod().getName() + ", podId: " + p.getPod().getId() + " is in " + p.getPod().getAllocationState().name() + " state, skipping this and trying other pods");
allocationStateStr = pod.getAllocationState().toString();
public HostPodDaoImpl() { DataCenterAndNameSearch = createSearchBuilder(); DataCenterAndNameSearch.and("dc", DataCenterAndNameSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); DataCenterAndNameSearch.and("name", DataCenterAndNameSearch.entity().getName(), SearchCriteria.Op.EQ); DataCenterAndNameSearch.done(); DataCenterIdSearch = createSearchBuilder(); DataCenterIdSearch.and("dcId", DataCenterIdSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); DataCenterIdSearch.done(); PodIdSearch = createSearchBuilder(Long.class); PodIdSearch.selectFields(PodIdSearch.entity().getId()); PodIdSearch.and("dataCenterId", PodIdSearch.entity().getDataCenterId(), Op.EQ); PodIdSearch.and("allocationState", PodIdSearch.entity().getAllocationState(), Op.EQ); PodIdSearch.done(); }
@Override public List<Long> listClustersWithDisabledPods(long zoneId) { GenericSearchBuilder<HostPodVO, Long> disabledPodIdSearch = hostPodDao.createSearchBuilder(Long.class); disabledPodIdSearch.selectFields(disabledPodIdSearch.entity().getId()); disabledPodIdSearch.and("dataCenterId", disabledPodIdSearch.entity().getDataCenterId(), Op.EQ); disabledPodIdSearch.and("allocationState", disabledPodIdSearch.entity().getAllocationState(), Op.EQ); GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class); clusterIdSearch.selectFields(clusterIdSearch.entity().getId()); clusterIdSearch.join("disabledPodIdSearch", disabledPodIdSearch, clusterIdSearch.entity().getPodId(), disabledPodIdSearch.entity().getId(), JoinBuilder.JoinType.INNER); clusterIdSearch.done(); SearchCriteria<Long> sc = clusterIdSearch.create(); sc.setJoinParameters("disabledPodIdSearch", "dataCenterId", zoneId); sc.setJoinParameters("disabledPodIdSearch", "allocationState", Grouping.AllocationState.Disabled); return customSearch(sc, null); }
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE); sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);