diff mbox series

[ovs-dev] northd: Populate additional-chassis to HA group.

Message ID 20241011075928.325372-1-alekssmirnov@k2.cloud
State Accepted
Headers show
Series [ovs-dev] northd: Populate additional-chassis to HA group. | 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

Aleksandr Smirnov (K2 Cloud) Oct. 11, 2024, 7:59 a.m. UTC
From: Aleksandr Smirnov <AleksSmirnov@k2.cloud>

    northd does not populate Port_Binding:additional-chassis to
    Ha_Chassis_Group:ref_chassis, so, bfd session is not created
    for such chassis.

    The fix populates additional chassis to ref chassis.

Signed-off-by: Aleksandr Smirnov <AleksSmirnov@k2.cloud>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2024-September/417293.html
Reported-by: Vladislav Odintsov <vlodintsov@k2.cloud>
Tested-by: Vladislav Odintsov <vlodintsov@k2.cloud>
---
 northd/northd.c     | 13 +++++++++++--
 tests/ovn-northd.at |  7 +++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

Comments

Numan Siddique Nov. 13, 2024, 2:14 a.m. UTC | #1
On Fri, Oct 11, 2024 at 4:00 AM Aleksandr Smirnov <alekssmirnov@k2.cloud> wrote:
>
> From: Aleksandr Smirnov <AleksSmirnov@k2.cloud>
>
>     northd does not populate Port_Binding:additional-chassis to
>     Ha_Chassis_Group:ref_chassis, so, bfd session is not created
>     for such chassis.
>
>     The fix populates additional chassis to ref chassis.
>
> Signed-off-by: Aleksandr Smirnov <AleksSmirnov@k2.cloud>
> Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2024-September/417293.html
> Reported-by: Vladislav Odintsov <vlodintsov@k2.cloud>
> Tested-by: Vladislav Odintsov <vlodintsov@k2.cloud>

Thanks for the patch.  I applied to main and will backport to branches
24.09, 24.03 and 23.09 once the CI runs are successful.

Numan

