Skip to content

Commit a9da793

Browse files
committed
server: check if redundant router is supported when restart network with makeredundant = true
1 parent 6c40a7b commit a9da793

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
@@ -2735,6 +2735,12 @@ public boolean restartNetwork(NetworkVO network, boolean cleanup, boolean makeRe
27352735
Account callerAccount = _accountMgr.getActiveAccountById(user.getAccountId());
27362736
_accountMgr.checkAccess(callerAccount, AccessType.OperateEntry, true, network);
27372737
if (!network.isRedundant() && makeRedundant) {
2738+
NetworkOffering networkOffering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
2739+
Map<Network.Capability, String> sourceNatCapabilities = getNetworkOfferingServiceCapabilities(networkOffering, Service.SourceNat);
2740+
String isRedundantRouterSupported = sourceNatCapabilities.get(Capability.RedundantRouter);
2741+
if (!Boolean.parseBoolean(isRedundantRouterSupported)) {
2742+
throw new InvalidParameterValueException(String.format("Redundant router is not supported by the network offering %s", networkOffering));
2743+
}
27382744
network.setRedundant(true);
27392745
if (!_networksDao.update(network.getId(), network)) {
27402746
throw new CloudRuntimeException("Failed to update network into a redundant one, please try again");

0 commit comments

Comments
 (0)