From 237a37015d447e86062b80bd30af70791cee1f63 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Mon, 21 Oct 2019 16:46:32 -0400 Subject: [PATCH] Set upstream IP in key if changed --- node-daemon/pvcd/Daemon.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/node-daemon/pvcd/Daemon.py b/node-daemon/pvcd/Daemon.py index a00b2b62..96d2a77e 100644 --- a/node-daemon/pvcd/Daemon.py +++ b/node-daemon/pvcd/Daemon.py @@ -936,6 +936,15 @@ if enable_storage: # Zookeeper keepalive update function def update_zookeeper(): + # Set the upstream IP in Zookeeper for clients to read + if config['enable_networking']: + if this_node.router_state == 'primary': + try: + if zkhandler.readdata(zk_conn, '/upstream_ip') != config['upstream_floating_ip']: + raise + except: + zkhandler.writedata(zk_conn, {'/upstream_ip': config['upstream_floating_ip']}) + # Get past state and update if needed if debug: print("Get past state and update if needed")