When changing the order of stages in the LogicalFlow table in SB, some rules will be added with an incorrect stage-name in the external-ids of existing datapath groups. When adding a stage, new lflows in a new table with the same match and action that already existed with the same table-id will remain in the database with unupdated stage names.
Signed-off-by: Alexandra Rukomoinikova <[email protected]> --- lib/ovn-util.c | 5 ++++- lib/ovn-util.h | 2 +- northd/lflow-mgr.c | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/ovn-util.c b/lib/ovn-util.c index c65b36bb5..d1572d5ec 100644 --- a/lib/ovn-util.c +++ b/lib/ovn-util.c @@ -646,16 +646,19 @@ sbrec_logical_flow_hash(const struct sbrec_logical_flow *lf) { return ovn_logical_flow_hash(lf->table_id, ovn_pipeline_from_name(lf->pipeline), + smap_get_def(&lf->external_ids, + "stage-name", ""), lf->priority, lf->match, lf->actions); } uint32_t ovn_logical_flow_hash(uint8_t table_id, enum ovn_pipeline pipeline, - uint16_t priority, + const char *stage, uint16_t priority, const char *match, const char *actions) { size_t hash = hash_2words((table_id << 16) | priority, pipeline); + hash = hash_string(stage, hash); hash = hash_string(match, hash); return hash_string(actions, hash); } diff --git a/lib/ovn-util.h b/lib/ovn-util.h index ce8cc0568..8c54e5946 100644 --- a/lib/ovn-util.h +++ b/lib/ovn-util.h @@ -147,7 +147,7 @@ enum ovn_pipeline { uint32_t sbrec_logical_flow_hash(const struct sbrec_logical_flow *); uint32_t ovn_logical_flow_hash(uint8_t table_id, enum ovn_pipeline pipeline, - uint16_t priority, + const char *stage, uint16_t priority, const char *match, const char *actions); void ovn_conn_show(struct unixctl_conn *conn, int argc OVS_UNUSED, const char *argv[] OVS_UNUSED, void *idl_); diff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c index 88ce7ce56..eb466c7b6 100644 --- a/northd/lflow-mgr.c +++ b/northd/lflow-mgr.c @@ -670,9 +670,9 @@ lflow_table_add_lflow(struct lflow_table *lflow_table, ovs_assert(!od || ovn_stage_to_datapath_type(stage) == ovn_datapath_get_type(od)); - hash = ovn_logical_flow_hash(ovn_stage_get_table(stage), ovn_stage_get_pipeline(stage), + ovn_stage_to_str(stage), priority, match, actions); @@ -909,6 +909,8 @@ ovn_lflow_equal(const struct ovn_lflow *a, enum ovn_stage stage, const char *actions, const char *ctrl_meter) { return (a->stage == stage + && !strcmp(ovn_stage_to_str(a->stage), + ovn_stage_to_str(stage)) && a->priority == priority && !strcmp(a->match, match) && !strcmp(a->actions, actions) -- 2.48.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
