Fixing getRouters() to make it call the super method.

- after calling super, if we have routers available, do not call the subclass method.
This commit is contained in:
wilderrodrigues 2015-01-12 17:39:59 +01:00
parent 460204fa9f
commit eee891be3e
2 changed files with 13 additions and 2 deletions

View File

@ -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");

View File

@ -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)) {