From 4be45af09cf9cd99beb6e252809ba4387454d102 Mon Sep 17 00:00:00 2001 From: phamt Date: Mon, 20 Dec 2010 17:48:56 +0000 Subject: [PATCH] Added support for RHEL6. Cleaned up RHEL5 kickstart template. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8485 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/zvm.pm | 5 + .../xcat/install/rh/compute.rhel5.s390x.tmpl | 4 +- .../xcat/install/rh/compute.rhel6.s390x.tmpl | 29 +++++ .../xcat/install/scripts/post.rhel6.s390x | 118 ++++++++++++++++++ 4 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 xCAT-server/share/xcat/install/rh/compute.rhel6.s390x.tmpl create mode 100644 xCAT-server/share/xcat/install/scripts/post.rhel6.s390x diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index b0edb7070..7e42c468b 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -3136,6 +3136,8 @@ sub nodeSet { $postScript = "/opt/xcat/share/xcat/install/scripts/post.sles11.s390x"; } elsif ( $os =~ m/rhel5/i ) { $postScript = "/opt/xcat/share/xcat/install/scripts/post.rhel5.s390x"; + } elsif ( $os =~ m/rhel6/i ) { + $postScript = "/opt/xcat/share/xcat/install/scripts/post.rhel6.s390x"; } else { xCAT::zvmUtils->printLn( $callback, "$node: (Error) No postscript available for $os" ); return; @@ -3311,6 +3313,9 @@ sub nodeSet { # If the line contains 'ramdisk_size' if ( $_ =~ m/ramdisk_size/i ) { $parmHeader = xCAT::zvmUtils->trimStr($_); + + # Remove last parameter on RHEL6 + $parmHeader =~ s/cio_ignore=all,!0.0.0009//g; } } diff --git a/xCAT-server/share/xcat/install/rh/compute.rhel5.s390x.tmpl b/xCAT-server/share/xcat/install/rh/compute.rhel5.s390x.tmpl index 30001ca62..caa976446 100644 --- a/xCAT-server/share/xcat/install/rh/compute.rhel5.s390x.tmpl +++ b/xCAT-server/share/xcat/install/rh/compute.rhel5.s390x.tmpl @@ -20,13 +20,11 @@ key --skip zerombr yes clearpart --initlabel --drives=dasda part / --fstype ext3 --size=100 --grow --ondisk=dasda +part swap --size=512 --ondisk=dasda %packages @base @core @base-x -fipscheck -device-mapper-multipath -sgpio %post \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/rh/compute.rhel6.s390x.tmpl b/xCAT-server/share/xcat/install/rh/compute.rhel6.s390x.tmpl new file mode 100644 index 000000000..6f23f2ce1 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/compute.rhel6.s390x.tmpl @@ -0,0 +1,29 @@ +# Kickstart file automatically generated by anaconda. + +install +url --url replace_url +key --skip +lang en_US.UTF-8 +network --bootproto dhcp +rootpw replace_rootpw +firewall --disabled +authconfig --enableshadow --enablemd5 +selinux --enforcing +timezone --utc America/New_York +bootloader --location=mbr +reboot +key --skip +# The following is the partition information you requested +# Note that any partitions you deleted are not expressed +# here so unless you clear all partitions first, this is +# not guaranteed to work +zerombr yes +clearpart --initlabel --drives=dasda +part / --fstype ext3 --size=100 --grow --ondisk=dasda +part swap --size=512 --ondisk=dasda + +%packages +@base +@core + +%post \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x new file mode 100644 index 000000000..2d42d1b36 --- /dev/null +++ b/xCAT-server/share/xcat/install/scripts/post.rhel6.s390x @@ -0,0 +1,118 @@ +echo ARP=no >> /etc/sysconfig/network-scripts/ifcfg-eth0 + +# Get hostname +export HOSTNAME=$(host $IP 2>/dev/null | awk '{print $5}' | awk -F. '{print $1}') +hostname $HOSTNAME + +# Run xcat postscripts +# Master/service node set by nodeset +export MASTER_IPS=( replace_master ) +export MASTER=replace_master +cd /tmp +RAND=$(perl -e 'print int(rand(50)). "\n"') +sleep $RAND + +# Loop through the master/service nodes +for i in $(seq 1 20) +do + GOTIT=0 + for i in $MASTER_IPS + do + # Download postscripts from FTP server + wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts + if [ "$?" = "0" ]; then + # Exit if openssl is not executable + if [ ! -x /usr/bin/openssl ]; then + exit 1 + fi + + USEOPENSSLFORXCAT=1 + export USEOPENSSLFORXCAT + + # Get xcat server + XCATSERVER=$i:3001 + export XCATSERVER + + # Move postscritps into /xcatpost + mv $i/postscripts /xcatpost + # Remove postscritps + rm -rf $i + # Make postscripts executable + chmod +x /xcatpost/* + + # Get postscript to run on this node from xcat server + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript + MYCONT=`grep MASTER /tmp/mypostscript` + MAX_RETRIES=10 + RETRY=0 + while [ -z "$MYCONT" ]; do + RETRY=$(($RETRY+1)) + if [ $RETRY -eq $MAX_RETRIES ] + then + break + fi + + # Sleep a couple of seconds before trying again + let SLI=$RANDOM%10+10 + sleep $SLI + + # Get postscript to run on this node from xcat server + /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript + MYCONT=`grep MASTER /tmp/mypostscript` + done + + # Make executable + chmod +x /tmp/mypostscript + GOTIT=1 + break + fi + done + + # If postscripts for this node are found + if [ "$GOTIT" = "1" ]; then + # Save the master/service node to /opt/xcat/xcatinfo file + if [ ! -f /opt/xcat/xcatinfo ]; then + mkdir -p /opt/xcat + touch /opt/xcat/xcatinfo + fi + echo "XCATSERVER=$i" > /opt/xcat/xcatinfo + break + fi + RAND=$(perl -e 'print int(rand(5)). "\n"') + sleep $RAND +done + +cd /xcatpost +export PATH=/xcatpost:$PATH + +# Save post boot scripts to /tmp/mypostscript.post +TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript.post +chmod 755 /tmp/mypostscript.post + +# Create post init +cat >/etc/init.d/xcatpostinit1 << 'EOF' +# Install directory variable set by nodeset +replace_install_dir/postscripts/xcatpostinit1 +EOF +# Change permissions +chmod 755 /etc/init.d/xcatpostinit1 + +# Create post install +mkdir -p /opt/xcat +cat >/opt/xcat/xcatinstallpost << 'EOF' +# Install directory variable set by nodeset +replace_install_dir/postscripts/xcatinstallpost +chkconfig xcatpostinit1 off +EOF +chmod 755 /opt/xcat/xcatinstallpost + +chkconfig --add xcatpostinit1 + +# Only run preboot scripts here +TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript` +echo "$TMP" > /tmp/mypostscript +/tmp/mypostscript + +# Master/service node variable set by nodeset +updateflag.awk replace_master 3002 \ No newline at end of file