DaanHoogland commented on code in PR #6781:
URL: https://github.com/apache/cloudstack/pull/6781#discussion_r996956458


##########
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java:
##########
@@ -6748,6 +6737,31 @@ public Pair<List<? extends NetworkOffering>, Integer> 
searchForNetworkOfferings(
         }
     }
 
+    private boolean allowNetworkOfferingWithNullTag(Long zoneId, List<String> 
allPhysicalNetworkTags) {
+        boolean allowNullTag = false;
+        final List<PhysicalNetworkVO> physicalNetworks = 
_physicalNetworkDao.listByZoneAndTrafficType(zoneId, TrafficType.Guest);
+        for (final PhysicalNetworkVO physicalNetwork : physicalNetworks) {
+            final List<String> physicalNetworkTags = physicalNetwork.getTags();
+            if (CollectionUtils.isEmpty(physicalNetworkTags)) {
+                if (!allowNullTag) {
+                    allowNullTag = true;
+                } else {
+                    throw new CloudRuntimeException("There are more than 1 
physical network with empty tag in the zone id=" + zoneId);
+                }
+            } else {
+                allPhysicalNetworkTags.addAll(physicalNetworkTags);
+            }
+        }
+        return allowNullTag;
+    }
+
+    private boolean checkNetworkOfferingTags(List<String> pNtwkTags, boolean 
allowNullTag, String offeringTags) {
+        if ((offeringTags == null && !allowNullTag) || (offeringTags != null 
&& !pNtwkTags.contains(offeringTags))) {
+            return false;
+        }
+        return true;

Review Comment:
   ```suggestion
           return !((offeringTags == null && !allowNullTag) || (offeringTags != 
null && !pNtwkTags.contains(offeringTags)));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to