@@ -1005,14 +1005,36 @@ fi
10051005
10061006# Quantum
10071007# -------
1008-
1009- # Quantum service
1010- if is_service_enabled q-svc; then
1008+ if is_service_enabled quantum; then
1009+ # Put config files in /etc/quantum for everyone to find
10111010 QUANTUM_CONF_DIR=/etc/quantum
10121011 if [[ ! -d $QUANTUM_CONF_DIR ]]; then
10131012 sudo mkdir -p $QUANTUM_CONF_DIR
10141013 fi
10151014 sudo chown ` whoami` $QUANTUM_CONF_DIR
1015+
1016+ # Set default values when using Linux Bridge plugin
1017+ if [[ " $Q_PLUGIN " = " linuxbridge" ]]; then
1018+ # set the config file
1019+ QUANTUM_LB_CONF_DIR=$QUANTUM_CONF_DIR /plugins/linuxbridge
1020+ mkdir -p $QUANTUM_LB_CONF_DIR
1021+ QUANTUM_LB_CONFIG_FILE=$QUANTUM_LB_CONF_DIR /linuxbridge_conf.ini
1022+ # must remove this file from existing location, otherwise Quantum will prefer it
1023+ if [[ -e $QUANTUM_DIR /etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini ]]; then
1024+ sudo mv $QUANTUM_DIR /etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini $QUANTUM_LB_CONFIG_FILE
1025+ fi
1026+ # set the default network interface
1027+ QUANTUM_LB_PRIVATE_INTERFACE=${QUANTUM_LB_PRIVATE_INTERFACE:- $GUEST_INTERFACE_DEFAULT }
1028+ fi
1029+ fi
1030+ # Quantum service
1031+ if is_service_enabled q-svc; then
1032+ QUANTUM_PLUGIN_INI_FILE=$QUANTUM_CONF_DIR /plugins.ini
1033+ # must remove this file from existing location, otherwise Quantum will prefer it
1034+ if [[ -e $QUANTUM_DIR /etc/plugins.ini ]]; then
1035+ sudo mv $QUANTUM_DIR /etc/plugins.ini $QUANTUM_PLUGIN_INI_FILE
1036+ fi
1037+
10161038 if [[ " $Q_PLUGIN " = " openvswitch" ]]; then
10171039 # Install deps
10181040 # FIXME add to files/apts/quantum, but don't install if not needed!
@@ -1031,13 +1053,27 @@ if is_service_enabled q-svc; then
10311053 echo " mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin."
10321054 exit 1
10331055 fi
1034- QUANTUM_PLUGIN_INI_FILE=$QUANTUM_CONF_DIR /plugins.ini
1035- # must remove this file from existing location, otherwise Quantum will prefer it
1036- if [[ -e $QUANTUM_DIR /etc/plugins.ini ]]; then
1037- sudo mv $QUANTUM_DIR /etc/plugins.ini $QUANTUM_PLUGIN_INI_FILE
1038- fi
10391056 # Make sure we're using the openvswitch plugin
10401057 sudo sed -i -e " s/^provider =.*$/provider = quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPlugin/g" $QUANTUM_PLUGIN_INI_FILE
1058+ elif [[ " $Q_PLUGIN " = " linuxbridge" ]]; then
1059+ # Install deps
1060+ # FIXME add to files/apts/quantum, but don't install if not needed!
1061+ install_package python-configobj
1062+ # Create database for the plugin/agent
1063+ if is_service_enabled mysql; then
1064+ mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e ' DROP DATABASE IF EXISTS quantum_linux_bridge;'
1065+ mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e ' CREATE DATABASE IF NOT EXISTS quantum_linux_bridge;'
1066+ else
1067+ echo " mysql must be enabled in order to use the $Q_PLUGIN Quantum plugin."
1068+ exit 1
1069+ fi
1070+ # Make sure we're using the linuxbridge plugin and set the mysql hostname, username and password in the config file
1071+ sudo sed -i -e " s/^provider =.*$/provider = quantum.plugins.linuxbridge.LinuxBridgePlugin.LinuxBridgePlugin/g" $QUANTUM_PLUGIN_INI_FILE
1072+ sudo sed -i -e " s/^connection = sqlite$/#connection = sqlite/g" $QUANTUM_LB_CONFIG_FILE
1073+ sudo sed -i -e " s/^#connection = mysql$/connection = mysql/g" $QUANTUM_LB_CONFIG_FILE
1074+ sudo sed -i -e " s/^user = .*$/user = $MYSQL_USER /g" $QUANTUM_LB_CONFIG_FILE
1075+ sudo sed -i -e " s/^pass = .*$/pass = $MYSQL_PASSWORD /g" $QUANTUM_LB_CONFIG_FILE
1076+ sudo sed -i -e " s/^host = .*$/host = $MYSQL_HOST /g" $QUANTUM_LB_CONFIG_FILE
10411077 fi
10421078 if [[ -e $QUANTUM_DIR /etc/quantum.conf ]]; then
10431079 sudo mv $QUANTUM_DIR /etc/quantum.conf $QUANTUM_CONF_DIR /quantum.conf
@@ -1063,8 +1099,12 @@ if is_service_enabled q-agt; then
10631099 fi
10641100 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
10651101 screen_it q-agt " sleep 4; sudo python $QUANTUM_DIR /quantum/plugins/openvswitch/agent/ovs_quantum_agent.py $QUANTUM_OVS_CONFIG_FILE -v"
1102+ elif [[ " $Q_PLUGIN " = " linuxbridge" ]]; then
1103+ # Start up the quantum <-> linuxbridge agent
1104+ install_package bridge-utils
1105+ sudo sed -i -e " s/^physical_interface = .*$/physical_interface = $QUANTUM_LB_PRIVATE_INTERFACE /g" $QUANTUM_LB_CONFIG_FILE
1106+ screen_it q-agt " sleep 4; sudo python $QUANTUM_DIR /quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py $QUANTUM_LB_CONFIG_FILE -v"
10661107 fi
1067-
10681108fi
10691109
10701110# Melange service
@@ -1535,6 +1575,11 @@ if is_service_enabled quantum; then
15351575 add_nova_opt " libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"
15361576 add_nova_opt " linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver"
15371577 add_nova_opt " quantum_use_dhcp=True"
1578+ elif is_service_enabled q-svc && [[ " $Q_PLUGIN " = " linuxbridge" ]]; then
1579+ add_nova_opt " libvirt_vif_type=ethernet"
1580+ add_nova_opt " libvirt_vif_driver=nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver"
1581+ add_nova_opt " linuxnet_interface_driver=nova.network.linux_net.QuantumLinuxBridgeInterfaceDriver"
1582+ add_nova_opt " quantum_use_dhcp=True"
15381583 fi
15391584else
15401585 add_nova_opt " network_manager=nova.network.manager.$NET_MAN "
0 commit comments