diff mbox series

[ovs-dev,v3,2/2] controller-vtep: Update tunnel_key and replication_mode if needed

Message ID 20210611114413.5897-3-odivlad@gmail.com
State Superseded, archived
Headers show
Series controller-vtep: Fix MMR creation and commit only changed data | expand

Commit Message

Vladislav Odintsov June 11, 2021, 11:44 a.m. UTC
Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
---
 controller-vtep/vtep.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

Comments

Dumitru Ceara June 15, 2021, 3:51 p.m. UTC | #1
On 6/11/21 1:44 PM, Vladislav Odintsov wrote:
> Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
> ---

Acked-by: Dumitru Ceara <dceara@redhat.com>

Thanks!
diff mbox series

Patch

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