Browse code

remove db setting when no nova service need it

We shouldn't have the db connection laying around if services don't
need it.

Change-Id: I9290e80c499c0c4644094e3c0666fd0ab002a23c

Sean Dague authored on 2017/01/18 21:53:33
Showing 1 changed files
... ...
@@ -465,8 +465,6 @@ function create_nova_conf {
465 465
     else
466 466
         iniset $NOVA_CONF DEFAULT my_ip "$HOST_IP"
467 467
     fi
468
-    iniset $NOVA_CONF database connection `database_connection_url nova`
469
-    iniset $NOVA_CONF api_database connection `database_connection_url nova_api`
470 468
     iniset $NOVA_CONF DEFAULT instance_name_template "${INSTANCE_NAME_PREFIX}%08x"
471 469
     iniset $NOVA_CONF DEFAULT osapi_compute_listen "$NOVA_SERVICE_LISTEN_ADDRESS"
472 470
     iniset $NOVA_CONF DEFAULT metadata_listen "$NOVA_SERVICE_LISTEN_ADDRESS"
... ...
@@ -478,6 +476,14 @@ function create_nova_conf {
478 478
         iniset $NOVA_CONF DEFAULT bindir "/usr/bin"
479 479
     fi
480 480
 
481
+    # only setup database connections if there are services that
482
+    # require them running on the host. The ensures that n-cpu doesn't
483
+    # leak a need to use the db in a multinode scenario.
484
+    if is_service_enabled n-api n-cond n-sched; then
485
+        iniset $NOVA_CONF database connection `database_connection_url nova`
486
+        iniset $NOVA_CONF api_database connection `database_connection_url nova_api`
487
+    fi
488
+
481 489
     if is_service_enabled n-api; then
482 490
         if is_service_enabled n-api-meta; then
483 491
             # If running n-api-meta as a separate service