Fix race condition during designate setup

Right now when designate is being installed for the first time, role
tries to run pool update before database is being populated. That
happens due to flushing handlers early as db sync requires service
to run with relevant config. This regression has been implemented
with [1].

To resolve it we move copy of pools.yaml after handlers are flushed
first time and after db sync process.
We also move service_setup before first flush as otherwise service
won't be able to start properly anyway.

There's no need to copy pools.yaml to each designate container and run
pool update multiple times - it's enough to do that once.

[1] 87eb5d46cd

Change-Id: I3b3aaf48f990e229ba5ca3ec5127780fa70228d0
This commit is contained in:
Dmitriy Rabotyagov 2022-11-25 18:20:06 +01:00
parent f5936a486c
commit aab80f8524
3 changed files with 39 additions and 35 deletions

View File

@ -33,7 +33,6 @@
become_user: "{{ designate_system_user_name }}"
changed_when: false
when: designate_pools_yaml is defined
notify: Restart designate services
- name: Start services
systemd:

View File

@ -79,13 +79,6 @@
tags:
- designate-policy-override
- name: Create Designate pools.yaml file
copy:
content: "{{ designate_pools_yaml | to_nice_yaml }}"
dest: "/etc/designate/pools.yaml"
when: designate_pools_yaml is defined
notify: Perform Designate pools update
- name: Create Designate rndc key file
template:
src: rndc.key.j2

View File

@ -100,33 +100,6 @@
- designate-install
- designate-config
- name: Run the systemd service role
import_role:
name: systemd_service
vars:
systemd_user_name: "{{ designate_system_user_name }}"
systemd_group_name: "{{ designate_system_group_name }}"
systemd_service_restart_changed: false
systemd_tempd_prefix: openstack
systemd_slice_name: designate
systemd_lock_path: /var/lock/designate
systemd_CPUAccounting: true
systemd_BlockIOAccounting: true
systemd_MemoryAccounting: true
systemd_TasksAccounting: true
systemd_services: "{{ filtered_designate_services }}"
tags:
- designate-config
- systemd-service
- name: Flush handlers
meta: flush_handlers
- import_tasks: designate_db_sync.yml
when: _designate_is_first_play_host
tags:
- designate-install
- include_role:
name: openstack.osa.service_setup
apply:
@ -162,5 +135,44 @@
tags:
- always
- name: Run the systemd service role
import_role:
name: systemd_service
vars:
systemd_user_name: "{{ designate_system_user_name }}"
systemd_group_name: "{{ designate_system_group_name }}"
systemd_service_restart_changed: false
systemd_tempd_prefix: openstack
systemd_slice_name: designate
systemd_lock_path: /var/lock/designate
systemd_CPUAccounting: true
systemd_BlockIOAccounting: true
systemd_MemoryAccounting: true
systemd_TasksAccounting: true
systemd_services: "{{ filtered_designate_services }}"
tags:
- designate-config
- systemd-service
- name: Flush handlers
meta: flush_handlers
- import_tasks: designate_db_sync.yml
when: _designate_is_first_play_host
tags:
- designate-install
- name: Place Designate pools.yaml file
copy:
content: "{{ designate_pools_yaml | to_nice_yaml }}"
dest: "/etc/designate/pools.yaml"
when:
- designate_pools_yaml is defined
- _designate_is_first_play_host
notify:
- Perform Designate pools update
tags:
- designate-config
- name: Flush handlers
meta: flush_handlers