Browse code

Configure nova_cell1.conf to use placement for reschedules

Nova now calculates alternate hosts in the scheduler and
sends those to the cell for reschedules in case a build on
a given compute node fails.

The cell conductor needs to claim resources against the
alternate hosts in Placement during a reschedule, therefore
it needs to be configured to talk to the placement service.

Part of blueprint return-alternate-hosts

Change-Id: Ie599968d9e7537e551fe6d9deb63a91b256b1e11

Matt Riedemann authored on 2017/12/23 01:39:29
Showing 2 changed files
... ...
@@ -600,6 +600,12 @@ function create_nova_conf {
600 600
             else
601 601
                 rpc_backend_add_vhost $vhost
602 602
                 iniset_rpc_backend nova $conf DEFAULT $vhost
603
+                # When running in superconductor mode, the cell conductor
604
+                # must be configured to talk to the placement service for
605
+                # reschedules to work.
606
+                if is_service_enabled placement placement-client; then
607
+                    configure_placement_nova_compute $conf
608
+                fi
603 609
             fi
604 610
             # Format logging
605 611
             setup_logging $conf
... ...
@@ -103,14 +103,16 @@ function _config_placement_apache_wsgi {
103 103
 }
104 104
 
105 105
 function configure_placement_nova_compute {
106
-    iniset $NOVA_CONF placement auth_type "password"
107
-    iniset $NOVA_CONF placement auth_url "$KEYSTONE_SERVICE_URI"
108
-    iniset $NOVA_CONF placement username placement
109
-    iniset $NOVA_CONF placement password "$SERVICE_PASSWORD"
110
-    iniset $NOVA_CONF placement user_domain_name "$SERVICE_DOMAIN_NAME"
111
-    iniset $NOVA_CONF placement project_name "$SERVICE_TENANT_NAME"
112
-    iniset $NOVA_CONF placement project_domain_name "$SERVICE_DOMAIN_NAME"
113
-    iniset $NOVA_CONF placement os_region_name "$REGION_NAME"
106
+    # Use the provided config file path or default to $NOVA_CONF.
107
+    local conf=${1:-$NOVA_CONF}
108
+    iniset $conf placement auth_type "password"
109
+    iniset $conf placement auth_url "$KEYSTONE_SERVICE_URI"
110
+    iniset $conf placement username placement
111
+    iniset $conf placement password "$SERVICE_PASSWORD"
112
+    iniset $conf placement user_domain_name "$SERVICE_DOMAIN_NAME"
113
+    iniset $conf placement project_name "$SERVICE_TENANT_NAME"
114
+    iniset $conf placement project_domain_name "$SERVICE_DOMAIN_NAME"
115
+    iniset $conf placement os_region_name "$REGION_NAME"
114 116
     # TODO(cdent): auth_strategy, which is common to see in these
115 117
     # blocks is not currently used here. For the time being the
116 118
     # placement api uses the auth_strategy configuration setting