blob: 87d3c3d17bbcf02e5489b411241167052809a7f3 [file] [log] [blame]
Mark McClainb05c8762013-07-06 23:29:39 -04001# Neutron Nicira NVP plugin
Dan Wendlandt555ecd02013-02-23 23:07:07 -08002# ---------------------------
3
4# Save trace setting
5MY_XTRACE=$(set +o | grep xtrace)
6set +o xtrace
7
Mark McClainb05c8762013-07-06 23:29:39 -04008source $TOP_DIR/lib/neutron_plugins/ovs_base
Dan Wendlandt555ecd02013-02-23 23:07:07 -08009
10function setup_integration_bridge() {
Mark McClainb05c8762013-07-06 23:29:39 -040011 _neutron_ovs_base_setup_bridge $OVS_BRIDGE
Dan Wendlandt555ecd02013-02-23 23:07:07 -080012 # 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 Wendlandt555ecd02013-02-23 23:07:07 -080017 else
Nachi Ueno07115eb2013-02-26 12:38:18 -080018 die $LINENO "Error - No controller specified. Unable to set a manager for OVS"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080019 fi
20 sudo ovs-vsctl set-manager ssl:$OVS_MGR_IP
21}
22
Mark McClainb05c8762013-07-06 23:29:39 -040023function is_neutron_ovs_base_plugin() {
Dan Wendlandt555ecd02013-02-23 23:07:07 -080024 # NVP uses OVS, but not the l3-agent
25 return 0
26}
27
Mark McClainb05c8762013-07-06 23:29:39 -040028function neutron_plugin_create_nova_conf() {
Dan Wendlandt555ecd02013-02-23 23:07:07 -080029 # if n-cpu is enabled, then setup integration bridge
30 if is_service_enabled n-cpu; then
31 setup_integration_bridge
32 fi
33}
34
Mark McClainb05c8762013-07-06 23:29:39 -040035function neutron_plugin_install_agent_packages() {
armando-migliaccio174c7512013-06-11 14:09:08 -070036 # Nicira Plugin does not run q-agt, but it currently needs dhcp and metadata agents
Mark McClainb05c8762013-07-06 23:29:39 -040037 _neutron_ovs_base_install_agent_packages
Dan Wendlandt555ecd02013-02-23 23:07:07 -080038}
39
Mark McClainb05c8762013-07-06 23:29:39 -040040function neutron_plugin_configure_common() {
41 Q_PLUGIN_CONF_PATH=etc/neutron/plugins/nicira
Dan Wendlandt555ecd02013-02-23 23:07:07 -080042 Q_PLUGIN_CONF_FILENAME=nvp.ini
Mark McClainb05c8762013-07-06 23:29:39 -040043 Q_DB_NAME="neutron_nvp"
armando-migliaccioaadef072013-07-08 11:52:17 -070044 Q_PLUGIN_CLASS="neutron.plugins.nicira.NeutronPlugin.NvpPluginV2"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080045}
46
Mark McClainb05c8762013-07-06 23:29:39 -040047function neutron_plugin_configure_debug_command() {
armando-migliacciofb430892013-06-11 15:22:58 -070048 sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE
armando-migliacciodfe3f6b2013-07-19 16:51:26 -070049 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge "$PUBLIC_BRIDGE"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080050}
51
Mark McClainb05c8762013-07-06 23:29:39 -040052function neutron_plugin_configure_dhcp_agent() {
Dan Wendlandt555ecd02013-02-23 23:07:07 -080053 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
Mark McClainb05c8762013-07-06 23:29:39 -040059function neutron_plugin_configure_l3_agent() {
Sean Dague3bdb9222013-10-22 08:36:16 -040060 # Nicira plugin does not run L3 agent
61 die $LINENO "q-l3 should must not be executed with Nicira plugin!"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080062}
63
Mark McClainb05c8762013-07-06 23:29:39 -040064function neutron_plugin_configure_plugin_agent() {
Sean Dague3bdb9222013-10-22 08:36:16 -040065 # Nicira plugin does not run L2 agent
66 die $LINENO "q-agt must not be executed with Nicira plugin!"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080067}
68
Mark McClainb05c8762013-07-06 23:29:39 -040069function neutron_plugin_configure_service() {
Dan Wendlandt555ecd02013-02-23 23:07:07 -080070 if [[ "$MAX_LP_PER_BRIDGED_LS" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000071 iniset /$Q_PLUGIN_CONF_FILE nvp max_lp_per_bridged_ls $MAX_LP_PER_BRIDGED_LS
Dan Wendlandt555ecd02013-02-23 23:07:07 -080072 fi
73 if [[ "$MAX_LP_PER_OVERLAY_LS" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000074 iniset /$Q_PLUGIN_CONF_FILE nvp max_lp_per_overlay_ls $MAX_LP_PER_OVERLAY_LS
Dan Wendlandt555ecd02013-02-23 23:07:07 -080075 fi
76 if [[ "$FAILOVER_TIME" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000077 iniset /$Q_PLUGIN_CONF_FILE nvp failover_time $FAILOVER_TIME
Dan Wendlandt555ecd02013-02-23 23:07:07 -080078 fi
79 if [[ "$CONCURRENT_CONNECTIONS" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000080 iniset /$Q_PLUGIN_CONF_FILE nvp concurrent_connections $CONCURRENT_CONNECTIONS
Dan Wendlandt555ecd02013-02-23 23:07:07 -080081 fi
82
armando-migliaccioa25fa9d2013-04-15 13:46:35 -070083 if [[ "$DEFAULT_TZ_UUID" != "" ]]; then
84 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_tz_uuid $DEFAULT_TZ_UUID
Dan Wendlandt555ecd02013-02-23 23:07:07 -080085 else
armando-migliaccioa25fa9d2013-04-15 13:46:35 -070086 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
Salvatore Orlandof5dbf8c2013-08-13 09:02:46 -070092 iniset /$Q_PLUGIN_CONF_FILE nvp metadata_mode access_network
armando-migliaccioa25fa9d2013-04-15 13:46:35 -070093 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 Wendlandt555ecd02013-02-23 23:07:07 -0800120 fi
armando-migliaccioec0ff2a2013-09-25 17:29:58 -0700121 if [[ "$AGENT_MODE" != "" ]]; then
122 iniset /$Q_PLUGIN_CONF_FILE nvp agent_mode $AGENT_MODE
123 if [[ "$AGENT_MODE" == "agentless" ]]; then
124 if [[ "$DEFAULT_SERVICE_CLUSTER_UUID" != "" ]]; then
125 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_service_cluster_uuid $DEFAULT_SERVICE_CLUSTER_UUID
126 else
127 die $LINENO "Agentless mode requires a service cluster."
128 fi
armando-migliaccio976e4182013-10-02 12:59:07 -0700129 iniset /$Q_PLUGIN_CONF_FILE nvp_metadata metadata_server_address $Q_META_DATA_IP
armando-migliaccioec0ff2a2013-09-25 17:29:58 -0700130 fi
131 fi
Dan Wendlandt555ecd02013-02-23 23:07:07 -0800132}
133
Mark McClainb05c8762013-07-06 23:29:39 -0400134function neutron_plugin_setup_interface_driver() {
Dan Wendlandt555ecd02013-02-23 23:07:07 -0800135 local conf_file=$1
Mark McClainb05c8762013-07-06 23:29:39 -0400136 iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver
Dan Wendlandt555ecd02013-02-23 23:07:07 -0800137}
138
Mark McClainb05c8762013-07-06 23:29:39 -0400139function has_neutron_plugin_security_group() {
Akihiro MOTOKI3452f8e2013-03-21 14:11:27 +0900140 # 0 means True here
141 return 0
142}
143
Mark McClainb05c8762013-07-06 23:29:39 -0400144function neutron_plugin_check_adv_test_requirements() {
armando-migliaccio7c025fe2013-05-08 11:33:07 -0700145 is_service_enabled q-dhcp && return 0
146}
147
Dan Wendlandt555ecd02013-02-23 23:07:07 -0800148# Restore xtrace
149$MY_XTRACE