diff mbox series

[ovs-dev,v1,4/4] northd: I-P for logical switch creation in en_ls_stateful engine node.

Message ID 20250110162717.3550933-1-numans@ovn.org
State Changes Requested
Headers show
Series northd I-P for logical switch creation | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Numan Siddique Jan. 10, 2025, 4:27 p.m. UTC
From: Numan Siddique <numans@ovn.org>

en_northd engine nodes provides the created or updated logical switches
in its tracked data and en_ls_stateful node handles these changes.

Signed-off-by: Numan Siddique <numans@ovn.org>
---
 northd/en-ls-stateful.c | 20 +++++++++++++-------
 tests/ovn-northd.at     |  2 +-
 2 files changed, 14 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/northd/en-ls-stateful.c b/northd/en-ls-stateful.c
index 1534bad9f6..bf42a25788 100644
--- a/northd/en-ls-stateful.c
+++ b/northd/en-ls-stateful.c
@@ -138,12 +138,9 @@  ls_stateful_northd_handler(struct engine_node *node, void *data_)
         return false;
     }
 
-    if (northd_has_lswitchs_in_tracked_data(&northd_data->trk_data)) {
-        return false;
-    }
-
     if (!northd_has_ls_lbs_in_tracked_data(&northd_data->trk_data) &&
-        !northd_has_ls_acls_in_tracked_data(&northd_data->trk_data)) {
+        !northd_has_ls_acls_in_tracked_data(&northd_data->trk_data) &&
+        !northd_has_lswitchs_in_tracked_data(&northd_data->trk_data)) {
         return true;
     }
 
@@ -153,6 +150,10 @@  ls_stateful_northd_handler(struct engine_node *node, void *data_)
     struct hmapx_node *hmapx_node;
 
     struct hmapx changed_stateful_od = HMAPX_INITIALIZER(&changed_stateful_od);
+    HMAPX_FOR_EACH (hmapx_node, &nd_changes->trk_switches.crupdated) {
+        hmapx_add(&changed_stateful_od, hmapx_node->data);
+    }
+
     HMAPX_FOR_EACH (hmapx_node, &nd_changes->ls_with_changed_lbs) {
         hmapx_add(&changed_stateful_od, hmapx_node->data);
     }
@@ -166,9 +167,14 @@  ls_stateful_northd_handler(struct engine_node *node, void *data_)
 
         struct ls_stateful_record *ls_stateful_rec = ls_stateful_table_find_(
             &data->table, od->nbs);
-        ovs_assert(ls_stateful_rec);
-        ls_stateful_record_reinit(ls_stateful_rec, od, NULL,
+        if (!ls_stateful_rec) {
+            ls_stateful_rec =
+                ls_stateful_record_create(&data->table, od,
+                                          input_data.ls_port_groups);
+        } else {
+            ls_stateful_record_reinit(ls_stateful_rec, od, NULL,
                                   input_data.ls_port_groups);
+        }
 
         /* Add the ls_stateful_rec to the tracking data. */
         hmapx_add(&data->trk_data.crupdated, ls_stateful_rec);
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index e1dbd8bab9..8912951765 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -14287,7 +14287,7 @@  check ovn-nbctl --wait=sb sync
 check as northd ovn-appctl -t ovn-northd inc-engine/clear-stats
 check ovn-nbctl --wait=sb ls-add sw0
 check_engine_stats northd norecompute compute
-check_engine_stats ls_stateful recompute nocompute
+check_engine_stats ls_stateful norecompute compute
 check_engine_stats lflow recompute nocompute
 
 # For the below engine nodes, en_northd is input.  So check