Skip to content

Commit 3b4523f

Browse files
raveningRakesh Venkatesh
andauthored
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 <rakeshv@apache.org>
1 parent 40b4b2c commit 3b4523f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

server/src/main/java/com/cloud/server/ManagementServerImpl.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
import javax.inject.Inject;
4545
import javax.naming.ConfigurationException;
4646

47+
import com.cloud.dc.DomainVlanMapVO;
48+
import com.cloud.dc.dao.DomainVlanMapDao;
4749
import org.apache.cloudstack.acl.ControlledEntity;
4850
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
4951
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
@@ -889,6 +891,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
889891
private VpcDao _vpcDao;
890892
@Inject
891893
private AnnotationDao annotationDao;
894+
@Inject
895+
private DomainVlanMapDao _domainVlanMapDao;
892896

893897
private LockControllerListener _lockControllerListener;
894898
private final ScheduledExecutorService _eventExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("EventChecker"));
@@ -1894,6 +1898,16 @@ public Pair<List<? extends Vlan>, Integer> searchForVlans(final ListVlanIpRanges
18941898
sb.join("accountVlanMapSearch", accountVlanMapSearch, sb.entity().getId(), accountVlanMapSearch.entity().getVlanDbId(), JoinBuilder.JoinType.INNER);
18951899
}
18961900

1901+
if (domainId != null) {
1902+
DomainVO domain = ApiDBUtils.findDomainById(domainId);
1903+
if (domain == null) {
1904+
throw new InvalidParameterValueException("Unable to find domain with id " + domainId);
1905+
}
1906+
final SearchBuilder<DomainVlanMapVO> domainVlanMapSearch = _domainVlanMapDao.createSearchBuilder();
1907+
domainVlanMapSearch.and("domainId", domainVlanMapSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
1908+
sb.join("domainVlanMapSearch", domainVlanMapSearch, sb.entity().getId(), domainVlanMapSearch.entity().getVlanDbId(), JoinType.INNER);
1909+
}
1910+
18971911
if (podId != null) {
18981912
final SearchBuilder<PodVlanMapVO> podVlanMapSearch = _podVlanMapDao.createSearchBuilder();
18991913
podVlanMapSearch.and("podId", podVlanMapSearch.entity().getPodId(), SearchCriteria.Op.EQ);
@@ -1937,6 +1951,10 @@ public Pair<List<? extends Vlan>, Integer> searchForVlans(final ListVlanIpRanges
19371951
if (physicalNetworkId != null) {
19381952
sc.setParameters("physicalNetworkId", physicalNetworkId);
19391953
}
1954+
1955+
if (domainId != null) {
1956+
sc.setJoinParameters("domainVlanMapSearch", "domainId", domainId);
1957+
}
19401958
}
19411959

19421960
final Pair<List<VlanVO>, Integer> result = _vlanDao.searchAndCount(sc, searchFilter);

0 commit comments

Comments
 (0)