VPC: applyStaticRoutes - don't exclude static routes in Revoke state

This commit is contained in:
Alena Prokharchyk 2012-08-02 18:42:14 -07:00
parent 6aee5f2aef
commit 6eba8a818a

View File

@ -831,15 +831,12 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
List<StaticRouteProfile> staticRouteProfiles = new ArrayList<StaticRouteProfile>(routes.size()); List<StaticRouteProfile> staticRouteProfiles = new ArrayList<StaticRouteProfile>(routes.size());
Map<Long, VpcGateway> gatewayMap = new HashMap<Long, VpcGateway>(); Map<Long, VpcGateway> gatewayMap = new HashMap<Long, VpcGateway>();
for (StaticRoute route : routes) { for (StaticRoute route : routes) {
if (route.getState() != StaticRoute.State.Revoke) { VpcGateway gateway = gatewayMap.get(route.getVpcGatewayId());
//skip static route in revoke state if (gateway == null) {
VpcGateway gateway = gatewayMap.get(route.getVpcGatewayId()); gateway = _vpcMgr.getVpcGateway(route.getVpcGatewayId());
if (gateway == null) { gatewayMap.put(gateway.getId(), gateway);
gateway = _vpcMgr.getVpcGateway(route.getVpcGatewayId());
gatewayMap.put(gateway.getId(), gateway);
}
staticRouteProfiles.add(new StaticRouteProfile(route, gateway));
} }
staticRouteProfiles.add(new StaticRouteProfile(route, gateway));
} }
s_logger.debug("Found " + staticRouteProfiles.size() + " static routes to apply as a part of vpc route " s_logger.debug("Found " + staticRouteProfiles.size() + " static routes to apply as a part of vpc route "
@ -1018,16 +1015,6 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
return true; return true;
} }
//exclude static route in Revoke state
Iterator<StaticRouteProfile> it = staticRoutes.iterator();
while (it.hasNext()) {
StaticRouteProfile profile = it.next();
if (profile.getState() == StaticRoute.State.Revoke) {
s_logger.debug("Not sending static route " + profile + " because its in " + StaticRoute.State.Revoke + " state");
it.remove();
}
}
boolean result = true; boolean result = true;
for (VirtualRouter router : routers) { for (VirtualRouter router : routers) {
if (router.getState() == State.Running) { if (router.getState() == State.Running) {