Browse Source

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
tags/fuel8_cx5
Aviram Bar-Haim 2 years ago
parent
commit
3d7d5fb73c

+ 5
- 0
bootstrap/sync/opt/mellanox_init.sh View File

@@ -16,6 +16,11 @@
16 16
 
17 17
 OFED_DEBS_DIR=/opt/ofed/MLNX_OFED/DEBS
18 18
 
19
+# Updating linux-headers
20
+kernel_prefix=initrd.img
21
+sudo apt-get install -y $(ls /boot/ | grep $kernel_prefix | \
22
+sed  "s/$kernel_prefix/linux-headers/")
23
+
19 24
 # Set mlnx scripts to run on boot
20 25
 sed -i '1a\$(init_mlnx.sh > \/dev\/null 2>\&1) \&\n' /etc/rc.local
21 26
 if [ ! -z $1 ]; then

+ 59
- 55
deployment_scripts/configure_mellanox_vfs.py View File

@@ -92,72 +92,76 @@ class MellanoxVfsSettings(object):
92 92
             count += 1;
93 93
 
94 94
     @classmethod
95
-    def unbind(cls):
95
+    def unbind(cls, vf_index):
96 96
         for vf in cls.mellanox_vfs:
97
-            cmd_vfs_pci = "echo {0} ".format(vf['pci_address']) + \
98
-                           ">> /sys/bus/pci/drivers/mlx5_core/unbind"
99
-            p_unbind_pci = subprocess.Popen(cmd_vfs_pci, shell=True, stdout=subprocess.PIPE,
100
-                                            stderr=subprocess.STDOUT)
101
-            retval = p_unbind_pci.wait()
102
-            if retval != 0:
103
-                logging.error("Failed to unbind pci address {0}".format(vf['pci_address']))
104
-                sys.exit(1)
105
-        logging.info("Managed to unbind VFs.")
97
+            if int(vf['vf_num']) == int(vf_index):
98
+                cmd_vfs_pci = "echo {0} ".format(vf['pci_address']) + \
99
+                              ">> /sys/bus/pci/drivers/mlx5_core/unbind"
100
+                p_unbind_pci = subprocess.Popen(cmd_vfs_pci, shell=True, stdout=subprocess.PIPE,
101
+                                                stderr=subprocess.STDOUT)
102
+                retval = p_unbind_pci.wait()
103
+                if retval != 0:
104
+                    logging.error("Failed to unbind pci address {0}".format(vf['pci_address']))
105
+                    sys.exit(1)
106
+            logging.info("Managed to unbind VFs.")
106 107
 
107 108
     @classmethod
108
-    def bind(cls):
109
+    def bind(cls, vf_index):
109 110
         for vf in cls.mellanox_vfs:
110
-            cmd_vfs_pci = "echo {0} ".format(vf['pci_address']) + \
111
-                           ">> /sys/bus/pci/drivers/mlx5_core/bind"
112
-            p_bind_pci = subprocess.Popen(cmd_vfs_pci, shell=True, stdout=subprocess.PIPE,
113
-                                          stderr=subprocess.STDOUT)
114
-            retval = p_bind_pci.wait()
115
-            if retval != 0:
116
-                print 'Bind: Error is:', p_bind_pci.stdout.readlines()
117
-                logging.error("Failed to bind pci address {0}".format(vf['pci_address']) )
118
-                sys.exit(1)
119
-            else:
120
-                print 'Managed to bind pci address ', vf['pci_address']
121
-                logging.debug("Managed to bind pci address {0}".format(vf['pci_address']) )
122
-        logging.info("Managed to bind VFs.")
111
+            if int(vf['vf_num']) == int(vf_index):
112
+                cmd_vfs_pci = "echo {0} ".format(vf['pci_address']) + \
113
+                              ">> /sys/bus/pci/drivers/mlx5_core/bind"
114
+                p_bind_pci = subprocess.Popen(cmd_vfs_pci, shell=True, stdout=subprocess.PIPE,
115
+                                              stderr=subprocess.STDOUT)
116
+                retval = p_bind_pci.wait()
117
+                if retval != 0:
118
+                    print 'Bind: Error is:', p_bind_pci.stdout.readlines()
119
+                    logging.error("Failed to bind pci address {0}".format(vf['pci_address']) )
120
+                    sys.exit(1)
121
+                else:
122
+                    print 'Managed to bind pci address ', vf['pci_address']
123
+                    logging.debug("Managed to bind pci address {0}".format(vf['pci_address']) )
124
+            logging.info("Managed to bind VFs.")
123 125
 
