Browse code

Create mechanism for enabling placement-client on subnodes

When doing multinode devstack we need a way to specify that we've
enabled for the placement service. We use a pseudo service of
placement-client for this.

Change-Id: I04a655fbc58913b3d607400a7f677be299499142

Sean Dague authored on 2016/12/16 06:32:08
Showing 2 changed files
... ...
@@ -55,7 +55,7 @@ PLACEMENT_SERVICE_PORT=${PLACEMENT_SERVICE_PORT:-8778}
55 55
 # Test if any placement services are enabled
56 56
 # is_placement_enabled
57 57
 function is_placement_enabled {
58
-    [[ ,${ENABLED_SERVICES} =~ ,"placement-" ]] && return 0
58
+    [[ ,${ENABLED_SERVICES} =~ ,"placement-api" ]] && return 0
59 59
     return 1
60 60
 }
61 61
 
... ...
@@ -101,12 +101,7 @@ function _config_placement_apache_wsgi {
101 101
     " -i $placement_api_apache_conf
102 102
 }
103 103
 
104
-# configure_placement() - Set config files, create data dirs, etc
105
-function configure_placement {
106
-    if [ "$PLACEMENT_DB_ENABLED" != False ]; then
107
-        iniset $PLACEMENT_CONF placement_database connection `database_connection_url placement`
108
-    fi
109
-
104
+function configure_placement_nova_compute {
110 105
     iniset $NOVA_CONF placement auth_type "password"
111 106
     iniset $NOVA_CONF placement auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v3"
112 107
     iniset $NOVA_CONF placement username placement
... ...
@@ -121,7 +116,13 @@ function configure_placement {
121 121
     # established by the nova api. This avoids, for the time, being,
122 122
     # creating redundant configuration items that are just used for
123 123
     # testing.
124
+}
124 125
 
126
+# configure_placement() - Set config files, create data dirs, etc
127
+function configure_placement {
128
+    if [ "$PLACEMENT_DB_ENABLED" != False ]; then
129
+        iniset $PLACEMENT_CONF placement_database connection `database_connection_url placement`
130
+    fi
125 131
     _config_placement_apache_wsgi
126 132
 }
127 133
 
... ...
@@ -869,6 +869,16 @@ if is_service_enabled placement; then
869 869
     configure_placement
870 870
 fi
871 871
 
872
+# create a placement-client fake service to know we need to configure
873
+# placement connectivity. We configure the placement service for nova
874
+# if placement-api or placement-client is active, and n-cpu on the
875
+# same box.
876
+if is_service_enabled placement placement-client; then
877
+    if is_service_enabled n-cpu; then
878
+        configure_placement_nova_compute
879
+    fi
880
+fi
881
+
872 882
 if is_service_enabled horizon; then
873 883
     # django openstack_auth
874 884
     install_django_openstack_auth