GabrielBrascher commented on a change in pull request #5844:
URL: https://github.com/apache/cloudstack/pull/5844#discussion_r781945776



##########
File path: server/src/main/java/com/cloud/network/NetworkServiceImpl.java
##########
@@ -1457,6 +1454,23 @@ public Network createGuestNetwork(CreateNetworkCmd cmd) 
throws InsufficientCapac
         return network;
     }
 
+    private void validateNetworkOfferingForRegularUser(NetworkOfferingVO 
ntwkOff) {
+        if (ntwkOff.getTrafficType() != TrafficType.Guest) {
+            throw new InvalidParameterValueException("Regular users can only 
create a Guest network");
+        }
+        if (ntwkOff.getGuestType() == GuestType.Isolated && 
areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat)) {
+            s_logger.debug(String.format("Creating a network from network 
offerings having traffic type [%s] and network type [%s] with a service [%s] 
enabled.",
+                    TrafficType.Guest, GuestType.Isolated, 
Service.SourceNat.getName()));
+        } else if (ntwkOff.getGuestType() == GuestType.L2) {
+            s_logger.debug(String.format("Creating a network from network 
offerings having traffic type [%s] and network type [%s].",
+                    TrafficType.Guest, GuestType.L2));
+        } else {
+            throw new InvalidParameterValueException(
+                    String.format("Regular users can only create an %s network 
with a service [%s] enabled, or a %s network.",

Review comment:
       Great log messages :+1: 




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