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 <dalva...@redhat.com>
Signed-off-by: Dumitru Ceara <dce...@redhat.com>

---
v2:
- Add command description to manpage (suggested by Daniel).
- Add Reviewed-by tag.
---
 controller/ovn-controller.8.xml | 14 ++++++++++++++
 controller/ovn-controller.c     | 14 ++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/controller/ovn-controller.8.xml b/controller/ovn-controller.8.xml
index 780625f..a226802 100644
--- a/controller/ovn-controller.8.xml
+++ b/controller/ovn-controller.8.xml
@@ -450,6 +450,20 @@
       <dd>
         Show OVN SBDB connection status for the chassis.
       </dd>
+
+      <dt><code>recompute</code></dt>
+      <dd>
+      <p>
+        Trigger a full compute iteration in <code>ovn-controller</code> based
+        on the contents of the Southbound database and local OVS database.
+      </p>
+      <p>
+        This command is intended to use only in the event of a bug in the
+        incremental processing engine in <code>ovn-controller</code> to avoid
+        inconsistent states. It should therefore be used with care as full
+        recomputes are cpu intensive.
+      </p>
+      </dd>
       </dl>
     </p>
 
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
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to