Browse code

Merge "Set default API_WORKERS"

Jenkins authored on 2014/09/20 12:46:26
Showing 5 changed files
... ...
@@ -154,7 +154,7 @@ function configure_ceilometer {
154 154
 
155 155
     if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] ; then
156 156
         iniset $CEILOMETER_CONF database connection `database_connection_url ceilometer`
157
-        iniset $CEILOMETER_CONF DEFAULT collector_workers $(( ($(nproc) + 1) / 2 ))
157
+        iniset $CEILOMETER_CONF DEFAULT collector_workers $API_WORKERS
158 158
     else
159 159
         iniset $CEILOMETER_CONF database connection mongodb://localhost:27017/ceilometer
160 160
         configure_mongodb
... ...
@@ -307,9 +307,7 @@ function configure_cinder {
307 307
     iniset $CINDER_CONF keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
308 308
     iniset $CINDER_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
309 309
 
310
-    if [ -n "$API_WORKERS" ]; then
311
-        iniset $CINDER_CONF DEFAULT osapi_volume_workers "$API_WORKERS"
312
-    fi
310
+    iniset $CINDER_CONF DEFAULT osapi_volume_workers "$API_WORKERS"
313 311
 }
314 312
 
315 313
 # create_cinder_accounts() - Set up common required cinder accounts
... ...
@@ -138,9 +138,7 @@ function configure_glance {
138 138
     # sections.
139 139
     iniset $GLANCE_API_CONF glance_store filesystem_store_datadir $GLANCE_IMAGE_DIR/
140 140
 
141
-    if [ -n "$API_WORKERS" ]; then
142
-        iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
143
-    fi
141
+    iniset $GLANCE_API_CONF DEFAULT workers "$API_WORKERS"
144 142
 
145 143
     # Store the images in swift if enabled.
146 144
     if is_service_enabled s-proxy; then
... ...
@@ -519,11 +519,9 @@ function create_nova_conf {
519 519
     iniset_rpc_backend nova $NOVA_CONF DEFAULT
520 520
     iniset $NOVA_CONF glance api_servers "$GLANCE_HOSTPORT"
521 521
 
522
-    if [ -n "$API_WORKERS" ]; then
523
-        iniset $NOVA_CONF DEFAULT osci_compute_workers "$API_WORKERS"
524
-        iniset $NOVA_CONF DEFAULT ec2_workers "$API_WORKERS"
525
-        iniset $NOVA_CONF DEFAULT metadata_workers "$API_WORKERS"
526
-    fi
522
+    iniset $NOVA_CONF DEFAULT osci_compute_workers "$API_WORKERS"
523
+    iniset $NOVA_CONF DEFAULT ec2_workers "$API_WORKERS"
524
+    iniset $NOVA_CONF DEFAULT metadata_workers "$API_WORKERS"
527 525
 }
528 526
 
529 527
 function init_nova_cells {
... ...
@@ -511,10 +511,11 @@ UNDO_REQUIREMENTS=${UNDO_REQUIREMENTS:-True}
511 511
 # Allow the use of an alternate protocol (such as https) for service endpoints
512 512
 SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http}
513 513
 
514
-# Sets the maximum number of workers for various services and can restrict
514
+# Sets the maximum number of workers for most services to reduce
515 515
 # the memory used where there are a large number of CPUs present
516 516
 # (the default number of workers for many services is the number of CPUs)
517
-# API_WORKERS=4
517
+# Also sets the minimum number of workers to 2.
518
+API_WORKERS=${API_WORKERS:=$(( ($(nproc)/2)<2 ? 2 : ($(nproc)/2) ))}
518 519
 
519 520
 # Local variables:
520 521
 # mode: shell-script