Add glance-cache support

Glance cache is used to keep a locally cache image
in the glance_api service.
Is an usefull service when an image is commonly used
to speed times between pulling from storage backend
and send to nova.

Change-Id: I8e684cc10e4fee1cb52c17a126e3b11f69576cf6
This commit is contained in:
Eduardo Gonzalez 2018-11-19 19:47:09 +01:00
parent 0bc44c9ae9
commit cc9dae4dee
9 changed files with 67 additions and 2 deletions

View File

@ -672,6 +672,7 @@ openstack_auth:
glance_backend_file: "{{ not (glance_backend_ceph | bool or glance_backend_swift | bool or glance_backend_vmware | bool) }}" glance_backend_file: "{{ not (glance_backend_ceph | bool or glance_backend_swift | bool or glance_backend_vmware | bool) }}"
glance_backend_ceph: "{{ enable_ceph }}" glance_backend_ceph: "{{ enable_ceph }}"
glance_backend_vmware: "no" glance_backend_vmware: "no"
enable_glance_image_cache: "no"
# ceph backend has priority over swift in all-ceph clusters # ceph backend has priority over swift in all-ceph clusters
glance_backend_swift: "{{ not (enable_ceph | bool) and enable_swift | bool }}" glance_backend_swift: "{{ not (enable_ceph | bool) and enable_swift | bool }}"
glance_file_datadir_volume: "glance" glance_file_datadir_volume: "glance"

View File

@ -151,7 +151,7 @@ openstack_glance_auth: "{{ openstack_auth }}"
################### ###################
# Kolla # Kolla
#################### ###################
glance_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}" glance_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
glance_dev_repos_pull: "{{ kolla_dev_repos_pull }}" glance_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
glance_dev_mode: "{{ kolla_dev_mode }}" glance_dev_mode: "{{ kolla_dev_mode }}"
@ -162,3 +162,9 @@ glance_source_version: "{{ kolla_source_version }}"
################################################ ################################################
vmware_vcenter_name: vmware_vcenter_name:
vmware_datastore_name: vmware_datastore_name:
###################
# Glance cache
###################
# Default maximum size of 10Gb
glance_cache_max_size: "10737418240"

View File

@ -21,6 +21,7 @@
- inventory_hostname in glance_api_hosts - inventory_hostname in glance_api_hosts
- service.enabled | bool - service.enabled | bool
- config_json.changed | bool - config_json.changed | bool
or glance_cache_conf.changed | bool
or glance_conf.changed | bool or glance_conf.changed | bool
or glance_swift_conf.changed | bool or glance_swift_conf.changed | bool
or policy_overwriting.changed | bool or policy_overwriting.changed | bool

View File

@ -76,6 +76,26 @@
- Restart glance-api container - Restart glance-api container
- Restart glance-registry container - Restart glance-registry container
- name: Copying over glance-cache.conf for glance_api
vars:
glance_api: "{{ glance_services['glance-api'] }}"
merge_configs:
sources:
- "{{ role_path }}/templates/glance-cache.conf.j2"
- "{{ node_custom_config }}/glance-cache.conf"
- "{{ node_custom_config }}/glance/glance-cache.conf"
- "{{ node_custom_config }}/glance/{{ inventory_hostname }}/glance-cache.conf"
dest: "{{ node_config_directory }}/glance-api/glance-cache.conf"
mode: "0660"
become: true
register: glance_cache_conf
when:
- glance_api.enabled | bool
- inventory_hostname in groups[glance_api.group]
- enable_glance_image_cache | bool
notify:
- Restart glance-api container
- name: Copying over glance-swift.conf for glance_api - name: Copying over glance-swift.conf for glance_api
vars: vars:
glance_api: "{{ glance_services['glance-api'] }}" glance_api: "{{ glance_services['glance-api'] }}"

View File

@ -19,6 +19,11 @@ cinder_catalog_info = volume:cinder:internalURL
transport_url = {{ rpc_transport_url }} transport_url = {{ rpc_transport_url }}
{% if enable_glance_image_cache | bool %}
image_cache_max_size = {{ glance_cache_max_size }}
image_cache_dir = /var/lib/glance/image-cache
{% endif %}
[database] [database]
connection = mysql+pymysql://{{ glance_database_user }}:{{ glance_database_password }}@{{ glance_database_address }}/{{ glance_database_name }} connection = mysql+pymysql://{{ glance_database_user }}:{{ glance_database_password }}@{{ glance_database_address }}/{{ glance_database_name }}
max_retries = -1 max_retries = -1
@ -38,7 +43,7 @@ memcache_secret_key = {{ memcache_secret_key }}
memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %} memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}
[paste_deploy] [paste_deploy]
flavor = keystone flavor = {% if enable_glance_image_cache | bool %}keystone+cachemanagement{% else %}keystone{% endif %}
[glance_store] [glance_store]
{% if glance_backend_vmware | bool %} {% if glance_backend_vmware | bool %}

View File

@ -24,6 +24,12 @@
"dest": "/etc/glance/glance-swift.conf", "dest": "/etc/glance/glance-swift.conf",
"owner": "glance", "owner": "glance",
"perm": "0600" "perm": "0600"
}{% endif %}{% if enable_glance_image_cache | bool %},
{
"source": "{{ container_config_directory }}/glance-cache.conf",
"dest": "/etc/glance/glance-cache.conf",
"owner": "glance",
"perm": "0600"
}{% endif %} }{% endif %}
], ],
"permissions": [ "permissions": [

View File

@ -0,0 +1,19 @@
[DEFAULT]
debug = {{ glance_logging_debug }}
log_file = /var/log/kolla/glance/glance-cache.log
image_cache_max_size = {{ glance_cache_max_size }}
image_cache_dir = /var/lib/glance/image-cache
auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }}
admin_password = {{ glance_keystone_password }}
admin_user = {{ glance_keystone_user }}
admin_tenant_name = {{ default_project_domain_id }}
registry_host = {{ api_interface_address }}
registry_port = {{ glance_registry_port }}
{% if glance_backend_file | bool %}
filesystem_store_datadir = /var/lib/glance/images/
{% endif %}

View File

@ -346,6 +346,7 @@ kolla_internal_vip_address: "10.10.10.254"
#glance_backend_file: "yes" #glance_backend_file: "yes"
#glance_backend_swift: "no" #glance_backend_swift: "no"
#glance_backend_vmware: "no" #glance_backend_vmware: "no"
#enable_glance_image_cache: "no"
# Configure glance upgrade option, due to this feature is experimental # Configure glance upgrade option, due to this feature is experimental
# in glance, so default value should be set to "no". # in glance, so default value should be set to "no".
glance_enable_rolling_upgrade: "no" glance_enable_rolling_upgrade: "no"

View File

@ -0,0 +1,6 @@
---
features:
- |
Add support to configure glance-cache, enabled with
``enable_glance_image_cache`` and configure cache size
with ``glance_cache_max_size``.