CLOUDSTACK-617: Unable to edit a sub-domain. Change UpdateDomain to be consistent with CreateDomain i.e. before this operation, while checking if the domain-name is unique, search under the parent domain instead of searching under the ROOT domain.

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Likitha Shetty 2012-12-12 17:42:04 +05:30 committed by Rohit Yadav
parent 697d4d8832
commit 99556a4f30

View File

@ -1513,10 +1513,11 @@ public class ManagementServerImpl implements ManagementServer {
Account caller = UserContext.current().getCaller();
_accountMgr.checkAccess(caller, domain);
// domain name is unique in the cloud
// domain name is unique under the parent domain
if (domainName != null) {
SearchCriteria<DomainVO> sc = _domainDao.createSearchCriteria();
sc.addAnd("name", SearchCriteria.Op.EQ, domainName);
sc.addAnd("parent", SearchCriteria.Op.EQ, domain.getParent());
List<DomainVO> domains = _domainDao.search(sc, null);
boolean sameDomain = (domains.size() == 1 && domains.get(0).getId() == domainId);