blob: 938d5662eccd97f78daf40aaa76594ba62798a89 [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
Mark McClainb05c8762013-07-06 23:29:39 -04003# lib/neutron
Joe Gordon23946052014-01-15 21:42:32 +00004# functions - functions specific to neutron
Mark McClainb05c8762013-07-06 23:29:39 -04005
6# Dependencies:
7# ``functions`` file
8# ``DEST`` must be defined
Stephan Renatuse578eff2013-11-19 13:31:04 +01009# ``STACK_USER`` must be defined
Mark McClainb05c8762013-07-06 23:29:39 -040010
11# ``stack.sh`` calls the entry points in this order:
12#
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010013# - install_neutron_agent_packages
YAMAMOTO Takashi1a669dc2015-02-05 11:54:12 +090014# - install_neutronclient
15# - install_neutron
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010016# - install_neutron_third_party
17# - configure_neutron
18# - init_neutron
19# - configure_neutron_third_party
20# - init_neutron_third_party
21# - start_neutron_third_party
22# - create_nova_conf_neutron
23# - start_neutron_service_and_check
YAMAMOTO Takashi1a669dc2015-02-05 11:54:12 +090024# - check_neutron_third_party_integration
yunhong jiang0d6e9922014-10-10 06:12:47 -070025# - start_neutron_agents
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010026# - create_neutron_initial_network
27# - setup_neutron_debug
Mark McClainb05c8762013-07-06 23:29:39 -040028#
29# ``unstack.sh`` calls the entry points in this order:
30#
YAMAMOTO Takashi1a669dc2015-02-05 11:54:12 +090031# - teardown_neutron_debug
Adam Spiers6a5aa7c2013-10-24 11:27:02 +010032# - stop_neutron
yunhong jiang0d6e9922014-10-10 06:12:47 -070033# - stop_neutron_third_party
34# - cleanup_neutron
Mark McClainb05c8762013-07-06 23:29:39 -040035
36# Functions in lib/neutron are classified into the following categories:
37#
38# - entry points (called from stack.sh or unstack.sh)
39# - internal functions
40# - neutron exercises
41# - 3rd party programs
42
43
44# Neutron Networking
45# ------------------
46
47# Make sure that neutron is enabled in ``ENABLED_SERVICES``. If you want
48# to run Neutron on this host, make sure that q-svc is also in
49# ``ENABLED_SERVICES``.
50#
Mark McClainb05c8762013-07-06 23:29:39 -040051# See "Neutron Network Configuration" below for additional variables
52# that must be set in localrc for connectivity across hosts with
53# Neutron.
54#
55# With Neutron networking the NETWORK_MANAGER variable is ignored.
Mark McClainb05c8762013-07-06 23:29:39 -040056
John Davidge21529a52014-06-30 09:55:11 -040057# Settings
58# --------
59
Mark McClainb05c8762013-07-06 23:29:39 -040060
61# Neutron Network Configuration
62# -----------------------------
63
Matthew Treinishabde96a2016-05-12 19:26:20 -040064deprecated "Using lib/neutron-legacy is deprecated, and it will be removed in the future"
Armando Migliaccio7dbcfae2016-02-19 14:43:42 -080065
Rob Crittenden18d47782014-03-19 17:47:42 -040066if is_ssl_enabled_service "neutron" || is_service_enabled tls-proxy; then
67 Q_PROTOCOL="https"
68fi
69
70
Mark McClainb05c8762013-07-06 23:29:39 -040071# Set up default directories
Sean Daguee08ab102014-11-13 17:09:28 -050072GITDIR["python-neutronclient"]=$DEST/python-neutronclient
Sean Dague5cb19062014-11-01 01:37:45 +010073
Doug Wiegley93e682c2015-03-03 10:31:30 -070074
Mark McClainb05c8762013-07-06 23:29:39 -040075NEUTRON_DIR=$DEST/neutron
Kyle Mestery20b839f2014-12-08 06:17:27 +000076NEUTRON_FWAAS_DIR=$DEST/neutron-fwaas
Mark McClainb05c8762013-07-06 23:29:39 -040077NEUTRON_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
Sean Dague3bdb9222013-10-22 08:36:16 -040082else
83 NEUTRON_BIN_DIR=$(get_python_exec_prefix)
Mark McClainb05c8762013-07-06 23:29:39 -040084fi
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
Adam Gandelman7614d212014-08-11 14:27:50 -070090# Agent binaries. Note, binary paths for other agents are set in per-service
91# scripts in lib/neutron_plugins/services/
92AGENT_DHCP_BINARY="$NEUTRON_BIN_DIR/neutron-dhcp-agent"
93AGENT_L3_BINARY=${AGENT_L3_BINARY:-"$NEUTRON_BIN_DIR/neutron-l3-agent"}
94AGENT_META_BINARY="$NEUTRON_BIN_DIR/neutron-metadata-agent"
95
96# Agent config files. Note, plugin-specific Q_PLUGIN_CONF_FILE is set and
97# loaded from per-plugin scripts in lib/neutron_plugins/
98Q_DHCP_CONF_FILE=$NEUTRON_CONF_DIR/dhcp_agent.ini
99Q_L3_CONF_FILE=$NEUTRON_CONF_DIR/l3_agent.ini
Adam Gandelman7614d212014-08-11 14:27:50 -0700100Q_META_CONF_FILE=$NEUTRON_CONF_DIR/metadata_agent.ini
101
Henry Gessau0fc1cc22014-07-06 22:54:34 -0400102# Default name for Neutron database
103Q_DB_NAME=${Q_DB_NAME:-neutron}
Mark McClainb05c8762013-07-06 23:29:39 -0400104# Default Neutron Plugin
Kyle Mestery6d235002013-09-18 20:27:08 +0000105Q_PLUGIN=${Q_PLUGIN:-ml2}
Mark McClainb05c8762013-07-06 23:29:39 -0400106# Default Neutron Port
107Q_PORT=${Q_PORT:-9696}
Rob Crittenden18d47782014-03-19 17:47:42 -0400108# Default Neutron Internal Port when using TLS proxy
109Q_PORT_INT=${Q_PORT_INT:-19696}
Mark McClainb05c8762013-07-06 23:29:39 -0400110# Default Neutron Host
111Q_HOST=${Q_HOST:-$SERVICE_HOST}
Rob Crittenden18d47782014-03-19 17:47:42 -0400112# Default protocol
113Q_PROTOCOL=${Q_PROTOCOL:-$SERVICE_PROTOCOL}
Brian Haley180f5eb2015-06-16 13:14:31 -0400114# Default listen address
115Q_LISTEN_ADDRESS=${Q_LISTEN_ADDRESS:-$SERVICE_LISTEN_ADDRESS}
Mark McClainb05c8762013-07-06 23:29:39 -0400116# Default admin username
117Q_ADMIN_USERNAME=${Q_ADMIN_USERNAME:-neutron}
118# Default auth strategy
119Q_AUTH_STRATEGY=${Q_AUTH_STRATEGY:-keystone}
Mark McClainb05c8762013-07-06 23:29:39 -0400120# RHEL's support for namespaces requires using veths with ovs
121Q_OVS_USE_VETH=${Q_OVS_USE_VETH:-False}
122Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True}
Yuriy Taraday26623952014-07-16 17:41:53 +0400123Q_USE_ROOTWRAP_DAEMON=$(trueorfalse True Q_USE_ROOTWRAP_DAEMON)
Mark McClainb05c8762013-07-06 23:29:39 -0400124# Meta data IP
125Q_META_DATA_IP=${Q_META_DATA_IP:-$SERVICE_HOST}
126# Allow Overlapping IP among subnets
127Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-True}
Terry Wilsonf06c4432014-05-20 10:54:51 -0500128Q_NOTIFY_NOVA_PORT_STATUS_CHANGES=${Q_NOTIFY_NOVA_PORT_STATUS_CHANGES:-True}
129Q_NOTIFY_NOVA_PORT_DATA_CHANGES=${Q_NOTIFY_NOVA_PORT_DATA_CHANGES:-True}
Aaron Rosencea32b12014-03-04 16:20:14 -0800130VIF_PLUGGING_IS_FATAL=${VIF_PLUGGING_IS_FATAL:-True}
131VIF_PLUGGING_TIMEOUT=${VIF_PLUGGING_TIMEOUT:-300}
Aaron Rosen4540d002013-10-24 13:59:33 -0700132
Mark McClainb05c8762013-07-06 23:29:39 -0400133# List of config file names in addition to the main plugin config file
134# See _configure_neutron_common() for details about setting it up
135declare -a Q_PLUGIN_EXTRA_CONF_FILES
136
Mark McClainb05c8762013-07-06 23:29:39 -0400137
Dean Troyere2907b42014-02-26 17:35:37 -0600138Q_RR_CONF_FILE=$NEUTRON_CONF_DIR/rootwrap.conf
139if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
140 Q_RR_COMMAND="sudo"
141else
142 NEUTRON_ROOTWRAP=$(get_rootwrap_location neutron)
143 Q_RR_COMMAND="sudo $NEUTRON_ROOTWRAP $Q_RR_CONF_FILE"
Yuriy Taraday26623952014-07-16 17:41:53 +0400144 if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
145 Q_RR_DAEMON_COMMAND="sudo $NEUTRON_ROOTWRAP-daemon $Q_RR_CONF_FILE"
146 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400147fi
148
Brian Haleyeea76212014-06-27 11:45:50 -0400149
150# Distributed Virtual Router (DVR) configuration
151# Can be:
Dean Troyer3324f192014-09-18 09:26:39 -0500152# - ``legacy`` - No DVR functionality
153# - ``dvr_snat`` - Controller or single node DVR
154# - ``dvr`` - Compute node in multi-node DVR
155#
Brian Haleyeea76212014-06-27 11:45:50 -0400156Q_DVR_MODE=${Q_DVR_MODE:-legacy}
157if [[ "$Q_DVR_MODE" != "legacy" ]]; then
158 Q_ML2_PLUGIN_MECHANISM_DRIVERS=openvswitch,linuxbridge,l2population
159fi
160
Dean Troyere2907b42014-02-26 17:35:37 -0600161# Provider Network Configurations
162# --------------------------------
163
YAMAMOTO Takashi15130cd2014-10-28 11:49:58 +0900164# The following variables control the Neutron ML2 plugins' allocation
165# of tenant networks and availability of provider networks. If these
166# are not configured in ``localrc``, tenant networks will be local to
167# the host (with no remote connectivity), and no physical resources
168# will be available for the allocation of provider networks.
Dean Troyere2907b42014-02-26 17:35:37 -0600169
Attila Fazekas8feaf6c2014-07-27 20:47:04 +0200170# To disable tunnels (GRE or VXLAN) for tenant networks,
171# set to False in ``local.conf``.
172# GRE tunnels are only supported by the openvswitch.
173ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-True}
Dean Troyere2907b42014-02-26 17:35:37 -0600174
Richard Theis8906b482016-06-08 10:28:37 -0500175# If using GRE, VXLAN or GENEVE tunnels for tenant networks,
176# specify the range of IDs from which tenant networks are
177# allocated. Can be overridden in ``localrc`` if necessary.
Anant Patil3827dc02014-07-03 21:38:16 +0530178TENANT_TUNNEL_RANGES=${TENANT_TUNNEL_RANGES:-1:1000}
Dean Troyere2907b42014-02-26 17:35:37 -0600179
180# To use VLANs for tenant networks, set to True in localrc. VLANs
YAMAMOTO Takashi15130cd2014-10-28 11:49:58 +0900181# are supported by the ML2 plugins, requiring additional configuration
182# described below.
Dean Troyere2907b42014-02-26 17:35:37 -0600183ENABLE_TENANT_VLANS=${ENABLE_TENANT_VLANS:-False}
184
185# If using VLANs for tenant networks, set in ``localrc`` to specify
186# the range of VLAN VIDs from which tenant networks are
187# allocated. An external network switch must be configured to
188# trunk these VLANs between hosts for multi-host connectivity.
189#
190# Example: ``TENANT_VLAN_RANGE=1000:1999``
191TENANT_VLAN_RANGE=${TENANT_VLAN_RANGE:-}
192
193# If using VLANs for tenant networks, or if using flat or VLAN
194# provider networks, set in ``localrc`` to the name of the physical
195# network, and also configure ``OVS_PHYSICAL_BRIDGE`` for the
196# openvswitch agent or ``LB_PHYSICAL_INTERFACE`` for the linuxbridge
197# agent, as described below.
198#
199# Example: ``PHYSICAL_NETWORK=default``
Kevin Benton1554ade2016-07-22 09:40:19 -0700200PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-public}
Dean Troyere2907b42014-02-26 17:35:37 -0600201
YAMAMOTO Takashi15130cd2014-10-28 11:49:58 +0900202# With the openvswitch agent, if using VLANs for tenant networks,
Dean Troyere2907b42014-02-26 17:35:37 -0600203# or if using flat or VLAN provider networks, set in ``localrc`` to
204# the name of the OVS bridge to use for the physical network. The
205# bridge will be created if it does not already exist, but a
206# physical interface must be manually added to the bridge as a
207# port for external connectivity.
208#
209# Example: ``OVS_PHYSICAL_BRIDGE=br-eth1``
Kevin Benton1554ade2016-07-22 09:40:19 -0700210OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-br-ex}
Dean Troyere2907b42014-02-26 17:35:37 -0600211
Clark Boylan95469032016-09-08 17:08:36 -0700212default_route_dev=$(ip route | grep ^default | awk '{print $5}')
213die_if_not_set $LINENO default_route_dev "Failure retrieving default route device"
YAMAMOTO Takashi15130cd2014-10-28 11:49:58 +0900214# With the linuxbridge agent, if using VLANs for tenant networks,
Dean Troyere2907b42014-02-26 17:35:37 -0600215# or if using flat or VLAN provider networks, set in ``localrc`` to
216# the name of the network interface to use for the physical
217# network.
218#
219# Example: ``LB_PHYSICAL_INTERFACE=eth1``
Clark Boylan95469032016-09-08 17:08:36 -0700220LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-$default_route_dev}
Dean Troyere2907b42014-02-26 17:35:37 -0600221
Edgar Magana6f335b92014-07-10 15:42:44 -0700222# When Neutron tunnels are enabled it is needed to specify the
223# IP address of the end point in the local server. This IP is set
224# by default to the same IP address that the HOST IP.
225# This variable can be used to specify a different end point IP address
226# Example: ``TUNNEL_ENDPOINT_IP=1.1.1.1``
227TUNNEL_ENDPOINT_IP=${TUNNEL_ENDPOINT_IP:-$HOST_IP}
228
Dean Troyere2907b42014-02-26 17:35:37 -0600229# With the openvswitch plugin, set to True in ``localrc`` to enable
230# provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False.
231#
232# Example: ``OVS_ENABLE_TUNNELING=True``
233OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS}
234
Tan Lin27a196e2014-10-31 15:44:34 +0800235# Use DHCP agent for providing metadata service in the case of
236# without L3 agent (No Route Agent), set to True in localrc.
237ENABLE_ISOLATED_METADATA=${ENABLE_ISOLATED_METADATA:-False}
238
239# Add a static route as dhcp option, so the request to 169.254.169.254
240# will be able to reach through a route(DHCP agent)
241# This option require ENABLE_ISOLATED_METADATA = True
242ENABLE_METADATA_NETWORK=${ENABLE_METADATA_NETWORK:-False}
Mark McClainb05c8762013-07-06 23:29:39 -0400243# Neutron plugin specific functions
244# ---------------------------------
245
246# Please refer to ``lib/neutron_plugins/README.md`` for details.
Hirofumi Ichihara36daecd2015-07-23 17:50:40 +0900247if [ -f $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN ]; then
248 source $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN
249fi
Mark McClainb05c8762013-07-06 23:29:39 -0400250
Emilien Macchi40546f72013-09-24 15:10:25 +0200251# Agent metering service plugin functions
252# -------------------------------------------
253
254# Hardcoding for 1 service plugin for now
255source $TOP_DIR/lib/neutron_plugins/services/metering
256
Sean M. Collins2a242512016-05-03 09:03:09 -0400257# L3 Service functions
258source $TOP_DIR/lib/neutron_plugins/services/l3
Mark McClainb05c8762013-07-06 23:29:39 -0400259# Use security group or not
260if has_neutron_plugin_security_group; then
261 Q_USE_SECGROUP=${Q_USE_SECGROUP:-True}
262else
263 Q_USE_SECGROUP=False
264fi
265
Dean Troyere2907b42014-02-26 17:35:37 -0600266# Save trace setting
Ian Wienand523f4882015-10-13 11:03:03 +1100267_XTRACE_NEUTRON=$(set +o | grep xtrace)
Dean Troyere2907b42014-02-26 17:35:37 -0600268set +o xtrace
269
270
Mark McClainb05c8762013-07-06 23:29:39 -0400271# Functions
272# ---------
273
Adam Gandelman7614d212014-08-11 14:27:50 -0700274function _determine_config_server {
275 local cfg_file
276 local opts="--config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
277 for cfg_file in ${Q_PLUGIN_EXTRA_CONF_FILES[@]}; do
Tom Patzig73467042016-04-19 17:02:34 +0200278 opts+=" --config-file $cfg_file"
Adam Gandelman7614d212014-08-11 14:27:50 -0700279 done
280 echo "$opts"
281}
282
Adam Gandelman7614d212014-08-11 14:27:50 -0700283function _determine_config_l3 {
Angus Leesa1c70f22016-05-31 14:43:14 +1000284 local opts="--config-file $NEUTRON_CONF --config-file $Q_L3_CONF_FILE"
Adam Gandelman7614d212014-08-11 14:27:50 -0700285 echo "$opts"
286}
287
288# For services and agents that require it, dynamically construct a list of
289# --config-file arguments that are passed to the binary.
290function determine_config_files {
291 local opts=""
292 case "$1" in
293 "neutron-server") opts="$(_determine_config_server)" ;;
Adam Gandelman7614d212014-08-11 14:27:50 -0700294 "neutron-l3-agent") opts="$(_determine_config_l3)" ;;
295 esac
296 if [ -z "$opts" ] ; then
297 die $LINENO "Could not determine config files for $1."
298 fi
299 echo "$opts"
300}
301
Sean M. Collins2a242512016-05-03 09:03:09 -0400302# configure_mutnauq()
Mark McClainb05c8762013-07-06 23:29:39 -0400303# Set common config for all neutron server and agents.
Sean M. Collins2a242512016-05-03 09:03:09 -0400304function configure_mutnauq {
Mark McClainb05c8762013-07-06 23:29:39 -0400305 _configure_neutron_common
Brant Knudson2dd110c2015-03-14 12:39:14 -0500306 iniset_rpc_backend neutron $NEUTRON_CONF
Mark McClainb05c8762013-07-06 23:29:39 -0400307
308 # goes before q-svc to init Q_SERVICE_PLUGIN_CLASSES
Emilien Macchi40546f72013-09-24 15:10:25 +0200309 if is_service_enabled q-metering; then
310 _configure_neutron_metering
311 fi
Stephen Ma9b38eb22014-04-02 02:13:09 +0000312 if is_service_enabled q-agt q-svc; then
Mark McClainb05c8762013-07-06 23:29:39 -0400313 _configure_neutron_service
314 fi
315 if is_service_enabled q-agt; then
316 _configure_neutron_plugin_agent
317 fi
318 if is_service_enabled q-dhcp; then
319 _configure_neutron_dhcp_agent
320 fi
321 if is_service_enabled q-l3; then
322 _configure_neutron_l3_agent
323 fi
324 if is_service_enabled q-meta; then
325 _configure_neutron_metadata_agent
326 fi
327
Brian Haleyeea76212014-06-27 11:45:50 -0400328 if [[ "$Q_DVR_MODE" != "legacy" ]]; then
329 _configure_dvr
330 fi
Dina Belova58adaa62014-07-11 18:18:12 +0400331 if is_service_enabled ceilometer; then
332 _configure_neutron_ceilometer_notifications
333 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400334
armando-migliaccioe155b892015-06-12 08:55:02 -0700335 iniset $NEUTRON_CONF DEFAULT api_workers "$API_WORKERS"
Mark McClainb05c8762013-07-06 23:29:39 -0400336}
337
Ian Wienandaee18c72014-02-21 15:35:08 +1100338function create_nova_conf_neutron {
Sean Daguef21cc1f2016-03-04 11:08:32 -0500339 iniset $NOVA_CONF DEFAULT use_neutron True
Matthew Kassawara28af7962016-02-10 19:04:08 +0000340 iniset $NOVA_CONF neutron auth_type "password"
Brant Knudsone86b91b2016-05-03 15:21:47 -0500341 iniset $NOVA_CONF neutron auth_url "$KEYSTONE_AUTH_URI/v3"
Jamie Lennox394968f2015-08-28 09:18:26 +1000342 iniset $NOVA_CONF neutron username "$Q_ADMIN_USERNAME"
343 iniset $NOVA_CONF neutron password "$SERVICE_PASSWORD"
Jamie Lennoxcbcbd8f2016-01-21 16:08:14 -0600344 iniset $NOVA_CONF neutron user_domain_name "$SERVICE_DOMAIN_NAME"
Sean Dague7580a0c2016-02-17 06:23:36 -0500345 iniset $NOVA_CONF neutron project_name "$SERVICE_PROJECT_NAME"
Jamie Lennoxcbcbd8f2016-01-21 16:08:14 -0600346 iniset $NOVA_CONF neutron project_domain_name "$SERVICE_DOMAIN_NAME"
Gary Kotton13d385e2014-06-17 23:24:53 -0700347 iniset $NOVA_CONF neutron auth_strategy "$Q_AUTH_STRATEGY"
Bartosz Górski0abde392014-02-28 14:15:19 +0100348 iniset $NOVA_CONF neutron region_name "$REGION_NAME"
Rob Crittenden18d47782014-03-19 17:47:42 -0400349 iniset $NOVA_CONF neutron url "${Q_PROTOCOL}://$Q_HOST:$Q_PORT"
Mark McClainb05c8762013-07-06 23:29:39 -0400350
351 if [[ "$Q_USE_SECGROUP" == "True" ]]; then
352 LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver
Jeff Peeler1143f7e2013-10-31 16:21:52 -0400353 iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER
Mark McClainb05c8762013-07-06 23:29:39 -0400354 fi
355
Matt Riedemann925c2562015-08-25 13:40:25 -0700356 # optionally set options in nova_conf
Mark McClainb05c8762013-07-06 23:29:39 -0400357 neutron_plugin_create_nova_conf
358
Mark McClainb05c8762013-07-06 23:29:39 -0400359 if is_service_enabled q-meta; then
Gary Kottondd745502014-08-11 23:38:47 -0700360 iniset $NOVA_CONF neutron service_metadata_proxy "True"
Mark McClainb05c8762013-07-06 23:29:39 -0400361 fi
Aaron Rosencea32b12014-03-04 16:20:14 -0800362
363 iniset $NOVA_CONF DEFAULT vif_plugging_is_fatal "$VIF_PLUGGING_IS_FATAL"
364 iniset $NOVA_CONF DEFAULT vif_plugging_timeout "$VIF_PLUGGING_TIMEOUT"
Mark McClainb05c8762013-07-06 23:29:39 -0400365}
366
Sean M. Collins2a242512016-05-03 09:03:09 -0400367# create_mutnauq_accounts() - Set up common required neutron accounts
Mark McClainb05c8762013-07-06 23:29:39 -0400368
369# Tenant User Roles
370# ------------------------------------------------------------------
371# service neutron admin # if enabled
372
373# Migrated from keystone_data.sh
Sean M. Collins2a242512016-05-03 09:03:09 -0400374function create_mutnauq_accounts {
Mark McClainb05c8762013-07-06 23:29:39 -0400375 if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
Bartosz Górski0abde392014-02-28 14:15:19 +0100376
Jamie Lennox85ff5322015-01-28 14:28:01 +1000377 create_service_user "neutron"
Bartosz Górski0abde392014-02-28 14:15:19 +0100378
Sean Dague985e9582016-02-10 07:25:24 -0500379 get_or_create_service "neutron" "network" "Neutron Service"
Matt Riedemannae4578b2016-04-23 01:45:40 +0000380 get_or_create_endpoint \
Sean Dague985e9582016-02-10 07:25:24 -0500381 "network" \
382 "$REGION_NAME" \
383 "$Q_PROTOCOL://$SERVICE_HOST:$Q_PORT/" \
384 "$Q_PROTOCOL://$SERVICE_HOST:$Q_PORT/" \
385 "$Q_PROTOCOL://$SERVICE_HOST:$Q_PORT/"
Mark McClainb05c8762013-07-06 23:29:39 -0400386 fi
387}
388
Sean M. Collins2a242512016-05-03 09:03:09 -0400389# init_mutnauq() - Initialize databases, etc.
390function init_mutnauq {
Ihar Hrachyshka157c84b2014-10-06 13:29:39 +0200391 recreate_database $Q_DB_NAME
Salvatore Orlandodd649882013-08-05 08:56:17 -0700392 # Run Neutron db migrations
393 $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 -0400394}
395
Sean M. Collins2a242512016-05-03 09:03:09 -0400396# install_mutnauq() - Collect source and prepare
397function install_mutnauq {
Doug Wiegley86561c32016-02-10 18:37:21 -0700398 # Install neutron-lib from git so we make sure we're testing
399 # the latest code.
400 if use_library_from_git "neutron-lib"; then
401 git_clone_by_name "neutron-lib"
402 setup_dev_lib "neutron-lib"
403 fi
404
Mark McClainb05c8762013-07-06 23:29:39 -0400405 git_clone $NEUTRON_REPO $NEUTRON_DIR $NEUTRON_BRANCH
406 setup_develop $NEUTRON_DIR
Mate Lakat6df64892014-10-17 13:09:49 +0200407
408 if [ "$VIRT_DRIVER" == 'xenserver' ]; then
409 local dom0_ip
410 dom0_ip=$(echo "$XENAPI_CONNECTION_URL" | cut -d "/" -f 3-)
411
412 local ssh_dom0
413 ssh_dom0="sudo -u $DOMZERO_USER ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$dom0_ip"
414
415 # Find where the plugins should go in dom0
416 local xen_functions
417 xen_functions=$(cat $TOP_DIR/tools/xen/functions)
418 local plugin_dir
419 plugin_dir=$($ssh_dom0 "$xen_functions; set -eux; xapi_plugin_location")
420
421 # install neutron plugins to dom0
Huan Xie201e3c12015-08-27 12:34:24 +0100422 tar -czf - -C $NEUTRON_DIR/neutron/plugins/ml2/drivers/openvswitch/agent/xenapi/etc/xapi.d/plugins/ ./ |
Mate Lakat6df64892014-10-17 13:09:49 +0200423 $ssh_dom0 "tar -xzf - -C $plugin_dir && chmod a+x $plugin_dir/*"
424 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400425}
426
Mark McClainb05c8762013-07-06 23:29:39 -0400427# install_neutron_agent_packages() - Collect source and prepare
Ian Wienandaee18c72014-02-21 15:35:08 +1100428function install_neutron_agent_packages {
Robert Li72b3e442014-07-17 15:04:52 -0400429 # radvd doesn't come with the OS. Install it if the l3 service is enabled.
430 if is_service_enabled q-l3; then
431 install_package radvd
432 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400433 # install packages that are specific to plugin agent(s)
434 if is_service_enabled q-agt q-dhcp q-l3; then
435 neutron_plugin_install_agent_packages
436 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400437}
438
439# Start running processes, including screen
Ian Wienandaee18c72014-02-21 15:35:08 +1100440function start_neutron_service_and_check {
Rob Crittenden18d47782014-03-19 17:47:42 -0400441 local service_port=$Q_PORT
442 local service_protocol=$Q_PROTOCOL
Ian Wienand7ae97292016-02-16 14:50:53 +1100443 local cfg_file_options
444
445 cfg_file_options="$(determine_config_files neutron-server)"
446
Rob Crittenden18d47782014-03-19 17:47:42 -0400447 if is_service_enabled tls-proxy; then
448 service_port=$Q_PORT_INT
449 service_protocol="http"
450 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400451 # Start the Neutron service
Davanum Srinivas59756e92015-09-23 17:42:54 -0400452 run_process q-svc "$NEUTRON_BIN_DIR/neutron-server $cfg_file_options"
Mark McClainb05c8762013-07-06 23:29:39 -0400453 echo "Waiting for Neutron to start..."
Rob Crittenden18d47782014-03-19 17:47:42 -0400454 if is_ssl_enabled_service "neutron"; then
455 ssl_ca="--ca-certificate=${SSL_BUNDLE_FILE}"
456 fi
Sean Dague442e4e92015-06-24 13:24:02 -0400457
458 local testcmd="wget ${ssl_ca} --no-proxy -q -O- $service_protocol://$Q_HOST:$service_port"
459 test_with_retry "$testcmd" "Neutron did not start" $SERVICE_TIMEOUT
460
Rob Crittenden18d47782014-03-19 17:47:42 -0400461 # Start proxy if enabled
462 if is_service_enabled tls-proxy; then
Gregory Haynes4b49e402016-08-31 18:19:51 -0700463 start_tls_proxy neutron '*' $Q_PORT $Q_HOST $Q_PORT_INT
Rob Crittenden18d47782014-03-19 17:47:42 -0400464 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400465}
466
Russell Bryant09b94602015-06-08 15:25:43 -0400467# Control of the l2 agent is separated out to make it easier to test partial
468# upgrades (everything upgraded except the L2 agent)
Sean M. Collins2a242512016-05-03 09:03:09 -0400469function start_mutnauq_l2_agent {
Davanum Srinivas59756e92015-09-23 17:42:54 -0400470 run_process q-agt "$AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE"
Nachi Ueno584750f2013-07-15 18:22:21 -0700471
Kahou Leid663e292015-10-24 12:18:57 -0700472 if is_provider_network && [[ $Q_AGENT == "openvswitch" ]]; then
Zhongyue Luo56b7efb2014-12-16 11:36:49 +0800473 sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
Sean M. Collins5ec6f8f2014-05-14 17:01:03 -0400474 sudo ip link set $OVS_PHYSICAL_BRIDGE up
475 sudo ip link set br-int up
476 sudo ip link set $PUBLIC_INTERFACE up
yunhong jiangae9ee6b2014-10-08 07:01:02 -0700477 if is_ironic_hardware; then
478 for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do
479 sudo ip addr del $IP dev $PUBLIC_INTERFACE
480 sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE
481 done
gong yong sheng348c6ac2015-06-23 14:03:47 +0800482 sudo ip route replace $FIXED_RANGE via $NETWORK_GATEWAY dev $OVS_PHYSICAL_BRIDGE
yunhong jiangae9ee6b2014-10-08 07:01:02 -0700483 fi
Sean M. Collins5ec6f8f2014-05-14 17:01:03 -0400484 fi
Russell Bryant09b94602015-06-08 15:25:43 -0400485}
486
Sean M. Collins2a242512016-05-03 09:03:09 -0400487function start_mutnauq_other_agents {
Angus Leesa1c70f22016-05-31 14:43:14 +1000488 run_process q-dhcp "$AGENT_DHCP_BINARY --config-file $NEUTRON_CONF --config-file $Q_DHCP_CONF_FILE"
Sean M. Collins5ec6f8f2014-05-14 17:01:03 -0400489
Paul Michalie4289c82015-08-14 11:49:27 -0400490 if is_service_enabled neutron-vpnaas; then
491 : # Started by plugin
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700492 else
Davanum Srinivas59756e92015-09-23 17:42:54 -0400493 run_process q-l3 "$AGENT_L3_BINARY $(determine_config_files neutron-l3-agent)"
Ravi Chunduru95c93e22013-07-16 04:18:47 -0700494 fi
495
Angus Leesa1c70f22016-05-31 14:43:14 +1000496 run_process q-meta "$AGENT_META_BINARY --config-file $NEUTRON_CONF --config-file $Q_META_CONF_FILE"
Davanum Srinivas59756e92015-09-23 17:42:54 -0400497 run_process q-metering "$AGENT_METERING_BINARY --config-file $NEUTRON_CONF --config-file $METERING_AGENT_CONF_FILENAME"
Mark McClainb05c8762013-07-06 23:29:39 -0400498
499 if [ "$VIRT_DRIVER" = 'xenserver' ]; then
500 # For XenServer, start an agent for the domU openvswitch
Davanum Srinivas59756e92015-09-23 17:42:54 -0400501 run_process q-domua "$AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE.domU"
Mark McClainb05c8762013-07-06 23:29:39 -0400502 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400503}
504
Russell Bryant09b94602015-06-08 15:25:43 -0400505# Start running processes, including screen
506function start_neutron_agents {
507 # Start up the neutron agents if enabled
Sean M. Collins2a242512016-05-03 09:03:09 -0400508 start_mutnauq_l2_agent
509 start_mutnauq_other_agents
Russell Bryant09b94602015-06-08 15:25:43 -0400510}
511
Sean M. Collins2a242512016-05-03 09:03:09 -0400512function stop_mutnauq_l2_agent {
Russell Bryant09b94602015-06-08 15:25:43 -0400513 stop_process q-agt
Huan Xie54482cd2016-10-09 09:47:48 +0000514
515 if [ "$VIRT_DRIVER" = 'xenserver' ]; then
516 stop_process q-domua
517 fi
Russell Bryant09b94602015-06-08 15:25:43 -0400518}
519
Sean M. Collins2a242512016-05-03 09:03:09 -0400520# stop_mutnauq_other() - Stop running processes (non-screen)
521function stop_mutnauq_other {
Mark McClainb05c8762013-07-06 23:29:39 -0400522 if is_service_enabled q-dhcp; then
Chris Dent36891dc2015-02-03 16:22:44 +0000523 stop_process q-dhcp
Mark McClainb05c8762013-07-06 23:29:39 -0400524 pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }')
525 [ ! -z "$pid" ] && sudo kill -9 $pid
526 fi
Chris Dent36891dc2015-02-03 16:22:44 +0000527
528 stop_process q-svc
Li Maa15d9de2016-01-19 19:11:51 +0800529
530 if is_service_enabled q-l3; then
531 sudo pkill -f "radvd -C $DATA_DIR/neutron/ra"
532 stop_process q-l3
533 fi
Chris Dent36891dc2015-02-03 16:22:44 +0000534
Mark McClainb05c8762013-07-06 23:29:39 -0400535 if is_service_enabled q-meta; then
Jakub Libosvar1f763282014-01-28 23:01:38 +0100536 sudo pkill -9 -f neutron-ns-metadata-proxy || :
Chris Dent36891dc2015-02-03 16:22:44 +0000537 stop_process q-meta
Mark McClainb05c8762013-07-06 23:29:39 -0400538 fi
Akihiro Motokiedddb1f2013-12-09 20:21:06 +0900539
Akihiro Motokiedddb1f2013-12-09 20:21:06 +0900540 if is_service_enabled q-metering; then
541 neutron_metering_stop
542 fi
Li Ma50120fa2015-12-13 10:41:34 +0800543
544 if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
545 sudo pkill -9 -f $NEUTRON_ROOTWRAP-daemon || :
546 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400547}
548
Russell Bryant09b94602015-06-08 15:25:43 -0400549# stop_neutron() - Stop running processes (non-screen)
Sean M. Collins2a242512016-05-03 09:03:09 -0400550function stop_mutnauq {
551 stop_mutnauq_other
552 stop_mutnauq_l2_agent
Russell Bryant09b94602015-06-08 15:25:43 -0400553}
554
Sean M. Collins00e16a92015-02-20 11:45:21 -0500555# _move_neutron_addresses_route() - Move the primary IP to the OVS bridge
Adam Kacmarsky6b172c82015-08-13 15:14:05 -0600556# on startup, or back to the public interface on cleanup. If no IP is
557# configured on the interface, just add it as a port to the OVS bridge.
Sean M. Collins00e16a92015-02-20 11:45:21 -0500558function _move_neutron_addresses_route {
559 local from_intf=$1
560 local to_intf=$2
561 local add_ovs_port=$3
Brian Haleya0d1b012015-11-16 17:30:48 -0500562 local del_ovs_port=$4
563 local af=$5
Sean M. Collins00e16a92015-02-20 11:45:21 -0500564
565 if [[ -n "$from_intf" && -n "$to_intf" ]]; then
566 # Remove the primary IP address from $from_intf and add it to $to_intf,
567 # along with the default route, if it exists. Also, when called
568 # on configure we will also add $from_intf as a port on $to_intf,
569 # assuming it is an OVS bridge.
570
Matt McEuene24707b2016-07-11 08:37:59 -0500571 local IP_REPLACE=""
Adam Kacmarsky6b172c82015-08-13 15:14:05 -0600572 local IP_DEL=""
Shinobu KINJOf95315b2015-11-07 10:21:08 +0900573 local IP_UP=""
Ian Wienandada886d2015-10-07 14:06:26 +1100574 local DEFAULT_ROUTE_GW
Sean M. Collins59e86a32015-11-09 11:06:39 -0500575 DEFAULT_ROUTE_GW=$(ip -f $af r | awk "/default.+$from_intf/ { print \$3; exit }")
Sean M. Collins00e16a92015-02-20 11:45:21 -0500576 local ADD_OVS_PORT=""
Brian Haleya0d1b012015-11-16 17:30:48 -0500577 local DEL_OVS_PORT=""
Sean M. Collins17398a32016-05-11 18:24:46 +0000578 local ARP_CMD=""
Sean M. Collins00e16a92015-02-20 11:45:21 -0500579
Brian Haleybb9caea2015-11-16 17:18:42 -0500580 IP_BRD=$(ip -f $af a s dev $from_intf scope global primary | grep inet | awk '{ print $2, $3, $4; exit }')
Adam Kacmarsky11298a02015-06-26 14:49:47 -0600581
Sean M. Collins00e16a92015-02-20 11:45:21 -0500582 if [ "$DEFAULT_ROUTE_GW" != "" ]; then
Sean M. Collins59e86a32015-11-09 11:06:39 -0500583 ADD_DEFAULT_ROUTE="sudo ip -f $af r replace default via $DEFAULT_ROUTE_GW dev $to_intf"
Sean M. Collins00e16a92015-02-20 11:45:21 -0500584 fi
585
586 if [[ "$add_ovs_port" == "True" ]]; then
Raman Budnydb02bbf2015-03-31 13:09:09 +0300587 ADD_OVS_PORT="sudo ovs-vsctl --may-exist add-port $to_intf $from_intf"
Sean M. Collins00e16a92015-02-20 11:45:21 -0500588 fi
589
Brian Haleya0d1b012015-11-16 17:30:48 -0500590 if [[ "$del_ovs_port" == "True" ]]; then
591 DEL_OVS_PORT="sudo ovs-vsctl --if-exists del-port $from_intf $to_intf"
592 fi
593
Adam Kacmarsky6b172c82015-08-13 15:14:05 -0600594 if [[ "$IP_BRD" != "" ]]; then
Brian Haley94510212015-09-02 15:40:04 -0400595 IP_DEL="sudo ip addr del $IP_BRD dev $from_intf"
Matt McEuene24707b2016-07-11 08:37:59 -0500596 IP_REPLACE="sudo ip addr replace $IP_BRD dev $to_intf"
Shinobu KINJOf95315b2015-11-07 10:21:08 +0900597 IP_UP="sudo ip link set $to_intf up"
Sean M. Collins6d4843e2016-05-12 16:14:26 -0400598 if [[ "$af" == "inet" ]]; then
599 IP=$(echo $IP_BRD | awk '{ print $1; exit }' | grep -o -E '(.*)/' | cut -d "/" -f1)
600 ARP_CMD="arping -A -c 3 -w 4.5 -I $to_intf $IP "
601 fi
Adam Kacmarsky6b172c82015-08-13 15:14:05 -0600602 fi
603
Brian Haleya0d1b012015-11-16 17:30:48 -0500604 # The add/del OVS port calls have to happen either before or
605 # after the address is moved in order to not leave it orphaned.
Matt McEuene24707b2016-07-11 08:37:59 -0500606 $DEL_OVS_PORT; $IP_DEL; $IP_REPLACE; $IP_UP; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE; $ARP_CMD
Sean M. Collins00e16a92015-02-20 11:45:21 -0500607 fi
608}
609
Sean M. Collins2a242512016-05-03 09:03:09 -0400610# cleanup_mutnauq() - Remove residual data files, anything left over from previous
Mark McClainb05c8762013-07-06 23:29:39 -0400611# runs that a clean run would need to clean up
Sean M. Collins2a242512016-05-03 09:03:09 -0400612function cleanup_mutnauq {
Sean M. Collins00e16a92015-02-20 11:45:21 -0500613
Yalei Wang316b3482015-07-15 21:00:31 +0800614 if [[ -n "$OVS_PHYSICAL_BRIDGE" ]]; then
Brian Haleya0d1b012015-11-16 17:30:48 -0500615 _move_neutron_addresses_route "$OVS_PHYSICAL_BRIDGE" "$PUBLIC_INTERFACE" False True "inet"
Adam Kacmarsky11298a02015-06-26 14:49:47 -0600616
Yalei Wang316b3482015-07-15 21:00:31 +0800617 if [[ $(ip -f inet6 a s dev "$OVS_PHYSICAL_BRIDGE" | grep -c 'global') != 0 ]]; then
Sean M. Collins790266f2015-11-11 13:36:35 -0500618 # ip(8) wants the prefix length when deleting
619 local v6_gateway
620 v6_gateway=$(ip -6 a s dev $OVS_PHYSICAL_BRIDGE | grep $IPV6_PUBLIC_NETWORK_GATEWAY | awk '{ print $2 }')
621 sudo ip -6 addr del $v6_gateway dev $OVS_PHYSICAL_BRIDGE
Brian Haleya0d1b012015-11-16 17:30:48 -0500622 _move_neutron_addresses_route "$OVS_PHYSICAL_BRIDGE" "$PUBLIC_INTERFACE" False False "inet6"
Yalei Wang316b3482015-07-15 21:00:31 +0800623 fi
Sean M. Collins00e16a92015-02-20 11:45:21 -0500624
Yalei Wang316b3482015-07-15 21:00:31 +0800625 if is_provider_network && is_ironic_hardware; then
626 for IP in $(ip addr show dev $OVS_PHYSICAL_BRIDGE | grep ' inet ' | awk '{print $2}'); do
627 sudo ip addr del $IP dev $OVS_PHYSICAL_BRIDGE
628 sudo ip addr add $IP dev $PUBLIC_INTERFACE
629 done
630 sudo route del -net $FIXED_RANGE gw $NETWORK_GATEWAY dev $OVS_PHYSICAL_BRIDGE
631 fi
yunhong jiangae9ee6b2014-10-08 07:01:02 -0700632 fi
633
Mark McClainb05c8762013-07-06 23:29:39 -0400634 if is_neutron_ovs_base_plugin; then
635 neutron_ovs_base_cleanup
636 fi
637
Sean M. Collins7bc2af72015-06-08 12:36:30 -0400638 if [[ $Q_AGENT == "linuxbridge" ]]; then
639 neutron_lb_cleanup
640 fi
641
Mark McClainb05c8762013-07-06 23:29:39 -0400642 # delete all namespaces created by neutron
Doug Wiegley7e40c642016-08-20 16:32:14 +0000643 for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|fip|snat)-[0-9a-f-]*'); do
Mark McClainb05c8762013-07-06 23:29:39 -0400644 sudo ip netns delete ${ns}
645 done
646}
647
Doug Wiegley93e682c2015-03-03 10:31:30 -0700648
Maru Newby952fd902015-01-30 22:27:12 +0000649function _create_neutron_conf_dir {
Mark McClainb05c8762013-07-06 23:29:39 -0400650 # Put config files in ``NEUTRON_CONF_DIR`` for everyone to find
Dean Troyer8421c2b2015-03-16 13:52:19 -0500651 sudo install -d -o $STACK_USER $NEUTRON_CONF_DIR
Maru Newby952fd902015-01-30 22:27:12 +0000652}
653
654# _configure_neutron_common()
655# Set common config for all neutron server and agents.
656# This MUST be called before other ``_configure_neutron_*`` functions.
657function _configure_neutron_common {
658 _create_neutron_conf_dir
Mark McClainb05c8762013-07-06 23:29:39 -0400659
Martin Hickey30d5fae2015-11-10 13:44:15 +0000660 # Uses oslo config generator to generate core sample configuration files
661 (cd $NEUTRON_DIR && exec ./tools/generate_config_file_samples.sh)
662
663 cp $NEUTRON_DIR/etc/neutron.conf.sample $NEUTRON_CONF
Mark McClainb05c8762013-07-06 23:29:39 -0400664
Jerry Zhao296c1e32015-08-07 20:43:54 -0400665 Q_POLICY_FILE=$NEUTRON_CONF_DIR/policy.json
666 cp $NEUTRON_DIR/etc/policy.json $Q_POLICY_FILE
667
668 # allow neutron user to administer neutron to match neutron account
669 sed -i 's/"context_is_admin": "role:admin"/"context_is_admin": "role:admin or user_name:neutron"/g' $Q_POLICY_FILE
670
Mark McClainb05c8762013-07-06 23:29:39 -0400671 # Set plugin-specific variables ``Q_DB_NAME``, ``Q_PLUGIN_CLASS``.
672 # For main plugin config file, set ``Q_PLUGIN_CONF_PATH``, ``Q_PLUGIN_CONF_FILENAME``.
Tom Patzig67223b02016-04-19 16:43:05 +0200673 # For additional plugin config files, set ``Q_PLUGIN_EXTRA_CONF_PATH`` and
Mark McClainb05c8762013-07-06 23:29:39 -0400674 # ``Q_PLUGIN_EXTRA_CONF_FILES``. For example:
Adam Spierscb961592013-10-05 12:11:07 +0100675 #
Tom Patzig67223b02016-04-19 16:43:05 +0200676 # ``Q_PLUGIN_EXTRA_CONF_PATH=/path/to/plugins``
Boden R82bca442016-04-15 10:56:09 -0600677 # ``Q_PLUGIN_EXTRA_CONF_FILES=(file1 file2)``
Mark McClainb05c8762013-07-06 23:29:39 -0400678 neutron_plugin_configure_common
679
sbauzae2c4ee22013-08-29 17:29:46 +0200680 if [[ "$Q_PLUGIN_CONF_PATH" == '' || "$Q_PLUGIN_CONF_FILENAME" == '' || "$Q_PLUGIN_CLASS" == '' ]]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400681 die $LINENO "Neutron plugin not set.. exiting"
682 fi
683
684 # If needed, move config file from ``$NEUTRON_DIR/etc/neutron`` to ``NEUTRON_CONF_DIR``
685 mkdir -p /$Q_PLUGIN_CONF_PATH
686 Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
Hirofumi Ichihara97cc85b2015-09-08 13:51:01 +0900687 # NOTE(hichihara): Some neutron vendor plugins were already decomposed and
688 # there is no config file in Neutron tree. They should prepare the file in each plugin.
Martin Hickey30d5fae2015-11-10 13:44:15 +0000689 if [ -f "$NEUTRON_DIR/$Q_PLUGIN_CONF_FILE.sample" ]; then
690 cp "$NEUTRON_DIR/$Q_PLUGIN_CONF_FILE.sample" /$Q_PLUGIN_CONF_FILE
691 elif [ -f $NEUTRON_DIR/$Q_PLUGIN_CONF_FILE ]; then
Hirofumi Ichihara97cc85b2015-09-08 13:51:01 +0900692 cp $NEUTRON_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE
693 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400694
Ihar Hrachyshkab816e5d2014-07-21 13:53:50 +0200695 iniset $NEUTRON_CONF database connection `database_connection_url $Q_DB_NAME`
Mark McClainb05c8762013-07-06 23:29:39 -0400696 iniset $NEUTRON_CONF DEFAULT state_path $DATA_DIR/neutron
salvatoree4e535b2014-10-29 18:22:46 +0100697 iniset $NEUTRON_CONF DEFAULT use_syslog $SYSLOG
Brian Haley180f5eb2015-06-16 13:14:31 -0400698 iniset $NEUTRON_CONF DEFAULT bind_host $Q_LISTEN_ADDRESS
Martin Hickey30d5fae2015-11-10 13:44:15 +0000699 iniset $NEUTRON_CONF oslo_concurrency lock_path $DATA_DIR/neutron/lock
700
Victor Ryzhenkin878d7d82016-04-27 15:15:52 +0300701 # NOTE(freerunner): Need to adjust Region Name for nova in multiregion installation
702 iniset $NEUTRON_CONF nova region_name $REGION_NAME
703
Mark McClainb05c8762013-07-06 23:29:39 -0400704 # If addition config files are set, make sure their path name is set as well
705 if [[ ${#Q_PLUGIN_EXTRA_CONF_FILES[@]} > 0 && $Q_PLUGIN_EXTRA_CONF_PATH == '' ]]; then
706 die $LINENO "Neutron additional plugin config not set.. exiting"
707 fi
708
709 # If additional config files exist, copy them over to neutron configuration
710 # directory
711 if [[ $Q_PLUGIN_EXTRA_CONF_PATH != '' ]]; then
Mark McClainb05c8762013-07-06 23:29:39 -0400712 local f
713 for (( f=0; $f < ${#Q_PLUGIN_EXTRA_CONF_FILES[@]}; f+=1 )); do
714 Q_PLUGIN_EXTRA_CONF_FILES[$f]=$Q_PLUGIN_EXTRA_CONF_PATH/${Q_PLUGIN_EXTRA_CONF_FILES[$f]}
Mark McClainb05c8762013-07-06 23:29:39 -0400715 done
716 fi
717
Joe Gordonbee5c502013-08-30 13:48:08 -0400718 if [ "$VIRT_DRIVER" = 'fake' ]; then
719 # Disable arbitrary limits
720 iniset $NEUTRON_CONF quotas quota_network -1
721 iniset $NEUTRON_CONF quotas quota_subnet -1
722 iniset $NEUTRON_CONF quotas quota_port -1
723 iniset $NEUTRON_CONF quotas quota_security_group -1
724 iniset $NEUTRON_CONF quotas quota_security_group_rule -1
725 fi
726
Salvatore Orlando05ae8332013-08-20 14:51:08 -0700727 # Format logging
728 if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
Salvatore Orlandobc7f6432013-11-25 10:11:14 -0800729 setup_colorized_logging $NEUTRON_CONF DEFAULT project_id
venkata anil9b1df572015-01-15 07:38:22 +0000730 else
731 # Show user_name and project_name by default like in nova
Ronald Bradforde8264902016-01-20 21:16:33 +0000732 iniset $NEUTRON_CONF DEFAULT logging_user_identity_format "%(user_name)s %(project_name)s"
Salvatore Orlando05ae8332013-08-20 14:51:08 -0700733 fi
734
Rob Crittenden18d47782014-03-19 17:47:42 -0400735 if is_service_enabled tls-proxy; then
736 # Set the service port for a proxy to take the original
737 iniset $NEUTRON_CONF DEFAULT bind_port "$Q_PORT_INT"
738 fi
739
740 if is_ssl_enabled_service "nova"; then
Jamie Lennoxdc757dd2015-03-09 14:48:09 +1100741 iniset $NEUTRON_CONF nova cafile $SSL_BUNDLE_FILE
Rob Crittenden18d47782014-03-19 17:47:42 -0400742 fi
743
744 if is_ssl_enabled_service "neutron"; then
745 ensure_certificates NEUTRON
746
747 iniset $NEUTRON_CONF DEFAULT use_ssl True
748 iniset $NEUTRON_CONF DEFAULT ssl_cert_file "$NEUTRON_SSL_CERT"
749 iniset $NEUTRON_CONF DEFAULT ssl_key_file "$NEUTRON_SSL_KEY"
750 fi
751
Mark McClainb05c8762013-07-06 23:29:39 -0400752 _neutron_setup_rootwrap
753}
754
Ian Wienandaee18c72014-02-21 15:35:08 +1100755function _configure_neutron_dhcp_agent {
Mark McClainb05c8762013-07-06 23:29:39 -0400756
Martin Hickey30d5fae2015-11-10 13:44:15 +0000757 cp $NEUTRON_DIR/etc/dhcp_agent.ini.sample $Q_DHCP_CONF_FILE
Mark McClainb05c8762013-07-06 23:29:39 -0400758
Ben Nemec03997942013-08-10 09:56:16 -0500759 iniset $Q_DHCP_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Sean Dague78801c12016-08-04 14:10:07 -0400760 # make it so we have working DNS from guests
761 iniset $Q_DHCP_CONF_FILE DEFAULT dnsmasq_local_resolv True
Hirofumi Ichihara2bb3a642015-08-18 12:59:08 -0700762 iniset $Q_DHCP_CONF_FILE AGENT root_helper "$Q_RR_COMMAND"
Yuriy Taraday26623952014-07-16 17:41:53 +0400763 if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
Hirofumi Ichihara2bb3a642015-08-18 12:59:08 -0700764 iniset $Q_DHCP_CONF_FILE AGENT root_helper_daemon "$Q_RR_DAEMON_COMMAND"
Yuriy Taraday26623952014-07-16 17:41:53 +0400765 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400766
Tan Lin27a196e2014-10-31 15:44:34 +0800767 if ! is_service_enabled q-l3; then
768 if [[ "$ENABLE_ISOLATED_METADATA" = "True" ]]; then
769 iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata $ENABLE_ISOLATED_METADATA
770 iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network $ENABLE_METADATA_NETWORK
771 else
772 if [[ "$ENABLE_METADATA_NETWORK" = "True" ]]; then
773 die "$LINENO" "Enable isolated metadata is a must for metadata network"
774 fi
775 fi
776 fi
777
Mark McClainb05c8762013-07-06 23:29:39 -0400778 _neutron_setup_interface_driver $Q_DHCP_CONF_FILE
779
xurong000379977ef31d02016-07-05 11:09:40 +0800780 neutron_plugin_configure_dhcp_agent $Q_DHCP_CONF_FILE
Mark McClainb05c8762013-07-06 23:29:39 -0400781}
782
Mark McClainb05c8762013-07-06 23:29:39 -0400783
Ian Wienandaee18c72014-02-21 15:35:08 +1100784function _configure_neutron_metadata_agent {
Martin Hickey30d5fae2015-11-10 13:44:15 +0000785 cp $NEUTRON_DIR/etc/metadata_agent.ini.sample $Q_META_CONF_FILE
Mark McClainb05c8762013-07-06 23:29:39 -0400786
Ben Nemec03997942013-08-10 09:56:16 -0500787 iniset $Q_META_CONF_FILE DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400788 iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP
Hirofumi Ichihara2bb3a642015-08-18 12:59:08 -0700789 iniset $Q_META_CONF_FILE AGENT root_helper "$Q_RR_COMMAND"
Yuriy Taraday26623952014-07-16 17:41:53 +0400790 if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
Hirofumi Ichihara2bb3a642015-08-18 12:59:08 -0700791 iniset $Q_META_CONF_FILE AGENT root_helper_daemon "$Q_RR_DAEMON_COMMAND"
Yuriy Taraday26623952014-07-16 17:41:53 +0400792 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400793}
794
Dina Belova58adaa62014-07-11 18:18:12 +0400795function _configure_neutron_ceilometer_notifications {
Wanlong Gaocf04a9a2016-01-16 17:46:35 +0800796 iniset $NEUTRON_CONF oslo_messaging_notifications driver messaging
Dina Belova58adaa62014-07-11 18:18:12 +0400797}
798
Ian Wienandaee18c72014-02-21 15:35:08 +1100799function _configure_neutron_metering {
Emilien Macchi40546f72013-09-24 15:10:25 +0200800 neutron_agent_metering_configure_common
801 neutron_agent_metering_configure_agent
802}
803
Brian Haleyeea76212014-06-27 11:45:50 -0400804function _configure_dvr {
805 iniset $NEUTRON_CONF DEFAULT router_distributed True
806 iniset $Q_L3_CONF_FILE DEFAULT agent_mode $Q_DVR_MODE
807}
808
809
Mark McClainb05c8762013-07-06 23:29:39 -0400810# _configure_neutron_plugin_agent() - Set config files for neutron plugin agent
811# It is called when q-agt is enabled.
Ian Wienandaee18c72014-02-21 15:35:08 +1100812function _configure_neutron_plugin_agent {
Mark McClainb05c8762013-07-06 23:29:39 -0400813 # Specify the default root helper prior to agent configuration to
814 # ensure that an agent's configuration can override the default
815 iniset /$Q_PLUGIN_CONF_FILE agent root_helper "$Q_RR_COMMAND"
Yuriy Taraday26623952014-07-16 17:41:53 +0400816 if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
817 iniset /$Q_PLUGIN_CONF_FILE agent root_helper_daemon "$Q_RR_DAEMON_COMMAND"
818 fi
Ben Nemec03997942013-08-10 09:56:16 -0500819 iniset $NEUTRON_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Mark McClainb05c8762013-07-06 23:29:39 -0400820
821 # Configure agent for plugin
822 neutron_plugin_configure_plugin_agent
823}
824
825# _configure_neutron_service() - Set config files for neutron service
826# It is called when q-svc is enabled.
Ian Wienandaee18c72014-02-21 15:35:08 +1100827function _configure_neutron_service {
Mark McClainb05c8762013-07-06 23:29:39 -0400828 Q_API_PASTE_FILE=$NEUTRON_CONF_DIR/api-paste.ini
Mark McClainb05c8762013-07-06 23:29:39 -0400829 cp $NEUTRON_DIR/etc/api-paste.ini $Q_API_PASTE_FILE
Kevin Benton08a5fcc2014-07-18 16:06:12 -0700830
Mark McClainb05c8762013-07-06 23:29:39 -0400831 # Update either configuration file with plugin
832 iniset $NEUTRON_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS
833
834 if [[ $Q_SERVICE_PLUGIN_CLASSES != '' ]]; then
835 iniset $NEUTRON_CONF DEFAULT service_plugins $Q_SERVICE_PLUGIN_CLASSES
836 fi
837
Ben Nemec03997942013-08-10 09:56:16 -0500838 iniset $NEUTRON_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
Chris Dent74a85b02015-04-22 18:02:39 +0000839 iniset $NEUTRON_CONF oslo_policy policy_file $Q_POLICY_FILE
Mark McClainb05c8762013-07-06 23:29:39 -0400840 iniset $NEUTRON_CONF DEFAULT allow_overlapping_ips $Q_ALLOW_OVERLAPPING_IP
841
842 iniset $NEUTRON_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY
843 _neutron_setup_keystone $NEUTRON_CONF keystone_authtoken
844
Atsushi SAKAIfe7b56c2015-11-13 17:06:16 +0900845 # Configuration for neutron notifications to nova.
Terry Wilsonf06c4432014-05-20 10:54:51 -0500846 iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_status_changes $Q_NOTIFY_NOVA_PORT_STATUS_CHANGES
847 iniset $NEUTRON_CONF DEFAULT notify_nova_on_port_data_changes $Q_NOTIFY_NOVA_PORT_DATA_CHANGES
Jamie Lennoxdc757dd2015-03-09 14:48:09 +1100848
Thomas Bechtoldfb948912016-03-27 08:59:42 +0200849 configure_auth_token_middleware $NEUTRON_CONF nova $NEUTRON_AUTH_CACHE_DIR nova
Aaron Rosencea32b12014-03-04 16:20:14 -0800850
Mark McClainb05c8762013-07-06 23:29:39 -0400851 # Configure plugin
852 neutron_plugin_configure_service
853}
854
855# Utility Functions
856#------------------
857
Isaku Yamahata9e136b42013-12-16 15:52:03 +0900858# _neutron_service_plugin_class_add() - add service plugin class
Ian Wienandaee18c72014-02-21 15:35:08 +1100859function _neutron_service_plugin_class_add {
Isaku Yamahata9e136b42013-12-16 15:52:03 +0900860 local service_plugin_class=$1
861 if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then
862 Q_SERVICE_PLUGIN_CLASSES=$service_plugin_class
863 elif [[ ! ,${Q_SERVICE_PLUGIN_CLASSES}, =~ ,${service_plugin_class}, ]]; then
864 Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,$service_plugin_class"
865 fi
866}
867
Ihar Hrachyshka5893cc72014-12-22 11:49:42 +0100868# _neutron_deploy_rootwrap_filters() - deploy rootwrap filters to $Q_CONF_ROOTWRAP_D (owned by root).
869function _neutron_deploy_rootwrap_filters {
gong yong sheng3d6eaae2015-09-15 15:00:29 +0800870 if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
871 return
872 fi
Ihar Hrachyshka5893cc72014-12-22 11:49:42 +0100873 local srcdir=$1
Dean Troyer8421c2b2015-03-16 13:52:19 -0500874 sudo install -d -o root -m 755 $Q_CONF_ROOTWRAP_D
875 sudo install -o root -m 644 $srcdir/etc/neutron/rootwrap.d/* $Q_CONF_ROOTWRAP_D/
Ihar Hrachyshka5893cc72014-12-22 11:49:42 +0100876}
877
Mark McClainb05c8762013-07-06 23:29:39 -0400878# _neutron_setup_rootwrap() - configure Neutron's rootwrap
Ian Wienandaee18c72014-02-21 15:35:08 +1100879function _neutron_setup_rootwrap {
Mark McClainb05c8762013-07-06 23:29:39 -0400880 if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
881 return
882 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400883 # Wipe any existing ``rootwrap.d`` files first
884 Q_CONF_ROOTWRAP_D=$NEUTRON_CONF_DIR/rootwrap.d
885 if [[ -d $Q_CONF_ROOTWRAP_D ]]; then
886 sudo rm -rf $Q_CONF_ROOTWRAP_D
887 fi
Ihar Hrachyshka5893cc72014-12-22 11:49:42 +0100888
889 _neutron_deploy_rootwrap_filters $NEUTRON_DIR
890
Mark McClainb05c8762013-07-06 23:29:39 -0400891 # Set up ``rootwrap.conf``, pointing to ``$NEUTRON_CONF_DIR/rootwrap.d``
892 # location moved in newer versions, prefer new location
893 if test -r $NEUTRON_DIR/etc/neutron/rootwrap.conf; then
Dean Troyer8421c2b2015-03-16 13:52:19 -0500894 sudo install -o root -g root -m 644 $NEUTRON_DIR/etc/neutron/rootwrap.conf $Q_RR_CONF_FILE
Mark McClainb05c8762013-07-06 23:29:39 -0400895 else
Dean Troyer8421c2b2015-03-16 13:52:19 -0500896 sudo install -o root -g root -m 644 $NEUTRON_DIR/etc/rootwrap.conf $Q_RR_CONF_FILE
Mark McClainb05c8762013-07-06 23:29:39 -0400897 fi
898 sudo sed -e "s:^filters_path=.*$:filters_path=$Q_CONF_ROOTWRAP_D:" -i $Q_RR_CONF_FILE
Robert Li2c5d4622015-04-21 15:48:22 -0400899 sudo sed -e 's:^exec_dirs=\(.*\)$:exec_dirs=\1,/usr/local/bin:' -i $Q_RR_CONF_FILE
900
Mark McClainb05c8762013-07-06 23:29:39 -0400901 # Specify ``rootwrap.conf`` as first parameter to neutron-rootwrap
902 ROOTWRAP_SUDOER_CMD="$NEUTRON_ROOTWRAP $Q_RR_CONF_FILE *"
Yuriy Taraday26623952014-07-16 17:41:53 +0400903 ROOTWRAP_DAEMON_SUDOER_CMD="$NEUTRON_ROOTWRAP-daemon $Q_RR_CONF_FILE"
Mark McClainb05c8762013-07-06 23:29:39 -0400904
905 # Set up the rootwrap sudoers for neutron
906 TEMPFILE=`mktemp`
Stephan Renatuse578eff2013-11-19 13:31:04 +0100907 echo "$STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD" >$TEMPFILE
Yuriy Taraday26623952014-07-16 17:41:53 +0400908 echo "$STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_DAEMON_SUDOER_CMD" >>$TEMPFILE
Mark McClainb05c8762013-07-06 23:29:39 -0400909 chmod 0440 $TEMPFILE
910 sudo chown root:root $TEMPFILE
911 sudo mv $TEMPFILE /etc/sudoers.d/neutron-rootwrap
912
913 # Update the root_helper
914 iniset $NEUTRON_CONF agent root_helper "$Q_RR_COMMAND"
Yuriy Taraday26623952014-07-16 17:41:53 +0400915 if [[ "$Q_USE_ROOTWRAP_DAEMON" == "True" ]]; then
916 iniset $NEUTRON_CONF agent root_helper_daemon "$Q_RR_DAEMON_COMMAND"
917 fi
Mark McClainb05c8762013-07-06 23:29:39 -0400918}
919
Ihar Hrachyshkabb4654b2015-10-06 18:09:07 +0200920# Configures keystone integration for neutron service
Ian Wienandaee18c72014-02-21 15:35:08 +1100921function _neutron_setup_keystone {
Mark McClainb05c8762013-07-06 23:29:39 -0400922 local conf_file=$1
923 local section=$2
Jamie Lennox3561d7f2014-05-21 17:18:43 +1000924
Brant Knudson05952372014-09-19 17:22:22 -0500925 create_neutron_cache_dir
926 configure_auth_token_middleware $conf_file $Q_ADMIN_USERNAME $NEUTRON_AUTH_CACHE_DIR $section
Mark McClainb05c8762013-07-06 23:29:39 -0400927}
928
Ian Wienandaee18c72014-02-21 15:35:08 +1100929function _neutron_setup_interface_driver {
Mark McClainb05c8762013-07-06 23:29:39 -0400930
931 # ovs_use_veth needs to be set before the plugin configuration
932 # occurs to allow plugins to override the setting.
933 iniset $1 DEFAULT ovs_use_veth $Q_OVS_USE_VETH
934
935 neutron_plugin_setup_interface_driver $1
936}
Mark McClainb05c8762013-07-06 23:29:39 -0400937# Functions for Neutron Exercises
938#--------------------------------
939
Ian Wienandaee18c72014-02-21 15:35:08 +1100940function delete_probe {
Mark McClainb05c8762013-07-06 23:29:39 -0400941 local from_net="$1"
942 net_id=`_get_net_id $from_net`
943 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}'`
944 neutron-debug --os-tenant-name admin --os-username admin probe-delete $probe_id
945}
946
Ian Wienandaee18c72014-02-21 15:35:08 +1100947function _get_net_id {
Victor Ryzhenkin878d7d82016-04-27 15:15:52 +0300948 neutron --os-cloud devstack-admin --os-region "$REGION_NAME" --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD net-list | grep $1 | awk '{print $2}'
Mark McClainb05c8762013-07-06 23:29:39 -0400949}
950
Ian Wienandaee18c72014-02-21 15:35:08 +1100951function _get_probe_cmd_prefix {
Mark McClainb05c8762013-07-06 23:29:39 -0400952 local from_net="$1"
953 net_id=`_get_net_id $from_net`
954 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`
955 echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id"
956}
957
Mark McClainb05c8762013-07-06 23:29:39 -0400958# ssh check
Ian Wienandaee18c72014-02-21 15:35:08 +1100959function _ssh_check_neutron {
Mark McClainb05c8762013-07-06 23:29:39 -0400960 local from_net=$1
961 local key_file=$2
962 local ip=$3
963 local user=$4
964 local timeout_sec=$5
965 local probe_cmd = ""
966 probe_cmd=`_get_probe_cmd_prefix $from_net`
Sean Dague442e4e92015-06-24 13:24:02 -0400967 local testcmd="$probe_cmd ssh -o StrictHostKeyChecking=no -i $key_file ${user}@$ip echo success"
968 test_with_retry "$testcmd" "server $ip didn't become ssh-able" $timeout_sec
Mark McClainb05c8762013-07-06 23:29:39 -0400969}
970
Mark McClainb05c8762013-07-06 23:29:39 -0400971# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +1100972$_XTRACE_NEUTRON
Mark McClainb05c8762013-07-06 23:29:39 -0400973
Adam Spiers6a5aa7c2013-10-24 11:27:02 +0100974# Tell emacs to use shell-script-mode
975## Local variables:
976## mode: shell-script
977## End: