blob: ca89d57fe78122c172db5c423abb6c2d6ec1a261 [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 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
Mark McClainb05c8762013-07-06 23:29:39 -040036function neutron_plugin_install_agent_packages() {
armando-migliaccio174c7512013-06-11 14:09:08 -070037 # Nicira Plugin does not run q-agt, but it currently needs dhcp and metadata agents
Mark McClainb05c8762013-07-06 23:29:39 -040038 _neutron_ovs_base_install_agent_packages
Dan Wendlandt555ecd02013-02-23 23:07:07 -080039}
40
Mark McClainb05c8762013-07-06 23:29:39 -040041function neutron_plugin_configure_common() {
42 Q_PLUGIN_CONF_PATH=etc/neutron/plugins/nicira
Dan Wendlandt555ecd02013-02-23 23:07:07 -080043 Q_PLUGIN_CONF_FILENAME=nvp.ini
Mark McClainb05c8762013-07-06 23:29:39 -040044 Q_DB_NAME="neutron_nvp"
armando-migliaccioaadef072013-07-08 11:52:17 -070045 Q_PLUGIN_CLASS="neutron.plugins.nicira.NeutronPlugin.NvpPluginV2"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080046}
47
Mark McClainb05c8762013-07-06 23:29:39 -040048function neutron_plugin_configure_debug_command() {
armando-migliacciofb430892013-06-11 15:22:58 -070049 sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE
armando-migliacciodfe3f6b2013-07-19 16:51:26 -070050 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge "$PUBLIC_BRIDGE"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080051}
52
Mark McClainb05c8762013-07-06 23:29:39 -040053function neutron_plugin_configure_dhcp_agent() {
Dan Wendlandt555ecd02013-02-23 23:07:07 -080054 setup_integration_bridge
55 iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True
56 iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network True
57 iniset $Q_DHCP_CONF_FILE DEFAULT ovs_use_veth True
58}
59
Mark McClainb05c8762013-07-06 23:29:39 -040060function neutron_plugin_configure_l3_agent() {
Dan Wendlandt555ecd02013-02-23 23:07:07 -080061 # Nicira plugin does not run L3 agent
Nachi Ueno07115eb2013-02-26 12:38:18 -080062 die $LINENO "q-l3 should must not be executed with Nicira plugin!"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080063}
64
Mark McClainb05c8762013-07-06 23:29:39 -040065function neutron_plugin_configure_plugin_agent() {
Dan Wendlandt555ecd02013-02-23 23:07:07 -080066 # Nicira plugin does not run L2 agent
Nachi Ueno07115eb2013-02-26 12:38:18 -080067 die $LINENO "q-agt must not be executed with Nicira plugin!"
Dan Wendlandt555ecd02013-02-23 23:07:07 -080068}
69
Mark McClainb05c8762013-07-06 23:29:39 -040070function neutron_plugin_configure_service() {
Dan Wendlandt555ecd02013-02-23 23:07:07 -080071 if [[ "$MAX_LP_PER_BRIDGED_LS" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000072 iniset /$Q_PLUGIN_CONF_FILE nvp max_lp_per_bridged_ls $MAX_LP_PER_BRIDGED_LS
Dan Wendlandt555ecd02013-02-23 23:07:07 -080073 fi
74 if [[ "$MAX_LP_PER_OVERLAY_LS" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000075 iniset /$Q_PLUGIN_CONF_FILE nvp max_lp_per_overlay_ls $MAX_LP_PER_OVERLAY_LS
Dan Wendlandt555ecd02013-02-23 23:07:07 -080076 fi
77 if [[ "$FAILOVER_TIME" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000078 iniset /$Q_PLUGIN_CONF_FILE nvp failover_time $FAILOVER_TIME
Dan Wendlandt555ecd02013-02-23 23:07:07 -080079 fi
80 if [[ "$CONCURRENT_CONNECTIONS" != "" ]]; then
Gary Kottond42634f2013-06-24 09:26:55 +000081 iniset /$Q_PLUGIN_CONF_FILE nvp concurrent_connections $CONCURRENT_CONNECTIONS
Dan Wendlandt555ecd02013-02-23 23:07:07 -080082 fi
83
armando-migliaccioa25fa9d2013-04-15 13:46:35 -070084 if [[ "$DEFAULT_TZ_UUID" != "" ]]; then
85 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_tz_uuid $DEFAULT_TZ_UUID
Dan Wendlandt555ecd02013-02-23 23:07:07 -080086 else
armando-migliaccioa25fa9d2013-04-15 13:46:35 -070087 die $LINENO "The nicira plugin won't work without a default transport zone."
88 fi
89 if [[ "$DEFAULT_L3_GW_SVC_UUID" != "" ]]; then
90 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l3_gw_service_uuid $DEFAULT_L3_GW_SVC_UUID
91 Q_L3_ENABLED=True
92 Q_L3_ROUTER_PER_TENANT=True
Salvatore Orlandof5dbf8c2013-08-13 09:02:46 -070093 iniset /$Q_PLUGIN_CONF_FILE nvp metadata_mode access_network
armando-migliaccioa25fa9d2013-04-15 13:46:35 -070094 fi
95 if [[ "$DEFAULT_L2_GW_SVC_UUID" != "" ]]; then
96 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l2_gw_service_uuid $DEFAULT_L2_GW_SVC_UUID
97 fi
98 # NVP_CONTROLLERS must be a comma separated string
99 if [[ "$NVP_CONTROLLERS" != "" ]]; then
100 iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_controllers $NVP_CONTROLLERS
101 else
102 die $LINENO "The nicira plugin needs at least an NVP controller."
103 fi
104 if [[ "$NVP_USER" != "" ]]; then
105 iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_user $NVP_USER
106 fi
107 if [[ "$NVP_PASSWORD" != "" ]]; then
108 iniset /$Q_PLUGIN_CONF_FILE DEFAULT nvp_password $NVP_PASSWORD
109 fi
110 if [[ "$NVP_REQ_TIMEOUT" != "" ]]; then
111 iniset /$Q_PLUGIN_CONF_FILE DEFAULT req_timeout $NVP_REQ_TIMEOUT
112 fi
113 if [[ "$NVP_HTTP_TIMEOUT" != "" ]]; then
114 iniset /$Q_PLUGIN_CONF_FILE DEFAULT http_timeout $NVP_HTTP_TIMEOUT
115 fi
116 if [[ "$NVP_RETRIES" != "" ]]; then
117 iniset /$Q_PLUGIN_CONF_FILE DEFAULT retries $NVP_RETRIES
118 fi
119 if [[ "$NVP_REDIRECTS" != "" ]]; then
120 iniset /$Q_PLUGIN_CONF_FILE DEFAULT redirects $NVP_REDIRECTS
Dan Wendlandt555ecd02013-02-23 23:07:07 -0800121 fi
armando-migliaccioec0ff2a2013-09-25 17:29:58 -0700122 if [[ "$AGENT_MODE" != "" ]]; then
123 iniset /$Q_PLUGIN_CONF_FILE nvp agent_mode $AGENT_MODE
124 if [[ "$AGENT_MODE" == "agentless" ]]; then
125 if [[ "$DEFAULT_SERVICE_CLUSTER_UUID" != "" ]]; then
126 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_service_cluster_uuid $DEFAULT_SERVICE_CLUSTER_UUID
127 else
128 die $LINENO "Agentless mode requires a service cluster."
129 fi
130 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