Properly handle takeover state in VXNetworks

Most of these actions/conditionals were looking for primary state, but
were failing during node takeover. Update the conditionals to look for
both router states instead.

Also add a wait to lock flushing until a takeover is completed.
This commit is contained in:
2020-03-02 10:41:00 -05:00
parent b8852e116e
commit 1e4350ca6f
2 changed files with 15 additions and 12 deletions

View File

@ -74,6 +74,9 @@ def run_command(zk_conn, logger, this_node, data):
# Flushing VM RBD locks
if command == 'flush_locks':
dom_uuid = args
# If this node is taking over primary state, wait until it's done
while this_node.router_state == 'takeover':
time.sleep(1)
if this_node.router_state == 'primary':
# Lock the command queue
zk_lock = zkhandler.writelock(zk_conn, '/cmd/domains')