Skip to content

Commit

Permalink
northd: Refactor the northd change tracking.
Browse files Browse the repository at this point in the history
northd engine tracking data now has the following tracking data
  - changed ovn_ports (right now only changed logical switch ports are
    tracked.)
  - changed load balancers.

This separation becomes easier to add lflow handling for these
changes in lflow northd engine handler.  This patch doesn't
handle the load balancer changes in lflow handler.  It will
be handled in upcoming commits.

Signed-off-by: Numan Siddique <numans@ovn.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
numansiddique authored and ovsrobot committed Oct 24, 2023
1 parent 4db5ab2 commit b1c9da6
Show file tree
Hide file tree
Showing 6 changed files with 313 additions and 240 deletions.
11 changes: 6 additions & 5 deletions northd/en-lflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ lflow_northd_handler(struct engine_node *node,
return false;
}

/* Fall back to recompute if lb related data has changed. */
if (northd_data->lb_changed) {
/* Fall back to recompute if load balancers have changed. */
if (northd_has_lbs_in_tracked_data(&northd_data->trk_northd_changes)) {
return false;
}

Expand All @@ -119,13 +119,14 @@ lflow_northd_handler(struct engine_node *node,
struct lflow_input lflow_input;
lflow_get_input_data(node, &lflow_input);

if (!lflow_handle_northd_ls_changes(eng_ctx->ovnsb_idl_txn,
&northd_data->tracked_ls_changes,
&lflow_input, &lflow_data->lflows)) {
if (!lflow_handle_northd_port_changes(eng_ctx->ovnsb_idl_txn,
&northd_data->trk_northd_changes.trk_ovn_ports,
&lflow_input, &lflow_data->lflows)) {
return false;
}

engine_set_node_state(node, EN_UPDATED);

return true;
}

Expand Down
13 changes: 7 additions & 6 deletions northd/en-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,16 @@ northd_lb_data_handler(struct engine_node *node, void *data)
&nd->ls_datapaths,
&nd->lr_datapaths,
&nd->lb_datapaths_map,
&nd->lb_group_datapaths_map)) {
&nd->lb_group_datapaths_map,
&nd->trk_northd_changes)) {
return false;
}

/* Indicate the depedendant engine nodes that load balancer/group
* related data has changed (including association to logical
* switch/router). */
nd->lb_changed = true;
engine_set_node_state(node, EN_UPDATED);
if (northd_has_lbs_in_tracked_data(&nd->trk_northd_changes)) {
nd->change_tracked = true;
engine_set_node_state(node, EN_UPDATED);
}

return true;
}

Expand Down
10 changes: 7 additions & 3 deletions northd/en-sync-sb.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ sync_to_sb_lb_northd_handler(struct engine_node *node, void *data OVS_UNUSED)
{
struct northd_data *nd = engine_get_input_data("northd", node);

if (!nd->change_tracked || nd->lb_changed) {
if (!nd->change_tracked ||
northd_has_lbs_in_tracked_data(&nd->trk_northd_changes)) {
/* Return false if no tracking data or if lbs changed. */
return false;
}
Expand Down Expand Up @@ -306,11 +307,14 @@ sync_to_sb_pb_northd_handler(struct engine_node *node, void *data OVS_UNUSED)
}

struct northd_data *nd = engine_get_input_data("northd", node);
if (!nd->change_tracked) {
if (!nd->change_tracked ||
northd_has_lbs_in_tracked_data(&nd->trk_northd_changes)) {
/* Return false if no tracking data or if lbs changed. */
return false;
}

if (!sync_pbs_for_northd_ls_changes(&nd->tracked_ls_changes)) {
if (!sync_pbs_for_northd_changed_ovn_ports(
&nd->trk_northd_changes.trk_ovn_ports)) {
return false;
}

Expand Down
Loading

0 comments on commit b1c9da6

Please sign in to comment.