Ensure migration out occurs
This commit is contained in:
parent
9a39d739e8
commit
77db36a891
|
@ -119,18 +119,14 @@ class NodeInstance(object):
|
||||||
if self.config['enable_networking']:
|
if self.config['enable_networking']:
|
||||||
if self.router_state == 'primary':
|
if self.router_state == 'primary':
|
||||||
self.logger.out('Setting node {} to primary state'.format(self.name), state='i')
|
self.logger.out('Setting node {} to primary state'.format(self.name), state='i')
|
||||||
#self.become_primary()
|
|
||||||
transition_thread = threading.Thread(target=self.become_primary, args=(), kwargs={})
|
transition_thread = threading.Thread(target=self.become_primary, args=(), kwargs={})
|
||||||
transition_thread.start()
|
transition_thread.start()
|
||||||
#transition_thread.join()
|
|
||||||
else:
|
else:
|
||||||
# Skip becoming secondary unless already running
|
# Skip becoming secondary unless already running
|
||||||
if self.daemon_state == 'run':
|
if self.daemon_state == 'run' or self.daemon_state = 'shutdown':
|
||||||
self.logger.out('Setting node {} to secondary state'.format(self.name), state='i')
|
self.logger.out('Setting node {} to secondary state'.format(self.name), state='i')
|
||||||
#self.become_secondary()
|
|
||||||
transition_thread = threading.Thread(target=self.become_secondary, args=(), kwargs={})
|
transition_thread = threading.Thread(target=self.become_secondary, args=(), kwargs={})
|
||||||
transition_thread.start()
|
transition_thread.start()
|
||||||
#transition_thread.join()
|
|
||||||
|
|
||||||
@self.zk_conn.DataWatch('/nodes/{}/domainstate'.format(self.name))
|
@self.zk_conn.DataWatch('/nodes/{}/domainstate'.format(self.name))
|
||||||
def watch_node_domainstate(data, stat, event=''):
|
def watch_node_domainstate(data, stat, event=''):
|
||||||
|
@ -150,13 +146,12 @@ class NodeInstance(object):
|
||||||
# toggle state management of this node
|
# toggle state management of this node
|
||||||
if self.name == self.this_node:
|
if self.name == self.this_node:
|
||||||
# Stop any existing flush jobs
|
# Stop any existing flush jobs
|
||||||
if self.flush_thread:
|
if self.flush_thread is not None:
|
||||||
self.flush_stopper = True
|
|
||||||
self.logger.out('Waiting for previous migration to complete'.format(self.name), state='i')
|
self.logger.out('Waiting for previous migration to complete'.format(self.name), state='i')
|
||||||
|
self.flush_stopper = True
|
||||||
while self.flush_stopper:
|
while self.flush_stopper:
|
||||||
time.sleep(1)
|
time.sleep(0.1)
|
||||||
self.flush_stopper = False
|
|
||||||
self.flush_thread = None
|
|
||||||
# Do flushing in a thread so it doesn't block the migrates out
|
# Do flushing in a thread so it doesn't block the migrates out
|
||||||
if self.domain_state == 'flush':
|
if self.domain_state == 'flush':
|
||||||
self.flush_thread = threading.Thread(target=self.flush, args=(), kwargs={})
|
self.flush_thread = threading.Thread(target=self.flush, args=(), kwargs={})
|
||||||
|
|
Loading…
Reference in New Issue