Skip to content

Commit 4dc53aa

Browse files
author
Shweta P
committed
Adds LinuxBridge plugin setup support.
Change-Id: I4c3250ac9bd3f3eb466a211bcaddaf1855d6ef8d
1 parent c31ae02 commit 4dc53aa

File tree

1 file changed

+54
-9
lines changed

1 file changed

+54
-9
lines changed

stack.sh

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -990,14 +990,36 @@ fi
990990

991991
# Quantum
992992
# -------
993-
994-
# Quantum service
995-
if is_service_enabled q-svc; then
993+
if is_service_enabled quantum; then
994+
# Put config files in /etc/quantum for everyone to find
996995
QUANTUM_CONF_DIR=/etc/quantum
997996
if [[ ! -d $QUANTUM_CONF_DIR ]]; then
998997
sudo mkdir -p $QUANTUM_CONF_DIR
999998
fi
1000999
sudo chown `whoami` $QUANTUM_CONF_DIR
1000+
1001+
# Set default values when using Linux Bridge plugin
1002+
if [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
1003+
# set the config file
1004+
QUANTUM_LB_CONF_DIR=$QUANTUM_CONF_DIR/plugins/linuxbridge
1005+
mkdir -p $QUANTUM_LB_CONF_DIR
1006+
QUANTUM_LB_CONFIG_FILE=$QUANTUM_LB_CONF_DIR/linuxbridge_conf.ini
1007+
# must remove this file from existing location, otherwise Quantum will prefer it
1008+
if [[ -e $QUANTUM_DIR/etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini ]]; then
1009+
sudo mv $QUANTUM_DIR/etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini $QUANTUM_LB_CONFIG_FILE
1010+
fi
1011+
#set the default network interface
1012+
QUANTUM_LB_PRIVATE_INTERFACE=${QUANTUM_LB_PRIVATE_INTERFACE:-$GUEST_INTERFACE_DEFAULT}
1013+
fi
1014+
fi
1015+
# Quantum service
1016+
if is_service_enabled q-svc; then
1017+
QUANTUM_PLUGIN_INI_FILE=$QUANTUM_CONF_DIR/plugins.ini
1018+
# must remove this file from existing location, otherwise Quantum will prefer it
1019+
if [[ -e $QUANTUM_DIR/etc/plugins.ini ]]; then
1020+
sudo mv $QUANTUM_DIR/etc/plugins.ini $QUANTUM_PLUGIN_INI_FILE
1021+
fi
1022+
10011023
if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
10021024
# Install deps
10031025
# FIXME add to files/apts/quantum, but don't install if not needed!
@@ -1016,13 +1038,27 @@ if is_service_enabled q-svc; then
10161038
echo "mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin."
10171039
exit 1
10181040
fi
1019-
QUANTUM_PLUGIN_INI_FILE=$QUANTUM_CONF_DIR/plugins.ini
1020-
# must remove this file from existing location, otherwise Quantum will prefer it
1021-
if [[ -e $QUANTUM_DIR/etc/plugins.ini ]]; then
1022-
sudo mv $QUANTUM_DIR/etc/plugins.ini $QUANTUM_PLUGIN_INI_FILE
1023-
fi
10241041
# Make sure we're using the openvswitch plugin
10251042
sudo sed -i -e "s/^provider =.*$/provider = quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPlugin/g" $QUANTUM_PLUGIN_INI_FILE
1043+
elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
1044+
# Install deps
1045+
# FIXME add to files/apts/quantum, but don't install if not needed!
1046+
install_package python-configobj
1047+
# Create database for the plugin/agent
1048+
if is_service_enabled mysql; then
1049+
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'DROP DATABASE IF EXISTS quantum_linux_bridge;'
1050+
mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e 'CREATE DATABASE IF NOT EXISTS quantum_linux_bridge;'
1051+
else
1052+
echo "mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin."
1053+
exit 1
1054+
fi
1055+
# Make sure we're using the linuxbridge plugin and set the mysql hostname, username and password in the config file
1056+
sudo sed -i -e "s/^provider =.*$/provider = quantum.plugins.linuxbridge.LinuxBridgePlugin.LinuxBridgePlugin/g" $QUANTUM_PLUGIN_INI_FILE
1057+
sudo sed -i -e "s/^connection = sqlite$/#connection = sqlite/g" $QUANTUM_LB_CONFIG_FILE
1058+
sudo sed -i -e "s/^#connection = mysql$/connection = mysql/g" $QUANTUM_LB_CONFIG_FILE
1059+
sudo sed -i -e "s/^user = .*$/user = $MYSQL_USER/g" $QUANTUM_LB_CONFIG_FILE
1060+
sudo sed -i -e "s/^pass = .*$/pass = $MYSQL_PASSWORD/g" $QUANTUM_LB_CONFIG_FILE
1061+
sudo sed -i -e "s/^host = .*$/host = $MYSQL_HOST/g" $QUANTUM_LB_CONFIG_FILE
10261062
fi
10271063
if [[ -e $QUANTUM_DIR/etc/quantum.conf ]]; then
10281064
sudo mv $QUANTUM_DIR/etc/quantum.conf $QUANTUM_CONF_DIR/quantum.conf
@@ -1048,8 +1084,12 @@ if is_service_enabled q-agt; then
10481084
fi
10491085
sudo sed -i -e "s/^sql_connection =.*$/sql_connection = mysql:\/\/$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST\/ovs_quantum?charset=utf8/g" $QUANTUM_OVS_CONFIG_FILE
10501086
screen_it q-agt "sleep 4; sudo python $QUANTUM_DIR/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py $QUANTUM_OVS_CONFIG_FILE -v"
1087+
elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
1088+
# Start up the quantum <-> linuxbridge agent
1089+
install_package bridge-utils
1090+
sudo sed -i -e "s/^physical_interface = .*$/physical_interface = $QUANTUM_LB_PRIVATE_INTERFACE/g" $QUANTUM_LB_CONFIG_FILE
1091+
screen_it q-agt "sleep 4; sudo python $QUANTUM_DIR/quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py $QUANTUM_LB_CONFIG_FILE -v"
10511092
fi
1052-
10531093
fi
10541094

10551095
# Melange service
@@ -1520,6 +1560,11 @@ if is_service_enabled quantum; then
15201560
add_nova_opt "libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"
15211561
add_nova_opt "linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver"
15221562
add_nova_opt "quantum_use_dhcp=True"
1563+
elif is_service_enabled q-svc && [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
1564+
add_nova_opt "libvirt_vif_type=ethernet"
1565+
add_nova_opt "libvirt_vif_driver=nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver"
1566+
add_nova_opt "linuxnet_interface_driver=nova.network.linux_net.QuantumLinuxBridgeInterfaceDriver"
1567+
add_nova_opt "quantum_use_dhcp=True"
15231568
fi
15241569
else
15251570
add_nova_opt "network_manager=nova.network.manager.$NET_MAN"

0 commit comments

Comments
 (0)