On Mon, Jun 11, 2018 at 3:14 PM, Ben Pfaff <[email protected]> wrote: > > This was duplicate functionality. > > Signed-off-by: Ben Pfaff <[email protected]> > --- > ovn/controller/chassis.c | 5 +++-- > ovn/controller/chassis.h | 6 ++++-- > ovn/controller/ovn-controller.c | 24 ++++-------------------- > ovn/controller/ovn-controller.h | 3 --- > 4 files changed, 11 insertions(+), 27 deletions(-) > > diff --git a/ovn/controller/chassis.c b/ovn/controller/chassis.c > index c509e2fcab50..db5d2d03dbf6 100644 > --- a/ovn/controller/chassis.c > +++ b/ovn/controller/chassis.c > @@ -22,6 +22,7 @@ > #include "lib/vswitch-idl.h" > #include "openvswitch/dynamic-string.h" > #include "openvswitch/vlog.h" > +#include "ovn/lib/chassis-index.h" > #include "ovn/lib/ovn-sb-idl.h" > #include "ovn-controller.h" > #include "lib/util.h" > @@ -76,8 +77,8 @@ get_cms_options(const struct smap *ext_ids) > * amenable to a transaction. */ > const struct sbrec_chassis * > chassis_run(struct controller_ctx *ctx, > + struct ovsdb_idl_index *sbrec_chassis_by_name, > const struct ovsrec_open_vswitch_table *ovs_table, > - const struct sbrec_chassis_table *chassis_table, > const char *chassis_id, > const struct ovsrec_bridge *br_int) > { > @@ -139,7 +140,7 @@ chassis_run(struct controller_ctx *ctx, > const char *iface_types_str = ds_cstr(&iface_types); > > const struct sbrec_chassis *chassis_rec > - = get_chassis(chassis_table, chassis_id); > + = chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id); > const char *encap_csum = smap_get_def(&cfg->external_ids, > "ovn-encap-csum", "true"); > if (chassis_rec) { > diff --git a/ovn/controller/chassis.h b/ovn/controller/chassis.h > index 6d4787854c1c..f5245c363683 100644 > --- a/ovn/controller/chassis.h > +++ b/ovn/controller/chassis.h > @@ -20,6 +20,7 @@ > > struct controller_ctx; > struct ovsdb_idl; > +struct ovsdb_idl_index; > struct ovsrec_bridge; > struct ovsrec_open_vswitch_table; > struct sbrec_chassis; > @@ -27,8 +28,9 @@ struct sbrec_chassis_table; > > void chassis_register_ovs_idl(struct ovsdb_idl *); > const struct sbrec_chassis *chassis_run( > - struct controller_ctx *, const struct ovsrec_open_vswitch_table *, > - const struct sbrec_chassis_table *, > + struct controller_ctx *, > + struct ovsdb_idl_index *sbrec_chassis_by_name, > + const struct ovsrec_open_vswitch_table *, > const char *chassis_id, const struct ovsrec_bridge *br_int); > bool chassis_cleanup(struct controller_ctx *, const struct sbrec_chassis *); > > diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c > index cd4208556de7..1754c51a0fcd 100644 > --- a/ovn/controller/ovn-controller.c > +++ b/ovn/controller/ovn-controller.c > @@ -94,21 +94,6 @@ get_local_datapath(const struct hmap *local_datapaths, uint32_t tunnel_key) > : NULL); > } > > -const struct sbrec_chassis * > -get_chassis(const struct sbrec_chassis_table *chassis_table, > - const char *chassis_id) > -{ > - const struct sbrec_chassis *chassis_rec; > - > - SBREC_CHASSIS_TABLE_FOR_EACH (chassis_rec, chassis_table) { > - if (!strcmp(chassis_rec->name, chassis_id)) { > - break; > - } > - } > - > - return chassis_rec; > -} > - > uint32_t > get_tunnel_type(const char *name) > { > @@ -691,9 +676,8 @@ main(int argc, char *argv[]) > > const struct sbrec_chassis *chassis = NULL; > if (chassis_id) { > - chassis = chassis_run(&ctx, > + chassis = chassis_run(&ctx, sbrec_chassis_by_name, > ovsrec_open_vswitch_table_get(ctx.ovs_idl), > - sbrec_chassis_table_get(ctx.ovnsb_idl), > chassis_id, br_int); > encaps_run(&ctx, > ovsrec_bridge_table_get(ctx.ovs_idl), br_int, > @@ -881,8 +865,6 @@ main(int argc, char *argv[]) > const struct ovsrec_open_vswitch_table *ovs_table > = ovsrec_open_vswitch_table_get(ctx.ovs_idl); > > - const struct sbrec_chassis_table *chassis_table > - = sbrec_chassis_table_get(ctx.ovnsb_idl); > const struct sbrec_port_binding_table *port_binding_table > = sbrec_port_binding_table_get(ctx.ovnsb_idl); > > @@ -890,7 +872,9 @@ main(int argc, char *argv[]) > ovs_table); > const char *chassis_id = get_chassis_id(ovs_table); > const struct sbrec_chassis *chassis > - = chassis_id ? get_chassis(chassis_table, chassis_id) : NULL; > + = (chassis_id > + ? chassis_lookup_by_name(sbrec_chassis_by_name, chassis_id) > + : NULL); > > /* Run all of the cleanup functions, even if one of them returns false. > * We're done if all of them return true. */ > diff --git a/ovn/controller/ovn-controller.h b/ovn/controller/ovn-controller.h > index 7a172a7879bd..6f4e961886ac 100644 > --- a/ovn/controller/ovn-controller.h > +++ b/ovn/controller/ovn-controller.h > @@ -78,9 +78,6 @@ struct local_datapath *get_local_datapath(const struct hmap *, > const struct ovsrec_bridge *get_bridge(const struct ovsrec_bridge_table *, > const char *br_name); > > -const struct sbrec_chassis *get_chassis(const struct sbrec_chassis_table *, > - const char *chassis_id); > - > /* Must be a bit-field ordered from most-preferred (higher number) to > * least-preferred (lower number). */ > enum chassis_tunnel_type { > -- > 2.16.1 > > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Acked-by: Han Zhou <[email protected]> _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
