Add configuration options for my.cnf

The following configuration options added:

    galera_innodb_read_io_threads: 8
    galera_innodb_write_io_threads: 8
    galera_wsrep_slave_threads: 8
    galera_xtrabackup_parallel: 4
    galera_error_log_enabled: false

Change-Id: Id1185c3a38669c37dc88806b4e9955522629ce1c
Related-Bug: https://mirantis.jira.com/browse/PROD-16528
diff --git a/README.rst b/README.rst
index 872aca0..9d59c82 100644
--- a/README.rst
+++ b/README.rst
@@ -139,6 +139,11 @@
 
 - **galera_innodb_buffer_pool_size** - the default value is 3138M
 - **galera_max_connections** - the default value is 20000
+- **galera_innodb_read_io_threads** - the default value is 8
+- **galera_innodb_write_io_threads** - the default value is 8
+- **galera_wsrep_slave_threads** - the default value is 8
+- **galera_xtrabackup_parallel** - the default value is 4
+- **galera_error_log_enabled** - the default value is 'false'
 
 Usage:
 .. code-block:: yaml
@@ -146,6 +151,11 @@
     _param:
       galera_innodb_buffer_pool_size: 1024M
       galera_max_connections: 200
+      galera_innodb_read_io_threads: 16
+      galera_innodb_write_io_threads: 16
+      galera_wsrep_slave_threads: 8
+      galera_xtrabackup_parallel: 2
+      galera_error_log_enabled: true
 
 
 Usage
diff --git a/galera/files/my.cnf b/galera/files/my.cnf
index 049d6d6..cb9687e 100644
--- a/galera/files/my.cnf
+++ b/galera/files/my.cnf
@@ -31,7 +31,11 @@
 init-connect='SET NAMES utf8'
 character-set-server=utf8
 default-storage-engine=innodb
-#log_error=/var/log/mysql/error.log
+{%- if service.get('error_log_enabled', False) %}
+log_error = /var/log/mysql/error.log
+{%- else %}
+#log_error = /var/log/mysql/error.log
+{%- endif %}
 skip-external-locking
 skip-name-resolve
 socket = /var/run/mysqld/mysqld.sock
@@ -49,8 +53,8 @@
 innodb_file_per_table=1
 innodb_buffer_pool_size={{ service.innodb_buffer_pool_size }}
 innodb_log_file_size=627M
-innodb_read_io_threads=8
-innodb_write_io_threads=8
+innodb_read_io_threads={{ service.get('innodb_read_io_threads', 8) }}
+innodb_write_io_threads={{ service.get('innodb_write_io_threads', 8) }}
 innodb_io_capacity=500
 innodb_flush_log_at_trx_commit=2
 innodb_flush_method=O_DIRECT
@@ -61,7 +65,7 @@
 wsrep_provider={{ service.wsrep_provider }}
 wsrep_cluster_name="openstack"
 
-wsrep_slave_threads=8
+wsrep_slave_threads={{ service.get('wsrep_slave_threads', 8) }}
 wsrep_sst_method=xtrabackup-v2
 wsrep_sst_auth={{ service.admin.user }}:{{ service.admin.password }}
 wsrep_node_address={{ service.bind.address }}
@@ -76,7 +80,7 @@
 {% endif %}
 
 [xtrabackup]
-parallel=4
+parallel={{ service.get('xtrabackup_parallel', 4) }}
 
 [sst]
 streamfmt=xbstream
diff --git a/galera/files/my.cnf.container b/galera/files/my.cnf.container
index 0a2645e..2c5f7f1 100644
--- a/galera/files/my.cnf.container
+++ b/galera/files/my.cnf.container
@@ -16,8 +16,8 @@
 innodb_flush_log_at_trx_commit=2
 innodb_file_per_table=1
 innodb_data_file_path = ibdata1:100M:autoextend
-innodb_read_io_threads=8
-innodb_write_io_threads=8
+innodb_read_io_threads={{ service.get('innodb_read_io_threads', 8) }}
+innodb_write_io_threads={{ service.get('innodb_write_io_threads', 8) }}
 innodb_io_capacity=500
 innodb_doublewrite=0
 innodb_log_file_size=627M
@@ -59,7 +59,7 @@
 wsrep_provider_options="gcache.size=512M; gmcast.segment=0"
 wsrep_cluster_name="my_wsrep_cluster"
 wsrep_cluster_address="gcomm://{% for member in service.members %}{{ member.host}}{% if not loop.last %},{% endif %}{% endfor %}"
-wsrep_slave_threads=8
+wsrep_slave_threads={{ service.get('wsrep_slave_threads', 8) }}
 wsrep_certify_nonPK=1
 wsrep_max_ws_rows=131072
 wsrep_max_ws_size=1073741824
@@ -77,6 +77,6 @@
 socket=/var/lib/mysql/mysql.sock
 
 [xtrabackup]
-parallel=4
+parallel={{ service.get('xtrabackup_parallel', 4) }}
 user={{ service.admin.user }}
 password={{ service.admin.password }}
diff --git a/galera/files/my.cnf.init b/galera/files/my.cnf.init
index a5ea26d..b05584a 100644
--- a/galera/files/my.cnf.init
+++ b/galera/files/my.cnf.init
@@ -34,12 +34,18 @@
 query_cache_size=0
 query_cache_type=0
 
