Enable defining a network as redundant during restart through the UI (#7405)

Co-authored-by: Gabriel <gabriel.fernandes@scclouds.com.br>
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
This commit is contained in:
GaOrtiga 2026-03-04 13:00:54 -03:00 committed by GitHub
parent 75620309c2
commit 7ad68aafa5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View File

@ -280,6 +280,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
private static final ConfigKey<Boolean> AllowEmptyStartEndIpAddress = new ConfigKey<>("Advanced", Boolean.class,
"allow.empty.start.end.ipaddress", "true", "Allow creating network without mentioning start and end IP address",
true, ConfigKey.Scope.Account);
public static final ConfigKey<Boolean> AllowUsersToMakeNetworksRedundant = new ConfigKey<>("Advanced", Boolean.class,
"allow.users.to.make.networks.redundant", "true", "Allow Users to make Networks Redundant",
true, ConfigKey.Scope.Global);
private static final long MIN_VLAN_ID = 0L;
private static final long MAX_VLAN_ID = 4095L; // 2^12 - 1
private static final long MIN_GRE_KEY = 0L;
@ -2998,8 +3001,12 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
throwInvalidIdException("Cannot restart a VPC tier with cleanup, please restart the whole VPC.", network.getUuid(), "network tier");
}
boolean makeRedundant = cmd.getMakeRedundant();
boolean livePatch = cmd.getLivePatch();
User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
if (makeRedundant && !_accountMgr.isRootAdmin(callerUser.getAccountId()) && !AllowUsersToMakeNetworksRedundant.value() ) {
throw new InvalidParameterValueException("Could not make the network redundant. Please contact administrator.");
}
boolean livePatch = cmd.getLivePatch();
return restartNetwork(network, cleanup, makeRedundant, livePatch, callerUser);
}
@ -6278,7 +6285,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
@Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {AllowDuplicateNetworkName, AllowEmptyStartEndIpAddress, VRPrivateInterfaceMtu, VRPublicInterfaceMtu, AllowUsersToSpecifyVRMtu};
return new ConfigKey<?>[] {AllowDuplicateNetworkName, AllowEmptyStartEndIpAddress, AllowUsersToMakeNetworksRedundant, VRPrivateInterfaceMtu, VRPublicInterfaceMtu, AllowUsersToSpecifyVRMtu};
}
public boolean isDefaultAcl(Long aclId) {

View File

@ -96,6 +96,7 @@
]
},
"plugins": [],
"allowMakingRouterRedundant": false,
"apidocs": true,
"basicZoneEnabled": true,
"multipleServer": false,

View File

@ -20,6 +20,7 @@ import store from '@/store'
import tungsten from '@/assets/icons/tungsten.svg?inline'
import { isAdmin } from '@/role'
import { isZoneCreated } from '@/utils/zone'
import { vueProps } from '@/vue-app'
export default {
name: 'network',
@ -171,13 +172,16 @@ export default {
if (isGroupAction || record.vpcid == null) {
fields.push('cleanup')
}
if (!record.redundantrouter && vueProps.$config.allowMakingRouterRedundant) {
fields.push('makeredundant')
}
fields.push('livepatch')
return fields
},
show: (record) => record.type !== 'L2',
groupAction: true,
popup: true,
groupMap: (selection, values) => { return selection.map(x => { return { id: x, cleanup: values.cleanup } }) }
groupMap: (selection, values) => { return selection.map(x => { return { id: x, cleanup: values.cleanup, makeredundant: values.makeredundant } }) }
},
{
api: 'replaceNetworkACLList',