Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core

This commit is contained in:
mellor 2014-05-06 14:10:57 -04:00
commit ec0a921395
5 changed files with 14 additions and 320 deletions

View File

@ -1020,6 +1020,7 @@ sub fork_fanout_dsh
}
}
# save the original exports, we are going to add the unique node name below
my $firstpass=0;
while (@$targets_waiting
&& (keys(%$targets_active) < $$options{'fanout'}))
{
@ -1046,6 +1047,7 @@ sub fork_fanout_dsh
}
if ($$options{'environment'})
{
if ($firstpass ==0) { # do the servicenode stuff only once
# if we are on a servicenode need to get the environment file
# from the SNsyncfiledir, not local
if (xCAT::Utils->isServiceNode()) {
@ -1068,8 +1070,10 @@ sub fork_fanout_dsh
$rsp->{error}->[0] = "File $$options{'environment'} does not exist";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
}
# build the xdsh command
push @dsh_command,
$firstpass=1;
}
# build the xdsh command
push @dsh_command,
"$exportnode$$options{'pre-command'} . $$options{'environment'} ; $$options{'command'}$$options{'post-command'}";
}

View File

@ -217,14 +217,13 @@ sub is_me
#my ($b1, $b2, $b3, $b4) = split /\./, $nameIP;
# get all the possible IPs for the node I'm running on
my $ifcmd = "ifconfig -a | grep 'inet'";
my $result = xCAT::Utils->runcmd($ifcmd, -1, 1);
my $ipcmd = "ip addr | grep 'inet'";
my $result = xCAT::Utils->runcmd($ipcmd, -1, 1);
if ($::RUNCMD_RC != 0)
{
my $rsp;
# push @{$rsp->{data}}, "Could not run $ifcmd.\n";
# xCAT::MsgUtils->message("E", $rsp, $callback);
$::VERBOSE = $verb;
my $str="Error running ipcmd";
xCAT::MsgUtils->message("S", $str);
$::VERBOSE = $verb;
return 0;
}
@ -232,7 +231,6 @@ sub is_me
{
my ($inet, $myIP, $str) = split(" ", $int);
chomp $myIP;
$myIP =~ s/addr://;
$myIP =~ s/\/.*//; # ipv6 address 4000::99/64
$myIP =~ s/\%.*//; # ipv6 address ::1%1/128
@ -1135,8 +1133,8 @@ sub dolitesetup
if (!$file) {
next;
}
}
# ex. .../inst_root/foo/bar/ or .../inst_root/etc/lppcfg
my $instrootfile = $instrootloc . $file;

View File

