diff --git a/perl-xCAT/xCAT/ServiceNodeUtils.pm b/perl-xCAT/xCAT/ServiceNodeUtils.pm index c76d8d910..049831309 100755 --- a/perl-xCAT/xCAT/ServiceNodeUtils.pm +++ b/perl-xCAT/xCAT/ServiceNodeUtils.pm @@ -10,12 +10,8 @@ BEGIN # if AIX - make sure we include perl 5.8.2 in INC path. # Needed to find perl dependencies shipped in deps tarball. if ($^O =~ /^aix/i) { - use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi"; - use lib "/usr/opt/perl5/lib/5.8.2"; - use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi"; - use lib "/usr/opt/perl5/lib/site_perl/5.8.2"; -} - + unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); + } use lib "$::XCATROOT/lib/perl"; use strict; #----------------------------------------------------------------------------- diff --git a/perl-xCAT/xCAT/TableUtils.pm b/perl-xCAT/xCAT/TableUtils.pm index 69599d1fd..e55d194fa 100755 --- a/perl-xCAT/xCAT/TableUtils.pm +++ b/perl-xCAT/xCAT/TableUtils.pm @@ -10,11 +10,8 @@ BEGIN # if AIX - make sure we include perl 5.8.2 in INC path. # Needed to find perl dependencies shipped in deps tarball. if ($^O =~ /^aix/i) { - use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi"; - use lib "/usr/opt/perl5/lib/5.8.2"; - use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi"; - use lib "/usr/opt/perl5/lib/site_perl/5.8.2"; -} + unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); + } use lib "$::XCATROOT/lib/perl"; use strict; diff --git a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install index 96b3aa7bb..1bf577624 100755 --- a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install +++ b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install @@ -50,6 +50,17 @@ OS=`uname` #installroot='/install/netboot/sles11.1/x86_64/compute/rootimg' INSTALL_DIR='/install' +#echo "------------------------------------------" +#echo "OFED_DIR=$ofeddir" +#echo "OSVER=$OSVER" +#echo "arch=$ARCH" +#echo "NODESETSTATE=$NODESETSTATE" +#echo "mlnxofed_options=$mlnxofed_options" +#echo "installroot=$installroot" +#echo "------------------------------------------" + + + #use arg for the OFED_DIR if defined, ARGNUM=$# if [ $ARGNUM -gt 1 ]; then @@ -73,13 +84,13 @@ if [ -z "$mlnxofed_options" ]; then mlnxofed_options="--without-32bit --force" fi -if [ $NODESETSTATE != "genimage" ]; then +if [[ $NODESETSTATE != "genimage" ]]; then # running as a postscript in a full-disk install or AIX diskless install installroot="" fi if [ $OS != "AIX" ]; then - if [ $NODESETSTATE == "install" ] || [ $NODESETSTATE == "boot" ]; then + if [[ $NODESETSTATE == "install" ]] || [[ $NODESETSTATE == "boot" ]]; then # Being run from a stateful install postscript # Copy rpms directly from the xCAT management node and install mkdir -p /tmp/ofed @@ -92,13 +103,58 @@ if [ $OS != "AIX" ]; then wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=$num --reject "index.html*" --no-parent http://$MASTER$download_dir/ 2> /tmp/wget.log wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=$num --reject "index.html*" --no-parent http://$MASTER$download_dir/.mlnx 2>> /tmp/wget.log wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=$num --reject "index.html*" --no-parent http://$MASTER$download_dir/.supported_kernels 2>> /tmp/wget.log + + + if [ -f /etc/os-release ] && + cat /etc/os-release |grep NAME|grep Ubuntu>/dev/null + then + nodename=`hostname` + echo "$nodename 's operating system is Ubuntu." + echo "If you want to install Mellanox_OFED in $nodename, $nodename must have ability to access public network." + echo -n "checking $nodename 's ability to access public network..........." + if ping -c 3 91.189.88.140 > /dev/null;then + echo "[OK]" + else + echo "[Failed]" + echo "please make your $nodename have ability to access public network" + exit 1 + fi + + cp /etc/apt/sources.list /etc/apt/sources.list.bak + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty main/d" /etc/apt/sources.list + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty-updates main/d" /etc/apt/sources.list + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty universe/d" /etc/apt/sources.list + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty-updates universe/d" /etc/apt/sources.list + + echo "deb http://91.189.88.140/ubuntu-ports/ trusty main +deb http://91.189.88.140/ubuntu-ports/ trusty-updates main +deb http://91.189.88.140/ubuntu-ports/ trusty universe +deb http://91.189.88.140/ubuntu-ports/ trusty-updates universe" >> /etc/apt/sources.list + + apt-get clean all + sleep 1 + apt-get update + fi + #rpm -Uvh --force libibverbs-devel*.rpm #perl -x mlnxofedinstall --without-32bit --force - perl -x mlnxofedinstall $mlnxofed_options + + if [ -f /etc/os-release ] && + cat /etc/os-release|grep NAME|grep Ubuntu>/dev/null && + uname -m |grep ppc64 >/dev/null + then + echo "ARCH=powerpc perl -x mlnxofedinstall $mlnxofed_options" + ARCH=powerpc perl -x mlnxofedinstall $mlnxofed_options + sleep 1 + service openibd restart + else + echo "perl -x mlnxofedinstall $mlnxofed_options" + perl -x mlnxofedinstall $mlnxofed_options + fi rm -Rf /tmp/ofed fi - if [ $NODESETSTATE == "genimage" ]; then + if [[ $NODESETSTATE == "genimage" ]]; then # Being called from .postinstall script # Assume we are on the same machine if [[ $OS == sles* ]] || [[ $OS == suse* ]] || [[ -f /etc/SuSE-release ]]; then @@ -118,6 +174,52 @@ if [ $OS != "AIX" ]; then umount $installroot/dev/ umount $installroot/sys umount $installroot/proc + elif [ -f /etc/os-release ] && + cat /etc/os-release |grep NAME|grep Ubuntu>/dev/null; then + + mkdir $installroot/tmp/ofed_install + cp -r $OFED_DIR/ $installroot/tmp/ofed_install/ + + nodename=`hostname` + echo "$nodename 's operating system is Ubuntu." + echo "If you want to install Mellanox_OFED in $nodename, $nodename must have ability to access public network." + echo -n "checking $nodename 's ability to access public network..........." + if ping -c 3 91.189.88.140 > /dev/null;then + echo "[OK]" + else + echo "[Failed]" + echo "please make your $nodename have ability to access public network" + exit 1 + fi + + sourceslist="$installroot/etc/apt/sources.list" + cp $sourceslist $sourceslist.bak + + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty main/d" $sourceslist + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty-updates main/d" $sourceslist + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty universe/d" $sourceslist + sed -i "/deb http:\\/\\/91.189.88.140\\/ubuntu-ports\\/ trusty-updates universe/d" $sourceslist + + echo "deb http://91.189.88.140/ubuntu-ports/ trusty main +deb http://91.189.88.140/ubuntu-ports/ trusty-updates main +deb http://91.189.88.140/ubuntu-ports/ trusty universe +deb http://91.189.88.140/ubuntu-ports/ trusty-updates universe" >> $sourceslist + + chroot $installroot apt-get clean all + sleep 1 + chroot $installroot apt-get update + mount --bind /dev $installroot/dev/ + mount --bind /proc $installroot/proc/ + mount --bind /sys $installroot/sys/ + chroot $installroot apt-get install -y linux-headers-$(uname -r) + + echo "perl -x mlnxofedinstall $mlnxofed_options" + chroot $installroot perl -x /tmp/ofed_install/ofed/mlnxofedinstall --without-fw-update $mlnxofed_options + rm -rf $installroot/tmp/ofed_install + umount $installroot/dev/ + umount $installroot/proc/ + umount $installroot/sys/ + else mkdir $installroot/tmp/ofed_install cp -r $OFED_DIR/ $installroot/tmp/ofed_install/ diff --git a/xCAT/postscripts/configib b/xCAT/postscripts/configib index 904dd0da3..2845695ae 100755 --- a/xCAT/postscripts/configib +++ b/xCAT/postscripts/configib @@ -17,6 +17,7 @@ # NETWORKS_LINE2='netname=ib1||net=15.0.1.0||mask=255.255.255.0||mgtifname=||gateway=15.0.1.254||dhcpserver=||tftpserver=||nameservers=||ntpservers=||logservers=||dynamicrange=||staticrange=||staticrangeincrement=||nodehostname=||ddnsdomain=||vlanid=||domain=||disable=||comments=' # NETWORKS_LINE3='netname=ib3||net=15.0.3.0||mask=255.255.255.0||mgtifname=||gateway=||dhcpserver=||tftpserver=||nameservers=||ntpservers=||logservers=||dynamicrange=||staticrange=||staticrangeincrement=||nodehostname=||ddnsdomain=||vlanid=||domain=||disable=||comments=' + if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then str_dir_name=`dirname $0` . $str_dir_name/xcatlib.sh @@ -69,7 +70,7 @@ fi #find correct IB driver PLTFRM=`uname` -if [[ $OSVER == rhels5* || "$OSVER" == rhels6* ]] +if [[ $OSVER == rhels5* || "$OSVER" == rhels6* || "$OSVER" == ubuntu14* ]] then ib_driver="rdma" #/sbin/service $ib_driver status @@ -135,24 +136,59 @@ then elif [ -f /etc/SuSE-release ] then OS_name="suse" + elif [ -f /etc/os-release ] && cat /etc/os-release |grep NAME|grep Ubuntu>/dev/null + then + OS_name="ubuntu" else echo "Unsupported to config IB on this OS!" logger -p local4.info -t xcat "Unsupported to config IB on this OS!" exit - fi - - if [ $OS_name == 'suse' ] - then - dir="/etc/sysconfig/network" - else - dir="/etc/sysconfig/network-scripts" fi + + if [ $OS_name != 'ubuntu' ]; then + if [ $OS_name == 'suse' ] + then + dir="/etc/sysconfig/network" + else + dir="/etc/sysconfig/network-scripts" + fi + + #`rm -f $dir/ifcfg-$nic` 2>&1 1>/dev/null + # nic aliases + `rm -f $dir/ifcfg-ib*` 2>&1 1>/dev/null + else + interfaces="/etc/network/interfaces" - # remove the nic configuration files which are included in $NIC_IBNICS - for nic in `echo "$NIC_IBNICS" | tr "," "\n"` - do - rm -f $dir/ifcfg-$nic 2>&1 1>/dev/null - done + for tmp in `sed -n "/auto ib/=" ${interfaces}` + do + startline=`sed -n "/auto ib/=" ${interfaces}| head -n 1` + endline=`sed -n "$startline,/^auto/p" ${interfaces} |wc -l` + + if sed -n "$startline,/^auto/p" ${interfaces} |sed '$!d' |grep "auto" >/dev/null;then + endline=`expr $startline + $endline - 2` + else + endline=`expr $startline + $endline - 1` + fi + + ((startline--)) + temp=`sed -n ${startline}p ${interfaces}` + while [[ $temp =~ ^# ]] + do + ((startline--)) + temp=`sed -n ${startline}p ${interfaces}` + done + ((startline++)) + + temp=`sed -n ${endline}p ${interfaces}` + while [[ $temp =~ ^# ]] + do + ((endline--)) + temp=`sed -n ${endline}p ${interfaces}` + done + + sed -i ${startline},${endline}d ${interfaces} + done + fi else loop_number=`lsdev | grep "IP over Infiniband Network Interface" | wc -l` num=0 @@ -428,6 +464,56 @@ IPADDR=$nicip" > $dir/ifcfg-$nic:$ipindex goodnics="$goodnics,$nic:$ipindex" fi fi # end not the first ip address + elif [ $OS_name == 'ubuntu' ] + then + # First ip address + if [ $ipindex -eq 1 ]; then + # ipv6 + if echo $nicip | grep : 2>&1 1>/dev/null + then + echo "auto $nic +iface $nic inet6 static +address $nicip +netmask $netmask" >> /etc/network/interfaces + + if [ -n "$gateway" ]; then + echo "gateway $gateway" >> /etc/network/interfaces + fi + # ipv4 + else + # Write the info to the ifcfg file + echo "auto $nic +iface $nic inet static +address $nicip +netmask $netmask" >> /etc/network/interfaces + + #if [ -n "$gateway" ]; then + # echo "gateway $gateway" >> /etc/network/interfaces + #fi + fi + else # Not the first ip address + # ipv6 + if echo $nicip | grep : 2>&1 1>/dev/null + then + echo "auto $nic +iface $nic inet6 static +address $nicip +netmask $netmask" >> /etc/network/interfaces + + if [ -n "$gateway" ]; then + echo "gateway $gateway" >> /etc/network/interfaces + fi + else # ipv4 + echo "auto $nic:$ipindex +iface $nic:$ipindex inet static +address $nicip +netmask $netmask" >> /etc/network/interfaces + + #if [ -n "$gateway" ]; then + # echo "gateway $gateway" >> /etc/network/interfaces + #fi + fi + fi else echo "Unsupported operating system" logger -p local4.err -t xcat "Unsupported operating system" @@ -502,18 +588,27 @@ done # end for nic # Bringup all the ib interfaces if [ $PLTFRM == "Linux" ] then - #/sbin/service $ib_driver restart restartservice $ib_driver - for nic in `echo "$goodnics" | tr "," "\n"` + for nic in `echo "$goodnics" | tr "," "\n"|sort -u` do sleep 5 - if [[ "$OSVER" == rhels6* ]] then ip link set dev $nic up else - ifup $nic + if [[ "$OSVER" == ubuntu14* ]] + then + interfaces="/etc/network/interfaces" + for tmp in `cat $interfaces |grep "auto ib" |sort -u|awk '{print $2}'` + do + ifdown $tmp > /dev/null 2>&1 + sleep 2 + ifup $tmp + done + else + ifup $nic + fi fi done fi diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index 2845b5130..18c46dc5f 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -501,7 +501,7 @@ if ( pmatch "$OSVER" "sles11*" && [ $haszypper -eq 1 ] ); then result=`zypper --non-interactive --no-gpg-checks refresh 2>&1` -elif ( pmatch "$OSVER" "rhel*" && [ $hasyum -eq 1 ] ); then +elif ( ((pmatch "$OSVER" "rhel*") || (pmatch "$OSVER" "centos*") || (pmatch "$OSVER" "SL*")) && [ $hasyum -eq 1 ] ); then #remove old repo mkdir -p /etc/yum.repos.d if [ -r "/etc/yum.repos.d/local-repository.repo" ]; then