Fix IB and VFs order issues

Change provider of DHCP service and set a default value
to iSER interface for servers without VFs, before adding
intel_iommu to kernel parameters and reboot.

Change-Id: Idf3eddcf9cb2226998b186febb7cc720cda39e70
This commit is contained in:
Aviram Bar-Haim 2015-05-06 20:40:14 +03:00
parent 650ee39193
commit 2518848783
6 changed files with 36 additions and 14 deletions

View File

@ -26,5 +26,17 @@ if [ $DISTRO == 'ubuntu' ] && [ $DRIVER == 'eth_ipoib' ]; then
cat /etc/network/interfaces.d/ifcfg-ib* >> /etc/network/interfaces
\rm -f /etc/network/interfaces.d/ifcfg-ib0*
fi
# Kill tgt daemons if exists
tgt_locks=`find /var/run/ -name tgtd* | wc -l`
if [ $tgt_locks -ne 0 ];then
\rm -f /var/run/tgtd* && killall -9 tgtd
service tgt stop
fi
service openibd restart && service openvswitch-switch restart
if [ $tgt_locks -ne 0 ];then
service tgt start
fi
fi

View File

@ -24,6 +24,7 @@ class mellanox_openstack::controller_ib_pv (
service { $dhcp_agent :
ensure => running,
enable => true,
provider => pacemaker,
subscribe => [File[$mlnx_dnsmasq_pv_config_file],
Neutron_dhcp_agent_config['DEFAULT/dnsmasq_config_file']]
}

View File

@ -37,6 +37,7 @@ class mellanox_openstack::controller_sriov (
service { $dhcp_agent :
ensure => running,
enable => true,
provider => pacemaker,
subscribe => Neutron_dhcp_agent_config['DEFAULT/dhcp_driver'],
}
}

View File

@ -30,21 +30,23 @@ function logger_print () {
logger -t $SCOPE "$priority: $msg"
}
# Check that a first probe VF exists
if [ ! -d $PARENT_FIRST_VF ]; then
logger_print error "Did not find probed ports of ${STORAGE_PORT}, skipping rename."
exit 1
fi
DEVICES='/sys/class/net/*/device'
SON_BUS=`basename $(readlink /sys/class/net/$STORAGE_PORT/device/virtfn0)`
if [ -e $PARENT_FIRST_VF ];then
CHILD_BUS=`basename $(readlink /sys/class/net/$STORAGE_PORT/device/virtfn0)`
logger_print info "Found first probed port of ${STORAGE_PORT} with bus ID: ${CHILD_BUS}."
else
PARENT_BUS=`cat /sys/class/net/$STORAGE_PORT/device/uevent | grep -i pci_slot | cut -d = -f 2`
CHILD_BUS=`echo $PARENT_BUS | sed -e s/0$/1/g`
PROBED_PORT_NAME="eth_iser_guess"
logger_print info "Did not find probed ports of ${STORAGE_PORT}, guessing its bus is: ${CHILD_BUS}."
fi
STORAGE_PORT_NUMBER=`cat /sys/class/net/$STORAGE_PORT/dev_id`
# Find the probe VF port that fits the storage ports number and BUS
for dev in $DEVICES; do
# Check for correct bus
CANDIDATE_BUS=`readlink -nq $dev`;
if [[ $CANDIDATE_BUS != *$SON_BUS* ]]; then
if [[ $CANDIDATE_BUS != *$CHILD_BUS* ]]; then
continue;
fi
@ -71,9 +73,9 @@ fi
# Persistantly rename the matched probed port
if [ $PROBED_PORT_NAME != $ISER_NAME ]; then
#Prepare line for udev
# Prepare line for udev
UDEV_LINE="SUBSYSTEM==\"net\", ACTION==\"add\", "
UDEV_LINE+="ATTR{dev_id}==\"$STORAGE_PORT_NUMBER\", KERNELS==\"$SON_BUS\", "
UDEV_LINE+="ATTR{dev_id}==\"$STORAGE_PORT_NUMBER\", KERNELS==\"$CHILD_BUS\", "
UDEV_LINE+="ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"$ISER_NAME\""
# Change/add line in udev file
@ -82,7 +84,13 @@ if [ $PROBED_PORT_NAME != $ISER_NAME ]; then
OLD_LINE_NUMBER=`grep -n $PROBED_PORT_NAME $UDEV_FILE | cut -d : -f 1`
eval "sed '"$OLD_LINE_NUMBER"d' -i $UDEV_FILE"
fi
echo $UDEV_LINE >> $UDEV_FILE
# Insert new name config if not exists
grep $ISER_NAME $UDEV_FILE > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo >> $UDEV_FILE
echo $UDEV_LINE >> $UDEV_FILE
fi
# restart OFED modules for udev changes to take effect
modprobe -r mlx4_en && modprobe mlx4_en

View File

@ -17,7 +17,7 @@
readonly SCRIPT_DIR=$(dirname "$0")
source $SCRIPT_DIR/common
readonly SCRIPT_MODE=$1
readonly FALLBACK_NUM_VFS=16
readonly FALLBACK_NUM_VFS=8
readonly SRIOV_ENABLED_FLAG=1
readonly NEW_KERNEL_PARAM="intel_iommu=on"
readonly GRUB_FILE_CENTOS="/boot/grub/grub.conf"
@ -122,7 +122,7 @@ function burn_vfs_in_fw () {
else
logger_print debug "Detected SR-IOV is disabled"
fi
if [ "$total_vfs" -ne "$current_num_of_vfs" ] 2>/dev/null; then
if [[ ! "$total_vfs" == "$current_num_of_vfs" ]] 2>/dev/null; then
logger_print debug "Current allowed number of VFs is ${current_num_of_vfs}, required number is ${total_vfs}"
mlxconfig -y -d $dev s SRIOV_EN=1 NUM_OF_VFS=$total_vfs 2>&1 >/dev/null
if [ $? -ne 0 ]; then

View File

@ -5,7 +5,7 @@ name: mellanox-plugin
title: Mellanox Openstack features
# Plugin version
version: 0.2.5
version: 0.2.12
# Description
description: Enable features over Mellanox hardware