3 # Copyright (C) 2012, Red Hat, Inc.
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License. You may obtain
7 # a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 # License for the specific language governing permissions and limitations
18 # The script supports the plugins below
19 declare -a SUPPORTED_PLUGINS=(linuxbridge openvswitch)
22 # Print --help output and exit.
27 The helper script will install the necessary support for the L3 agent.
29 Usage: quantum-l3-setup [options]
32 Print usage information.
34 The quantum plugin. Supported plugins:-
35 ${SUPPORTED_PLUGINS[*]}
37 The Quantum hostname (assumes that this is also the QPID host).
45 for i in "${SUPPORTED_PLUGINS[@]}"; do
46 if [ "$i" == "$1" ]; then
53 L3_CONF=/etc/quantum/l3_agent.ini
54 L3_META_CONF=/etc/quantum/metadata_agent.ini
78 # if the plugin is not defined
79 if [ -z ${QUANTUM_PLUGIN} ] ; then
80 echo "Please select a plugin from: ${SUPPORTED_PLUGINS[*]}"
85 # check that the plugin is valid
86 is_valid_plugin ${QUANTUM_PLUGIN}
88 echo "Plugin '${QUANTUM_PLUGIN}' not supported. Supported plugins:-"
89 echo " ${SUPPORTED_PLUGINS[*]}"
93 echo "Quantum plugin: ${QUANTUM_PLUGIN}"
95 if [ -z ${Q_HOST} ] ; then
96 echo "Please enter the Quantum hostname:"
101 Q_CONF=/etc/quantum/quantum.conf
103 openstack-config --set ${Q_CONF} DEFAULT rpc_backend quantum.openstack.common.rpc.impl_qpid
104 openstack-config --set ${Q_CONF} DEFAULT qpid_hostname ${Q_HOST}
106 case "${QUANTUM_PLUGIN}" in
108 LINUX_INTERFACE_DRIVER=quantum.agent.linux.interface.BridgeInterfaceDriver
109 openstack-config --set ${L3_CONF} DEFAULT external_network_bridge ''
113 if ! rpm -q openvswitch > /dev/null
115 echo "Please install openvswitch"
118 LINUX_INTERFACE_DRIVER=quantum.agent.linux.interface.OVSInterfaceDriver
124 OS_USERNAME=${OS_USERNAME:-quantum}
125 OS_PASSWORD=${OS_PASSWORD:-servicepass}
126 OS_AUTH_URL=${OS_AUTH_URL:-http://localhost:35357/v2.0/}
127 OS_TENANT_NAME=${OS_TENANT_NAME:-service}
130 openstack-config --set ${L3_META_CONF} DEFAULT auth_url ${OS_AUTH_URL}
131 openstack-config --set ${L3_META_CONF} DEFAULT admin_user ${OS_USERNAME}
132 openstack-config --set ${L3_META_CONF} DEFAULT admin_password ${OS_PASSWORD}
133 openstack-config --set ${L3_META_CONF} DEFAULT admin_tenant_name ${OS_TENANT_NAME}
135 # Update interface driver
136 openstack-config --set ${L3_CONF} DEFAULT interface_driver ${LINUX_INTERFACE_DRIVER}
138 echo "Configuration updates complete!"