e263c82e |
#!/bin/bash
# |
05952e3f |
# Neutron VMware NSX plugin
# ------------------------- |
555ecd07 |
# Save trace setting |
e3a9160c |
NSX_XTRACE=$(set +o | grep xtrace) |
555ecd07 |
set +o xtrace
|
b05c8769 |
source $TOP_DIR/lib/neutron_plugins/ovs_base |
555ecd07 |
|
aee18c74 |
function setup_integration_bridge { |
b05c8769 |
_neutron_ovs_base_setup_bridge $OVS_BRIDGE |
05952e3f |
# Set manager to NSX controller (1st of list)
if [[ "$NSX_CONTROLLERS" != "" ]]; then |
555ecd07 |
# Get the first controller |
05952e3f |
controllers=(${NSX_CONTROLLERS//,/ }) |
555ecd07 |
OVS_MGR_IP=${controllers[0]}
else |
07115eb5 |
die $LINENO "Error - No controller specified. Unable to set a manager for OVS" |
555ecd07 |
fi
sudo ovs-vsctl set-manager ssl:$OVS_MGR_IP
}
|
aee18c74 |
function is_neutron_ovs_base_plugin { |
05952e3f |
# NSX uses OVS, but not the l3-agent |
555ecd07 |
return 0
}
|
aee18c74 |
function neutron_plugin_create_nova_conf { |
555ecd07 |
# if n-cpu is enabled, then setup integration bridge
if is_service_enabled n-cpu; then
setup_integration_bridge
fi
}
|
aee18c74 |
function neutron_plugin_install_agent_packages { |
05952e3f |
# VMware NSX Plugin does not run q-agt, but it currently needs dhcp and metadata agents |
b05c8769 |
_neutron_ovs_base_install_agent_packages |
555ecd07 |
}
|
aee18c74 |
function neutron_plugin_configure_common { |
05952e3f |
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/vmware
Q_PLUGIN_CONF_FILENAME=nsx.ini |
41e36d6b |
Q_PLUGIN_CLASS="neutron.plugins.vmware.plugin.NsxPlugin" |
555ecd07 |
}
|
aee18c74 |
function neutron_plugin_configure_debug_command { |
fb430899 |
sudo ovs-vsctl --no-wait -- --may-exist add-br $PUBLIC_BRIDGE |
dfe3f6ba |
iniset $NEUTRON_TEST_CONFIG_FILE DEFAULT external_network_bridge "$PUBLIC_BRIDGE" |
555ecd07 |
}
|
aee18c74 |
function neutron_plugin_configure_dhcp_agent { |
555ecd07 |
setup_integration_bridge
iniset $Q_DHCP_CONF_FILE DEFAULT enable_isolated_metadata True
iniset $Q_DHCP_CONF_FILE DEFAULT enable_metadata_network True
iniset $Q_DHCP_CONF_FILE DEFAULT ovs_use_veth True
}
|
aee18c74 |
function neutron_plugin_configure_l3_agent { |
05952e3f |
# VMware NSX plugin does not run L3 agent |
b4052563 |
die $LINENO "q-l3 should not be executed with VMware NSX plugin!" |
555ecd07 |
}
|
aee18c74 |
function neutron_plugin_configure_plugin_agent { |
05952e3f |
# VMware NSX plugin does not run L2 agent
die $LINENO "q-agt must not be executed with VMware NSX plugin!" |
555ecd07 |
}
|
aee18c74 |
function neutron_plugin_configure_service { |
555ecd07 |
if [[ "$MAX_LP_PER_BRIDGED_LS" != "" ]]; then |
05952e3f |
iniset /$Q_PLUGIN_CONF_FILE nsx max_lp_per_bridged_ls $MAX_LP_PER_BRIDGED_LS |
555ecd07 |
fi
if [[ "$MAX_LP_PER_OVERLAY_LS" != "" ]]; then |
05952e3f |
iniset /$Q_PLUGIN_CONF_FILE nsx max_lp_per_overlay_ls $MAX_LP_PER_OVERLAY_LS |
555ecd07 |
fi
if [[ "$FAILOVER_TIME" != "" ]]; then |
05952e3f |
iniset /$Q_PLUGIN_CONF_FILE nsx failover_time $FAILOVER_TIME |
555ecd07 |
fi
if [[ "$CONCURRENT_CONNECTIONS" != "" ]]; then |
05952e3f |
iniset /$Q_PLUGIN_CONF_FILE nsx concurrent_connections $CONCURRENT_CONNECTIONS |
555ecd07 |
fi
|
a25fa9db |
if [[ "$DEFAULT_TZ_UUID" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_tz_uuid $DEFAULT_TZ_UUID |
555ecd07 |
else |
05952e3f |
die $LINENO "The VMware NSX plugin won't work without a default transport zone." |
a25fa9db |
fi
if [[ "$DEFAULT_L3_GW_SVC_UUID" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l3_gw_service_uuid $DEFAULT_L3_GW_SVC_UUID
Q_L3_ENABLED=True
Q_L3_ROUTER_PER_TENANT=True |
05952e3f |
iniset /$Q_PLUGIN_CONF_FILE nsx metadata_mode access_network |
a25fa9db |
fi
if [[ "$DEFAULT_L2_GW_SVC_UUID" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_l2_gw_service_uuid $DEFAULT_L2_GW_SVC_UUID
fi |
05952e3f |
# NSX_CONTROLLERS must be a comma separated string
if [[ "$NSX_CONTROLLERS" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_controllers $NSX_CONTROLLERS |
a25fa9db |
else |
05952e3f |
die $LINENO "The VMware NSX plugin needs at least an NSX controller." |
a25fa9db |
fi |
05952e3f |
if [[ "$NSX_USER" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_user $NSX_USER |
a25fa9db |
fi |
05952e3f |
if [[ "$NSX_PASSWORD" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_password $NSX_PASSWORD |
a25fa9db |
fi |
05952e3f |
if [[ "$NSX_HTTP_TIMEOUT" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT http_timeout $NSX_HTTP_TIMEOUT |
a25fa9db |
fi |
05952e3f |
if [[ "$NSX_RETRIES" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT retries $NSX_RETRIES |
a25fa9db |
fi |
05952e3f |
if [[ "$NSX_REDIRECTS" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT redirects $NSX_REDIRECTS |
555ecd07 |
fi |
ec0ff2ac |
if [[ "$AGENT_MODE" != "" ]]; then |
05952e3f |
iniset /$Q_PLUGIN_CONF_FILE nsx agent_mode $AGENT_MODE |
ec0ff2ac |
if [[ "$AGENT_MODE" == "agentless" ]]; then
if [[ "$DEFAULT_SERVICE_CLUSTER_UUID" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE DEFAULT default_service_cluster_uuid $DEFAULT_SERVICE_CLUSTER_UUID
else
die $LINENO "Agentless mode requires a service cluster."
fi |
05952e3f |
iniset /$Q_PLUGIN_CONF_FILE nsx_metadata metadata_server_address $Q_META_DATA_IP |
ec0ff2ac |
fi
fi |
555ecd07 |
}
|
aee18c74 |
function neutron_plugin_setup_interface_driver { |
555ecd07 |
local conf_file=$1 |
b05c8769 |
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver |
555ecd07 |
}
|
aee18c74 |
function has_neutron_plugin_security_group { |
3452f8eb |
# 0 means True here
return 0
}
|
aee18c74 |
function neutron_plugin_check_adv_test_requirements { |
7c025fed |
is_service_enabled q-dhcp && return 0
}
|
555ecd07 |
# Restore xtrace |
e3a9160c |
$NSX_XTRACE |