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

lmartins at redhat.com lmartins at redhat.com
Wed Jun 26 10:59:30 UTC 2019


From: Lucas Alvares Gomes <lucasagomes at 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 at gmail.com>
---
v1 -> v2
  * Fix "line is > 79 characters" warnings

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

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
-- 
2.22.0



More information about the dev mailing list