Re: [ovs-dev] [PATCH v2 1/4] ovn: l3ha, handling of multiple gateways

2017-06-13 Thread Russell Bryant
On Tue, Jun 13, 2017 at 1:22 PM, Guru Shetty  wrote:
>
>
> On 13 June 2017 at 10:17, Russell Bryant  wrote:
>>
>> On Fri, Jun 9, 2017 at 10:46 AM, Guru Shetty  wrote:
>> > On 8 June 2017 at 14:39, Ben Pfaff  wrote:
>> >
>> >> On Thu, Jun 08, 2017 at 02:05:05PM +, majop...@redhat.com wrote:
>> >> > From: Miguel Angel Ajo 
>> >> >
>> >> > This patch handles multiple gateways with priorities in
>> >> > chassisredirect
>> >> > ports, any gateway with a chassis redirect port will implement the
>> >> > rules to de-encapsulate incomming packets for such port.
>> >> >
>> >> > And hosts targetting a remote chassisredirect port will setup a
>> >> > bundle(active_backup, ..) action to each tunnel port, in the given
>> >> > priority order.
>> >> >
>> >> > Signed-off-by: Miguel Angel Ajo 
>> >>
>> >> I feel unqualified to fully and properly review this series.  Guru, is
>> >> it something you'd feel able to take a look at?  Is anyone else
>> >> planning
>> >> to review this?
>> >>
>> >
>> > I will have a go at it.
>>
>> Thanks a lot, Guru.  Since this is important for OpenStack, let me
>> know if you won't have time to review and I'll make time to help.  I
>> think you're a better reviewer for this one, though.
>
> Russell,
>  If you want to do the initial round, please go ahead. Since you know more
> about the usecase and how it is to be used by OpenStack, your review will
> help.

OK - I'll do a pass on them.

-- 
Russell Bryant
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2 1/4] ovn: l3ha, handling of multiple gateways

2017-06-13 Thread Guru Shetty
On 13 June 2017 at 10:17, Russell Bryant  wrote:

> On Fri, Jun 9, 2017 at 10:46 AM, Guru Shetty  wrote:
> > On 8 June 2017 at 14:39, Ben Pfaff  wrote:
> >
> >> On Thu, Jun 08, 2017 at 02:05:05PM +, majop...@redhat.com wrote:
> >> > From: Miguel Angel Ajo 
> >> >
> >> > This patch handles multiple gateways with priorities in
> chassisredirect
> >> > ports, any gateway with a chassis redirect port will implement the
> >> > rules to de-encapsulate incomming packets for such port.
> >> >
> >> > And hosts targetting a remote chassisredirect port will setup a
> >> > bundle(active_backup, ..) action to each tunnel port, in the given
> >> > priority order.
> >> >
> >> > Signed-off-by: Miguel Angel Ajo 
> >>
> >> I feel unqualified to fully and properly review this series.  Guru, is
> >> it something you'd feel able to take a look at?  Is anyone else planning
> >> to review this?
> >>
> >
> > I will have a go at it.
>
> Thanks a lot, Guru.  Since this is important for OpenStack, let me
> know if you won't have time to review and I'll make time to help.  I
> think you're a better reviewer for this one, though.
>
Russell,
 If you want to do the initial round, please go ahead. Since you know more
about the usecase and how it is to be used by OpenStack, your review will
help.


>
> --
> Russell Bryant
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2 1/4] ovn: l3ha, handling of multiple gateways

2017-06-13 Thread Russell Bryant
On Fri, Jun 9, 2017 at 10:46 AM, Guru Shetty  wrote:
> On 8 June 2017 at 14:39, Ben Pfaff  wrote:
>
>> On Thu, Jun 08, 2017 at 02:05:05PM +, majop...@redhat.com wrote:
>> > From: Miguel Angel Ajo 
>> >
>> > This patch handles multiple gateways with priorities in chassisredirect
>> > ports, any gateway with a chassis redirect port will implement the
>> > rules to de-encapsulate incomming packets for such port.
>> >
>> > And hosts targetting a remote chassisredirect port will setup a
>> > bundle(active_backup, ..) action to each tunnel port, in the given
>> > priority order.
>> >
>> > Signed-off-by: Miguel Angel Ajo 
>>
>> I feel unqualified to fully and properly review this series.  Guru, is
>> it something you'd feel able to take a look at?  Is anyone else planning
>> to review this?
>>
>
> I will have a go at it.

Thanks a lot, Guru.  Since this is important for OpenStack, let me
know if you won't have time to review and I'll make time to help.  I
think you're a better reviewer for this one, though.

-- 
Russell Bryant
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2 1/4] ovn: l3ha, handling of multiple gateways

2017-06-09 Thread Guru Shetty
On 8 June 2017 at 14:39, Ben Pfaff  wrote:

