Minor (non-functional) fixes to commit 4023d6a5fa57.
1. Fix typo of function name: collect_lb_groups_for_ha_chassis_groups
2. Update the comments of the collect_lb_groups_for_ha_chassis_groups
   function to avoid confusion.
3. Rename tmp_ha_chassis to tmp_ha_ref_chassis, because HA chassis is
   more like the chassis belonging to a HA chassis group.

Fixes: 4023d6a5fa57 ("northd: Fix recompute of referenced chassis in HA chassis 
groups.")
Signed-off-by: Han Zhou <[email protected]>
---
 northd/northd.c | 52 +++++++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 25 deletions(-)

diff --git a/northd/northd.c b/northd/northd.c
index e9cb906e2aa4..bb56bfac6c0f 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -801,7 +801,7 @@ struct lrouter_group {
     /* Set of ha_chassis_groups which are associated with the router dps. */
     struct sset ha_chassis_groups;
     /* Temporary storage for chassis references while computing HA groups. */
-    struct hmapx tmp_ha_chassis;
+    struct hmapx tmp_ha_ref_chassis;
 };
 
 static struct ovn_datapath *
@@ -8762,7 +8762,7 @@ build_lrouter_groups(struct hmap *lr_ports, struct 
ovs_list *lr_list)
             od->lr_group->router_dps[0] = od;
             od->lr_group->n_router_dps = 1;
             sset_init(&od->lr_group->ha_chassis_groups);
-            hmapx_init(&od->lr_group->tmp_ha_chassis);
+            hmapx_init(&od->lr_group->tmp_ha_ref_chassis);
             build_lrouter_groups__(lr_ports, od);
         }
     }
@@ -17250,7 +17250,7 @@ destroy_datapaths_and_ports(struct ovn_datapaths 
*ls_datapaths,
 
             free(lr_group->router_dps);
             sset_destroy(&lr_group->ha_chassis_groups);
-            hmapx_destroy(&lr_group->tmp_ha_chassis);
+            hmapx_destroy(&lr_group->tmp_ha_ref_chassis);
             free(lr_group);
         }
     }
@@ -17609,27 +17609,28 @@ update_sb_ha_group_ref_chassis(
     hmap_destroy(&ha_ch_grps);
 }
 
-/* This function checks if the port binding 'sb' references
- * a HA chassis group.
- * Eg. Suppose a distributed logical router port - lr0-public
- * uses an HA chassis group - hagrp1 and if hagrp1 has 3 ha
- * chassis - gw1, gw2 and gw3.
+/* This function and the next function build_ha_chassis_group_ref_chassis
+ * build the reference chassis 'ref_chassis' for each HA chassis group.
+ *
+ * Suppose a distributed logical router port - lr0-public uses an HA chassis
+ * group - hagrp1 and if hagrp1 has 3 ha chassis - gw1, gw2 and gw3.
  * Or
- * If the distributed logical router port - lr0-public has
- * 3 gateway chassis - gw1, gw2 and gw3.
- * ovn-northd creates ha chassis group - hagrp1 in SB DB
- * and adds gw1, gw2 and gw3 to its ha_chassis list.
+ * If the distributed logical router port - lr0-public has 3 gateway chassis -
+ * gw1, gw2 and gw3.
+ *
+ * ovn-northd creates ha chassis group - hagrp1 in SB DB and adds gw1, gw2 and
+ * gw3 to its ha_chassis list.
  *
- * If port binding 'sb' represents a logical switch port 'p1'
- * and its logical switch is connected to the logical router
- * 'lr0' directly or indirectly (i.e p1's logical switch is
- *  connected to a router 'lr1' and 'lr1' has a path to lr0 via
- *  transit logical switches) and 'sb' is claimed by chassis - 'c1' then
- * this function adds c1 to the list of the reference chassis
- *  - 'ref_chassis' of hagrp1.
+ * If port binding 'sb' represents a logical switch port 'p1' and its logical
+ * switch is connected to the logical router 'lr0' directly or indirectly (i.e
+ * p1's logical switch is connected to a router 'lr1' and 'lr1' has a path to
+ * lr0 via transit logical switches) and 'sb' is claimed by chassis - 'c1' then
+ * this function adds c1 to the 'tmp_ha_ref_chassis' of lr_group, and later the
+ * function build_ha_chassis_group_ref_chassis will add these chassis to the
+ * list of the reference chassis - 'ref_chassis' of hagrp1.
  */
 static void
-collect_lb_groups_for_ha_chassis_groups(const struct sbrec_port_binding *sb,
+collect_lr_groups_for_ha_chassis_groups(const struct sbrec_port_binding *sb,
                                         struct ovn_port *op,
                                         struct hmapx *lr_groups)
 {
@@ -17651,7 +17652,7 @@ collect_lb_groups_for_ha_chassis_groups(const struct 
sbrec_port_binding *sb,
     }
 
     hmapx_add(lr_groups, lr_group);
-    hmapx_add(&lr_group->tmp_ha_chassis, sb->chassis);
+    hmapx_add(&lr_group->tmp_ha_ref_chassis, sb->chassis);
 }
 
 static void
@@ -17678,11 +17679,12 @@ build_ha_chassis_group_ref_chassis(struct 
ovsdb_idl_index *ha_ch_grp_by_name,
                 shash_find_data(ha_ref_chassis_map, sb_ha_chassis_grp->name);
             ovs_assert(ref_ch_info);
 
-            add_to_ha_ref_chassis_info(ref_ch_info, &lr_group->tmp_ha_chassis);
+            add_to_ha_ref_chassis_info(ref_ch_info,
+                                       &lr_group->tmp_ha_ref_chassis);
         }
 
-        hmapx_destroy(&lr_group->tmp_ha_chassis);
-        hmapx_init(&lr_group->tmp_ha_chassis);
+        hmapx_destroy(&lr_group->tmp_ha_ref_chassis);
+        hmapx_init(&lr_group->tmp_ha_ref_chassis);
     }
 }
 
@@ -17777,7 +17779,7 @@ handle_port_binding_changes(struct ovsdb_idl_txn 
*ovnsb_txn,
         if (build_ha_chassis_ref && ovnsb_txn && sb->chassis) {
             /* Check and collect the chassis which has claimed this 'sb'
              * in relation to LR groups. */
-            collect_lb_groups_for_ha_chassis_groups(sb, op, &lr_groups);
+            collect_lr_groups_for_ha_chassis_groups(sb, op, &lr_groups);
         }
     }
 
-- 
2.38.1

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

Reply via email to