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 selected plugin.
29 Usage: quantum-node-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
54 LB_CONF=/etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini
55 OVS_CONF=/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini
58 NOVA_CONF=/etc/nova/nova.conf
82 # if the plugin is not defined
83 if [ -z ${QUANTUM_PLUGIN} ] ; then
84 echo "Please select a plugin from: ${SUPPORTED_PLUGINS[*]}"
89 # check that the plugin is valid
90 is_valid_plugin ${QUANTUM_PLUGIN}
92 echo "Plugin '${QUANTUM_PLUGIN}' not supported. Supported plugins:-"
93 echo " ${SUPPORTED_PLUGINS[*]}"
97 echo "Quantum plugin: ${QUANTUM_PLUGIN}"
99 if ! [ -e "/etc/quantum/plugins/${QUANTUM_PLUGIN}" ]; then
100 echo "Please install the ${QUANTUM_PLUGIN} quantum plugin"
104 #if the database hostname and is not defined and is required
105 if [ -z ${Q_HOST} ] ; then
106 echo "Please enter the Quantum hostname:"
111 Q_CONF=/etc/quantum/quantum.conf
113 openstack-config --set ${Q_CONF} DEFAULT rpc_backend quantum.openstack.common.rpc.impl_qpid
114 openstack-config --set ${Q_CONF} DEFAULT qpid_hostname ${Q_HOST}
116 case "${QUANTUM_PLUGIN}" in
121 if ! rpm -q openvswitch > /dev/null
123 echo "Please install openvswitch"
126 OVS_CONF=/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini
127 openstack-config --set ${OVS_CONF} SECURITYGROUP firewall_driver quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
132 echo "Would you like to update the nova configuration files? (y/n): "
143 OS_USERNAME=${OS_USERNAME:-quantum}
144 OS_PASSWORD=${OS_PASSWORD:-servicepass}
145 OS_AUTH_URL=${OS_AUTH_URL:-http://127.0.0.1:35357/v2.0/}
146 OS_TENANT_NAME=${OS_TENANT_NAME:-service}
148 # If OpenStack is installed then configure nova.conf
149 if ! [ -e "${NOVA_CONF}" ]; then
150 echo "Please install OpenStack compute and then set the values"
151 echo "in /etc/nova/nova.conf DEFAULT section"
152 echo " network_api_class=nova.network.quantumv2.api.API"
153 echo " quantum_admin_username=${OS_USERNAME}"
154 echo " quantum_admin_password=${OS_PASSWORD}"
155 echo " quantum_admin_auth_url=${OS_AUTH_URL}"
156 echo " quantum_auth_strategy=keystone"
157 echo " quantum_admin_tenant_name=${OS_TENANT_NAME}"
158 echo " quantum_url=http://${Q_HOST}:${Q_PORT}/"
159 echo " firewall_driver=nova.virt.firewall.NoopFirewallDriver"
160 echo " security_group_api=quantum"
162 openstack-config --set ${NOVA_CONF} DEFAULT network_api_class nova.network.quantumv2.api.API
163 openstack-config --set ${NOVA_CONF} DEFAULT quantum_admin_username ${OS_USERNAME}
164 openstack-config --set ${NOVA_CONF} DEFAULT quantum_admin_password ${OS_PASSWORD}
165 openstack-config --set ${NOVA_CONF} DEFAULT quantum_admin_auth_url ${OS_AUTH_URL}
166 openstack-config --set ${NOVA_CONF} DEFAULT quantum_auth_strategy keystone
167 openstack-config --set ${NOVA_CONF} DEFAULT quantum_admin_tenant_name ${OS_TENANT_NAME}
168 openstack-config --set ${NOVA_CONF} DEFAULT quantum_url http://${Q_HOST}:${Q_PORT}/
169 openstack-config --set ${NOVA_CONF} DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
170 openstack-config --set ${NOVA_CONF} DEFAULT security_group_api quantum
173 echo "Configuration updates complete!"