diff mbox

[ovs-dev,2/2] Ovn tunnel encapsulation should consider both local and remote

Message ID 201705080141.v481fSSM056529@mse01.zte.com.cn
State Not Applicable
Headers show

Commit Message

xurong00037997 May 8, 2017, 1:35 a.m. UTC
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 <xu.rong@zte.com.cn>
收件人:         dev@openvswitch.org, 
抄送:   xurong00037997 <xu.rong@zte.com.cn>
日期:   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(-)

             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

Comments

Ben Pfaff July 6, 2017, 10:37 p.m. UTC | #1
I took another look at this and now I understand the problem that it is
meant to solve.  I think that it assumes that a hypervisor that only
offers, for example, STT, to remote hypervisors, is not capable of
using Geneve or VXLAN for tunneling to remote hypervisors.  I don't
think that's a correct assumption.

On Mon, May 08, 2017 at 09:35:37AM +0800, xu.rong@zte.com.cn wrote:
> 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 <xu.rong@zte.com.cn>
> 收件人:         dev@openvswitch.org, 
> 抄送:   xurong00037997 <xu.rong@zte.com.cn>
> 日期:   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
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox

Patch

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;