rafaelweingartner commented on a change in pull request #2293: 
CLOUDSTACK-10047: DVSwitch fixes and improvements
URL: https://github.com/apache/cloudstack/pull/2293#discussion_r144034868
 
 

 ##########
 File path: engine/schema/src/com/cloud/dc/dao/DataCenterVnetDaoImpl.java
 ##########
 @@ -100,29 +101,42 @@ public void lockRange(long dcId, long physicalNetworkId, 
Integer start, Integer
     }
 
     @Override
-    public List<DataCenterVnetVO> findVnet(long dcId, String vnet) {
-        SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();
-        ;
-        sc.setParameters("dc", dcId);
-        sc.setParameters("vnet", vnet);
-        return listBy(sc);
-    }
-
-    @Override
     public int countZoneVlans(long dcId, boolean onlyCountAllocated) {
         SearchCriteria<Integer> sc = onlyCountAllocated ? 
countAllocatedZoneVlans.create() : countZoneVlans.create();
         sc.setParameters("dc", dcId);
         return customSearch(sc, null).get(0);
     }
 
+    private List<DataCenterVnetVO> findOverlappingVnets(final long dcId, final 
Long physicalNetworkId, final String vnet) {
+        final List<Integer> searchVnets = UriUtils.expandVlanUri(vnet);
+        final List<DataCenterVnetVO> overlappingVnets = new ArrayList<>();
+        if (searchVnets != null && searchVnets.size() > 0) {
 
 Review comment:
   what about inverting this conditional?
   `if( searchVnets == null || searchVnets.size() == 0){return 
overlappingVnets;}`
   This helps to reduce the number of IFs inside of IFs
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to