@@ -280,6 +280,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
280280 private static final ConfigKey <Boolean > AllowEmptyStartEndIpAddress = new ConfigKey <>("Advanced" , Boolean .class ,
281281 "allow.empty.start.end.ipaddress" , "true" , "Allow creating network without mentioning start and end IP address" ,
282282 true , ConfigKey .Scope .Account );
283+ public static final ConfigKey <Boolean > AllowUsersToMakeNetworksRedundant = new ConfigKey <>("Advanced" , Boolean .class ,
284+ "allow.users.to.make.networks.redundant" , "true" , "Allow Users to make Networks Redundant" ,
285+ true , ConfigKey .Scope .Global );
283286 private static final long MIN_VLAN_ID = 0L ;
284287 private static final long MAX_VLAN_ID = 4095L ; // 2^12 - 1
285288 private static final long MIN_GRE_KEY = 0L ;
@@ -2998,8 +3001,12 @@ public boolean restartNetwork(RestartNetworkCmd cmd) throws ConcurrentOperationE
29983001 throwInvalidIdException ("Cannot restart a VPC tier with cleanup, please restart the whole VPC." , network .getUuid (), "network tier" );
29993002 }
30003003 boolean makeRedundant = cmd .getMakeRedundant ();
3001- boolean livePatch = cmd .getLivePatch ();
30023004 User callerUser = _accountMgr .getActiveUser (CallContext .current ().getCallingUserId ());
3005+ if (makeRedundant && !_accountMgr .isRootAdmin (callerUser .getAccountId ()) && !AllowUsersToMakeNetworksRedundant .value () ) {
3006+ throw new InvalidParameterValueException ("Could not make the network redundant. Please contact administrator." );
3007+ }
3008+
3009+ boolean livePatch = cmd .getLivePatch ();
30033010 return restartNetwork (network , cleanup , makeRedundant , livePatch , callerUser );
30043011 }
30053012
@@ -6278,7 +6285,7 @@ public String getConfigComponentName() {
62786285
62796286 @ Override
62806287 public ConfigKey <?>[] getConfigKeys () {
6281- return new ConfigKey <?>[] {AllowDuplicateNetworkName , AllowEmptyStartEndIpAddress , VRPrivateInterfaceMtu , VRPublicInterfaceMtu , AllowUsersToSpecifyVRMtu };
6288+ return new ConfigKey <?>[] {AllowDuplicateNetworkName , AllowEmptyStartEndIpAddress , AllowUsersToMakeNetworksRedundant , VRPrivateInterfaceMtu , VRPublicInterfaceMtu , AllowUsersToSpecifyVRMtu };
62826289 }
62836290
62846291 public boolean isDefaultAcl (Long aclId ) {
0 commit comments