On Fri, Aug 30, 2024 at 10:28 AM Xavier Simonart <[email protected]> wrote:
> Signed-off-by: Xavier Simonart <[email protected]> > --- > Hi Xavier, I have two small comments down below. > controller/local_data.c | 15 +++++++++++++++ > controller/local_data.h | 2 ++ > controller/ovn-controller.c | 15 +++++++++++++++ > 3 files changed, 32 insertions(+) > > diff --git a/controller/local_data.c b/controller/local_data.c > index f889fb76b..b44975c83 100644 > --- a/controller/local_data.c > +++ b/controller/local_data.c > @@ -231,6 +231,21 @@ add_local_datapath_peer_port( > local_datapath_peer_port_add(peer_ld, peer, pb); > } > > +void > +local_data_dump_peer_ports(struct hmap *local_datapaths, struct ds > *peer_ports) > +{ > + struct local_datapath *ld; > + size_t i = 0; > + HMAP_FOR_EACH (ld, hmap_node, local_datapaths) { > + const char *name = smap_get(&ld->datapath->external_ids, "name"); > Should we skip anything that doesn't have a name in external_ids? Maybe smap_get_def with some sensible default e.g. "<UNKNOWN>". > + for (i = 0; i < ld->n_peer_ports; i++) { > + ds_put_format(peer_ports, "dp %s : local = %s, remote = %s\n", > + name, ld->peer_ports[i].local->logical_port, > + ld->peer_ports[i].remote->logical_port); > Seems like the formatting is slightly off here. > + } > + } > +} > + > void > remove_local_datapath_peer_port(const struct sbrec_port_binding *pb, > struct local_datapath *ld, > diff --git a/controller/local_data.h b/controller/local_data.h > index 632f34b51..ab8e789a5 100644 > --- a/controller/local_data.h > +++ b/controller/local_data.h > @@ -173,5 +173,7 @@ void remove_local_datapath_multichassis_port(struct > local_datapath *ld, > char *logical_port); > bool lb_is_local(const struct sbrec_load_balancer *sbrec_lb, > const struct hmap *local_datapaths); > +void local_data_dump_peer_ports(struct hmap *local_datapaths, > + struct ds *peer_ports); > > #endif /* controller/local_data.h */ > diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c > index c48667887..983bbce9c 100644 > --- a/controller/ovn-controller.c > +++ b/controller/ovn-controller.c > @@ -101,6 +101,7 @@ static unixctl_cb_func debug_status_execution; > static unixctl_cb_func debug_dump_local_bindings; > static unixctl_cb_func debug_dump_related_lports; > static unixctl_cb_func debug_dump_local_template_vars; > +static unixctl_cb_func debug_dump_peer_ports; > static unixctl_cb_func debug_dump_lflow_conj_ids; > static unixctl_cb_func lflow_cache_flush_cmd; > static unixctl_cb_func lflow_cache_show_stats_cmd; > @@ -5335,6 +5336,10 @@ main(int argc, char *argv[]) > debug_dump_lflow_conj_ids, > &lflow_output_data->conj_ids); > > + unixctl_command_register("debug/dump-peer-ports", "", 0, 0, > + debug_dump_peer_ports, > + &runtime_data->local_datapaths); > + > unixctl_command_register("debug/dump-local-template-vars", "", 0, 0, > debug_dump_local_template_vars, > &template_vars_data->local_templates); > @@ -6249,6 +6254,16 @@ debug_dump_related_lports(struct unixctl_conn > *conn, int argc OVS_UNUSED, > ds_destroy(&data); > } > > +static void > +debug_dump_peer_ports(struct unixctl_conn *conn, int argc OVS_UNUSED, > + const char *argv[] OVS_UNUSED, void > *local_datapaths) > +{ > + struct ds peer_ports = DS_EMPTY_INITIALIZER; > + local_data_dump_peer_ports(local_datapaths, &peer_ports); > + unixctl_command_reply(conn, ds_cstr(&peer_ports)); > + ds_destroy(&peer_ports); > +} > + > static void > debug_dump_lflow_conj_ids(struct unixctl_conn *conn, int argc OVS_UNUSED, > const char *argv[] OVS_UNUSED, void *conj_ids) > -- > 2.31.1 > > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > > Thanks, Ales -- Ales Musil Senior Software Engineer - OVN Core Red Hat EMEA <https://www.redhat.com> [email protected] <https://red.ht/sig> _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
