[ovs-dev,v2] OVN: Enhance ovndb-servers.ocf to handle inactive_probe_interval updates
diff mbox series

Message ID 20190626105930.10018-1-lmartins@redhat.com
State New
Headers show
Series
  • [ovs-dev,v2] OVN: Enhance ovndb-servers.ocf to handle inactive_probe_interval updates
Related show

Commit Message

Lucas Alvares Gomes June 26, 2019, 10:59 a.m. UTC
From: Lucas Alvares Gomes <lucasagomes@gmail.com>

This patch is enhacing the ovndb-servers.ocf script to handle updates to
the inactive_probe_interval via pacemaker. For example, one could run:

$ sudo crm_resource --resource ovndb_servers --set-parameter
inactive_probe_interval --parameter-value <new probe value>

To set a new inactive probe interval in OVSDB. The patch also handles
the case were multiple connection exists.

Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
---
v1 -> v2
  * Fix "line is > 79 characters" warnings

 ovn/utilities/ovndb-servers.ocf | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

Comments

Ben Pfaff June 26, 2019, 7:11 p.m. UTC | #1
On Wed, Jun 26, 2019 at 11:59:30AM +0100, lmartins@redhat.com wrote:
> From: Lucas Alvares Gomes <lucasagomes@gmail.com>
> 
> This patch is enhacing the ovndb-servers.ocf script to handle updates to
> the inactive_probe_interval via pacemaker. For example, one could run:
> 
> $ sudo crm_resource --resource ovndb_servers --set-parameter
> inactive_probe_interval --parameter-value <new probe value>
> 
> To set a new inactive probe interval in OVSDB. The patch also handles
> the case were multiple connection exists.
> 
> Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>

Numan or Ali, would you mind reviewing this?  It is outside my expertise
and you seem to be recent contributors.
Numan Siddique June 26, 2019, 7:13 p.m. UTC | #2
On Thu, Jun 27, 2019 at 12:41 AM Ben Pfaff <blp@ovn.org> wrote:

> On Wed, Jun 26, 2019 at 11:59:30AM +0100, lmartins@redhat.com wrote:
> > From: Lucas Alvares Gomes <lucasagomes@gmail.com>
> >
> > This patch is enhacing the ovndb-servers.ocf script to handle updates to
> > the inactive_probe_interval via pacemaker. For example, one could run:
> >
> > $ sudo crm_resource --resource ovndb_servers --set-parameter
> > inactive_probe_interval --parameter-value <new probe value>
> >
> > To set a new inactive probe interval in OVSDB. The patch also handles
> > the case were multiple connection exists.
> >
> > Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
>
> Numan or Ali, would you mind reviewing this?  It is outside my expertise
> and you seem to be recent contributors.
>

I will take a look at it.

Thanks
Numan
Numan Siddique June 29, 2019, 5:07 a.m. UTC | #3
On Thu, Jun 27, 2019 at 12:43 AM Numan Siddique <nusiddiq@redhat.com> wrote:

>
>
> On Thu, Jun 27, 2019 at 12:41 AM Ben Pfaff <blp@ovn.org> wrote:
>
>> On Wed, Jun 26, 2019 at 11:59:30AM +0100, lmartins@redhat.com wrote:
>> > From: Lucas Alvares Gomes <lucasagomes@gmail.com>
>> >
>> > This patch is enhacing the ovndb-servers.ocf script to handle updates to
>> > the inactive_probe_interval via pacemaker. For example, one could run:
>> >
>> > $ sudo crm_resource --resource ovndb_servers --set-parameter
>> > inactive_probe_interval --parameter-value <new probe value>
>> >
>> > To set a new inactive probe interval in OVSDB. The patch also handles
>> > the case were multiple connection exists.
>> >
>> > Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
>>
>
Acked-by: Numan Siddique <nusiddiq@redhat.com>



>
>> Numan or Ali, would you mind reviewing this?  It is outside my expertise
>> and you seem to be recent contributors.
>>
>
> I will take a look at it.
>
> Thanks
> Numan
>
>
aginwala June 29, 2019, 6:11 p.m. UTC | #4
Thanks Lucas for the patch:

