When a LSP has multiple requested-chassis specified, northd will set
requested_additional_chassis column in SB port_binding, and
ovn-controller on one or more chassis will claim the LSP and update the
SB port_binding record's options:additional-chassis-activated.

When the LSP is updated with only one (or no) chassis left in
requested-chassis, northd will clear the requested_additional_chassis
of the SB port_binding, and later when the SB port_binding update
notification come back to northd, it will see that there is no
requested_additional_chassis and then clear the
options:additional-chassis-activated accordingly. This is very
inefficient. It requires two round-trips just to clear the SB
port_binding's options:additional-chassis-activated.

The second round-trip is essentially a change to SB DB made by northd,
which is triggered by another SB DB change also made by northd, which is
in fact unnecessary. When the LSP is updated, northd can directly update
the options:additional-chassis-activated when the column
requested_additional_chassis is updated at the same time.

Signed-off-by: Han Zhou <[email protected]>
---
 northd/northd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/northd/northd.c b/northd/northd.c
index f65b69848a09..2dbcf219dcc9 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -3564,6 +3564,9 @@ ovn_port_update_sbrec(struct ovsdb_idl_txn *ovnsb_txn,
                 smap_add(&options, "vlan-passthru", "true");
             }
 
+            ovn_port_update_sbrec_chassis(sbrec_chassis_by_name,
+                                          sbrec_chassis_by_hostname, op);
+
             /* Retain activated chassis flags. */
             if (op->sb->requested_additional_chassis) {
                 const char *activated_str = smap_get(
@@ -3610,9 +3613,6 @@ ovn_port_update_sbrec(struct ovsdb_idl_txn *ovnsb_txn,
                  * ha_chassis_group cleared in the same transaction. */
                 sbrec_port_binding_set_ha_chassis_group(op->sb, NULL);
             }
-
-            ovn_port_update_sbrec_chassis(sbrec_chassis_by_name,
-                                          sbrec_chassis_by_hostname, op);
         } else {
             const char *chassis = NULL;
             if (op->peer && op->peer->od && op->peer->od->nbr) {
-- 
2.30.2

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

Reply via email to