On 12/6/22 11:19, Vladislav Odintsov wrote: > Before this patch if one deletes transit switch through which there were > routes in ICSB:Route table, such routes were left forever in the DB. > > Now we validate that each ICSB:Route has an appropriate transit switch. > > Signed-off-by: Vladislav Odintsov <[email protected]> > --- > ic/ovn-ic.c | 40 +++++++++++++++++++++++++++ > tests/ovn-ic.at | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 113 insertions(+) > > diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c > index e5c193d9d..d3bc08761 100644 > --- a/ic/ovn-ic.c > +++ b/ic/ovn-ic.c > @@ -71,6 +71,7 @@ struct ic_context { > struct ovsdb_idl_index *icsbrec_port_binding_by_az; > struct ovsdb_idl_index *icsbrec_port_binding_by_ts; > struct ovsdb_idl_index *icsbrec_port_binding_by_ts_az; > + struct ovsdb_idl_index *icsbrec_route_by_az; > struct ovsdb_idl_index *icsbrec_route_by_ts; > struct ovsdb_idl_index *icsbrec_route_by_ts_az; > }; > @@ -1612,6 +1613,38 @@ advertise_lr_routes(struct ic_context *ctx, > hmap_destroy(&routes_ad); > } > > +static void > +delete_orphan_ic_routes(struct ic_context *ctx, > + const struct icsbrec_availability_zone *az) > +{ > + const struct icsbrec_route *isb_route, *isb_route_key = > + icsbrec_route_index_init_row(ctx->icsbrec_route_by_az); > + icsbrec_route_index_set_availability_zone(isb_route_key, az); > + > + const struct icnbrec_transit_switch *t_sw, *t_sw_key; > + > + ICSBREC_ROUTE_FOR_EACH_EQUAL (isb_route, isb_route_key, > + ctx->icsbrec_route_by_az) > + { > + t_sw_key = icnbrec_transit_switch_index_init_row( > + ctx->icnbrec_transit_switch_by_name); > + icnbrec_transit_switch_index_set_name(t_sw_key, > + isb_route->transit_switch); > + t_sw = icnbrec_transit_switch_index_find( > + ctx->icnbrec_transit_switch_by_name, t_sw_key); > + icnbrec_transit_switch_index_destroy_row(t_sw_key); > + > + if (!t_sw) { > + VLOG_WARN("Deleting orphan ICDB:Route: %s->%s (%s, rtb:%s, " > + "transit switch: %s)", isb_route->ip_prefix, > + isb_route->nexthop, isb_route->origin, > + isb_route->route_table, isb_route->transit_switch);
I guess this slipped through. We agreed to change this to VLOG_INFO_RL in v1. With that addressed please feel free to add my ack to v3: Acked-by: Dumitru Ceara <[email protected]> Thanks! _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
