From 0c67812fc2464e80882ca34e17e3b4c592e39f26 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Sat, 27 Oct 2018 16:31:54 -0400 Subject: [PATCH] Fix shutdown secondary bug --- node-daemon/pvcd/Daemon.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/node-daemon/pvcd/Daemon.py b/node-daemon/pvcd/Daemon.py index 317e1331..0d6011df 100644 --- a/node-daemon/pvcd/Daemon.py +++ b/node-daemon/pvcd/Daemon.py @@ -325,7 +325,7 @@ def cleanup(): logger.out('Terminating pvcd and cleaning up', state='s') # Force into secondary network state if needed - if this_node.name == this_node.primary_node: + if zkhandler.readdata(zk_conn, '/nodes/{}/routerstate'.format(myhostname)) == 'primary': is_primary = True zkhandler.writedata(zk_conn, { '/nodes/{}/routerstate'.format(myhostname): 'secondary', @@ -577,6 +577,9 @@ def update_primart(new_primary, stat, event=''): zkhandler.writedata(zk_conn, {'/nodes/{}/routerstate'.format(myhostname): 'primary'}) else: zkhandler.writedata(zk_conn, {'/nodes/{}/routerstate'.format(myhostname): 'secondary'}) + else: + zkhandler.writedata(zk_conn, {'/nodes/{}/routerstate'.format(myhostname): 'client'}) + for node in d_node: d_node[node].primary_node = new_primary