parent
5d73974e95
commit
ab28bf40d1
|
@ -275,13 +275,13 @@ class NodeInstance(object):
|
||||||
#
|
#
|
||||||
# A ----------------------------------------------------------------- SYNC (candidate)
|
# A ----------------------------------------------------------------- SYNC (candidate)
|
||||||
# B ----------------------------------------------------------------- SYNC (current)
|
# B ----------------------------------------------------------------- SYNC (current)
|
||||||
# 1. Stop client API ||
|
# 1. Stop DNS aggregator ||
|
||||||
# 2. Stop metadata API ||
|
# 2. Stop DHCP servers ||
|
||||||
# 3. Stop DNS aggregator ||
|
|
||||||
# 4. Stop DHCP servers ||
|
|
||||||
# 4a) network 1 ||
|
# 4a) network 1 ||
|
||||||
# 4b) network 2 ||
|
# 4b) network 2 ||
|
||||||
# etc. ||
|
# etc. ||
|
||||||
|
# 3. Stop client API ||
|
||||||
|
# 4. Stop metadata API ||
|
||||||
# --
|
# --
|
||||||
# C ----------------------------------------------------------------- SYNC (candidate)
|
# C ----------------------------------------------------------------- SYNC (candidate)
|
||||||
# 5. Remove upstream floating IP 1. Add upstream floating IP ||
|
# 5. Remove upstream floating IP 1. Add upstream floating IP ||
|
||||||
|
@ -300,13 +300,13 @@ class NodeInstance(object):
|
||||||
# --
|
# --
|
||||||
# G ----------------------------------------------------------------- SYNC (candidate)
|
# G ----------------------------------------------------------------- SYNC (candidate)
|
||||||
# 5. Transition Patroni primary ||
|
# 5. Transition Patroni primary ||
|
||||||
# 6. Start DHCP servers ||
|
# 6. Start client API ||
|
||||||
|
# 7. Start metadata API ||
|
||||||
|
# 8. Start DHCP servers ||
|
||||||
# 5a) network 1 ||
|
# 5a) network 1 ||
|
||||||
# 5b) network 2 ||
|
# 5b) network 2 ||
|
||||||
# etc. ||
|
# etc. ||
|
||||||
# 7. Start DNS aggregator ||
|
# 9. Start DNS aggregator ||
|
||||||
# 8. Start metadata API ||
|
|
||||||
# 9. Start client API ||
|
|
||||||
# --
|
# --
|
||||||
######
|
######
|
||||||
def become_primary(self):
|
def become_primary(self):
|
||||||
|
@ -468,22 +468,22 @@ class NodeInstance(object):
|
||||||
patroni_failed = False
|
patroni_failed = False
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
break
|
break
|
||||||
# 6. Start DHCP servers
|
# 6. Start client API (and provisioner worker)
|
||||||
for network in self.d_network:
|
|
||||||
self.d_network[network].startDHCPServer()
|
|
||||||
# 7. Start DNS aggregator; just continue if we fail
|
|
||||||
if not patroni_failed:
|
|
||||||
self.dns_aggregator.start_aggregator()
|
|
||||||
else:
|
|
||||||
self.logger.out('Not starting DNS aggregator due to Patroni failures', state='e')
|
|
||||||
# 8. Start metadata API; just continue if we fail
|
|
||||||
self.metadata_api.start()
|
|
||||||
# 9. Start client API (and provisioner worker)
|
|
||||||
if self.config['enable_api']:
|
if self.config['enable_api']:
|
||||||
self.logger.out('Starting PVC API client service', state='i')
|
self.logger.out('Starting PVC API client service', state='i')
|
||||||
common.run_os_command("systemctl start pvc-api.service")
|
common.run_os_command("systemctl start pvc-api.service")
|
||||||
self.logger.out('Starting PVC Provisioner Worker service', state='i')
|
self.logger.out('Starting PVC Provisioner Worker service', state='i')
|
||||||
common.run_os_command("systemctl start pvc-provisioner-worker.service")
|
common.run_os_command("systemctl start pvc-provisioner-worker.service")
|
||||||
|
# 7. Start metadata API; just continue if we fail
|
||||||
|
self.metadata_api.start()
|
||||||
|
# 8. Start DHCP servers
|
||||||
|
for network in self.d_network:
|
||||||
|
self.d_network[network].startDHCPServer()
|
||||||
|
# 9. Start DNS aggregator; just continue if we fail
|
||||||
|
if not patroni_failed:
|
||||||
|
self.dns_aggregator.start_aggregator()
|
||||||
|
else:
|
||||||
|
self.logger.out('Not starting DNS aggregator due to Patroni failures', state='e')
|
||||||
self.logger.out('Releasing write lock for synchronization G', state='i')
|
self.logger.out('Releasing write lock for synchronization G', state='i')
|
||||||
zkhandler.writedata(self.zk_conn, {'/locks/primary_node': ''})
|
zkhandler.writedata(self.zk_conn, {'/locks/primary_node': ''})
|
||||||
lock.release()
|
lock.release()
|
||||||
|
@ -513,21 +513,21 @@ class NodeInstance(object):
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization B', state='o')
|
self.logger.out('Acquired write lock for synchronization B', state='o')
|
||||||
time.sleep(0.2) # Time for reader to acquire the lock
|
time.sleep(0.2) # Time for reader to acquire the lock
|
||||||
# 1. Stop client API
|
# 1. Stop DNS aggregator
|
||||||
if self.config['enable_api']:
|
|
||||||
self.logger.out('Stopping PVC API client service', state='i')
|
|
||||||
common.run_os_command("systemctl stop pvc-api.service")
|
|
||||||
# 2. Stop metadata API
|
|
||||||
self.metadata_api.stop()
|
|
||||||
# 3. Stop DNS aggregator
|
|
||||||
self.dns_aggregator.stop_aggregator()
|
self.dns_aggregator.stop_aggregator()
|
||||||
# 4. Stop DHCP servers
|
# 2. Stop DHCP servers
|
||||||
for network in self.d_network:
|
for network in self.d_network:
|
||||||
self.d_network[network].stopDHCPServer()
|
self.d_network[network].stopDHCPServer()
|
||||||
self.logger.out('Releasing write lock for synchronization B', state='i')
|
self.logger.out('Releasing write lock for synchronization B', state='i')
|
||||||
zkhandler.writedata(self.zk_conn, {'/locks/primary_node': ''})
|
zkhandler.writedata(self.zk_conn, {'/locks/primary_node': ''})
|
||||||
lock.release()
|
lock.release()
|
||||||
self.logger.out('Released write lock for synchronization B', state='o')
|
self.logger.out('Released write lock for synchronization B', state='o')
|
||||||
|
# 3. Stop client API
|
||||||
|
if self.config['enable_api']:
|
||||||
|
self.logger.out('Stopping PVC API client service', state='i')
|
||||||
|
common.run_os_command("systemctl stop pvc-api.service")
|
||||||
|
# 4. Stop metadata API
|
||||||
|
self.metadata_api.stop()
|
||||||
time.sleep(0.1) # Time for new writer to acquire the lock
|
time.sleep(0.1) # Time for new writer to acquire the lock
|
||||||
|
|
||||||
# Synchronize nodes C (I am reader)
|
# Synchronize nodes C (I am reader)
|
||||||
|
|
Loading…
Reference in New Issue