private Long domainOfDedicatedHost(HostVO host) { long hostId = host.getId(); DedicatedResourceVO dedicatedHost = _dedicatedDao.findByHostId(hostId); DedicatedResourceVO dedicatedClusterOfHost = _dedicatedDao.findByClusterId(host.getClusterId()); DedicatedResourceVO dedicatedPodOfHost = _dedicatedDao.findByPodId(host.getPodId()); if (dedicatedHost != null) { return dedicatedHost.getDomainId(); } if (dedicatedClusterOfHost != null) { return dedicatedClusterOfHost.getDomainId(); } if (dedicatedPodOfHost != null) { return dedicatedPodOfHost.getDomainId(); } return null; }
boolean domainIdInChildreanList = getDomainChildIds(dedicatedPodOfCluster.getDomainId()).contains(domainId); (accountId != null && !(dedicatedPodOfCluster.getDomainId().equals(domainId) || domainIdInChildreanList))) { s_logger.error("Cannot dedicate Cluster. Its Pod is already dedicated"); HostPodVO pod = _podDao.findById(cluster.getPodId()); boolean domainIdInChildreanList = getDomainChildIds(dedicatedZoneOfCluster.getDomainId()).contains(domainId); (accountId != null && !(dedicatedZoneOfCluster.getDomainId().equals(domainId) || domainIdInChildreanList))) { s_logger.error("Cannot dedicate Cluster. Its zone is already dedicated"); DataCenterVO zone = _zoneDao.findById(cluster.getDataCenterId()); DedicatedResourceVO dHost = _dedicatedDao.findByHostId(host.getId()); if (dHost != null) { if (!(childDomainIds.contains(dHost.getDomainId()))) { throw new CloudRuntimeException("Host " + host.getName() + " under this Cluster " + cluster.getName() + " is dedicated to different account/domain"); if (dHost.getAccountId() == null && dHost.getDomainId().equals(domainId)) { hostsToRelease.add(dHost);
boolean domainIdInChildreanList = getDomainChildIds(dedicatedClusterOfHost.getDomainId()).contains(domainId); (accountId != null && !(dedicatedClusterOfHost.getDomainId().equals(domainId) || domainIdInChildreanList))) { ClusterVO cluster = _clusterDao.findById(host.getClusterId()); s_logger.error("Host's Cluster " + cluster.getName() + " is already dedicated"); boolean domainIdInChildreanList = getDomainChildIds(dedicatedPodOfHost.getDomainId()).contains(domainId); (accountId != null && !(dedicatedPodOfHost.getDomainId().equals(domainId) || domainIdInChildreanList))) { HostPodVO pod = _podDao.findById(host.getPodId()); s_logger.error("Host's Pod " + pod.getName() + " is already dedicated"); boolean domainIdInChildreanList = getDomainChildIds(dedicatedZoneOfHost.getDomainId()).contains(domainId); (accountId != null && !(dedicatedZoneOfHost.getDomainId().equals(domainId) || domainIdInChildreanList))) { DataCenterVO zone = _zoneDao.findById(host.getDataCenterId()); s_logger.error("Host's Data Center " + zone.getName() + " is already dedicated");
boolean domainIdInChildreanList = getDomainChildIds(dedicatedZoneOfPod.getDomainId()).contains(domainId); (accountId != null && !(dedicatedZoneOfPod.getDomainId().equals(domainId) || domainIdInChildreanList))) { DataCenterVO zone = _zoneDao.findById(pod.getDataCenterId()); s_logger.error("Cannot dedicate Pod. Its zone is already dedicated"); DedicatedResourceVO dCluster = _dedicatedDao.findByClusterId(cluster.getId()); if (dCluster != null) { if (!(childDomainIds.contains(dCluster.getDomainId()))) { throw new CloudRuntimeException("Cluster " + cluster.getName() + " under this Pod " + pod.getName() + " is dedicated to different account/domain"); if (dCluster.getAccountId() == null && dCluster.getDomainId().equals(domainId)) { clustersToRelease.add(dCluster); DedicatedResourceVO dHost = _dedicatedDao.findByHostId(host.getId()); if (dHost != null) { if (!(getDomainChildIds(domainId).contains(dHost.getDomainId()))) { throw new CloudRuntimeException("Host " + host.getName() + " under this Pod " + pod.getName() + " is dedicated to different account/domain"); if (dHost.getAccountId() == null && dHost.getDomainId().equals(domainId)) { hostsToRelease.add(dHost);
DedicatedResourceVO dPod = _dedicatedDao.findByPodId(pod.getId()); if (dPod != null) { if (!(childDomainIds.contains(dPod.getDomainId()))) { throw new CloudRuntimeException("Pod " + pod.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); if (dPod.getAccountId() == null && dPod.getDomainId().equals(domainId)) { podsToRelease.add(dPod); DedicatedResourceVO dCluster = _dedicatedDao.findByClusterId(cluster.getId()); if (dCluster != null) { if (!(childDomainIds.contains(dCluster.getDomainId()))) { throw new CloudRuntimeException("Cluster " + cluster.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); if (dCluster.getAccountId() == null && dCluster.getDomainId().equals(domainId)) { clustersToRelease.add(dCluster); DedicatedResourceVO dHost = _dedicatedDao.findByHostId(host.getId()); if (dHost != null) { if (!(childDomainIds.contains(dHost.getDomainId()))) { throw new CloudRuntimeException("Host " + host.getName() + " under this Zone " + dc.getName() + " is dedicated to different account/domain"); if (dHost.getAccountId() == null && dHost.getDomainId().equals(domainId)) { hostsToRelease.add(dHost);
DomainVO domain = _domainDao.findById(dedicatedZone.getDomainId()); if (domain == null) { throw new CloudRuntimeException("Unable to find the domain " + zone.getDomainId() + " for the zone: " + zone);
ListZonesByDomainIdSearch.and("domainId", ListZonesByDomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ); ListZonesByDomainIdSearch.and("accountId", ListZonesByDomainIdSearch.entity().getAccountId(), SearchCriteria.Op.NULL); ListZonesByDomainIdSearch.done(); ListPodsByDomainIdSearch.and("domainId", ListPodsByDomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ); ListPodsByDomainIdSearch.and("accountId", ListPodsByDomainIdSearch.entity().getAccountId(), SearchCriteria.Op.NULL); ListPodsByDomainIdSearch.done(); ListClustersByDomainIdSearch.and("domainId", ListClustersByDomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ); ListClustersByDomainIdSearch.and("accountId", ListClustersByDomainIdSearch.entity().getAccountId(), SearchCriteria.Op.NULL); ListClustersByDomainIdSearch.done(); ListHostsByDomainIdSearch.and("domainId", ListHostsByDomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ); ListHostsByDomainIdSearch.and("accountId", ListHostsByDomainIdSearch.entity().getAccountId(), SearchCriteria.Op.NULL); ListHostsByDomainIdSearch.done(); ListAllZonesSearch.and("hostId", ListAllZonesSearch.entity().getHostId(), Op.NULL); ListAllZonesSearch.and("accountId", ListAllZonesSearch.entity().getAccountId(), Op.EQ); ListAllZonesSearch.and("domainId", ListAllZonesSearch.entity().getDomainId(), Op.EQ); ListAllZonesSearch.and("affinityGroupId", ListAllZonesSearch.entity().getAffinityGroupId(), Op.EQ); ListAllZonesSearch.done(); ListAllPodsSearch.and("hostId", ListAllPodsSearch.entity().getHostId(), Op.NULL); ListAllPodsSearch.and("accountId", ListAllPodsSearch.entity().getAccountId(), Op.EQ); ListAllPodsSearch.and("domainId", ListAllPodsSearch.entity().getDomainId(), Op.EQ); ListAllPodsSearch.and("affinityGroupId", ListAllPodsSearch.entity().getAffinityGroupId(), Op.EQ); ListAllPodsSearch.done(); ListAllClustersSearch.and("hostId", ListAllClustersSearch.entity().getHostId(), Op.NULL);