Browse code

Merge "Restore linuxbridge-agent compatibility"

Jenkins authored on 2014/11/25 19:11:49
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,77 @@
0
+# Neutron Linux Bridge L2 agent
1
+# -----------------------------
2
+
3
+# Save trace setting
4
+PLUGIN_XTRACE=$(set +o | grep xtrace)
5
+set +o xtrace
6
+
7
+function is_neutron_ovs_base_plugin {
8
+    # linuxbridge doesn't use OVS
9
+    return 1
10
+}
11
+
12
+function neutron_plugin_create_nova_conf {
13
+    :
14
+}
15
+
16
+function neutron_plugin_install_agent_packages {
17
+    install_package bridge-utils
18
+}
19
+
20
+function neutron_plugin_configure_debug_command {
21
+    iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge
22
+}
23
+
24
+function neutron_plugin_configure_dhcp_agent {
25
+    iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_agent_manager neutron.agent.dhcp_agent.DhcpAgentWithStateReport
26
+}
27
+
28
+function neutron_plugin_configure_l3_agent {
29
+    iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge
30
+    iniset $Q_L3_CONF_FILE DEFAULT l3_agent_manager neutron.agent.l3_agent.L3NATAgentWithStateReport
31
+}
32
+
33
+function neutron_plugin_configure_plugin_agent {
34
+    # Setup physical network interface mappings.  Override
35
+    # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more
36
+    # complex physical network configurations.
37
+    if [[ "$LB_INTERFACE_MAPPINGS" == "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then
38
+        LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE
39
+    fi
40
+    if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then
41
+        iniset /$Q_PLUGIN_CONF_FILE linux_bridge physical_interface_mappings $LB_INTERFACE_MAPPINGS
42
+    fi
43
+    if [[ "$Q_USE_SECGROUP" == "True" ]]; then
44
+        iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
45
+    else
46
+        iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver
47
+    fi
48
+    AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-linuxbridge-agent"
49
+    iniset /$Q_PLUGIN_CONF_FILE agent tunnel_types $Q_TUNNEL_TYPES
50
+    # Define extra "AGENT" configuration options when q-agt is configured by defining
51
+    # the array ``Q_AGENT_EXTRA_AGENT_OPTS``.
52
+    # For Example: ``Q_AGENT_EXTRA_AGENT_OPTS=(foo=true bar=2)``
53
+    for I in "${Q_AGENT_EXTRA_AGENT_OPTS[@]}"; do
54
+        # Replace the first '=' with ' ' for iniset syntax
55
+        iniset /$Q_PLUGIN_CONF_FILE agent ${I/=/ }
56
+    done
57
+    # Define extra "LINUX_BRIDGE" configuration options when q-agt is configured by defining
58
+    # the array ``Q_AGENT_EXTRA_SRV_OPTS``.
59
+    # For Example: ``Q_AGENT_EXTRA_SRV_OPTS=(foo=true bar=2)``
60
+    for I in "${Q_AGENT_EXTRA_SRV_OPTS[@]}"; do
61
+        # Replace the first '=' with ' ' for iniset syntax
62
+        iniset /$Q_PLUGIN_CONF_FILE linux_bridge ${I/=/ }
63
+    done
64
+}
65
+
66
+function neutron_plugin_setup_interface_driver {
67
+    local conf_file=$1
68
+    iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.BridgeInterfaceDriver
69
+}
70
+
71
+function neutron_plugin_check_adv_test_requirements {
72
+    is_service_enabled q-agt && is_service_enabled q-dhcp && return 0
73
+}
74
+
75
+# Restore xtrace
76
+$PLUGIN_XTRACE