Browse code

RPC support for Quantum and devstack

The patch does the following:
1. RPC support
2. Enables agent and service to run on different hosts (ensures that the
file quantum.conf is copied)
3. Removes sudo for the quantum file copying
4. Uses iniset for plugin configuration

Change-Id: I0f84ec72b97f0dd8d74ac5683efa2cda5be28dd5

Gary Kotton authored on 2012/07/29 17:28:47
Showing 1 changed files
... ...
@@ -1158,15 +1158,15 @@ if is_service_enabled quantum; then
1158 1158
     elif [[ "$NOVA_USE_QUANTUM_API" = "v2" ]]; then
1159 1159
         iniset /$Q_PLUGIN_CONF_FILE AGENT target_v2_api True
1160 1160
     fi
1161
+    Q_CONF_FILE=/etc/quantum/quantum.conf
1162
+    cp $QUANTUM_DIR/etc/quantum.conf $Q_CONF_FILE
1161 1163
 fi
1162 1164
 
1163 1165
 # Quantum service (for controller node)
1164 1166
 if is_service_enabled q-svc; then
1165
-    Q_CONF_FILE=/etc/quantum/quantum.conf
1166 1167
     Q_API_PASTE_FILE=/etc/quantum/api-paste.ini
1167 1168
     Q_POLICY_FILE=/etc/quantum/policy.json
1168 1169
 
1169
-    cp $QUANTUM_DIR/etc/quantum.conf $Q_CONF_FILE
1170 1170
     cp $QUANTUM_DIR/etc/api-paste.ini $Q_API_PASTE_FILE
1171 1171
     cp $QUANTUM_DIR/etc/policy.json $Q_POLICY_FILE
1172 1172
 
... ...
@@ -1188,8 +1188,6 @@ if is_service_enabled q-svc; then
1188 1188
     iniset $Q_API_PASTE_FILE filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME
1189 1189
     iniset $Q_API_PASTE_FILE filter:authtoken admin_user $Q_ADMIN_USERNAME
1190 1190
     iniset $Q_API_PASTE_FILE filter:authtoken admin_password $SERVICE_PASSWORD
1191
-
1192
-    screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $Q_CONF_FILE --config-file /$Q_PLUGIN_CONF_FILE"
1193 1191
 fi
1194 1192
 
1195 1193
 # Quantum agent (for compute nodes)
... ...
@@ -1213,8 +1211,6 @@ if is_service_enabled q-agt; then
1213 1213
        sudo sed -i -e "s/^physical_interface = .*$/physical_interface = $QUANTUM_LB_PRIVATE_INTERFACE/g" /$Q_PLUGIN_CONF_FILE
1214 1214
        AGENT_BINARY="$QUANTUM_DIR/quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py"
1215 1215
     fi
1216
-    # Start up the quantum agent
1217
-    screen_it q-agt "sudo python $AGENT_BINARY --config-file $Q_CONF_FILE --config-file /$Q_PLUGIN_CONF_FILE"
1218 1216
 fi
1219 1217
 
1220 1218
 # Quantum DHCP
... ...
@@ -1223,9 +1219,7 @@ if is_service_enabled q-dhcp; then
1223 1223
 
1224 1224
     Q_DHCP_CONF_FILE=/etc/quantum/dhcp_agent.ini
1225 1225
 
1226
-    if [[ -e $QUANTUM_DIR/etc/dhcp_agent.ini ]]; then
1227
-      sudo cp $QUANTUM_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE
1228
-    fi
1226
+    cp $QUANTUM_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE
1229 1227
 
1230 1228
     # Set verbose
1231 1229
     iniset $Q_DHCP_CONF_FILE DEFAULT verbose True
... ...
@@ -1244,10 +1238,28 @@ if is_service_enabled q-dhcp; then
1244 1244
     elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
1245 1245
         iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver
1246 1246
     fi
1247
-    # Start up the quantum agent
1248
-    screen_it q-dhcp "sudo python $AGENT_DHCP_BINARY --config-file=$Q_DHCP_CONF_FILE"
1249 1247
 fi
1250 1248
 
1249
+# Quantum RPC support - must be updated prior to starting any of the services
1250
+if is_service_enabled quantum; then
1251
+    iniset $Q_CONF_FILE DEFAULT control_exchange quantum
1252
+    if is_service_enabled qpid ; then
1253
+        iniset $Q_CONF_FILE DEFAULT rpc_backend quantum.openstack.common.rpc.impl_qpid
1254
+    elif [ -n "$RABBIT_HOST" ] &&  [ -n "$RABBIT_PASSWORD" ]; then
1255
+        iniset $Q_CONF_FILE DEFAULT rabbit_host $RABBIT_HOST
1256
+        iniset $Q_CONF_FILE DEFAULT rabbit_password $RABBIT_PASSWORD
1257
+    fi
1258
+fi
1259
+
1260
+# Start the Quantum services
1261
+screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $Q_CONF_FILE --config-file /$Q_PLUGIN_CONF_FILE"
1262
+
1263
+# Start up the quantum agent
1264
+screen_it q-agt "sudo python $AGENT_BINARY --config-file $Q_CONF_FILE --config-file /$Q_PLUGIN_CONF_FILE"
1265
+
1266
+# Start up the quantum agent
1267
+screen_it q-dhcp "sudo python $AGENT_DHCP_BINARY --config-file=$Q_DHCP_CONF_FILE"
1268
+
1251 1269
 # Melange service
1252 1270
 if is_service_enabled m-svc; then
1253 1271
     if is_service_enabled mysql; then