From eee891be3e7c460919796b30f44923996080ba34 Mon Sep 17 00:00:00 2001 From: wilderrodrigues Date: Mon, 12 Jan 2015 17:39:59 +0100 Subject: [PATCH] Fixing getRouters() to make it call the super method. - after calling super, if we have routers available, do not call the subclass method. --- .../cloud/network/element/VpcVirtualRouterElement.java | 9 +++++++-- .../router/VirtualNetworkApplianceManagerImpl.java | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java index f0c0fba8407..078eab3d885 100644 --- a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java +++ b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java @@ -16,7 +16,6 @@ // under the License. package com.cloud.network.element; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -340,8 +339,14 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc @Override protected List getRouters(final Network network, final DeployDestination dest) { - List routers = new ArrayList(); + //1st time it runs the domain router of the VM shall be returned + List routers = super.getRouters(network, dest); + if (routers.size() > 0) { + return routers; + } + + //For the 2nd time it returns the VPC routers. final Long vpcId = network.getVpcId(); if (vpcId == null) { s_logger.error("Network " + network + " is not associated with any VPC"); diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 278164b43b1..6b928d76a33 100644 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -2636,6 +2636,12 @@ Configurable, StateListener { final String routerControlIp = _routerControlHelper.getRouterControlIp(router.getId()); final String routerIpInNetwork = _routerControlHelper.getRouterIpInNetwork(network.getId(), router.getId()); + if (routerIpInNetwork == null) { + //Guest Nics are getting removed during the procedure and added back again. + //Returniung false here and waiting for the retry. + return false; + } + final AggregationControlCommand cmd = new AggregationControlCommand(action, router.getInstanceName(), routerControlIp, routerIpInNetwork); final Commands cmds = new Commands(cmd); if (!_nwHelper.sendCommandsToRouter(router, cmds)) {