Skip to content

Commit bcd23eb

Browse files
server: check if redundant router is supported when restart network with makeredundant = true (#10612)
1 parent e68abcd commit bcd23eb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/src/main/java/com/cloud/network/NetworkServiceImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,6 +2739,12 @@ public boolean restartNetwork(NetworkVO network, boolean cleanup, boolean makeRe
27392739
Account callerAccount = _accountMgr.getActiveAccountById(user.getAccountId());
27402740
_accountMgr.checkAccess(callerAccount, AccessType.OperateEntry, true, network);
27412741
if (!network.isRedundant() && makeRedundant) {
2742+
NetworkOffering networkOffering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
2743+
Map<Network.Capability, String> sourceNatCapabilities = getNetworkOfferingServiceCapabilities(networkOffering, Service.SourceNat);
2744+
String isRedundantRouterSupported = sourceNatCapabilities.get(Capability.RedundantRouter);
2745+
if (!Boolean.parseBoolean(isRedundantRouterSupported)) {
2746+
throw new InvalidParameterValueException(String.format("Redundant router is not supported by the network offering %s", networkOffering));
2747+
}
27422748
network.setRedundant(true);
27432749
if (!_networksDao.update(network.getId(), network)) {
27442750
throw new CloudRuntimeException("Failed to update network into a redundant one, please try again");

0 commit comments

Comments
 (0)