When a load balancer group was removed from a switch in the same
transaction as the switch was deleted, this resulted in an assert [0]
in ovn.

A similar issue could occur when lbg was removed from a router (but
resulted in different symptoms i.e. commit failures).

[0] northd/lflow-mgr.c:1233: assertion dp_bitmap_len failed in 
do_ovn_lflow_add()

Stack trace:
6  ovs_assert_failure at lib/util.c:87
7  do_ovn_lflow_add at northd/lflow-mgr.c:1233
8  lflow_table_add_lflow__ at northd/lflow-mgr.c:868
9  lflow_table_add_lflow at northd/lflow-mgr.c:992
10 build_lb_rules_pre_stateful at northd/northd.c:8948
11 build_lswitch_flows_for_lb at northd/northd.c:14255
12 build_lswitch_flows_for_lb at northd/northd.c:14222
13 build_lflows_thread at northd/northd.c:20911

Fixes: 1dfaa516b00b ("lflow-mgr: Remove the ovn_datapath from ovn_lflow.")
Signed-off-by: Xavier Simonart <[email protected]>
---
 northd/en-lb-data.c |  2 ++
 tests/ovn-northd.at | 49 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/northd/en-lb-data.c b/northd/en-lb-data.c
index 3bc2e0443..c0465cbaa 100644
--- a/northd/en-lb-data.c
+++ b/northd/en-lb-data.c
@@ -399,6 +399,7 @@ lb_data_synced_logical_switch_handler(struct engine_node 
*node, void *data)
         if (od_lb_data) {
             hmap_remove(&lb_data->ls_lb_map, &od_lb_data->hmap_node);
             hmapx_add(&trk_lb_data->deleted_od_lb_data, od_lb_data);
+            changed = true;
         }
     }
 
@@ -479,6 +480,7 @@ lb_data_synced_logical_router_handler(struct engine_node 
*node, void *data)
         if (od_lb_data) {
             hmap_remove(&lb_data->lr_lb_map, &od_lb_data->hmap_node);
             hmapx_add(&trk_lb_data->deleted_od_lb_data, od_lb_data);
+            changed = true;
         }
     }
 
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index 6c37337ad..46b29ba5b 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -25340,3 +25340,52 @@ OVN_CLEANUP_NORTHD
 AT_CLEANUP
 ])
 
+OVN_FOR_EACH_NORTHD_NO_HV([
+AT_SETUP([Remove lb group and delete switch in the same txn])
+ovn_start
+
+check ovn-nbctl ls-add sw0
+check ovn-nbctl ls-add sw1
+
+check ovn-nbctl lb-add lb0 172.16.0.10:80 10.0.0.2:80
+lb0_uuid=$(fetch_column nb:load_balancer _uuid name=lb0)
+lbg_uuid=$(ovn-nbctl create load_balancer_group name=lbg0 
load_balancer=$lb0_uuid)
+check ovn-nbctl --wait=sb set logical_switch sw1 load_balancer_group=$lbg_uuid
+
+sleep_northd
+check ovn-nbctl remove logical_switch sw1 load_balancer_group $lbg_uuid
+check ovn-nbctl ls-del sw0
+check ovn-nbctl ls-del sw1
+wake_up_northd
+
+check ovn-nbctl --wait=sb sync
+
+OVN_CLEANUP_NORTHD
+AT_CLEANUP
+])
+
+OVN_FOR_EACH_NORTHD_NO_HV([
+AT_SETUP([Remove lb group and delete router in the same txn])
+ovn_start
+
+check ovn-nbctl lr-add r0
+check ovn-nbctl lr-add r1
+
+check ovn-nbctl lb-add lb0 172.16.0.10:80 10.0.0.2:80
+lb0_uuid=$(fetch_column nb:load_balancer _uuid name=lb0)
+lbg_uuid=$(ovn-nbctl create load_balancer_group name=lbg0 
load_balancer=$lb0_uuid)
+check ovn-nbctl --wait=sb add logical_router r1 load_balancer_group $lbg_uuid
+
+sleep_northd
+check ovn-nbctl remove logical_router r1 load_balancer_group $lbg_uuid
+check ovn-nbctl lr-del r0
+check ovn-nbctl lr-del r1
+wake_up_northd
+
+check ovn-nbctl --wait=sb sync
+
+AT_CHECK([grep -q "referential integrity violation" northd/ovn-northd.log], 
[1])
+
+OVN_CLEANUP_NORTHD
+AT_CLEANUP
+])
-- 
2.47.1

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

Reply via email to