blob: 5334be613b9195d2d456b3f9b38d6c37494a991e [file] [log] [blame]
Mark McClainb05c8762013-07-06 23:29:39 -04001# lib/neutron
2# functions - funstions specific to neutron
3
4# Dependencies:
5# ``functions`` file
6# ``DEST`` must be defined
7
8# ``stack.sh`` calls the entry points in this order:
9#
10# install_neutron
11# install_neutronclient
12# install_neutron_agent_packages
13# install_neutron_third_party
14# configure_neutron
15# init_neutron
16# configure_neutron_third_party
17# init_neutron_third_party
18# start_neutron_third_party
19# create_nova_conf_neutron
20# start_neutron_service_and_check
21# create_neutron_initial_network
22# setup_neutron_debug
23# start_neutron_agents
24#
25# ``unstack.sh`` calls the entry points in this order:
26#
27# stop_neutron
28
29# Functions in lib/neutron are classified into the following categories:
30#
31# - entry points (called from stack.sh or unstack.sh)
32# - internal functions
33# - neutron exercises
34# - 3rd party programs
35
36
37# Neutron Networking
38# ------------------
39
40# Make sure that neutron is enabled in ``ENABLED_SERVICES``. If you want
41# to run Neutron on this host, make sure that q-svc is also in
42# ``ENABLED_SERVICES``.
43#
44# If you're planning to use the Neutron openvswitch plugin, set
45# ``Q_PLUGIN`` to "openvswitch" and make sure the q-agt service is enabled
46# in ``ENABLED_SERVICES``. If you're planning to use the Neutron
47# linuxbridge plugin, set ``Q_PLUGIN`` to "linuxbridge" and make sure the
48# q-agt service is enabled in ``ENABLED_SERVICES``.
49#
50# See "Neutron Network Configuration" below for additional variables
51# that must be set in localrc for connectivity across hosts with
52# Neutron.
53#
54# With Neutron networking the NETWORK_MANAGER variable is ignored.
55#
56# To enable specific configuration options for either the Open vSwitch or
57# LinuxBridge plugin, please see the top level README file under the
58# Neutron section.
59
60# Save trace setting
61XTRACE=$(set +o | grep xtrace)
62set +o xtrace
63
64
65# Neutron Network Configuration
66# -----------------------------
67
68# Gateway and subnet defaults, in case they are not customized in localrc
69NETWORK_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1}
70PUBLIC_NETWORK_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-172.24.4.225}
71PRIVATE_SUBNET_NAME=${PRIVATE_SUBNET_NAME:-"private-subnet"}
72PUBLIC_SUBNET_NAME=${PUBLIC_SUBNET_NAME:-"public-subnet"}
73
74# Set up default directories
75NEUTRON_DIR=$DEST/neutron
76NEUTRONCLIENT_DIR=$DEST/python-neutronclient
77NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
78
79# Support entry points installation of console scripts
80if [[ -d $NEUTRON_DIR/bin/neutron-server ]]; then
81 NEUTRON_BIN_DIR=$NEUTRON_DIR/bin
82 else
83NEUTRON_BIN_DIR=$(get_python_exec_prefix)
84fi
85
86NEUTRON_CONF_DIR=/etc/neutron
87NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf
88export NEUTRON_TEST_CONFIG_FILE=${NEUTRON_TEST_CONFIG_FILE:-"$NEUTRON_CONF_DIR/debug.ini"}
89
90# Default Neutron Plugin
91Q_PLUGIN=${Q_PLUGIN:-openvswitch}
92# Default Neutron Port
93Q_PORT=${Q_PORT:-9696}
94# Default Neutron Host
95Q_HOST=${Q_HOST:-$SERVICE_HOST}
96# Default admin username
97Q_ADMIN_USERNAME=${Q_ADMIN_USERNAME:-neutron}
98# Default auth strategy
99Q_AUTH_STRATEGY=${Q_AUTH_STRATEGY:-keystone}
100# Use namespace or not
101Q_USE_NAMESPACE=${Q_USE_NAMESPACE:-True}
102# RHEL's support for namespaces requires using veths with ovs
103Q_OVS_USE_VETH=${Q_OVS_USE_VETH:-False}
104Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True}
105# Meta data IP
106Q_META_DATA_IP=${Q_META_DATA_IP:-$SERVICE_HOST}
107# Allow Overlapping IP among subnets
108Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-True}
109# Use neutron-debug command
110Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False}
111# The name of the default q-l3 router
112Q_ROUTER_NAME=${Q_ROUTER_NAME:-router1}
113# List of config file names in addition to the main plugin config file
114# See _configure_neutron_common() for details about setting it up
115declare -a Q_PLUGIN_EXTRA_CONF_FILES
116
117if is_service_enabled neutron; then
118 Q_RR_CONF_FILE=$NEUTRON_CONF_DIR/rootwrap.conf
119 if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
120 Q_RR_COMMAND="sudo"
121 else
122 NEUTRON_ROOTWRAP=$(get_rootwrap_location neutron)
123 Q_RR_COMMAND="sudo $NEUTRON_ROOTWRAP $Q_RR_CONF_FILE"
124 fi
125
126 # Provider Network Configurations
127 # --------------------------------
128
129 # The following variables control the Neutron openvswitch and
130 # linuxbridge plugins' allocation of tenant networks and
131 # availability of provider networks. If these are not configured
132 # in ``localrc``, tenant networks will be local to the host (with no
133 # remote connectivity), and no physical resources will be
134 # available for the allocation of provider networks.
135
136 # To use GRE tunnels for tenant networks, set to True in
137 # ``localrc``. GRE tunnels are only supported by the openvswitch
138 # plugin, and currently only on Ubuntu.
139 ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-False}
140
141 # If using GRE tunnels for tenant networks, specify the range of
142 # tunnel IDs from which tenant networks are allocated. Can be
143 # overriden in ``localrc`` in necesssary.
144 TENANT_TUNNEL_RANGES=${TENANT_TUNNEL_RANGE:-1:1000}
145
146 # To use VLANs for tenant networks, set to True in localrc. VLANs
147 # are supported by the openvswitch and linuxbridge plugins, each
148 # requiring additional configuration described below.
149 ENABLE_TENANT_VLANS=${ENABLE_TENANT_VLANS:-False}
150
151 # If using VLANs for tenant networks, set in ``localrc`` to specify
152 # the range of VLAN VIDs from which tenant networks are
153 # allocated. An external network switch must be configured to
154 # trunk these VLANs between hosts for multi-host connectivity.
155 #
156 # Example: ``TENANT_VLAN_RANGE=1000:1999``
157 TENANT_VLAN_RANGE=${TENANT_VLAN_RANGE:-}
158
159 # If using VLANs for tenant networks, or if using flat or VLAN
160 # provider networks, set in ``localrc`` to the name of the physical
161 # network, and also configure ``OVS_PHYSICAL_BRIDGE`` for the
162 # openvswitch agent or ``LB_PHYSICAL_INTERFACE`` for the linuxbridge
163 # agent, as described below.
164 #
165 # Example: ``PHYSICAL_NETWORK=default``
166 PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-}
167
168 # With the openvswitch plugin, if using VLANs for tenant networks,
169 # or if using flat or VLAN provider networks, set in ``localrc`` to
170 # the name of the OVS bridge to use for the physical network. The
171 # bridge will be created if it does not already exist, but a
172 # physical interface must be manually added to the bridge as a
173 # port for external connectivity.
174 #
175 # Example: ``OVS_PHYSICAL_BRIDGE=br-eth1``
176 OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-}
177
178 # With the linuxbridge plugin, if using VLANs for tenant networks,
179 # or if using flat or VLAN provider networks, set in ``localrc`` to
180 # the name of the network interface to use for the physical
181 # network.
182 #
183 # Example: ``LB_PHYSICAL_INTERFACE=eth1``
184 LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-}
185
186 # With the openvswitch plugin, set to True in ``localrc`` to enable
187 # provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False.
188 #
189 # Example: ``OVS_ENABLE_TUNNELING=True``
190 OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS}
191fi
192
193# Neutron plugin specific functions
194# ---------------------------------
195
196# Please refer to ``lib/neutron_plugins/README.md`` for details.
197source $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN
198
199# Agent loadbalancer service plugin functions
200# -------------------------------------------
201
202# Hardcoding for 1 service plugin for now
203source $TOP_DIR/lib/neutron_plugins/services/loadbalancer
204
Emilien Macchi40546f72013-09-24 15:10:25 +0200205# Agent metering service plugin functions
206# -------------------------------------------
207
208# Hardcoding for 1 service plugin for now
209source $TOP_DIR/lib/neutron_plugins/services/metering
210
Nachi Ueno69b3ff62013-06-07 10:28:33 -0700211# VPN service plugin functions
212# -------------------------------------------
213# Hardcoding for 1 service plugin for now
214source $TOP_DIR/lib/neutron_plugins/services/vpn
215
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700216# Firewall Service Plugin functions
217# --------------------------------
218source $TOP_DIR/lib/neutron_plugins/services/firewall
219
Mark McClainb05c8762013-07-06 23:29:39 -0400220# Use security group or not
221if has_neutron_plugin_security_group; then
222 Q_USE_SECGROUP=${Q_USE_SECGROUP:-True}
223else
224 Q_USE_SECGROUP=False
225fi
226
227# Functions
228# ---------
229
230# configure_neutron()
231# Set common config for all neutron server and agents.
232function configure_neutron() {
233 _configure_neutron_common
234 iniset_rpc_backend neutron $NEUTRON_CONF DEFAULT
235
236 # goes before q-svc to init Q_SERVICE_PLUGIN_CLASSES
237 if is_service_enabled q-lbaas; then
238 _configure_neutron_lbaas
239 fi
Emilien Macchi40546f72013-09-24 15:10:25 +0200240 if is_service_enabled q-metering; then
241 _configure_neutron_metering
242 fi
Nachi Ueno69b3ff62013-06-07 10:28:33 -0700243 if is_service_enabled q-vpn; then
244 _configure_neutron_vpn
245 fi
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700246 if is_service_enabled q-fwaas; then
247 _configure_neutron_fwaas
248 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400249 if is_service_enabled q-svc; then
250 _configure_neutron_service
251 fi
252 if is_service_enabled q-agt; then
253 _configure_neutron_plugin_agent
254 fi
255 if is_service_enabled q-dhcp; then
256 _configure_neutron_dhcp_agent
257 fi
258 if is_service_enabled q-l3; then
259 _configure_neutron_l3_agent
260 fi
261 if is_service_enabled q-meta; then
262 _configure_neutron_metadata_agent
263 fi
264
265 _configure_neutron_debug_command
266}
267
268function create_nova_conf_neutron() {
Yong Sheng Gong032e4542013-08-25 10:21:10 +0800269 iniset $NOVA_CONF DEFAULT network_api_class "nova.network.neutronv2.api.API"
270 iniset $NOVA_CONF DEFAULT neutron_admin_username "$Q_ADMIN_USERNAME"
271 iniset $NOVA_CONF DEFAULT neutron_admin_password "$SERVICE_PASSWORD"
272 iniset $NOVA_CONF DEFAULT neutron_admin_auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0"
273 iniset $NOVA_CONF DEFAULT neutron_auth_strategy "$Q_AUTH_STRATEGY"
274 iniset $NOVA_CONF DEFAULT neutron_admin_tenant_name "$SERVICE_TENANT_NAME"
275 iniset $NOVA_CONF DEFAULT neutron_region_name "RegionOne"
276 iniset $NOVA_CONF DEFAULT neutron_url "http://$Q_HOST:$Q_PORT"
Mark McClainb05c8762013-07-06 23:29:39 -0400277
278 if [[ "$Q_USE_SECGROUP" == "True" ]]; then
279 LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver
Yong Sheng Gong032e4542013-08-25 10:21:10 +0800280 iniset $NOVA_CONF DEFAULT security_group_api neutron
Mark McClainb05c8762013-07-06 23:29:39 -0400281 fi
282
283 # set NOVA_VIF_DRIVER and optionally set options in nova_conf
284 neutron_plugin_create_nova_conf
285
286 iniset $NOVA_CONF DEFAULT libvirt_vif_driver "$NOVA_VIF_DRIVER"
287 iniset $NOVA_CONF DEFAULT linuxnet_interface_driver "$LINUXNET_VIF_DRIVER"
288 if is_service_enabled q-meta; then
Yong Sheng Gong032e4542013-08-25 10:21:10 +0800289 iniset $NOVA_CONF DEFAULT service_neutron_metadata_proxy "True"
Mark McClainb05c8762013-07-06 23:29:39 -0400290 fi
291}
292
293# create_neutron_accounts() - Set up common required neutron accounts
294
295# Tenant User Roles
296# ------------------------------------------------------------------
297# service neutron admin # if enabled
298
299# Migrated from keystone_data.sh
300function create_neutron_accounts() {
301
302 SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
303 ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }")
304
305 if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
306 NEUTRON_USER=$(keystone user-create \
307 --name=neutron \
308 --pass="$SERVICE_PASSWORD" \
309 --tenant_id $SERVICE_TENANT \
310 --email=neutron@example.com \
311 | grep " id " | get_field 2)
312 keystone user-role-add \
Jorge Valderrama Romerof39ee962013-09-02 17:18:40 +0200313 --tenant-id $SERVICE_TENANT \
314 --user-id $NEUTRON_USER \
315 --role-id $ADMIN_ROLE
Mark McClainb05c8762013-07-06 23:29:39 -0400316 if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
317 NEUTRON_SERVICE=$(keystone service-create \
318 --name=neutron \
319 --type=network \
320 --description="Neutron Service" \
321 | grep " id " | get_field 2)
322 keystone endpoint-create \
323 --region RegionOne \
324 --service_id $NEUTRON_SERVICE \
325 --publicurl "http://$SERVICE_HOST:9696/" \
326 --adminurl "http://$SERVICE_HOST:9696/" \
327 --internalurl "http://$SERVICE_HOST:9696/"
328 fi
329 fi
330}
331
332function create_neutron_initial_network() {
333 TENANT_ID=$(keystone tenant-list | grep " demo " | get_field 1)
334
335 # Create a small network
336 # Since neutron command is executed in admin context at this point,
337 # ``--tenant_id`` needs to be specified.
338 if is_baremetal; then
sbauzae2c4ee22013-08-29 17:29:46 +0200339 if [[ "$PUBLIC_INTERFACE" == '' || "$OVS_PHYSICAL_BRIDGE" == '' ]]; then
340 die $LINENO "Neutron settings for baremetal not set.. exiting"
341 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400342 sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
343 for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do
344 sudo ip addr del $IP dev $PUBLIC_INTERFACE
345 sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE
346 done
347 NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type flat --provider:physical_network "$PHYSICAL_NETWORK" | grep ' id ' | get_field 2)
348 SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
349 sudo ifconfig $OVS_PHYSICAL_BRIDGE up
sbauzae2c4ee22013-08-29 17:29:46 +0200350 sudo route add default gw $NETWORK_GATEWAY dev $OVS_PHYSICAL_BRIDGE
Mark McClainb05c8762013-07-06 23:29:39 -0400351 else
352 NET_ID=$(neutron net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
353 SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY --name $PRIVATE_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
354 fi
355
356 if [[ "$Q_L3_ENABLED" == "True" ]]; then
357 # Create a router, and add the private subnet as one of its interfaces
358 if [[ "$Q_L3_ROUTER_PER_TENANT" == "True" ]]; then
359 # create a tenant-owned router.
360 ROUTER_ID=$(neutron router-create --tenant_id $TENANT_ID $Q_ROUTER_NAME | grep ' id ' | get_field 2)
361 else
362 # Plugin only supports creating a single router, which should be admin owned.
363 ROUTER_ID=$(neutron router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
364 fi
365 neutron router-interface-add $ROUTER_ID $SUBNET_ID
366 # Create an external network, and a subnet. Configure the external network as router gw
367 EXT_NET_ID=$(neutron net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2)
368 EXT_GW_IP=$(neutron subnet-create --ip_version 4 ${Q_FLOATING_ALLOCATION_POOL:+--allocation-pool $Q_FLOATING_ALLOCATION_POOL} --gateway $PUBLIC_NETWORK_GATEWAY --name $PUBLIC_SUBNET_NAME $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2)
369 neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
370
371 if is_service_enabled q-l3; then
372 # logic is specific to using the l3-agent for l3
373 if is_neutron_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then
374 CIDR_LEN=${FLOATING_RANGE#*/}
375 sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE
376 sudo ip link set $PUBLIC_BRIDGE up
377 ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'`
378 sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP
379 fi
380 if [[ "$Q_USE_NAMESPACE" == "False" ]]; then
381 # Explicitly set router id in l3 agent configuration
382 iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID
383 fi
384 fi
385 fi
386}
387
388# init_neutron() - Initialize databases, etc.
389function init_neutron() {
Salvatore Orlandodd649882013-08-05 08:56:17 -0700390 recreate_database $Q_DB_NAME utf8
391 # Run Neutron db migrations
392 $NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
Mark McClainb05c8762013-07-06 23:29:39 -0400393}
394
395# install_neutron() - Collect source and prepare
396function install_neutron() {
397 git_clone $NEUTRON_REPO $NEUTRON_DIR $NEUTRON_BRANCH
398 setup_develop $NEUTRON_DIR
399}
400
401# install_neutronclient() - Collect source and prepare
402function install_neutronclient() {
403 git_clone $NEUTRONCLIENT_REPO $NEUTRONCLIENT_DIR $NEUTRONCLIENT_BRANCH
404 setup_develop $NEUTRONCLIENT_DIR
Attila Fazekasfac533e2013-08-14 16:04:01 +0200405 sudo install -D -m 0644 -o $STACK_USER {$NEUTRONCLIENT_DIR/tools/,/etc/bash_completion.d/}neutron.bash_completion
Mark McClainb05c8762013-07-06 23:29:39 -0400406}
407
408# install_neutron_agent_packages() - Collect source and prepare
409function install_neutron_agent_packages() {
410 # install packages that are specific to plugin agent(s)
411 if is_service_enabled q-agt q-dhcp q-l3; then
412 neutron_plugin_install_agent_packages
413 fi
414
415 if is_service_enabled q-lbaas; then
416 neutron_agent_lbaas_install_agent_packages
417 fi
418}
419
420# Start running processes, including screen
421function start_neutron_service_and_check() {
422 # build config-file options
423 local cfg_file
424 local CFG_FILE_OPTIONS="--config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
425 for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do
426 CFG_FILE_OPTIONS+=" --config-file /$cfg_file"
427 done
428 # Start the Neutron service
429 screen_it q-svc "cd $NEUTRON_DIR && python $NEUTRON_BIN_DIR/neutron-server $CFG_FILE_OPTIONS"
430 echo "Waiting for Neutron to start..."
431 if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://$Q_HOST:$Q_PORT; do sleep 1; done"; then
432 die $LINENO "Neutron did not start"
433 fi
434}
435
436# Start running processes, including screen
437function start_neutron_agents() {
438 # Start up the neutron agents if enabled
439 screen_it q-agt "cd $NEUTRON_DIR && python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
440 screen_it q-dhcp "cd $NEUTRON_DIR && python $AGENT_DHCP_BINARY --config-file $NEUTRON_CONF --config-file=$Q_DHCP_CONF_FILE"
Nachi Ueno584750f2013-07-15 18:22:21 -0700441
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700442 L3_CONF_FILES="--config-file $NEUTRON_CONF --config-file=$Q_L3_CONF_FILE"
443
444 if is_service_enabled q-fwaas; then
445 L3_CONF_FILES="$L3_CONF_FILES --config-file $Q_FWAAS_CONF_FILE"
Nachi Ueno584750f2013-07-15 18:22:21 -0700446 fi
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700447 if is_service_enabled q-vpn; then
448 screen_it q-vpn "cd $NEUTRON_DIR && $AGENT_VPN_BINARY $L3_CONF_FILES"
449 else
450 screen_it q-l3 "cd $NEUTRON_DIR && python $AGENT_L3_BINARY $L3_CONF_FILES"
451 fi
452
Mark McClainb05c8762013-07-06 23:29:39 -0400453 screen_it q-meta "cd $NEUTRON_DIR && python $AGENT_META_BINARY --config-file $NEUTRON_CONF --config-file=$Q_META_CONF_FILE"
454
455 if [ "$VIRT_DRIVER" = 'xenserver' ]; then
456 # For XenServer, start an agent for the domU openvswitch
457 screen_it q-domua "cd $NEUTRON_DIR && python $AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE.domU"
458 fi
459
460 if is_service_enabled q-lbaas; then
461 screen_it q-lbaas "cd $NEUTRON_DIR && python $AGENT_LBAAS_BINARY --config-file $NEUTRON_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME"
462 fi
Emilien Macchi40546f72013-09-24 15:10:25 +0200463
464 if is_service_enabled q-metering; then
465 screen_it q-metering "cd $NEUTRON_DIR && python $AGENT_METERING_BINARY --config-file $NEUTRON_CONF --config-file $METERING_AGENT_CONF_FILENAME"
466 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400467}
468
469# stop_neutron() - Stop running processes (non-screen)
470function stop_neutron() {
471 if is_service_enabled q-dhcp; then
472 pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }')
473 [ ! -z "$pid" ] && sudo kill -9 $pid
474 fi
475 if is_service_enabled q-meta; then
476 pid=$(ps aux | awk '/neutron-ns-metadata-proxy/ { print $2 }')
477 [ ! -z "$pid" ] && sudo kill -9 $pid
478 fi
479}
480
481# cleanup_neutron() - Remove residual data files, anything left over from previous
482# runs that a clean run would need to clean up
483function cleanup_neutron() {
484 if is_neutron_ovs_base_plugin; then
485 neutron_ovs_base_cleanup
486 fi
487
488 # delete all namespaces created by neutron
489 for ns in $(sudo ip netns list | grep -o -e qdhcp-[0-9a-f\-]* -e qrouter-[0-9a-f\-]*); do
490 sudo ip netns delete ${ns}
491 done
492}
493
494# _configure_neutron_common()
495# Set common config for all neutron server and agents.
496# This MUST be called before other ``_configure_neutron_*`` functions.
497function _configure_neutron_common() {
498 # Put config files in ``NEUTRON_CONF_DIR`` for everyone to find
499 if [[ ! -d $NEUTRON_CONF_DIR ]]; then
500 sudo mkdir -p $NEUTRON_CONF_DIR
501 fi
502 sudo chown $STACK_USER $NEUTRON_CONF_DIR
503
504 cp $NEUTRON_DIR/etc/neutron.conf $NEUTRON_CONF
505
506 # Set plugin-specific variables ``Q_DB_NAME``, ``Q_PLUGIN_CLASS``.
507 # For main plugin config file, set ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``.
508 # For addition plugin config files, set ``Q_PLUGIN_EXTRA_CONF_PATH``,
509 # ``Q_PLUGIN_EXTRA_CONF_FILES``. For example:
510 # ``Q_PLUGIN_EXTRA_CONF_FILES=(file1, file2)``
511 neutron_plugin_configure_common
512
sbauzae2c4ee22013-08-29 17:29:46 +0200513 if [[ "$Q_PLUGIN_CONF_PATH" == '' || "$Q_PLUGIN_CONF_FILENAME" == '' || "$Q_PLUGIN_CLASS" == '' ]]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400514 die $LINENO "Neutron plugin not set.. exiting"
515 fi
516
517 # If needed, move config file from ``$NEUTRON_DIR/etc/neutron`` to ``NEUTRON_CONF_DIR``
518 mkdir -p /$Q_PLUGIN_CONF_PATH
519 Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
520 cp $NEUTRON_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE
521
522 iniset /$Q_PLUGIN_CONF_FILE database connection `database_connection_url $Q_DB_NAME`
523 iniset $NEUTRON_CONF DEFAULT state_path $DATA_DIR/neutron
524
525 # If addition config files are set, make sure their path name is set as well
526 if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then
527 die $LINENO "Neutron additional plugin config not set.. exiting"
528 fi
529
530 # If additional config files exist, copy them over to neutron configuration
531 # directory
532 if [[ $Q_PLUGIN_EXTRA_CONF_PATH != '' ]]; then
533 mkdir -p /$Q_PLUGIN_EXTRA_CONF_PATH
534 local f
535 for (( f=0; $f < ${#Q_PLUGIN_EXTRA_CONF_FILES[@]}; f+=1 )); do
536 Q_PLUGIN_EXTRA_CONF_FILES[$f]=$Q_PLUGIN_EXTRA_CONF_PATH/${Q_PLUGIN_EXTRA_CONF_FILES[$f]}
537 cp $NEUTRON_DIR/${Q_PLUGIN_EXTRA_CONF_FILES[$f]} /${Q_PLUGIN_EXTRA_CONF_FILES[$f]}
538 done
539 fi
540
Joe Gordonbee5c502013-08-30 13:48:08 -0400541 if [ "$VIRT_DRIVER" = 'fake' ]; then
542 # Disable arbitrary limits
543 iniset $NEUTRON_CONF quotas quota_network -1
544 iniset $NEUTRON_CONF quotas quota_subnet -1
545 iniset $NEUTRON_CONF quotas quota_port -1
546 iniset $NEUTRON_CONF quotas quota_security_group -1
547 iniset $NEUTRON_CONF quotas quota_security_group_rule -1
548 fi
549
Salvatore Orlando05ae8332013-08-20 14:51:08 -0700550 # Format logging
551 if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
552 setup_colorized_logging $NEUTRON_CONF DEFAULT
553 fi
554
Mark McClainb05c8762013-07-06 23:29:39 -0400555 _neutron_setup_rootwrap
556}
557
558function _configure_neutron_debug_command() {
559 if [[ "$Q_USE_DEBUG_COMMAND" != "True" ]]; then
560 return
561 fi
562
563 cp $NEUTRON_DIR/etc/l3_agent.ini $NEUTRON_TEST_CONFIG_FILE
564
565 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT verbose False
566 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT debug False
567 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
568 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT root_helper "$Q_RR_COMMAND"
569 # Intermediate fix until Neutron patch lands and then line above will
570 # be cleaned.
571 iniset $NEUTRON_TEST_CONFIG_FILE agent root_helper "$Q_RR_COMMAND"
572
Mark McClainb05c8762013-07-06 23:29:39 -0400573 _neutron_setup_interface_driver $NEUTRON_TEST_CONFIG_FILE
574
575 neutron_plugin_configure_debug_command
576}
577
578function _configure_neutron_dhcp_agent() {
579 AGENT_DHCP_BINARY="$NEUTRON_BIN_DIR/neutron-dhcp-agent"
580 Q_DHCP_CONF_FILE=$NEUTRON_CONF_DIR/dhcp_agent.ini
581
582 cp $NEUTRON_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE
583
584 iniset $Q_DHCP_CONF_FILE DEFAULT verbose True
Ben Nemec03997942013-08-10 09:56:16 -0500585 iniset $Q_DHCP_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400586 iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
587 iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
588
Kyle Mestery73b21912013-08-22 11:25:21 +0000589 # Define extra "DEFAULT" configuration options when q-dhcp is configured by
590 # defining the array ``Q_DHCP_EXTRA_DEFAULT_OPTS``.
591 # For Example: ``Q_DHCP_EXTRA_DEFAULT_OPTS=(foo=true bar=2)``
592 for I in "${Q_DHCP_EXTRA_DEFAULT_OPTS[@]}"; do
593 # Replace the first '=' with ' ' for iniset syntax
594 iniset $Q_DHCP_CONF_FILE DEFAULT ${I/=/ }
595 done
596
Mark McClainb05c8762013-07-06 23:29:39 -0400597 _neutron_setup_interface_driver $Q_DHCP_CONF_FILE
598
599 neutron_plugin_configure_dhcp_agent
600}
601
602function _configure_neutron_l3_agent() {
603 Q_L3_ENABLED=True
604 # for l3-agent, only use per tenant router if we have namespaces
605 Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE
Nachi Ueno69b3ff62013-06-07 10:28:33 -0700606
607 AGENT_L3_BINARY=${AGENT_L3_BINARY:-"$NEUTRON_BIN_DIR/neutron-l3-agent"}
Mark McClainb05c8762013-07-06 23:29:39 -0400608 Q_L3_CONF_FILE=$NEUTRON_CONF_DIR/l3_agent.ini
609
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700610 if is_service_enabled q-fwaas; then
611 Q_FWAAS_CONF_FILE=$NEUTRON_CONF_DIR/fwaas_driver.ini
612 fi
613
Mark McClainb05c8762013-07-06 23:29:39 -0400614 cp $NEUTRON_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE
615
616 iniset $Q_L3_CONF_FILE DEFAULT verbose True
Ben Nemec03997942013-08-10 09:56:16 -0500617 iniset $Q_L3_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400618 iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
619 iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
620
Mark McClainb05c8762013-07-06 23:29:39 -0400621 _neutron_setup_interface_driver $Q_L3_CONF_FILE
622
623 neutron_plugin_configure_l3_agent
624}
625
626function _configure_neutron_metadata_agent() {
627 AGENT_META_BINARY="$NEUTRON_BIN_DIR/neutron-metadata-agent"
628 Q_META_CONF_FILE=$NEUTRON_CONF_DIR/metadata_agent.ini
629
630 cp $NEUTRON_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE
631
632 iniset $Q_META_CONF_FILE DEFAULT verbose True
Ben Nemec03997942013-08-10 09:56:16 -0500633 iniset $Q_META_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400634 iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP
635 iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
636
Yong Sheng Gong8535d8b2013-08-25 11:21:13 +0800637 _neutron_setup_keystone $Q_META_CONF_FILE DEFAULT True True True
Maru Newbybf10ac52013-08-10 21:27:54 +0000638
Mark McClainb05c8762013-07-06 23:29:39 -0400639}
640
641function _configure_neutron_lbaas() {
642 neutron_agent_lbaas_configure_common
643 neutron_agent_lbaas_configure_agent
644}
645
Emilien Macchi40546f72013-09-24 15:10:25 +0200646function _configure_neutron_metering() {
647 neutron_agent_metering_configure_common
648 neutron_agent_metering_configure_agent
649}
650
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700651function _configure_neutron_fwaas() {
652 neutron_fwaas_configure_common
653 neutron_fwaas_configure_driver
654}
655
Nachi Ueno69b3ff62013-06-07 10:28:33 -0700656function _configure_neutron_vpn()
657{
658 neutron_vpn_install_agent_packages
659 neutron_vpn_configure_common
Nachi Ueno69b3ff62013-06-07 10:28:33 -0700660}
661
Mark McClainb05c8762013-07-06 23:29:39 -0400662# _configure_neutron_plugin_agent() - Set config files for neutron plugin agent
663# It is called when q-agt is enabled.
664function _configure_neutron_plugin_agent() {
665 # Specify the default root helper prior to agent configuration to
666 # ensure that an agent's configuration can override the default
667 iniset /$Q_PLUGIN_CONF_FILE agent root_helper "$Q_RR_COMMAND"
668 iniset $NEUTRON_CONF DEFAULT verbose True
Ben Nemec03997942013-08-10 09:56:16 -0500669 iniset $NEUTRON_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400670
671 # Configure agent for plugin
672 neutron_plugin_configure_plugin_agent
673}
674
675# _configure_neutron_service() - Set config files for neutron service
676# It is called when q-svc is enabled.
677function _configure_neutron_service() {
678 Q_API_PASTE_FILE=$NEUTRON_CONF_DIR/api-paste.ini
679 Q_POLICY_FILE=$NEUTRON_CONF_DIR/policy.json
680
681 cp $NEUTRON_DIR/etc/api-paste.ini $Q_API_PASTE_FILE
682 cp $NEUTRON_DIR/etc/policy.json $Q_POLICY_FILE
683
Mark McClainb05c8762013-07-06 23:29:39 -0400684 # Update either configuration file with plugin
685 iniset $NEUTRON_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS
686
687 if [[ $Q_SERVICE_PLUGIN_CLASSES != '' ]]; then
688 iniset $NEUTRON_CONF DEFAULT service_plugins $Q_SERVICE_PLUGIN_CLASSES
689 fi
690
691 iniset $NEUTRON_CONF DEFAULT verbose True
Ben Nemec03997942013-08-10 09:56:16 -0500692 iniset $NEUTRON_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400693 iniset $NEUTRON_CONF DEFAULT policy_file $Q_POLICY_FILE
694 iniset $NEUTRON_CONF DEFAULT allow_overlapping_ips $Q_ALLOW_OVERLAPPING_IP
695
696 iniset $NEUTRON_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY
697 _neutron_setup_keystone $NEUTRON_CONF keystone_authtoken
698
Simon Pasquierca96b0a2013-07-09 16:59:12 +0200699 # Define extra "DEFAULT" configuration options when q-svc is configured by
700 # defining the array ``Q_SRV_EXTRA_DEFAULT_OPTS``.
701 # For Example: ``Q_SRV_EXTRA_DEFAULT_OPTS=(foo=true bar=2)``
702 for I in "${Q_SRV_EXTRA_DEFAULT_OPTS[@]}"; do
703 # Replace the first '=' with ' ' for iniset syntax
704 iniset $NEUTRON_CONF DEFAULT ${I/=/ }
705 done
706
Mark McClainb05c8762013-07-06 23:29:39 -0400707 # Configure plugin
708 neutron_plugin_configure_service
709}
710
711# Utility Functions
712#------------------
713
714# _neutron_setup_rootwrap() - configure Neutron's rootwrap
715function _neutron_setup_rootwrap() {
716 if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
717 return
718 fi
719 # Deploy new rootwrap filters files (owned by root).
720 # Wipe any existing ``rootwrap.d`` files first
721 Q_CONF_ROOTWRAP_D=$NEUTRON_CONF_DIR/rootwrap.d
722 if [[ -d $Q_CONF_ROOTWRAP_D ]]; then
723 sudo rm -rf $Q_CONF_ROOTWRAP_D
724 fi
725 # Deploy filters to ``$NEUTRON_CONF_DIR/rootwrap.d``
726 mkdir -p -m 755 $Q_CONF_ROOTWRAP_D
727 cp -pr $NEUTRON_DIR/etc/neutron/rootwrap.d/* $Q_CONF_ROOTWRAP_D/
728 sudo chown -R root:root $Q_CONF_ROOTWRAP_D
729 sudo chmod 644 $Q_CONF_ROOTWRAP_D/*
730 # Set up ``rootwrap.conf``, pointing to ``$NEUTRON_CONF_DIR/rootwrap.d``
731 # location moved in newer versions, prefer new location
732 if test -r $NEUTRON_DIR/etc/neutron/rootwrap.conf; then
733 sudo cp -p $NEUTRON_DIR/etc/neutron/rootwrap.conf $Q_RR_CONF_FILE
734 else
735 sudo cp -p $NEUTRON_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE
736 fi
737 sudo sed -e "s:^filters_path=.*$:filters_path=$Q_CONF_ROOTWRAP_D:" -i $Q_RR_CONF_FILE
738 sudo chown root:root $Q_RR_CONF_FILE
739 sudo chmod 0644 $Q_RR_CONF_FILE
740 # Specify ``rootwrap.conf`` as first parameter to neutron-rootwrap
741 ROOTWRAP_SUDOER_CMD="$NEUTRON_ROOTWRAP $Q_RR_CONF_FILE *"
742
743 # Set up the rootwrap sudoers for neutron
744 TEMPFILE=`mktemp`
745 echo "$USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD" >$TEMPFILE
746 chmod 0440 $TEMPFILE
747 sudo chown root:root $TEMPFILE
748 sudo mv $TEMPFILE /etc/sudoers.d/neutron-rootwrap
749
750 # Update the root_helper
751 iniset $NEUTRON_CONF agent root_helper "$Q_RR_COMMAND"
752}
753
754# Configures keystone integration for neutron service and agents
755function _neutron_setup_keystone() {
756 local conf_file=$1
757 local section=$2
758 local use_auth_url=$3
Maru Newbybf10ac52013-08-10 21:27:54 +0000759 local skip_auth_cache=$4
Yong Sheng Gong8535d8b2013-08-25 11:21:13 +0800760 local use_service_port=$5
761 local keystone_port=$KEYSTONE_AUTH_PORT
762 if [[ -n $use_service_port ]]; then
763 keystone_port=$KEYSTONE_SERVICE_PORT
764 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400765 if [[ -n $use_auth_url ]]; then
Yong Sheng Gong8535d8b2013-08-25 11:21:13 +0800766 iniset $conf_file $section auth_url "$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_AUTH_HOST:$keystone_port/v2.0"
Mark McClainb05c8762013-07-06 23:29:39 -0400767 else
768 iniset $conf_file $section auth_host $KEYSTONE_SERVICE_HOST
Yong Sheng Gong8535d8b2013-08-25 11:21:13 +0800769 iniset $conf_file $section auth_port $keystone_port
Mark McClainb05c8762013-07-06 23:29:39 -0400770 iniset $conf_file $section auth_protocol $KEYSTONE_SERVICE_PROTOCOL
771 fi
772 iniset $conf_file $section admin_tenant_name $SERVICE_TENANT_NAME
773 iniset $conf_file $section admin_user $Q_ADMIN_USERNAME
774 iniset $conf_file $section admin_password $SERVICE_PASSWORD
Maru Newbybf10ac52013-08-10 21:27:54 +0000775 if [[ -z $skip_auth_cache ]]; then
776 iniset $conf_file $section signing_dir $NEUTRON_AUTH_CACHE_DIR
777 # Create cache dir
778 sudo mkdir -p $NEUTRON_AUTH_CACHE_DIR
779 sudo chown $STACK_USER $NEUTRON_AUTH_CACHE_DIR
780 rm -f $NEUTRON_AUTH_CACHE_DIR/*
781 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400782}
783
784function _neutron_setup_interface_driver() {
785
786 # ovs_use_veth needs to be set before the plugin configuration
787 # occurs to allow plugins to override the setting.
788 iniset $1 DEFAULT ovs_use_veth $Q_OVS_USE_VETH
789
790 neutron_plugin_setup_interface_driver $1
791}
792
793# Functions for Neutron Exercises
794#--------------------------------
795
796function delete_probe() {
797 local from_net="$1"
798 net_id=`_get_net_id $from_net`
799 probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'`
800 neutron-debug --os-tenant-name admin --os-username admin probe-delete $probe_id
801}
802
803function setup_neutron_debug() {
804 if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
805 public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME`
806 neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $public_net_id
807 private_net_id=`_get_net_id $PRIVATE_NETWORK_NAME`
808 neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create --device-owner compute $private_net_id
809 fi
810}
811
812function teardown_neutron_debug() {
813 delete_probe $PUBLIC_NETWORK_NAME
814 delete_probe $PRIVATE_NETWORK_NAME
815}
816
817function _get_net_id() {
818 neutron --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}'
819}
820
821function _get_probe_cmd_prefix() {
822 local from_net="$1"
823 net_id=`_get_net_id $from_net`
824 probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}' | head -n 1`
825 echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id"
826}
827
828function _ping_check_neutron() {
829 local from_net=$1
830 local ip=$2
831 local timeout_sec=$3
832 local expected=${4:-"True"}
833 local check_command=""
834 probe_cmd=`_get_probe_cmd_prefix $from_net`
835 if [[ "$expected" = "True" ]]; then
836 check_command="while ! $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done"
837 else
838 check_command="while $probe_cmd ping -w 1 -c 1 $ip; do sleep 1; done"
839 fi
840 if ! timeout $timeout_sec sh -c "$check_command"; then
841 if [[ "$expected" = "True" ]]; then
842 die $LINENO "[Fail] Couldn't ping server"
843 else
844 die $LINENO "[Fail] Could ping server"
845 fi
846 fi
847}
848
849# ssh check
850function _ssh_check_neutron() {
851 local from_net=$1
852 local key_file=$2
853 local ip=$3
854 local user=$4
855 local timeout_sec=$5
856 local probe_cmd = ""
857 probe_cmd=`_get_probe_cmd_prefix $from_net`
858 if ! timeout $timeout_sec sh -c "while ! $probe_cmd ssh -o StrictHostKeyChecking=no -i $key_file ${user}@$ip echo success; do sleep 1; done"; then
859 die $LINENO "server didn't become ssh-able!"
860 fi
861}
862
863# Neutron 3rd party programs
864#---------------------------
865
866# please refer to ``lib/neutron_thirdparty/README.md`` for details
867NEUTRON_THIRD_PARTIES=""
868for f in $TOP_DIR/lib/neutron_thirdparty/*; do
869 third_party=$(basename $f)
870 if is_service_enabled $third_party; then
871 source $TOP_DIR/lib/neutron_thirdparty/$third_party
872 NEUTRON_THIRD_PARTIES="$NEUTRON_THIRD_PARTIES,$third_party"
873 fi
874done
875
876function _neutron_third_party_do() {
877 for third_party in ${NEUTRON_THIRD_PARTIES//,/ }; do
878 ${1}_${third_party}
879 done
880}
881
882# configure_neutron_third_party() - Set config files, create data dirs, etc
883function configure_neutron_third_party() {
884 _neutron_third_party_do configure
885}
886
887# init_neutron_third_party() - Initialize databases, etc.
888function init_neutron_third_party() {
889 _neutron_third_party_do init
890}
891
892# install_neutron_third_party() - Collect source and prepare
893function install_neutron_third_party() {
894 _neutron_third_party_do install
895}
896
897# start_neutron_third_party() - Start running processes, including screen
898function start_neutron_third_party() {
899 _neutron_third_party_do start
900}
901
902# stop_neutron_third_party - Stop running processes (non-screen)
903function stop_neutron_third_party() {
904 _neutron_third_party_do stop
905}
906
907
908# Restore xtrace
909$XTRACE
910
911# Local variables:
912# mode: shell-script
913# End: