When a logical switch was created and a port with dynamic addressing
was added in the same transaction, the dynamic address was never
allocated.

A test was modified to always hit that condtion.

Fixes: 06e2c1bf0ce7 ("northd: I-P for logical switch creation/deletion in 
en_northd.")
Signed-off-by: Xavier Simonart <[email protected]>
---
 northd/northd.c | 6 ++++++
 tests/ovn.at    | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/northd/northd.c b/northd/northd.c
index e4acb11ab..eecb313d3 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -5295,6 +5295,12 @@ northd_handle_ls_changes(struct ovsdb_idl_txn 
*ovnsb_idl_txn,
             hmapx_add(&trk_data->ls_with_changed_acls, od);
         }
         hmapx_add(&trk_data->trk_switches.crupdated, od);
+        bool ls_has_ipam = od->ipam_info.allocated_ipv4s ||
+                           od->ipam_info.ipv6_prefix_set ||
+                           od->ipam_info.mac_only;
+        if (ls_has_ipam) {
+            hmapx_add(&trk_data->ls_with_changed_ipam, od);
+        }
     }
 
     HMAPX_FOR_EACH (node, &ni->synced_lses->updated) {
diff --git a/tests/ovn.at b/tests/ovn.at
index 6b191624c..7f5de830c 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -9486,8 +9486,8 @@ check ovn-nbctl --wait=sb lsp-add sw0 p26 -- 
lsp-set-addresses p26 dynamic
 check_dynamic_addresses p26 "0a:00:00:a8:01:17 192.168.1.16"
 
 # Test for exhausting subnet address space.
-check ovn-nbctl ls-add sw2 -- add Logical-Switch sw2 other_config 
subnet=172.16.1.0/30
-check ovn-nbctl --wait=sb lsp-add sw2 p27 -- lsp-set-addresses p27 dynamic
+check ovn-nbctl --wait=sb ls-add sw2 -- add Logical-Switch sw2 other_config 
subnet=172.16.1.0/30 \
+                       -- lsp-add sw2 p27 -- lsp-set-addresses p27 dynamic
 check_dynamic_addresses p27 "0a:00:00:10:01:03 172.16.1.2"
 
 check ovn-nbctl --wait=sb lsp-add sw2 p28 -- lsp-set-addresses p28 dynamic
-- 
2.47.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to