From 13fc3b0dd8f44b707ff25f5e3c3c7d8f56624085 Mon Sep 17 00:00:00 2001 From: abhishek Date: Thu, 17 Feb 2011 15:29:13 -0800 Subject: [PATCH] bug 8452: more delete domain specific changes --- server/src/com/cloud/server/ManagementServerImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 360c284dad6..397cc0c0b09 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -2939,9 +2939,6 @@ public class ManagementServerImpl implements ManagementServer { Account account = UserContext.current().getCaller(); Long domainId = cmd.getId(); Boolean cleanup = cmd.getCleanup(); - - //TODO - cleanup = true; if ((domainId == DomainVO.ROOT_DOMAIN) || ((account != null) && !_domainDao.isChildDomain(account.getDomainId(), domainId))) { throw new PermissionDeniedException("Unable to delete domain " + domainId + ", permission denied."); @@ -2961,10 +2958,13 @@ public class ManagementServerImpl implements ManagementServer { if (!_domainDao.remove(domainId)) { s_logger.error("Delete failed on domain " + domain.getName() + " (id: " + domainId + "); please make sure all users and sub domains have been removed from the domain before deleting"); return false; + } else { + domain.setState(Domain.State.Inactive); + _domainDao.update(domainId, domain); } } } else { - throw new InvalidParameterValueException("Failed to delete domain nable " + domainId + ", domain not found"); + throw new InvalidParameterValueException("Failed to delete domain " + domainId + ", domain not found"); } cleanupDomainOfferings(domainId); return true; @@ -3004,7 +3004,7 @@ public class ManagementServerImpl implements ManagementServer { sc1.addAnd("path", SearchCriteria.Op.LIKE, "%"+domainHandle.getPath()+"%"); List domainsToBeInactivated = _domainDao.search(sc1, null); - //update all subdomains to inactive so no accounts can be created + //update all subdomains to inactive so no accounts/users can be created for(DomainVO domain : domainsToBeInactivated) { domain.setState(Domain.State.Inactive); _domainDao.update(domain.getId(), domain);