It's good to update inactivity_probe via crm resource as we ideally use
ovn-nbtl/ovn-sbctl commands to do that since the value one chooses depends
on scale and can be different for everyone and we always tune it from
active node. Also what do you mean by multiple connections? It's possible
to run ovn nb db and ovn sb db in dual mode with pssl and ptcp which is
where you can set multiple entries in the connection table afaik and sure
instead of running nbctl/sbctl multiple times, this patch will help. Hence,
brief explanation in doc would be helpful too. Since you are exposing this
through crm_resource, update Documentation/topics/integration.rst in
pacemaker section so that user can also read that option and leverage
multiple probe update via this patch.

On Fri, Jun 28, 2019 at 10:08 PM Numan Siddique <nusiddiq@redhat.com> wrote:

> On Thu, Jun 27, 2019 at 12:43 AM Numan Siddique <nusiddiq@redhat.com>
> wrote:
>
> >
> >
> > On Thu, Jun 27, 2019 at 12:41 AM Ben Pfaff <blp@ovn.org> wrote:
> >
> >> On Wed, Jun 26, 2019 at 11:59:30AM +0100, lmartins@redhat.com wrote:
> >> > From: Lucas Alvares Gomes <lucasagomes@gmail.com>
> >> >
> >> > This patch is enhacing the ovndb-servers.ocf script to handle updates
> to
> >> > the inactive_probe_interval via pacemaker. For example, one could run:
> >> >
> >> > $ sudo crm_resource --resource ovndb_servers --set-parameter
> >> > inactive_probe_interval --parameter-value <new probe value>
> >> >
> >> > To set a new inactive probe interval in OVSDB. The patch also handles
> >> > the case were multiple connection exists.
> >> >
> >> > Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
> >>
> >
> Acked-by: Numan Siddique <nusiddiq@redhat.com>
>
>
>
> >
> >> Numan or Ali, would you mind reviewing this?  It is outside my expertise
> >> and you seem to be recent contributors.
> >>
> >
> > I will take a look at it.
> >
> > Thanks
> > Numan
> >
> >
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>

Patch
diff mbox series

diff --git a/ovn/utilities/ovndb-servers.ocf b/ovn/utilities/ovndb-servers.ocf
index 10313304c..38f75d476 100755
--- a/ovn/utilities/ovndb-servers.ocf
+++ b/ovn/utilities/ovndb-servers.ocf
@@ -240,20 +240,42 @@  ovsdb_server_notify() {
         else
            LISTON_ON_IP=${MASTER_IP}
         fi
-        conn=`ovn-nbctl get NB_global . connections`
-        if [ "$conn" == "[]" ]
+        conn=$(ovn-nbctl get NB_global . connections | \
+               awk -F'[][]' '{print $2}')
+        if [ -z "$conn" ]
         then
             ovn-nbctl -- --id=@conn_uuid create Connection \
 target="p${NB_MASTER_PROTO}\:${NB_MASTER_PORT}\:${LISTON_ON_IP}" \
 inactivity_probe=$INACTIVE_PROBE -- set NB_Global . connections=@conn_uuid
+        else
+            for c in ${conn/, // }
+            do
+                iprob=`ovn-nbctl get Connection $c inactivity_probe`
+                if [ $iprob != $INACTIVE_PROBE ]
+                then
+                    ovn-nbctl set Connection $c \
+                    inactivity_probe=$INACTIVE_PROBE
+                fi
+            done
         fi
 
-        conn=`ovn-sbctl get SB_global . connections`
-        if [ "$conn" == "[]" ]
+        conn=$(ovn-sbctl get SB_global . connections | \
+               awk -F'[][]' '{print $2}')
+        if [ -z "$conn" ]
         then
             ovn-sbctl -- --id=@conn_uuid create Connection \
 target="p${SB_MASTER_PROTO}\:${SB_MASTER_PORT}\:${LISTON_ON_IP}" \
 inactivity_probe=$INACTIVE_PROBE -- set SB_Global . connections=@conn_uuid
+        else
+            for c in ${conn/, // }
+            do
+                iprob=`ovn-sbctl get Connection $c inactivity_probe`
+                if [ $iprob != $INACTIVE_PROBE ]
+                then
+                    ovn-sbctl set Connection $c \
+                    inactivity_probe=$INACTIVE_PROBE
+                fi
+            done
         fi
 
     else