[ovs-dev] [PATCH ovn 2/3] northd: update stage-name if changed

Mark Gray mark.d.gray at redhat.com
Sat Jun 19 09:51:23 UTC 2021


If a new table is added to a logical flow pipeline, the mapping between
'external_ids:stage-name' from the 'Logical_Flow' table in the
'OVN_Southbound' database and the 'stage' number may change for some tables.

If 'ovn-northd' is started against a populated Southbound database,
'external_ids:stage-name' will not be updated to reflect the new, correct
name. This will cause the stage name to be incorrectly displayed by some
tools and commands such as `ovn-sbctl dump-flows`.

This commit, reconciles changes to the stage name as part of build_lflows().

Suggested-by: Ilya Maximets <i.maximets at ovn.org>
Signed-off-by: Mark Gray <mark.d.gray at redhat.com>
---
 northd/ovn-northd.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index aae7314c8977..d97ab4a5b39c 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -12412,6 +12412,13 @@ build_lflows(struct northd_context *ctx, struct hmap *datapaths,
             ovn_stage_build(dp_type, pipeline, sbflow->table_id),
             sbflow->priority, sbflow->match, sbflow->actions, sbflow->hash);
         if (lflow) {
+            const char *stage_name = smap_get_def(&sbflow->external_ids,
+                                                  "stage-name", "");
+            if (strcmp(stage_name, ovn_stage_to_str(lflow->stage))) {
+                sbrec_logical_flow_update_external_ids_setkey(sbflow,
+                     "stage-name", ovn_stage_to_str(lflow->stage));
+            }
+
             /* This is a valid lflow.  Checking if the datapath group needs
              * updates. */
             bool update_dp_group = false;
@@ -14197,6 +14204,8 @@ main(int argc, char *argv[])
     add_column_noalert(ovnsb_idl_loop.idl, &sbrec_logical_flow_col_priority);
     add_column_noalert(ovnsb_idl_loop.idl, &sbrec_logical_flow_col_match);
     add_column_noalert(ovnsb_idl_loop.idl, &sbrec_logical_flow_col_actions);
+    ovsdb_idl_add_column(ovnsb_idl_loop.idl,
+                         &sbrec_logical_flow_col_external_ids);
 
     ovsdb_idl_add_table(ovnsb_idl_loop.idl,
                         &sbrec_table_logical_dp_group);
-- 
2.27.0



More information about the dev mailing list