Enable coordination for cinder service
Supported backend: mysql
PROD-36497
Change-Id: If2965382834f517a42de10dbf773e90f2c9ee3b0
diff --git a/README.rst b/README.rst
index ac0210e..c0330db 100644
--- a/README.rst
+++ b/README.rst
@@ -1054,6 +1054,19 @@
volume_name_template: 'custom-volume-name-%s'
+Enable coordination for cinder service:
+=======================================
+In order to enable coordination two options need to be set: enabled and backend
+
+.. code-block:: yaml
+
+ cinder:
+ controller:
+ coordination:
+ enabled: true
+ backend: mysql
+
+
Upgrades
========
diff --git a/cinder/files/queens/cinder.conf.controller.Debian b/cinder/files/queens/cinder.conf.controller.Debian
index 0714687..f377333 100644
--- a/cinder/files/queens/cinder.conf.controller.Debian
+++ b/cinder/files/queens/cinder.conf.controller.Debian
@@ -3161,7 +3161,16 @@
# The backend URL to use for distributed coordination. (string value)
#backend_url = file://$state_path
-
+{%- if controller.get('coordination', {}).get('enabled', False) %}
+ {%- if controller.coordination.get('backend', '') == 'mysql' %}
+ {%- set connection_x509_ssl_option = '' %}
+ {%- set _data = controller.database %}
+ {%- if _data.get('x509',{}).get('enabled',False) %}
+ {%- set connection_x509_ssl_option = '&ssl_ca=' ~ _data.x509.get('ca_file') ~ '&ssl_cert=' ~ _data.x509.get('cert_file') ~ '&ssl_key=' ~ _data.x509.get('key_file') %}
+ {%- endif %}
+backend_url = mysql://{{ _data.user }}:{{ _data.password }}@{{ _data.host }}:{{ _data.get('port', '3306') }}/{{ _data.name }}?charset=utf8{{ connection_x509_ssl_option|string }}
+ {%- endif %}
+{%- endif %}
[fc-zone-manager]