Hi Thuan

ack (review) with minor comment.

Here -a is used for AND but && is used elsewhere in the file. We could be more 
consistent.

#value is cleaned after a lease time, keep watching

Maybe rechange to

#value is cleared after lease time, keep watching

Thanks
Gary
________________________________
From: Thuan Tran <[email protected]>
Sent: 20 February 2020 22:21
To: Gary Lee <[email protected]>; Vu Minh Nguyen 
<[email protected]>; Minh Hon Chau <[email protected]>; Thang 
Duc Nguyen <[email protected]>
Cc: [email protected] <[email protected]>; 
Thuan Tran <[email protected]>
Subject: [PATCH 1/1] osaf: fix etcd3.plugin watch takeover_request [#3158]

After reject a takeover_request, value is cleaned after a lease time
then it mistaken raise a change value become empty. It leads to osafrded
handle and reboot itself as lost connectivity to consensus.
---
 src/osaf/consensus/plugins/etcd3.plugin | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/osaf/consensus/plugins/etcd3.plugin 
b/src/osaf/consensus/plugins/etcd3.plugin
index 60559a0e9..e8fa6b6e7 100644
--- a/src/osaf/consensus/plugins/etcd3.plugin
+++ b/src/osaf/consensus/plugins/etcd3.plugin
@@ -362,6 +362,14 @@ watch() {
           return 1
         fi
       elif [ "$orig_value" != "$current_value" ]; then
+        if [ "$watch_key" == "$takeover_request" ]; then
+          state=$(echo $orig_value | awk '{print $4}')
+          if [ "$state" == "REJECTED" -a -z "$current_value" ]; then
+            #value is cleaned after a lease time, keep watching
+            orig_value=""
+            continue
+          fi
+        fi
         echo $current_value
         return 0
       fi
--
2.17.1


_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to