From 996e1077aa5ddf4731aba5805e99c59168eab3f9 Mon Sep 17 00:00:00 2001 From: Dumitru Ceara Date: Mon, 2 Dec 2019 19:02:52 +0100 Subject: [PATCH ovn] ovn-controller: Add command to trigger an I-P full recompute. Incremental processing tries to minimize the number of times ovn-controller has to fully reprocess the contents of the southbound database. However, if a bug in the I-P code causes ovn-controller to end up in an inconsistent state, we have no easy way to force a full recalculation of the openflow entries. This commit adds a new command to ovn-controller, "recompute", which allows users to force a full recompute of the database. It can be triggered by the user in the following way: ovn-appctl -t ovn-controller recompute Reviewed-by: Daniel Alvarez Signed-off-by: Dumitru Ceara Signed-off-by: Han Zhou (cherry picked from upstream commit c66e0cee15ef6716ff2c092dce3168c92975bbf1) --- ovn/controller/ovn-controller.8.xml | 14 ++++++++++++++ ovn/controller/ovn-controller.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/ovn/controller/ovn-controller.8.xml b/ovn/controller/ovn-controller.8.xml index 780625f..a226802 100644 --- a/ovn/controller/ovn-controller.8.xml +++ b/ovn/controller/ovn-controller.8.xml @@ -450,6 +450,20 @@
Show OVN SBDB connection status for the chassis.
+ +
recompute
+
+

+ Trigger a full compute iteration in ovn-controller based + on the contents of the Southbound database and local OVS database. +

+

+ This command is intended to use only in the event of a bug in the + incremental processing engine in ovn-controller to avoid + inconsistent states. It should therefore be used with care as full + recomputes are cpu intensive. +

+

diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c index d7eb9d0..e864101 100644 --- a/ovn/controller/ovn-controller.c +++ b/ovn/controller/ovn-controller.c @@ -73,6 +73,7 @@ static unixctl_cb_func meter_table_list; static unixctl_cb_func group_table_list; static unixctl_cb_func inject_pkt; static unixctl_cb_func ovn_controller_conn_show; +static unixctl_cb_func engine_recompute_cmd; #define DEFAULT_BRIDGE_NAME "br-int" #define DEFAULT_PROBE_INTERVAL_MSEC 5000 @@ -1895,6 +1896,9 @@ main(int argc, char *argv[]) unixctl_command_register("inject-pkt", "MICROFLOW", 1, 1, inject_pkt, &pending_pkt); + unixctl_command_register("recompute", "", 0, 0, engine_recompute_cmd, + NULL); + uint64_t engine_run_id = 0; uint64_t old_engine_run_id = 0; bool engine_run_done = true; @@ -2391,3 +2395,13 @@ ovn_controller_conn_show(struct unixctl_conn *conn, int argc OVS_UNUSED, } unixctl_command_reply(conn, result); } + +static void +engine_recompute_cmd(struct unixctl_conn *conn OVS_UNUSED, int argc OVS_UNUSED, + const char *argv[] OVS_UNUSED, void *arg OVS_UNUSED) +{ + VLOG_INFO("User triggered force recompute."); + engine_set_force_recompute(true); + poll_immediate_wake(); + unixctl_command_reply(conn, NULL); +} -- 1.8.3.1