If one end is configured external-ids:ovn-encap-type=geneve,stt,the other 
end is configured external-ids:ovn-encap-type=stt,
then the tunnel is not available based on the current 
implementation,because one end is geneve,the other end is stt.
After this revision,the tunnel will be stt on both ends,and it will be 
available.





发件人:         xurong00037997 <[email protected]>
收件人:         [email protected], 
抄送:   xurong00037997 <[email protected]>
日期:   2017/05/04 10:00
主题:   [PATCH 2/2] Ovn tunnel encapsulation should consider both local 
and remote



---
 ovn/controller/encaps.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/ovn/controller/encaps.c b/ovn/controller/encaps.c
index f187a8f..5da7fbe 100644
--- a/ovn/controller/encaps.c
+++ b/ovn/controller/encaps.c
@@ -136,14 +136,14 @@ exit:
 }
 
 static struct sbrec_encap *
-preferred_encap(const struct sbrec_chassis *chassis_rec)
+preferred_encap(const struct sbrec_chassis *chassis_rec, uint32_t 
all_encap_type)
 {
     struct sbrec_encap *best_encap = NULL;
     uint32_t best_type = 0;
 
     for (int i = 0; i < chassis_rec->n_encaps; i++) {
         uint32_t tun_type = 
get_tunnel_type(chassis_rec->encaps[i]->type);
-        if (tun_type > best_type) {
+        if (tun_type > best_type && (tun_type & all_encap_type)) {
             best_type = tun_type;
             best_encap = chassis_rec->encaps[i];
         }
@@ -197,11 +197,18 @@ encaps_run(struct controller_ctx *ctx, const struct 
ovsrec_bridge *br_int,
             }
         }
     }
+ 
+    const struct sbrec_chassis *lchassis_rec
+        = get_chassis(ctx->ovnsb_idl, chassis_id);
+    uint32_t all_encap_type = 0;
+    for (int i = 0; i < lchassis_rec->n_encaps; i++) {
+        all_encap_type |= get_tunnel_type(lchassis_rec->encaps[i]->type);
+    }
 
     SBREC_CHASSIS_FOR_EACH(chassis_rec, ctx->ovnsb_idl) {
         if (strcmp(chassis_rec->name, chassis_id)) {
             /* Create tunnels to the other chassis. */
-            const struct sbrec_encap *encap = 
preferred_encap(chassis_rec);
+            const struct sbrec_encap *encap = 
preferred_encap(chassis_rec,all_encap_type);
             if (!encap) {
                 VLOG_INFO("No supported encaps for '%s'", 
chassis_rec->name);
                 continue;
-- 
2.8.1



_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to