| Bob Kukura | c9b0f1a | 2013-04-23 16:28:24 -0400 | [diff] [blame] | 1 | # Quantum Modular Layer 2 plugin | 
 | 2 | # ------------------------------ | 
 | 3 |  | 
 | 4 | # Save trace setting | 
 | 5 | MY_XTRACE=$(set +o | grep xtrace) | 
 | 6 | set +o xtrace | 
 | 7 |  | 
 | 8 | # Default openvswitch L2 agent | 
 | 9 | Q_AGENT=${Q_AGENT:-openvswitch} | 
 | 10 | source $TOP_DIR/lib/quantum_plugins/${Q_AGENT}_agent | 
 | 11 |  | 
 | 12 | function quantum_plugin_configure_common() { | 
 | 13 |     Q_PLUGIN_CONF_PATH=etc/quantum/plugins/ml2 | 
 | 14 |     Q_PLUGIN_CONF_FILENAME=ml2_conf.ini | 
 | 15 |     Q_DB_NAME="quantum_ml2" | 
 | 16 |     Q_PLUGIN_CLASS="quantum.plugins.ml2.plugin.Ml2Plugin" | 
 | 17 | } | 
 | 18 |  | 
 | 19 | function quantum_plugin_configure_service() { | 
 | 20 |     if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then | 
 | 21 |         iniset /$Q_PLUGIN_CONF_FILE ml2 tenant_network_types gre | 
 | 22 |         iniset /$Q_PLUGIN_CONF_FILE ml2_type_gre tunnel_id_ranges $TENANT_TUNNEL_RANGES | 
 | 23 |     elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then | 
 | 24 |         iniset /$Q_PLUGIN_CONF_FILE ml2 tenant_network_types vlan | 
 | 25 |     else | 
 | 26 |         echo "WARNING - The ml2 plugin is using local tenant networks, with no connectivity between hosts." | 
 | 27 |     fi | 
 | 28 |  | 
 | 29 |     # Override ``ML2_VLAN_RANGES`` and any needed agent configuration | 
 | 30 |     # variables in ``localrc`` for more complex physical network | 
 | 31 |     # configurations. | 
 | 32 |     if [[ "$ML2_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then | 
 | 33 |         ML2_VLAN_RANGES=$PHYSICAL_NETWORK | 
 | 34 |         if [[ "$TENANT_VLAN_RANGE" != "" ]]; then | 
 | 35 |             ML2_VLAN_RANGES=$ML2_VLAN_RANGES:$TENANT_VLAN_RANGE | 
 | 36 |         fi | 
 | 37 |     fi | 
 | 38 |     if [[ "$ML2_VLAN_RANGES" != "" ]]; then | 
 | 39 |         iniset /$Q_PLUGIN_CONF_FILE ml2_type_vlan network_vlan_ranges $ML2_VLAN_RANGES | 
 | 40 |     fi | 
 | 41 |  | 
 | 42 |     # REVISIT(rkukura): Setting firewall_driver here for | 
 | 43 |     # quantum.agent.securitygroups_rpc.is_firewall_enabled() which is | 
 | 44 |     # used in the server, in case no L2 agent is configured on the | 
 | 45 |     # server's node. If an L2 agent is configured, this will get | 
 | 46 |     # overridden with the correct driver. The ml2 plugin should | 
 | 47 |     # instead use its own config variable to indicate whether security | 
 | 48 |     # groups is enabled, and that will need to be set here instead. | 
 | 49 |     if [[ "$Q_USE_SECGROUP" == "True" ]]; then | 
 | 50 |         iniset /$Q_PLUGIN_CONF_FILE SECURITYGROUP firewall_driver quantum.agent.not.a.real.FirewallDriver | 
 | 51 |     else | 
 | 52 |         iniset /$Q_PLUGIN_CONF_FILE SECURITYGROUP firewall_driver quantum.agent.firewall.NoopFirewallDriver | 
 | 53 |     fi | 
 | 54 |  | 
 | 55 | } | 
 | 56 |  | 
 | 57 | function has_quantum_plugin_security_group() { | 
 | 58 |     return 0 | 
 | 59 | } | 
 | 60 |  | 
 | 61 | # Restore xtrace | 
 | 62 | $MY_XTRACE |