From fd98ae58bfaea99212965e5e3fa09c1aa9ae349c Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Wed, 6 Jun 2018 18:18:58 -0400 Subject: [PATCH] Some improvements in selecting to fencea node --- NodeInstance.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/NodeInstance.py b/NodeInstance.py index a152b91b..fb6168ba 100644 --- a/NodeInstance.py +++ b/NodeInstance.py @@ -206,12 +206,13 @@ class NodeInstance(): node_state = 'unknown' node_keepalive = 0 - # Handle deadtime and fencng if needed (>30 seconds out-of-date keepalive info) + # Handle deadtime and fencng if needed + # (A node is considered dead when its keepalive timer is >30s out-of-date while in 'start' state) node_deadtime = int(time.time()) - 30 - if node_keepalive < node_deadtime and ( node_state != 'dead' and node_state != 'flush' and node_state != 'stop' ): + if node_keepalive < node_deadtime and node_state == 'start': print('>>> Node {} is dead! Performing fence operation in 3 seconds.'.format(node_name)) - self.zk.set('/domains/{}/state'.format(node_name), 'dead'.encode('ascii')) - fence_thread = threading.Thread(target=fencenode.fence, args=(node_name), kwargs={}) + self.zk.set('/nodes/{}/state'.format(node_name), 'dead'.encode('ascii')) + fence_thread = threading.Thread(target=fencenode.fence, args=(node_name, self.zk), kwargs={}) fence_thread.start() # Update the arrays