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 <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/99556a4f Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/99556a4f Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/99556a4f Branch: refs/heads/javelin Commit: 99556a4f30865081ee58825a37f52d8cedab185b Parents: 697d4d8 Author: Likitha Shetty <[email protected]> Authored: Wed Dec 12 17:42:04 2012 +0530 Committer: Rohit Yadav <[email protected]> Committed: Wed Jan 30 16:40:48 2013 -0800 ---------------------------------------------------------------------- .../src/com/cloud/server/ManagementServerImpl.java | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/99556a4f/server/src/com/cloud/server/ManagementServerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index a2a74c2..40c5508 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -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);
