Enable Glance to use Cinder iSCSI backend

To use an iSCSI Cinder backend as its store, glance_api must run
privileged and have /dev and /etc/iscsi properly mounted

Co-authored-by: Radosław Piliszek <radoslaw.piliszek@gmail.com>
Change-Id: I988d3c9d0564483440ae17203ad88a8049abbea4
Closes-Bug: #1855695
(cherry picked from commit fa49b2692d)
This commit is contained in:
chenxing 2019-12-19 12:03:54 +08:00 committed by Mark Goddard
parent 7e97edfd94
commit be4daa5b4e
5 changed files with 32 additions and 3 deletions

View File

@ -8,12 +8,16 @@ glance_services:
enabled: true
image: "{{ glance_api_image_full }}"
environment: "{{ container_proxy }}"
privileged: "{{ enable_cinder | bool and enable_cinder_backend_iscsi | bool }}"
volumes:
- "{{ node_config_directory }}/glance-api/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "{{ glance_file_datadir_volume }}:/var/lib/glance/"
- "{{ kolla_dev_repos_directory ~ '/glance/glance:/var/lib/kolla/venv/lib/python2.7/site-packages/glance' if glance_dev_mode | bool else '' }}"
- "kolla_logs:/var/log/kolla/"
# NOTE(yoctozepto): below to support Cinder iSCSI backends
- "{% if enable_cinder | bool and enable_cinder_backend_iscsi | bool %}iscsi_info:/etc/iscsi{% endif %}"
- "{% if enable_cinder | bool and enable_cinder_backend_iscsi | bool %}/dev:/dev{% endif %}"
dimensions: "{{ glance_api_dimensions }}"
haproxy:
glance_api:

View File

@ -13,6 +13,7 @@
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
privileged: "{{ service.privileged }}"
environment: "{{ service.environment }}"
volumes: "{{ service.volumes|reject('equalto', '')|list }}"
dimensions: "{{ service.dimensions }}"

View File

@ -0,0 +1,18 @@
---
- name: Check glance containers
become: true
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ item.value.container_name }}"
image: "{{ item.value.image }}"
privileged: "{{ item.value.privileged }}"
environment: "{{ item.value.environment | default(omit) }}"
volumes: "{{ item.value.volumes|reject('equalto', '')|list }}"
dimensions: "{{ item.value.dimensions }}"
when:
- item.value.host_in_groups | bool
- item.value.enabled | bool
with_dict: "{{ glance_services }}"
notify:
- "Restart {{ item.key }} container"

View File

@ -44,7 +44,7 @@
BOOTSTRAP:
name: "bootstrap_glance"
restart_policy: "never"
volumes: "{{ glance_api.volumes }}"
volumes: "{{ glance_api.volumes|reject('equalto', '')|list }}"
run_once: True
delegate_to: "{{ groups[glance_api.group][0] }}"
@ -65,7 +65,7 @@
BOOTSTRAP:
name: "bootstrap_glance"
restart_policy: "never"
volumes: "{{ glance_api.volumes }}"
volumes: "{{ glance_api.volumes|reject('equalto', '')|list }}"
run_once: True
delegate_to: "{{ groups[glance_api.group][0] }}"
notify:
@ -95,7 +95,7 @@
BOOTSTRAP:
name: "bootstrap_glance"
restart_policy: "never"
volumes: "{{ glance_api.volumes }}"
volumes: "{{ glance_api.volumes|reject('equalto', '')|list }}"
run_once: True
delegate_to: "{{ groups[glance_api.group][0] }}"

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes glance_api to run as privileged and adds missing mounts so it
can use an iscsi cinder backend as its store. `LP#1855695
<https://bugs.launchpad.net/kolla-ansible/+bug/1855695>`__