Restore inter-AZ connectivity during OVN upgrades by allowing
legacy routes (without lr-id) from different availability zones
to be learned. Previously, updated nodes skipped all routes
without lr-id, breaking connectivity to non-upgraded AZs.
The fix checks availability zone for legacy routes instead of
skipping them entirely, maintaining backward compatibility.
Fixes: b1f8d726390e ("ovn-ic: support learning routes in same AZ")
Signed-off-by: Alexandra Rukomoinikova <[email protected]>
Tested-by: Evgeniy Kovalev <[email protected]>
---
ic/ovn-ic.c | 20 +++++++++++--------
tests/ovn-ic.at | 53 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+), 8 deletions(-)
diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index 70b2ca28f..9a930df7d 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -1502,6 +1502,7 @@ lrp_is_ts_port(struct ic_context *ctx, struct
ic_router_info *ic_lr,
static void
sync_learned_routes(struct ic_context *ctx,
+ const struct icsbrec_availability_zone *az,
struct ic_router_info *ic_lr)
{
ovs_assert(ctx->ovnnb_txn);
@@ -1536,15 +1537,18 @@ sync_learned_routes(struct ic_context *ctx,
ICSBREC_ROUTE_FOR_EACH_EQUAL (isb_route, isb_route_key,
ctx->icsbrec_route_by_ts) {
+ /* Filters ICSB routes, skipping those that either belong to
+ * current logical router or are legacy routes from the current
+ * availability zone (withoud lr-id).
+ */
const char *lr_id = smap_get(&isb_route->external_ids, "lr-id");
- if (lr_id == NULL) {
- continue;
- }
struct uuid lr_uuid;
- if (!uuid_from_string(&lr_uuid, lr_id)) {
- continue;
- }
- if (uuid_equals(&ic_lr->lr->header_.uuid, &lr_uuid)) {
+ if (lr_id) {
+ if (!uuid_from_string(&lr_uuid, lr_id)
+ || uuid_equals(&ic_lr->lr->header_.uuid, &lr_uuid)) {
+ continue;
+ }
+ } else if (isb_route->availability_zone == az) {
continue;
}
@@ -1981,7 +1985,7 @@ route_run(struct ic_context *ctx,
struct shash routes_ad_by_ts = SHASH_INITIALIZER(&routes_ad_by_ts);
HMAP_FOR_EACH_SAFE (ic_lr, node, &ic_lrs) {
collect_lr_routes(ctx, ic_lr, &routes_ad_by_ts);
- sync_learned_routes(ctx, ic_lr);
+ sync_learned_routes(ctx, az, ic_lr);
free(ic_lr->isb_pbs);
hmap_destroy(&ic_lr->routes_learned);
hmap_remove(&ic_lrs, &ic_lr->node);
diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at
index 34bf04d7d..889a83535 100644
--- a/tests/ovn-ic.at
+++ b/tests/ovn-ic.at
@@ -3215,3 +3215,56 @@ OVN_CLEANUP_IC([az1], [az2])
AT_CLEANUP
])
+
+AT_BANNER([Learning routes backward compatibility])
+OVN_FOR_EACH_NORTHD([
+AT_SETUP([ovn-ic -- Backward compatibility of learning routes in the same AZ])
+
+ovn_init_ic_db
+ovn_start az1
+
+# Enable route learning at AZ level
+check ovn-nbctl set nb_global . options:ic-route-learn=true
+# Enable route advertising at AZ level
+check ovn-nbctl set nb_global . options:ic-route-adv=true
+
+# Create a fake availability zone to announce a route from.
+# This route will not have an lr-id in its external_ids, simulating
+# the behavior of the legacy code. The system is expected to
+# learn this route to maintain backward compatibility.
+check_uuid ovn-ic-sbctl create Availability_Zone name=fake_az
+fake_az_uuid=$(fetch_column ic-sb:availability-zone _uuid name="fake_az")
+check_uuid ovn-ic-sbctl create Gateway name=fake_az_gw
availability_zone=$fake_az_uuid \
+ encap=@encap -- --id=@encap create encap type=geneve ip="192.168.0.2"
+
+check ovn-ic-nbctl ts-add ts1
+check ovn-ic-nbctl ts-add ts2
+
+check ovn-nbctl lr-add lr1
+check ovn-nbctl lrp-add lr1 lrp-lr1-ts1 aa:aa:aa:aa:aa:02 169.254.100.1/24
+check ovn-nbctl lsp-add ts1 lsp-ts1-lr1 -- \
+ lsp-set-addresses lsp-ts1-lr1 router -- \
+ lsp-set-type lsp-ts1-lr1 router -- \
+ lsp-set-options lsp-ts1-lr1 router-port=lrp-lr1-ts1
+
+# Check ISB
+check_row_count ic-sb:Datapath_Binding 1 transit_switch=ts1
+check_row_count ic-sb:Datapath_Binding 1 transit_switch=ts2
+
+check_uuid ovn-ic-sbctl create Route availability_zone=$fake_az_uuid \
+ ip_prefix="172.31.0.0/24" nexthop="169.254.100.2" origin=connected \
+ transit_switch=ts1
+
+AT_CHECK([ovn-ic-sbctl find Route nexthop="169.254.100.2" | grep
external_ids], [0], [dnl
+external_ids : {}
+])
+
+AT_CHECK([ovn-nbctl lr-route-list lr1], [0], [dnl
+IPv4 Routes
+Route Table <main>:
+ 172.31.0.0/24 169.254.100.2 dst-ip (learned)
+])
+
+OVN_CLEANUP_IC([az1])
+AT_CLEANUP
+])
--
2.48.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev