diff mbox series

[ovs-dev,v4,3/4] ovn-ic: Support dumping a visual representation of the I-P graph.

Message ID 20251216202825.177582-4-guilherme.paulo@luizalabs.com
State Accepted
Delegated to: Numan Siddique
Headers show
Series ovn-ic: Introduce I+P for ovn-ic. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_ovn-kubernetes success github build: passed
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Paulo Guilherme Silva Dec. 16, 2025, 8:28 p.m. UTC
This commit updates the ability to dump a (partial) representation
of the incremental processing graph. Now It's currently supported for
ovn-ic too through a command-line argument, --dump-inc-proc-graph[=<i-p-node>].

If the command line argument is present the binary (ovn-ic) 
just dumps a representation of the incremental
processing graph in DOT format to stdout.  The binary then exits.

If the '<i-p-node>' optional argument value is present the
representation only includes nodes up to (and including) '<i-p-node>'.

Signed-off-by: Paulo Guilherme Silva <guilherme.paulo@luizalabs.com>
---
 ic/ovn-ic.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Dumitru Ceara Jan. 5, 2026, 11:51 a.m. UTC | #1
On 12/16/25 9:28 PM, Paulo Guilherme Silva via dev wrote:
> This commit updates the ability to dump a (partial) representation
> of the incremental processing graph. Now It's currently supported for
> ovn-ic too through a command-line argument, --dump-inc-proc-graph[=<i-p-node>].
> 
> If the command line argument is present the binary (ovn-ic) 
> just dumps a representation of the incremental
> processing graph in DOT format to stdout.  The binary then exits.
> 
> If the '<i-p-node>' optional argument value is present the
> representation only includes nodes up to (and including) '<i-p-node>'.
> 
> Signed-off-by: Paulo Guilherme Silva <guilherme.paulo@luizalabs.com>
> ---

Recheck-request: github-robot-_Build_and_Test
diff mbox series

Patch

diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index 0e8c0953d..41596d73a 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -3054,6 +3054,28 @@  update_sequence_numbers(struct ic_context *ctx,
     }
 }
 
+static void
+inc_proc_graph_dump(const char *end_node)
+{
+    struct ovsdb_idl_loop ovnnb_idl_loop = OVSDB_IDL_LOOP_INITIALIZER(
+        ovsdb_idl_create_unconnected(&nbrec_idl_class, true));
+    struct ovsdb_idl_loop ovnsb_idl_loop = OVSDB_IDL_LOOP_INITIALIZER(
+        ovsdb_idl_create_unconnected(&sbrec_idl_class, true));
+    struct ovsdb_idl_loop ovninb_idl_loop = OVSDB_IDL_LOOP_INITIALIZER(
+        ovsdb_idl_create_unconnected(&icnbrec_idl_class, true));
+    struct ovsdb_idl_loop ovnisb_idl_loop = OVSDB_IDL_LOOP_INITIALIZER(
+        ovsdb_idl_create_unconnected(&icsbrec_idl_class, true));
+
+    inc_proc_ic_init(&ovnnb_idl_loop, &ovnsb_idl_loop,
+                     &ovninb_idl_loop, &ovnisb_idl_loop);
+    engine_dump_graph(end_node);
+
+    ovsdb_idl_loop_destroy(&ovnnb_idl_loop);
+    ovsdb_idl_loop_destroy(&ovnsb_idl_loop);
+    ovsdb_idl_loop_destroy(&ovninb_idl_loop);
+    ovsdb_idl_loop_destroy(&ovnisb_idl_loop);
+}
+
 void
 ovn_db_run(struct ic_context *ctx)
 {
@@ -3081,6 +3103,7 @@  parse_options(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
         OVN_DAEMON_OPTION_ENUMS,
         VLOG_OPTION_ENUMS,
         SSL_OPTION_ENUMS,
+        OPT_DUMP_INC_PROC_GRAPH,
     };
     static const struct option long_options[] = {
         {"ovnsb-db", required_argument, NULL, 'd'},
@@ -3091,6 +3114,8 @@  parse_options(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
         {"help", no_argument, NULL, 'h'},
         {"options", no_argument, NULL, 'o'},
         {"version", no_argument, NULL, 'V'},
+        {"dump-inc-proc-graph", optional_argument, NULL,
+         OPT_DUMP_INC_PROC_GRAPH},
         OVN_DAEMON_LONG_OPTIONS,
         VLOG_LONG_OPTIONS,
         STREAM_SSL_LONG_OPTIONS,
@@ -3170,6 +3195,14 @@  parse_options(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
             ovn_print_version(0, 0);
             exit(EXIT_SUCCESS);
 
+        /* --dump-inc-proc-graph[=<i-p-node>]: Whether to dump the I-P engine
+         * graph representation in DOT format to stdout.  Optionally only up
+         * to <i-p-node>.
+         */
+        case OPT_DUMP_INC_PROC_GRAPH:
+            inc_proc_graph_dump(optarg);
+            exit(EXIT_SUCCESS);
+
         default:
             break;
         }