Browse Source

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
tags/8.0.0.0b1
Eduardo Gonzalez 6 months ago
parent
commit
cc9dae4dee

+ 1
- 0
ansible/group_vars/all.yml View File

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

+ 7
- 1
ansible/roles/glance/defaults/main.yml View File

@@ -151,7 +151,7 @@ openstack_glance_auth: "{{ openstack_auth }}"
151 151
 
152 152
 ###################
153 153
 # Kolla
154
-####################
154
+###################
155 155
 glance_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
156 156
 glance_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
157 157
 glance_dev_mode: "{{ kolla_dev_mode }}"
@@ -162,3 +162,9 @@ glance_source_version: "{{ kolla_source_version }}"
162 162
 ################################################
163 163
 vmware_vcenter_name:
164 164
 vmware_datastore_name:
165
+
166
+###################
167
+# Glance cache
168
+###################
169
+# Default maximum size of 10Gb
170
+glance_cache_max_size: "10737418240"

+ 1
- 0
ansible/roles/glance/handlers/main.yml View File

@@ -21,6 +21,7 @@
21 21
     - inventory_hostname in glance_api_hosts
22 22
     - service.enabled | bool
23 23
     - config_json.changed | bool
24
+      or glance_cache_conf.changed | bool
24 25
       or glance_conf.changed | bool
25 26
       or glance_swift_conf.changed | bool
26 27
       or policy_overwriting.changed | bool

+ 20
- 0
ansible/roles/glance/tasks/config.yml View File

@@ -76,6 +76,26 @@
76 76
     - Restart glance-api container
77 77
     - Restart glance-registry container
78 78
 
79
+- name: Copying over glance-cache.conf for glance_api
80
+  vars:
81
+    glance_api: "{{ glance_services['glance-api'] }}"
82
+  merge_configs:
83
+    sources:
84
+      - "{{ role_path }}/templates/glance-cache.conf.j2"
85
+      - "{{ node_custom_config }}/glance-cache.conf"
86
+      - "{{ node_custom_config }}/glance/glance-cache.conf"
87
+      - "{{ node_custom_config }}/glance/{{ inventory_hostname }}/glance-cache.conf"
88
+    dest: "{{ node_config_directory }}/glance-api/glance-cache.conf"
89
+    mode: "0660"
90
+  become: true
91
+  register: glance_cache_conf
92
+  when:
93
+    - glance_api.enabled | bool
94
+    - inventory_hostname in groups[glance_api.group]
95
+    - enable_glance_image_cache | bool
96
+  notify:
97
+    - Restart glance-api container
98
+
79 99
 - name: Copying over glance-swift.conf for glance_api
80 100
   vars:
81 101
     glance_api: "{{ glance_services['glance-api'] }}"

+ 6
- 1
ansible/roles/glance/templates/glance-api.conf.j2 View File

@@ -19,6 +19,11 @@ cinder_catalog_info = volume:cinder:internalURL
19 19
 
20 20
 transport_url = {{ rpc_transport_url }}
21 21
 
22
+{% if enable_glance_image_cache | bool %}
23
+image_cache_max_size = {{ glance_cache_max_size }}
24
+image_cache_dir = /var/lib/glance/image-cache
25
+{% endif %}
26
+
22 27
 [database]
23 28
 connection = mysql+pymysql://{{ glance_database_user }}:{{ glance_database_password }}@{{ glance_database_address }}/{{ glance_database_name }}
24 29
 max_retries = -1
@@ -38,7 +43,7 @@ memcache_secret_key = {{ memcache_secret_key }}
38 43
 memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}
39 44
 
40 45
 [paste_deploy]
41
-flavor = keystone
46
+flavor = {% if enable_glance_image_cache | bool %}keystone+cachemanagement{% else %}keystone{% endif %}
42 47
 
43 48
 [glance_store]
44 49
 {% if glance_backend_vmware | bool %}

+ 6
- 0
ansible/roles/glance/templates/glance-api.json.j2 View File

@@ -24,6 +24,12 @@
24 24
             "dest": "/etc/glance/glance-swift.conf",
25 25
             "owner": "glance",
26 26
             "perm": "0600"
27
+        }{% endif %}{% if enable_glance_image_cache | bool %},
28
+        {
29
+            "source": "{{ container_config_directory }}/glance-cache.conf",
30
+            "dest": "/etc/glance/glance-cache.conf",
31
+            "owner": "glance",
32
+            "perm": "0600"
27 33
         }{% endif %}
28 34
     ],
29 35
     "permissions": [

+ 19
- 0
ansible/roles/glance/templates/glance-cache.conf.j2 View File

@@ -0,0 +1,19 @@
1
+[DEFAULT]
2
+
3
+debug = {{ glance_logging_debug }}
4
+log_file = /var/log/kolla/glance/glance-cache.log
5
+
6
+image_cache_max_size = {{ glance_cache_max_size }}
7
+image_cache_dir = /var/lib/glance/image-cache
8
+
9
+auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }}
10
+admin_password = {{ glance_keystone_password }}
11
+admin_user = {{ glance_keystone_user }}
12
+admin_tenant_name = {{ default_project_domain_id }}
13
+
14
+registry_host = {{ api_interface_address }}
15
+registry_port = {{ glance_registry_port }}
16
+
17
+{% if glance_backend_file | bool %}
18
+filesystem_store_datadir = /var/lib/glance/images/
19
+{% endif %}

+ 1
- 0
etc/kolla/globals.yml View File

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

+ 6
- 0
releasenotes/notes/glance-cache-ecf950ba3e9136b1.yaml View File

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

Loading…
Cancel
Save