> On Thu, Jun 08, 2017 at 02:05:05PM +, majop...@redhat.com wrote:
> > From: Miguel Angel Ajo 
> >
> > This patch handles multiple gateways with priorities in chassisredirect
> > ports, any gateway with a chassis redirect port will implement the
> > rules to de-encapsulate incomming packets for such port.
> >
> > And hosts targetting a remote chassisredirect port will setup a
> > bundle(active_backup, ..) action to each tunnel port, in the given
> > priority order.
> >
> > Signed-off-by: Miguel Angel Ajo 
>
> I feel unqualified to fully and properly review this series.  Guru, is
> it something you'd feel able to take a look at?  Is anyone else planning
> to review this?
>

I will have a go at it.

>
> Thanks,
>
> Ben.
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2 1/4] ovn: l3ha, handling of multiple gateways

2017-06-09 Thread Miguel Angel Ajo Pelayo
I'd like this feature to be considered for OVS 2.8,

I know the deadline for branching is close, but this would let us implement
l3ha on the networking-ovn side, closing one of the gaps we have
with the reference implementation now.


Best regards,
Miguel Ángel

On Fri, Jun 9, 2017 at 11:35 AM, Miguel Angel Ajo Pelayo <
majop...@redhat.com> wrote:

> Thank you Ben and Guru,
>
> I plan to generalise this work with follow up patches, to let us
> setup a multiple chassis on a Logical_Router too (and hence handle it
> via the l3gateway ports).
>
>Anil Venkata is also working on a follow up patch to make sure
> gARPs are only  announced on the master/active gateway.
>
>
> On Thu, Jun 8, 2017 at 11:39 PM, Ben Pfaff  wrote:
>
>> On Thu, Jun 08, 2017 at 02:05:05PM +, majop...@redhat.com wrote:
>> > From: Miguel Angel Ajo 
>> >
>> > This patch handles multiple gateways with priorities in chassisredirect
>> > ports, any gateway with a chassis redirect port will implement the
>> > rules to de-encapsulate incomming packets for such port.
>> >
>> > And hosts targetting a remote chassisredirect port will setup a
>> > bundle(active_backup, ..) action to each tunnel port, in the given
>> > priority order.
>> >
>> > Signed-off-by: Miguel Angel Ajo 
>>
>> I feel unqualified to fully and properly review this series.  Guru, is
>> it something you'd feel able to take a look at?  Is anyone else planning
>> to review this?
>>
>> Thanks,
>>
>> Ben.
>>
>
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2 1/4] ovn: l3ha, handling of multiple gateways

2017-06-09 Thread Miguel Angel Ajo Pelayo
Thank you Ben and Guru,

I plan to generalise this work with follow up patches, to let us
setup a multiple chassis on a Logical_Router too (and hence handle it
via the l3gateway ports).

   Anil Venkata is also working on a follow up patch to make sure
gARPs are only  announced on the master/active gateway.


On Thu, Jun 8, 2017 at 11:39 PM, Ben Pfaff  wrote:

> On Thu, Jun 08, 2017 at 02:05:05PM +, majop...@redhat.com wrote:
> > From: Miguel Angel Ajo 
> >
> > This patch handles multiple gateways with priorities in chassisredirect
> > ports, any gateway with a chassis redirect port will implement the
> > rules to de-encapsulate incomming packets for such port.
> >
> > And hosts targetting a remote chassisredirect port will setup a
> > bundle(active_backup, ..) action to each tunnel port, in the given
> > priority order.
> >
> > Signed-off-by: Miguel Angel Ajo 
>
> I feel unqualified to fully and properly review this series.  Guru, is
> it something you'd feel able to take a look at?  Is anyone else planning
> to review this?
>
> Thanks,
>
> Ben.
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2 1/4] ovn: l3ha, handling of multiple gateways

2017-06-08 Thread Ben Pfaff
On Thu, Jun 08, 2017 at 02:05:05PM +, majop...@redhat.com wrote:
> From: Miguel Angel Ajo 
> 
> This patch handles multiple gateways with priorities in chassisredirect
> ports, any gateway with a chassis redirect port will implement the
> rules to de-encapsulate incomming packets for such port.
> 
> And hosts targetting a remote chassisredirect port will setup a
> bundle(active_backup, ..) action to each tunnel port, in the given
> priority order.
> 
> Signed-off-by: Miguel Angel Ajo 

I feel unqualified to fully and properly review this series.  Guru, is
it something you'd feel able to take a look at?  Is anyone else planning
to review this?

Thanks,

Ben.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2 1/4] ovn: l3ha, handling of multiple gateways

2017-06-08 Thread majopela
From: Miguel Angel Ajo 

This patch handles multiple gateways with priorities in chassisredirect
ports, any gateway with a chassis redirect port will implement the
rules to de-encapsulate incomming packets for such port.

And hosts targetting a remote chassisredirect port will setup a
bundle(active_backup, ..) action to each tunnel port, in the given
priority order.

