From patchwork Fri Nov 5 13:30:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frode Nordahl X-Patchwork-Id: 1551374 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=EsrEkqhY; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hm1bl3NNmz9sf8 for ; Sat, 6 Nov 2021 00:30:43 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9EACB40498; Fri, 5 Nov 2021 13:30:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LLtgP6gBlc-9; Fri, 5 Nov 2021 13:30:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 590AF40494; Fri, 5 Nov 2021 13:30:37 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C1160C0038; Fri, 5 Nov 2021 13:30:35 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id CF488C0019 for ; Fri, 5 Nov 2021 13:30:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id AF34B6157E for ; Fri, 5 Nov 2021 13:30:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=canonical.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id djjdLGXLcW1C for ; Fri, 5 Nov 2021 13:30:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by smtp3.osuosl.org (Postfix) with ESMTPS id EE7BB61577 for ; Fri, 5 Nov 2021 13:30:32 +0000 (UTC) Received: from frode-threadripper.. (1.general.frode.uk.vpn [10.172.193.250]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 8FFC43F1E4; Fri, 5 Nov 2021 13:30:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1636119028; bh=WiO4qAVHeDyJrcLKrE+qz39I020drkJ3KpEuRVk7Snk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EsrEkqhYruD8TbbLKqEv93CoJVlSBgog+SrwGdfmrjoZN8hVBRyT/cna4BWm6J15d lsso3RIxgHGSBB5S4w4HvXG6K+tKa6lnUnHSF5fcu9GoXybBa/znNGaT/gF8s/zhSK MrPHAqljk5UdlTm0NYQfERV0vstmnE1Tfv5Dpa0Lu4EDRNswafmNOegCKK5+vFRqpx reiVB3u0Ys3N/L4I22HzWFNImqi7x/bLiC+wSnkqYLQGUB9OuKP5ZTX1AkXfyhxg7b LY7V0pr2A/jO7PFYAWAOyzIAFBYwCTxJTO95bQYY3Anx4tk7KGIlHSZpHLenZz4LFu M6LzX4yVOfhPg== From: Frode Nordahl To: dev@openvswitch.org Date: Fri, 5 Nov 2021 14:30:17 +0100 Message-Id: <20211105133019.1991280-3-frode.nordahl@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211105133019.1991280-1-frode.nordahl@canonical.com> References: <20211105133019.1991280-1-frode.nordahl@canonical.com> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn v9 2/4] ovn-controller: Prepare VIF plug provider infrastructure. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Add port by interfaces index - To be able to effectively remove ports previously plugged by us we need to look up ports by interface records. Add Port_Binding by requested_chassis index - To be able to effectively iterate over ports destined to our chassis we need to look up Port_Binding records by requested_chassis. 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 --- controller/ovn-controller.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 4d99da03a..b51997f01 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,17 @@ 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); + + struct ovsdb_idl_index *ovsrec_port_by_interfaces + = ovsdb_idl_index_create1(ovs_idl_loop.idl, + &ovsrec_port_col_interfaces); + ovsdb_idl_get_initial_snapshot(ovs_idl_loop.idl); /* Configure OVN SB database. */ @@ -3122,6 +3130,9 @@ main(int argc, char *argv[]) struct ovsdb_idl_index *sbrec_port_binding_by_type = ovsdb_idl_index_create1(ovnsb_idl_loop.idl, &sbrec_port_binding_col_type); + struct ovsdb_idl_index *sbrec_port_binding_by_requested_chassis + = ovsdb_idl_index_create1(ovnsb_idl_loop.idl, + &sbrec_port_binding_col_requested_chassis); struct ovsdb_idl_index *sbrec_datapath_binding_by_key = ovsdb_idl_index_create1(ovnsb_idl_loop.idl, &sbrec_datapath_binding_col_tunnel_key); @@ -3879,6 +3890,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 +3911,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 +3922,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 +3969,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);