Merge "Number of heat queues will keep growing forever after heat-engine restarts"

This commit is contained in:
Zuul 2021-06-25 13:35:19 +00:00 committed by Gerrit Code Review
commit ee1ae1a8b3
3 changed files with 20 additions and 5 deletions

View File

@ -74,6 +74,12 @@ options:
default: openstack
type: string
description: RabbitMQ virtual host to request access on rabbitmq-server.
ttl:
type: int
default: 3600000
description: |
TTL in MS for heat queues in the openstack vhost. Defaults to
1 hour, but can be tuned up or down depending on deployment requirements.
encryption-key:
default: ""
type: string

View File

@ -171,6 +171,8 @@ def config_changed():
cluster_joined(relation_id=rid)
for r_id in relation_ids('ha'):
ha_joined(relation_id=r_id)
for rid in relation_ids('amqp'):
amqp_joined(relation_id=rid)
# call the policy overrides handler which will install any policy overrides
policyd.maybe_do_policyd_overrides_on_config_changed(
@ -221,7 +223,10 @@ def upgrade_charm():
@hooks.hook('amqp-relation-joined')
def amqp_joined(relation_id=None):
relation_set(relation_id=relation_id,
username=config('rabbit-user'), vhost=config('rabbit-vhost'))
username=config('rabbit-user'), vhost=config('rabbit-vhost'),
ttlname='heat_expiry',
ttlreg='heat-engine-listener|engine_worker',
ttl=config('ttl'))
@hooks.hook('amqp-relation-changed')

View File

@ -226,14 +226,18 @@ class HeatRelationTests(CharmTestCase):
self.relation_set.assert_called_with(
username='heat',
vhost='openstack',
relation_id=None)
relation_id=None,
ttlname='heat_expiry',
ttlreg='heat-engine-listener|engine_worker',
ttl=3600000)
def test_amqp_joined_passes_relation_id(self):
"Ensures relation_id correct passed to relation_set"
relations.amqp_joined(relation_id='heat:1')
self.relation_set.assert_called_with(username='heat',
vhost='openstack',
relation_id='heat:1')
self.relation_set.assert_called_with(
username='heat', vhost='openstack', relation_id='heat:1',
ttlname='heat_expiry',
ttlreg='heat-engine-listener|engine_worker', ttl=3600000)
@patch.object(relations, 'CONFIGS')
def test_amqp_changed_relation_data(self, configs):