[ovs-dev] [PATCH ovn v10 2/4] ovn-controller: Prepare VIF plug provider infrastructure.

Frode Nordahl frode.nordahl at canonical.com
Fri Nov 5 14:00:12 UTC 2021


Add `enable-dummy-plug` option - To enable testing of the VIF plug
provider infrastructure without building OVN with an external VIF
plug provider we include a dummy implementation which can be
enabled using this command line option.

Signed-off-by: Frode Nordahl <frode.nordahl at canonical.com>
---
 controller/ovn-controller.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 4d99da03a..1cef04735 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -56,6 +56,8 @@
 #include "lib/ovn-sb-idl.h"
 #include "lib/ovn-util.h"
 #include "patch.h"
+#include "vif-plug.h"
+#include "vif-plug-provider.h"
 #include "physical.h"
 #include "pinctrl.h"
 #include "openvswitch/poll-loop.h"
@@ -3082,11 +3084,13 @@ main(int argc, char *argv[])
     patch_init();
     pinctrl_init();
     lflow_init();
+    vif_plug_provider_initialize();
 
     /* Connect to OVS OVSDB instance. */
     struct ovsdb_idl_loop ovs_idl_loop = OVSDB_IDL_LOOP_INITIALIZER(
         ovsdb_idl_create(ovs_remote, &ovsrec_idl_class, false, true));
     ctrl_register_ovs_idl(ovs_idl_loop.idl);
+
     ovsdb_idl_get_initial_snapshot(ovs_idl_loop.idl);
 
     /* Configure OVN SB database. */
@@ -3879,6 +3883,7 @@ loop_done:
     pinctrl_destroy();
     patch_destroy();
     if_status_mgr_destroy(if_mgr);
+    vif_plug_provider_destroy_all();
 
     ovsdb_idl_loop_destroy(&ovs_idl_loop);
     ovsdb_idl_loop_destroy(&ovnsb_idl_loop);
@@ -3899,6 +3904,7 @@ parse_options(int argc, char *argv[])
         VLOG_OPTION_ENUMS,
         OVN_DAEMON_OPTION_ENUMS,
         SSL_OPTION_ENUMS,
+        OPT_ENABLE_DUMMY_VIF_PLUG,
     };
 
     static struct option long_options[] = {
@@ -3909,6 +3915,8 @@ parse_options(int argc, char *argv[])
         STREAM_SSL_LONG_OPTIONS,
         {"peer-ca-cert", required_argument, NULL, OPT_PEER_CA_CERT},
         {"bootstrap-ca-cert", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT},
+        {"enable-dummy-vif-plug", no_argument, NULL,
+         OPT_ENABLE_DUMMY_VIF_PLUG},
         {NULL, 0, NULL, 0}
     };
     char *short_options = ovs_cmdl_long_options_to_short_options(long_options);
@@ -3954,6 +3962,10 @@ parse_options(int argc, char *argv[])
             stream_ssl_set_ca_cert_file(optarg, true);
             break;
 
+        case OPT_ENABLE_DUMMY_VIF_PLUG:
+            vif_plug_dummy_enable();
+            break;
+
         case '?':
             exit(EXIT_FAILURE);
 
-- 
2.32.0



More information about the dev mailing list