From 115c55e1fe55598704ddab8e3ce251d1f7d78ffc Mon Sep 17 00:00:00 2001 From: Carlos Cesario Date: Fri, 8 Jul 2016 13:34:04 -0300 Subject: [PATCH] Add multipathing support to docker container Due some cinder drivers need multipathing support like this one http://docs.openstack.org/mitaka/config-reference/block-storage/drivers/ibm-storwize-svc-driver.html This PS will allow to run these additional drivers when using Kolla. Implements: blueprint multipath-support Change-Id: Id6cf29f984c92773bbfc2f95daea573a74701648 --- ansible/group_vars/all.yml | 1 + ansible/inventory/all-in-one | 4 ++++ ansible/inventory/multinode | 4 ++++ ansible/roles/multipathd/defaults/main.yml | 9 +++++++ ansible/roles/multipathd/tasks/config.yml | 24 +++++++++++++++++++ ansible/roles/multipathd/tasks/deploy.yml | 4 ++++ ansible/roles/multipathd/tasks/main.yml | 2 ++ ansible/roles/multipathd/tasks/pull.yml | 7 ++++++ .../roles/multipathd/tasks/reconfigure.yml | 1 + ansible/roles/multipathd/tasks/start.yml | 21 ++++++++++++++++ ansible/roles/multipathd/tasks/upgrade.yml | 5 ++++ .../multipathd/templates/multipath.conf.j2 | 11 +++++++++ .../multipathd/templates/multipathd.json.j2 | 11 +++++++++ ansible/site.yml | 8 +++++++ docker/multipathd/Dockerfile.j2 | 18 ++++++++++++++ etc/kolla/globals.yml | 1 + .../notes/add-multipath-9ee29be1fcea6d94.yaml | 3 +++ 17 files changed, 134 insertions(+) create mode 100644 ansible/roles/multipathd/defaults/main.yml create mode 100644 ansible/roles/multipathd/tasks/config.yml create mode 100644 ansible/roles/multipathd/tasks/deploy.yml create mode 100644 ansible/roles/multipathd/tasks/main.yml create mode 100644 ansible/roles/multipathd/tasks/pull.yml create mode 100644 ansible/roles/multipathd/tasks/reconfigure.yml create mode 100644 ansible/roles/multipathd/tasks/start.yml create mode 100644 ansible/roles/multipathd/tasks/upgrade.yml create mode 100644 ansible/roles/multipathd/templates/multipath.conf.j2 create mode 100644 ansible/roles/multipathd/templates/multipathd.json.j2 create mode 100644 docker/multipathd/Dockerfile.j2 create mode 100644 releasenotes/notes/add-multipath-9ee29be1fcea6d94.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 157b4299ca..aed7db9865 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -205,6 +205,7 @@ enable_magnum: "no" enable_manila: "no" enable_mistral: "no" enable_mongodb: "no" +enable_multipathd: "no" enable_murano: "no" enable_neutron_lbaas: "no" enable_neutron_qos: "no" diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index d8a4232cf9..53a8940afb 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -244,3 +244,7 @@ ceilometer [ceilometer-compute:children] compute + +# Multipathd +[multipathd:children] +compute diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index 5edfbd2c02..6b98a2dd26 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -256,3 +256,7 @@ ceilometer [ceilometer-compute:children] compute + +# Multipathd +[multipathd:children] +compute diff --git a/ansible/roles/multipathd/defaults/main.yml b/ansible/roles/multipathd/defaults/main.yml new file mode 100644 index 0000000000..0a2a56dff0 --- /dev/null +++ b/ansible/roles/multipathd/defaults/main.yml @@ -0,0 +1,9 @@ +--- +project_name: "multipathd" + +#################### +# Docker +#################### +multipathd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-multipathd" +multipathd_tag: "{{ openstack_release }}" +multipathd_image_full: "{{ multipathd_image }}:{{ multipathd_tag }}" diff --git a/ansible/roles/multipathd/tasks/config.yml b/ansible/roles/multipathd/tasks/config.yml new file mode 100644 index 0000000000..a831b32a6c --- /dev/null +++ b/ansible/roles/multipathd/tasks/config.yml @@ -0,0 +1,24 @@ +--- +- name: Ensuring config directories exist + file: + path: "{{ node_config_directory }}/{{ item }}" + state: "directory" + recurse: yes + when: inventory_hostname in groups['compute'] + with_items: + - "multipathd" + +- name: Copying over config.json files for services + template: + src: "{{ item }}.json.j2" + dest: "{{ node_config_directory }}/{{ item }}/config.json" + when: inventory_hostname in groups['compute'] + with_items: + - "multipathd" + +- name: Copying over multipath.conf + template: + src: "{{ role_path }}/templates/multipath.conf.j2" + dest: "{{ node_config_directory }}/{{ item }}/multipath.conf" + with_items: + - "multipathd" diff --git a/ansible/roles/multipathd/tasks/deploy.yml b/ansible/roles/multipathd/tasks/deploy.yml new file mode 100644 index 0000000000..1f16915ad9 --- /dev/null +++ b/ansible/roles/multipathd/tasks/deploy.yml @@ -0,0 +1,4 @@ +--- +- include: config.yml + +- include: start.yml diff --git a/ansible/roles/multipathd/tasks/main.yml b/ansible/roles/multipathd/tasks/main.yml new file mode 100644 index 0000000000..b017e8b4ad --- /dev/null +++ b/ansible/roles/multipathd/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include: "{{ action }}.yml" diff --git a/ansible/roles/multipathd/tasks/pull.yml b/ansible/roles/multipathd/tasks/pull.yml new file mode 100644 index 0000000000..41d70f65e1 --- /dev/null +++ b/ansible/roles/multipathd/tasks/pull.yml @@ -0,0 +1,7 @@ +--- +- name: Pulling multipathd image + kolla_docker: + action: "pull_image" + common_options: "{{ docker_common_options }}" + image: "{{ multipathd_image_full }}" + when: inventory_hostname in groups['multipathd'] diff --git a/ansible/roles/multipathd/tasks/reconfigure.yml b/ansible/roles/multipathd/tasks/reconfigure.yml new file mode 100644 index 0000000000..ed97d539c0 --- /dev/null +++ b/ansible/roles/multipathd/tasks/reconfigure.yml @@ -0,0 +1 @@ +--- diff --git a/ansible/roles/multipathd/tasks/start.yml b/ansible/roles/multipathd/tasks/start.yml new file mode 100644 index 0000000000..0bd7012f31 --- /dev/null +++ b/ansible/roles/multipathd/tasks/start.yml @@ -0,0 +1,21 @@ +--- +- name: Starting multipathd container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + image: "{{ multipathd_image_full }}" + name: "multipathd" + ipc_mode: "host" + privileged: True + volumes: + - "{{ node_config_directory }}/multipathd/:{{ container_config_directory }}/:ro" + - "kolla_logs:/var/log/kolla/" + - "/etc/localtime:/etc/localtime:ro" + - "/dev/:/dev/" + - "/run/:/run/" + - "/sys/fs/cgroup:/sys/fs/cgroup:ro" + - "/lib/modules:/lib/modules:ro" + - "/sys/kernel/config:/configfs" + - "cinder:/var/lib/cinder" + - "iscsi_info:/etc/iscsi" + when: inventory_hostname in groups['compute'] diff --git a/ansible/roles/multipathd/tasks/upgrade.yml b/ansible/roles/multipathd/tasks/upgrade.yml new file mode 100644 index 0000000000..4586b4fabc --- /dev/null +++ b/ansible/roles/multipathd/tasks/upgrade.yml @@ -0,0 +1,5 @@ +--- +- include: config.yml + +- include: start.yml + serial: "30%" diff --git a/ansible/roles/multipathd/templates/multipath.conf.j2 b/ansible/roles/multipathd/templates/multipath.conf.j2 new file mode 100644 index 0000000000..d063f31a87 --- /dev/null +++ b/ansible/roles/multipathd/templates/multipath.conf.j2 @@ -0,0 +1,11 @@ +defaults { + user_friendly_names no + polling_interval 30 +} + +blacklist { + devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" + devnode "^sd[a]" + devnode "^hd[a-z]" + devnode "^cciss!c[0-9]d[0-9]*" +} diff --git a/ansible/roles/multipathd/templates/multipathd.json.j2 b/ansible/roles/multipathd/templates/multipathd.json.j2 new file mode 100644 index 0000000000..2570a607e2 --- /dev/null +++ b/ansible/roles/multipathd/templates/multipathd.json.j2 @@ -0,0 +1,11 @@ +{ + "command": "/sbin/multipathd -d", + "config_files": [ + { + "source": "{{ container_config_directory }}/multipath.conf", + "dest": "/etc/multipath.conf", + "owner": "root", + "perm": "0600" + } + ] +} diff --git a/ansible/site.yml b/ansible/site.yml index dbf3861ced..98305cfdc3 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -22,6 +22,7 @@ - mariadb - iscsid - tgtd + - multipathd - murano-api - neutron-server - nova-api @@ -60,6 +61,13 @@ tags: iscsi, when: enable_iscsi | bool } +- hosts: + - multipathd + roles: + - { role: multipathd, + tags: multipathd, + when: enable_multipathd | bool } + - hosts: rabbitmq roles: - { role: rabbitmq, diff --git a/docker/multipathd/Dockerfile.j2 b/docker/multipathd/Dockerfile.j2 new file mode 100644 index 0000000000..9c91f91f32 --- /dev/null +++ b/docker/multipathd/Dockerfile.j2 @@ -0,0 +1,18 @@ +FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} + +RUN yum -y install \ + device-mapper-multipath \ + && yum clean all + +{% elif base_distro in ['ubuntu', 'debian'] %} + +RUN apt-get -y install --no-install-recommends \ + multipath-tools \ + && apt-get clean + +{% endif %} + +{{ include_footer }} diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index 47b450cdfd..acee827022 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -120,6 +120,7 @@ neutron_external_interface: "eth1" #enable_mistral: "no" #enable_mongodb: "no" #enable_murano: "no" +#enable_multipathd: "no" #enable_neutron_lbaas: "no" #enable_neutron_qos: "no" #enable_swift: "no" diff --git a/releasenotes/notes/add-multipath-9ee29be1fcea6d94.yaml b/releasenotes/notes/add-multipath-9ee29be1fcea6d94.yaml new file mode 100644 index 0000000000..82377e7295 --- /dev/null +++ b/releasenotes/notes/add-multipath-9ee29be1fcea6d94.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add multipathing support to docker container.