Add Swift backend support to Glance

Support setting Swift as Glance storage backend.

Change-Id: Idddbf2ce741e0486d60e1de88c77a7f0332a5a2b
This commit is contained in:
guochao 2017-07-12 09:42:34 +08:00 committed by jimmygc
parent 3f6eaefeaf
commit d3e07342a5
9 changed files with 53 additions and 2 deletions

View File

@ -484,6 +484,7 @@ keystone_default_user_role: "_member_"
glance_backend_file: "{{ not enable_ceph | bool }}"
glance_backend_ceph: "{{ enable_ceph }}"
glance_backend_vmware: "no"
glance_backend_swift: "no"
glance_file_datadir_volume: "glance"
#######################

View File

@ -72,6 +72,8 @@ glance_backends:
enabled: "{{ glance_backend_vmware | bool }}"
- name: cinder
enabled: "{{ enable_cinder | bool }}"
- name: "swift"
enabled: "{{ enable_swift | bool and glance_backend_swift | bool }}"
glance_store_backends: "{{ glance_backends|selectattr('enabled', 'equalto', true)|list }}"

View File

@ -19,6 +19,7 @@
- service.enabled | bool
- config_json.changed | bool
or glance_conf.changed | bool
or glance_swift_conf.changed | bool
or policy_json.changed | bool
or glance_api_container.changed | bool

View File

@ -49,6 +49,24 @@
run_once: True
register: glance_policy
- name: Copying over glance-swift.conf for glance_api
vars:
glance_api: "{{ glance_services['glance-api'] }}"
merge_configs:
sources:
- "{{ role_path }}/templates/glance-swift.conf.j2"
- "{{ node_custom_config }}/glance-swift.conf"
- "{{ node_custom_config }}/glance/glance-swift.conf"
- "{{ node_custom_config }}/glance/{{ inventory_hostname }}/glance-swift.conf"
dest: "{{ node_config_directory }}/glance-api/glance-swift.conf"
register: glance_swift_conf
when:
- glance_api.enabled | bool
- inventory_hostname in groups[glance_api.group]
- glance_backend_swift | bool
notify:
- Restart glance-api container
- name: Copying over existing policy.json
template:
src: "{{ node_custom_config }}/glance/policy.json"

View File

@ -45,6 +45,8 @@ flavor = keystone
default_store = vsphere
{% elif enable_ceph | bool and glance_backend_ceph | bool %}
default_store = rbd
{% elif enable_swift | bool and glance_backend_swift | bool %}
default_store = swift+http
{% else %}
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
@ -60,6 +62,17 @@ rbd_store_pool = {{ ceph_glance_pool_name }}
rbd_store_chunk_size = 8
{% endif %}
{% if enable_swift | bool and glance_backend_swift | bool %}
swift_store_container = glance
swift_store_multiple_containers_seed = 0
swift_store_multi_tenant = False
swift_store_create_container_on_put = True
swift_store_region = {{ openstack_region_name }}
default_swift_reference = swift
swift_store_config_file = /etc/glance/glance-swift.conf
swift_store_auth_insecure = True
{% endif %}
{% if glance_backend_vmware | bool %}
vmware_server_host = {{ vmware_vcenter_host_ip }}
vmware_server_username = {{ vmware_vcenter_host_username }}

View File

@ -19,8 +19,13 @@
"dest": "/etc/ceph/",
"owner": "glance",
"perm": "0700"
}
{% endif %}
}{% endif %}{% if glance_backend_swift | bool %},
{
"source": "{{ container_config_directory }}/glance-swift.conf",
"dest": "/etc/glance/glance-swift.conf",
"owner": "glance",
"perm": "0600"
}{% endif %}
],
"permissions": [
{

View File

@ -0,0 +1,7 @@
[swift]
auth_version = 3
auth_address = {{ openstack_auth.auth_url }}/v3
user = service:{{ glance_keystone_user }}
key = {{ glance_keystone_password }}
project_domain_id = default
user_domain_id = default

View File

@ -258,6 +258,7 @@ kolla_internal_vip_address: "10.10.10.254"
#glance_backend_file: "yes"
#glance_backend_ceph: "no"
#glance_backend_vmware: "no"
#glance_backend_swift: "no"
#######################

View File

@ -0,0 +1,3 @@
---
features:
- Add Glance Swift backend support