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 <[email protected]>
---
 ic/ovn-ic.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

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;
         }
-- 
2.34.1


-- 




_'Esta mensagem é direcionada apenas para os endereços constantes no 
cabeçalho inicial. Se você não está listado nos endereços constantes no 
cabeçalho, pedimos-lhe que desconsidere completamente o conteúdo dessa 
mensagem e cuja cópia, encaminhamento e/ou execução das ações citadas estão 
imediatamente anuladas e proibidas'._


* **'Apesar do Magazine Luiza tomar 
todas as precauções razoáveis para assegurar que nenhum vírus esteja 
presente nesse e-mail, a empresa não poderá aceitar a responsabilidade por 
quaisquer perdas ou danos causados por esse e-mail ou por seus anexos'.*



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

Reply via email to