+{%- if service.get('error_log_enabled', False) %}
+log_error = /var/log/mysql/error.log
+{%- else %}
+#log_error = /var/log/mysql/error.log
+{%- endif %}
+
 innodb_file_format=Barracuda
 innodb_file_per_table=1
 innodb_buffer_pool_size={{ service.innodb_buffer_pool_size }}
 innodb_log_file_size=627M
-innodb_read_io_threads=8
-innodb_write_io_threads=8
+innodb_read_io_threads={{ service.get('innodb_read_io_threads', 8) }}
+innodb_write_io_threads={{ service.get('innodb_write_io_threads', 8) }}
 innodb_io_capacity=500
 innodb_flush_log_at_trx_commit=2
 innodb_flush_method=O_DIRECT
@@ -51,7 +57,7 @@
 wsrep_provider={{ service.wsrep_provider }}
 wsrep_cluster_name="openstack"
 
-wsrep_slave_threads=8
+wsrep_slave_threads={{ service.get('wsrep_slave_threads', 8) }}
 wsrep_sst_method=xtrabackup-v2
 wsrep_sst_auth={{ service.admin.user }}:{{ service.admin.password }}
 wsrep_node_address={{ service.bind.address }}
@@ -66,7 +72,7 @@
 {% endif %}
 
 [xtrabackup]
-parallel=4
+parallel={{ service.get('xtrabackup_parallel', 4) }}
 
 [sst]
 streamfmt=xbstream
diff --git a/galera/files/my.cnf.pre b/galera/files/my.cnf.pre
index 9bc6c17..817efa1 100644
--- a/galera/files/my.cnf.pre
+++ b/galera/files/my.cnf.pre
@@ -23,7 +23,7 @@
 myisam-recover         = BACKUP
 query_cache_limit	= 1M
 query_cache_size        = 16M
-#log_error = /var/log/mysql/error.log
+log_error = /var/log/mysql/error.log
 expire_logs_days	= 10
 max_binlog_size         = 100M
 [mysqldump]
diff --git a/metadata/service/master/cluster.yml b/metadata/service/master/cluster.yml
index 05c4c57..d48ffcb 100644
--- a/metadata/service/master/cluster.yml
+++ b/metadata/service/master/cluster.yml
@@ -10,6 +10,11 @@
     galera_server_admin_user: root
     galera_max_connections: 20000
     galera_innodb_buffer_pool_size: 3138M
+    galera_innodb_read_io_threads: 8
+    galera_innodb_write_io_threads: 8
+    galera_wsrep_slave_threads: 8
+    galera_xtrabackup_parallel: 4
+    galera_error_log_enabled: false
   galera:
     master:
       enabled: true
@@ -30,6 +35,11 @@
         port: 4567
       max_connections: ${_param:galera_max_connections}
       innodb_buffer_pool_size: ${_param:galera_innodb_buffer_pool_size}
+      innodb_read_io_threads: ${_param:galera_innodb_read_io_threads}
+      innodb_write_io_threads: ${_param:galera_innodb_write_io_threads}
+      wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
+      xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
+      error_log_enabled: ${_param:galera_error_log_enabled}
   mysql:
     server:
       users:
diff --git a/metadata/service/master/container.yml b/metadata/service/master/container.yml
index c80beef..2850f77 100644
--- a/metadata/service/master/container.yml
+++ b/metadata/service/master/container.yml
@@ -5,6 +5,11 @@
     galera_server_admin_user: root
     galera_max_connections: 20000
     galera_innodb_buffer_pool_size: 3138M
+    galera_innodb_read_io_threads: 8
+    galera_innodb_write_io_threads: 8
+    galera_wsrep_slave_threads: 8
+    galera_xtrabackup_parallel: 4
+    galera_error_log_enabled: false
   kubernetes:
     control:
       configmap:
@@ -32,6 +37,11 @@
                   port: 4567
                 max_connections: ${_param:galera_max_connections}
                 innodb_buffer_pool_size: ${_param:galera_innodb_buffer_pool_size}
+                innodb_read_io_threads: ${_param:galera_innodb_read_io_threads}
+                innodb_write_io_threads: ${_param:galera_innodb_write_io_threads}
+                wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
+                xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
+                error_log_enabled: ${_param:galera_error_log_enabled}
             mysql:
               server:
                 users:
diff --git a/metadata/service/slave/cluster.yml b/metadata/service/slave/cluster.yml
index de05623..f1430a5 100644
--- a/metadata/service/slave/cluster.yml
+++ b/metadata/service/slave/cluster.yml
@@ -10,6 +10,11 @@
     galera_server_admin_user: root
     galera_max_connections: 20000
     galera_innodb_buffer_pool_size: 3138M
+    galera_innodb_read_io_threads: 8
+    galera_innodb_write_io_threads: 8
+    galera_wsrep_slave_threads: 8
+    galera_xtrabackup_parallel: 4
+    galera_error_log_enabled: false
   galera:
     slave:
       enabled: true
@@ -30,6 +35,11 @@
         port: 4567
       max_connections: ${_param:galera_max_connections}
       innodb_buffer_pool_size: ${_param:galera_innodb_buffer_pool_size}
+      innodb_read_io_threads: ${_param:galera_innodb_read_io_threads}
+      innodb_write_io_threads: ${_param:galera_innodb_write_io_threads}
+      wsrep_slave_threads: ${_param:galera_wsrep_slave_threads}
+      xtrabackup_parallel: ${_param:galera_xtrabackup_parallel}
+      error_log_enabled: ${_param:galera_error_log_enabled}
   mysql:
     server:
       users: