Prevent update-status to run unrequired handlers
Before, the update-status hook would run many handlers
that would have been normally done only during
configuration changes.
Consequently it creates an impact on the service and
apply changes every time the hook is triggered, which is
in most deployments every 5 minutes.
This prevents the DNS zones managed by Designate to be
updated constantly and potentially avoid race conditions
within designate components.
Closes-bug: #2003528
Change-Id: I0d4fea182da1316c0c30c143e64fcd2ca682afff
(cherry picked from commit f84cee2634
)
This commit is contained in:
parent
5df19a272d
commit
11e72d57bc
|
@ -59,6 +59,7 @@ def check_dns_slaves():
|
|||
reactive.remove_state('dns-slaves-config-valid')
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when_any('dns-slaves-config-valid',
|
||||
'dns-backend.available')
|
||||
def set_dns_config_available(*args):
|
||||
|
@ -83,6 +84,7 @@ def install_packages():
|
|||
reactive.remove_state('pool-manager-cache.synched')
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when('amqp.connected')
|
||||
def setup_amqp_req(amqp):
|
||||
"""Send request for rabbit access and vhost"""
|
||||
|
@ -105,6 +107,7 @@ def config_rendered():
|
|||
reactive.set_state('config.rendered')
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when_none('charm.paused')
|
||||
@reactive.when('config.rendered', 'base-config.rendered')
|
||||
def start_designate_services():
|
||||
|
@ -132,6 +135,7 @@ def setup_database(database):
|
|||
reactive.set_state('shared-db.setup')
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when('identity-service.connected')
|
||||
def maybe_setup_endpoint(keystone):
|
||||
"""When the keystone interface connects, register this unit in the keystone
|
||||
|
@ -146,6 +150,7 @@ def maybe_setup_endpoint(keystone):
|
|||
keystone.register_endpoints(*args)
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when('cluster.connected')
|
||||
def expose_rndc_address(cluster):
|
||||
rndc_address = ip.get_relation_ip('dns-backend')
|
||||
|
@ -190,6 +195,7 @@ def sync_pool_manager_cache(*args):
|
|||
reactive.set_state('pool-manager-cache.synched')
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when('db.synched')
|
||||
@reactive.when('pool-manager-cache.synched')
|
||||
@reactive.when(*COMPLETE_INTERFACE_STATES)
|
||||
|
@ -232,6 +238,7 @@ def _render_sink_configs(instance, interfaces_list):
|
|||
instance.render_with_interfaces(interfaces_list, configs=configs)
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when('ha.connected')
|
||||
def cluster_connected(hacluster):
|
||||
"""Configure HA resources in corosync"""
|
||||
|
@ -239,6 +246,7 @@ def cluster_connected(hacluster):
|
|||
instance.configure_ha_resources(hacluster)
|
||||
|
||||
|
||||
@reactive.when_not('is-update-status-hook')
|
||||
@reactive.when('dnsaas.connected')
|
||||
def expose_endpoint(endpoint):
|
||||
with charm.provide_charm_instance() as instance:
|
||||
|
|
|
@ -46,7 +46,7 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
|
|||
'configure_nrpe': ('base-config.rendered', ),
|
||||
},
|
||||
'when_not': {
|
||||
'setup_amqp_req': ('amqp.requested-access', ),
|
||||
'setup_amqp_req': ('is-update-status-hook', ),
|
||||
'setup_database': ('shared-db.setup', ),
|
||||
'config_rendered': ('config.rendered', ),
|
||||
'install_packages': ('installed', ),
|
||||
|
@ -58,6 +58,13 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
|
|||
'dont-set-assess-status', ),
|
||||
'reset_shared_db': ('shared-db.connected', ),
|
||||
'configure_nrpe': ('is-update-status-hook', ),
|
||||
'set_dns_config_available': ('is-update-status-hook', ),
|
||||
'start_designate_services': ('is-update-status-hook', ),
|
||||
'maybe_setup_endpoint': ('is-update-status-hook', ),
|
||||
'expose_endpoint': ('is-update-status-hook', ),
|
||||
'configure_designate_full': ('is-update-status-hook', ),
|
||||
'expose_rndc_address': ('is-update-status-hook', ),
|
||||
'cluster_connected': ('is-update-status-hook', ),
|
||||
},
|
||||
'when_any': {
|
||||
'set_dns_config_available': (
|
||||
|
|
Loading…
Reference in New Issue