Skip to content

server: check if redundant router is supported when restart network with makeredundant = true #10612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 4.19
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2735,6 +2735,12 @@
Account callerAccount = _accountMgr.getActiveAccountById(user.getAccountId());
_accountMgr.checkAccess(callerAccount, AccessType.OperateEntry, true, network);
if (!network.isRedundant() && makeRedundant) {
NetworkOffering networkOffering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
Map<Network.Capability, String> sourceNatCapabilities = getNetworkOfferingServiceCapabilities(networkOffering, Service.SourceNat);
String isRedundantRouterSupported = sourceNatCapabilities.get(Capability.RedundantRouter);

Check warning on line 2740 in server/src/main/java/com/cloud/network/NetworkServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/com/cloud/network/NetworkServiceImpl.java#L2738-L2740

Added lines #L2738 - L2740 were not covered by tests
if (!Boolean.parseBoolean(isRedundantRouterSupported)) {
throw new InvalidParameterValueException(String.format("Redundant router is not supported by the network offering %s", networkOffering));

Check warning on line 2742 in server/src/main/java/com/cloud/network/NetworkServiceImpl.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L2742 was not covered by tests
}
network.setRedundant(true);
if (!_networksDao.update(network.getId(), network)) {
throw new CloudRuntimeException("Failed to update network into a redundant one, please try again");
Expand Down