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 DHCP agent.
29 Usage: quantum-dhcp-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 DHCP_CONF=/etc/quantum/dhcp_agent.ini
77 # if the plugin is not defined
78 if [ -z ${QUANTUM_PLUGIN} ] ; then
79 echo "Please select a plugin from: ${SUPPORTED_PLUGINS[*]}"
84 # check that the plugin is valid
85 is_valid_plugin ${QUANTUM_PLUGIN}
87 echo "Plugin '${QUANTUM_PLUGIN}' not supported. Supported plugins:-"
88 echo " ${SUPPORTED_PLUGINS[*]}"
92 echo "Quantum plugin: ${QUANTUM_PLUGIN}"
94 if [ -z ${Q_HOST} ] ; then
95 echo "Please enter the Quantum hostname:"
100 Q_CONF=/etc/quantum/quantum.conf
102 openstack-config --set ${Q_CONF} DEFAULT rpc_backend quantum.openstack.common.rpc.impl_qpid
103 openstack-config --set ${Q_CONF} DEFAULT qpid_hostname ${Q_HOST}
105 case "${QUANTUM_PLUGIN}" in
107 LINUX_INTERFACE_DRIVER=quantum.agent.linux.interface.BridgeInterfaceDriver
111 if ! rpm -q openvswitch > /dev/null
113 echo "Please install openvswitch"
116 LINUX_INTERFACE_DRIVER=quantum.agent.linux.interface.OVSInterfaceDriver
122 OS_USERNAME=${OS_USERNAME:-quantum}
123 OS_PASSWORD=${OS_PASSWORD:-servicepass}
124 OS_AUTH_URL=${OS_AUTH_URL:-http://localhost:35357/v2.0/}
125 OS_TENANT_NAME=${OS_TENANT_NAME:-service}
128 openstack-config --set ${DHCP_CONF} DEFAULT auth_url ${OS_AUTH_URL}
129 openstack-config --set ${DHCP_CONF} DEFAULT admin_username ${OS_USERNAME}
130 openstack-config --set ${DHCP_CONF} DEFAULT admin_password ${OS_PASSWORD}
131 openstack-config --set ${DHCP_CONF} DEFAULT admin_tenant_name ${OS_TENANT_NAME}
133 # Update interface driver
134 openstack-config --set ${DHCP_CONF} DEFAULT interface_driver ${LINUX_INTERFACE_DRIVER}
136 echo "Configuration updates complete!"