@ -1,138 +0,0 @@
#!/bin/sh
#
# stateless
#
# chkconfig: 345 11 99
# description: action stateless
#
# Source the library functions
. /etc/rc.d/init.d/functions
ZONE="US/Mountain"
case "$1" in
start)
echo -n "Starting stateless configuration: "
if [ -r /etc/stateless_done ]
then
echo_failure
echo
echo " already run!"
exit $?
fi
#initrd=xcat/netboot/fedora8/x86_64/compute/initrd.gz imgurl=nfs://rro000/install/netboot/fedora8/x86_64/compute/rootimg console=ttyS1,19200n8r BOOT_IMAGE=xcat/netboot/fedora8/x86_64/compute/kernel
cat /proc/cmdline | grep imgurl >/dev/null 2>&1
if [ "$?" != "0" ]
then
echo_failure
echo
echo " imgurl missing from /proc/cmdline, i.e. stateful!"
exit $?
fi
for i in $(cat /proc/cmdline)
do
KEY=$(echo $i | awk -F= '{print $1}')
VALUE=$(echo $i | awk -F= '{print $2}')
if [ "$KEY" = "imgurl" ]
then
SERVER=$(echo $VALUE | awk -F/ '{print $3}')
fi
done
if [ -z "$SERVER" ]
then
echo_failure
echo
echo "bogus server in imgurl"
exit $?
fi
echo
echo " Universal Server: $SERVER"
echo -n " Syslog: "
echo "*.* @$SERVER" >/etc/rsyslog.conf
echo_success
echo
if [ -r /etc/rc.d/init.d/ntpd ]
then
echo -n " NTP: "
if [ ! -r /etc/sysconfig/clock ]
then
echo "ZONE=\"$ZONE\"
UTC=true
ARC=false" >/etc/sysconfig/clock
fi
echo "server $SERVER
driftfile /etc/ntp/drift
multicastclient
broadcastdelay 0.008
disable auth
keys /etc/ntp/keys
trustedkey 65535
requestkey 65535
controlkey 65535" >/etc/ntp.conf
echo "$SERVER" >/etc/ntp/step-tickers
echo_success
echo
fi
if [ -r /etc/ldap.conf -a -r /etc/resolv.conf ]
then
echo -n " LDAP: "
DC=$(
cat /etc/resolv.conf | \
egrep '(domain|search)' | \
head -1 | \
awk '{print $2}' | \
sed 's/\./,dc=/g' | \
sed 's/^/dc=/'
)
echo "host $SERVER
base $DC
nss_base_passwd ou=People,$DC
nss_base_shadow ou=People,$DC
nss_base_group ou=Group,$DC
timelimit 120
bind_timelimit 120
idle_timelimit 3600
nss_initgroups_ignoreusers root,ldap,named,avahi,haldaemon,dbus,radvd,tomcat,radiusd,news,mailman,nscd
ssl no
tls_cacertdir /etc/openldap/cacerts
pam_password md5" >/etc/ldap.conf
echo "URI ldap://$SERVER
BASE $DC
TLS_CACERTDIR /etc/openldap/cacerts" >/etc/openldap/ldap.conf
cd /etc
cp nsswitch.conf nsswitch.conf.ORIG
sed -r 's/^((passwd|shadow|group):.*)/\1 ldap/' <nsswitch.conf.ORIG >nsswitch.conf
cd /etc/pam.d
cp system-auth system-auth.ORIG
sed -r 's/(account\s+required\s+pam_unix.so)/account sufficient pam_ldap.so\n\1/' <system-auth.ORIG >system-auth
echo_success
echo
fi
touch /etc/stateless_done
;;
stop)
;;
*)
echo "Usage: stateless {start|stop}"
exit 1
esac

View File

