From d0b06f679b321da59ef9f9154fab4c02f843bb8a Mon Sep 17 00:00:00 2001 From: "Q.hongtao" Date: Fri, 27 Mar 2020 16:58:12 +0800 Subject: [PATCH] Add vitrage-persistor service Kolla Ansible was missing vitrage-persistor service required by Vitrage for data storage. Depends on fixing availability of Kolla image. Change-Id: I8158ba66b8b624f6bcb89da9c990a30a68b7187b Depends-On: Id5e143636f9a81e7294b775f3d8b9134bee58054 Closes-Bug: #1869319 --- ansible/inventory/all-in-one | 3 +++ ansible/inventory/multinode | 3 +++ .../conf/filter/01-rewrite-0.12.conf.j2 | 2 +- .../conf/filter/01-rewrite-0.14.conf.j2 | 2 +- ansible/roles/vitrage/defaults/main.yml | 19 +++++++++++++++ ansible/roles/vitrage/handlers/main.yml | 15 ++++++++++++ ansible/roles/vitrage/tasks/deploy.yml | 3 ++- .../templates/vitrage-persistor.json.j2 | 24 +++++++++++++++++++ .../notes/bug-1869319-66905f50871ac6b1.yaml | 6 +++++ 9 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 ansible/roles/vitrage/templates/vitrage-persistor.json.j2 create mode 100644 releasenotes/notes/bug-1869319-66905f50871ac6b1.yaml diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index 65cc85e67a..0b4eb8e968 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -708,6 +708,9 @@ vitrage [vitrage-ml:children] vitrage +[vitrage-persistor:children] +vitrage + # Blazar [blazar-api:children] blazar diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index cbd415c3bb..e688ff6b15 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -727,6 +727,9 @@ vitrage [vitrage-ml:children] vitrage +[vitrage-persistor:children] +vitrage + # Blazar [blazar-api:children] blazar diff --git a/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 b/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 index 0b49f39832..8ae8e16ab6 100644 --- a/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 +++ b/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 @@ -31,7 +31,7 @@ rewriterule28 programname ^(ironic-api|ironic-conductor|ironic-inspector)$ openstack_python rewriterule29 programname ^(panko-api|panko-dbsync)$ openstack_python rewriterule30 programname ^(tacker-server|tacker-conductor)$ openstack_python - rewriterule31 programname ^(vitrage-ml|vitrage-notifier|vitrage-graph)$ openstack_python + rewriterule31 programname ^(vitrage-ml|vitrage-notifier|vitrage-graph|vitrage-persistor)$ openstack_python rewriterule32 programname ^(blazar-api|blazar-manager)$ openstack_python rewriterule33 programname ^(cyborg-api|cyborg-conductor|cyborg-agent)$ openstack_python rewriterule34 programname ^(monasca-api|monasca-notification|monasca-persister|agent-collector|agent-forwarder|agent-statsd)$ openstack_python diff --git a/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 b/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 index 363dbbcf68..2354b6a6a8 100644 --- a/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 +++ b/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 @@ -158,7 +158,7 @@ key programname - pattern ^(vitrage-ml|vitrage-notifier|vitrage-graph)$ + pattern ^(vitrage-ml|vitrage-notifier|vitrage-graph|vitrage-persistor)$ tag openstack_python diff --git a/ansible/roles/vitrage/defaults/main.yml b/ansible/roles/vitrage/defaults/main.yml index 3a23977083..563d93832f 100644 --- a/ansible/roles/vitrage/defaults/main.yml +++ b/ansible/roles/vitrage/defaults/main.yml @@ -41,6 +41,13 @@ vitrage_services: image: "{{ vitrage_ml_image_full }}" volumes: "{{ vitrage_ml_default_volumes + vitrage_ml_extra_volumes }}" dimensions: "{{ vitrage_ml_dimensions }}" + vitrage-persistor: + container_name: vitrage_persistor + group: vitrage-persistor + enabled: true + image: "{{ vitrage_persistor_image_full }}" + volumes: "{{ vitrage_persistor_default_volumes + vitrage_persistor_extra_volumes }}" + dimensions: "{{ vitrage_persistor_dimensions }}" #################### ## Database @@ -72,10 +79,15 @@ vitrage_ml_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ dock vitrage_ml_tag: "{{ vitrage_tag }}" vitrage_ml_image_full: "{{ vitrage_ml_image }}:{{ vitrage_ml_tag }}" +vitrage_persistor_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ vitrage_install_type }}-vitrage-persistor" +vitrage_persistor_tag: "{{ vitrage_tag }}" +vitrage_persistor_image_full: "{{ vitrage_persistor_image }}:{{ vitrage_persistor_tag }}" + vitrage_api_dimensions: "{{ default_container_dimensions }}" vitrage_notifier_dimensions: "{{ default_container_dimensions }}" vitrage_graph_dimensions: "{{ default_container_dimensions }}" vitrage_ml_dimensions: "{{ default_container_dimensions }}" +vitrage_persistor_dimensions: "{{ default_container_dimensions }}" vitrage_api_default_volumes: - "{{ node_config_directory }}/vitrage-api/:{{ container_config_directory }}/:ro" @@ -101,12 +113,19 @@ vitrage_ml_default_volumes: - "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}" - "{{ kolla_dev_repos_directory ~ '/vitrage/vitrage:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/vitrage' if vitrage_dev_mode | bool else '' }}" - "kolla_logs:/var/log/kolla/" +vitrage_persistor_default_volumes: + - "{{ node_config_directory }}/vitrage-persistor/:{{ container_config_directory }}/:ro" + - "/etc/localtime:/etc/localtime:ro" + - "{{ '/etc/timezone:/etc/timezone:ro' if kolla_base_distro in ['debian', 'ubuntu'] else '' }}" + - "{{ kolla_dev_repos_directory ~ '/vitrage/vitrage:/var/lib/kolla/venv/lib/python' ~ distro_python_version ~ '/site-packages/vitrage' if vitrage_dev_mode | bool else '' }}" + - "kolla_logs:/var/log/kolla/" vitrage_extra_volumes: "{{ default_extra_volumes }}" vitrage_api_extra_volumes: "{{ vitrage_extra_volumes }}" vitrage_notifier_extra_volumes: "{{ vitrage_extra_volumes }}" vitrage_graph_extra_volumes: "{{ vitrage_extra_volumes }}" vitrage_ml_extra_volumes: "{{ vitrage_extra_volumes }}" +vitrage_persistor_extra_volumes: "{{ vitrage_extra_volumes }}" #################### # OpenStack diff --git a/ansible/roles/vitrage/handlers/main.yml b/ansible/roles/vitrage/handlers/main.yml index 212872a836..d1f007b6b5 100644 --- a/ansible/roles/vitrage/handlers/main.yml +++ b/ansible/roles/vitrage/handlers/main.yml @@ -58,3 +58,18 @@ dimensions: "{{ service.dimensions }}" when: - kolla_action != "config" + +- name: Restart vitrage-persistor container + vars: + service_name: "vitrage-persistor" + service: "{{ vitrage_services[service_name] }}" + become: true + kolla_docker: + action: "recreate_or_restart_container" + common_options: "{{ docker_common_options }}" + name: "{{ service.container_name }}" + image: "{{ service.image }}" + volumes: "{{ service.volumes | reject('equalto', '') | list }}" + dimensions: "{{ service.dimensions }}" + when: + - kolla_action != "config" diff --git a/ansible/roles/vitrage/tasks/deploy.yml b/ansible/roles/vitrage/tasks/deploy.yml index 0861879a52..b29d8ffa9f 100644 --- a/ansible/roles/vitrage/tasks/deploy.yml +++ b/ansible/roles/vitrage/tasks/deploy.yml @@ -6,7 +6,8 @@ when: inventory_hostname in groups['vitrage-api'] or inventory_hostname in groups['vitrage-ml'] or inventory_hostname in groups['vitrage-graph'] or - inventory_hostname in groups['vitrage-notifier'] + inventory_hostname in groups['vitrage-notifier'] or + inventory_hostname in groups['vitrage-persistor'] - include_tasks: clone.yml when: vitrage_dev_mode | bool diff --git a/ansible/roles/vitrage/templates/vitrage-persistor.json.j2 b/ansible/roles/vitrage/templates/vitrage-persistor.json.j2 new file mode 100644 index 0000000000..8a3e917344 --- /dev/null +++ b/ansible/roles/vitrage/templates/vitrage-persistor.json.j2 @@ -0,0 +1,24 @@ +{ + "command": "vitrage-persistor --config-file /etc/vitrage/vitrage.conf", + "config_files": [ + { + "source": "{{ container_config_directory }}/vitrage.conf", + "dest": "/etc/vitrage/vitrage.conf", + "owner": "vitrage", + "perm": "0644" + }{% if vitrage_policy_file is defined %}, + { + "source": "{{ container_config_directory }}/{{ vitrage_policy_file }}", + "dest": "/etc/vitrage/{{ vitrage_policy_file }}", + "owner": "vitrage", + "perm": "0600" + }{% endif %} + ], + "permissions": [ + { + "path": "/var/log/kolla/vitrage", + "owner": "vitrage:vitrage", + "recurse": true + } + ] +} diff --git a/releasenotes/notes/bug-1869319-66905f50871ac6b1.yaml b/releasenotes/notes/bug-1869319-66905f50871ac6b1.yaml new file mode 100644 index 0000000000..afa1163b3b --- /dev/null +++ b/releasenotes/notes/bug-1869319-66905f50871ac6b1.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Adds missing ``vitrage-persistor`` service, required by Vitrage + deployments for storing data. + `LP#1869319 `__