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


##########
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java:
##########
@@ -1603,8 +1603,9 @@ private void setupPersistentNetwork(NetworkVO network, 
NetworkOfferingVO offerin
     }
 
     private boolean networkMeetsPersistenceCriteria(NetworkVO network, 
NetworkOfferingVO offering, boolean cleanup) {
+        BroadcastDomainType broadcastDomainType = network.getBroadcastUri() != 
null ? BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) : null;

Review Comment:
   ```suggestion
           BroadcastDomainType broadcastDomainType =  
BroadcastDomainType.getSchemeValue(network.getBroadcastUri());
   ```
   
   nullcheck is part of the getSchemeValue() contract



##########
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java:
##########
@@ -1603,8 +1603,9 @@ private void setupPersistentNetwork(NetworkVO network, 
NetworkOfferingVO offerin
     }
 
     private boolean networkMeetsPersistenceCriteria(NetworkVO network, 
NetworkOfferingVO offering, boolean cleanup) {
+        BroadcastDomainType broadcastDomainType = network.getBroadcastUri() != 
null ? BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) : null;
         boolean criteriaMet = offering.isPersistent() &&
-                (network.getBroadcastUri() != null && 
BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) == 
BroadcastDomainType.Vlan);
+                (broadcastDomainType == BroadcastDomainType.Vlan || 
broadcastDomainType == BroadcastDomainType.Vxlan);

Review Comment:
   it would be nice for readability to use a list of values:
   ```suggestion
           List<BroadcastDomainType> broadcastTypes = 
Arrays.asList(BroadcastDomainType.Vlan, BroadcastDomainType.Vxlan)
           boolean criteriaMet = offering.isPersistent() &&                
broadcastTypes.contains(broadcastDomainType);
   ```



-- 
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