| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 1 | # Quantum Nicira NVP plugin | 
|  | 2 | # --------------------------- | 
|  | 3 |  | 
|  | 4 | # Save trace setting | 
|  | 5 | MY_XTRACE=$(set +o | grep xtrace) | 
|  | 6 | set +o xtrace | 
|  | 7 |  | 
|  | 8 | source $TOP_DIR/lib/quantum_plugins/ovs_base | 
|  | 9 |  | 
|  | 10 | function setup_integration_bridge() { | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 11 | _quantum_ovs_base_setup_bridge $OVS_BRIDGE | 
|  | 12 | # Set manager to NVP controller (1st of list) | 
|  | 13 | if [[ "$NVP_CONTROLLERS" != "" ]]; then | 
|  | 14 | # Get the first controller | 
|  | 15 | controllers=(${NVP_CONTROLLERS//,/ }) | 
|  | 16 | OVS_MGR_IP=${controllers[0]} | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 17 | else | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 18 | die $LINENO "Error - No controller specified. Unable to set a manager for OVS" | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 19 | fi | 
|  | 20 | sudo ovs-vsctl set-manager ssl:$OVS_MGR_IP | 
|  | 21 | } | 
|  | 22 |  | 
|  | 23 | function is_quantum_ovs_base_plugin() { | 
|  | 24 | # NVP uses OVS, but not the l3-agent | 
|  | 25 | return 0 | 
|  | 26 | } | 
|  | 27 |  | 
|  | 28 | function quantum_plugin_create_nova_conf() { | 
|  | 29 | NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtOpenVswitchDriver"} | 
|  | 30 | # if n-cpu is enabled, then setup integration bridge | 
|  | 31 | if is_service_enabled n-cpu; then | 
|  | 32 | setup_integration_bridge | 
|  | 33 | fi | 
|  | 34 | } | 
|  | 35 |  | 
|  | 36 | function quantum_plugin_install_agent_packages() { | 
| armando-migliaccio | 174c751 | 2013-06-11 14:09:08 -0700 | [diff] [blame] | 37 | # Nicira Plugin does not run q-agt, but it currently needs dhcp and metadata agents | 
|  | 38 | _quantum_ovs_base_install_agent_packages | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 39 | } | 
|  | 40 |  | 
|  | 41 | function quantum_plugin_configure_common() { | 
|  | 42 | Q_PLUGIN_CONF_PATH=etc/quantum/plugins/nicira | 
|  | 43 | Q_PLUGIN_CONF_FILENAME=nvp.ini | 
|  | 44 | Q_DB_NAME="quantum_nvp" | 
|  | 45 | Q_PLUGIN_CLASS="quantum.plugins.nicira.nicira_nvp_plugin.QuantumPlugin.NvpPluginV2" | 
|  | 46 | } | 
|  | 47 |  | 
|  | 48 | function quantum_plugin_configure_debug_command() { | 
| armando-migliaccio | fb43089 | 2013-06-11 15:22:58 -0700 | [diff] [blame] | 49 | sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 50 | } | 
|  | 51 |  | 
|  | 52 | function quantum_plugin_configure_dhcp_agent() { | 
|  | 53 | setup_integration_bridge | 
|  | 54 | iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True | 
|  | 55 | iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network True | 
|  | 56 | iniset $Q_DHCP_CONF_FILE DEFAULT ovs_use_veth True | 
|  | 57 | } | 
|  | 58 |  | 
|  | 59 | function quantum_plugin_configure_l3_agent() { | 
|  | 60 | # Nicira plugin does not run L3 agent | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 61 | die $LINENO "q-l3 should must not be executed with Nicira plugin!" | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 62 | } | 
|  | 63 |  | 
|  | 64 | function quantum_plugin_configure_plugin_agent() { | 
|  | 65 | # Nicira plugin does not run L2 agent | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 66 | die $LINENO "q-agt must not be executed with Nicira plugin!" | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 67 | } | 
|  | 68 |  | 
|  | 69 | function quantum_plugin_configure_service() { | 
|  | 70 | if [[ "$MAX_LP_PER_BRIDGED_LS" != "" ]]; then | 
| Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame^] | 71 | iniset /$Q_PLUGIN_CONF_FILE nvp max_lp_per_bridged_ls $MAX_LP_PER_BRIDGED_LS | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 72 | fi | 
|  | 73 | if [[ "$MAX_LP_PER_OVERLAY_LS" != "" ]]; then | 
| Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame^] | 74 | iniset /$Q_PLUGIN_CONF_FILE nvp max_lp_per_overlay_ls $MAX_LP_PER_OVERLAY_LS | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 75 | fi | 
|  | 76 | if [[ "$FAILOVER_TIME" != "" ]]; then | 
| Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame^] | 77 | iniset /$Q_PLUGIN_CONF_FILE nvp failover_time $FAILOVER_TIME | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 78 | fi | 
|  | 79 | if [[ "$CONCURRENT_CONNECTIONS" != "" ]]; then | 
| Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame^] | 80 | iniset /$Q_PLUGIN_CONF_FILE nvp concurrent_connections $CONCURRENT_CONNECTIONS | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 81 | fi | 
|  | 82 |  | 
| armando-migliaccio | a25fa9d | 2013-04-15 13:46:35 -0700 | [diff] [blame] | 83 | if [[ "$DEFAULT_TZ_UUID" != "" ]]; then | 
|  | 84 | iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_tz_uuid $DEFAULT_TZ_UUID | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 85 | else | 
| armando-migliaccio | a25fa9d | 2013-04-15 13:46:35 -0700 | [diff] [blame] | 86 | die $LINENO "The nicira plugin won't work without a default transport zone." | 
|  | 87 | fi | 
|  | 88 | if [[ "$DEFAULT_L3_GW_SVC_UUID" != "" ]]; then | 
|  | 89 | iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l3_gw_service_uuid $DEFAULT_L3_GW_SVC_UUID | 
|  | 90 | Q_L3_ENABLED=True | 
|  | 91 | Q_L3_ROUTER_PER_TENANT=True | 
| Gary Kotton | d42634f | 2013-06-24 09:26:55 +0000 | [diff] [blame^] | 92 | iniset /$Q_PLUGIN_CONF_FILE nvp enable_metadata_access_network True | 
| armando-migliaccio | a25fa9d | 2013-04-15 13:46:35 -0700 | [diff] [blame] | 93 | fi | 
|  | 94 | if [[ "$DEFAULT_L2_GW_SVC_UUID" != "" ]]; then | 
|  | 95 | iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l2_gw_service_uuid $DEFAULT_L2_GW_SVC_UUID | 
|  | 96 | fi | 
|  | 97 | # NVP_CONTROLLERS must be a comma separated string | 
|  | 98 | if [[ "$NVP_CONTROLLERS" != "" ]]; then | 
|  | 99 | iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_controllers $NVP_CONTROLLERS | 
|  | 100 | else | 
|  | 101 | die $LINENO "The nicira plugin needs at least an NVP controller." | 
|  | 102 | fi | 
|  | 103 | if [[ "$NVP_USER" != "" ]]; then | 
|  | 104 | iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_user $NVP_USER | 
|  | 105 | fi | 
|  | 106 | if [[ "$NVP_PASSWORD" != "" ]]; then | 
|  | 107 | iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_password $NVP_PASSWORD | 
|  | 108 | fi | 
|  | 109 | if [[ "$NVP_REQ_TIMEOUT" != "" ]]; then | 
|  | 110 | iniset /$Q_PLUGIN_CONF_FILE DEFAULT req_timeout $NVP_REQ_TIMEOUT | 
|  | 111 | fi | 
|  | 112 | if [[ "$NVP_HTTP_TIMEOUT" != "" ]]; then | 
|  | 113 | iniset /$Q_PLUGIN_CONF_FILE DEFAULT http_timeout $NVP_HTTP_TIMEOUT | 
|  | 114 | fi | 
|  | 115 | if [[ "$NVP_RETRIES" != "" ]]; then | 
|  | 116 | iniset /$Q_PLUGIN_CONF_FILE DEFAULT retries $NVP_RETRIES | 
|  | 117 | fi | 
|  | 118 | if [[ "$NVP_REDIRECTS" != "" ]]; then | 
|  | 119 | iniset /$Q_PLUGIN_CONF_FILE DEFAULT redirects $NVP_REDIRECTS | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 120 | fi | 
|  | 121 | } | 
|  | 122 |  | 
|  | 123 | function quantum_plugin_setup_interface_driver() { | 
|  | 124 | local conf_file=$1 | 
|  | 125 | iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver | 
|  | 126 | } | 
|  | 127 |  | 
| Akihiro MOTOKI | 3452f8e | 2013-03-21 14:11:27 +0900 | [diff] [blame] | 128 | function has_quantum_plugin_security_group() { | 
|  | 129 | # 0 means True here | 
|  | 130 | return 0 | 
|  | 131 | } | 
|  | 132 |  | 
| armando-migliaccio | 7c025fe | 2013-05-08 11:33:07 -0700 | [diff] [blame] | 133 | function quantum_plugin_check_adv_test_requirements() { | 
|  | 134 | is_service_enabled q-dhcp && return 0 | 
|  | 135 | } | 
|  | 136 |  | 
| Dan Wendlandt | 555ecd0 | 2013-02-23 23:07:07 -0800 | [diff] [blame] | 137 | # Restore xtrace | 
|  | 138 | $MY_XTRACE |