[ovs-dev,4/5] ovn-controller: Support multiple encaps simultaneously.
diff mbox

Message ID 20151015201917.GE9615@nicira.com
State Not Applicable
Headers show

Commit Message

Ben Pfaff Oct. 15, 2015, 8:19 p.m. UTC
On Thu, Oct 15, 2015 at 01:54:59AM -0700, Justin Pettit wrote:
> Signed-off-by: Justin Pettit <jpettit@nicira.com>

The chassis.c code only verifies the IP address for one of the
encapsulations, maybe it should do it for all of them, something like
this:


Acked-by: Ben Pfaff <blp@nicira.com>

Comments

Justin Pettit Oct. 16, 2015, 7:45 a.m. UTC | #1
> On Oct 15, 2015, at 1:19 PM, Ben Pfaff <blp@nicira.com> wrote:
> 
> On Thu, Oct 15, 2015 at 01:54:59AM -0700, Justin Pettit wrote:
>> Signed-off-by: Justin Pettit <jpettit@nicira.com>
> 
> The chassis.c code only verifies the IP address for one of the
> encapsulations, maybe it should do it for all of them, something like
> this:
> 
> diff --git a/ovn/controller/chassis.c b/ovn/controller/chassis.c
> index 894000d..84791c0 100644
> --- a/ovn/controller/chassis.c
> +++ b/ovn/controller/chassis.c
> @@ -90,13 +90,16 @@ chassis_run(struct controller_ctx *ctx, const char *chassis_id)
>     free(tokstr);
> 
>     if (chassis_rec) {
> +        /* Compare desired tunnels against those currently in the database. */
>         uint32_t cur_tunnels = 0;
> +        bool same = true;
>         for (int i = 0; i < chassis_rec->n_encaps; i++) {
>             cur_tunnels |= get_tunnel_type(chassis_rec->encaps[i]->type);
> +            same = same && strcmp(chassis_rec->encaps[i]->ip, encap_ip);
>         }
> +        same = same && req_tunnels == cur_tunnels;
> 
> -        if (req_tunnels == cur_tunnels
> -            && !strcmp(chassis_rec->encaps[0]->ip, encap_ip)) {
> +        if (same) {
>             /* Nothing changed. */
>             inited = true;
>             return;
> 
> Acked-by: Ben Pfaff <blp@nicira.com>

Good suggestion.  Thanks!

--Justin

Patch
diff mbox

diff --git a/ovn/controller/chassis.c b/ovn/controller/chassis.c
index 894000d..84791c0 100644
--- a/ovn/controller/chassis.c
+++ b/ovn/controller/chassis.c
@@ -90,13 +90,16 @@  chassis_run(struct controller_ctx *ctx, const char *chassis_id)
     free(tokstr);
 
     if (chassis_rec) {
+        /* Compare desired tunnels against those currently in the database. */
         uint32_t cur_tunnels = 0;
+        bool same = true;
         for (int i = 0; i < chassis_rec->n_encaps; i++) {
             cur_tunnels |= get_tunnel_type(chassis_rec->encaps[i]->type);
+            same = same && strcmp(chassis_rec->encaps[i]->ip, encap_ip);
         }
+        same = same && req_tunnels == cur_tunnels;
 
-        if (req_tunnels == cur_tunnels
-            && !strcmp(chassis_rec->encaps[0]->ip, encap_ip)) {
+        if (same) {
             /* Nothing changed. */
             inited = true;
             return;