From 0b0dd35837a22cad8313dd8df6806dc316919a2f Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 26 Mar 2021 10:46:28 +0000 Subject: [PATCH] masakari: fix minor issues with instance monitor * Don't generate masakari.conf for instance monitor * Don't generate masakari-monitors.conf for API or engine * Use a consistent name for dimensions - masakari_instancemonitor_dimensions * Fix source code paths in dev mode Change-Id: I551f93c9bf1ad6712b53c316074ae1df84e4352b --- ansible/roles/masakari/defaults/main.yml | 10 +++--- ansible/roles/masakari/tasks/clone.yml | 2 +- ansible/roles/masakari/tasks/config.yml | 33 +++++++++++-------- ...nstancemonitor-fixes-dc13e5234456d4c5.yaml | 12 +++++++ 4 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 releasenotes/notes/masakari-instancemonitor-fixes-dc13e5234456d4c5.yaml diff --git a/ansible/roles/masakari/defaults/main.yml b/ansible/roles/masakari/defaults/main.yml index 5aeee7b45f..2ae14924d9 100644 --- a/ansible/roles/masakari/defaults/main.yml +++ b/ansible/roles/masakari/defaults/main.yml @@ -34,7 +34,7 @@ masakari_services: image: "{{ masakari_monitors_image_full }}" volumes: "{{ masakari_instancemonitor_default_volumes + masakari_instancemonitor_extra_volumes }}" privileged: True - dimensions: "{{ masakari_monitors_dimensions }}" + dimensions: "{{ masakari_instancemonitor_dimensions }}" #################### @@ -64,7 +64,9 @@ masakari_monitors_image_full: "{{ masakari_monitors_image }}:{{ masakari_monitor masakari_api_dimensions: "{{ default_container_dimensions }}" masakari_engine_dimensions: "{{ default_container_dimensions }}" -masakari_monitors_dimensions: "{{ default_container_dimensions }}" +# NOTE(mgoddard): Allow masakari_monitors_dimensions for backwards +# compatibility. +masakari_instancemonitor_dimensions: "{{ masakari_monitors_dimensions | default(default_container_dimensions) }}" masakari_extra_volumes: "{{ default_extra_volumes }}" masakari_api_extra_volumes: "{{ masakari_extra_volumes }}" @@ -89,7 +91,7 @@ masakari_instancemonitor_default_volumes: - "/etc/localtime:/etc/localtime:ro" - "{{ '/etc/timezone:/etc/timezone:ro' if ansible_os_family == 'Debian' else '' }}" - "kolla_logs:/var/log/kolla/" - - "{{ kolla_dev_repos_directory ~ '/masakari/masakari:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/masakari' if masakari_dev_mode | bool else '' }}" + - "{{ kolla_dev_repos_directory ~ '/masakari-monitors/masakarimonitors:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/masakarimonitors' if masakari_dev_mode | bool else '' }}" #################### @@ -114,7 +116,7 @@ masakari_dev_repos_pull: "{{ kolla_dev_repos_pull }}" masakari_dev_mode: "{{ kolla_dev_mode }}" masakari_source_version: "{{ kolla_source_version }}" -masakari_monitors_git_repository: "{{ kolla_dev_repos_git }}/masakarimonitors" +masakari_monitors_git_repository: "{{ kolla_dev_repos_git }}/masakari-monitors" masakari_monitors_dev_repos_pull: "{{ kolla_dev_repos_pull }}" masakari_monitors_dev_mode: "{{ kolla_dev_mode }}" masakari_monitors_source_version: "{{ kolla_source_version }}" diff --git a/ansible/roles/masakari/tasks/clone.yml b/ansible/roles/masakari/tasks/clone.yml index 383de1920a..9bdf1f1813 100644 --- a/ansible/roles/masakari/tasks/clone.yml +++ b/ansible/roles/masakari/tasks/clone.yml @@ -11,6 +11,6 @@ become: true git: repo: "{{ masakarimonitors_git_repository }}" - dest: "{{ kolla_dev_repos_directory }}/masakarimonitors" + dest: "{{ kolla_dev_repos_directory }}/masakari-monitors" update: "{{ masakarimonitors_dev_repos_pull }}" version: "{{ masakarimonitors_source_version }}" diff --git a/ansible/roles/masakari/tasks/config.yml b/ansible/roles/masakari/tasks/config.yml index 4e664e3803..da55677baf 100644 --- a/ansible/roles/masakari/tasks/config.yml +++ b/ansible/roles/masakari/tasks/config.yml @@ -64,43 +64,48 @@ - name: Copying over masakari.conf vars: - service: "{{ item.key }}" + service_name: "{{ item }}" + service: "{{ masakari_services[service_name] }}" merge_configs: sources: - "{{ role_path }}/templates/masakari.conf.j2" - "{{ node_custom_config }}/global.conf" - "{{ node_custom_config }}/masakari.conf" - - "{{ node_custom_config }}/masakari/{{ item.key }}.conf" + - "{{ node_custom_config }}/masakari/{{ service_name }}.conf" - "{{ node_custom_config }}/masakari/{{ inventory_hostname }}/masakari.conf" - dest: "{{ node_config_directory }}/{{ item.key }}/masakari.conf" + dest: "{{ node_config_directory }}/{{ service_name }}/masakari.conf" mode: "0660" become: true when: - - inventory_hostname in groups[item.value.group] - - item.value.enabled | bool - with_dict: "{{ masakari_services }}" + - inventory_hostname in groups[service.group] + - service.enabled | bool + with_items: + - masakari-api + - masakari-engine notify: - - Restart {{ item.key }} container + - Restart {{ service_name }} container - name: Copying over masakari-monitors.conf vars: - service: "{{ item.key }}" + service_name: "{{ item }}" + service: "{{ masakari_services[service_name] }}" merge_configs: sources: - "{{ role_path }}/templates/masakari-monitors.conf.j2" - "{{ node_custom_config }}/global.conf" - - "{{ node_custom_config }}/masakari/{{ item.key }}.conf" + - "{{ node_custom_config }}/masakari/{{ service_name }}.conf" - "{{ node_custom_config }}/masakari/masakari-monitors.conf" - "{{ node_custom_config }}/masakari/{{ inventory_hostname }}/masakari-monitors.conf" - dest: "{{ node_config_directory }}/{{ item.key }}/masakari-monitors.conf" + dest: "{{ node_config_directory }}/{{ service_name }}/masakari-monitors.conf" mode: "0660" become: true when: - - inventory_hostname in groups[item.value.group] - - item.value.enabled | bool - with_dict: "{{ masakari_services }}" + - inventory_hostname in groups[service.group] + - service.enabled | bool + with_items: + - masakari-instancemonitor notify: - - Restart {{ item.key }} container + - Restart {{ service_name }} container - name: Copying over wsgi-masakari file for services vars: diff --git a/releasenotes/notes/masakari-instancemonitor-fixes-dc13e5234456d4c5.yaml b/releasenotes/notes/masakari-instancemonitor-fixes-dc13e5234456d4c5.yaml new file mode 100644 index 0000000000..b4661cd6c5 --- /dev/null +++ b/releasenotes/notes/masakari-instancemonitor-fixes-dc13e5234456d4c5.yaml @@ -0,0 +1,12 @@ +--- +fixes: + - | + Fixes an issue where ``masakari.conf`` was generated for the + ``masakari-instancemonitor`` service but not used. + - | + Fixes an issue where ``masakari-monitors.conf`` was generated for the + ``masakari-api`` and ``masakari-engine`` services but not used. + - | + Uses a consistent variable name for container dimensions for + ``masakari-instancemonitor`` - ``masakari_instancemonitor_dimensions``. + The old name of ``masakari_monitors_dimensions`` is still supported.