Prevent update-status to run unrequired handlers
Before the update-status hook would run handlers that are expected to run when the configuration changes or relations added/removed. The update-status hook doesn't hold the machine lock which makes concurrent hook executions possible and seen in the gate where for example multiple "apt-get" executions trying to acquire dpkg's lock. Closes-Bug: #2016893 Change-Id: I63bfd9903057cbea2db8de4f1b612601aacb568d
This commit is contained in:
parent
11bd4c79f2
commit
c2f4a1e38d
@ -34,6 +34,7 @@ charms_openstack.charm.use_defaults(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when('shared-db.available')
|
@reactive.when('shared-db.available')
|
||||||
@reactive.when('identity-service.available')
|
@reactive.when('identity-service.available')
|
||||||
def render_config(*args):
|
def render_config(*args):
|
||||||
@ -60,6 +61,7 @@ def render_config(*args):
|
|||||||
reactive.set_state('config.rendered')
|
reactive.set_state('config.rendered')
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when('config.rendered')
|
@reactive.when('config.rendered')
|
||||||
@reactive.when('placement.available')
|
@reactive.when('placement.available')
|
||||||
@reactive.when_not('db.synced')
|
@reactive.when_not('db.synced')
|
||||||
@ -77,6 +79,7 @@ def init_db():
|
|||||||
reactive.set_state('db.synced')
|
reactive.set_state('db.synced')
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when_not('is-update-status-hook')
|
||||||
@reactive.when('ha.connected')
|
@reactive.when('ha.connected')
|
||||||
def cluster_connected(hacluster):
|
def cluster_connected(hacluster):
|
||||||
"""Configure HA resources in corosync"""
|
"""Configure HA resources in corosync"""
|
||||||
|
@ -40,7 +40,9 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
|
|||||||
'cluster_connected': ('ha.connected',),
|
'cluster_connected': ('ha.connected',),
|
||||||
},
|
},
|
||||||
'when_not': {
|
'when_not': {
|
||||||
'init_db': ('db.synced',),
|
'init_db': ('db.synced', 'is-update-status-hook'),
|
||||||
|
'render_config': ('is-update-status-hook', ),
|
||||||
|
'cluster_connected': ('is-update-status-hook', ),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
# test that the hooks were registered via the
|
# test that the hooks were registered via the
|
||||||
|
Loading…
Reference in New Issue
Block a user