blob: f4eb82d04e3381ddb18dc8c7d7f8a922367a8ce0 [file] [log] [blame]
armando-migliaccio05952e32014-01-05 07:59:06 -08001# Neutron VMware NSX plugin
2# -------------------------
3
4# Save trace setting
Dean Troyere3a91602014-03-28 12:40:56 -05005NSX_XTRACE=$(set +o | grep xtrace)
armando-migliaccio05952e32014-01-05 07:59:06 -08006set +o xtrace
7
8source $TOP_DIR/lib/neutron_plugins/ovs_base
9
Ian Wienandaee18c72014-02-21 15:35:08 +110010function setup_integration_bridge {
armando-migliaccio05952e32014-01-05 07:59:06 -080011 _neutron_ovs_base_setup_bridge $OVS_BRIDGE
12 # Set manager to NSX controller (1st of list)
13 if [[ "$NSX_CONTROLLERS" != "" ]]; then
14 # Get the first controller
15 controllers=(${NSX_CONTROLLERS//,/ })
16 OVS_MGR_IP=${controllers[0]}
17 else
18 die $LINENO "Error - No controller specified. Unable to set a manager for OVS"
19 fi
20 sudo ovs-vsctl set-manager ssl:$OVS_MGR_IP
21}
22
Ian Wienandaee18c72014-02-21 15:35:08 +110023function is_neutron_ovs_base_plugin {
armando-migliaccio05952e32014-01-05 07:59:06 -080024 # NSX uses OVS, but not the l3-agent
25 return 0
26}
27
Ian Wienandaee18c72014-02-21 15:35:08 +110028function neutron_plugin_create_nova_conf {
armando-migliaccio05952e32014-01-05 07:59:06 -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
Ian Wienandaee18c72014-02-21 15:35:08 +110035function neutron_plugin_install_agent_packages {
armando-migliaccio05952e32014-01-05 07:59:06 -080036 # VMware NSX Plugin does not run q-agt, but it currently needs dhcp and metadata agents
37 _neutron_ovs_base_install_agent_packages
38}
39
Ian Wienandaee18c72014-02-21 15:35:08 +110040function neutron_plugin_configure_common {
armando-migliaccio05952e32014-01-05 07:59:06 -080041 Q_PLUGIN_CONF_PATH=etc/neutron/plugins/vmware
42 Q_PLUGIN_CONF_FILENAME=nsx.ini
armando-migliaccio41e36d62014-02-04 13:39:32 -080043 Q_PLUGIN_CLASS="neutron.plugins.vmware.plugin.NsxPlugin"
armando-migliaccio05952e32014-01-05 07:59:06 -080044}
45
Ian Wienandaee18c72014-02-21 15:35:08 +110046function neutron_plugin_configure_debug_command {
armando-migliaccio05952e32014-01-05 07:59:06 -080047 sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE
48 iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge "$PUBLIC_BRIDGE"
49}
50
Ian Wienandaee18c72014-02-21 15:35:08 +110051function neutron_plugin_configure_dhcp_agent {
armando-migliaccio05952e32014-01-05 07:59:06 -080052 setup_integration_bridge
53 iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True
54 iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network True
55 iniset $Q_DHCP_CONF_FILE DEFAULT ovs_use_veth True
56}
57
Ian Wienandaee18c72014-02-21 15:35:08 +110058function neutron_plugin_configure_l3_agent {
armando-migliaccio05952e32014-01-05 07:59:06 -080059 # VMware NSX plugin does not run L3 agent
Gary Kottonb4052562014-06-11 04:16:57 -070060 die $LINENO "q-l3 should not be executed with VMware NSX plugin!"
armando-migliaccio05952e32014-01-05 07:59:06 -080061}
62
Ian Wienandaee18c72014-02-21 15:35:08 +110063function neutron_plugin_configure_plugin_agent {
armando-migliaccio05952e32014-01-05 07:59:06 -080064 # VMware NSX plugin does not run L2 agent
65 die $LINENO "q-agt must not be executed with VMware NSX plugin!"
66}
67
Ian Wienandaee18c72014-02-21 15:35:08 +110068function neutron_plugin_configure_service {
armando-migliaccio05952e32014-01-05 07:59:06 -080069 if [[ "$MAX_LP_PER_BRIDGED_LS" != "" ]]; then
70 iniset /$Q_PLUGIN_CONF_FILE nsx max_lp_per_bridged_ls $MAX_LP_PER_BRIDGED_LS
71 fi
72 if [[ "$MAX_LP_PER_OVERLAY_LS" != "" ]]; then
73 iniset /$Q_PLUGIN_CONF_FILE nsx max_lp_per_overlay_ls $MAX_LP_PER_OVERLAY_LS
74 fi
75 if [[ "$FAILOVER_TIME" != "" ]]; then
76 iniset /$Q_PLUGIN_CONF_FILE nsx failover_time $FAILOVER_TIME
77 fi
78 if [[ "$CONCURRENT_CONNECTIONS" != "" ]]; then
79 iniset /$Q_PLUGIN_CONF_FILE nsx concurrent_connections $CONCURRENT_CONNECTIONS
80 fi
81
82 if [[ "$DEFAULT_TZ_UUID" != "" ]]; then
83 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_tz_uuid $DEFAULT_TZ_UUID
84 else
85 die $LINENO "The VMware NSX plugin won't work without a default transport zone."
86 fi
87 if [[ "$DEFAULT_L3_GW_SVC_UUID" != "" ]]; then
88 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l3_gw_service_uuid $DEFAULT_L3_GW_SVC_UUID
89 Q_L3_ENABLED=True
90 Q_L3_ROUTER_PER_TENANT=True
91 iniset /$Q_PLUGIN_CONF_FILE nsx metadata_mode access_network
92 fi
93 if [[ "$DEFAULT_L2_GW_SVC_UUID" != "" ]]; then
94 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l2_gw_service_uuid $DEFAULT_L2_GW_SVC_UUID
95 fi
96 # NSX_CONTROLLERS must be a comma separated string
97 if [[ "$NSX_CONTROLLERS" != "" ]]; then
98 iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_controllers $NSX_CONTROLLERS
99 else
100 die $LINENO "The VMware NSX plugin needs at least an NSX controller."
101 fi
102 if [[ "$NSX_USER" != "" ]]; then
103 iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_user $NSX_USER
104 fi
105 if [[ "$NSX_PASSWORD" != "" ]]; then
106 iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_password $NSX_PASSWORD
107 fi
armando-migliaccio05952e32014-01-05 07:59:06 -0800108 if [[ "$NSX_HTTP_TIMEOUT" != "" ]]; then
109 iniset /$Q_PLUGIN_CONF_FILE DEFAULT http_timeout $NSX_HTTP_TIMEOUT
110 fi
111 if [[ "$NSX_RETRIES" != "" ]]; then
112 iniset /$Q_PLUGIN_CONF_FILE DEFAULT retries $NSX_RETRIES
113 fi
114 if [[ "$NSX_REDIRECTS" != "" ]]; then
115 iniset /$Q_PLUGIN_CONF_FILE DEFAULT redirects $NSX_REDIRECTS
116 fi
117 if [[ "$AGENT_MODE" != "" ]]; then
118 iniset /$Q_PLUGIN_CONF_FILE nsx agent_mode $AGENT_MODE
119 if [[ "$AGENT_MODE" == "agentless" ]]; then
120 if [[ "$DEFAULT_SERVICE_CLUSTER_UUID" != "" ]]; then
121 iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_service_cluster_uuid $DEFAULT_SERVICE_CLUSTER_UUID
122 else
123 die $LINENO "Agentless mode requires a service cluster."
124 fi
125 iniset /$Q_PLUGIN_CONF_FILE nsx_metadata metadata_server_address $Q_META_DATA_IP
126 fi
127 fi
128}
129
Ian Wienandaee18c72014-02-21 15:35:08 +1100130function neutron_plugin_setup_interface_driver {
armando-migliaccio05952e32014-01-05 07:59:06 -0800131 local conf_file=$1
132 iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver
133}
134
Ian Wienandaee18c72014-02-21 15:35:08 +1100135function has_neutron_plugin_security_group {
armando-migliaccio05952e32014-01-05 07:59:06 -0800136 # 0 means True here
137 return 0
138}
139
Ian Wienandaee18c72014-02-21 15:35:08 +1100140function neutron_plugin_check_adv_test_requirements {
armando-migliaccio05952e32014-01-05 07:59:06 -0800141 is_service_enabled q-dhcp && return 0
142}
143
144# Restore xtrace
Dean Troyere3a91602014-03-28 12:40:56 -0500145$NSX_XTRACE