summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAviram Bar-Haim <aviramb@mellanox.com>2017-02-15 16:24:11 +0200
committerwaleedm <waleedm@mellanox.com>2017-03-16 12:13:51 -0400
commit3d7d5fb73c9a3a3a364dd71788a2062463283b6e (patch)
treeb9e308fb849dc82a1fd9aa1dfb6ecf9652561503
parentc86447737214022194f1ed988dacfee8db6d1411 (diff)
Upgrading to Mellanox OFED 3.4-1 GA
Adding some reqiured packages for ofed installation and adding a workaround for setting interfaces up after ofed installtion and adding vfs Change-Id: I482d02eb51f18df71e8aa5e0cba0c14218bf53af
Notes
Notes (review): Code-Review+1: Hasan Qunoo <hqunoo@gmail.com> 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: Tue, 11 Jul 2017 11:57:06 +0000 Reviewed-on: https://review.openstack.org/434307 Project: openstack/fuel-plugin-mellanox Branch: refs/heads/master
-rwxr-xr-xbootstrap/sync/opt/mellanox_init.sh5
-rwxr-xr-xdeployment_scripts/configure_mellanox_vfs.py114
-rwxr-xr-xdeployment_scripts/install_ofed.sh16
-rwxr-xr-xdeployment_scripts/sriov.sh11
-rw-r--r--metadata.yaml4
-rwxr-xr-xpre_build_hook2
-rwxr-xr-xscripts/create_mellanox_bootstrap7
-rw-r--r--uninstall.sh10
8 files changed, 99 insertions, 70 deletions
diff --git a/bootstrap/sync/opt/mellanox_init.sh b/bootstrap/sync/opt/mellanox_init.sh
index 597923b..d1aed2a 100755
--- a/bootstrap/sync/opt/mellanox_init.sh
+++ b/bootstrap/sync/opt/mellanox_init.sh
@@ -16,6 +16,11 @@
16 16
17OFED_DEBS_DIR=/opt/ofed/MLNX_OFED/DEBS 17OFED_DEBS_DIR=/opt/ofed/MLNX_OFED/DEBS
18 18
19# Updating linux-headers
20kernel_prefix=initrd.img
21sudo apt-get install -y $(ls /boot/ | grep $kernel_prefix | \
22sed "s/$kernel_prefix/linux-headers/")
23
19# Set mlnx scripts to run on boot 24# Set mlnx scripts to run on boot
20sed -i '1a\$(init_mlnx.sh > \/dev\/null 2>\&1) \&\n' /etc/rc.local 25sed -i '1a\$(init_mlnx.sh > \/dev\/null 2>\&1) \&\n' /etc/rc.local
21if [ ! -z $1 ]; then 26if [ ! -z $1 ]; then
diff --git a/deployment_scripts/configure_mellanox_vfs.py b/deployment_scripts/configure_mellanox_vfs.py
index 26bcf2d..1b05e40 100755
--- a/deployment_scripts/configure_mellanox_vfs.py
+++ b/deployment_scripts/configure_mellanox_vfs.py
@@ -92,72 +92,76 @@ class MellanoxVfsSettings(object):
92 count += 1; 92 count += 1;
93 93
94 @classmethod 94 @classmethod
95 def unbind(cls): 95 def unbind(cls, vf_index):
96 for vf in cls.mellanox_vfs: 96 for vf in cls.mellanox_vfs:
97 cmd_vfs_pci = "echo {0} ".format(vf['pci_address']) + \ 97 if int(vf['vf_num']) == int(vf_index):
98 ">> /sys/bus/pci/drivers/mlx5_core/unbind" 98 cmd_vfs_pci = "echo {0} ".format(vf['pci_address']) + \
99 p_unbind_pci = subprocess.Popen(cmd_vfs_pci, shell=True, stdout=subprocess.PIPE, 99 ">> /sys/bus/pci/drivers/mlx5_core/unbind"
100 stderr=subprocess.STDOUT) 100 p_unbind_pci = subprocess.Popen(cmd_vfs_pci, shell=True, stdout=subprocess.PIPE,
101 retval = p_unbind_pci.wait() 101 stderr=subprocess.STDOUT)
102 if retval != 0: 102 retval = p_unbind_pci.wait()
103 logging.error("Failed to unbind pci address {0}".format(vf['pci_address'])) 103 if retval != 0:
104 sys.exit(1) 104 logging.error("Failed to unbind pci address {0}".format(vf['pci_address']))
105 logging.info("Managed to unbind VFs.") 105 sys.exit(1)
106 logging.info("Managed to unbind VFs.")
106 107
107 @classmethod 108 @classmethod
108 def bind(cls): 109 def bind(cls, vf_index):
109 for vf in cls.mellanox_vfs: 110 for vf in cls.mellanox_vfs:
110 cmd_vfs_pci = "echo {0} ".format(vf['pci_address']) + \ 111 if int(vf['vf_num']) == int(vf_index):
111 ">> /sys/bus/pci/drivers/mlx5_core/bind" 112 cmd_vfs_pci = "echo {0} ".format(vf['pci_address']) + \
112 p_bind_pci = subprocess.Popen(cmd_vfs_pci, shell=True, stdout=subprocess.PIPE, 113 ">> /sys/bus/pci/drivers/mlx5_core/bind"
113 stderr=subprocess.STDOUT) 114 p_bind_pci = subprocess.Popen(cmd_vfs_pci, shell=True, stdout=subprocess.PIPE,
114 retval = p_bind_pci.wait() 115 stderr=subprocess.STDOUT)
115 if retval != 0: 116 retval = p_bind_pci.wait()
116 print 'Bind: Error is:', p_bind_pci.stdout.readlines() 117 if retval != 0:
117 logging.error("Failed to bind pci address {0}".format(vf['pci_address']) ) 118 print 'Bind: Error is:', p_bind_pci.stdout.readlines()
118 sys.exit(1) 119 logging.error("Failed to bind pci address {0}".format(vf['pci_address']) )
119 else: 120 sys.exit(1)
120 print 'Managed to bind pci address ', vf['pci_address'] 121 else:
121 logging.debug("Managed to bind pci address {0}".format(vf['pci_address']) ) 122 print 'Managed to bind pci address ', vf['pci_address']
122 logging.info("Managed to bind VFs.") 123 logging.debug("Managed to bind pci address {0}".format(vf['pci_address']) )
124 logging.info("Managed to bind VFs.")
123 125
124 @classmethod 126 @classmethod
125 def assign_mac_per_vf(cls): 127 def assign_mac_per_vf(cls, vf_index):
126 for vf in cls.mellanox_vfs: 128 for vf in cls.mellanox_vfs:
127 if "00:00:00:00:00:00" in vf['mac']: 129 if int(vf['vf_num']) == int(vf_index):
128 cmd_generate_mac = "ibstat {0} {1} |".format(vf['port_module'], vf['port_num']) + \ 130 if "00:00:00:00:00:00" in vf['mac']:
129 " grep GUID | cut -d' ' -f3 | cut -d'x' -f2" 131 cmd_generate_mac = "ibstat {0} {1} |".format(vf['port_module'], vf['port_num']) + \
130 p_cmd_generate_mac = subprocess.Popen(cmd_generate_mac, shell=True, 132 " grep GUID | cut -d' ' -f3 | cut -d'x' -f2"
131 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 133 p_cmd_generate_mac = subprocess.Popen(cmd_generate_mac, shell=True,
132 retval = p_cmd_generate_mac.wait() 134 stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
133 if retval != 0: 135 retval = p_cmd_generate_mac.wait()
134 print 'Failed to get ibstat port guid' 136 if retval != 0:
135 logging.error("Failed to find PORT GUID to set it as a MAC address for the VF") 137 print 'Failed to get ibstat port guid'
136 sys.exit(1) 138 logging.error("Failed to find PORT GUID to set it as a MAC address for the VF")
137 port_guid = p_cmd_generate_mac.stdout.readlines()[0].rstrip(); 139 sys.exit(1)
138 port_guid_to_mac = port_guid[0:12] 140 port_guid = p_cmd_generate_mac.stdout.readlines()[0].rstrip();
139 port_guid_to_mac = ':'.join(port_guid_to_mac[i:i+2] for i in range \ 141 port_guid_to_mac = port_guid[0:12]
140 (0, len(port_guid_to_mac), 2)) 142 port_guid_to_mac = ':'.join(port_guid_to_mac[i:i+2] for i in range \
141 vf['mac'] = port_guid_to_mac 143 (0, len(port_guid_to_mac), 2))
144 vf['mac'] = port_guid_to_mac
142 145
143 @classmethod 146 @classmethod
144 def set_mac_per_vf(cls): 147 def set_mac_per_vf(cls, vf_index):
145 cmd_physical_port = "hiera mellanox-plugin | grep physical_port | cut -d'>' -f2 " 148 cmd_physical_port = "hiera mellanox-plugin | grep physical_port | cut -d'>' -f2 "
146 p = subprocess.Popen(cmd_physical_port ,shell=True,stdout=subprocess.PIPE, 149 p = subprocess.Popen(cmd_physical_port ,shell=True,stdout=subprocess.PIPE,
147 stderr=subprocess.STDOUT) 150 stderr=subprocess.STDOUT)
148 physical_port = p.stdout.readlines()[0].rstrip() 151 physical_port = p.stdout.readlines()[0].rstrip()
149 physical_port = physical_port.strip(',"') 152 physical_port = physical_port.strip(',"')
150 for vf in cls.mellanox_vfs: 153 for vf in cls.mellanox_vfs:
151 cmd_set_mac_per_vf = "ip link set " + \ 154 if int(vf['vf_num']) == int(vf_index):
152 "{0} vf {1} mac {2}".format(physical_port,vf['vf_num'], vf['mac']) 155 cmd_set_mac_per_vf = "ip link set " + \
153 p_cmd_set_mac_per_vf = subprocess.Popen(cmd_set_mac_per_vf,shell=True, 156 "{0} vf {1} mac {2}".format(physical_port,vf['vf_num'], vf['mac'])
154 stdout=subprocess.PIPE, 157 p_cmd_set_mac_per_vf = subprocess.Popen(cmd_set_mac_per_vf,shell=True,
155 stderr=subprocess.STDOUT) 158 stdout=subprocess.PIPE,
156 retval = p_cmd_set_mac_per_vf.wait() 159 stderr=subprocess.STDOUT)
157 if retval != 0: 160 retval = p_cmd_set_mac_per_vf.wait()
158 print 'Failed to set vf mac', cmd_set_mac_per_vf 161 if retval != 0:
159 logging.error("Failed to set MAC address to VF {0}".format(vf['vf_num'])) 162 print 'Failed to set vf mac', cmd_set_mac_per_vf
160 sys.exit(1) 163 logging.error("Failed to set MAC address to VF {0}".format(vf['vf_num']))
164 sys.exit(1)
161 165
162 @classmethod 166 @classmethod
163 def wait_for_vfs_loaded(cls, total_vfs): 167 def wait_for_vfs_loaded(cls, total_vfs):
@@ -190,10 +194,10 @@ def main(total_vfs):
190 vfs_configurations = MellanoxVfsSettings() 194 vfs_configurations = MellanoxVfsSettings()
191 vfs_configurations.wait_for_vfs_loaded(int(total_vfs)) 195 vfs_configurations.wait_for_vfs_loaded(int(total_vfs))
192 vfs_configurations.build_vfs_dict() 196 vfs_configurations.build_vfs_dict()
193 vfs_configurations.assign_mac_per_vf() 197 vfs_configurations.assign_mac_per_vf(0)
194 vfs_configurations.unbind() 198 vfs_configurations.unbind(0)
195 vfs_configurations.set_mac_per_vf() 199 vfs_configurations.set_mac_per_vf(0)
196 vfs_configurations.bind() 200 vfs_configurations.bind(0)
197 201
198 except MellanoxVfsSettingsException, exc: 202 except MellanoxVfsSettingsException, exc:
199 error_msg = "Failed configuring Mellanox vfs: {0}\n".format(exc) 203 error_msg = "Failed configuring Mellanox vfs: {0}\n".format(exc)
diff --git a/deployment_scripts/install_ofed.sh b/deployment_scripts/install_ofed.sh
index f7dcf44..a13edc9 100755
--- a/deployment_scripts/install_ofed.sh
+++ b/deployment_scripts/install_ofed.sh
@@ -41,7 +41,7 @@ function install_mlnx_ofed_src () {
41 if [ "$DISTRO" == "redhat" ]; then 41 if [ "$DISTRO" == "redhat" ]; then
42 yum install ${OFED_PACKAGE_NAME} -y 42 yum install ${OFED_PACKAGE_NAME} -y
43 elif [ "$DISTRO" == "ubuntu" ]; then 43 elif [ "$DISTRO" == "ubuntu" ]; then
44 apt-get install ${OFED_PACKAGE_NAME} -y 44 apt-get install ${OFED_PACKAGE_NAME} -y --force-yes
45 fi 45 fi
46 if [ $? -ne 0 ]; then 46 if [ $? -ne 0 ]; then
47 logger_print error "Failed installing ${OFED_PACKAGE_NAME} package" 47 logger_print error "Failed installing ${OFED_PACKAGE_NAME} package"
@@ -78,6 +78,13 @@ function add_kernel_support () {
78 fi 78 fi
79} 79}
80 80
81function install_missing_packages_for_ofed() {
82 apt-get install -y --force-yes dpatch autoconf libgfortran3 \
83 chrpath graphviz flex debhelper swig quilt m4 libltdl-dev \
84 gfortran tcl bison autotools-dev tk python-libxml2 tcl8.4 \
85 pkg-config automake tk8.4
86}
87
81function install_ofed_without_fw_update () { 88function install_ofed_without_fw_update () {
82 OFED_INSTALL_SCRIPT="${OFED_DIR}/mlnxofedinstall" 89 OFED_INSTALL_SCRIPT="${OFED_DIR}/mlnxofedinstall"
83 if [ ! -f $OFED_INSTALL_SCRIPT ]; then 90 if [ ! -f $OFED_INSTALL_SCRIPT ]; then
@@ -85,6 +92,9 @@ function install_ofed_without_fw_update () {
85 exit 1 92 exit 1
86 fi 93 fi
87 94
95 logger_print info "Installing missing packges for OFED"
96 install_missing_packages_for_ofed
97
88 logger_print info "Installing OFED drivers" 98 logger_print info "Installing OFED drivers"
89 OFED_INSTALL_SCRIPT_CMD="/usr/bin/perl ${OFED_INSTALL_SCRIPT}" 99 OFED_INSTALL_SCRIPT_CMD="/usr/bin/perl ${OFED_INSTALL_SCRIPT}"
90 ${OFED_INSTALL_SCRIPT_CMD} --force --without-fw-update 100 ${OFED_INSTALL_SCRIPT_CMD} --force --without-fw-update
@@ -145,4 +155,8 @@ sysctl_conf set 'kernel.printk' '4 4 1 7'
145service openibd stop 155service openibd stop
146service openibd start 156service openibd start
147 157
158# Setting interfaces up
159for interface in `ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d' | \
160sed 's/://'`;do ifconfig $interface up; done
161
148exit 0 162exit 0
diff --git a/deployment_scripts/sriov.sh b/deployment_scripts/sriov.sh
index 9a5f3af..8a62fdd 100755
--- a/deployment_scripts/sriov.sh
+++ b/deployment_scripts/sriov.sh
@@ -305,13 +305,19 @@ function set_sriov () {
305 python ./configure_mellanox_vfs.py ${TOTAL_VFS} 305 python ./configure_mellanox_vfs.py ${TOTAL_VFS}
306 fi 306 fi
307 307
308 # Make number of VFs and their MACs persistent 308 # Make number of VFs persistent
309 persistent_ifup_script=/etc/network/if-up.d/persistent_mlnx_params 309 persistent_ifup_script=/etc/network/if-up.d/persistent_mlnx_params
310 echo "#!/bin/bash" > $persistent_ifup_script 310 echo "#!/bin/bash" > $persistent_ifup_script
311 chmod +x $persistent_ifup_script 311 chmod +x $persistent_ifup_script
312 echo "# VFs Persistency" >> $persistent_ifup_script
312 echo "if ! lspci | grep -i mellanox | grep -i virtual; then" >> $persistent_ifup_script 313 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 314 echo "echo 0 > /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 315 echo "echo ${TOTAL_VFS} > /sys/class/net/${device_up}/device/mlx5_num_vfs" >> $persistent_ifup_script
316 echo "fi" >> $persistent_ifup_script
317
318 # Make the MAC for iser vf persistent
319 echo "# MACs Persistency" >> $persistent_ifup_script
320 echo 'if ip link show | grep "vf 0"| grep "MAC 00:00:00:00:00:00"; then' >> $persistent_ifup_script
315 echo "python /etc/fuel/plugins/mellanox-plugin-*/configure_mellanox_vfs.py ${TOTAL_VFS}" >> $persistent_ifup_script 321 echo "python /etc/fuel/plugins/mellanox-plugin-*/configure_mellanox_vfs.py ${TOTAL_VFS}" >> $persistent_ifup_script
316 echo "fi" >> $persistent_ifup_script 322 echo "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 323 echo "if [ -f /etc/init.d/tgt ]; then /etc/init.d/tgt force-reload; else exit 0; fi" >> $persistent_ifup_script
@@ -342,4 +348,7 @@ case $SCRIPT_MODE in
342 ;; 348 ;;
343esac 349esac
344 350
351# Setting interfaces up
352for interface in `ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d' | \
353sed 's/://'`;do ifconfig $interface up; done
345exit $? 354exit $?
diff --git a/metadata.yaml b/metadata.yaml
index e7ffd21..3c80ec3 100644
--- a/metadata.yaml
+++ b/metadata.yaml
@@ -5,13 +5,13 @@ 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.3.0 8version: 3.3.1
9 9
10# Description 10# Description
11description: Enable features over Mellanox ConnectX-4 Adapters 11description: Enable features over Mellanox ConnectX-4 Adapters
12 12
13# Required fuel version 13# Required fuel version
14fuel_version: ['8.0','9.0'] 14fuel_version: ['8.0','9.0','9.1','9.2']
15 15
16# Specify license of your plugin 16# Specify license of your plugin
17licenses: ['Apache License Version 2.0'] 17licenses: ['Apache License Version 2.0']
diff --git a/pre_build_hook b/pre_build_hook
index e6ccdae..c5eca12 100755
--- a/pre_build_hook
+++ b/pre_build_hook
@@ -62,7 +62,7 @@ old_debs="${PLUGIN_DIR}/repositories/ubuntu/*.deb"
62deb_files="cirros-testvm-mellanox_0.3.2-ubuntu3_amd64.deb 62deb_files="cirros-testvm-mellanox_0.3.2-ubuntu3_amd64.deb
63 cirros-testvm-mellanox-ib_0.3.2-9_amd64.deb 63 cirros-testvm-mellanox-ib_0.3.2-9_amd64.deb
64 eswitchd_1.0.0-18_amd64.deb 64 eswitchd_1.0.0-18_amd64.deb
65 mlnx-ofed-fuel_3.3-1.5.0.0_amd64.deb 65 mlnx-ofed-fuel_3.4-1.0.0.0_amd64.deb
66 lldpd_0.9.1-0_amd64.deb 66 lldpd_0.9.1-0_amd64.deb
67 python-networking-mlnx_7.0.0-1_all.deb" 67 python-networking-mlnx_7.0.0-1_all.deb"
68get_packages "deb" "$old_debs" "$deb_files" 68get_packages "deb" "$old_debs" "$deb_files"
diff --git a/scripts/create_mellanox_bootstrap b/scripts/create_mellanox_bootstrap
index 22a6862..ece2683 100755
--- a/scripts/create_mellanox_bootstrap
+++ b/scripts/create_mellanox_bootstrap
@@ -76,7 +76,12 @@ with open("/etc/fuel-bootstrap-cli/fuel_bootstrap_cli.yaml", 'r') as stream:
76 with open("/etc/fuel-bootstrap-cli/fuel_bootstrap_cli.yaml", "w") as f: 76 with open("/etc/fuel-bootstrap-cli/fuel_bootstrap_cli.yaml", "w") as f:
77 yaml.dump(fuel_bootstrap_config, f) 77 yaml.dump(fuel_bootstrap_config, f)
78 78
79 extra_packages = ['mlnx-ofed-fuel', 'python-libxml2', 'lsof'] 79 extra_packages = ['mlnx-ofed-fuel', 'python-libxml2', 'lsof', 'curl',
80 'libgfortran3', 'tk', 'swig', 'm4', 'autoconf',
81 'tcl8.4', 'flex', 'dpatch', 'gfortran', 'libltdl-dev',
82 'autotools-dev', 'quilt', 'automake', 'pkg-config',
83 'chrpath', 'debhelper', 'tk8.4', 'graphviz', 'bison',
84 'tcl']
80 packages = ''.join(['--package %s ' % p for p in extra_packages]) 85 packages = ''.join(['--package %s ' % p for p in extra_packages])
81 extra_dir = "/var/www/nailgun/plugins/%s/bootstrap/sync" % plugin 86 extra_dir = "/var/www/nailgun/plugins/%s/bootstrap/sync" % plugin
82 cmd = "fuel-bootstrap build --debug {0} --extra-dir {1} \ 87 cmd = "fuel-bootstrap build --debug {0} --extra-dir {1} \
diff --git a/uninstall.sh b/uninstall.sh
index 8becd81..9f2922c 100644
--- a/uninstall.sh
+++ b/uninstall.sh
@@ -1,18 +1,10 @@
1EXTRA_SCRIPTS="/sbin/reboot_bootstrap_node 1EXTRA_SCRIPTS="/sbin/reboot_bootstrap_node
2 /sbin/create_mellanox_bootstrap" 2 /sbin/create_mellanox_bootstrap"
3source /var/www/nailgun/plugins/mellanox-plugin*/scripts/common
3 4
4# Verify run is over Fuel Master and we are not During upgrade 5# Verify run is over Fuel Master and we are not During upgrade
5if [ -d $FUEL_BOOTSTRAP_DIR ] && [ $1 -eq 0 ]; then 6if [ -d $FUEL_BOOTSTRAP_DIR ] && [ $1 -eq 0 ]; then
6 7
7 source /var/www/nailgun/plugins/mellanox-plugin*/scripts/common
8
9 # Return orig active bootstrap
10 if [ -f $ORIG_BOOTSTRAP_VERSION_FILE ]; then
11 orig_uid=`cat $ORIG_BOOTSTRAP_VERSION_FILE`
12 fuel-bootstrap activate $orig_uid
13 \rm $ORIG_BOOTSTRAP_VERSION_FILE
14 fi
15
16 # Return orig yaml 8 # Return orig yaml
17 if [ -f $ORIG_BOOTSTRAP_CLI_YAML ]; then 9 if [ -f $ORIG_BOOTSTRAP_CLI_YAML ]; then
18 mv $ORIG_BOOTSTRAP_CLI_YAML $BOOTSTRAP_CLI_YAML 10 mv $ORIG_BOOTSTRAP_CLI_YAML $BOOTSTRAP_CLI_YAML