summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRawan Herzallah <rherzallah@asaltech.com>2016-06-21 08:25:17 +0000
committerRawan Herzallah <rherzallah@asaltech.com>2016-06-22 11:38:33 +0000
commitd684dc16f873f08ad72e3c554fe105a449124781 (patch)
tree5f3d709ef26dd8e6d2e72397d6bf5e4766cb90af
parentf1a549dac6dc7609da89acfc17db1fea533efdbb (diff)
Fix conditional reboot when max num vfs changes
Added fixes to check reboot_required condition Change-Id: I988d8def24f096223d7a9a0f816de7f4596edaf6
Notes
Notes (review): Code-Review+1: Rawan Herzallah <rherzallah@asaltech.com> Code-Review+2: Aviram Bar-Haim <aviramb@mellanox.com> Workflow+1: Aviram Bar-Haim <aviramb@mellanox.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 22 Jun 2016 12:08:53 +0000 Reviewed-on: https://review.openstack.org/332006 Project: openstack/fuel-plugin-mellanox Branch: refs/heads/master
-rwxr-xr-xdeployment_scripts/common1
-rwxr-xr-xdeployment_scripts/mellanox_settings.py26
-rwxr-xr-xdeployment_scripts/sriov.sh38
-rw-r--r--metadata.yaml2
4 files changed, 44 insertions, 23 deletions
diff --git a/deployment_scripts/common b/deployment_scripts/common
index a2bf050..994dbb9 100755
--- a/deployment_scripts/common
+++ b/deployment_scripts/common
@@ -94,3 +94,4 @@ readonly ROLES=`get_param roles`
94readonly ROLE=`get_param role` 94readonly ROLE=`get_param role`
95readonly DEBUG=`get_param debug` 95readonly DEBUG=`get_param debug`
96readonly QOS=`get_mlnx_param mlnx_qos` 96readonly QOS=`get_mlnx_param mlnx_qos`
97readonly REBOOT_REQUIRED=`get_mlnx_param reboot_required`
diff --git a/deployment_scripts/mellanox_settings.py b/deployment_scripts/mellanox_settings.py
index 0822c59..d16ede3 100755
--- a/deployment_scripts/mellanox_settings.py
+++ b/deployment_scripts/mellanox_settings.py
@@ -300,13 +300,25 @@ class MellanoxSettings(object):
300 burned_num_vfs_list = list() 300 burned_num_vfs_list = list()
301 devices = os.popen('mst status -v| grep pciconf | grep {0} | awk \'{{print $2}}\' '.format( 301 devices = os.popen('mst status -v| grep pciconf | grep {0} | awk \'{{print $2}}\' '.format(
302 mlnx['cx_card'].replace("-",""))).readlines() 302 mlnx['cx_card'].replace("-",""))).readlines()
303 for dev in devices: 303 if len(devices) > 0:
304 num = os.popen('mlxconfig -d {0} q | grep NUM_OF_VFS | awk \'{{print $2}}\' \ 304 for dev in devices:
305 '.format(dev.rsplit()[0])).readlines() 305 num = os.popen('mlxconfig -d {0} q | grep NUM_OF_VFS | awk \'{{print $2}}\' \
306 burned_num_vfs_list.append(num[0].rsplit()[0]) 306 '.format(dev.rsplit()[0])).readlines()
307 burned_num_vfs = list(set(burned_num_vfs_list))[0] 307 if len(num) > 0:
308 if burned_num_vfs > MAX_NUM_VFS or mlnx['num_of_vfs'] > MAX_NUM_VFS : 308 burned_num_vfs_list.append(num[0].rsplit()[0])
309 mlnx['reboot_required'] = True 309 else:
310 logging.error("Failed to grep NUM_OF_VFS from Mellanox card")
311 sys.exit(1)
312 burned_num_vfs_set_list = list(set(burned_num_vfs_list))
313 for burned_num_vfs in burned_num_vfs_set_list :
314 if int(burned_num_vfs) < int(mlnx['num_of_vfs']) :
315 mlnx['reboot_required'] = True
316 logging.info('reboot_required is true as {0} is < {1}'.format(burned_num_vfs,
317 mlnx['num_of_vfs']))
318 break;
319 else:
320 logging.error("There are no Mellanox devices with {0} card".format(mlnx['cx_card']))
321 sys.exit(1)
310 322
311 @classmethod 323 @classmethod
312 def update_role_settings(cls): 324 def update_role_settings(cls):
diff --git a/deployment_scripts/sriov.sh b/deployment_scripts/sriov.sh
index 22048ef..9a5f3af 100755
--- a/deployment_scripts/sriov.sh
+++ b/deployment_scripts/sriov.sh
@@ -153,7 +153,7 @@ function burn_vfs_in_fw () {
153 # required for mlxconfig to discover mlnx devices 153 # required for mlxconfig to discover mlnx devices
154 service openibd start &>/dev/null 154 service openibd start &>/dev/null
155 service mst start &>/dev/null 155 service mst start &>/dev/null
156 devices=$(mst status -v | grep $CX| grep pciconf | awk '{print $2}') 156 devices=$(mst status -v | grep $(echo $CX | tr -d '-')| grep pciconf | awk '{print $2}')
157 for dev in $devices; do 157 for dev in $devices; do
158 logger_print debug "device=$dev" 158 logger_print debug "device=$dev"
159 mlxconfig -d $dev q | grep SRIOV | awk '{print $2}' | grep $SRIOV_ENABLED_FLAG &>/dev/null 159 mlxconfig -d $dev q | grep SRIOV | awk '{print $2}' | grep $SRIOV_ENABLED_FLAG &>/dev/null
@@ -181,7 +181,7 @@ function burn_vfs_in_fw () {
181 # required for mlxconfig to discover mlnx devices 181 # required for mlxconfig to discover mlnx devices
182 service openibd start &>/dev/null 182 service openibd start &>/dev/null
183 service mst start &>/dev/null 183 service mst start &>/dev/null
184 devices=$(mst status -v | grep $CX| grep pciconf | awk '{print $2}') 184 devices=$(mst status -v | grep $(echo $CX | tr -d '-') | grep pciconf | awk '{print $2}')
185 for dev in $devices; do 185 for dev in $devices; do
186 current_fw_vfs=`mlxconfig -d $dev q | grep NUM_OF_VFS | awk '{print $2}'` 186 current_fw_vfs=`mlxconfig -d $dev q | grep NUM_OF_VFS | awk '{print $2}'`
187 if [ "$total_vfs" -gt "$current_fw_vfs" ]; then 187 if [ "$total_vfs" -gt "$current_fw_vfs" ]; then
@@ -269,7 +269,7 @@ function validate_sriov () {
269 if [ $CX == 'ConnectX-4' ]; then 269 if [ $CX == 'ConnectX-4' ]; then
270 set_sriov $FALLBACK_NUM_VFS 270 set_sriov $FALLBACK_NUM_VFS
271 fi 271 fi
272 272
273 current_num_vfs=`lspci | grep -i mellanox | grep -i virtual | wc -l` 273 current_num_vfs=`lspci | grep -i mellanox | grep -i virtual | wc -l`
274 if [ $current_num_vfs -eq $FALLBACK_NUM_VFS ]; then 274 if [ $current_num_vfs -eq $FALLBACK_NUM_VFS ]; then
275 logger_print info "Fallback to ${FALLBACK_NUM_VFS} succeeded" 275 logger_print info "Fallback to ${FALLBACK_NUM_VFS} succeeded"
@@ -290,30 +290,38 @@ function set_sriov () {
290 exit 1 290 exit 1
291 else 291 else
292 if [ "$(lspci | grep -i mellanox | grep -i virtual | wc -l)" -ne "$TOTAL_VFS" ]; then 292 if [ "$(lspci | grep -i mellanox | grep -i virtual | wc -l)" -ne "$TOTAL_VFS" ]; then
293 res=`echo 0 > /sys/class/net/${device_up}/device/mlx5_num_vfs`
294 res=`echo ${TOTAL_VFS} > /sys/class/net/${device_up}/device/mlx5_num_vfs`
295 if [ ! $? -eq 0 ]; then
296 logger_print error "Failed to write $TOTAL_VFS > /sys/class/net/${device_up}/device/mlx5_num_vfs"
297 exit 1
298 fi
299 293
300 # Give MACs to created VFs 294 if [ ! $REBOOT_REQUIRED == true ] || [ $SCRIPT_MODE == "validate" ] ; then
301 python ./configure_mellanox_vfs.py ${TOTAL_VFS} 295 res=`echo 0 > /sys/class/net/${device_up}/device/mlx5_num_vfs`
296 res=`echo ${TOTAL_VFS} > /sys/class/net/${device_up}/device/mlx5_num_vfs`
297 if [ ! $? -eq 0 ]; then
298 logger_print error "Failed to write $TOTAL_VFS > /sys/class/net/${device_up}/device/mlx5_num_vfs"
299 exit 1
300 else
301 logger_print debug "Configured total vfs ${TOTAL_VFS} on ${device_up}"
302 fi
303
304 # Give MACs to created VFs
305 python ./configure_mellanox_vfs.py ${TOTAL_VFS}
306 fi
302 307
303 # Make number of VFs and their MACs persistent 308 # Make number of VFs and their MACs persistent
304 persistent_ifup_script=/etc/network/if-up.d/persistent_mlnx_params 309 persistent_ifup_script=/etc/network/if-up.d/persistent_mlnx_params
305 echo "#!/bin/bash" > $persistent_ifup_script 310 echo "#!/bin/bash" > $persistent_ifup_script
306 chmod +x $persistent_ifup_script 311 chmod +x $persistent_ifup_script
307 echo "if ! lspci | grep -i mellanox | grep -i virtual; then" >> $persistent_ifup_script 312 echo "if ! lspci | grep -i mellanox | grep -i virtual; then" >> $persistent_ifup_script
313 echo "echo 0 > /sys/class/net/${device_up}/device/mlx5_num_vfs" >> $persistent_ifup_script
308 echo "echo ${TOTAL_VFS} > /sys/class/net/${device_up}/device/mlx5_num_vfs" >> $persistent_ifup_script 314 echo "echo ${TOTAL_VFS} > /sys/class/net/${device_up}/device/mlx5_num_vfs" >> $persistent_ifup_script
309 echo "python /etc/fuel/plugins/mellanox-plugin-*/configure_mellanox_vfs.py ${TOTAL_VFS}" >> $persistent_ifup_script 315 echo "python /etc/fuel/plugins/mellanox-plugin-*/configure_mellanox_vfs.py ${TOTAL_VFS}" >> $persistent_ifup_script
310 echo "fi" >> $persistent_ifup_script 316 echo "fi" >> $persistent_ifup_script
311 echo "if [ -f /etc/init.d/tgt ]; then /etc/init.d/tgt force-reload; else exit 0; fi" >> $persistent_ifup_script 317 echo "if [ -f /etc/init.d/tgt ]; then /etc/init.d/tgt force-reload; else exit 0; fi" >> $persistent_ifup_script
312 318
313 if [ ! $? -eq 0 ]; then 319 if [ $REBOOT_REQUIRED == true ] && [ $SCRIPT_MODE == "configure" ] ; then
314 logger_print error "Failed to write $TOTAL_VFS > /sys/class/net/${device_up}/device/mlx5_num_vfs" 320 logger_print debug "Configured total vfs ${TOTAL_VFS} on ${device_up} will apply \
315 exit 1 321 on next reboot as reboot is required"
316 else 322 fi
323
324 if [ $SCRIPT_MODE == "validate" ] ; then
317 logger_print debug "Configured total vfs ${TOTAL_VFS} on ${device_up}" 325 logger_print debug "Configured total vfs ${TOTAL_VFS} on ${device_up}"
318 fi 326 fi
319 fi 327 fi
diff --git a/metadata.yaml b/metadata.yaml
index 3f6f137..9c87295 100644
--- a/metadata.yaml
+++ b/metadata.yaml
@@ -5,7 +5,7 @@ name: mellanox-plugin
5title: Mellanox ConnectX-4 Openstack Features 5title: Mellanox ConnectX-4 Openstack Features
6 6
7# Plugin version 7# Plugin version
8version: 3.1.16 8version: 3.1.17
9 9
10# Description 10# Description
11description: Enable features over Mellanox ConnectX-4 Adapters 11description: Enable features over Mellanox ConnectX-4 Adapters