|
44 | 44 | import javax.inject.Inject; |
45 | 45 | import javax.naming.ConfigurationException; |
46 | 46 |
|
| 47 | +import com.cloud.dc.DomainVlanMapVO; |
| 48 | +import com.cloud.dc.dao.DomainVlanMapDao; |
47 | 49 | import org.apache.cloudstack.acl.ControlledEntity; |
48 | 50 | import org.apache.cloudstack.affinity.AffinityGroupProcessor; |
49 | 51 | import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; |
@@ -889,6 +891,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe |
889 | 891 | private VpcDao _vpcDao; |
890 | 892 | @Inject |
891 | 893 | private AnnotationDao annotationDao; |
| 894 | + @Inject |
| 895 | + private DomainVlanMapDao _domainVlanMapDao; |
892 | 896 |
|
893 | 897 | private LockControllerListener _lockControllerListener; |
894 | 898 | private final ScheduledExecutorService _eventExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("EventChecker")); |
@@ -1894,6 +1898,16 @@ public Pair<List<? extends Vlan>, Integer> searchForVlans(final ListVlanIpRanges |
1894 | 1898 | sb.join("accountVlanMapSearch", accountVlanMapSearch, sb.entity().getId(), accountVlanMapSearch.entity().getVlanDbId(), JoinBuilder.JoinType.INNER); |
1895 | 1899 | } |
1896 | 1900 |
|
| 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 | + |
1897 | 1911 | if (podId != null) { |
1898 | 1912 | final SearchBuilder<PodVlanMapVO> podVlanMapSearch = _podVlanMapDao.createSearchBuilder(); |
1899 | 1913 | podVlanMapSearch.and("podId", podVlanMapSearch.entity().getPodId(), SearchCriteria.Op.EQ); |
@@ -1937,6 +1951,10 @@ public Pair<List<? extends Vlan>, Integer> searchForVlans(final ListVlanIpRanges |
1937 | 1951 | if (physicalNetworkId != null) { |
1938 | 1952 | sc.setParameters("physicalNetworkId", physicalNetworkId); |
1939 | 1953 | } |
| 1954 | + |
| 1955 | + if (domainId != null) { |
| 1956 | + sc.setJoinParameters("domainVlanMapSearch", "domainId", domainId); |
| 1957 | + } |
1940 | 1958 | } |
1941 | 1959 |
|
1942 | 1960 | final Pair<List<VlanVO>, Integer> result = _vlanDao.searchAndCount(sc, searchFilter); |
|
0 commit comments