From 11a60a65684a7a453afc4802436cdcc56b3c4e0c Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 25 Sep 2020 10:05:59 +0000 Subject: [PATCH] Add support for using a tmpfs for Cinder image conversion This can improve performance of image format conversion and encryption, if sufficient memory is available on the cinder-volume host. Closes-Bug: #1897276 Change-Id: I4ca1c4db7b66fdfc6bb873aad2570234f3882d81 --- ansible/roles/cinder/defaults/main.yml | 7 +++++++ ansible/roles/cinder/handlers/main.yml | 1 + ansible/roles/cinder/tasks/check-containers.yml | 1 + .../notes/cinder-conversion-tmpfs-94e2ed1de5d9ea06.yaml | 6 ++++++ 4 files changed, 15 insertions(+) create mode 100644 releasenotes/notes/cinder-conversion-tmpfs-94e2ed1de5d9ea06.yaml diff --git a/ansible/roles/cinder/defaults/main.yml b/ansible/roles/cinder/defaults/main.yml index 95c7576d7e..ba447d6a6b 100644 --- a/ansible/roles/cinder/defaults/main.yml +++ b/ansible/roles/cinder/defaults/main.yml @@ -38,6 +38,7 @@ cinder_services: image: "{{ cinder_volume_image_full }}" privileged: True ipc_mode: "host" + tmpfs: "{{ cinder_volume_tmpfs }}" volumes: "{{ cinder_volume_default_volumes + cinder_volume_extra_volumes }}" dimensions: "{{ cinder_volume_dimensions }}" cinder-backup: @@ -125,6 +126,12 @@ cinder_backup_extra_volumes: "{{ cinder_extra_volumes }}" cinder_scheduler_extra_volumes: "{{ cinder_extra_volumes }}" cinder_volume_extra_volumes: "{{ cinder_extra_volumes }}" +cinder_volume_tmpfs: + - "{% if cinder_enable_conversion_tmpfs | bool %}/var/lib/cinder/conversion{% endif %}" + +# If true, use a tmpfs mount for the Cinder image conversion directory. +cinder_enable_conversion_tmpfs: false + #################### # OpenStack #################### diff --git a/ansible/roles/cinder/handlers/main.yml b/ansible/roles/cinder/handlers/main.yml index 47a470f7fc..ddad53b805 100644 --- a/ansible/roles/cinder/handlers/main.yml +++ b/ansible/roles/cinder/handlers/main.yml @@ -41,6 +41,7 @@ image: "{{ service.image }}" privileged: "{{ service.privileged | default(False) }}" ipc_mode: "{{ service.ipc_mode | default('') }}" + tmpfs: "{{ service.tmpfs | default(omit) }}" volumes: "{{ service.volumes | reject('equalto', '') | list }}" dimensions: "{{ service.dimensions }}" when: diff --git a/ansible/roles/cinder/tasks/check-containers.yml b/ansible/roles/cinder/tasks/check-containers.yml index 184933646c..9f483539f0 100644 --- a/ansible/roles/cinder/tasks/check-containers.yml +++ b/ansible/roles/cinder/tasks/check-containers.yml @@ -6,6 +6,7 @@ common_options: "{{ docker_common_options }}" name: "{{ item.value.container_name }}" image: "{{ item.value.image }}" + tmpfs: "{{ item.value.tmpfs | default(omit) }}" volumes: "{{ item.value.volumes | reject('equalto', '') | list }}" dimensions: "{{ item.value.dimensions }}" privileged: "{{ item.value.privileged | default(False) }}" diff --git a/releasenotes/notes/cinder-conversion-tmpfs-94e2ed1de5d9ea06.yaml b/releasenotes/notes/cinder-conversion-tmpfs-94e2ed1de5d9ea06.yaml new file mode 100644 index 0000000000..cdfa192050 --- /dev/null +++ b/releasenotes/notes/cinder-conversion-tmpfs-94e2ed1de5d9ea06.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Adds support for using a ``tmpfs`` mount for the image conversion directory + of the ``cinder_volume`` container. This is disabled by default, but may be + enabled by setting ``cinder_enable_conversion_tmpfs`` to ``true``.