Browse code

Update stack.sh for Quantum openvswitch plugin changes

With support for multiple physical networks being added to the Quantum
openvswitch plugin via https://review.openstack.org/#/c/11388/, the
configuration needed to enable either tunneling or VLANs has
changed.

See http://wiki.openstack.org/ConfigureOpenvswitch for configuration
and usage details.

Change-Id: I82ca587e097a0f9612af46f2f89a19ac27c73432

Bob Kukura authored on 2012/08/27 14:53:11
Showing 1 changed files
... ...
@@ -1135,14 +1135,19 @@ if is_service_enabled quantum; then
1135 1135
     sudo sed -i -e "s/^sql_connection =.*$/sql_connection = mysql:\/\/$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST\/$Q_DB_NAME?charset=utf8/g" /$Q_PLUGIN_CONF_FILE
1136 1136
 
1137 1137
     OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-True}
1138
-    if [[ "$Q_PLUGIN" = "openvswitch" && $OVS_ENABLE_TUNNELING = "True" ]]; then
1138
+    if [[ "$Q_PLUGIN" = "openvswitch" && "$OVS_ENABLE_TUNNELING" = "True" ]]; then
1139 1139
         OVS_VERSION=`ovs-vsctl --version | head -n 1 | awk '{print $4;}'`
1140 1140
         if [ $OVS_VERSION \< "1.4" ] && ! is_service_enabled q-svc ; then
1141 1141
             echo "You are running OVS version $OVS_VERSION."
1142 1142
             echo "OVS 1.4+ is required for tunneling between multiple hosts."
1143 1143
             exit 1
1144 1144
         fi
1145
-        sudo sed -i -e "s/.*enable_tunneling = .*$/enable_tunneling = $OVS_ENABLE_TUNNELING/g" /$Q_PLUGIN_CONF_FILE
1145
+        if [[ "$OVS_DEFAULT_BRIDGE" = "" ]]; then
1146
+            iniset /$Q_PLUGIN_CONF_FILE OVS network_vlan_ranges ""
1147
+        else
1148
+            iniset /$Q_PLUGIN_CONF_FILE OVS network_vlan_ranges default
1149
+        fi
1150
+        iniset /$Q_PLUGIN_CONF_FILE OVS tunnel_id_ranges 1:1000
1146 1151
     fi
1147 1152
 
1148 1153
     Q_CONF_FILE=/etc/quantum/quantum.conf
... ...
@@ -1189,7 +1194,19 @@ if is_service_enabled q-agt; then
1189 1189
         sudo ovs-vsctl --no-wait -- --if-exists del-br $OVS_BRIDGE
1190 1190
         sudo ovs-vsctl --no-wait add-br $OVS_BRIDGE
1191 1191
         sudo ovs-vsctl --no-wait br-set-external-id $OVS_BRIDGE bridge-id br-int
1192
-        sudo sed -i -e "s/.*local_ip = .*/local_ip = $HOST_IP/g" /$Q_PLUGIN_CONF_FILE
1192
+        if [[ "$OVS_ENABLE_TUNNELING" == "True" ]]; then
1193
+            iniset /$Q_PLUGIN_CONF_FILE OVS local_ip $HOST_IP
1194
+        else
1195
+            # Need bridge if not tunneling
1196
+            OVS_DEFAULT_BRIDGE=${OVS_DEFAULT_BRIDGE:-br-$GUEST_INTERFACE_DEFAULT}
1197
+        fi
1198
+        if [[ "$OVS_DEFAULT_BRIDGE" = "" ]]; then
1199
+            iniset /$Q_PLUGIN_CONF_FILE OVS bridge_mappings ""
1200
+        else
1201
+            # Configure bridge manually with physical interface as port for multi-node
1202
+            sudo ovs-vsctl --no-wait -- --may-exist add-br $OVS_DEFAULT_BRIDGE
1203
+            iniset /$Q_PLUGIN_CONF_FILE OVS bridge_mappings default:$OVS_DEFAULT_BRIDGE
1204
+        fi
1193 1205
         AGENT_BINARY="$QUANTUM_DIR/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py"
1194 1206
     elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
1195 1207
        # Start up the quantum <-> linuxbridge agent