diff mbox series

[ovs-dev] OVN: Enhance ovndb-servers.ocf to handle inactive_probe_interval updates

Message ID 20190626091201.31321-1-lmartins@redhat.com
State Superseded
Headers show
Series [ovs-dev] OVN: Enhance ovndb-servers.ocf to handle inactive_probe_interval updates | expand

Commit Message

Lucas Martins June 26, 2019, 9:12 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>
---
 ovn/utilities/ovndb-servers.ocf | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

Comments

0-day Robot June 26, 2019, 10:42 a.m. UTC | #1
Bleep bloop.  Greetings Lucas Alvares Gomes, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 80 characters long (recommended limit is 79)
#30 FILE: ovn/utilities/ovndb-servers.ocf:243:
        conn=`ovn-nbctl get NB_global . connections | awk -F'[][]' '{print $2}'`

WARNING: Line is 80 characters long (recommended limit is 79)
#42 FILE: ovn/utilities/ovndb-servers.ocf:255:
                    ovn-nbctl set Connection $c inactivity_probe=$INACTIVE_PROBE

WARNING: Line is 80 characters long (recommended limit is 79)
#49 FILE: ovn/utilities/ovndb-servers.ocf:260:
        conn=`ovn-sbctl get SB_global . connections | awk -F'[][]' '{print $2}'`

WARNING: Line is 80 characters long (recommended limit is 79)
#61 FILE: ovn/utilities/ovndb-servers.ocf:272:
                    ovn-sbctl set Connection $c inactivity_probe=$INACTIVE_PROBE

Lines checked: 69, Warnings: 4, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@bytheb.org

Thanks,
0-day Robot
Numan Siddique June 28, 2019, 6:16 p.m. UTC | #2
On Wed, Jun 26, 2019 at 2:42 PM <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>



> ---
>  ovn/utilities/ovndb-servers.ocf | 26 ++++++++++++++++++++++----
>  1 file changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/ovn/utilities/ovndb-servers.ocf
> b/ovn/utilities/ovndb-servers.ocf
> index 10313304c..62ac53b7c 100755
> --- a/ovn/utilities/ovndb-servers.ocf
> +++ b/ovn/utilities/ovndb-servers.ocf
> @@ -240,20 +240,38 @@ 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
> --
> 2.22.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Numan Siddique June 28, 2019, 6:17 p.m. UTC | #3
On Fri, Jun 28, 2019 at 11:46 PM Numan Siddique <nusiddiq@redhat.com> wrote:

>
>
> On Wed, Jun 26, 2019 at 2:42 PM <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>
>
>
Hi Lucas, there are few checkpatch warnings. You may want to fix those
errors
and submit v2.



>
>
>> ---
>>  ovn/utilities/ovndb-servers.ocf | 26 ++++++++++++++++++++++----
>>  1 file changed, 22 insertions(+), 4 deletions(-)
>>
>> diff --git a/ovn/utilities/ovndb-servers.ocf
>> b/ovn/utilities/ovndb-servers.ocf
>> index 10313304c..62ac53b7c 100755
>> --- a/ovn/utilities/ovndb-servers.ocf
>> +++ b/ovn/utilities/ovndb-servers.ocf
>> @@ -240,20 +240,38 @@ 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
>> --
>> 2.22.0
>>
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>>
>
Lucas Alvares Gomes June 28, 2019, 8:26 p.m. UTC | #4
On Fri, 28 Jun 2019, 19:17 Numan Siddique, <nusiddiq@redhat.com> wrote:

> On Fri, Jun 28, 2019 at 11:46 PM Numan Siddique <nusiddiq@redhat.com>
> wrote:
>
> >
> >
> > On Wed, Jun 26, 2019 at 2:42 PM <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>
> >
> >
> Hi Lucas, there are few checkpatch warnings. You may want to fix those
> errors
> and submit v2.
>

Hi Numans,

Thanks for looking into this, I've pushed a V2 already at
https://patchwork.ozlabs.org/patch/1122681/


>
>
> >
> >
> >> ---
> >>  ovn/utilities/ovndb-servers.ocf | 26 ++++++++++++++++++++++----
> >>  1 file changed, 22 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/ovn/utilities/ovndb-servers.ocf
> >> b/ovn/utilities/ovndb-servers.ocf
> >> index 10313304c..62ac53b7c 100755
> >> --- a/ovn/utilities/ovndb-servers.ocf
> >> +++ b/ovn/utilities/ovndb-servers.ocf
> >> @@ -240,20 +240,38 @@ 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
> >> --
> >> 2.22.0
> >>
> >> _______________________________________________
> >> dev mailing list
> >> dev@openvswitch.org
> >> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >>
> >
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/ovn/utilities/ovndb-servers.ocf b/ovn/utilities/ovndb-servers.ocf
index 10313304c..62ac53b7c 100755
--- a/ovn/utilities/ovndb-servers.ocf
+++ b/ovn/utilities/ovndb-servers.ocf
@@ -240,20 +240,38 @@  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