@@ -1360,9 +1360,8 @@ public Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapac
13601360
13611361 performBasicPrivateVlanChecks (vlanId , secondaryVlanId , privateVlanType );
13621362
1363- // Regular user can create Guest Isolated Source Nat enabled network or L2 network only
1364- if (_accountMgr .isNormalUser (caller .getId ())) {
1365- validateNetworkOfferingForRegularUser (ntwkOff );
1363+ if (!_accountMgr .isRootAdmin (caller .getId ())) {
1364+ validateNetworkOfferingForNonRootAdminUser (ntwkOff );
13661365 }
13671366
13681367 // Don't allow to specify vlan if the caller is not ROOT admin
@@ -1454,20 +1453,16 @@ public Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapac
14541453 return network ;
14551454 }
14561455
1457- private void validateNetworkOfferingForRegularUser (NetworkOfferingVO ntwkOff ) {
1456+ private void validateNetworkOfferingForNonRootAdminUser (NetworkOfferingVO ntwkOff ) {
14581457 if (ntwkOff .getTrafficType () != TrafficType .Guest ) {
1459- throw new InvalidParameterValueException ("Regular users can only create a Guest network" );
1458+ throw new InvalidParameterValueException ("This user can only create a Guest network" );
14601459 }
1461- if (ntwkOff .getGuestType () == GuestType .Isolated && areServicesSupportedByNetworkOffering (ntwkOff .getId (), Service .SourceNat )) {
1462- s_logger .debug (String .format ("Creating a network from network offerings having traffic type [%s] and network type [%s] with a service [%s] enabled." ,
1463- TrafficType .Guest , GuestType .Isolated , Service .SourceNat .getName ()));
1464- } else if (ntwkOff .getGuestType () == GuestType .L2 ) {
1460+ if (ntwkOff .getGuestType () == GuestType .L2 || ntwkOff .getGuestType () == GuestType .Isolated ) {
14651461 s_logger .debug (String .format ("Creating a network from network offerings having traffic type [%s] and network type [%s]." ,
1466- TrafficType .Guest , GuestType . L2 ));
1462+ TrafficType .Guest , ntwkOff . getGuestType () ));
14671463 } else {
14681464 throw new InvalidParameterValueException (
1469- String .format ("Regular users can only create an %s network with a service [%s] enabled, or a %s network." ,
1470- GuestType .Isolated , Service .SourceNat .getName (), GuestType .L2 ));
1465+ String .format ("This user can only create an %s network or a %s network." , GuestType .Isolated , GuestType .L2 ));
14711466 }
14721467 }
14731468
0 commit comments