Unhardcode 'image_conversion_dir' option
Option 'image_conversion_dir' is directory used for temporary storage
during image conversion.
Change-Id: Iec808873ecf3fbf042d5a33857fd44d23edb642b
Related-Prod: PROD-29437 (PROD:29437)
diff --git a/README.rst b/README.rst
index 6c97682..2da3342 100644
--- a/README.rst
+++ b/README.rst
@@ -86,6 +86,7 @@
default_volume_type: 7k2SaS
enable_force_upload: true
my_ip: 192.168.0.254
+ image_conversion_dir: /var/tmp/cinder/conversion
database:
engine: mysql
host: 127.0.0.1
@@ -254,6 +255,15 @@
wipe_method: shred
...
+* Configure directory used for temporary storage during image conversion:
+
+ .. code-block:: yaml
+
+ cinder:
+ volume:
+ image_conversion_dir: /var/tmp/cinder/conversion
+ ...
+
* Configuration of ``policy.json`` file:
.. code-block:: yaml
diff --git a/cinder/files/mitaka/cinder.conf.volume.Debian b/cinder/files/mitaka/cinder.conf.volume.Debian
index 72ffa70..4a9cd1d 100644
--- a/cinder/files/mitaka/cinder.conf.volume.Debian
+++ b/cinder/files/mitaka/cinder.conf.volume.Debian
@@ -16,6 +16,10 @@
state_path = /var/lib/cinder
+{%- if volume.image_conversion_dir is defined %}
+image_conversion_dir = {{ volume.image_conversion_dir }}
+{%- endif %}
+
use_syslog=False
glance_num_retries=0
diff --git a/cinder/files/newton/cinder.conf.volume.Debian b/cinder/files/newton/cinder.conf.volume.Debian
index b21e7d6..c85f01e 100644
--- a/cinder/files/newton/cinder.conf.volume.Debian
+++ b/cinder/files/newton/cinder.conf.volume.Debian
@@ -16,6 +16,10 @@
state_path = /var/lib/cinder
+{%- if volume.image_conversion_dir is defined %}
+image_conversion_dir = {{ volume.image_conversion_dir }}
+{%- endif %}
+
use_syslog=False
glance_num_retries=0
diff --git a/cinder/files/ocata/cinder.conf.volume.Debian b/cinder/files/ocata/cinder.conf.volume.Debian
index 12d8978..ac36bf6 100644
--- a/cinder/files/ocata/cinder.conf.volume.Debian
+++ b/cinder/files/ocata/cinder.conf.volume.Debian
@@ -16,6 +16,10 @@
state_path = /var/lib/cinder
+{%- if volume.image_conversion_dir is defined %}
+image_conversion_dir = {{ volume.image_conversion_dir }}
+{%- endif %}
+
use_syslog=False
glance_num_retries=0
diff --git a/cinder/files/pike/cinder.conf.volume.Debian b/cinder/files/pike/cinder.conf.volume.Debian
index 6f737fb..6b05671 100644
--- a/cinder/files/pike/cinder.conf.volume.Debian
+++ b/cinder/files/pike/cinder.conf.volume.Debian
@@ -27,6 +27,10 @@
state_path = /var/lib/cinder
+{%- if volume.image_conversion_dir is defined %}
+image_conversion_dir = {{ volume.image_conversion_dir }}
+{%- endif %}
+
use_syslog=False
glance_num_retries=0
diff --git a/cinder/files/queens/cinder.conf.volume.Debian b/cinder/files/queens/cinder.conf.volume.Debian
index 195ee91..dfa02e3 100644
--- a/cinder/files/queens/cinder.conf.volume.Debian
+++ b/cinder/files/queens/cinder.conf.volume.Debian
@@ -492,6 +492,9 @@
# Directory used for temporary storage during image conversion (string value)
#image_conversion_dir = $state_path/conversion
+{%- if volume.image_conversion_dir is defined %}
+image_conversion_dir = {{ volume.image_conversion_dir }}
+{%- endif %}
# message minimum life in seconds. (integer value)
#message_ttl = 2592000
diff --git a/cinder/files/rocky/cinder.conf.volume.Debian b/cinder/files/rocky/cinder.conf.volume.Debian
index 11242fe..a60923d 100644
--- a/cinder/files/rocky/cinder.conf.volume.Debian
+++ b/cinder/files/rocky/cinder.conf.volume.Debian
@@ -501,6 +501,9 @@
# Directory used for temporary storage during image conversion (string value)
#image_conversion_dir = $state_path/conversion
+{%- if volume.image_conversion_dir is defined %}
+image_conversion_dir = {{ volume.image_conversion_dir }}
+{%- endif %}
# message minimum life in seconds. (integer value)
#message_ttl = 2592000
diff --git a/cinder/volume.sls b/cinder/volume.sls
index cc221e6..433171a 100644
--- a/cinder/volume.sls
+++ b/cinder/volume.sls
@@ -28,6 +28,19 @@
- require_in:
- service: cinder_volume_services
+{%- if volume.image_conversion_dir is defined %}
+{{ volume.image_conversion_dir }}:
+ file.directory:
+ - mode: 755
+ - user: cinder
+ - group: cinder
+ - makedirs: true
+ - require:
+ - pkg: cinder_volume_packages
+ - require_in:
+ - service: cinder_volume_services
+{%- endif %}
+
{%- if volume.message_queue.get('ssl',{}).get('enabled', False) %}
rabbitmq_ca_cinder_volume:
{%- if volume.message_queue.ssl.cacert is defined %}
diff --git a/tests/pillar/volume_single.sls b/tests/pillar/volume_single.sls
index e81a2cd..c1fd5ec 100644
--- a/tests/pillar/volume_single.sls
+++ b/tests/pillar/volume_single.sls
@@ -4,6 +4,7 @@
version: liberty
scheduler_default_filters: AvailabilityZoneFilter
default_volume_type: defaultVolumeType
+ image_conversion_dir: /var/tmp/cinder/conversion
backend:
lvm:
host: 127.0.0.1