SR-IOV: devstack support for SR-IOV agent

Change-Id: Ia0649962bd0c68d9c99fd54cc84ce8dd67d792e8
This commit is contained in:
Moshe Levi 2015-08-25 15:50:09 +03:00
parent fee48aa108
commit bd07b74045
4 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,23 @@
SRIOV_AGENT_CONF="${Q_PLUGIN_CONF_PATH}/sriov_agent.ini"
SRIOV_AGENT_BINARY="${NEUTRON_BIN_DIR}/neutron-sriov-nic-agent"
function configure_l2_agent_sriovnicswitch {
if [[ -n "$PHYSICAL_NETWORK" ]] && [[ -n "$PHYSICAL_INTERFACE" ]]; then
PHYSICAL_DEVICE_MAPPINGS=$PHYSICAL_NETWORK:$PHYSICAL_INTERFACE
fi
if [[ -n "$PHYSICAL_DEVICE_MAPPINGS" ]]; then
iniset /$SRIOV_AGENT_CONF sriov_nic physical_device_mappings $PHYSICAL_DEVICE_MAPPINGS
fi
iniset /$SRIOV_AGENT_CONF securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver
iniset /$SRIOV_AGENT_CONF agent extensions "$L2_AGENT_EXTENSIONS"
}
function start_l2_agent_sriov {
run_process q-sriov-agt "$SRIOV_AGENT_BINARY --config-file $NEUTRON_CONF --config-file /$SRIOV_AGENT_CONF"
}
function stop_l2_agent_sriov {
stop_process q-sriov-agt
}

View File

@ -1,3 +1,6 @@
source $LIBDIR/ml2_drivers/sriovnicswitch
function enable_ml2_extension_driver { function enable_ml2_extension_driver {
local extension_driver=$1 local extension_driver=$1
if [[ -z "$Q_ML2_PLUGIN_EXT_DRIVERS" ]]; then if [[ -z "$Q_ML2_PLUGIN_EXT_DRIVERS" ]]; then
@ -11,3 +14,16 @@ function enable_ml2_extension_driver {
function configure_qos_ml2 { function configure_qos_ml2 {
enable_ml2_extension_driver "qos" enable_ml2_extension_driver "qos"
} }
function configure_ml2 {
OIFS=$IFS;
IFS=",";
mechanism_drivers_array=($Q_ML2_PLUGIN_MECHANISM_DRIVERS);
IFS=$OIFS;
for mechanism_driver in "${mechanism_drivers_array[@]}"; do
if [ "$(type -t configure_ml2_$mechanism_driver)" = function ]; then
configure_ml2_$mechanism_driver
fi
done
}

View File

@ -0,0 +1,3 @@
function configure_ml2_sriovnicswitch {
iniset /$Q_PLUGIN_CONF_FILE ml2_sriov agent_required True
}

View File

@ -1,6 +1,7 @@
LIBDIR=$DEST/neutron/devstack/lib LIBDIR=$DEST/neutron/devstack/lib
source $LIBDIR/l2_agent source $LIBDIR/l2_agent
source $LIBDIR/l2_agent_sriovnicswitch
source $LIBDIR/ml2 source $LIBDIR/ml2
source $LIBDIR/qos source $LIBDIR/qos
@ -15,4 +16,26 @@ if [[ "$1" == "stack" && "$2" == "post-config" ]]; then
if is_service_enabled q-agt; then if is_service_enabled q-agt; then
configure_l2_agent configure_l2_agent
fi fi
#Note: sriov agent should run with OVS or linux bridge agent
#because they are the mechanisms that bind the DHCP and router ports.
#Currently devstack lacks the option to run two agents on the same node.
#Therefore we create new service, q-sriov-agt, and the q-agt should be OVS
#or linux bridge.
if is_service_enabled q-sriov-agt; then
configure_$Q_PLUGIN
configure_l2_agent
configure_l2_agent_sriovnicswitch
fi
fi
if [[ "$1" == "stack" && "$2" == "extra" ]]; then
if is_service_enabled q-sriov-agt; then
start_l2_agent_sriov
fi
fi
if [[ "$1" == "unstack" ]]; then
if is_service_enabled q-sriov-agt; then
stop_l2_agent_sriov
fi
fi fi