The time/warp can be useful in tests where we need to test time
sensitive operations, and it might not be convenient to wait
for the time to pass. The warp adjusts only monotonic clock
so it can be used only on operations that do not relay on wall
clock time.

Signed-off-by: Ales Musil <amu...@redhat.com>
---
 controller/ovn-controller.c |  1 +
 lib/ovn-util.c              | 16 ++++++++++++++++
 lib/ovn-util.h              |  2 ++
 northd/ovn-northd.c         |  1 +
 4 files changed, 20 insertions(+)

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 0b09c98bd..440c76ca1 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -5991,6 +5991,7 @@ main(int argc, char *argv[])
 
     unixctl_command_register("debug/ignore-startup-delay", "", 0, 0,
                              debug_ignore_startup_delay, NULL);
+    ovn_debug_commands_register();
 
     unsigned int ovs_cond_seqno = UINT_MAX;
     unsigned int ovnsb_cond_seqno = UINT_MAX;
diff --git a/lib/ovn-util.c b/lib/ovn-util.c
index c65b36bb5..2749f8b6d 100644
--- a/lib/ovn-util.c
+++ b/lib/ovn-util.c
@@ -33,6 +33,7 @@
 #include "stream.h"
 #include "svec.h"
 #include "unixctl.h"
+#include "dummy.h"
 
 VLOG_DEFINE_THIS_MODULE(ovn_util);
 
@@ -1399,3 +1400,18 @@ lport_lookup_by_name(struct ovsdb_idl_index 
*sbrec_port_binding_by_name,
 
     return retval;
 }
+
+static void
+ovn_enable_timewarp(struct unixctl_conn *conn, int argc OVS_UNUSED,
+                    const char *argv[] OVS_UNUSED, void *arg OVS_UNUSED)
+{
+    timeval_dummy_register();
+    unixctl_command_reply(conn, NULL);
+}
+
+void
+ovn_debug_commands_register(void)
+{
+    unixctl_command_register("debug/enable-timewarp", "", 0, 0,
+                             ovn_enable_timewarp, NULL);
+}
diff --git a/lib/ovn-util.h b/lib/ovn-util.h
index ce8cc0568..6e559118a 100644
--- a/lib/ovn-util.h
+++ b/lib/ovn-util.h
@@ -492,6 +492,8 @@ bool ovn_update_swconn_at(struct rconn *swconn, const char 
*target,
 
 bool prefix_is_link_local(const struct in6_addr *prefix, unsigned int plen);
 
+void ovn_debug_commands_register(void);
+
 const struct sbrec_port_binding *lport_lookup_by_name(
     struct ovsdb_idl_index *sbrec_port_binding_by_name,
     const char *name);
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 72eedbfdb..aed95ba97 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -849,6 +849,7 @@ main(int argc, char *argv[])
     unixctl_command_register("parallel-build/get-n-threads", "", 0, 0,
                              ovn_northd_get_thread_count_cmd,
                              NULL);
+    ovn_debug_commands_register();
 
     daemonize_complete();
 
-- 
2.49.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to