@ -1,170 +0,0 @@
################################################################################
# Create a generic HPC image
# This script is an example of how to create an HPC image with xCAT stateless.
# in this example you may need to change some of the parameters. In the future
# we should probably place this in the database...
# All good sys admins can reproduce their environments. Creating a stateless
# image should be reproducable. Doing this with a script is a good idea.
#
################################################################################
# specify the OS stuff. You'll probably want to change this. If you do then you'll
# need to make sure there is a *.pkglist and *.exlist
PROFILE=compute
ARCH=x86_64
OS=centos5.3
# this is where the OS image will reside
IMGROOT=/install/netboot/$OS/$ARCH/$PROFILE/rootimg
# remove the old image if it exists.
rm -rf /install/netboot/$OS/$ARCH/$PROFILE
# generate the base image
# for IBM: tg3 in older blades, bnx in newer stuff, and igb in the nehalem based products.
/opt/xcat/share/xcat/netboot/centos/genimage -i eth0 -n libphy,tg3,bnx2,igb -o $OS -p $PROFILE
# update the yum database in the image
rm -rf $IMGROOT/etc/yum.repos.d
yum --installroot=$IMGROOT clean all
cp -a /etc/yum.repos.d/ $IMGROOT/etc/
rm -rf $IMGROOT/etc/yum.repos.d/xCAT-*
# no selinux!!
echo SELINUX=disabled > $IMGROOT/etc/sysconfig/selinux
# fix respawns
cp $IMGROOT/etc/inittab $IMGROOT/etc/inittab.ORIG
grep -v 38400 $IMGROOT/etc/inittab.ORIG > $IMGROOT/etc/inittab
# filesystem setup, you'll want to customize this. We have swap and scratch
# configured here. But if you don't have disks then this may not help.
# we name our / partition the image name (compute by default) plus a timestamp.
TIME=`date +%s`
cp $IMGROOT/etc/fstab $IMGROOT/etc/fstab.ORIG
echo "proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
$PROFILE-$TIME / tmpfs rw 0 1
#/dev/sda1 swap swap defaults 0 0
#/dev/sda2 /scratch ext3 defaults 0 0
" > $IMGROOT/etc/fstab
mkdir $IMGROOT/scratch
### get ntp to start on boot
chroot $IMGROOT chkconfig --level 345 ntpd on
#### user stuff so that we can do some work ####
cp /etc/shadow $IMGROOT/etc/
cp /etc/group $IMGROOT/etc/
cp /etc/passwd $IMGROOT/etc/
cp /etc/hosts $IMGROOT/etc/
### scaling fixes #####
echo "# increase TCP max buffer size
net.core.rmem_max = 33554432
net.core.wmem_max = 33554432
net.core.rmem_default = 65536
net.core.wmem_default = 65536
# increase Linux autotuning TCP buffer limits
# min, default, and max number of bytes to use
net.ipv4.tcp_rmem = 4096 33554432 33554432
net.ipv4.tcp_wmem = 4096 33554432 33554432
net.ipv4.tcp_mem= 33554432 33554432 33554432
net.ipv4.route.flush=1
net.core.netdev_max_backlog=1500
#GPFS / NFS Tuning
net.ipv4.conf.all.arp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.neigh.default.gc_thresh1 = 1024
net.ipv4.neigh.default.gc_thresh2 = 4096
net.ipv4.neigh.default.gc_thresh3 = 8192
net.ipv4.neigh.default.gc_stale_time = 24" >> $IMGROOT/etc/sysctl.conf
## Limits: need to make sure users can have unlimited memory (ulimit -l unlimited)
cp /etc/security/limits.conf $IMGROOT/etc/security/
### add torque ###
/opt/xcat/share/xcat/netboot/add-on/torque/add_torque $IMGROOT mgt /opt/torque / local
# update the limit on pegged memory limit and if they have old xCAT then make sure
# it says torque instead of pbs in the paths of the config file.
perl -pi -e 's/ulimit -n 20000/ulimit -n 20000; ulimit -l unlimited/g' $IMGROOT/etc/init.d/pbs_mom
perl -pi -e 's/spool\/pbs/spool\/torque/g' $IMGROOT/etc/init.d/pbs_mom
perl -pi -e 's/spool\/pbs/spool\/torque/g' $IMGROOT/etc/init.d/pbs_mom
perl -pi -e 's/PBS_HOME=\/var\/spool\/pbs/PBS_HOME=\/var\/spool\/torque/g' $IMGROOT/var/spool/torque/mom_priv/epilogue
perl -pi -e 's/PBS_HOME=\/var\/spool\/pbs/PBS_HOME=\/var\/spool\/torque/g' $IMGROOT/var/spool/torque/mom_priv/prologue
perl -pi -e 's/PBS_HOME=\/var\/spool\/pbs/PBS_HOME=\/var\/spool\/torque/g' $IMGROOT/var/spool/torque/mom_priv/takedownnode
### stateless init script does NTP, syslog, etc. ####
cp /etc/localtime $IMGROOT/etc/
cp /opt/xcat/share/xcat/netboot/add-on/stateless/stateless $IMGROOT/etc/init.d/
perl -pi -e 's!Mountain!Mexico/General!g' $IMGROOT/etc/init.d/stateless
perl -pi -e 's/driftfile \/etc\/ntp/driftfile \/var\/lib\/ntp/g' $IMGROOT/etc/init.d/stateless
perl -pi -e 's/keys \/etc\/ntp/keys \/var\/lib\/ntp/g' $IMGROOT/etc/init.d/stateless
rm -rf $IMGROOT/etc/sysconfig/clock
chroot $IMGROOT chkconfig --level 345 stateless on
chroot $IMGROOT chkconfig --level 345 rsyslog on
### make sure dhcp boot protocol is set to none ###
perl -pi -e 's/dhcp/none/g' $IMGROOT/etc/sysconfig/network-scripts/ifcfg-eth0
#### add GPFS stuff ###
# this is an example of a stateless GPFS implementation. Uncomment the below if you
# want GPFS. Make sure you have the GPFS RPMs to do this.
#GPFSSRCDIR=/install/GPFS
#yum --installroot=$IMGROOT -y install glibc ksh compat-libstdc++-33 binutils rsh
#rpm -ivh --root=$IMGROOT $GPFSSRCDIR/gpfs.base*rpm
#rpm -ivh --root=$IMGROOT $GPFSSRCDIR/gpfs.gpl*rpm
#rpm -ivh --root=$IMGROOT $GPFSSRCDIR/gpfs.msg*rpm
#rpm -Uivh --root=$IMGROOT $GPFSSRCDIR/updates/gpfs.base*rpm
#rpm -Uivh --root=$IMGROOT $GPFSSRCDIR/updates/gpfs.gpl*rpm
#rpm -Uivh --root=$IMGROOT $GPFSSRCDIR/updates/gpfs.msg*rpm
##
#AUTOGPFSDIR=/opt/xcat/share/xcat/netboot/add-on/autogpfs
#cp $AUTOGPFSDIR/autogpfsc.pl $IMGROOT/usr/sbin
#cp $AUTOGPFSDIR/autogpfsc $IMGROOT/etc/init.d/
#echo "SERVERS=mgt
#PORT=3003
#BLOCK=no" >> $IMGROOT/etc/sysconfig/autogpfsc
#
#chroot $IMGROOT chkconfig --level 345 autogpfsc on
#cp $GPFSSRCDIR/2.6.18-128.el5/* $IMGROOT/usr/lpp/mmfs/bin/
#cp /etc/profile.d/gpfs.sh $IMGROOT/etc/profile.d/
### End GPFS Stuff ####
### IB Stuff ####
# if you have InfiniBand on your machines then you probably have an OFED distribution you
# need to add. Here is an example of how to add it.
#echo "Adding InfiniBand"
#yum --installroot=$IMGROOT -y install bind-utils which rpm tcl tk glibc-devel.i386 pciutils expat libgfortran.x86_64 libgomp.x86_64 tcsh
#
#IBROOT=/install/voltaire/VoltaireOFED-1.4.2_2-k2.6.18-128.el5-x86_64
#mount -o bind /proc $IMGROOT/proc
#mount -o bind /sys $IMGROOT/sys
#mount -o bind $IBROOT $IMGROOT/mnt
#chroot $IMGROOT /mnt/install.sh --without-mpi
#umount $IMGROOT/mnt
#umount $IMGROOT/sys
#umount $IMGROOT/proc
# configure IB IP address
#echo "IP=\`host \$HOSTNAME-ib0 | awk '{ print \$4 }' | head -1\`" >> $IMGROOT/etc/rc.d/rc.local
#echo "ifconfig ib0 \$IP" >> $IMGROOT/etc/rc.d/rc.local
#echo "ifconfig ib0 netmask 255.255.0.0" >> $IMGROOT/etc/rc.d/rc.local
### End IB Stuff ####
# configure name resolution
# change this to what you want it to be. (this is in site.tab as the domain and nameservers)
echo "search cluster.foo
nameserver 172.20.0.1" >$IMGROOT/etc/resolv.conf
### uniq-i-fy Torque OS name
echo "opsys compute_centos5.3" >> $IMGROOT/var/spool/torque/mom_priv/config
packimage -p $PROFILE -a $ARCH -o $OS
echo "Image $PROFILE-$TIME created"

View File

@ -180,7 +180,7 @@ if [ "$str_temp" = "mac" ];then
fi
done
else
str_inst_nic=`ifconfig -a | grep -i "$MACADDRESS" | awk '{print $1;}'`
str_inst_nic=`ip -o link | grep -i "$MACADDRESS" | awk '{print $2;}' | sed s/://`
fi
elif [ `echo $str_temp | grep -E "e(n|th)[0-9]+"` ];then
str_inst_nic=$str_temp