summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRawan Herzallah <rherzallah@asaltech.com>2016-05-03 06:38:41 +0000
committerRawan Herzallah <rherzallah@asaltech.com>2016-05-10 06:40:49 +0000
commitfcef114eb5749d9978c15712a4c50ef84ce698e4 (patch)
tree4b2e7d6760dad3e8aeb961bba865ae1e4bb15434
parent467a479d4d6811c3230fcb2d239bea26f9ab8ccb (diff)
Enhanced create_mellanox_bootstrap script
Added arg parser, changed script name and removed adding intel_iommu parameter as plugin forces user to add it now. Change-Id: I4a15ca4a67290ebdb764cedc543ca2afe8f158af
Notes
Notes (review): Code-Review+2: Moshe Levi <moshele@mellanox.com> Workflow+1: Moshe Levi <moshele@mellanox.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 10 May 2016 06:59:24 +0000 Reviewed-on: https://review.openstack.org/311608 Project: openstack/fuel-plugin-mellanox Branch: refs/heads/master
-rw-r--r--metadata.yaml2
-rw-r--r--post_install.sh4
-rwxr-xr-xscripts/create_mellanox_bootstrap (renamed from scripts/create_mellanox_vpi_bootstrap)51
-rw-r--r--uninstall.sh17
4 files changed, 34 insertions, 40 deletions
diff --git a/metadata.yaml b/metadata.yaml
index 03fdb20..6b25f3d 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.1 8version: 3.1.4
9 9
10# Description 10# Description
11description: Enable features over Mellanox ConnectX-4 Adapters 11description: Enable features over Mellanox ConnectX-4 Adapters
diff --git a/post_install.sh b/post_install.sh
index f1d5a9e..b758bc8 100644
--- a/post_install.sh
+++ b/post_install.sh
@@ -7,12 +7,12 @@ if [ -d $FUEL_BOOTSTRAP_DIR ]; then
7 7
8 # Add bootstrap scripts to Fuel Master 8 # Add bootstrap scripts to Fuel Master
9 \cp $PLUGIN_SCRIPTS_DIR/reboot_bootstrap_nodes \ 9 \cp $PLUGIN_SCRIPTS_DIR/reboot_bootstrap_nodes \
10 $PLUGIN_SCRIPTS_DIR/create_mellanox_vpi_bootstrap \ 10 $PLUGIN_SCRIPTS_DIR/create_mellanox_bootstrap \
11 /sbin/ 11 /sbin/
12 12
13 # Print post install message 13 # Print post install message
14 echo " `tput bold`In order to create Bootstrap discovery image for detecting Mellanox Infiniband HW:" 14 echo " `tput bold`In order to create Bootstrap discovery image for detecting Mellanox Infiniband HW:"
15 echo " 1. Please build a new bootstrap ('create_mellanox_vpi_bootstrap can be used')." 15 echo " 1. Please build a new bootstrap ('create_mellanox_bootstrap [--link_type] [-h, --help] can be used')."
16 echo " 2. Please reboot your old bootstrap nodes" 16 echo " 2. Please reboot your old bootstrap nodes"
17 echo " ('reboot_bootstrap_nodes [-e environment_id] [-a] [-h]' can be used).`tput sgr0`" 17 echo " ('reboot_bootstrap_nodes [-e environment_id] [-a] [-h]' can be used).`tput sgr0`"
18 18
diff --git a/scripts/create_mellanox_vpi_bootstrap b/scripts/create_mellanox_bootstrap
index 4733e1f..8165c6f 100755
--- a/scripts/create_mellanox_vpi_bootstrap
+++ b/scripts/create_mellanox_bootstrap
@@ -19,26 +19,30 @@ import os
19import time 19import time
20import subprocess 20import subprocess
21import sys 21import sys
22import argparse
23import textwrap
22 24
23# Verify input 25parser = argparse.ArgumentParser(
24if len(sys.argv) > 1 and (sys.argv[1] == 'eth' or sys.argv[1] == 'ib' or \ 26 prog='PROG',
25 sys.argv[1] == 'default_link_type' ): 27 formatter_class=argparse.RawDescriptionHelpFormatter,
26 if 'default_link_type' in sys.argv[1]: 28 description=textwrap.dedent('''\
27 link_type = 'eth' 29 Available link_type values are:
28 else: 30 -------------------------------
29 link_type = "_%s" % sys.argv[1] 31 - eth for changing link type to Ethernet
30elif len(sys.argv) == 1: 32 - ib for changing link type to Infiniband
31 link_type = "" 33 - current for leaving link type as is
34 '''))
35parser.add_argument("--link_type", choices=['eth', 'ib', 'current'])
36
37args = parser.parse_args()
38if not args.link_type:
39 parser.print_help()
40 sys.exit(1)
32else: 41else:
33 basename = os.path.basename(sys.argv[0]) 42 if 'current' in args.link_type:
34 print "Wrong usage." 43 link_type=""
35 print "Usage: %s <link_type>" % basename 44 else:
36 print " Valid link type: eth,ib" 45 link_type = "_{0}".format(args.link_type)
37 print " option 1: %s" % basename
38 print " option 2: %s eth" % basename
39 print " option 3: %s ib" % basename
40 print " option 4: %s default_link_type" % basename
41 exit(1)
42 46
43# Set variables 47# Set variables
44plugin = subprocess.Popen("echo /var/www/nailgun/plugins/mellanox-plugin-*/ " + 48plugin = subprocess.Popen("echo /var/www/nailgun/plugins/mellanox-plugin-*/ " +
@@ -61,16 +65,7 @@ with open("/etc/fuel-bootstrap-cli/fuel_bootstrap_cli.yaml", 'r') as stream:
61 'section': None, 65 'section': None,
62 'type': 'deb', 66 'type': 'deb',
63 'uri': plugin_uri}) 67 'uri': plugin_uri})
64 override = True 68 # Override fuel bootstrap yaml
65
66 # Verify SR-IOV capabilities
67 if 'intel_iommu=on' not in fuel_bootstrap_config['extend_kopts']:
68 fuel_bootstrap_config['extend_kopts'] = fuel_bootstrap_config['extend_kopts'] \
69 + ' intel_iommu=on'
70 override = True
71
72 # Override fuel bootstrap yaml if needed
73 if override:
74 with open("/etc/fuel-bootstrap-cli/fuel_bootstrap_cli.yaml", "w") as f: 69 with open("/etc/fuel-bootstrap-cli/fuel_bootstrap_cli.yaml", "w") as f:
75 yaml.dump(fuel_bootstrap_config, f) 70 yaml.dump(fuel_bootstrap_config, f)
76 71
diff --git a/uninstall.sh b/uninstall.sh
index d584e2e..8becd81 100644
--- a/uninstall.sh
+++ b/uninstall.sh
@@ -1,3 +1,5 @@
1EXTRA_SCRIPTS="/sbin/reboot_bootstrap_node
2 /sbin/create_mellanox_bootstrap"
1 3
2# Verify run is over Fuel Master and we are not During upgrade 4# Verify run is over Fuel Master and we are not During upgrade
3if [ -d $FUEL_BOOTSTRAP_DIR ] && [ $1 -eq 0 ]; then 5if [ -d $FUEL_BOOTSTRAP_DIR ] && [ $1 -eq 0 ]; then
@@ -16,13 +18,10 @@ if [ -d $FUEL_BOOTSTRAP_DIR ] && [ $1 -eq 0 ]; then
16 mv $ORIG_BOOTSTRAP_CLI_YAML $BOOTSTRAP_CLI_YAML 18 mv $ORIG_BOOTSTRAP_CLI_YAML $BOOTSTRAP_CLI_YAML
17 fi 19 fi
18 20
19 # Remove extra scripts 21 for script in $EXTRA_SCRIPTS; do
20 if [ -f "/sbin/reboot_bootstrap_nodes" ]; then 22 # Remove extra scripts
21 \rm /sbin/reboot_bootstrap_nodes 23 if [ -e $script ]; then
22 fi 24 \rm $script
23 25 fi
24 if [ -f "/sbin/create_mellanox_vpi_bootstrap" ]; then 26 done
25 \rm /sbin/create_mellanox_vpi_bootstrap
26 fi
27
28fi 27fi