709cc0c154
Enable the plugin to override the base DHCP DeviceManager. This patch does the following: 1. provide a class that overrides the default. This is required so that we can override the device_manager class 2. Introduces two new configuration variables: - dhcp_override_mac - enables the driver to override the neutron port mac address. This should be used when the DHCP agent is running on a VM that is connected to the DVS. This can save the admin the bother of setting 'forged transmits' to enable. This should be the MAC address of the VM - dvs_integration_bridge - the name of the bridge to plug the interface. This may be a dedicated bride that is connected to the DVS This enables one to use the simple DVS plugin and actaully get a DHCP address. NOTE: a port group that can see all of the tags should be configured. This is the port group that the dvs_integration_bridge should be attached to. DocImpact Change-Id: I6b0742b363e551e09a8c44fd59c698a90d180efd Depends-on: cee3664a77487750c2c5f68f1df97f3d80362e17
117 lines
3.9 KiB
Bash
117 lines
3.9 KiB
Bash
#!/bin/bash
|
|
|
|
# Copyright 2015 VMware, Inc.
|
|
#
|
|
# All Rights Reserved
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
# Neutron VMware DVS plugin
|
|
# -------------------------
|
|
|
|
# Settings previously defined in devstack:lib/neutron-legacy
|
|
NEUTRON_CONF_DIR=/etc/neutron
|
|
export NEUTRON_TEST_CONFIG_FILE=${NEUTRON_TEST_CONFIG_FILE:-"$NEUTRON_CONF_DIR/debug.ini"}
|
|
Q_DHCP_CONF_FILE=$NEUTRON_CONF_DIR/dhcp_agent.ini
|
|
|
|
# Save trace setting
|
|
DVS_XTRACE=$(set +o | grep xtrace)
|
|
set +o xtrace
|
|
|
|
source $TOP_DIR/lib/neutron_plugins/ovs_base
|
|
|
|
DVS_BRIDGE=${DVS_BRIDGE:-br-dvs}
|
|
DVS_INTERFACE=${DVS_INTERFACE:-eth1}
|
|
|
|
function setup_integration_bridge {
|
|
# remove integration bridge created by Neutron
|
|
for bridge in $(sudo ovs-vsctl list-br | grep -o -e $DVS_BRIDGE); do
|
|
sudo ovs-vsctl del-br ${bridge}
|
|
done
|
|
_neutron_ovs_base_setup_bridge $DVS_BRIDGE
|
|
sudo ovs-vsctl add-port $DVS_BRIDGE $DVS_INTERFACE
|
|
}
|
|
|
|
function is_neutron_ovs_base_plugin {
|
|
# DVS uses OVS, but not the l3-agent
|
|
return 0
|
|
}
|
|
|
|
function neutron_plugin_create_nova_conf {
|
|
# if n-cpu is enabled, then setup integration bridge
|
|
if is_service_enabled n-cpu; then
|
|
setup_integration_bridge
|
|
fi
|
|
}
|
|
|
|
function neutron_plugin_install_agent_packages {
|
|
# VMware DVS Plugin does not run q-agt, but it currently needs dhcp and metadata agents
|
|
_neutron_ovs_base_install_agent_packages
|
|
}
|
|
|
|
function neutron_plugin_configure_common {
|
|
Q_PLUGIN_CONF_PATH=etc/neutron/plugins/vmware
|
|
Q_PLUGIN_CONF_FILENAME=nsx.ini
|
|
Q_PLUGIN_SRC_CONF_PATH=vmware-nsx/etc
|
|
VMWARE_NSX_DIR=vmware-nsx
|
|
# Uses oslo config generator to generate sample configuration file
|
|
(cd $DEST/$VMWARE_NSX_DIR && exec ./tools/generate_config_file_samples.sh)
|
|
mkdir -p /$Q_PLUGIN_CONF_PATH
|
|
cp $DEST/$Q_PLUGIN_SRC_CONF_PATH/nsx.ini.sample /$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
|
|
Q_DB_NAME="neutron_nsx"
|
|
Q_PLUGIN_CLASS="vmware_nsx.plugin.NsxDvsPlugin"
|
|
}
|
|
|
|
function neutron_plugin_configure_debug_command {
|
|
# TBD (garyk)
|
|
:
|
|
}
|
|
|
|
function neutron_plugin_configure_dhcp_agent {
|
|
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_integration_bridge $OVS_BRIDGE
|
|
iniset $Q_DHCP_CONF_FILE DEFAULT dhcp_driver "vmware_nsx.plugins.dvs.dhcp.Dnsmasq"
|
|
}
|
|
|
|
function neutron_plugin_configure_l3_agent {
|
|
# VMware DVS plugin does not run L3 agent
|
|
die $LINENO "q-l3 should not be executed with VMware DVS plugin!"
|
|
}
|
|
|
|
function neutron_plugin_configure_plugin_agent {
|
|
# VMware DVS plugin does not run L2 agent
|
|
die $LINENO "q-agt must not be executed with VMware DVS plugin!"
|
|
}
|
|
|
|
function neutron_plugin_configure_service {
|
|
iniset /$Q_PLUGIN_CONF_FILE dvs host_ip "$VMWAREAPI_IP"
|
|
iniset /$Q_PLUGIN_CONF_FILE dvs host_username "$VMWAREAPI_USER"
|
|
iniset /$Q_PLUGIN_CONF_FILE dvs host_password "$VMWAREAPI_PASSWORD"
|
|
iniset /$Q_PLUGIN_CONF_FILE dvs ca_file "$VMWAREAPI_CA_FILE"
|
|
iniset /$Q_PLUGIN_CONF_FILE dvs insecure "$VMWAREAPI_INSECURE"
|
|
iniset /$Q_PLUGIN_CONF_FILE dvs dvs_name "$VMWARE_DVS_NAME"
|
|
}
|
|
|
|
function neutron_plugin_setup_interface_driver {
|
|
local conf_file=$1
|
|
iniset $conf_file DEFAULT interface_driver neutron.agent.linux.interface.OVSInterfaceDriver
|
|
}
|
|
|
|
function neutron_plugin_check_adv_test_requirements {
|
|
is_service_enabled q-dhcp && return 0
|
|
}
|
|
|
|
# Restore xtrace
|
|
$DVS_XTRACE
|