There is a need to refactor by cleaning up the remaining code from the 'ic' engine-node after completing the decentralization from a single engine to multiple engines. In the dependency graph of the incremental processing engine (I+P), it becomes the output node.
Signed-off-by: Paulo Guilherme Silva <[email protected]> --- ic/en-ic.c | 100 ++---------------------------------------- ic/en-ic.h | 6 --- ic/inc-proc-ic.c | 18 -------- ic/ovn-ic.c | 21 --------- ic/ovn-ic.h | 38 ---------------- lib/stopwatch-names.h | 1 - 6 files changed, 4 insertions(+), 180 deletions(-) diff --git a/ic/en-ic.c b/ic/en-ic.c index ecdc1ab5d..0e7f510db 100644 --- a/ic/en-ic.c +++ b/ic/en-ic.c @@ -19,90 +19,15 @@ #include <stdio.h> /* OVS includes. */ -#include "openvswitch/vlog.h" +#include "openvswitch/util.h" /* OVN includes. */ -#include "ovn-ic.h" #include "en-ic.h" -#include "en-enum-datapaths.h" -#include "lib/ovn-ic-sb-idl.h" #include "lib/inc-proc-eng.h" -#include "lib/ovn-util.h" -#include "lib/stopwatch-names.h" -#include "coverage.h" -#include "stopwatch.h" -#include "stopwatch-names.h" - -VLOG_DEFINE_THIS_MODULE(en_ic); -COVERAGE_DEFINE(ic_run); - -void ic_destroy(struct ic_data *data); -void ic_init(struct ic_data *data); - -static void -ic_get_input_data(struct engine_node *node, - struct ic_input *input_data) -{ - /* Table references */ - input_data->nbrec_logical_switch_table = - EN_OVSDB_GET(engine_get_input("NB_logical_switch", node)); - input_data->nbrec_logical_router_table = - EN_OVSDB_GET(engine_get_input("NB_logical_router", node)); - input_data->sbrec_chassis_table = - EN_OVSDB_GET(engine_get_input("SB_chassis", node)); - input_data->icsbrec_ic_sb_global_table = - EN_OVSDB_GET(engine_get_input("ICSB_ic_sb_global", node)); - input_data->icsbrec_availability_zone_table = - EN_OVSDB_GET(engine_get_input("ICSB_availability_zone", node)); - - /* Indexes */ - input_data->nbrec_ls_by_name = - engine_ovsdb_node_get_index( - engine_get_input("NB_logical_switch", node), - "nbrec_ls_by_name"); - input_data->nbrec_lr_by_name = - engine_ovsdb_node_get_index( - engine_get_input("NB_logical_router", node), - "nbrec_lr_by_name"); - input_data->nbrec_lrp_by_name = - engine_ovsdb_node_get_index( - engine_get_input("NB_logical_router", node), - "nbrec_lrp_by_name"); - input_data->nbrec_port_by_name = - engine_ovsdb_node_get_index( - engine_get_input("NB_logical_switch", node), - "nbrec_port_by_name"); - input_data->sbrec_chassis_by_name = - engine_ovsdb_node_get_index( - engine_get_input("SB_chassis", node), - "sbrec_chassis_by_name"); -} enum engine_node_state -en_ic_run(struct engine_node *node, void *data) +en_ic_run(struct engine_node *node OVS_UNUSED, void *data OVS_UNUSED) { - const struct engine_context *eng_ctx = engine_get_context(); - struct ic_data *ic_data = data; - struct ic_input input_data; - - struct ed_type_enum_datapaths *dp_node_data = - engine_get_input_data("enum_datapaths", node); - - if (!dp_node_data) { - return EN_UNCHANGED; - } - - ic_data->dp_tnlids = &dp_node_data->dp_tnlids; - ic_data->isb_ts_dps = &dp_node_data->isb_ts_dps; - ic_data->isb_tr_dps = &dp_node_data->isb_tr_dps; - - ic_get_input_data(node, &input_data); - input_data.runned_az = eng_ctx->client_ctx; - - COVERAGE_INC(ic_run); - stopwatch_start(IC_OVN_DB_RUN_STOPWATCH_NAME, time_msec()); - ovn_db_run(&input_data, ic_data, (struct engine_context *) eng_ctx); - stopwatch_stop(IC_OVN_DB_RUN_STOPWATCH_NAME, time_msec()); return EN_UPDATED; } @@ -110,28 +35,11 @@ void * en_ic_init(struct engine_node *node OVS_UNUSED, struct engine_arg *arg OVS_UNUSED) { - struct ic_data *data = xzalloc(sizeof *data); - - ic_init(data); - - return data; -} - -void -en_ic_cleanup(void *data) -{ - ic_destroy(data); + return NULL; } void -ic_destroy(struct ic_data *data OVS_UNUSED) +en_ic_cleanup(void *data OVS_UNUSED) { -} -void -ic_init(struct ic_data *data) -{ - data->dp_tnlids = NULL; - data->isb_ts_dps = NULL; - data->isb_tr_dps = NULL; } diff --git a/ic/en-ic.h b/ic/en-ic.h index ab1fbaf42..13db7570a 100644 --- a/ic/en-ic.h +++ b/ic/en-ic.h @@ -1,12 +1,6 @@ #ifndef EN_IC_H #define EN_IC_H 1 -#include <config.h> - -#include <getopt.h> -#include <stdlib.h> -#include <stdio.h> - #include "lib/inc-proc-eng.h" enum engine_node_state en_ic_run(struct engine_node *node OVS_UNUSED, diff --git a/ic/inc-proc-ic.c b/ic/inc-proc-ic.c index 0fe787a19..10b7c86f7 100644 --- a/ic/inc-proc-ic.c +++ b/ic/inc-proc-ic.c @@ -43,9 +43,7 @@ VLOG_DEFINE_THIS_MODULE(inc_proc_ic); NB_NODE(nb_global, "nb_global") \ NB_NODE(logical_router_static_route, "logical_router_static_route") \ NB_NODE(logical_router, "logical_router") \ - NB_NODE(logical_router_port, "logical_router_port") \ NB_NODE(logical_switch, "logical_switch") \ - NB_NODE(logical_switch_port, "logical_switch_port") \ NB_NODE(load_balancer, "load_balancer") \ NB_NODE(load_balancer_group, "load_balancer_group") @@ -68,8 +66,6 @@ VLOG_DEFINE_THIS_MODULE(inc_proc_ic); #define SB_NODES \ SB_NODE(sb_global, "sb_global") \ SB_NODE(chassis, "chassis") \ - SB_NODE(encap, "encap") \ - SB_NODE(datapath_binding, "datapath_binding") \ SB_NODE(port_binding, "port_binding") \ SB_NODE(service_monitor, "service_monitor") @@ -112,8 +108,6 @@ VLOG_DEFINE_THIS_MODULE(inc_proc_ic); #undef ICNB_NODE #define ICSB_NODES \ - ICSB_NODE(ic_sb_global, "ic_sb_global") \ - ICSB_NODE(availability_zone, "availability_zone") \ ICSB_NODE(service_monitor, "service_monitor") \ ICSB_NODE(route, "route") \ ICSB_NODE(datapath_binding, "datapath_binding") \ @@ -230,18 +224,6 @@ void inc_proc_ic_init(struct ovsdb_idl_loop *nb, engine_add_input(&en_ic, &en_route, NULL); engine_add_input(&en_ic, &en_srv_mon, NULL); - engine_add_input(&en_ic, &en_nb_logical_router, NULL); - engine_add_input(&en_ic, &en_nb_logical_router_port, NULL); - engine_add_input(&en_ic, &en_nb_logical_switch, NULL); - engine_add_input(&en_ic, &en_nb_logical_switch_port, NULL); - - engine_add_input(&en_ic, &en_sb_chassis, NULL); - engine_add_input(&en_ic, &en_sb_encap, NULL); - engine_add_input(&en_ic, &en_sb_datapath_binding, NULL); - - engine_add_input(&en_ic, &en_icsb_ic_sb_global, NULL); - engine_add_input(&en_ic, &en_icsb_availability_zone, NULL); - struct engine_arg engine_arg = { .nb_idl = nb->idl, .sb_idl = sb->idl, diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c index 3406c4d5d..35e4a80ba 100644 --- a/ic/ovn-ic.c +++ b/ic/ovn-ic.c @@ -20,32 +20,19 @@ #include <stdlib.h> #include <stdio.h> -#include "bitmap.h" #include "command-line.h" #include "daemon.h" -#include "dirs.h" -#include "openvswitch/dynamic-string.h" #include "fatal-signal.h" -#include "hash.h" -#include "openvswitch/hmap.h" #include "lib/ovn-ic-nb-idl.h" #include "lib/ovn-ic-sb-idl.h" #include "lib/ovn-nb-idl.h" #include "lib/ovn-sb-idl.h" -#include "lib/ovn-util.h" #include "memory.h" #include "openvswitch/poll-loop.h" -#include "ovsdb-idl.h" #include "simap.h" -#include "smap.h" -#include "sset.h" #include "stream.h" #include "stream-ssl.h" -#include "unixctl.h" -#include "util.h" -#include "uuid.h" #include "openvswitch/vlog.h" -#include "vec.h" #include "inc-proc-ic.h" #include "ovn-ic.h" #include "stopwatch-names.h" @@ -358,13 +345,6 @@ inc_proc_graph_dump(const char *end_node) ovsdb_idl_loop_destroy(&ovnisb_idl_loop); } -void -ovn_db_run(struct ic_input *input_data OVS_UNUSED, - struct ic_data *ic_data OVS_UNUSED, - struct engine_context *eng_ctx OVS_UNUSED) -{ - -} static void parse_options(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) @@ -765,7 +745,6 @@ main(int argc, char *argv[]) ovn_conn_show, ovnisb_idl_loop.idl); stopwatch_create(OVN_IC_LOOP_STOPWATCH_NAME, SW_MS); - stopwatch_create(IC_OVN_DB_RUN_STOPWATCH_NAME, SW_MS); stopwatch_create(OVN_IC_ENUM_DATAPATHS_RUN_STOPWATCH_NAME, SW_MS); stopwatch_create(OVN_IC_PORT_BINDING_RUN_STOPWATCH_NAME, SW_MS); stopwatch_create(OVN_IC_ROUTE_RUN_STOPWATCH_NAME, SW_MS); diff --git a/ic/ovn-ic.h b/ic/ovn-ic.h index f60e218f6..7cb346c7d 100644 --- a/ic/ovn-ic.h +++ b/ic/ovn-ic.h @@ -18,42 +18,6 @@ #include "unixctl.h" #include "lib/inc-proc-eng.h" -struct ic_input { - /* Northbound table references */ - const struct nbrec_logical_switch_table *nbrec_logical_switch_table; - const struct nbrec_logical_router_table *nbrec_logical_router_table; - - /* Southbound table references */ - const struct sbrec_chassis_table *sbrec_chassis_table; - const struct sbrec_sb_global_table *sbrec_sb_global_table; - - /* InterconnectNorthbound table references */ - const struct icnbrec_transit_switch_table *icnbrec_transit_switch_table; - - /* InterconnectSouthbound table references */ - const struct icsbrec_encap_table *icsbrec_encap_table; - const struct icsbrec_ic_sb_global_table *icsbrec_ic_sb_global_table; - const struct icsbrec_datapath_binding_table - *icsbrec_datapath_binding_table; - const struct icsbrec_availability_zone_table - *icsbrec_availability_zone_table; - - /* Indexes */ - const struct icsbrec_availability_zone *runned_az; - struct ovsdb_idl_index *nbrec_ls_by_name; - struct ovsdb_idl_index *nbrec_lr_by_name; - struct ovsdb_idl_index *nbrec_lrp_by_name; - struct ovsdb_idl_index *nbrec_port_by_name; - struct ovsdb_idl_index *sbrec_chassis_by_name; - struct ovsdb_idl_index *sbrec_port_binding_by_name; -}; - -struct ic_data { - /* Global state for 'en-enum-datapaths'. */ - struct hmap *dp_tnlids; - struct shash *isb_ts_dps; - struct shash *isb_tr_dps; -}; struct ic_state { bool had_lock; bool paused; @@ -84,7 +48,5 @@ enum ic_port_binding_type const struct icsbrec_availability_zone * az_run(struct ovsdb_idl *ovnnb_idl, struct ovsdb_idl *ovnisb_idl, struct ovsdb_idl_txn *ovnisb_idl_txn); -void ovn_db_run(struct ic_input *input_data, struct ic_data *ic_data, - struct engine_context *eng_ctx); #endif /* OVN_IC_H */ diff --git a/lib/stopwatch-names.h b/lib/stopwatch-names.h index ec4edf83c..b3f8dd1f5 100644 --- a/lib/stopwatch-names.h +++ b/lib/stopwatch-names.h @@ -41,7 +41,6 @@ #define GROUP_ECMP_ROUTE_RUN_STOPWATCH_NAME "group_ecmp_route" #define OVN_IC_LOOP_STOPWATCH_NAME "ovn-ic-loop" -#define IC_OVN_DB_RUN_STOPWATCH_NAME "ovn_db_run" #define OVN_IC_GATEWAY_RUN_STOPWATCH_NAME "gateway_run" #define OVN_IC_ENUM_DATAPATHS_RUN_STOPWATCH_NAME "enum_datapaths_run" #define OVN_IC_TRANSIT_SWITCH_RUN_STOPWATCH_NAME "transit_switch_run" -- 2.34.1 -- _'Esta mensagem é direcionada apenas para os endereços constantes no cabeçalho inicial. Se você não está listado nos endereços constantes no cabeçalho, pedimos-lhe que desconsidere completamente o conteúdo dessa mensagem e cuja cópia, encaminhamento e/ou execução das ações citadas estão imediatamente anuladas e proibidas'._ * **'Apesar do Magazine Luiza tomar todas as precauções razoáveis para assegurar que nenhum vírus esteja presente nesse e-mail, a empresa não poderá aceitar a responsabilidade por quaisquer perdas ou danos causados por esse e-mail ou por seus anexos'.* _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
