add service.raid1.sles11.tmpl and post.sles11.raid1 for RAID1 support on SLES11

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10576 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2011-09-21 03:13:12 +00:00
parent 5c3e3f6bf1
commit 71d204db9d
2 changed files with 330 additions and 0 deletions

View File

@ -0,0 +1,164 @@
<post-scripts config:type="list">
<script>
<filename>xcat.sh</filename>
<interpreter>shell</interpreter>
<source>
<![CDATA[
#!/bin/sh
cd /etc/sysconfig/network
rm -f ifcfg-eth-id*
rm -f ifcfg-myri*
cat >ifcfg-eth0 <<EOF
DEVICE=eth0
BOOTPROTO=dhcp
STARTMODE=onboot
EOF
. /tmp/prinicsetting
rm /tmp/prinicsetting
if [ "$PRINIC" != "eth0" ]
then
cd /etc/sysconfig/network
if [ ! -r ifcfg-$PRINIC ]
then
# cp -f ifcfg-eth0 ifcfg-$PRINIC
mv -f ifcfg-eth0 ifcfg-$PRINIC
perl -pi -e "s/eth0/$PRINIC/" ifcfg-$PRINIC
# echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
fi
fi
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
perl -pi -e 's/^FIREWALL="yes"/FIREWALL="no"/' /etc/sysconfig/network/config
/etc/init.d/network restart
RAND=$(perl -e 'print int(rand(50)). "\n"')
sleep $RAND
jsi=0
while [ $(hostname) == 'linux' ]
do
if [ $jsi -gt 10 ]; then
logger "Slept too long!"
exit
fi
let jsi=jsi+1
sleep 1
done
echo "Slept $jsi seconds before hostname made sense."
HOSTNAME=$(hostname -s)
echo $HOSTNAME
/sbin/portmap
export MASTER_IP=#XCATVAR:XCATMASTER#
export MASTER_IPS=#XCATVAR:XCATMASTER#
export MASTER="#XCATVAR:XCATMASTER#"
#
# This script has not yet been updated to work with service nodes
#
for i in $(seq 1 20)
do
GOTIT=0
for i in $MASTER_IPS
do
#mount -r $i:/install/postscripts /xcatpost
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 0 -T 60 ftp://$i/postscripts
if [ "$?" = "0" ]
then
if [ -x /usr/bin/openssl ]; then
XCATSERVER=$i:3001
export XCATSERVER
USEOPENSSLFORXCAT=1 #Though this is the only method going forward, flag to allow backward compatibility with 2.2 generated netboot images
export USEOPENSSLFORXCAT
else
exit 1
fi
mv $i/postscripts /xcatpost
rm -rf $i
chmod +x /xcatpost/*
/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
let SLI=$RANDOM%10+10
sleep $SLI
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /tmp/mypostscript
MYCONT=`grep MASTER /tmp/mypostscript`
done
chmod +x /tmp/mypostscript
GOTIT=1
break
fi
done
if [ "$GOTIT" = "1" ]
then
#save the master 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
PATH=/xcatpost:$PATH
export PATH
# Set the second disk to be bootable for RAID1 setup
parted -s /dev/sdb mkfs 1 fat16
parted /dev/sdb set 1 type 6
parted /dev/sdb set 1 boot on
dd if=/dev/sda1 of=/dev/sdb1
bootlist -m normal sda sdb
#save the postboot 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 the post init
cat >/etc/init.d/xcatpostinit1 << 'EOF'
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1#
EOF
chmod 755 /etc/init.d/xcatpostinit1
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc3.d/S84xcatpostinit1
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc4.d/S84xcatpostinit1
ln -s /etc/init.d/xcatpostinit1 /etc/init.d/rc5.d/S84xcatpostinit1
mkdir -p /opt/xcat
cat >/opt/xcat/xcatinstallpost << 'EOF'
#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost#
chkconfig xcatpostinit1 off
EOF
chmod 755 /opt/xcat/xcatinstallpost
chkconfig --add xcatpostinit1
#only run the prebooot scripts here
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /tmp/mypostscript`
echo "$TMP" > /tmp/mypostscript
/tmp/mypostscript
updateflag.awk $MASTER 3002
cd /
/xcatpost/#TABLE:nodelist:$NODE:node#
#rm -Rf /xcatpost
#rm -f /tmp/mypostscript
#rmdir /xcatpost
]]>
</source>
</script>
</post-scripts>

View File

@ -0,0 +1,166 @@
<?xml version="1.0"?>
<!DOCTYPE profile SYSTEM "/usr/share/YaST2/include/autoinstall/profile.dtd">
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<install>
<bootloader>
<write_bootloader config:type="boolean">true</write_bootloader>
<activate config:type="boolean">true</activate>
<kernel_parameters></kernel_parameters>
<lba_support config:type="boolean">false</lba_support>
<linear config:type="boolean">false</linear>
<location>mbr</location>
</bootloader>
<general>
<clock>
<hwclock>GMT</hwclock>
<timezone>#TABLE:site:key=timezone:value#</timezone>
</clock>
<keyboard>
<keymap>english-us</keymap>
</keyboard>
<language>en_US</language>
<mode>
<confirm config:type="boolean">false</confirm>
<forceboot config:type="boolean">false</forceboot>
<interactive_boot config:type="boolean">false</interactive_boot>
<reboot config:type="boolean">true</reboot>
</mode>
<mouse>
<id>non</id>
</mouse>
</general>
<partitioning config:type="list">
<drive>
<device>/dev/sda</device>
<partitions config:type="list">
<partition>
<format config:type="boolean">false</format>
<partition_id config:type="integer">65</partition_id>
<partition_nr config:type="integer">1</partition_nr>
<partition_type>primary</partition_type>
<size>24M</size>
</partition>
<partition>
<format config:type="boolean">false</format>
<partition_id config:type="integer">253</partition_id>
<partition_nr config:type="integer">2</partition_nr>
<raid_name>/dev/md0</raid_name>
<raid_type>raid</raid_type>
<size>2G</size>
</partition>
<partition>
<format config:type="boolean">false</format>
<partition_id config:type="integer">253</partition_id>
<partition_nr config:type="integer">3</partition_nr>
<raid_name>/dev/md1</raid_name>
<raid_type>raid</raid_type>
<size>max</size>
</partition>
</partitions>
<use>all</use>
</drive>
<drive>
<device>/dev/sdb</device>
<partitions config:type="list">
<partition>
<format config:type="boolean">false</format>
<partition_id config:type="integer">131</partition_id>
<partition_nr config:type="integer">1</partition_nr>
<partition_type>primary</partition_type>
<size>24M</size>
</partition>
<partition>
<format config:type="boolean">false</format>
<partition_id config:type="integer">253</partition_id>
<partition_nr config:type="integer">2</partition_nr>
<raid_name>/dev/md0</raid_name>
<raid_type>raid</raid_type>
<size>2G</size>
</partition>
<partition>
<format config:type="boolean">false</format>
<partition_id config:type="integer">253</partition_id>
<partition_nr config:type="integer">3</partition_nr>
<raid_name>/dev/md1</raid_name>
<raid_type>raid</raid_type>
<size>max</size>
</partition>
</partitions>
<use>all</use>
</drive>
<drive>
<device>/dev/md</device>
<partitions config:type="list">
<partition>
<filesystem config:type="symbol">reiser</filesystem>
<format config:type="boolean">true</format>
<mount>swap</mount>
<partition_id config:type="integer">131</partition_id>
<partition_nr config:type="integer">0</partition_nr>
<raid_options>
<chunk_size>4</chunk_size>
<parity_algorithm>left-asymmetric</parity_algorithm>
<raid_type>raid1</raid_type>
</raid_options>
</partition>
<partition>
<filesystem config:type="symbol">reiser</filesystem>
<format config:type="boolean">true</format>
<mount>/</mount>
<partition_id config:type="integer">131</partition_id>
<partition_nr config:type="integer">1</partition_nr>
<raid_options>
<chunk_size>4</chunk_size>
<parity_algorithm>left-asymmetric</parity_algorithm>
<raid_type>raid1</raid_type>
</raid_options>
</partition>
</partitions>
<use>all</use>
</drive>
</partitioning>
<software>
<patterns config:type="list">
#INCLUDE_DEFAULT_PTRNLIST_S#
</patterns>
<packages config:type="list">
#INCLUDE_DEFAULT_PKGLIST_S#
</packages>
</software>
</install>
<configure>
<users config:type="list">
<user>
<username>root</username>
<user_password>#CRYPT:passwd:key=system,username=root:password#</user_password>
<encrypted config:type="boolean">true</encrypted>
<forename/>
<surname/>
</user>
</users>
<networking>
<dns>
<dhcp_hostname config:type="boolean">true</dhcp_hostname>
<dhcp_resolv config:type="boolean">true</dhcp_resolv>
<domain>local</domain>
<hostname>linux</hostname>
</dns>
<interfaces config:type="list">
<interface>
<bootproto>dhcp</bootproto>
<device>eth0</device>
<startmode>onboot</startmode>
</interface>
</interfaces>
<routing>
<ip_forward config:type="boolean">false</ip_forward>
<routes config:type="list"/>
</routing>
</networking>
<scripts>
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.sles#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/chroot.sles#
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.sles11.raid1#
</scripts>
</configure>
</profile>