Disable designate-mdns service until the configuration has been rendered
As per the bug report, designate-mdns service appear to restart multiple time.
This patch disable the service until the configuration has been rendered.
Closes-Bug: #1925233
Change-Id: Ib9843bda9c6967ce50cec8d721079bd70f7f3040
(cherry picked from commit 1fef3793f5
)
This commit is contained in:
parent
97ff1a9103
commit
604222e924
@ -90,6 +90,32 @@ def setup_amqp_req(amqp):
|
||||
vhost='openstack')
|
||||
|
||||
|
||||
@reactive.when('base-config.rendered')
|
||||
@reactive.when_not('config.rendered')
|
||||
def config_rendered():
|
||||
"""Set the config.rendered state when ready for operation.
|
||||
|
||||
The config.rendered flag is used by the default handlers in
|
||||
charms.openstack to enable/disable services based on the
|
||||
readiness of the deployment. This functionality ensure
|
||||
that the Designate services start up only after the
|
||||
database has been synced.
|
||||
LP#1925233
|
||||
"""
|
||||
reactive.set_state('config.rendered')
|
||||
|
||||
|
||||
@reactive.when('config.rendered', 'base-config.rendered')
|
||||
def start_designate_services():
|
||||
"""Enable services when database is synchronized"""
|
||||
with charm.provide_charm_instance() as instance:
|
||||
if instance.db_sync_done():
|
||||
instance.enable_services()
|
||||
else:
|
||||
hookenv.log("Services not enabled, waiting for db sync",
|
||||
level=hookenv.WARNING)
|
||||
|
||||
|
||||
@reactive.when('shared-db.connected')
|
||||
@reactive.when_not('shared-db.setup')
|
||||
def setup_database(database):
|
||||
@ -128,7 +154,7 @@ def expose_rndc_address(cluster):
|
||||
@reactive.when_not('base-config.rendered')
|
||||
@reactive.when(*COMPLETE_INTERFACE_STATES)
|
||||
def configure_designate_basic(*args):
|
||||
"""Configure the minimum to boostrap designate"""
|
||||
"""Configure the minimum to bootstrap designate"""
|
||||
# If cluster relation is available it needs to passed in
|
||||
cluster = relations.endpoint_from_flag('cluster.available')
|
||||
if cluster is not None:
|
||||
@ -138,6 +164,7 @@ def configure_designate_basic(*args):
|
||||
args = args + (dns_backend, )
|
||||
with charm.provide_charm_instance() as instance:
|
||||
instance.render_base_config(args)
|
||||
instance.disable_services()
|
||||
reactive.set_state('base-config.rendered')
|
||||
|
||||
|
||||
|
@ -22,7 +22,10 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
|
||||
'setup_amqp_req': ('amqp.connected', ),
|
||||
'setup_database': ('shared-db.connected', ),
|
||||
'maybe_setup_endpoint': ('identity-service.connected', ),
|
||||
'start_designate_services': ('config.rendered',
|
||||
'base-config.rendered', ),
|
||||
'expose_rndc_address': ('cluster.connected', ),
|
||||
'config_rendered': ('base-config.rendered', ),
|
||||
'configure_ssl': ('identity-service.available', ),
|
||||
'config_changed': ('config.changed', ),
|
||||
'cluster_connected': ('ha.connected', ),
|
||||
@ -45,6 +48,7 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
|
||||
'when_not': {
|
||||
'setup_amqp_req': ('amqp.requested-access', ),
|
||||
'setup_database': ('shared-db.setup', ),
|
||||
'config_rendered': ('config.rendered', ),
|
||||
'install_packages': ('installed', ),
|
||||
'run_db_migration': ('db.synched', ),
|
||||
'sync_pool_manager_cache': ('pool-manager-cache.synched', ),
|
||||
|
Loading…
Reference in New Issue
Block a user