> ---
>  northd/northd.c     | 13 +++++++++++--
>  tests/ovn-northd.at |  7 +++++++
>  2 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/northd/northd.c b/northd/northd.c
> index 0aa0de637..088617aae 100644
> --- a/northd/northd.c
> +++ b/northd/northd.c
> @@ -19041,7 +19041,14 @@ collect_lr_groups_for_ha_chassis_groups(const struct sbrec_port_binding *sb,
>      }
>
>      hmapx_add(lr_groups, lr_group);
> -    hmapx_add(&lr_group->tmp_ha_ref_chassis, sb->chassis);
> +
> +    if (sb->chassis) {
> +        hmapx_add(&lr_group->tmp_ha_ref_chassis, sb->chassis);
> +    }
> +
> +    for (size_t i = 0; i < sb->n_additional_chassis; i++) {
> +        hmapx_add(&lr_group->tmp_ha_ref_chassis, sb->additional_chassis[i]);
> +    }
>  }
>
>  static void
> @@ -19158,7 +19165,9 @@ handle_port_binding_changes(struct ovsdb_idl_txn *ovnsb_txn,
>              sbrec_port_binding_set_up(op->sb, &up, 1);
>          }
>
> -        if (build_ha_chassis_ref && ovnsb_txn && sb->chassis) {
> +        if (build_ha_chassis_ref
> +            && ovnsb_txn
> +            && (sb->chassis || sb->n_additional_chassis)) {
>              /* Check and collect the chassis which has claimed this 'sb'
>               * in relation to LR groups. */
>              collect_lr_groups_for_ha_chassis_groups(sb, op, &lr_groups);
> diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
> index d6a8c4640..e295c721d 100644
> --- a/tests/ovn-northd.at
> +++ b/tests/ovn-northd.at
> @@ -572,6 +572,7 @@ check ovn-sbctl chassis-add ch2 geneve 127.0.0.3
>  check ovn-sbctl chassis-add ch3 geneve 127.0.0.4
>  check ovn-sbctl chassis-add comp1 geneve 127.0.0.5
>  check ovn-sbctl chassis-add comp2 geneve 127.0.0.6
> +check ovn-sbctl chassis-add cadd1 geneve 127.0.0.7
>
>  check ovn-nbctl lrp-add lr0 lr0-sw0 00:00:20:20:12:14 10.0.0.1/24
>  check ovn-nbctl lsp-add sw0 sw0-lr0
> @@ -584,11 +585,17 @@ wait_row_count nb:Logical_Switch_Port 1 name=sw0-p1 up=true
>
>  comp1_ch_uuid=$(fetch_column Chassis _uuid name=comp1)
>  comp2_ch_uuid=$(fetch_column Chassis _uuid name=comp2)
> +cadd1_ch_uuid=$(fetch_column Chassis _uuid name=cadd1)
> +
>  ch2_ch_uuid=$comp1_ch_uuid
>
>  # Check ref_chassis.
>  echo "comp1_ch_uuid = $comp1_ch_uuid"
>  wait_column "$comp1_ch_uuid" HA_Chassis_Group ref_chassis
> +ovn-sbctl set Port_Binding sw0-p1 additional_chassis=$cadd1_ch_uuid
> +wait_column "$cadd1_ch_uuid $comp1_ch_uuid" HA_Chassis_Group ref_chassis
> +ovn-sbctl clear Port_Binding sw0-p1 additional_chassis
> +wait_column "$comp1_ch_uuid" HA_Chassis_Group ref_chassis
>
>  # unbind sw0-p1
>  ovn-sbctl lsp-unbind sw0-p1
> --
> 2.46.2
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/northd/northd.c b/northd/northd.c
index 0aa0de637..088617aae 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -19041,7 +19041,14 @@  collect_lr_groups_for_ha_chassis_groups(const struct sbrec_port_binding *sb,
     }
 
     hmapx_add(lr_groups, lr_group);
-    hmapx_add(&lr_group->tmp_ha_ref_chassis, sb->chassis);
+
+    if (sb->chassis) {
+        hmapx_add(&lr_group->tmp_ha_ref_chassis, sb->chassis);
+    }
+
+    for (size_t i = 0; i < sb->n_additional_chassis; i++) {
+        hmapx_add(&lr_group->tmp_ha_ref_chassis, sb->additional_chassis[i]);
+    }
 }
 
 static void
@@ -19158,7 +19165,9 @@  handle_port_binding_changes(struct ovsdb_idl_txn *ovnsb_txn,
             sbrec_port_binding_set_up(op->sb, &up, 1);
         }
 
-        if (build_ha_chassis_ref && ovnsb_txn && sb->chassis) {
+        if (build_ha_chassis_ref
+            && ovnsb_txn
+            && (sb->chassis || sb->n_additional_chassis)) {
             /* Check and collect the chassis which has claimed this 'sb'
              * in relation to LR groups. */
             collect_lr_groups_for_ha_chassis_groups(sb, op, &lr_groups);
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index d6a8c4640..e295c721d 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -572,6 +572,7 @@  check ovn-sbctl chassis-add ch2 geneve 127.0.0.3
 check ovn-sbctl chassis-add ch3 geneve 127.0.0.4
 check ovn-sbctl chassis-add comp1 geneve 127.0.0.5
 check ovn-sbctl chassis-add comp2 geneve 127.0.0.6
+check ovn-sbctl chassis-add cadd1 geneve 127.0.0.7
 
 check ovn-nbctl lrp-add lr0 lr0-sw0 00:00:20:20:12:14 10.0.0.1/24
 check ovn-nbctl lsp-add sw0 sw0-lr0
@@ -584,11 +585,17 @@  wait_row_count nb:Logical_Switch_Port 1 name=sw0-p1 up=true
 
 comp1_ch_uuid=$(fetch_column Chassis _uuid name=comp1)
 comp2_ch_uuid=$(fetch_column Chassis _uuid name=comp2)
+cadd1_ch_uuid=$(fetch_column Chassis _uuid name=cadd1)
+
 ch2_ch_uuid=$comp1_ch_uuid
 
 # Check ref_chassis.
 echo "comp1_ch_uuid = $comp1_ch_uuid"
 wait_column "$comp1_ch_uuid" HA_Chassis_Group ref_chassis
+ovn-sbctl set Port_Binding sw0-p1 additional_chassis=$cadd1_ch_uuid
+wait_column "$cadd1_ch_uuid $comp1_ch_uuid" HA_Chassis_Group ref_chassis
+ovn-sbctl clear Port_Binding sw0-p1 additional_chassis
+wait_column "$comp1_ch_uuid" HA_Chassis_Group ref_chassis
 
 # unbind sw0-p1
 ovn-sbctl lsp-unbind sw0-p1