124 126
     @classmethod
125
-    def assign_mac_per_vf(cls):
127
+    def assign_mac_per_vf(cls, vf_index):
126 128
         for vf in cls.mellanox_vfs:
127
-            if "00:00:00:00:00:00" in vf['mac']:
128
-                cmd_generate_mac = "ibstat {0} {1} |".format(vf['port_module'], vf['port_num']) + \
129
-                                   " grep GUID | cut -d' ' -f3 | cut -d'x' -f2"
130
-                p_cmd_generate_mac = subprocess.Popen(cmd_generate_mac, shell=True,
131
-                                                      stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
132
-                retval = p_cmd_generate_mac.wait()
133
-                if retval != 0:
134
-                     print 'Failed to get ibstat port guid'
135
-                     logging.error("Failed to find PORT GUID to set it as a MAC address for the VF")
136
-                     sys.exit(1)
137
-                port_guid = p_cmd_generate_mac.stdout.readlines()[0].rstrip();
138
-                port_guid_to_mac = port_guid[0:12]
139
-                port_guid_to_mac = ':'.join(port_guid_to_mac[i:i+2] for i in range \
140
-                                   (0, len(port_guid_to_mac), 2))
141
-                vf['mac'] = port_guid_to_mac
129
+            if int(vf['vf_num']) == int(vf_index):
130
+                if "00:00:00:00:00:00" in vf['mac']:
131
+                    cmd_generate_mac = "ibstat {0} {1} |".format(vf['port_module'], vf['port_num']) + \
132
+                                       " grep GUID | cut -d' ' -f3 | cut -d'x' -f2"
133
+                    p_cmd_generate_mac = subprocess.Popen(cmd_generate_mac, shell=True,
134
+                                                          stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
135
+                    retval = p_cmd_generate_mac.wait()
136
+                    if retval != 0:
137
+                         print 'Failed to get ibstat port guid'
138
+                         logging.error("Failed to find PORT GUID to set it as a MAC address for the VF")
139
+                         sys.exit(1)
140
+                    port_guid = p_cmd_generate_mac.stdout.readlines()[0].rstrip();
141
+                    port_guid_to_mac = port_guid[0:12]
142
+                    port_guid_to_mac = ':'.join(port_guid_to_mac[i:i+2] for i in range \
143
+                                       (0, len(port_guid_to_mac), 2))
144
+                    vf['mac'] = port_guid_to_mac
142 145
 
143 146
     @classmethod
144
-    def set_mac_per_vf(cls):
147
+    def set_mac_per_vf(cls, vf_index):
145 148
         cmd_physical_port = "hiera mellanox-plugin | grep physical_port | cut -d'>' -f2 "
146 149
         p = subprocess.Popen(cmd_physical_port ,shell=True,stdout=subprocess.PIPE,
147 150
                              stderr=subprocess.STDOUT)
148 151
         physical_port = p.stdout.readlines()[0].rstrip()
149 152
         physical_port = physical_port.strip(',"')
150 153
         for vf in cls.mellanox_vfs:
151
-            cmd_set_mac_per_vf = "ip link set " + \
152
-                                 "{0} vf {1} mac {2}".format(physical_port,vf['vf_num'], vf['mac'])
153
-            p_cmd_set_mac_per_vf =  subprocess.Popen(cmd_set_mac_per_vf,shell=True,
154
-                                                     stdout=subprocess.PIPE,
155
-                                                     stderr=subprocess.STDOUT)
156
-            retval = p_cmd_set_mac_per_vf.wait()
157
-            if retval != 0:
158
-                 print 'Failed to set vf mac', cmd_set_mac_per_vf
159
-                 logging.error("Failed to set MAC address to VF {0}".format(vf['vf_num']))
160
-                 sys.exit(1)
154
+            if int(vf['vf_num']) == int(vf_index):
155
+                cmd_set_mac_per_vf = "ip link set " + \
156
+                                     "{0} vf {1} mac {2}".format(physical_port,vf['vf_num'], vf['mac'])
157
+                p_cmd_set_mac_per_vf =  subprocess.Popen(cmd_set_mac_per_vf,shell=True,
158
+                                                         stdout=subprocess.PIPE,
159
+                                                         stderr=subprocess.STDOUT)
160
+                retval = p_cmd_set_mac_per_vf.wait()
161
+                if retval != 0:
162
+                    print 'Failed to set vf mac', cmd_set_mac_per_vf
163
+                    logging.error("Failed to set MAC address to VF {0}".format(vf['vf_num']))
164
+                    sys.exit(1)
161 165
 
162 166
     @classmethod
163 167
     def wait_for_vfs_loaded(cls, total_vfs):
@@ -190,10 +194,10 @@ def main(total_vfs):
190 194
         vfs_configurations = MellanoxVfsSettings()
191 195
         vfs_configurations.wait_for_vfs_loaded(int(total_vfs))
192 196
         vfs_configurations.build_vfs_dict()
193
-        vfs_configurations.assign_mac_per_vf()
194
-        vfs_configurations.unbind()
195
-        vfs_configurations.set_mac_per_vf()
196
-        vfs_configurations.bind()
197
+        vfs_configurations.assign_mac_per_vf(0)
198
+        vfs_configurations.unbind(0)
199
+        vfs_configurations.set_mac_per_vf(0)
200
+        vfs_configurations.bind(0)
197 201
 
198 202
     except MellanoxVfsSettingsException, exc:
199 203
         error_msg = "Failed configuring Mellanox vfs: {0}\n".format(exc)

+ 15
- 1
deployment_scripts/install_ofed.sh View File

@@ -41,7 +41,7 @@ function install_mlnx_ofed_src () {
41 41
   if [ "$DISTRO" == "redhat" ]; then
42 42
     yum install ${OFED_PACKAGE_NAME} -y
43 43
   elif [ "$DISTRO" == "ubuntu" ]; then
44
-    apt-get install ${OFED_PACKAGE_NAME} -y
44
+    apt-get install ${OFED_PACKAGE_NAME} -y --force-yes
45 45
   fi
46 46
   if [ $? -ne 0 ]; then
47 47
     logger_print error "Failed installing ${OFED_PACKAGE_NAME} package"
@@ -78,6 +78,13 @@ function add_kernel_support () {
78 78
   fi
79 79
 }
80 80
 
81
+function 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
+
81 88
 function install_ofed_without_fw_update () {
82 89
   OFED_INSTALL_SCRIPT="${OFED_DIR}/mlnxofedinstall"
83 90
   if [ ! -f $OFED_INSTALL_SCRIPT ]; then
@@ -85,6 +92,9 @@ function install_ofed_without_fw_update () {
85 92
     exit 1
86 93
   fi
87 94
 
95
+  logger_print info "Installing missing packges for OFED"
96
+  install_missing_packages_for_ofed
97
+
88 98
   logger_print info "Installing OFED drivers"
89 99
   OFED_INSTALL_SCRIPT_CMD="/usr/bin/perl ${OFED_INSTALL_SCRIPT}"
90 100
   ${OFED_INSTALL_SCRIPT_CMD} --force --without-fw-update
@@ -145,4 +155,8 @@ sysctl_conf set 'kernel.printk' '4 4 1 7'
145 155
 service openibd stop
146 156
 service openibd start
147 157
 
158
+# Setting interfaces up
159
+for interface in `ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d' | \
160
+sed 's/://'`;do ifconfig $interface up; done
161
+
148 162
 exit 0

+ 10
- 1
deployment_scripts/sriov.sh View File

@@ -305,13 +305,19 @@ function set_sriov () {
305 305
         python ./configure_mellanox_vfs.py ${TOTAL_VFS}
306 306
       fi
307 307
 
308
-      # Make number of VFs and their MACs persistent
308
+      # Make number of VFs persistent
309 309
       persistent_ifup_script=/etc/network/if-up.d/persistent_mlnx_params
310 310
       echo "#!/bin/bash" > $persistent_ifup_script
311 311
       chmod +x $persistent_ifup_script
312
+      echo "# VFs Persistency" >> $persistent_ifup_script
312 313
       echo "if ! lspci | grep -i mellanox | grep -i virtual; then" >> $persistent_ifup_script
313 314
       echo "echo 0 > /sys/class/net/${device_up}/device/mlx5_num_vfs" >> $persistent_ifup_script
314 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 321
       echo "python /etc/fuel/plugins/mellanox-plugin-*/configure_mellanox_vfs.py ${TOTAL_VFS}" >> $persistent_ifup_script
316 322
       echo "fi" >> $persistent_ifup_script
317 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
   ;;
343 349
 esac
344 350
 
351
+# Setting interfaces up
352
+for interface in `ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d' | \
353
+sed 's/://'`;do ifconfig $interface up; done
345 354
 exit $?

+ 2
- 2
metadata.yaml View File

@@ -5,13 +5,13 @@ name: mellanox-plugin
5 5
 title: Mellanox ConnectX-4 Openstack Features
6 6
 
7 7
 # Plugin version
8
-version: 3.3.0
8
+version: 3.3.1
9 9
 
10 10
 # Description
11 11
 description: Enable features over Mellanox ConnectX-4 Adapters
12 12
 
13 13
 # Required fuel version
14
-fuel_version: ['8.0','9.0']
14
+fuel_version: ['8.0','9.0','9.1','9.2']
15 15
 
16 16
 # Specify license of your plugin
17 17
 licenses: ['Apache License Version 2.0']

+ 1
- 1
pre_build_hook View File

@@ -62,7 +62,7 @@ old_debs="${PLUGIN_DIR}/repositories/ubuntu/*.deb"
62 62
 deb_files="cirros-testvm-mellanox_0.3.2-ubuntu3_amd64.deb
63 63
            cirros-testvm-mellanox-ib_0.3.2-9_amd64.deb
64 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 66
            lldpd_0.9.1-0_amd64.deb
67 67
            python-networking-mlnx_7.0.0-1_all.deb"
68 68
 get_packages "deb" "$old_debs" "$deb_files"

+ 6
- 1
scripts/create_mellanox_bootstrap View File

@@ -76,7 +76,12 @@ with open("/etc/fuel-bootstrap-cli/fuel_bootstrap_cli.yaml", 'r') as stream:
76 76
         with open("/etc/fuel-bootstrap-cli/fuel_bootstrap_cli.yaml", "w") as f:
77 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 85
     packages = ''.join(['--package %s ' % p for p in extra_packages])
81 86
     extra_dir = "/var/www/nailgun/plugins/%s/bootstrap/sync" % plugin
82 87
     cmd = "fuel-bootstrap build --debug {0} --extra-dir {1} \

+ 1
- 9
uninstall.sh View File

@@ -1,18 +1,10 @@
1 1
 EXTRA_SCRIPTS="/sbin/reboot_bootstrap_node
2 2
                /sbin/create_mellanox_bootstrap"
3
+source /var/www/nailgun/plugins/mellanox-plugin*/scripts/common
3 4
 
4 5
 # Verify run is over Fuel Master and we are not During upgrade
5 6
 if [ -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 8
   # Return orig yaml
17 9
   if [ -f $ORIG_BOOTSTRAP_CLI_YAML ]; then
18 10
     mv $ORIG_BOOTSTRAP_CLI_YAML $BOOTSTRAP_CLI_YAML

Loading…
Cancel
Save