Signed-off-by: Miguel Angel Ajo 
---
 ovn/controller/binding.c|   9 +--
 ovn/controller/lflow.c  |   6 +-
 ovn/controller/lport.c  | 119 
 ovn/controller/lport.h  |  28 ++
 ovn/controller/ovn-controller.c |   5 +-
 ovn/controller/physical.c   | 114 --
 tests/ovn.at| 114 ++
 7 files changed, 369 insertions(+), 26 deletions(-)

diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c
index bb76608..d45c5df 100644
--- a/ovn/controller/binding.c
+++ b/ovn/controller/binding.c
@@ -394,12 +394,13 @@ consider_local_datapath(struct controller_ctx *ctx,
false, local_datapaths);
 }
 } else if (!strcmp(binding_rec->type, "chassisredirect")) {
-const char *chassis_id = smap_get(_rec->options,
-  "redirect-chassis");
-our_chassis = chassis_id && !strcmp(chassis_id, chassis_rec->name);
-if (our_chassis) {
+if (pb_redirect_chassis_contains(binding_rec, chassis_rec)) {
 add_local_datapath(ldatapaths, lports, binding_rec->datapath,
false, local_datapaths);
+// XXX this should only be set to true if our chassis
+// (chassis_rec) is the master for this chassisredirect port
+// but for now we'll bind it only when not bound
+our_chassis = !binding_rec->chassis;
 }
 } else if (!strcmp(binding_rec->type, "l3gateway")) {
 const char *chassis_id = smap_get(_rec->options,
diff --git a/ovn/controller/lflow.c b/ovn/controller/lflow.c
index b1b4b23..b7d1bcb 100644
--- a/ovn/controller/lflow.c
+++ b/ovn/controller/lflow.c
@@ -96,7 +96,11 @@ is_chassis_resident_cb(const void *c_aux_, const char 
*port_name)
 
 const struct sbrec_port_binding *pb
 = lport_lookup_by_name(c_aux->lports, port_name);
-return pb && pb->chassis && pb->chassis == c_aux->chassis;
+if (pb && pb->chassis && pb->chassis == c_aux->chassis) {
+return true;
+} else {
+return pb_redirect_chassis_contains(pb, c_aux->chassis);
+}
 }
 
 static bool
diff --git a/ovn/controller/lport.c b/ovn/controller/lport.c
index 906fda2..52608a1 100644
--- a/ovn/controller/lport.c
+++ b/ovn/controller/lport.c
@@ -237,3 +237,122 @@ mcgroup_lookup_by_dp_name(const struct mcgroup_index 
*mcgroups,
 }
 return NULL;
 }
+
+
+/* redirect-chassis option parsing
+ */
+static int
+compare_chassis_prio_(const void *a_, const void *b_)
+{
+const struct redirect_chassis *chassis_a = a_;
+const struct redirect_chassis *chassis_b = b_;
+int prio_diff = chassis_b->prio - chassis_a->prio;
+if (!prio_diff) {
+return strcmp(chassis_a->chassis_id, chassis_b->chassis_id);
+}
+return prio_diff;
+}
+
+struct ovs_list*
+parse_redirect_chassis(const struct sbrec_port_binding *binding)
+{
+
+const char *redir_chassis_const;
+char *redir_chassis_str;
+char *save_ptr1 = NULL;
+char *chassis_prio;
+
+struct redirect_chassis *redirect_chassis =
+xmalloc(sizeof *redirect_chassis);
+
+int n=0;
+
+redir_chassis_const = smap_get(>options, "redirect-chassis");
+
+if (!redir_chassis_const) {
+free(redirect_chassis);
+return NULL;
+}
+
+redir_chassis_str = xstrdup(redir_chassis_const);
+
+for (chassis_prio = strtok_r(redir_chassis_str, ", ", _ptr1);
+ chassis_prio; chassis_prio = strtok_r(NULL, ", ", _ptr1)) {
+
+char *save_ptr2 = NULL;
+char *chassis_name = strtok_r(chassis_prio, ":", _ptr2);
+char *prio = strtok_r(NULL, ":", _ptr2);
+
+if (strlen(chassis_name) > UUID_LEN) {
+static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
+VLOG_WARN_RL(, "chassis name (%s) in redirect-chassis option "
+  "of logical port %s is too long, ignoring.",
+  chassis_name, binding->logical_port);
+continue;
+}
+
+ovs_strzcpy(redirect_chassis[n].chassis_id, chassis_name,
+UUID_LEN + 1);
+
+/* chassis with no priority get lowest priority: 0 */
+redirect_chassis[n].prio = prio ? atoi(prio):0;
+
+redirect_chassis = xrealloc(redirect_chassis,
+sizeof *redirect_chassis * (++n + 1));
+
+}
+
+free(redir_chassis_str);
+
+qsort(redirect_chassis,