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

Signed-off-by: Dumitru Ceara <[email protected]>
---
 controller/ovn-controller.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index c56190f..04d9dea 100644
--- a/controller/ovn-controller.c
+++ b/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
@@ -1941,6 +1942,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;
     bool engine_run_done = true;
 
@@ -2442,3 +2446,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

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to