diff --git a/buildcore.sh b/buildcore.sh index 5dcb44a2c..d893423fd 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -36,6 +36,7 @@ # GITUP= - control which rpms get built by specifying a coregitup file # EMBED= - the environment for which a minimal version of xcat should be built, e.g. zvm or flex # VERBOSE=1 - to see lots of verbose output +# LOG= - provide an LOG file option to redirect some output into log file # you can change this if you need to UPLOADUSER=bp-sawyers @@ -343,6 +344,10 @@ fi #else we will continue # Prepare the RPMs for pkging and upload +WGET_CMD="wget" +if [ ! -z ${LOG} ]; then + WGET_CMD="wget -o ${LOG}" +fi # get gpg keys in place if [ "$OSNAME" != "AIX" ]; then @@ -350,7 +355,7 @@ if [ "$OSNAME" != "AIX" ]; then for i in pubring.gpg secring.gpg trustdb.gpg; do if [ ! -f $HOME/.gnupg/$i ] || [ `wc -c $HOME/.gnupg/$i|cut -f 1 -d' '` == 0 ]; then rm -f $HOME/.gnupg/$i - wget -P $HOME/.gnupg $GSA/keys/$i + ${WGET_CMD} -P $HOME/.gnupg $GSA/keys/$i chmod 600 $HOME/.gnupg/$i fi done @@ -372,10 +377,10 @@ if [ "$OSNAME" != "AIX" ]; then gpg -a --detach-sign $DESTDIR/repodata/repomd.xml gpg -a --detach-sign $SRCDIR/repodata/repomd.xml if [ ! -f $DESTDIR/repodata/repomd.xml.key ]; then - wget -P $DESTDIR/repodata $GSA/keys/repomd.xml.key + ${WGET_CMD} -q -P $DESTDIR/repodata $GSA/keys/repomd.xml.key fi if [ ! -f $SRCDIR/repodata/repomd.xml.key ]; then - wget -P $SRCDIR/repodata $GSA/keys/repomd.xml.key + ${WGET_CMD} -P $SRCDIR/repodata $GSA/keys/repomd.xml.key fi fi diff --git a/makerpm b/makerpm index 2266e78b5..d6fbc9f75 100755 --- a/makerpm +++ b/makerpm @@ -23,6 +23,18 @@ function makenoarch { RC=$? else # linux echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." + # TODO: should fix this up, this is a hack for the new build machine + if [ $RPMNAME = "xCAT-UI" ]; then + # Only if the old compiler.jar file does not exist..... + if [ ! -e /xcat2/build/tools/compiler.jar ]; then + # look for the dynamic location of the compiler.jar file + DIRNAME=`dirname $(readlink -f $0)` + COMPILER_JAR=`echo "${DIRNAME%%linux_rpm/*}tools/compiler.jar"` + if [ -f $COMPILER_JAR ]; then + sed -i "s#/xcat2/build/tools/compiler.jar#${COMPILER_JAR}#g" xCAT-UI/xCAT-UI.spec + fi + fi + fi tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm old mode 100755 new mode 100644 index b920ef108..bce499e13 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3596,6 +3596,8 @@ sub version_cmp { $ver_a = shift; } my $ver_b = shift; + $ver_a =~ s/([-.]0+)+$//; + $ver_b =~ s/([-.]0+)+$//; my @array_a = ($ver_a =~ /([-.]|\d+|[^-.\d]+)/g); my @array_b = ($ver_b =~ /([-.]|\d+|[^-.\d]+)/g); @@ -3620,9 +3622,12 @@ sub version_cmp { } elsif ( $b eq '.' ) { return 1; } elsif ($a =~ /^\d+$/ and $b =~ /^\d+$/) { - if ($a =~ /^0/ || $b =~ /^0/) { - return ($a cmp $b); - } else { +# if ($a =~ /^0/ || $b =~ /^0/) { +# return ($a cmp $b); +# } else { +# return ($a <=> $b); +# } + if($a != $b ){ return ($a <=> $b); } } else { diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index a2baa3326..ec599ea46 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -52,15 +52,28 @@ if [ -n "$2" ]; then fi fi -if [ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ] || [ -x "/usr/local/bin/confetty" ]; then - #use confluent - CONFETTY="confetty" - if [ -x "/opt/confluent/bin/confetty" ]; then +# xCAT 2.9.1 allows for an option to use confluent as a rcons replacement and only use +# confluent if this keyword is defined in the site table. This allows for confluent to +# be installed on the xCAT management node and switch between conserver & confluent +USE_CONFLUENT=0 +CONSOLE_SERVICE_KEYWORD=`tabdump site | grep consoleservice | cut -d, -f1 | tr -d '"'` +CONSOLE_SERVICE_VALUE=`tabdump site | grep consoleservice | cut -d, -f2 | tr -d '"'` + +if [ "$CONSOLE_SERVICE_KEYWORD" == "consoleservice" ]; then + if [ "$CONSOLE_SERVICE_VALUE" == "confluent" ]; then + USE_CONFLUENT=1 + fi +fi + +if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ] || [ -x "/usr/local/bin/confetty" ]); then + #use confluent + CONFETTY="confetty" + if [ -x "/opt/confluent/bin/confetty" ]; then CONFETTY="/opt/confluent/bin/confetty" - fi - if [ ! -z "$CONSCONTROLPATH" ]; then - CONSCONTROLPATH="-c $CONSCONTROLPATH" - fi + fi + if [ ! -z "$CONSCONTROLPATH" ]; then + CONSCONTROLPATH="-c $CONSCONTROLPATH" + fi if [ -z "$CONSERVER" ]; then CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '` fi diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 3627d7aa9..049001bc6 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -8,6 +8,7 @@ HOSTOS="$1" DIR=`dirname $0` #DIR=`realpath $DIR` DIR=`readlink -f $DIR` +BUILDARCH=`uname -m` # get the input files for dracut in the right place # Fedora 20 ppc64 uses /usr/lib/dracut/modules.d @@ -21,9 +22,64 @@ fi mkdir -p $DRACUTMODDIR cp $DIR/* $DRACUTMODDIR + +if [ "$HOSTOS" = "mcp" ]; then + #Special handlings for MCP PPC64 platform building. + if [ $BUILDARCH = "ppc64" ]; then + sed -i 's/dracut_install efibootmgr//' $DRACUTMODDIR/install + sed -i 's/dracut_install dmidecode \/usr\/lib64\/libstdc++.so.5//' $DRACUTMODDIR/install + sed -i 's/dmidecode//' $DRACUTMODDIR/install + sed -i 's/\/lib\/ld-linux.so.2/\/usr\/lib64\/ld-2.17.so/' $DRACUTMODDIR/install + else + sed -i 's/\/lib\/ld-linux.so.2/\/usr\/lib64\/ld-linux-x86-64.so.2/' $DRACUTMODDIR/install + fi + sed -i 's/mkfs.btrfs//' $DRACUTMODDIR/install + sed -i 's/\/etc\/redhat-release/\/etc\/base-release \/etc\/system-release/' $DRACUTMODDIR/install + sed -i 's/btrfs//' $DRACUTMODDIR/installkernel + + sed -i 's/\/usr\/bin\/basename/\/bin\/basename/' $DRACUTMODDIR/install + + sed -i 's/\/lib64\/libnss_dns-2.12.so/\/usr\/lib64\/libnss_dns-2.17.so/' $DRACUTMODDIR/install + sed -i 's/\/lib64\/libnss_dns.so.2/\/usr\/lib64\/libnss_dns.so.2/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libc.so.6/\/usr\/lib64\/libc.so.6/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libdl.so.2/\/usr\/lib64\/libdl.so.2/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libm.so.6/\/usr\/lib64\/libm.so.6/' $DRACUTMODDIR/install + sed -i 's/\/usr\/lib\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.19/' $DRACUTMODDIR/install + sed -i 's/\/usr\/lib64\/libstdc++.so.5//' $DRACUTMODDIR/install + sed -i 's/\/lib\/libpthread.so.0/\/usr\/lib64\/libpthread.so.0/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libncurses.so.5.7/\/usr\/lib64\/libncurses.so.5.9/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libgcc_s.so.1/\/usr\/lib64\/libgcc_s.so.1/' $DRACUTMODDIR/install + sed -i 's/\/lib\/libtinfo.so.5.7/\/usr\/lib64\/libtinfo.so.5.9/' $DRACUTMODDIR/install + sed -i 's/\/usr\/lib64\/libsasl2.so.2/\/usr\/lib64\/libsasl2.so.3/' $DRACUTMODDIR/install + + sed -i 's/\/lib\/terminfo\/l\/linux/\/usr\/share\/terminfo\/l\/linux/g' $DRACUTMODDIR/install + sed -i 's/\/lib\/terminfo\/v\/vt100/\/usr\/share\/terminfo\/v\/vt100/g' $DRACUTMODDIR/install + + # these are needed for sysclone, but are not yet in mcp + sed -i 's/ bc//' $DRACUTMODDIR/install + sed -i 's/ mkdosfs//' $DRACUTMODDIR/install + sed -i 's/ rsync//' $DRACUTMODDIR/install + sed -i 's/ kexec//' $DRACUTMODDIR/install + sed -i 's/ klogd//' $DRACUTMODDIR/install + sed -i 's/ mdadm//' $DRACUTMODDIR/install + sed -i 's/ mkfs\.xfs//' $DRACUTMODDIR/install + sed -i 's/ xfs_db//' $DRACUTMODDIR/install + sed -i 's/ mkreiserfs//' $DRACUTMODDIR/install + sed -i 's/ reiserfstune//' $DRACUTMODDIR/install + sed -i 's/ vconfig//' $DRACUTMODDIR/install + sed -i 's/ killall//' $DRACUTMODDIR/install + + # These timezone files are not available in the latest mcp build + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh87//' $DRACUTMODDIR/install + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh88//' $DRACUTMODDIR/install + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh89//' $DRACUTMODDIR/install + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh87//' $DRACUTMODDIR/install + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh88//' $DRACUTMODDIR/install + sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh89//' $DRACUTMODDIR/install + # For ppc64 platform, needs to remove some files, -# and some files are in different directories -if [ `uname -m` = "ppc64" ]; then +# # and some files are in different directories +elif [ $BUILDARCH = "ppc64" ]; then sed -i 's/dracut_install efibootmgr//' $DRACUTMODDIR/install sed -i 's/ dmidecode//' $DRACUTMODDIR/install sed -i 's/\/lib\/libncurses.so.5.7/\/lib64\/libncurses.so.5.7/' $DRACUTMODDIR/install @@ -46,38 +102,11 @@ if [ `uname -m` = "ppc64" ]; then sed -i 's/\/lib\/terminfo\/v\/vt100/\/usr\/share\/terminfo\/v\/vt100/g' $DRACUTMODDIR/install fi -if [ "$HOSTOS" = "mcp" ]; then - sed -i 's/mkfs.btrfs//' $DRACUTMODDIR/install - sed -i 's/\/etc\/redhat-release/\/etc\/base-release \/etc\/system-release/' $DRACUTMODDIR/install - sed -i 's/btrfs//' $DRACUTMODDIR/installkernel - - sed -i 's/\/usr\/bin\/basename/\/bin\/basename/' $DRACUTMODDIR/install - - # these are needed for sysclone, but are not yet in mcp - sed -i 's/ bc//' $DRACUTMODDIR/install - sed -i 's/ mkdosfs//' $DRACUTMODDIR/install - sed -i 's/ rsync//' $DRACUTMODDIR/install - sed -i 's/ kexec//' $DRACUTMODDIR/install - sed -i 's/ klogd//' $DRACUTMODDIR/install - sed -i 's/ mdadm//' $DRACUTMODDIR/install - sed -i 's/ mkfs\.xfs//' $DRACUTMODDIR/install - sed -i 's/ xfs_db//' $DRACUTMODDIR/install - sed -i 's/ mkreiserfs//' $DRACUTMODDIR/install - sed -i 's/ reiserfstune//' $DRACUTMODDIR/install - - # These timezone files are not available in the latest mcp build - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh87//' $DRACUTMODDIR/install - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh88//' $DRACUTMODDIR/install - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh89//' $DRACUTMODDIR/install - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh87//' $DRACUTMODDIR/install - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh88//' $DRACUTMODDIR/install - sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh89//' $DRACUTMODDIR/install -fi -mkdir -p /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs +mkdir -p /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs # run dracut if [ "$HOSTOS" = "mcp" ]; then - KPATH=`/bin/ls -d /lib/modules/*.x86_64` + KPATH=`/bin/ls -d /lib/modules/*` KERNELVERSION=`basename $KPATH` echo Creating the initramfs in /tmp/xcatgenesis.$$.rfs using dracut and kernel $KERNELVERSION ... else @@ -85,31 +114,31 @@ else fi # On Fedora 20 ppc64, dracut uses host-only mode by default -if [ `uname -m` = "ppc64" ]; then +if [ $BUILDARCH = "ppc64" ]; then dracut -m "xcat base" -N -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION else dracut -m "xcat base" -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION fi -echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs ... -cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs +echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs ... +cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs zcat /tmp/xcatgenesis.$$.rfs|cpio -dumi # add the kernel if [ "$HOSTOS" = "mcp" ]; then echo Adding kernel /boot/vmlinuz-* ... - cp /boot/vmlinuz-*.x86_64 /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/kernel + cp /boot/vmlinuz-* /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/kernel else - echo Adding kernel /boot/vmlinuz-`uname -r` ... - cp /boot/vmlinuz-`uname -r` /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/kernel + echo Adding kernel /boot/vmlinuz-$BUILDARCH ... + cp /boot/vmlinuz-$BUILDARCH /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/kernel fi cd - # create tar file -echo Tarring /tmp/xcatgenesis.$$/opt into ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 ... +echo Tarring /tmp/xcatgenesis.$$/opt into ~/rpmbuild/SOURCES/xCAT-genesis-base-$BUILDARCH.tar.bz2 ... cd /tmp/xcatgenesis.$$ -tar jcf ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 opt +tar jcf ~/rpmbuild/SOURCES/xCAT-genesis-base-$BUILDARCH.tar.bz2 opt # build the rpm -echo Building xCAT-genesis-base rpm from ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 and $DIR/xCAT-genesis-base.spec ... +echo Building xCAT-genesis-base rpm from ~/rpmbuild/SOURCES/xCAT-genesis-base-$BUILDARCH.tar.bz2 and $DIR/xCAT-genesis-base.spec ... rpmbuild -ba $DIR/xCAT-genesis-base.spec rm -rf $DRACUTMODDIR diff --git a/xCAT-genesis-builder/xcat-cmdline.sh b/xCAT-genesis-builder/xcat-cmdline.sh index 00aa2556e..b7cb7c093 100755 --- a/xCAT-genesis-builder/xcat-cmdline.sh +++ b/xCAT-genesis-builder/xcat-cmdline.sh @@ -7,6 +7,7 @@ echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile mkdir -p /etc/ssh mkdir -p /var/tmp/ mkdir -p /var/empty/sshd +sed -i '/^root:x/d' /etc/passwd echo root:x:0:0::/:/bin/bash >> /etc/passwd echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd echo rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin >> /etc/passwd diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index b0e5bb7df..e85bda22d 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -117,6 +117,7 @@ mask2prefix() { } # see if they specified static ip info, otherwise use dhcp +XCATPORT=3001 for parm in `cat /proc/cmdline`; do key=`echo $parm|awk -F= '{print $1}'` value=`echo $parm|awk -F= '{print $2}'` @@ -126,8 +127,14 @@ for parm in `cat /proc/cmdline`; do netmask=$value elif [[ ${key,,} == "gateway" ]]; then gateway=$value + elif [[ ${key,,} == "xcatd" ]]; then + XCATMASTER=`echo $value |awk -F: '{print $1}'` + XCATPORT=`echo $value |awk -F: '{print $2}'` fi done +export XCATPORT +export XCATMASTER + if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then # doing static ip # the device was determined above from the bootif mac, and put in bootnic @@ -145,54 +152,68 @@ if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then sleep 3 else echo "Setting IP via DHCP..." -# This section is for System P hardware discovery, which won't have a BOOTIF value set - tries=0 - while [ $tries -lt 5 ]; do - if [ -z "$bootnic" ]; then - ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo` - for tmp1 in $ALLUP_NICS; do - bootnic=$tmp1 - break - done - else - break - fi - sleep 2 - tries=$(($tries+1)) - done + # This section is for System P hardware discovery, which won't have a BOOTIF value set if [ -z "$bootnic" ]; then - ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo` - for tmp in $ALL_NICS; do - bootnic=$tmp - break + tries=0 + while [ $tries -lt 100 ]; do + ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo | sort -n -r` + for tmp1 in $ALLUP_NICS; do + dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$tmp1.pid $tmp1 & + dhclient -6 -pf /var/run/dhclient6.$tmp1.pid $tmp1 -lf /var/lib/dhclient/dhclient6.leases & + #bootnic=$tmp1 + #break + done + if [ ! -z "$ALLUP_NICS" ]; then + break + fi + sleep 2 + tries=$(($tries+1)) done - fi - dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic & - #we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce - #chances that we'll perform a partial discovery - #in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up - dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases & - NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'` - export NICSTOBRINGUP - for nic in $NICSTOBRINGUP; do + echo -n "Acquiring network addresses.." + while [ -z "$bootnic" ]; do + for tmp1 in $ALLUP_NICS; do + if ip addr show dev $tmp1|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; then + result=`ping -c1 -I $tmp1 $XCATMASTER 2>&1` + if [ $? -eq 0 ]; then + bootnic=$tmp1 + break + fi + fi + done + sleep 2 + done + if [ -z "$bootnic" ]; then + /bin/bash + fi + else + dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic & + #we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce + #chances that we'll perform a partial discovery + #in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up + dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases & + NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'` + export NICSTOBRINGUP + for nic in $NICSTOBRINGUP; do (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) & (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) & - done + done + + gripeiter=101 + echo -n "Acquiring network addresses.." + while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; do + sleep 0.1 + if [ $gripeiter = 1 ]; then + echo + echo "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..." + fi + gripeiter=$((gripeiter-1)) + done + fi fi openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 & -gripeiter=101 -echo -n "Acquiring network addresses.." -while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; do - sleep 0.1 - if [ $gripeiter = 1 ]; then - echo - echo "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..." - fi - gripeiter=$((gripeiter-1)) -done echo -n "Acquired IPv4 address on $bootnic: " ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}' ntpd -g -x @@ -214,16 +235,7 @@ if [ -f "/usr/sbin/dmidecode" ]; then fi DEVICE=$bootnic export DEVICE -XCATPORT=3001 -export XCATPORT -for parm in `cat /proc/cmdline`; do - key=`echo $parm|awk -F= '{print $1}'` - if [ "$key" = "xcatd" ]; then - XCATMASTER=`echo $parm|awk -F= '{print $2}'|awk -F: '{print $1}'` - XCATPORT=`echo $parm|awk -F= '{print $2}'|awk -F: '{print $2}'` - fi -done -export XCATMASTER + if [ "$destiny" != "discover" ]; then #we aren't discoverying, we probably can and should get a cert /bin/getcert $XCATMASTER:$XCATPORT fi diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index a9fcc666a..b34da65aa 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -11,6 +11,7 @@ BEGIN } } + use lib "$::XCATROOT/lib/perl"; #use Net::SNMP qw(:snmp INTEGER); use xCAT::Table; @@ -2004,7 +2005,7 @@ sub getmacs { } my @macs = (); - (my $code,my @orig_macs)=inv('mac'); + (my $code,my @orig_macs)=inv($node, 'mac'); my $ignore_gen_mac = 0; foreach my $mac (@orig_macs) { if ($mac =~ /(.*) -> (.*)/) { @@ -2113,6 +2114,7 @@ sub getmacs { } sub inv { + my $node = shift; my @invitems; my $data; my @output; @@ -2239,50 +2241,67 @@ sub inv { $updatehash{serial}=$data; } - if ($item =~ /^mac/ and $slot !~ /:/) { - foreach (0..3) { - $data=$session->get([$macoids[$_],$slot]); - if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } - if ($data =~ /:/) { - push @output,"MAC Address ".($_+1).": ".$data; + #print "item=$item, slot=$slot\n"; + + if ($item =~ /^mac/) { + if ($slot !~ /:/) { + foreach (0..3) { + $data=$session->get([$macoids[$_],$slot]); + if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } + if ($data =~ /:/) { + push @output,"MAC Address ".($_+1).": ".$data; + } + } + foreach (0..3) { + my $oid=$hsdcmacoids[$_].".$slot"; + $data=$session->get([$hsdcmacoids[$_],$slot]); + + if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } + if ($data =~ /:/) { + push @output,"HS Daughter card MAC Address ".($_+1).": ".$data; + } + } + foreach (0..3) { + $data=$session->get([$dcmacoids[$_],$slot]); + if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } + if ($data =~ /:/) { + push @output,"Daughter card 1 MAC Address ".($_+1).": ".$data; + } + } + foreach (0..3) { + $data=$session->get([$sidecardoids[$_],$slot]); + if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } + if ($data =~ /:/) { + push @output,"Side card MAC Address ".($_+1).": ".$data; + } + } + } else { + my $cmd="pasu $node show PXE |grep NicPortMacAddress"; + my $mac_list = xCAT::Utils->runcmd($cmd, 0, 1); + #print "mac_list=$mac_list\n"; + if (@$mac_list > 0) { + foreach my $mac (@$mac_list) { + #print "mac=$mac\n"; + $mac =~ s/^.*PXE.NicPortMacAddress.*(\d+)=(.*)$/"MAC Address $1: $2/; + #print "mac=$mac\n"; + push @output, $mac; + } + } } - } - foreach (0..3) { - my $oid=$hsdcmacoids[$_].".$slot"; - $data=$session->get([$hsdcmacoids[$_],$slot]); - if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } - if ($data =~ /:/) { - push @output,"HS Daughter card MAC Address ".($_+1).": ".$data; - } - } - foreach (0..3) { - $data=$session->get([$dcmacoids[$_],$slot]); - if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } - if ($data =~ /:/) { - push @output,"Daughter card 1 MAC Address ".($_+1).": ".$data; - } - } - foreach (0..3) { - $data=$session->get([$sidecardoids[$_],$slot]); - if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); } - if ($data =~ /:/) { - push @output,"Side card MAC Address ".($_+1).": ".$data; - } - } - } - } - if ($updatetable and $updatehash{mtm}) { + } + } + if ($updatetable and $updatehash{mtm}) { #updatenodegroups my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($updatehash{mtm}) ; if (defined($tmp_pre)) { xCAT::TableUtils->updatenodegroups($currnode, $tmp_pre); } - } - if ($updatetable and keys %updatehash) { + } + if ($updatetable and keys %updatehash) { my $vpdtab = xCAT::Table->new('vpd'); $vpdtab->setNodeAttribs($currnode,\%updatehash); - } - return (0,@output); + } + return (0,@output); } sub power { my $subcommand = shift; @@ -3716,7 +3735,7 @@ sub bladecmd { } elsif ($command eq "getmacs") { return getmacs($node, @args); } elsif ($command eq "rinv") { - return inv(@args); + return inv($node, @args); } elsif ($command eq "reventlog") { return eventlog(@args); } elsif ($command eq "rscan") { diff --git a/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl b/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl index b32f1f01d..b1ac4c9b8 100644 --- a/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl +++ b/xCAT-server/share/xcat/install/rh/service.rhels7.tmpl @@ -151,4 +151,5 @@ reboot %end %post #INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels7# %end diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 8625c7288..cbda9ed55 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -918,8 +918,8 @@ foreach my $dn (@ndrivers) { system("chroot $rootimg_dir depmod $kernelver"); if ($dracutmode) { - mkinitrd_dracut("statelite"); mkinitrd_dracut("stateless"); + mkinitrd_dracut("statelite"); } else { my @drivers; # backup of @ndrivers push @drivers, @ndrivers; diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 4edff6ac0..0c6fd71ac 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -830,20 +830,25 @@ sub getlibs { my $liblist = `chroot $rootimg_dir ldd $file`; my @libs = split/\n/,$liblist; my @return; - foreach (@libs) { - unless (/=>/) { - (my $wjnk, my $lib,my $jnk) = split /\s+/,$_,3; - $lib =~ s/^\///; - $libhash{$lib}=1; - next; - } - (my $temp1,my $temp2) = split />/,$_,2; - (my $whitespace,$temp1,$temp2) = split /\s+/,$temp2,4; - unless ($temp1 =~ /\//) { - next; - } - $temp1 =~ s/^\///; - $libhash{$temp1}=1; + foreach (@libs) { + if(/statically linked/ or /not a dynamic executable/){ + return; + } + unless (/=>/) { + (my $wjnk, my $lib,my $jnk) = split /\s+/,$_,3; + $lib =~ s/^\///; + $libhash{$lib}=1; + getlibs($lib); + next; + } + (my $temp1,my $temp2) = split />/,$_,2; + (my $whitespace,$temp1,$temp2) = split /\s+/,$temp2,4; + unless ($temp1 =~ /\//) { + next; + } + $temp1 =~ s/^\///; + $libhash{$temp1}=1; + getlibs($temp1); } } @@ -1180,12 +1185,20 @@ for i in `cat /proc/cmdline`; do #NOTE needs FT retry code to scale #NOTE: should prob have max count FILENAME=`echo \$VALUE|awk -F/ '{print \$NF}'` + + MAXTRIES=5 + ITER=0 while [ ! -r "\$FILENAME" ]; do echo Getting \$VALUE... - if ! wget \$VALUE; then + if ! /usr/bin/wget \$VALUE; then ST=`expr \$RANDOM % 5` sleep \$ST rm -f \$FILENAME + ITER=\$(expr \$ITER + 1 ) + if [ "\$ITER" == "\$MAXTRIES" ]; then + /bin/busybox telnetd -l /bin/sh + shell + fi fi done fi @@ -1420,7 +1433,7 @@ EOMS print $inifile "fi\n"; print $inifile "cd /\n"; print $inifile "cp /etc/hostname \$NEWROOT/etc/hostname\n"; - print $inifile "cp /etc/resolv.conf \$NEWROOT/etc/resolv.conf\n"; + print $inifile "rm -f \$NEWROOT/etc/resolv.conf; cp /etc/resolv.conf \$NEWROOT/etc/resolv.conf\n"; print $inifile "mount --move /dev \$NEWROOT/dev \n"; print $inifile "mount --move /proc \$NEWROOT/proc \n"; print $inifile "mount --move /sys \$NEWROOT/sys \n"; @@ -1525,7 +1538,7 @@ EOMS } } # add rsync for statelite - foreach ("bin/busybox","bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod") { + foreach ( "usr/bin/dig","bin/busybox","bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod","usr/bin/wget") { getlibs($_); push @filestoadd,$_; } @@ -1541,6 +1554,10 @@ EOMS if ($arch =~ /x86_64/) { push @filestoadd,"lib64/libnss_dns.so.2"; push @filestoadd,"lib64/libresolv.so.2"; + } elsif ($arch =~ /ppc64el/) { + push @filestoadd,"lib/powerpc64le-linux-gnu/libnss_files.so.2"; + push @filestoadd,"lib/powerpc64le-linux-gnu/libnss_dns.so.2"; + } else { push @filestoadd,"lib/libnss_dns.so.2"; } @@ -1583,6 +1600,11 @@ EOMS system("cp $rootimg_dir/lib/modules/$kernelver/modules.order /tmp/xcatinitrd.$$/lib/modules/$kernelver/modules.order"); } + +# if (-d "$rootimg_dir/lib/powerpc64le-linux-gnu/"){ +# system("cp -rf $rootimg_dir/lib/powerpc64le-linux-gnu/* /tmp/xcatinitrd.$$/lib/powerpc64le-linux-gnu/"); +# } + system("chroot /tmp/xcatinitrd.$$/ depmod $kernelver"); # Copy udev and network scripts into initrd for s390x, which also works for other platforms # udev diff --git a/xCAT/postscripts/hardeths b/xCAT/postscripts/hardeths index 43ec7c84e..be1411ede 100755 --- a/xCAT/postscripts/hardeths +++ b/xCAT/postscripts/hardeths @@ -75,6 +75,7 @@ fi for nic in `ip link |grep "BROADCAST" |awk '{print $2}' | sed s/://`; do IPADDRMASK=`ip addr show dev $nic | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1` IPADDR=`echo $IPADDRMASK | awk -F'/' '{print $1}'` + [ -z $IPADDR ] && continue PREFIXMASK=`echo $IPADDRMASK | awk -F'/' '{print $2}'` # converts to x.x.x.x mask value maskfromprefix $PREFIXMASK @@ -108,7 +109,8 @@ EOF NICFILE=${NICFILEPRE}${nic} else #mac=`ifconfig $nic|grep HWaddr|awk '{print $5}'|tr "[A-Z]" "[a-z]"` - mac=`ip link show $nic | grep ether | awk '{print $2}'` + mac=`ip link show $nic | grep "ether\|infiniband" | awk '{print $2}'` + [ -z $mac ] && continue NICFILE=${NICFILEPRE}eth-id-${mac} fi sed -i s/BOOTPROTO=dhcp/BOOTPROTO=static/ $NICFILE