From: Han Zhou <hzh...@ebay.com>

The ovn-controller main loop relies on the return value of chassis_run().
When ovnsb_idl_txn is NULL (i.e. there is a pending transaction for SB),
chasssis_run() returns NULL, which blocks functions to be executed in
the main loop unnecessarily. This patch updates chassis_run() so that
it returns chassis record whenever it is available.

This changes allows xxx_run() functions being executed whenever
br_int and chassis are not NULL. For functions that need to update
SB DB, there are already additional checks making sure ovnsb_idl_txn
is not NULL.

Acked-by: Numan Siddique <nusid...@redhat.com>
Acked-by: Mark Michelson <mmich...@redhat.com>
Signed-off-by: Han Zhou <hzh...@ebay.com>
---
v3->v4: rebase on master

 ovn/controller/chassis.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/ovn/controller/chassis.c b/ovn/controller/chassis.c
index 3ea908d..58d5d49 100644
--- a/ovn/controller/chassis.c
+++ b/ovn/controller/chassis.c
@@ -73,8 +73,7 @@ get_cms_options(const struct smap *ext_ids)
     return smap_get_def(ext_ids, "ovn-cms-options", "");
 }
 
-/* Returns this chassis's Chassis record, if it is available and is currently
- * amenable to a transaction. */
+/* Returns this chassis's Chassis record, if it is available. */
 const struct sbrec_chassis *
 chassis_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
             struct ovsdb_idl_index *sbrec_chassis_by_name,
@@ -82,8 +81,10 @@ chassis_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
             const char *chassis_id,
             const struct ovsrec_bridge *br_int)
 {
+    const struct sbrec_chassis *chassis_rec
+        = chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id);
     if (!ovnsb_idl_txn) {
-        return NULL;
+        return chassis_rec;
     }
 
     const struct ovsrec_open_vswitch *cfg;
@@ -148,8 +149,6 @@ chassis_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
     ds_chomp(&iface_types, ',');
     const char *iface_types_str = ds_cstr(&iface_types);
 
-    const struct sbrec_chassis *chassis_rec
-        = chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id);
     const char *encap_csum = smap_get_def(&cfg->external_ids,
                                           "ovn-encap-csum", "true");
     int n_encaps = count_1bits(req_tunnels);
-- 
2.1.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to