FIX access database failed 67/28767/4
authorliyuenan <liyuenan@huawei.com>
Thu, 16 Feb 2017 01:08:52 +0000 (09:08 +0800)
committerliyuenan <liyuenan@huawei.com>
Mon, 20 Feb 2017 05:48:54 +0000 (13:48 +0800)
JIRA: COMPASS-521

Use a dynamic value to set number of workers for Openstack API
service when the number of cpu more than 4.

Change-Id: Ic6482cfad9b5eba8fad9e56ea1a33f65e8c71001
Signed-off-by: liyuenan <liyuenan@huawei.com>
deploy/adapters/ansible/openstack/templates/nova.conf
deploy/adapters/ansible/roles/cinder-controller/templates/cinder.conf
deploy/adapters/ansible/roles/heat/templates/heat.j2

index b648b03..3cd2c03 100644 (file)
@@ -3,6 +3,11 @@
 {% set _ = memcached_servers.append('%s:11211'% host) %}
 {% endfor %}
 {% set memcached_servers = memcached_servers|join(',') %}
+{% if ansible_processor_vcpus > 10 %}
+{%  set api_workers = ansible_processor_vcpus // 10 %}
+{% else %}
+{%  set api_workers = 1 %}
+{% endif %}
 
 [DEFAULT]
 dhcpbridge_flagfile=/etc/nova/nova.conf
@@ -38,11 +43,8 @@ notify_on_state_change = vm_and_task_state
 notification_driver = nova.openstack.common.notifier.rpc_notifier
 notification_driver = ceilometer.compute.nova_notifier
 memcached_servers = {{ memcached_servers }}
-
-{% if ansible_processor_vcpus > 20 %}
-osapi_compute_workers = 20
-metadata_workers = 20
-{% endif %}
+osapi_compute_workers = {{ api_workers }}
+metadata_workers = {{ api_workers }}
 
 [database]
 # The SQLAlchemy connection string used to connect to the database
index 05a1c8f..8b03565 100644 (file)
@@ -3,6 +3,11 @@
 {% set _ = memcached_servers.append('%s:11211'% host) %}
 {% endfor %}
 {% set memcached_servers = memcached_servers|join(',') %}
+{% if ansible_processor_vcpus > 5 %}
+{%  set api_workers = ansible_processor_vcpus // 5 %}
+{% else %}
+{%  set api_workers = 1 %}
+{% endif %}
 
 [DEFAULT]
 rootwrap_config = /etc/cinder/rootwrap.conf
@@ -35,9 +40,7 @@ quota_driver = cinder.quota.DbQuotaDriver
 
 osapi_volume_listen = {{ storage_controller_host }}
 osapi_volume_listen_port = 8776
-{% if ansible_processor_vcpus > 30 %}
-osapi_volume_workers = 30
-{% endif %}
+osapi_volume_workers = {{ api_workers }}
 
 db_backend = sqlalchemy
 volume_name_template = volume-%s
index a785610..d73bd70 100644 (file)
@@ -3,6 +3,11 @@
 {% set _ = memcached_servers.append('%s:11211'% host) %}
 {% endfor %}
 {% set memcached_servers = memcached_servers|join(',') %}
+{% if ansible_processor_vcpus > 5 %}
+{%  set api_workers = ansible_processor_vcpus // 5 %}
+{% else %}
+{%  set api_workers = 1 %}
+{% endif %}
 
 [DEFAULT]
 heat_metadata_server_url = http://{{ internal_vip.ip }}:8000
@@ -12,14 +17,10 @@ log_dir = /var/log/heat
 stack_domain_admin = heat_domain_admin
 stack_domain_admin_password = {{ HEAT_PASS }}
 stack_user_domain_name = heat
-{% if ansible_processor_vcpus > 30 %}
-num_engine_workers = 30
-{% endif %}
+num_engine_workers = {{ api_workers}}
 
 [heat_api]
-{% if ansible_processor_vcpus > 30 %}
-workers = 30
-{% endif %}
+workers = {{ api_workers }}
 
 [database]
 connection = mysql://heat:{{ HEAT_DBPASS }}@{{ db_host }}/heat