[ovs-dev] [PATCH] ovn-controller: Restore all_lports for update_ct_zone

Ryan Moats rmoats at us.ibm.com
Wed Jul 27 12:29:38 UTC 2016


As [1] indicates, commit 263064a (Convert binding_run
to incremental processing.) incorrectly localized
all_lports to the binding module, leaving an empty
set for update_ct_zone to work with.  This patch
restores all_lports processing to what existed prior
to that patch.

Signed-off-by: Ryan Moats <rmoats at us.ibm.com>
---
 ovn/controller/binding.c        | 31 +++++++++++++++++++++++++++++--
 ovn/controller/binding.h        |  3 ++-
 ovn/controller/ovn-controller.c |  3 ++-
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c
index e83c1d5..d67412e 100644
--- a/ovn/controller/binding.c
+++ b/ovn/controller/binding.c
@@ -177,7 +177,6 @@ consider_local_datapath(struct controller_ctx *ctx,
     if (iface_rec
         || (binding_rec->parent_port && binding_rec->parent_port[0] &&
             sset_contains(&local_ids, binding_rec->parent_port))) {
-        add_local_datapath(local_datapaths, binding_rec);
         if (iface_rec && ctx->ovs_idl_txn) {
             update_qos(iface_rec, binding_rec);
         }
@@ -230,7 +229,8 @@ consider_local_datapath(struct controller_ctx *ctx,
 
 void
 binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
-            const char *chassis_id, struct hmap *local_datapaths)
+            const char *chassis_id, struct set *all_lports,
+            struct hmap *local_datapaths)
 {
     const struct sbrec_chassis *chassis_rec;
     const struct sbrec_port_binding *binding_rec;
@@ -251,6 +251,33 @@ binding_run(struct controller_ctx *ctx, const struct ovsrec_bridge *br_int,
         process_full_binding = true;
     }
 
+    struct shash_node *node;
+    SHASH_FOR_EACH (node, &lport_to_iface) {
+        sset_add(all_lports, node->name);
+    }
+
+    /* Run through all binding records to collect lists of lports
+       for later use in updating ct zones. */
+    SBREC_PORT_BINDING_FOR_EACH(binding_rec, ctx->ovnsb_idl) {
+        const struct ovsrec_interface *iface_rec
+            = shash_find_data(lport_to_iface, binding_rec->logical_port);
+        if (iface_rec
+            || (binding_rec->parent_port && binding_rec->parent_port[0] &&
+                sset_contains(all_lports, binding_rec->parent_port))) {
+            if (binding_rec->parent_port && binding_rec->parent_port[0]) {
+                /* Add child logical port to the set of all local ports. */
+                sset_add(all_lports, binding_rec->logical_port);
+            }
+        } else if (!binding_rec->chassis
+                   && !strcmp(binding_rec->type, "localnet")) {
+            /* localnet ports will never be bound to a chassis, but we want
+             * to list them in all_lports because we want to allocate
+             * a conntrack zone ID for each one, as we'll be creating
+             * a patch port for each one. */
+            sset_add(all_lports, binding_rec->logical_port);
+        }
+    }
+
     /* Run through each binding record to see if it is resident on this
      * chassis and update the binding accordingly.  This includes both
      * directly connected logical ports and children of those ports. */
diff --git a/ovn/controller/binding.h b/ovn/controller/binding.h
index 8753d44..0cb4a0f 100644
--- a/ovn/controller/binding.h
+++ b/ovn/controller/binding.h
@@ -29,7 +29,8 @@ struct sset;
 void binding_register_ovs_idl(struct ovsdb_idl *);
 void binding_reset_processing(void);
 void binding_run(struct controller_ctx *, const struct ovsrec_bridge *br_int,
-                 const char *chassis_id, struct hmap *local_datapaths);
+                 const char *chassis_id, struct sset *all_lports,
+                 struct hmap *local_datapaths);
 bool binding_cleanup(struct controller_ctx *, const char *chassis_id);
 
 #endif /* ovn/binding.h */
diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c
index ecf1306..fb5d81b 100644
--- a/ovn/controller/ovn-controller.c
+++ b/ovn/controller/ovn-controller.c
@@ -434,7 +434,8 @@ main(int argc, char *argv[])
         if (chassis_id) {
             chassis = chassis_run(&ctx, chassis_id);
             encaps_run(&ctx, br_int, chassis_id);
-            binding_run(&ctx, br_int, chassis_id, &local_datapaths);
+            binding_run(&ctx, br_int, chassis_id, &all_lports,
+                        &local_datapaths);
         }
 
         if (br_int && chassis_id) {
-- 
2.7.4 (Apple Git-66)




More information about the dev mailing list