From 842adf6d2f218e49bfe7d8c3b7dea84e289ece03 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 22 Feb 2023 09:41:40 +0100 Subject: [PATCH] Configure coordination in default for masakari-api This patch introduces distributed lock for masakari-api service when handle the concurrent notifications for the same host failure from multiple masakari-hostmonitor services. Change-Id: I46985202dc8da22601357eefe2727599e7a413e5 --- ansible/group_vars/all.yml | 1 + ansible/roles/masakari/templates/masakari.conf.j2 | 9 +++++++++ ...e-masakari-coordination-backend-d3b742315a07aabc.yaml | 6 ++++++ 3 files changed, 16 insertions(+) create mode 100644 releasenotes/notes/new-variable-masakari-coordination-backend-d3b742315a07aabc.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index ca573064f1..a59324555e 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -403,6 +403,7 @@ mariadb_shard_backup_user_prefix: "backup_shard_" mariadb_shards_info: "{{ groups['mariadb'] | database_shards_info() }}" masakari_api_port: "15868" +masakari_coordination_backend: "{{ 'redis' if enable_redis | bool else 'etcd' if enable_etcd | bool else '' }}" memcached_port: "11211" diff --git a/ansible/roles/masakari/templates/masakari.conf.j2 b/ansible/roles/masakari/templates/masakari.conf.j2 index 969cf2f2d5..081688aed1 100644 --- a/ansible/roles/masakari/templates/masakari.conf.j2 +++ b/ansible/roles/masakari/templates/masakari.conf.j2 @@ -70,3 +70,12 @@ policy_file = {{ masakari_policy_file }} [taskflow] connection = mysql+pymysql://{{ masakari_database_user }}:{{ masakari_database_password }}@{{ masakari_database_address }}/{{ masakari_database_name }} + +{% if service_name == 'masakari-api' %} +[coordination] +{% if masakari_coordination_backend == 'redis' %} +backend_url = {{ redis_connection_string }} +{% elif masakari_coordination_backend == 'etcd' %} +backend_url = etcd3+{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ etcd_client_port }}{% if openstack_cacert %}?ca_cert={{ openstack_cacert }}{% endif %} +{% endif %} +{% endif %} diff --git a/releasenotes/notes/new-variable-masakari-coordination-backend-d3b742315a07aabc.yaml b/releasenotes/notes/new-variable-masakari-coordination-backend-d3b742315a07aabc.yaml new file mode 100644 index 0000000000..d425368299 --- /dev/null +++ b/releasenotes/notes/new-variable-masakari-coordination-backend-d3b742315a07aabc.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Masakari coordination backend can now be configured via + masakari_coordination_backend variable. + Coordination is optional and can now be set to either redis or etcd.