Skip to content

Commit

Permalink
northd: Fix relying on naming coincidences.
Browse files Browse the repository at this point in the history
We previous relied on the fact the the southbound Port_Binding gets the
same name as the Northbound port. However in all of the cases we use
this we already know the name the southbound port will have. Therefore we
just use this name, instead of getting it from northbound.

This is a prerequisite for later patches that use derived router ports.

Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Huettner <[email protected]>
Signed-off-by: Dumitru Ceara <[email protected]>
  • Loading branch information
felixhuettner authored and dceara committed Dec 12, 2024
1 parent 18464c7 commit 785a461
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions northd/northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3298,9 +3298,17 @@ ovn_port_update_sbrec(struct ovsdb_idl_txn *ovnsb_txn,
smap_init(&new);

if (is_cr_port(op)) {
smap_add(&new, "distributed-port", op->nbsp->name);
smap_add(&new, "distributed-port", op->primary_port->key);
} else if (router_port) {
smap_add(&new, "peer", router_port);
/* op->peer can be null if the peer is disabed. In this
* case we fall back to the router_port string which
* might be wrong, but since the port does not exist that
* does not matter. */
if (op->peer) {
smap_add(&new, "peer", op->peer->key);
} else {
smap_add(&new, "peer", router_port);
}
}
if (chassis) {
smap_add(&new, "l3gateway-chassis", chassis);
Expand Down Expand Up @@ -4016,7 +4024,7 @@ sync_pb_for_lrp(struct ovn_port *op,
lr_stateful_table_find_by_index(lr_stateful_table, op->od->index);
ovs_assert(lr_stateful_rec);

smap_add(&new, "distributed-port", op->nbrp->name);
smap_add(&new, "distributed-port", op->primary_port->key);

bool always_redirect =
!lr_stateful_rec->lrnat_rec->has_distributed_nat &&
Expand All @@ -4041,10 +4049,7 @@ sync_pb_for_lrp(struct ovn_port *op,
smap_add(&new, "peer", op->peer->key);
if (op->nbrp->ha_chassis_group ||
op->nbrp->n_gateway_chassis) {
char *redirect_name =
ovn_chassis_redirect_name(op->nbrp->name);
smap_add(&new, "chassis-redirect-port", redirect_name);
free(redirect_name);
smap_add(&new, "chassis-redirect-port", op->cr_port->key);
}
}
if (chassis_name) {
Expand Down

0 comments on commit 785a461

Please sign in to comment.