Unhardcode 'image_conversion_dir' option for controllers
Option 'image_conversion_dir' is directory used for temporary storage
during image conversion.
Change-Id: I9b72eb3f14808c68b6cff568f52e27f79d9c9cf8
Related-Prod: PROD-29437 (PROD:29437)
diff --git a/README.rst b/README.rst
index 2da3342..35a5188 100644
--- a/README.rst
+++ b/README.rst
@@ -30,6 +30,7 @@
default_volume_type: 7k2SaS
enable_force_upload: true
availability_zone_fallback: True
+ image_conversion_dir: /var/tmp/cinder/conversion
database:
engine: mysql
host: 127.0.0.1
@@ -260,6 +261,8 @@
.. code-block:: yaml
cinder:
+ controller:
+ image_conversion_dir: /var/tmp/cinder/conversion
volume:
image_conversion_dir: /var/tmp/cinder/conversion
...
diff --git a/cinder/controller.sls b/cinder/controller.sls
index e50a1d6..31cb53c 100644
--- a/cinder/controller.sls
+++ b/cinder/controller.sls
@@ -25,6 +25,19 @@
- sls: cinder._ssl.rabbitmq
- sls: cinder.db.offline_sync
+{%- if controller.image_conversion_dir is defined %}
+{{ controller.image_conversion_dir }}:
+ file.directory:
+ - mode: 755
+ - user: cinder
+ - group: cinder
+ - makedirs: true
+ - require:
+ - pkg: cinder_controller_packages
+ - require_in:
+ - service: cinder_controller_packages
+{%- endif %}
+
/etc/cinder/cinder.conf:
file.managed:
- source: salt://cinder/files/{{ controller.version }}/cinder.conf.controller.{{ grains.os_family }}
diff --git a/cinder/files/mitaka/cinder.conf.controller.Debian b/cinder/files/mitaka/cinder.conf.controller.Debian
index c270fd1..ac804f1 100644
--- a/cinder/files/mitaka/cinder.conf.controller.Debian
+++ b/cinder/files/mitaka/cinder.conf.controller.Debian
@@ -23,6 +23,10 @@
state_path = /var/lib/cinder
+{%- if controller.image_conversion_dir is defined %}
+image_conversion_dir = {{ controller.image_conversion_dir }}
+{%- endif %}
+
use_syslog=False
glance_num_retries=0
diff --git a/cinder/files/newton/cinder.conf.controller.Debian b/cinder/files/newton/cinder.conf.controller.Debian
index fdba747..6f12b2b 100644
--- a/cinder/files/newton/cinder.conf.controller.Debian
+++ b/cinder/files/newton/cinder.conf.controller.Debian
@@ -16,6 +16,10 @@
state_path = /var/lib/cinder
+{%- if controller.image_conversion_dir is defined %}
+image_conversion_dir = {{ controller.image_conversion_dir }}
+{%- endif %}
+
use_syslog=False
glance_num_retries=0
diff --git a/cinder/files/ocata/cinder.conf.controller.Debian b/cinder/files/ocata/cinder.conf.controller.Debian
index 39d4ed5..0de1b9c 100644
--- a/cinder/files/ocata/cinder.conf.controller.Debian
+++ b/cinder/files/ocata/cinder.conf.controller.Debian
@@ -16,6 +16,10 @@
state_path = /var/lib/cinder
+{%- if controller.image_conversion_dir is defined %}
+image_conversion_dir = {{ controller.image_conversion_dir }}
+{%- endif %}
+
use_syslog=False
glance_num_retries=0
diff --git a/cinder/files/pike/cinder.conf.controller.Debian b/cinder/files/pike/cinder.conf.controller.Debian
index 4689c61..15e1c44 100644
--- a/cinder/files/pike/cinder.conf.controller.Debian
+++ b/cinder/files/pike/cinder.conf.controller.Debian
@@ -27,6 +27,10 @@
state_path = /var/lib/cinder
+{%- if controller.image_conversion_dir is defined %}
+image_conversion_dir = {{ controller.image_conversion_dir }}
+{%- endif %}
+
use_syslog=False
glance_num_retries=0
diff --git a/cinder/files/queens/cinder.conf.controller.Debian b/cinder/files/queens/cinder.conf.controller.Debian
index 9cb21bd..ccc7e05 100644
--- a/cinder/files/queens/cinder.conf.controller.Debian
+++ b/cinder/files/queens/cinder.conf.controller.Debian
@@ -495,6 +495,9 @@
# Directory used for temporary storage during image conversion (string value)
#image_conversion_dir = $state_path/conversion
+{%- if controller.image_conversion_dir is defined %}
+image_conversion_dir = {{ controller.image_conversion_dir }}
+{%- endif %}
# message minimum life in seconds. (integer value)
#message_ttl = 2592000
diff --git a/cinder/files/rocky/cinder.conf.controller.Debian b/cinder/files/rocky/cinder.conf.controller.Debian
index e94b3fa..8388c10 100644
--- a/cinder/files/rocky/cinder.conf.controller.Debian
+++ b/cinder/files/rocky/cinder.conf.controller.Debian
@@ -503,6 +503,9 @@
# Directory used for temporary storage during image conversion (string value)
#image_conversion_dir = $state_path/conversion
+{%- if controller.image_conversion_dir is defined %}
+image_conversion_dir = {{ controller.image_conversion_dir }}
+{%- endif %}
# message minimum life in seconds. (integer value)
#message_ttl = 2592000
diff --git a/tests/pillar/control_cluster.sls b/tests/pillar/control_cluster.sls
index e1e6dc5..d17c6eb 100644
--- a/tests/pillar/control_cluster.sls
+++ b/tests/pillar/control_cluster.sls
@@ -2,6 +2,7 @@
controller:
enabled: true
version: liberty
+ image_conversion_dir: /var/tmp/cinder/conversion
osapi:
host: 127.0.0.1
database:
diff --git a/tests/pillar/control_single.sls b/tests/pillar/control_single.sls
index 9f6d66d..61b7386 100644
--- a/tests/pillar/control_single.sls
+++ b/tests/pillar/control_single.sls
@@ -3,6 +3,7 @@
enabled: true
version: liberty
scheduler_default_filters: AvailabilityZoneFilter
+ image_conversion_dir: /var/tmp/cinder/conversion
osapi:
host: 127.0.0.1
database: