From 21df0ffe898530e69db48b2c16f34b3bb0a17c14 Mon Sep 17 00:00:00 2001 From: wilderrodrigues Date: Tue, 1 Sep 2015 14:31:49 +0200 Subject: [PATCH] CLOUDSTACK-8759 - The guest nic has to be added after the control nic - The was an issue introduced on 4.5 with the VPC refactor. - Adding a VM to a VPC with no router would create a broken VPC router, with no nics --- .../src/com/cloud/network/router/NetworkHelperImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/network/router/NetworkHelperImpl.java b/server/src/com/cloud/network/router/NetworkHelperImpl.java index e096439de6e..23cdf1a89c7 100644 --- a/server/src/com/cloud/network/router/NetworkHelperImpl.java +++ b/server/src/com/cloud/network/router/NetworkHelperImpl.java @@ -613,14 +613,21 @@ public class NetworkHelperImpl implements NetworkHelper { @Override public LinkedHashMap> configureDefaultNics(final RouterDeploymentDefinition routerDeploymentDefinition) throws ConcurrentOperationException, InsufficientAddressCapacityException { - final LinkedHashMap> networks = configureGuestNic(routerDeploymentDefinition); + final LinkedHashMap> networks = new LinkedHashMap>(3); + + // 1) Guest Network + final LinkedHashMap> guestNic = configureGuestNic(routerDeploymentDefinition); // 2) Control network s_logger.debug("Adding nic for Virtual Router in Control network "); final List offerings = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemControlNetwork); final NetworkOffering controlOffering = offerings.get(0); final Network controlConfig = _networkMgr.setupNetwork(s_systemAccount, controlOffering, routerDeploymentDefinition.getPlan(), null, null, false).get(0); + networks.put(controlConfig, new ArrayList()); + // The guest nic has to be added after the Control Nic. + networks.putAll(guestNic); + // 3) Public network if (routerDeploymentDefinition.isPublicNetwork()) { s_logger.debug("Adding nic for Virtual Router in Public network ");