This is an automated email from the ASF dual-hosted git repository.

sureshanaparti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 3b4523f  Display vlan ip range for specified domainid (#4634)
3b4523f is described below

commit 3b4523f22ad5921f6686fcecbea90bd17beeadd7
Author: Rakesh <[email protected]>
AuthorDate: Mon Sep 20 07:07:21 2021 +0200

    Display vlan ip range for specified domainid (#4634)
    
    * Display vlan ip range for specified domainid
    
    Currently if we try to list vlan ip range by passing
    domainid then it lists for all domain. Make sure that
    it lists only for that domain
    
    * orgazine imports
    
    Co-authored-by: Rakesh Venkatesh <[email protected]>
---
 .../java/com/cloud/server/ManagementServerImpl.java    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/server/src/main/java/com/cloud/server/ManagementServerImpl.java 
b/server/src/main/java/com/cloud/server/ManagementServerImpl.java
index f7cd7de..b27ad8c 100644
--- a/server/src/main/java/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/main/java/com/cloud/server/ManagementServerImpl.java
@@ -44,6 +44,8 @@ import javax.crypto.spec.SecretKeySpec;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import com.cloud.dc.DomainVlanMapVO;
+import com.cloud.dc.dao.DomainVlanMapDao;
 import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.affinity.AffinityGroupProcessor;
 import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
@@ -889,6 +891,8 @@ public class ManagementServerImpl extends ManagerBase 
implements ManagementServe
     private VpcDao _vpcDao;
     @Inject
     private AnnotationDao annotationDao;
+    @Inject
+    private DomainVlanMapDao _domainVlanMapDao;
 
     private LockControllerListener _lockControllerListener;
     private final ScheduledExecutorService _eventExecutor = 
Executors.newScheduledThreadPool(1, new NamedThreadFactory("EventChecker"));
@@ -1894,6 +1898,16 @@ public class ManagementServerImpl extends ManagerBase 
implements ManagementServe
             sb.join("accountVlanMapSearch", accountVlanMapSearch, 
sb.entity().getId(), accountVlanMapSearch.entity().getVlanDbId(), 
JoinBuilder.JoinType.INNER);
         }
 
+        if (domainId != null) {
+            DomainVO domain = ApiDBUtils.findDomainById(domainId);
+            if (domain == null) {
+                throw new InvalidParameterValueException("Unable to find 
domain with id " + domainId);
+            }
+            final SearchBuilder<DomainVlanMapVO> domainVlanMapSearch = 
_domainVlanMapDao.createSearchBuilder();
+            domainVlanMapSearch.and("domainId", 
domainVlanMapSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
+            sb.join("domainVlanMapSearch", domainVlanMapSearch, 
sb.entity().getId(), domainVlanMapSearch.entity().getVlanDbId(), 
JoinType.INNER);
+        }
+
         if (podId != null) {
             final SearchBuilder<PodVlanMapVO> podVlanMapSearch = 
_podVlanMapDao.createSearchBuilder();
             podVlanMapSearch.and("podId", 
podVlanMapSearch.entity().getPodId(), SearchCriteria.Op.EQ);
@@ -1937,6 +1951,10 @@ public class ManagementServerImpl extends ManagerBase 
implements ManagementServe
             if (physicalNetworkId != null) {
                 sc.setParameters("physicalNetworkId", physicalNetworkId);
             }
+
+            if (domainId != null) {
+                sc.setJoinParameters("domainVlanMapSearch", "domainId", 
domainId);
+            }
         }
 
         final Pair<List<VlanVO>, Integer> result = _vlanDao.searchAndCount(sc, 
searchFilter);

Reply via email to