Add support for specifying an alternate Quantum host/port

Also change the Quantum support around a bit.. now if you want Quantum
networking you can specify "quantum" in enabled_services -- if you actually
want to run the service then you need to add "q-svc" to enabled services.

Finally, move some of the openvswitch plugin logic into the openvswitch block.

Change-Id: I4b45e40f9670d2288d7714864a76e83972bec2c0
This commit is contained in:
Brad Hall 2011-12-12 23:04:58 +00:00
parent d9eafd5891
commit f1f3a8fbd8

View File

@ -154,6 +154,10 @@ QUANTUM_DIR=$DEST/quantum
# Default Quantum Plugin # Default Quantum Plugin
Q_PLUGIN=${Q_PLUGIN:-openvswitch} Q_PLUGIN=${Q_PLUGIN:-openvswitch}
# Default Quantum Port
Q_PORT=${Q_PORT:-9696}
# Default Quantum Host
Q_HOST=${Q_HOST:-localhost}
# Specify which services to launch. These generally correspond to screen tabs # Specify which services to launch. These generally correspond to screen tabs
ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,horizon,mysql,rabbit,openstackx} ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,horizon,mysql,rabbit,openstackx}
@ -280,8 +284,9 @@ FLAT_INTERFACE=${FLAT_INTERFACE:-eth0}
# Using Quantum networking: # Using Quantum networking:
# #
# Make sure that q-svc is enabled in ENABLED_SERVICES. If it is the network # Make sure that quantum is enabled in ENABLED_SERVICES. If it is the network
# manager will be set to the QuantumManager. # manager will be set to the QuantumManager. If you want to run Quantum on
# this host, make sure that q-svc is also in ENABLED_SERVICES.
# #
# If you're planning to use the Quantum openvswitch plugin, set Q_PLUGIN to # If you're planning to use the Quantum openvswitch plugin, set Q_PLUGIN to
# "openvswitch" and make sure the q-agt service is enabled in # "openvswitch" and make sure the q-agt service is enabled in
@ -531,7 +536,7 @@ if [[ "$ENABLED_SERVICES" =~ "openstackx" ]]; then
# that is *deprecated*. The code is being moved into python-novaclient & nova. # that is *deprecated*. The code is being moved into python-novaclient & nova.
git_clone $OPENSTACKX_REPO $OPENSTACKX_DIR $OPENSTACKX_BRANCH git_clone $OPENSTACKX_REPO $OPENSTACKX_DIR $OPENSTACKX_BRANCH
fi fi
if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
# quantum # quantum
git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH
fi fi
@ -565,7 +570,7 @@ if [[ "$ENABLED_SERVICES" =~ "horizon" ]]; then
cd $HORIZON_DIR/horizon; sudo python setup.py develop cd $HORIZON_DIR/horizon; sudo python setup.py develop
cd $HORIZON_DIR/openstack-dashboard; sudo python setup.py develop cd $HORIZON_DIR/openstack-dashboard; sudo python setup.py develop
fi fi
if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
cd $QUANTUM_DIR; sudo python setup.py develop cd $QUANTUM_DIR; sudo python setup.py develop
fi fi
@ -967,9 +972,11 @@ add_nova_flag "--allow_admin_api"
add_nova_flag "--scheduler_driver=$SCHEDULER" add_nova_flag "--scheduler_driver=$SCHEDULER"
add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf" add_nova_flag "--dhcpbridge_flagfile=$NOVA_DIR/bin/nova.conf"
add_nova_flag "--fixed_range=$FIXED_RANGE" add_nova_flag "--fixed_range=$FIXED_RANGE"
if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then
add_nova_flag "--network_manager=nova.network.quantum.manager.QuantumManager" add_nova_flag "--network_manager=nova.network.quantum.manager.QuantumManager"
if [[ "$Q_PLUGIN" = "openvswitch" ]]; then add_nova_flag "--quantum_connection_host=$Q_HOST"
add_nova_flag "--quantum_connection_port=$Q_PORT"
if [[ "$ENABLED_SERVICES" =~ "q-svc" && "$Q_PLUGIN" = "openvswitch" ]]; then
add_nova_flag "--libvirt_vif_type=ethernet" add_nova_flag "--libvirt_vif_type=ethernet"
add_nova_flag "--libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtOpenVswitchDriver" add_nova_flag "--libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"
add_nova_flag "--linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver" add_nova_flag "--linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver"
@ -1156,25 +1163,23 @@ if [[ "$ENABLED_SERVICES" =~ "n-api" ]]; then
fi fi
fi fi
# Quantum # Quantum service
if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
# Install deps # Install deps
# FIXME add to files/apts/quantum, but don't install if not needed! # FIXME add to files/apts/quantum, but don't install if not needed!
apt_get install openvswitch-switch openvswitch-datapath-dkms apt_get install openvswitch-switch openvswitch-datapath-dkms
# Create database for the plugin/agent # Create database for the plugin/agent
if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then if [[ "$ENABLED_SERVICES" =~ "mysql" ]]; then
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE IF NOT EXISTS ovs_quantum;' mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE IF NOT EXISTS ovs_quantum;'
else else
echo "mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin." echo "mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin."
exit 1 exit 1
fi fi
fi
QUANTUM_PLUGIN_INI_FILE=$QUANTUM_DIR/etc/plugins.ini QUANTUM_PLUGIN_INI_FILE=$QUANTUM_DIR/etc/plugins.ini
# Make sure we're using the openvswitch plugin # Make sure we're using the openvswitch plugin
sed -i -e "s/^provider =.*$/provider = quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPlugin/g" $QUANTUM_PLUGIN_INI_FILE sed -i -e "s/^provider =.*$/provider = quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPlugin/g" $QUANTUM_PLUGIN_INI_FILE
fi
screen_it q-svc "cd $QUANTUM_DIR && PYTHONPATH=.:$PYTHONPATH python $QUANTUM_DIR/bin/quantum-server $QUANTUM_DIR/etc/quantum.conf" screen_it q-svc "cd $QUANTUM_DIR && PYTHONPATH=.:$PYTHONPATH python $QUANTUM_DIR/bin/quantum-server $QUANTUM_DIR/etc/quantum.conf"
fi fi