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
This commit is contained in:
chenxing 2019-12-19 12:03:54 +08:00 committed by Radosław Piliszek
parent a4e7a13ac7
commit fa49b2692d
5 changed files with 15 additions and 3 deletions

View File

@ -9,6 +9,7 @@ glance_services:
enabled: true
image: "{{ glance_api_image_full }}"
environment: "{{ container_proxy }}"
privileged: "{{ enable_cinder | bool and enable_cinder_backend_iscsi | bool }}"
volumes: "{{ glance_api_default_volumes + glance_api_extra_volumes }}"
dimensions: "{{ glance_api_dimensions }}"
haproxy:
@ -120,6 +121,9 @@ glance_api_default_volumes:
- "{{ 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 %}"
glance_extra_volumes: "{{ default_extra_volumes }}"
glance_api_extra_volumes: "{{ glance_extra_volumes }}"

View File

@ -9,6 +9,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

@ -6,6 +6,7 @@
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 }}"

View File

@ -43,7 +43,7 @@
BOOTSTRAP:
name: "bootstrap_glance"
restart_policy: no
volumes: "{{ glance_api.volumes }}"
volumes: "{{ glance_api.volumes|reject('equalto', '')|list }}"
run_once: True
delegate_to: "{{ glance_api_hosts[0] }}"
@ -64,7 +64,7 @@
BOOTSTRAP:
name: "bootstrap_glance"
restart_policy: no
volumes: "{{ glance_api.volumes }}"
volumes: "{{ glance_api.volumes|reject('equalto', '')|list }}"
run_once: True
delegate_to: "{{ glance_api_hosts[0] }}"
notify:
@ -94,7 +94,7 @@
BOOTSTRAP:
name: "bootstrap_glance"
restart_policy: no
volumes: "{{ glance_api.volumes }}"
volumes: "{{ glance_api.volumes|reject('equalto', '')|list }}"
run_once: True
delegate_to: "{{ glance_api_hosts[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>`__