Fixing getRouters() to make it call the super method. - after calling super, if we have routers available, do not call the subclass method.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/294a42a1 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/294a42a1 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/294a42a1 Branch: refs/heads/feature/systemvm-persistent-config Commit: 294a42a1713eabdfdc8abc3a8e36a1e2e2dc8150 Parents: cdafd10 Author: wilderrodrigues <[email protected]> Authored: Mon Jan 12 17:39:59 2015 +0100 Committer: wilderrodrigues <[email protected]> Committed: Wed Feb 4 18:47:06 2015 +0100 ---------------------------------------------------------------------- .../com/cloud/network/element/VpcVirtualRouterElement.java | 9 +++++++-- .../network/router/VirtualNetworkApplianceManagerImpl.java | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/294a42a1/server/src/com/cloud/network/element/VpcVirtualRouterElement.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java index f0c0fba..078eab3 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<DomainRouterVO> getRouters(final Network network, final DeployDestination dest) { - List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>(); + //1st time it runs the domain router of the VM shall be returned + List<DomainRouterVO> 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"); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/294a42a1/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 278164b..6b928d7 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<State, VirtualMachine.Event, VirtualMachine> { 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)) {
