Adds ansible code for iscsid and tgtd containers

This partially implements iscsi and lvm2 support for cinder
in Kolla. Adds ansible code for iscsid and tgtd containers.

Change-Id: I2a4cfcf104397396ea61a09637d9ef3fc77b515f
Partially-Implements: blueprint iscsi-lvm2-docker
This commit is contained in:
Serguei Bezverkhi 2016-03-31 10:33:55 -04:00
parent 184f01a0d6
commit 6c2d7c7944
13 changed files with 150 additions and 12 deletions

View File

@ -37,3 +37,17 @@
- include: bootstrap_service.yml
when: database_created
- name: Creating cinder targets volume
kolla_docker:
action: "create_volume"
common_options: "{{ docker_common_options }}"
name: "cinder"
when: "{{ enable_iscsi | bool }}"
- name: Creating iscsi info volume
kolla_docker:
action: "create_volume"
common_options: "{{ docker_common_options }}"
name: "iscsi_info"
when: "{{ enable_iscsi | bool }}"

View File

@ -21,6 +21,16 @@
- "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['cinder-scheduler']
- name: Prepare volumes list
set_fact:
mounts:
- "{{ node_config_directory }}/cinder-volume/:{{ container_config_directory }}/:ro"
- "/dev/:/dev/"
- "/run/:/run/"
- "{% if enable_iscsi | bool %}cinder:/var/lib/cinder{% endif %}"
- "{% if enable_iscsi | bool %}iscsi_info:/etc/iscsi{% endif %}"
- "kolla_logs:/var/log/kolla/"
- name: Starting cinder-volume container
kolla_docker:
action: "start_container"
@ -28,11 +38,8 @@
name: "cinder_volume"
image: "{{ cinder_volume_image_full }}"
privileged: True
volumes:
- "{{ node_config_directory }}/cinder-volume/:{{ container_config_directory }}/:ro"
- "/dev/:/dev/"
- "/run/:/run/"
- "kolla_logs:/var/log/kolla/"
ipc_mode: "host"
volumes: '{{ mounts | reject("equalto", "") | list}}'
when: inventory_hostname in groups['cinder-volume']
- name: Starting cinder-backup container

View File

@ -0,0 +1,13 @@
---
project_name: "iscsi"
####################
# Docker
####################
iscsid_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-iscsid"
iscsid_tag: "{{ openstack_release }}"
iscsid_image_full: "{{ iscsid_image }}:{{ iscsid_tag }}"
tgtd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-tgtd"
tgtd_tag: "{{ openstack_release }}"
tgtd_image_full: "{{ tgtd_image }}:{{ tgtd_tag }}"

View File

@ -0,0 +1,34 @@
---
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item }}"
state: "directory"
recurse: yes
when: inventory_hostname in groups['compute']
with_items:
- "iscsid"
- 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:
- "iscsid"
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item }}"
state: "directory"
recurse: yes
when: inventory_hostname in groups['tgtd']
with_items:
- "tgtd"
- 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['tgtd']
with_items:
- "tgtd"

View File

@ -0,0 +1,4 @@
---
- include: config.yml
- include: start.yml

View File

@ -0,0 +1,2 @@
---
- include: "{{ action }}.yml"

View File

@ -0,0 +1,7 @@
---
- name: Pulling iscsi image
kolla_docker:
action: "pull_image"
common_options: "{{ docker_common_options }}"
image: "{{ iscsi_image_full }}"
when: inventory_hostname in groups['iscsi']

View File

@ -0,0 +1 @@
---

View File

@ -0,0 +1,40 @@
---
- name: Starting iscsid container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ iscsid_image_full }}"
name: "iscsid"
ipc_mode: "host"
privileged: True
volumes:
- "{{ node_config_directory }}/iscsid/:{{ container_config_directory }}/:ro"
- "kolla_logs:/var/log/kolla/"
- "/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']
- name: Starting tgtd container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ tgtd_image_full }}"
name: "tgtd"
ipc_mode: "host"
privileged: True
volumes:
- "{{ node_config_directory }}/tgtd/:{{ container_config_directory }}/:ro"
- "kolla_logs:/var/log/kolla/"
- "/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['tgtd']

View File

@ -0,0 +1 @@
---

View File

@ -0,0 +1,4 @@
{
"command": "iscsid -d 8 -f --pid=/run/iscsid.pid",
"config_files": []
}

View File

@ -0,0 +1,4 @@
{
"command": "tgtd -d 1 -f --iscsi portal={{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{ iscsi_port }}",
"config_files": []
}

View File

@ -11,12 +11,25 @@
- "{{ node_config_directory }}/nova-libvirt/:{{ container_config_directory }}/:ro"
- "/lib/modules:/lib/modules:ro"
- "/run/:/run/"
- "/dev:/dev"
- "/sys/fs/cgroup:/sys/fs/cgroup"
- "kolla_logs:/var/log/kolla/"
- "libvirtd:/var/lib/libvirt"
- "nova_compute:/var/lib/nova/"
when: inventory_hostname in groups['compute']
- name: Prepare volumes list
set_fact:
mounts:
- "{{ node_config_directory }}/nova-compute/:{{ container_config_directory }}/:ro"
- "/lib/modules:/lib/modules:ro"
- "/run:/run"
- "/dev:/dev"
- "kolla_logs:/var/log/kolla/"
- "{% if enable_iscsi | bool %}iscsi_info:/etc/iscsi{% endif %}"
- "libvirtd:/var/lib/libvirt"
- "nova_compute:/var/lib/nova/"
- name: Starting nova-compute container
kolla_docker:
action: "start_container"
@ -24,13 +37,7 @@
image: "{{ nova_compute_image_full }}"
name: "nova_compute"
privileged: True
volumes:
- "{{ node_config_directory }}/nova-compute/:{{ container_config_directory }}/:ro"
- "/lib/modules:/lib/modules:ro"
- "/run:/run"
- "kolla_logs:/var/log/kolla/"
- "libvirtd:/var/lib/libvirt"
- "nova_compute:/var/lib/nova/"
volumes: '{{ mounts | reject("equalto", "") | list}}'
when:
- inventory_hostname in groups['compute']
- not enable_nova_fake | bool