From patchwork Thu Aug 6 13:36:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1341728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=a6B7snGW; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BMqKP5NyVz9sPB for ; Thu, 6 Aug 2020 23:36:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 3115C88517; Thu, 6 Aug 2020 13:36:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NIIC1m8g-4rm; Thu, 6 Aug 2020 13:36:55 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 4F607884E6; Thu, 6 Aug 2020 13:36:55 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 36FC1C0050; Thu, 6 Aug 2020 13:36:55 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id BEFA9C004C for ; Thu, 6 Aug 2020 13:36:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id AD62B884E6 for ; Thu, 6 Aug 2020 13:36:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OYUAERGXozww for ; Thu, 6 Aug 2020 13:36:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by hemlock.osuosl.org (Postfix) with ESMTPS id 93731884E9 for ; Thu, 6 Aug 2020 13:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596721009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jq9R5BhEn5O3Dg6jC5QJhzPEmx5sSoSUBhgfjfkWU8U=; b=a6B7snGWhl8O3GTrsJAp88gllp9b254PYE2PGjQz/espEujUtcvAVxRpo6wim++yczkFgt CYnx4HkRlJygLZtuzPsl7NgT6w/q3bZLlQoEkUpbO1RN1wNQgzqTlwkvjSvHt2DmoCOiv8 S4EiqPFck6QsT2f5LqtKWWmZ8P3kbZ8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-b95crHUCNgqSkONJoscN-g-1; Thu, 06 Aug 2020 09:36:47 -0400 X-MC-Unique: b95crHUCNgqSkONJoscN-g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1B5F101C8A0 for ; Thu, 6 Aug 2020 13:36:46 +0000 (UTC) Received: from dceara.remote.csb (ovpn-112-214.ams2.redhat.com [10.36.112.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 062781001901 for ; Thu, 6 Aug 2020 13:36:45 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Thu, 6 Aug 2020 15:36:43 +0200 Message-Id: <20200806133641.5516.89240.stgit@dceara.remote.csb> In-Reply-To: <20200806133631.5516.344.stgit@dceara.remote.csb> References: <20200806133631.5516.344.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 1/2] chassis: Propagate ovn-monitor-all external-id to Chassis:other_config. 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" At least for avoiding races in the unit tests it's useful to store the value of the OVS ovn-monitor-all external-id in the Chassis record other_config field. This allows us to know for sure when an ovn-controller has processed the update to the OVS Open_vSwitch DB table. Signed-off-by: Dumitru Ceara --- controller/chassis.c | 23 +++++++++++++++++++++-- tests/ovn.at | 8 ++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/controller/chassis.c b/controller/chassis.c index eec270e..3440d5a 100644 --- a/controller/chassis.c +++ b/controller/chassis.c @@ -84,6 +84,7 @@ struct ovs_chassis_cfg { const char *datapath_type; const char *encap_csum; const char *cms_options; + const char *monitor_all; const char *chassis_macs; /* Set of encap types parsed from the 'ovn-encap-type' external-id. */ @@ -159,6 +160,12 @@ get_cms_options(const struct smap *ext_ids) } static const char * +get_monitor_all(const struct smap *ext_ids) +{ + return smap_get_def(ext_ids, "ovn-monitor-all", "false"); +} + +static const char * get_encap_csum(const struct smap *ext_ids) { return smap_get_def(ext_ids, "ovn-encap-csum", "true"); @@ -277,6 +284,7 @@ chassis_parse_ovs_config(const struct ovsrec_open_vswitch_table *ovs_table, ovs_cfg->datapath_type = get_datapath_type(br_int); ovs_cfg->encap_csum = get_encap_csum(&cfg->external_ids); ovs_cfg->cms_options = get_cms_options(&cfg->external_ids); + ovs_cfg->monitor_all = get_monitor_all(&cfg->external_ids); ovs_cfg->chassis_macs = get_chassis_mac_mappings(&cfg->external_ids); if (!chassis_parse_ovs_encap_type(encap_type, &ovs_cfg->encap_type_set)) { @@ -303,12 +311,13 @@ chassis_parse_ovs_config(const struct ovsrec_open_vswitch_table *ovs_table, static void chassis_build_other_config(struct smap *config, const char *bridge_mappings, const char *datapath_type, const char *cms_options, - const char *chassis_macs, const char *iface_types, - bool is_interconn) + const char *monitor_all, const char *chassis_macs, + const char *iface_types, bool is_interconn) { smap_replace(config, "ovn-bridge-mappings", bridge_mappings); smap_replace(config, "datapath-type", datapath_type); smap_replace(config, "ovn-cms-options", cms_options); + smap_replace(config, "ovn-monitor-all", monitor_all); smap_replace(config, "iface-types", iface_types); smap_replace(config, "ovn-chassis-mac-mappings", chassis_macs); smap_replace(config, "is-interconn", is_interconn ? "true" : "false"); @@ -321,6 +330,7 @@ static bool chassis_other_config_changed(const char *bridge_mappings, const char *datapath_type, const char *cms_options, + const char *monitor_all, const char *chassis_macs, const struct ds *iface_types, bool is_interconn, @@ -347,6 +357,13 @@ chassis_other_config_changed(const char *bridge_mappings, return true; } + const char *chassis_monitor_all = + get_monitor_all(&chassis_rec->other_config); + + if (strcmp(monitor_all, chassis_monitor_all)) { + return true; + } + const char *chassis_mac_mappings = get_chassis_mac_mappings(&chassis_rec->other_config); if (strcmp(chassis_macs, chassis_mac_mappings)) { @@ -554,6 +571,7 @@ chassis_update(const struct sbrec_chassis *chassis_rec, if (chassis_other_config_changed(ovs_cfg->bridge_mappings, ovs_cfg->datapath_type, ovs_cfg->cms_options, + ovs_cfg->monitor_all, ovs_cfg->chassis_macs, &ovs_cfg->iface_types, ovs_cfg->is_interconn, @@ -564,6 +582,7 @@ chassis_update(const struct sbrec_chassis *chassis_rec, chassis_build_other_config(&other_config, ovs_cfg->bridge_mappings, ovs_cfg->datapath_type, ovs_cfg->cms_options, + ovs_cfg->monitor_all, ovs_cfg->chassis_macs, ds_cstr_ro(&ovs_cfg->iface_types), ovs_cfg->is_interconn); diff --git a/tests/ovn.at b/tests/ovn.at index b0179a8..2235a19 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -20777,6 +20777,14 @@ as hv2 ovs-vsctl del-port hv2-vif1 as hv1 ovs-vsctl set open . external_ids:ovn-monitor-all=true as hv2 ovs-vsctl set open . external_ids:ovn-monitor-all=true +# Wait until ovn-monitor-all is processed by ovn-controller. +OVS_WAIT_UNTIL([ + test $(ovn-sbctl get chassis hv1 other_config:ovn-monitor-all) = '"true"' +]) +OVS_WAIT_UNTIL([ + test $(ovn-sbctl get chassis hv2 other_config:ovn-monitor-all) = '"true"' +]) + ovn-nbctl ls-add sw0 ovn-nbctl lsp-add sw0 sw0-p1 From patchwork Thu Aug 6 13:36:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1341729 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fVHJx1Rg; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BMqKy4xK8z9sPB for ; Thu, 6 Aug 2020 23:37:25 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id BFD2F86EDB; Thu, 6 Aug 2020 13:37:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dmzrv5GHLEqX; Thu, 6 Aug 2020 13:37:20 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id F34F286A85; Thu, 6 Aug 2020 13:37:19 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E7428C0050; Thu, 6 Aug 2020 13:37:19 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5E5C6C004C for ; Thu, 6 Aug 2020 13:37:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4482F23DB4 for ; Thu, 6 Aug 2020 13:37:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C-xXTNWQkyhp for ; Thu, 6 Aug 2020 13:37:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by silver.osuosl.org (Postfix) with ESMTPS id B366522851 for ; Thu, 6 Aug 2020 13:37:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596721019; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xcAGyjAIhfs1ecoiOU6W66ElAzQyeJDCJVTWsRl2rqQ=; b=fVHJx1RgPCuq8R/xgVZeaBl/C/r0Wq4+IJvQpF/x4d6T/a87OY8zGRLFoUoABAAeyXACNC s99DpFU7MLWv1vb0ia17ZhPT9cgbGyyqW8pnjm9XEEmpGW+hJ5OVNwotI3BqEEMw9qN6OA E86XRuL/rbEERJqrWwockkWlRCOUAfw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-6YFya2FDNjiUzdTgh7tqwQ-1; Thu, 06 Aug 2020 09:36:57 -0400 X-MC-Unique: 6YFya2FDNjiUzdTgh7tqwQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF539801E6A for ; Thu, 6 Aug 2020 13:36:56 +0000 (UTC) Received: from dceara.remote.csb (ovpn-112-214.ams2.redhat.com [10.36.112.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16D9460BF1 for ; Thu, 6 Aug 2020 13:36:55 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Thu, 6 Aug 2020 15:36:53 +0200 Message-Id: <20200806133652.5516.36390.stgit@dceara.remote.csb> In-Reply-To: <20200806133631.5516.344.stgit@dceara.remote.csb> References: <20200806133631.5516.344.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 2/2] pinctrl: Avoid flushing of non-local IGMP_Groups. 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" With ovn-monitor-all enabled, all ovn-controllers get updates about all SB records. This means that an ovn-controller might receive updates about IGMP_Groups inserted by other chassis on datapaths that are not local to the local chassis. These entries are valid and are not owned by the local chassis and should not be flushed. Fixes: 70ff8243040f ("OVN: Add IGMP SB definitions and ovn-controller support") Signed-off-by: Dumitru Ceara --- controller/pinctrl.c | 10 ++++++++++ tests/ovn.at | 43 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/controller/pinctrl.c b/controller/pinctrl.c index e37f210..f72ab70 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -4561,7 +4561,17 @@ ip_mcast_sync(struct ovsdb_idl_txn *ovnsb_idl_txn, continue; } + /* Skip non-local records. */ + if (sbrec_igmp->chassis != chassis) { + continue; + } + + /* Skip non-local datapaths. */ int64_t dp_key = sbrec_igmp->datapath->tunnel_key; + if (!get_local_datapath(local_datapaths, dp_key)) { + continue; + } + struct ip_mcast_snoop *ip_ms = ip_mcast_snoop_find(dp_key); /* If the datapath doesn't exist anymore or IGMP snooping was disabled diff --git a/tests/ovn.at b/tests/ovn.at index 2235a19..d641075 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -16997,7 +16997,48 @@ OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty]) -OVN_CLEANUP([hv1], [hv2]) +# With ovn-monitor-all=true, make sure ovn-controllers don't delete each +# other's IGMP_Group records. + +# Add a new chassis with no local datapaths. +net_add n3 +sim_add hv3 +as hv3 +ovs-vsctl add-br br-phys +ovn_attach n3 br-phys 192.168.0.3 + +# Enable ovn-monitor-all on all chassis. +as hv1 ovs-vsctl set open . external_ids:ovn-monitor-all=true +as hv2 ovs-vsctl set open . external_ids:ovn-monitor-all=true +as hv3 ovs-vsctl set open . external_ids:ovn-monitor-all=true + +# Wait until ovn-monitor-all is processed by ovn-controller. +OVS_WAIT_UNTIL([ + test $(ovn-sbctl get chassis hv1 other_config:ovn-monitor-all) = '"true"' +]) +OVS_WAIT_UNTIL([ + test $(ovn-sbctl get chassis hv2 other_config:ovn-monitor-all) = '"true"' +]) +OVS_WAIT_UNTIL([ + test $(ovn-sbctl get chassis hv3 other_config:ovn-monitor-all) = '"true"' +]) + +# Inject a fake IGMP_Group entry. +dp=$(ovn-sbctl --bare --columns _uuid list Datapath_Binding sw3) +ch=$(ovn-sbctl --bare --columns _uuid list Chassis hv3) +ovn-sbctl create IGMP_Group address="239.0.1.42" datapath=$dp chassis=$ch + +ovn-nbctl --wait=hv sync +OVS_WAIT_UNTIL([ + total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c` + test "${total_entries}" = "1" +]) +OVS_WAIT_UNTIL([ + total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.42" -c` + test "${total_entries}" = "1" +]) + +OVN_CLEANUP([hv1], [hv2], [hv3]) AT_CLEANUP AT_SETUP([ovn -- MLD snoop/querier/relay])