From patchwork Tue Jun 15 16:26:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1492353 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.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=u+rfyua9; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 ozlabs.org (Postfix) with ESMTPS id 4G4DH91fwHz9sWD for ; Wed, 16 Jun 2021 02:27:01 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6D30183C13; Tue, 15 Jun 2021 16:26:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9JmUFawZwOmv; Tue, 15 Jun 2021 16:26:58 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 84CBD83C0D; Tue, 15 Jun 2021 16:26:57 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5BF43C000D; Tue, 15 Jun 2021 16:26:57 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 01E17C000B for ; Tue, 15 Jun 2021 16:26:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 31A5883C09 for ; Tue, 15 Jun 2021 16:26:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Sevr4JxgVFAo for ; Tue, 15 Jun 2021 16:26:52 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1B44283C0A for ; Tue, 15 Jun 2021 16:26:51 +0000 (UTC) Received: by mail-lf1-x134.google.com with SMTP id i13so4731619lfc.7 for ; Tue, 15 Jun 2021 09:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oZ0ZZbMbHBAebMk65Sj+5olgMNfURsJi3r3rxeSQkGU=; b=u+rfyua9/H+aD/CmhjeXdJp0fvDhdI/HBWp7Gr/ILUY8QWxFD3xgUkqQ0cLB0C950k BLITgexZVRkYdBnWxVCrstcArntCSrxjdhNSuozCEUa4zCE1dpDW0+F7MfQiicyfbUbj V82zbosbJYIqGJcDZTk6Lqd9YgMUB04L1FEnmnYdnCqceGYHz5YuKDrW9aEvxJ0SDgva bd4Fomm1jfm46OrAyogDjWfmIe6RKwkDbXUnBwCzg8v5VICHRzDJPf16ksvYUgBInNdE lrHmKwW4yTz/Dk30Mm5xm1JwNdGnLt3OWCID9LfBleGPcp9MzTPO/fONbf/TCyKScBRy d8Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oZ0ZZbMbHBAebMk65Sj+5olgMNfURsJi3r3rxeSQkGU=; b=Lcf/P154x+w6vgNllb+pPmXsLdeVTdCXiZmcVn68JJ8b7MV33fzdv1FL3zeX53JEfD ktHKJ1CaoXyN0GX9aY92VcnpuzG7DAn/YKrjpMEB+GVAraMzrGhVC+MwWRtTksx9El/R oL4vZkk9RcMdsBiOTrafbDbhmxZzrEdqARh5Z3NR93WFmp3nm5qMr41JbqFm6gBV7iLi sVG9ecXadaknHTg9fQYi15iFUS7++bd+kIHYP9SrZHSDfFzkLp5cYtAg5Qoba9xp7+On nIyJnFjb4kKeCvSr9Ir27z6igzWIWuScquozOxPHUQqdYAtMMsq32AgyBmhQZLn3mLvo 7ArA== X-Gm-Message-State: AOAM530pOKiMxSXhTCZOKMgEhezDzC60476gNN1YJZ7kBfqaY6KhGn/D GVGyLpC68Xsm1kOFlyFF0RCz0ObHsZZ9sEBz X-Google-Smtp-Source: ABdhPJyciHtW/YwR9a9wLb67pEBO3T/ZuAuRbviUZUcY412Jgdqjuo2bUOni5gAWqnleNtnOg39+Gw== X-Received: by 2002:a05:6512:3c98:: with SMTP id h24mr195245lfv.26.1623774409666; Tue, 15 Jun 2021 09:26:49 -0700 (PDT) Received: from Vladislavs-MacBook-Pro.local.ru (109-252-131-42.dynamic.spd-mgts.ru. [109.252.131.42]) by smtp.gmail.com with ESMTPSA id d5sm2016472lfn.170.2021.06.15.09.26.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jun 2021 09:26:49 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Tue, 15 Jun 2021 19:26:08 +0300 Message-Id: <20210615162609.22559-2-odivlad@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210615162609.22559-1-odivlad@gmail.com> References: <20210615162609.22559-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Dumitru Ceara , Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v4 1/2] controller-vtep: fix mmr and physical locators create/update 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" Before this patch ovn-controller-vtep created Mcast_Macs_Remote record for each Port Binding in the ovn Logical Switch, to which vtep Logical Switch was attached. With this patch there is only one Mcast_Macs_Remote record per datapath. Physical Locator set is created every time when physical locators for associated datapath are changed. Next, this newly-created physical locator set is updated in the MMR record. Signed-off-by: Vladislav Odintsov Acked-by: Dumitru Ceara --- controller-vtep/vtep.c | 54 ++++++++++++++++------------ tests/ovn-controller-vtep.at | 70 ++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 22 deletions(-) diff --git a/controller-vtep/vtep.c b/controller-vtep/vtep.c index f3b02f63f..9d670466c 100644 --- a/controller-vtep/vtep.c +++ b/controller-vtep/vtep.c @@ -104,6 +104,7 @@ vtep_create_mmr(struct ovsdb_idl_txn *vtep_idl_txn, const char *mac, struct vteprec_mcast_macs_remote *new_mmr = vteprec_mcast_macs_remote_insert(vtep_idl_txn); + VLOG_DBG("Inserting MMR for LS '%s'", vtep_ls->name); vteprec_mcast_macs_remote_set_MAC(new_mmr, mac); vteprec_mcast_macs_remote_set_logical_switch(new_mmr, vtep_ls); vteprec_mcast_macs_remote_set_locator_set(new_mmr, ploc_set); @@ -140,7 +141,7 @@ vtep_process_pls(const struct ovs_list *locators_list, ploc_entry->vteprec_ploc; if (mmr_ext && !shash_find_data(&mmr_ext->physical_locators, locators[i]->dst_ip)) { - locator_lists_differ = true; + locator_lists_differ = true; } i++; } @@ -149,8 +150,8 @@ vtep_process_pls(const struct ovs_list *locators_list, return locator_lists_differ; } -/* Creates a new 'Mcast_Macs_Remote' entry if needed and also cleans up - * out-dated remote mcast mac entries as needed. */ +/* Creates a new 'Mcast_Macs_Remote' entry or modifies existing if needed + * and also cleans up out-dated remote mcast mac entries as needed. */ static void vtep_update_mmr(struct ovsdb_idl_txn *vtep_idl_txn, struct ovs_list *locators_list, @@ -162,22 +163,29 @@ vtep_update_mmr(struct ovsdb_idl_txn *vtep_idl_txn, bool mmr_changed; locators = xmalloc(n_locators_new * sizeof *locators); - mmr_changed = vtep_process_pls(locators_list, mmr_ext, locators); - if (mmr_ext && !n_locators_new) { - vteprec_mcast_macs_remote_delete(mmr_ext->mmr); - } else if ((mmr_ext && mmr_changed) || - (!mmr_ext && n_locators_new)) { + if (mmr_changed) { + if (n_locators_new) { + const struct vteprec_physical_locator_set *ploc_set = + vteprec_physical_locator_set_insert(vtep_idl_txn); - const struct vteprec_physical_locator_set *ploc_set = - vteprec_physical_locator_set_insert(vtep_idl_txn); + vteprec_physical_locator_set_set_locators(ploc_set, locators, + n_locators_new); - vtep_create_mmr(vtep_idl_txn, "unknown-dst", vtep_ls, ploc_set); + if (!mmr_ext) { /* create new mmr */ + vtep_create_mmr(vtep_idl_txn, "unknown-dst", vtep_ls, + ploc_set); + } else { /* update existing mmr */ + vteprec_mcast_macs_remote_set_locator_set(mmr_ext->mmr, + ploc_set); + } - vteprec_physical_locator_set_set_locators(ploc_set, locators, - n_locators_new); + } else if (mmr_ext) { /* remove old mmr */ + vteprec_mcast_macs_remote_delete(mmr_ext->mmr); + } } + free(locators); } @@ -353,17 +361,19 @@ vtep_macs_run(struct ovsdb_idl_txn *vtep_idl_txn, struct shash *ucast_macs_rmts, shash_add(&ls_node->physical_locators, chassis_ip, pl); } - char *mac_tnlkey = xasprintf("%s_%"PRId64, "unknown-dst", tnl_key); - ls_node->mmr_ext = shash_find_data(mcast_macs_rmts, mac_tnlkey); + if (!ls_node->mmr_ext) { + char *mac_tnlkey = xasprintf("%s_%"PRId64, "unknown-dst", tnl_key); + ls_node->mmr_ext = shash_find_data(mcast_macs_rmts, mac_tnlkey); - if (ls_node->mmr_ext && - ls_node->mmr_ext->mmr->logical_switch == ls_node->vtep_ls) { + if (ls_node->mmr_ext && + ls_node->mmr_ext->mmr->logical_switch == ls_node->vtep_ls) { - /* Delete the entry from the hash table so the mmr does not get - * removed from the DB later on during stale checking. */ - shash_find_and_delete(mcast_macs_rmts, mac_tnlkey); + /* Delete the entry from the hash table so the mmr does not get + * removed from the DB later on during stale checking. */ + shash_find_and_delete(mcast_macs_rmts, mac_tnlkey); + } + free(mac_tnlkey); } - free(mac_tnlkey); for (i = 0; i < port_binding_rec->n_mac; i++) { const struct vteprec_ucast_macs_remote *umr; @@ -535,7 +545,7 @@ vtep_run(struct controller_vtep_ctx *ctx) mmr->logical_switch && mmr->logical_switch->n_tunnel_key ? mmr->logical_switch->tunnel_key[0] : INT64_MAX); - shash_add(&mcast_macs_rmts, mac_tnlkey, mmr_ext); + shash_add_once(&mcast_macs_rmts, mac_tnlkey, mmr_ext); mmr_ext->mmr = mmr; shash_init(&mmr_ext->physical_locators); diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at index b2261d285..54db62f60 100644 --- a/tests/ovn-controller-vtep.at +++ b/tests/ovn-controller-vtep.at @@ -415,6 +415,20 @@ AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr - "f0:ab:cd:ef:01:03" ]) +# checks multiple vifs +# add new vif to br-test lswitch and check all UMRs exist +AT_CHECK([ovn-nbctl lsp-add br-test vif2]) +AT_CHECK([ovn-nbctl lsp-set-addresses vif2 f0:ab:cd:ef:02:02]) +AT_CHECK([ovn-nbctl --wait=sb sync]) +AT_CHECK([ovn-sbctl chassis-add ch2 vxlan 1.2.3.7]) +AT_CHECK([ovn-sbctl lsp-bind vif2 ch2]) +AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl + +"f0:ab:cd:ef:01:03" +"f0:ab:cd:ef:02:02" +]) +AT_CHECK([ovn-nbctl lsp-del vif2]) + # migrates mac to logical switch port vif1 on 'br-void'. AT_CHECK([ovn-nbctl lsp-set-addresses vif0]) AT_CHECK([ovn-nbctl --wait=sb lsp-set-addresses vif1 f0:ab:cd:ef:01:03]) @@ -492,3 +506,59 @@ AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr - OVN_CONTROLLER_VTEP_STOP([/has already been known to be on logical port/d]) AT_CLEANUP + +# Tests vtep module 'Mcast_Macs_Remote's. +AT_SETUP([ovn-controller-vtep - vtep-Mcast_Macs_Remote]) +OVN_CONTROLLER_VTEP_START + +# creates a simple logical network with the vtep device and a fake hv chassis +# 'ch0'. +check(ovn-nbctl lsp-add br-test vif0) +check(ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:00) +check(ovn-nbctl --wait=sb sync) +check(ovn-sbctl chassis-add ch0 vxlan 1.2.3.5) +check(ovn-sbctl lsp-bind vif0 ch0) + +# creates the logical switch in vtep and adds the corresponding logical +# port to 'br-test'. +check(vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0) +OVN_NB_ADD_VTEP_PORT([br-test], [br-vtep_lswitch0], [br-vtep], [lswitch0]) +OVS_WAIT_UNTIL([test -n "`ovn-sbctl list Port_Binding | grep br-vtep_lswitch0`"]) + +# checks Mcast_Macs_Remote creation. +OVS_WAIT_UNTIL([test `vtep-ctl list Mcast_Macs_Remote | grep _uuid | wc -l` -eq 1]) +AT_CHECK([vtep-ctl --columns=MAC list Mcast_Macs_Remote | cut -d ':' -f2- | tr -d ' '], [0], [dnl +unknown-dst +]) + +# check physical locator and physical locator set updates +OVS_WAIT_UNTIL([test -n "`vtep-ctl list Physical_Locator | grep _uuid`"]) +AT_CHECK([for i in `vtep-ctl --columns=locators list Physical_Locator_Set $(vtep-ctl --columns=locator_set list Mcast_Macs_Remote | cut -d ':' -f2) | cut -d ':' -f2 | tr -d '[[ ]]' | sed 's/,/ /g'`; do + vtep-ctl --columns=dst_ip list Physical_Locator $i | cut -d ':' -f2 | tr -d ' ' +done], [0], [dnl +"1.2.3.5" +]) + +# add new lport and bind it to another fake chassis 'ch1'. +check(ovn-nbctl lsp-add br-test vif1]) +check(ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:01]) +check(ovn-nbctl --wait=sb sync]) +check(ovn-sbctl chassis-add ch1 vxlan 1.2.3.6]) +check(ovn-sbctl lsp-bind vif1 ch1]) + +# checks there is still only one Mcast_Macs_Remote record. +OVS_WAIT_UNTIL([test `vtep-ctl list Mcast_Macs_Remote | grep _uuid | wc -l` -eq 1]) +AT_CHECK([vtep-ctl --columns=MAC list Mcast_Macs_Remote | cut -d ':' -f2- | tr -d ' '], [0], [dnl +unknown-dst +]) + +# check physical locator and physical locator set updates +AT_CHECK([for i in `vtep-ctl --columns=locators list Physical_Locator_Set $(vtep-ctl --columns=locator_set list Mcast_Macs_Remote | cut -d ':' -f2) | cut -d ':' -f2 | tr -d '[[ ]]' | sed 's/,/ /g'`; do + vtep-ctl --columns=dst_ip list Physical_Locator $i | cut -d ':' -f2 | tr -d ' ' +done | sort], [0], [dnl +"1.2.3.5" +"1.2.3.6" +]) + +OVN_CONTROLLER_VTEP_STOP +AT_CLEANUP From patchwork Tue Jun 15 16:26:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladislav Odintsov X-Patchwork-Id: 1492354 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=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=YTlBqq8t; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.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 ozlabs.org (Postfix) with ESMTPS id 4G4DHC729Tz9sW6 for ; Wed, 16 Jun 2021 02:27:03 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 009034053F; Tue, 15 Jun 2021 16:27:02 +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 EGAFroqIO8lD; Tue, 15 Jun 2021 16:27:01 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2DF6A4041B; Tue, 15 Jun 2021 16:27:00 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 28CE5C0027; Tue, 15 Jun 2021 16:26:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 24CE9C000B for ; Tue, 15 Jun 2021 16:26:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1C08E83C0D for ; Tue, 15 Jun 2021 16:26:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LwtiqYpcuoa6 for ; Tue, 15 Jun 2021 16:26:53 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by smtp1.osuosl.org (Postfix) with ESMTPS id 3E86C83C02 for ; Tue, 15 Jun 2021 16:26:53 +0000 (UTC) Received: by mail-lj1-x234.google.com with SMTP id l4so13364601ljg.0 for ; Tue, 15 Jun 2021 09:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+OVF4g7p7lysCBCFrq21oNDrTQQXxrv3HocDDd4nvu0=; b=YTlBqq8tTXS/0c9HgddzyixqULzgN2mzX0YOa2ZQdfU1qPy/yGbot9lyGFDemNQaWG 6upvXlmRJMbYeHK81n33w4S6Ef+H3h2K8aNueZ34u4IawsfmrfnsqAFbE+qZwWzfeKaw WGtE8DZIITQR5ci0NsgUQUNuDAaGqKzGWCXXMloH6s+n7yrKPKzA1oY4cueEiDrUJafa B8MeMtsSdspi2QcqC7R/ApbqLXasNxZkNf2i9HYJ0HNhw3tGxQfVEVomZ6HBNKZ4aaAT OAUH9+RXmtfhLscvqyljgauaQMVbJ1mtVJSdmqja6vpgquPqpJdhpGxqt+iD5BdHk2L8 FgJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+OVF4g7p7lysCBCFrq21oNDrTQQXxrv3HocDDd4nvu0=; b=DyX/pwuX78DFitFCj7HohEFK4GEidraOG3cSSzdushM12uqwsgMoTM8vWdIBk5nyDA /mzlVnPVHZHI9bH7CCAmccwrSzdyMNa9WlapKIv21PkPyJtq2Ha79QStDibWlm2WCxCf 2EbjTok/srOcUfMjPViB4m6yWFi2a0BxHYXnU0He7/4/8WjZxy8sgKyGt+HE9r71xiSs pSGZdNp/IGVDqgB3CRHtgyexvwiuPeFksJuDztB97OMDhbn7oCKll3oPUG+pXwdlw2A4 LjcWanD+c4oR8K1MwE+tCrcCyLaccc3eik/SUj1RvIYKLNB0KhcztPdhPRx/IpniF7OJ 6P4Q== X-Gm-Message-State: AOAM5322IU9LlQB6thvBAh4/pK4PLs4NtZRHhXPtm/EnETnv27ECfkWL 4iVRixECduGchGQcTpf65vss6nB95adV8eco X-Google-Smtp-Source: ABdhPJx5/icVwf/XtSGIenZJvrdkFmaGjPw2ycEsWg1XsB0F98m0gEpJh2e1hCOw7oKKGXAFgk8IMQ== X-Received: by 2002:a2e:9b0e:: with SMTP id u14mr370052lji.123.1623774411130; Tue, 15 Jun 2021 09:26:51 -0700 (PDT) Received: from Vladislavs-MacBook-Pro.local.ru (109-252-131-42.dynamic.spd-mgts.ru. [109.252.131.42]) by smtp.gmail.com with ESMTPSA id d5sm2016472lfn.170.2021.06.15.09.26.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jun 2021 09:26:50 -0700 (PDT) From: Vladislav Odintsov To: dev@openvswitch.org Date: Tue, 15 Jun 2021 19:26:09 +0300 Message-Id: <20210615162609.22559-3-odivlad@gmail.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210615162609.22559-1-odivlad@gmail.com> References: <20210615162609.22559-1-odivlad@gmail.com> MIME-Version: 1.0 Cc: Dumitru Ceara , Vladislav Odintsov Subject: [ovs-dev] [PATCH ovn v3 2/2] controller-vtep: Update tunnel_key and replication_mode if needed 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" Signed-off-by: Vladislav Odintsov Acked-by: Dumitru Ceara --- controller-vtep/vtep.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/controller-vtep/vtep.c b/controller-vtep/vtep.c index 49723b39d..314cc4eae 100644 --- a/controller-vtep/vtep.c +++ b/controller-vtep/vtep.c @@ -234,18 +234,23 @@ vtep_lswitch_run(struct shash *vtep_pbs, struct sset *vtep_pswitches, } tnl_key = port_binding_rec->datapath->tunnel_key; - if (vtep_ls->n_tunnel_key - && vtep_ls->tunnel_key[0] != tnl_key) { - VLOG_DBG("set vtep logical switch (%s) tunnel key from " - "(%"PRId64") to (%"PRId64")", vtep_ls->name, - vtep_ls->tunnel_key[0], tnl_key); + if ((vtep_ls->n_tunnel_key && vtep_ls->tunnel_key[0] != tnl_key) + || !vtep_ls->n_tunnel_key) { + VLOG_DBG("set vtep logical switch (%s) tunnel key to %"PRId64, + vtep_ls->name, tnl_key); + vteprec_logical_switch_set_tunnel_key(vtep_ls, &tnl_key, 1); } - vteprec_logical_switch_set_tunnel_key(vtep_ls, &tnl_key, 1); /* OVN is expected to always use source node replication mode, * hence the replication mode is hard-coded for each logical * switch in the context of ovn-controller-vtep. */ - vteprec_logical_switch_set_replication_mode(vtep_ls, "source_node"); + if (!vtep_ls->replication_mode + || strcmp(vtep_ls->replication_mode, "source_node")) { + + vteprec_logical_switch_set_replication_mode(vtep_ls, + "source_node"); + } + sset_add(&used_ls, lswitch_name); } }