Browse code

Make neutron ml2 use ovs native interface

Neutron has changed to use ovs native interface by default, but when
the hypervisor is XenServer, we cannot use ovs native interface without
extra configurations in neutron-openvswitch-agent(q-agt) in compute
node.

This patch is to add the needed configurations automatically during
deployment, so user needn't to do it manually and restart q-agt.

Change-Id: Ibc69d3cdb4d75833f2ac16840c62bcacf460dd4f

Huan Xie authored on 2016/09/20 15:49:50
Showing 2 changed files
... ...
@@ -95,6 +95,11 @@ function neutron_plugin_configure_plugin_agent {
95 95
         # XEN_INTEGRATION_BRIDGE is the integration bridge in dom0
96 96
         iniset /$Q_PLUGIN_CONF_FILE ovs integration_bridge $XEN_INTEGRATION_BRIDGE
97 97
 
98
+        # Set OVS native interface for ovs-agent in compute node
99
+        XEN_DOM0_IP=$(echo "$XENAPI_CONNECTION_URL" | cut -d "/" -f 3)
100
+        iniset /$Q_PLUGIN_CONF_FILE ovs ovsdb_connection tcp:$XEN_DOM0_IP:6640
101
+        iniset /$Q_PLUGIN_CONF_FILE ovs of_listen_address $HOST_IP
102
+
98 103
         # Set up domU's L2 agent:
99 104
 
100 105
         # Create a bridge "br-$VLAN_INTERFACE"
... ...
@@ -93,6 +93,15 @@ CRONTAB
93 93
     if is_service_enabled neutron; then
94 94
         # Remove restriction on linux bridge in Dom0 when neutron is enabled
95 95
         $ssh_dom0 "rm -f /etc/modprobe.d/blacklist-bridge*"
96
+
97
+        count=`$ssh_dom0 "iptables -t filter -L XenServerDevstack |wc -l"`
98
+        if [ "$count" = "0" ]; then
99
+        {
100
+            echo "iptables -t filter --new XenServerDevstack"
101
+            echo "iptables -t filter -I INPUT -j XenServerDevstack"
102
+            echo "iptables -t filter -I XenServerDevstack -p tcp --dport 6640 -j ACCEPT"
103
+        } | $ssh_dom0
104
+        fi
96 105
     fi
97 106
 }
98 107