Add cinder database connection parameters
[database]
idle_timeout
max_pool_size
max_retries
max_overflow
Change-Id: I6fac03a5616678ae99a1ed95fd40e34b47685ae8
Related-prod: PROD-26294
diff --git a/README.rst b/README.rst
index 824019f..a3a507c 100644
--- a/README.rst
+++ b/README.rst
@@ -844,6 +844,7 @@
secret_key: secret
Cinder service supports to define iscsi_helper for lvm backend.
+=======
.. code-block:: yaml
@@ -870,6 +871,30 @@
controller:
...
scheduler_default_filters: (filters)
+=======
+
+* Cinder database connection setup:
+
+.. code-block:: yaml
+
+ cinder:
+ controller:
+ enabled: True
+ ...
+ database:
+ idle_timeout: 280
+ max_pool_size: 30
+ max_retries: '-1'
+ max_overflow: 40
+ volume:
+ enabled: True
+ ...
+ database:
+ idle_timeout: 280
+ max_pool_size: 30
+ max_retries: '-1'
+ max_overflow: 40
+
Upgrades
========
diff --git a/cinder/files/ocata/cinder.conf.controller.Debian b/cinder/files/ocata/cinder.conf.controller.Debian
index 3e48653..8e44564 100644
--- a/cinder/files/ocata/cinder.conf.controller.Debian
+++ b/cinder/files/ocata/cinder.conf.controller.Debian
@@ -202,10 +202,10 @@
{%- endif %}
[database]
-idle_timeout=3600
-max_pool_size=30
-max_retries=-1
-max_overflow=40
+idle_timeout = {{ controller.database.get('idle_timeout', 280) }}
+max_pool_size = {{ controller.database.get('max_pool_size', 30) }}
+max_retries = {{ controller.database.get('max_retries', '-1') }}
+max_overflow = {{ controller.database.get('max_overflow', 40) }}
connection = {{ controller.database.engine }}+pymysql://{{ controller.database.user }}:{{ controller.database.password }}@{{ controller.database.host }}/{{ controller.database.name }}?charset=utf8{%- if controller.database.get('ssl',{}).get('enabled',False) %}&ssl_ca={{ controller.database.ssl.get('cacert_file', controller.cacert_file) }}{% endif %}
{%- if controller.backend is defined %}
diff --git a/cinder/files/ocata/cinder.conf.volume.Debian b/cinder/files/ocata/cinder.conf.volume.Debian
index 7a070ee..a52c22a 100644
--- a/cinder/files/ocata/cinder.conf.volume.Debian
+++ b/cinder/files/ocata/cinder.conf.volume.Debian
@@ -185,10 +185,10 @@
{%- endif %}
[database]
-idle_timeout=3600
-max_pool_size=30
-max_retries=-1
-max_overflow=40
+idle_timeout = {{ volume.database.get('idle_timeout', 280) }}
+max_pool_size = {{ volume.database.get('max_pool_size', 30) }}
+max_retries = {{ volume.database.get('max_retries', '-1') }}
+max_overflow = {{ volume.database.get('max_overflow', 40) }}
connection = {{ volume.database.engine }}+pymysql://{{ volume.database.user }}:{{ volume.database.password }}@{{ volume.database.host }}/{{ volume.database.name }}?charset=utf8{%- if volume.database.get('ssl',{}).get('enabled',False) %}&ssl_ca={{ volume.database.ssl.get('cacert_file', volume.cacert_file) }}{% endif %}
{%- if volume.backend is defined %}
diff --git a/cinder/files/pike/cinder.conf.controller.Debian b/cinder/files/pike/cinder.conf.controller.Debian
index 5c3ffde..7a1d2f4 100644
--- a/cinder/files/pike/cinder.conf.controller.Debian
+++ b/cinder/files/pike/cinder.conf.controller.Debian
@@ -228,10 +228,10 @@
{%- endif %}
[database]
-idle_timeout=3600
-max_pool_size=30
-max_retries=-1
-max_overflow=40
+idle_timeout = {{ controller.database.get('idle_timeout', 280) }}
+max_pool_size = {{ controller.database.get('max_pool_size', 30) }}
+max_retries = {{ controller.database.get('max_retries', '-1') }}
+max_overflow = {{ controller.database.get('max_overflow', 40) }}
connection = {{ controller.database.engine }}+pymysql://{{ controller.database.user }}:{{ controller.database.password }}@{{ controller.database.host }}/{{ controller.database.name }}?charset=utf8{{ connection_x509_ssl_option|string }}
{%- if controller.backend is defined %}
diff --git a/cinder/files/pike/cinder.conf.volume.Debian b/cinder/files/pike/cinder.conf.volume.Debian
index 9fa86fa..48c138a 100644
--- a/cinder/files/pike/cinder.conf.volume.Debian
+++ b/cinder/files/pike/cinder.conf.volume.Debian
@@ -210,10 +210,10 @@
{%- endif %}
[database]
-idle_timeout=3600
-max_pool_size=30
-max_retries=-1
-max_overflow=40
+idle_timeout = {{ volume.database.get('idle_timeout', 280) }}
+max_pool_size = {{ volume.database.get('max_pool_size', 30) }}
+max_retries = {{ volume.database.get('max_retries', '-1') }}
+max_overflow = {{ volume.database.get('max_overflow', 40) }}
connection = {{ volume.database.engine }}+pymysql://{{ volume.database.user }}:{{ volume.database.password }}@{{ volume.database.host }}/{{ volume.database.name }}?charset=utf8{{ connection_x509_ssl_option|string }}
{%- if volume.backend is defined %}
diff --git a/tests/pillar/control_cluster.sls b/tests/pillar/control_cluster.sls
index 5851aaa..3c106dd 100644
--- a/tests/pillar/control_cluster.sls
+++ b/tests/pillar/control_cluster.sls
@@ -11,6 +11,10 @@
name: cinder
user: cinder
password: password
+ idle_timeout: 280
+ max_pool_size: 30
+ max_retries: '-1'
+ max_overflow: 40
identity:
engine: keystone
region: RegionOne
diff --git a/tests/pillar/volume_single.sls b/tests/pillar/volume_single.sls
index 086fbfd..cea5f55 100644
--- a/tests/pillar/volume_single.sls
+++ b/tests/pillar/volume_single.sls
@@ -21,6 +21,10 @@
name: cinder
user: cinder
password: password
+ idle_timeout: 280
+ max_pool_size: 30
+ max_retries: '-1'
+ max_overflow: 40
identity:
engine: keystone
host: 127.0.0.1