Bug 2076 - Routing does not work unless node contains vms on all vlans (segIds) 79/12079/1
authorFlavio Fernandes <ffernand@redhat.com>
Thu, 25 Sep 2014 03:23:31 +0000 (23:23 -0400)
committerFlavio Fernandes <ffernand@redhat.com>
Mon, 20 Oct 2014 15:57:49 +0000 (11:57 -0400)
The logic for determining whether or not entries should be added to table 70 was
not taking into consideration the fact that vms on non-local vlans are also needed.

The fix simply fixes the logic used to filter out L3 fwd entries.

Change-Id: I0b7836a8f267c6346c24dad0adae6af87471dd57
Signed-off-by: Flavio Fernandes <ffernand@redhat.com>
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3Adapter.java

index 62b2b4e23f9b4d609c95231dcdc33f4eac8a6c73..896fc428a5fa352a4227bfc56feee9df72f52be9 100644 (file)
@@ -206,16 +206,17 @@ public class NeutronL3Adapter {
         // see if they are affected by l3
         //
         for (NeutronPort neutronPort : neutronPortCache.getAllPorts()) {
-            boolean currPortIsInSameSubnet = false;
-            for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) {
-                if (neutronRouterInterface.getSubnetUUID().equalsIgnoreCase(neutronIP.getSubnetUUID())) {
-                    currPortIsInSameSubnet = true;
-                    break;
+            boolean currPortShouldBeDeleted = false;
+            // Note: delete in this case only applies to 1)router interface delete and 2)ports on the same subnet
+            if (isDelete) {
+                for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) {
+                    if (neutronRouterInterface.getSubnetUUID().equalsIgnoreCase(neutronIP.getSubnetUUID())) {
+                        currPortShouldBeDeleted = true;
+                        break;
+                    }
                 }
             }
-            if (currPortIsInSameSubnet == true) {
-                this.updateL3ForNeutronPort(neutronPort, isDelete);
-            }
+            this.updateL3ForNeutronPort(neutronPort, currPortShouldBeDeleted);
         }
     }
 
@@ -301,20 +302,21 @@ public class NeutronL3Adapter {
         }
         for (Node node : nodes) {
             final Long dpid = getDpid(node);
-            final Action actionForNode =
-                    tenantNetworkManager.isTenantNetworkPresentInNode(node, providerSegmentationId) ?
-                    action : Action.DELETE;
+            final boolean tenantNetworkPresentInNode =
+                    tenantNetworkManager.isTenantNetworkPresentInNode(node, providerSegmentationId);
             for (Neutron_IPs neutronIP : neutronPort.getFixedIPs()) {
                 final String tenantIpStr = neutronIP.getIpAddress();
                 if (tenantIpStr.isEmpty()) {
                     continue;
                 }
 
-                // Configure L3 fwd
-                programL3ForwardingStage1(node, dpid, providerSegmentationId, tenantMac, tenantIpStr, actionForNode);
+                // Configure L3 fwd. We do that regardless of tenant network present, because these rules are
+                // still needed when routing to subnets non-local to node (bug 2076).
+                programL3ForwardingStage1(node, dpid, providerSegmentationId, tenantMac, tenantIpStr, action);
 
-                // Configure distributed ARP responder
-                programStaticArpStage1(node, dpid, providerSegmentationId, tenantMac, tenantIpStr, actionForNode);
+                // Configure distributed ARP responder. Only needed if tenant network exists in node.
+                programStaticArpStage1(node, dpid, providerSegmentationId, tenantMac, tenantIpStr,
+                                       tenantNetworkPresentInNode ? action : Action.DELETE);
             }
         }
     }