cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anim...@apache.org
Subject [01/11] git commit: updated refs/heads/4.3 to e089b91
Date Fri, 31 Jan 2014 02:08:04 GMT
Updated Branches:
  refs/heads/4.3 210b19c1f -> e089b9138


LOUDSTACK-5987: when listTemplates with filter=community/featured, get public templates from
all domains in the system, not just parent/child subdomains of the caller

Conflicts:
	server/src/com/cloud/api/query/QueryManagerImpl.java
(cherry picked from commit b1d4c06ad1d8931f5c810dcd8b1f1df01db174f3)

Signed-off-by: Animesh Chaturvedi <animesh@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/45e45b93
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/45e45b93
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/45e45b93

Branch: refs/heads/4.3
Commit: 45e45b930a6e3217feb6a60de412564091a13015
Parents: 210b19c
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Wed Jan 29 17:12:46 2014 -0800
Committer: Animesh Chaturvedi <animesh@apache.org>
Committed: Thu Jan 30 17:39:28 2014 -0800

----------------------------------------------------------------------
 .../com/cloud/api/query/QueryManagerImpl.java   | 30 +++++++++++++-------
 1 file changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45e45b93/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index 3cbe727..6671ab9 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -26,10 +26,6 @@ import java.util.Set;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.*;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.affinity.AffinityGroupDomainMapVO;
 import org.apache.cloudstack.affinity.AffinityGroupResponse;
@@ -85,8 +81,15 @@ import org.apache.cloudstack.api.response.UserVmResponse;
 import org.apache.cloudstack.api.response.VolumeResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
 import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreCapabilities;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.query.QueryService;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
 
 import com.cloud.api.query.dao.AccountJoinDao;
 import com.cloud.api.query.dao.AffinityGroupJoinDao;
@@ -172,8 +175,8 @@ import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VolumeDetailsDao;
 import com.cloud.tags.ResourceTagVO;
 import com.cloud.tags.dao.ResourceTagDao;
-import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
 import com.cloud.template.VirtualMachineTemplate.State;
+import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
 import com.cloud.user.DomainManager;
@@ -2930,10 +2933,17 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             if (!permittedAccounts.isEmpty()) {
                 for (Account account : permittedAccounts) {
                     permittedAccountIds.add(account.getId());
-                    DomainVO accountDomain = _domainDao.findById(account.getDomainId());
+                    boolean publicTemplates = (templateFilter == TemplateFilter.featured
|| templateFilter == TemplateFilter.community);
 
                     // get all parent domain ID's all the way till root domain
-                    DomainVO domainTreeNode = accountDomain;
+                    DomainVO domainTreeNode = null;
+                    //if template filter is featured, or community, all child domains should
be included in search
+                    if (publicTemplates) {
+                        domainTreeNode = _domainDao.findById(Domain.ROOT_DOMAIN);
+
+                    } else {
+                        domainTreeNode = _domainDao.findById(account.getDomainId());
+                    }
                     relatedDomainIds.add(domainTreeNode.getId());
                     while (domainTreeNode.getParent() != null) {
                         domainTreeNode = _domainDao.findById(domainTreeNode.getParent());
@@ -2941,10 +2951,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
                     }
 
                     // get all child domain ID's
-                    if (_accountMgr.isAdmin(account.getType())
-                            || (templateFilter == TemplateFilter.featured || templateFilter
== TemplateFilter.community)) {
-                        List<DomainVO> allChildDomains = _domainDao.findAllChildren(accountDomain.getPath(),
-                                accountDomain.getId());
+                    if (_accountMgr.isAdmin(account.getType()) || publicTemplates) {
+                        List<DomainVO> allChildDomains = _domainDao.findAllChildren(domainTreeNode.getPath(),
domainTreeNode.getId());
                         for (DomainVO childDomain : allChildDomains) {
                             relatedDomainIds.add(childDomain.getId());
                         }


Mime
View raw message