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

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

bbaaef
+      

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

bbaaef
+      
bbaaef
       
bbaaef
     

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