private List<DedicatedResourceVO> searchInDomainResources(long domainId) { List<DedicatedResourceVO> dr = _dedicatedDao.listByDomainId(domainId); return dr; }
private List<DedicatedResourceVO> searchInParentDomainResources(long domainId) { List<Long> domainIds = getDomainParentIds(domainId); List<DedicatedResourceVO> dr = new ArrayList<DedicatedResourceVO>(); for (Long id : domainIds) { List<DedicatedResourceVO> resource = _dedicatedDao.listByDomainId(id); if (resource != null) { dr.addAll(resource); } } return dr; }
/** * First check domain resources before removing domain. There are 2 cases: * <ol> * <li>Domain doesn't have accounts for cleanup, non-removed networks, or dedicated resources</li> * <ul><li>Delete domain</li></ul> * <li>Domain has one of the following: accounts set for cleanup, non-removed networks, dedicated resources</li> * <ul><li>Dont' delete domain</li><li>Fail operation</li></ul> * </ol> * @param domain domain to remove * @throws CloudRuntimeException when case 2 or when domain cannot be deleted on case 1 */ protected void removeDomainWithNoAccountsForCleanupNetworksOrDedicatedResources(DomainVO domain) { boolean hasDedicatedResources = false; List<Long> networkIds = _networkDomainDao.listNetworkIdsByDomain(domain.getId()); List<AccountVO> accountsForCleanup = _accountDao.findCleanupsForRemovedAccounts(domain.getId()); List<DedicatedResourceVO> dedicatedResources = _dedicatedDao.listByDomainId(domain.getId()); if (CollectionUtils.isNotEmpty(dedicatedResources)) { s_logger.error("There are dedicated resources for the domain " + domain.getId()); hasDedicatedResources = true; } if (accountsForCleanup.isEmpty() && networkIds.isEmpty() && !hasDedicatedResources) { publishRemoveEventsAndRemoveDomain(domain); } else { failRemoveOperation(domain, accountsForCleanup, networkIds, hasDedicatedResources); } }
if (accountsForCleanupInDomain.isEmpty()) { List<DedicatedResourceVO> dedicatedResources = _dedicatedDao.listByDomainId(domainId); if (dedicatedResources != null && !dedicatedResources.isEmpty()) { s_logger.debug("Releasing dedicated resources for domain" + domainId);
if (accountsForCleanup.isEmpty()) { List<DedicatedResourceVO> dedicatedResources = _dedicatedDao.listByDomainId(domainId); if (dedicatedResources != null && !dedicatedResources.isEmpty()) { s_logger.debug("Releasing dedicated resources for domain" + domainId);