Do not run db updates if db is in maintenance mode

As witih the shared-db hook do not run db updates if the database
is in maintenace mode

Closes-Bug: #1866864
Change-Id: I65619271d8a4215c8d9bf68ad0a86136ad87011c
This commit is contained in:
Liam Young 2020-03-11 07:16:01 +00:00
parent 6e3aacb08f
commit b53c597b15
1 changed files with 11 additions and 6 deletions

View File

@ -317,13 +317,18 @@ def amqp_changed():
hookenv.log('amqp relation incomplete. Peer not ready?')
return
CONFIGS.write(ncc_utils.NOVA_CONF)
leader_init_db_if_ready_allowed_units()
# db init for cells v2 requires amqp transport_url and db connections
# to be set in nova.conf, so we attempt db init in here as well as the
# db relation-changed hooks.
update_cell_db_if_ready_allowed_units()
if ch_utils.is_db_maintenance_mode():
hookenv.log(
'Database maintenance mode, defering db updates.',
level=hookenv.DEBUG)
else:
leader_init_db_if_ready_allowed_units()
# db init for cells v2 requires amqp transport_url and db connections
# to be set in nova.conf, so we attempt db init in here as well as the
# db relation-changed hooks.
update_cell_db_if_ready_allowed_units()
update_child_cell_records()
update_child_cell_records()
if hookenv.is_leader():
# NOTE: trigger restart on nova-api-metadata on