From 251884878306151bb0b3b92fcbb80fd1506d075b Mon Sep 17 00:00:00 2001 From: Aviram Bar-Haim Date: Wed, 6 May 2015 20:40:14 +0300 Subject: [PATCH] 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 --- .../move_ubuntu_ib_interfaces_conf.sh | 12 ++++++++ .../manifests/controller_ib_pv.pp | 1 + .../manifests/controller_sriov.pp | 1 + .../templates/iser_rename.erb | 30 ++++++++++++------- deployment_scripts/sriov.sh | 4 +-- metadata.yaml | 2 +- 6 files changed, 36 insertions(+), 14 deletions(-) diff --git a/deployment_scripts/move_ubuntu_ib_interfaces_conf.sh b/deployment_scripts/move_ubuntu_ib_interfaces_conf.sh index ec3a129..e0d20f5 100755 --- a/deployment_scripts/move_ubuntu_ib_interfaces_conf.sh +++ b/deployment_scripts/move_ubuntu_ib_interfaces_conf.sh @@ -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 diff --git a/deployment_scripts/puppet/modules/mellanox_openstack/manifests/controller_ib_pv.pp b/deployment_scripts/puppet/modules/mellanox_openstack/manifests/controller_ib_pv.pp index dc1d3dd..4ba3f64 100644 --- a/deployment_scripts/puppet/modules/mellanox_openstack/manifests/controller_ib_pv.pp +++ b/deployment_scripts/puppet/modules/mellanox_openstack/manifests/controller_ib_pv.pp @@ -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']] } diff --git a/deployment_scripts/puppet/modules/mellanox_openstack/manifests/controller_sriov.pp b/deployment_scripts/puppet/modules/mellanox_openstack/manifests/controller_sriov.pp index 05d9f4d..fe63e72 100644 --- a/deployment_scripts/puppet/modules/mellanox_openstack/manifests/controller_sriov.pp +++ b/deployment_scripts/puppet/modules/mellanox_openstack/manifests/controller_sriov.pp @@ -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'], } } diff --git a/deployment_scripts/puppet/modules/mellanox_openstack/templates/iser_rename.erb b/deployment_scripts/puppet/modules/mellanox_openstack/templates/iser_rename.erb index 0b127d3..9bc9ac8 100644 --- a/deployment_scripts/puppet/modules/mellanox_openstack/templates/iser_rename.erb +++ b/deployment_scripts/puppet/modules/mellanox_openstack/templates/iser_rename.erb @@ -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 diff --git a/deployment_scripts/sriov.sh b/deployment_scripts/sriov.sh index ac9d47b..a6d94ed 100755 --- a/deployment_scripts/sriov.sh +++ b/deployment_scripts/sriov.sh @@ -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 diff --git a/metadata.yaml b/metadata.yaml index 43dfcd0..85fdba7 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -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