[ovs-dev] [PATCH ovn] ovn-controller: Fix nb_cfg update with monitor_cond_change in flight.

Dumitru Ceara dceara at redhat.com
Mon Nov 9 11:21:17 UTC 2020


It is not correct for ovn-controller to pass the current SB_Global.nb_cfg
value to ofctrl_put() if there are pending changes to conditional
monitoring clauses (local or in flight).  It might be that after the
monitor condition is acked by the SB, records that were added to the SB
before SB_Global.nb_cfg was set are now sent as updates to
ovn-controller.  These should be first installed in OVS before
ovn-controller reports that it caught up with the current
SB_Global.nb_cfg value.

Signed-off-by: Dumitru Ceara <dceara at redhat.com>

---
This patch depends on OVS exposing an API to query the current state of
the monitor condition clauses and should be merged before the following
OVS patch is merged:
https://patchwork.ozlabs.org/project/openvswitch/patch/1604920181-23904-1-git-send-email-dceara@redhat.com/

As a consequence 0day-bot will fail to compile.
---
 controller/ovn-controller.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index a06cae3..621c285 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -726,11 +726,23 @@ restore_ct_zones(const struct ovsrec_bridge_table *bridge_table,
 }
 
 static int64_t
-get_nb_cfg(const struct sbrec_sb_global_table *sb_global_table)
+get_nb_cfg(const struct sbrec_sb_global_table *sb_global_table,
+           struct ovsdb_idl_loop *sb_loop)
 {
+    static int64_t nb_cfg = 0;
+
+    /* Delay getting nb_cfg if there are monitor condition changes
+     * in flight.  It might be that those changes would instruct the
+     * server to send updates that happened before SB_Global.nb_cfg.
+     */
+    if (ovsdb_idl_monitor_condition_pending(sb_loop->idl)) {
+        return nb_cfg;
+    }
+
     const struct sbrec_sb_global *sb
         = sbrec_sb_global_table_first(sb_global_table);
-    return sb ? sb->nb_cfg : 0;
+    nb_cfg = sb ? sb->nb_cfg : 0;
+    return nb_cfg;
 }
 
 static const char *
@@ -2574,7 +2586,8 @@ main(int argc, char *argv[])
                                    &ct_zones_data->pending,
                                    sbrec_meter_table_get(ovnsb_idl_loop.idl),
                                    get_nb_cfg(sbrec_sb_global_table_get(
-                                                   ovnsb_idl_loop.idl)),
+                                                   ovnsb_idl_loop.idl),
+                                              &ovnsb_idl_loop),
                                    engine_node_changed(&en_flow_output));
                     }
                     runtime_data = engine_get_data(&en_runtime_data);
-- 
1.8.3.1



More information about the dev mailing list