From d62552463fec7d32464cd6252388f824fd6be196 Mon Sep 17 00:00:00 2001 From: Mauricio Lima Date: Thu, 20 Oct 2016 17:19:47 -0300 Subject: [PATCH] Add manila-data service Change-Id: Ie82f1dd7773ef2cc2c6724ec0b5f78ebd79566ee Closes-Bug: #1635370 --- ansible/inventory/all-in-one | 3 +++ ansible/inventory/multinode | 3 +++ ansible/roles/manila/defaults/main.yml | 3 +++ ansible/roles/manila/tasks/config.yml | 3 +++ ansible/roles/manila/tasks/deploy.yml | 2 ++ ansible/roles/manila/tasks/pull.yml | 7 ++++++ ansible/roles/manila/tasks/reconfigure.yml | 5 ++++ ansible/roles/manila/tasks/start.yml | 14 +++++++++++ .../manila/templates/manila-data.json.j2 | 18 ++++++++++++++ ansible/site.yml | 1 + docker/manila/manila-data/Dockerfile.j2 | 24 +++++++++++++++++++ 11 files changed, 83 insertions(+) create mode 100644 ansible/roles/manila/templates/manila-data.json.j2 create mode 100644 docker/manila/manila-data/Dockerfile.j2 diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index b5ea09a38e..d8ef9082e9 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -239,6 +239,9 @@ manila [manila-share:children] storage +[manila-data:children] +storage + # Swift [swift-proxy-server:children] swift diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index 150af0e931..9580f68196 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -257,6 +257,9 @@ manila [manila-share:children] storage +[manila-data:children] +storage + # Swift [swift-proxy-server:children] swift diff --git a/ansible/roles/manila/defaults/main.yml b/ansible/roles/manila/defaults/main.yml index 05d7b833ac..2ba9665953 100644 --- a/ansible/roles/manila/defaults/main.yml +++ b/ansible/roles/manila/defaults/main.yml @@ -24,6 +24,9 @@ manila_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ dock manila_api_tag: "{{ openstack_release }}" manila_api_image_full: "{{ manila_api_image }}:{{ manila_api_tag }}" +manila_data_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-manila-data" +manila_data_tag: "{{ openstack_release }}" +manila_data_image_full: "{{ manila_data_image }}:{{ manila_data_tag }}" ##################### ## OpenStack diff --git a/ansible/roles/manila/tasks/config.yml b/ansible/roles/manila/tasks/config.yml index 4f83ff55b4..e0a20f485a 100644 --- a/ansible/roles/manila/tasks/config.yml +++ b/ansible/roles/manila/tasks/config.yml @@ -6,6 +6,7 @@ recurse: yes with_items: - "manila-api" + - "manila-data" - "manila-scheduler" - "manila-share" @@ -15,6 +16,7 @@ dest: "{{ node_config_directory }}/{{ item }}/config.json" with_items: - "manila-api" + - "manila-data" - "manila-scheduler" - "manila-share" @@ -33,6 +35,7 @@ dest: "{{ node_config_directory }}/{{ item }}/manila.conf" with_items: - "manila-api" + - "manila-data" - "manila-scheduler" - name: Copying over manila-share.conf diff --git a/ansible/roles/manila/tasks/deploy.yml b/ansible/roles/manila/tasks/deploy.yml index c4e32b6e46..37135a4093 100644 --- a/ansible/roles/manila/tasks/deploy.yml +++ b/ansible/roles/manila/tasks/deploy.yml @@ -4,6 +4,7 @@ - include: config.yml when: inventory_hostname in groups['manila-api'] or + inventory_hostname in groups['manila-data'] or inventory_hostname in groups['manila-share'] or inventory_hostname in groups['manila-scheduler'] @@ -12,5 +13,6 @@ - include: start.yml when: inventory_hostname in groups['manila-api'] or + inventory_hostname in groups['manila-data'] or inventory_hostname in groups['manila-share'] or inventory_hostname in groups['manila-scheduler'] diff --git a/ansible/roles/manila/tasks/pull.yml b/ansible/roles/manila/tasks/pull.yml index 608646f698..520e29c088 100644 --- a/ansible/roles/manila/tasks/pull.yml +++ b/ansible/roles/manila/tasks/pull.yml @@ -19,3 +19,10 @@ common_options: "{{ docker_common_options }}" image: "{{ manila_share_image_full }}" when: inventory_hostname in groups['manila-share'] + +- name: Pulling manila-data image + kolla_docker: + action: "pull_image" + common_options: "{{ docker_common_options }}" + image: "{{ manila_data_image_full }}" + when: inventory_hostname in groups['manila-data'] diff --git a/ansible/roles/manila/tasks/reconfigure.yml b/ansible/roles/manila/tasks/reconfigure.yml index 3c265fb0d8..90ab181044 100644 --- a/ansible/roles/manila/tasks/reconfigure.yml +++ b/ansible/roles/manila/tasks/reconfigure.yml @@ -8,6 +8,7 @@ when: inventory_hostname in groups[item.group] with_items: - { name: manila_api, group: manila-api } + - { name: manila_data, group: manila-data } - { name: manila_scheduler, group: manila-scheduler } - { name: manila_share, group: manila-share } @@ -21,6 +22,7 @@ when: inventory_hostname in groups[item.group] with_items: - { name: manila_api, group: manila-api } + - { name: manila_data, group: manila-data } - { name: manila_scheduler, group: manila-scheduler } - { name: manila_share, group: manila-share } @@ -35,6 +37,7 @@ when: inventory_hostname in groups[item.group] with_items: - { name: manila_api, group: manila-api } + - { name: manila_data, group: manila-data } - { name: manila_scheduler, group: manila-scheduler } - { name: manila_share, group: manila-share } @@ -49,6 +52,7 @@ - item[2]['rc'] == 1 with_together: - [{ name: manila_api, group: manila-api }, + { name: manila_data, group: manila-data }, { name: manila_scheduler, group: manila-scheduler }, { name: manila_share, group: manila-share }] - "{{ container_envs.results }}" @@ -68,6 +72,7 @@ - item[2]['rc'] == 1 with_together: - [{ name: manila_api, group: manila-api }, + { name: manila_data, group: manila-data }, { name: manila_scheduler, group: manila-scheduler }, { name: manila_share, group: manila-share }] - "{{ container_envs.results }}" diff --git a/ansible/roles/manila/tasks/start.yml b/ansible/roles/manila/tasks/start.yml index 7adaff7127..103b9f506a 100644 --- a/ansible/roles/manila/tasks/start.yml +++ b/ansible/roles/manila/tasks/start.yml @@ -36,3 +36,17 @@ - "/run/:/run/:shared" - "kolla_logs:/var/log/kolla/" when: inventory_hostname in groups['manila-share'] + +- name: Starting manila-data container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + name: "manila_data" + image: "{{ manila_data_image_full }}" + privileged: True + volumes: + - "{{ node_config_directory }}/manila-data/:{{ container_config_directory }}/:ro" + - "/etc/localtime:/etc/localtime:ro" + - "/run/:/run/:shared" + - "kolla_logs:/var/log/kolla/" + when: inventory_hostname in groups['manila-data'] diff --git a/ansible/roles/manila/templates/manila-data.json.j2 b/ansible/roles/manila/templates/manila-data.json.j2 new file mode 100644 index 0000000000..b5a8ce2bba --- /dev/null +++ b/ansible/roles/manila/templates/manila-data.json.j2 @@ -0,0 +1,18 @@ +{ + "command": "manila-data --config-file /etc/manila/manila.conf", + "config_files": [ + { + "source": "{{ container_config_directory }}/manila.conf", + "dest": "/etc/manila/manila.conf", + "owner": "manila", + "perm": "0600" + } + ], + "permissions": [ + { + "path": "/var/log/kolla/manila", + "owner": "manila:manila", + "recurse": true + } + ] +} diff --git a/ansible/site.yml b/ansible/site.yml index dd2e2da336..55f3d658e5 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -265,6 +265,7 @@ - hosts: - manila-api + - manila-data - manila-share - manila-scheduler serial: '{{ serial|default("0") }}' diff --git a/docker/manila/manila-data/Dockerfile.j2 b/docker/manila/manila-data/Dockerfile.j2 new file mode 100644 index 0000000000..8878d1acbe --- /dev/null +++ b/docker/manila/manila-data/Dockerfile.j2 @@ -0,0 +1,24 @@ +FROM {{ namespace }}/{{ image_prefix }}manila-base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% block manila_data_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% if install_type == 'binary' %} + {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} + + {% set manila_data_packages = [ + 'manila-data' + ] %} + +{{ macros.install_packages(manila_data_packages | customizable("packages")) }} + + {% endif %} +{% endif %} + +{% block manila_data_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} + +USER manila