server: Restarting all networks that needs a restart in a VPC (#4007)

When a VPC is restarted, the networks in the VPC is not restarted, this PR will add the logic to restart the networks in the VPC that needs a restart when the VPC is restarted.

Fixes #3816
This commit is contained in:
Spaceman1984 2020-06-17 03:42:04 +02:00 committed by GitHub
parent 5054766d9f
commit 88d51ce353
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -1747,6 +1747,8 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
return true;
}
restartVPCNetworks(vpcId, callerAccount, callerUser, cleanUp);
s_logger.debug("Starting VPC " + vpc + " as a part of VPC restart process without cleanup");
if (!startVpc(vpcId, false)) {
s_logger.warn("Failed to start vpc as a part of VPC " + vpc + " restart process");
@ -1763,6 +1765,15 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
}
}
private void restartVPCNetworks(long vpcId, Account callerAccount, User callerUser, boolean cleanUp) throws InsufficientCapacityException, ResourceUnavailableException {
List<? extends Network> networks = _ntwkModel.listNetworksByVpc(vpcId);
for (Network network: networks) {
if (network.isRestartRequired()) {
_ntwkMgr.restartNetwork(network.getId(), callerAccount, callerUser, cleanUp);
}
}
}
@Override
public List<PrivateGateway> getVpcPrivateGateways(final long vpcId) {
final List<VpcGatewayVO> gateways = _vpcGatewayDao.listByVpcIdAndType(vpcId, VpcGateway.Type.Private);