diff options
-rw-r--r-- | README | 18 | ||||
-rw-r--r-- | base/etc/hosts | 4 | ||||
-rw-r--r-- | base/etc/resolv.conf | 3 | ||||
-rw-r--r-- | base/etc/sysconfig/network | 5 | ||||
-rwxr-xr-x | base/etc/sysconfig/network-scripts/ifcfg-eth0 | 5 | ||||
-rwxr-xr-x | base/etc/sysconfig/network-scripts/ifcfg-eth1 | 5 | ||||
-rwxr-xr-x | base/etc/sysconfig/network-scripts/ifcfg-eth2 | 5 | ||||
-rw-r--r-- | base/root/.ssh/authorized_keys | 2 | ||||
-rw-r--r-- | base/root/.ssh/id_rsa.pub | 2 | ||||
-rwxr-xr-x | base/root/setup_tsm_client.sh | 8 | ||||
-rwxr-xr-x | base/root/setup_tsm_server.sh | 51 | ||||
-rw-r--r-- | config.sample | 110 | ||||
-rwxr-xr-x | create_base.sh | 72 | ||||
-rwxr-xr-x | create_cluster.sh | 2 | ||||
-rwxr-xr-x | create_node.sh | 74 | ||||
-rwxr-xr-x | create_tsm.sh | 56 | ||||
-rw-r--r-- | functions | 117 | ||||
-rw-r--r-- | templates/install.xml | 50 | ||||
-rw-r--r-- | templates/kickstart.cfg (renamed from ks.cfg) | 80 | ||||
-rw-r--r-- | templates/node.xml | 72 | ||||
-rw-r--r-- | templates/tsmserver.xml | 41 |
21 files changed, 449 insertions, 333 deletions
@@ -24,13 +24,14 @@ To setup a virtual cluster for SoFS with autocluster follow these steps: ./configure --without-xen --prefix=/usr - 2) install a squid proxy on your host. See + 2) You need a cacheing web proxy on your local network. If you don't + have one, then install a squid proxy on your host. See host_setup/etc/squid/squid.conf for a sample config suitable for a virtual cluster. Make sure it caches large objects and has plenty of space. This will be needed to make downloading all the RPMs to each client sane - To test your squid setup, run this command: + To test your squid setup, run a command like this: http_proxy=http://10.0.0.1:3128/ wget http://9.155.61.11/mediasets/SoFS-daily/ @@ -45,17 +46,24 @@ To setup a virtual cluster for SoFS with autocluster follow these steps: 5) create a 'config' file in the autocluster directory. I suggest you create it like this: - . config.sample - MEM=what ever mem you want - KVM=path to your kvm + . config.sample + MEM="what ever mem you want" + KVM="path to your kvm" That way when you upgrade autocluster with "git pull" you will inherit the new addtions to config.sample + Then look through config.sample and check for any config options + you want to override. Add them to your config file. + 6) use ./create_base.sh to create the base install image. The install will take about 10 to 15 minutes and you will see the packages installing in your terminal + Before you start create_base.sh make sure your web proxy cache is + authenticated with the Mainz BSO (eg. connect to + https://9.155.61.11 with a web browser) + 7) when that has finished, 'destroy' that machine (ie. power it off), with "virsh destroy SoFS-1.5-base" diff --git a/base/etc/hosts b/base/etc/hosts new file mode 100644 index 0000000..95614b9 --- /dev/null +++ b/base/etc/hosts @@ -0,0 +1,4 @@ +127.0.0.1 localhost @@CIFSNAME@@ + +@@GATEWAY@@ kvmhost +@@IPBASE@@.0.@@FIRSTIP@@ @@CLUSTER@@tsm diff --git a/base/etc/resolv.conf b/base/etc/resolv.conf new file mode 100644 index 0000000..81f217d --- /dev/null +++ b/base/etc/resolv.conf @@ -0,0 +1,3 @@ +domain @@DOMAIN@@ +search @@DNSSEARCH@@ +nameserver @@NAMESERVER@@ diff --git a/base/etc/sysconfig/network b/base/etc/sysconfig/network new file mode 100644 index 0000000..74b8bf8 --- /dev/null +++ b/base/etc/sysconfig/network @@ -0,0 +1,5 @@ +NETWORKING=yes +NETWORKING_IPV6=no +HOSTNAME=@@NAME@@.@@DOMAIN@@ +PEERDNS=no +GATEWAY=@@GATEWAY@@ diff --git a/base/etc/sysconfig/network-scripts/ifcfg-eth0 b/base/etc/sysconfig/network-scripts/ifcfg-eth0 new file mode 100755 index 0000000..5ac88f3 --- /dev/null +++ b/base/etc/sysconfig/network-scripts/ifcfg-eth0 @@ -0,0 +1,5 @@ +DEVICE=eth0 +ONBOOT=yes +TYPE=Ethernet +IPADDR=@IPBASE@@.0.@@IPNUM@@ +NETMASK=255.255.255.0 diff --git a/base/etc/sysconfig/network-scripts/ifcfg-eth1 b/base/etc/sysconfig/network-scripts/ifcfg-eth1 new file mode 100755 index 0000000..e311a39 --- /dev/null +++ b/base/etc/sysconfig/network-scripts/ifcfg-eth1 @@ -0,0 +1,5 @@ +DEVICE=eth1 +ONBOOT=yes +TYPE=Ethernet +IPADDR=@IPBASE@@.1.@@IPNUM@@ +NETMASK=255.255.255.0 diff --git a/base/etc/sysconfig/network-scripts/ifcfg-eth2 b/base/etc/sysconfig/network-scripts/ifcfg-eth2 new file mode 100755 index 0000000..309194b --- /dev/null +++ b/base/etc/sysconfig/network-scripts/ifcfg-eth2 @@ -0,0 +1,5 @@ +DEVICE=eth2 +ONBOOT=yes +TYPE=Ethernet +IPADDR=@IPBASE@@.2.@@IPNUM@@ +NETMASK=255.255.255.0 diff --git a/base/root/.ssh/authorized_keys b/base/root/.ssh/authorized_keys index a3e1b32..0897133 100644 --- a/base/root/.ssh/authorized_keys +++ b/base/root/.ssh/authorized_keys @@ -1,2 +1,2 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqb5/Xec12KIY7PiIEs9xEAL2VSgGyJ0aaYU/pd/Fe9GB9wTVH02We8fGHcbB19S0S8W4P6nyadSmVlkUflGVfs6UbFV2IZF1DYnwmTmlP98g9Em25tTcSmr1Mo2GcPJ38t7JQF28SC3hioxtXJlfqG8vi4RiFk6ujHKacPcHRgMJVruqaohqXN49Zlb6m2dfM8QkbsPzUDYksUDGXBWrDAQ7ZsTEYZVaWZ5n6qSvZ54hzZy/h71P0nTsuF4tC91LIs6L8Y1Qga3zfa+ZZZRYvBeEhmhqlUxPzVrd/MDA1CNLUApSRNZpgKMdUT8w+fw2wimwsEWyVByOM31hsqqVNQ== root@h01c001mz.VSOFS1.COM +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqb5/Xec12KIY7PiIEs9xEAL2VSgGyJ0aaYU/pd/Fe9GB9wTVH02We8fGHcbB19S0S8W4P6nyadSmVlkUflGVfs6UbFV2IZF1DYnwmTmlP98g9Em25tTcSmr1Mo2GcPJ38t7JQF28SC3hioxtXJlfqG8vi4RiFk6ujHKacPcHRgMJVruqaohqXN49Zlb6m2dfM8QkbsPzUDYksUDGXBWrDAQ7ZsTEYZVaWZ5n6qSvZ54hzZy/h71P0nTsuF4tC91LIs6L8Y1Qga3zfa+ZZZRYvBeEhmhqlUxPzVrd/MDA1CNLUApSRNZpgKMdUT8w+fw2wimwsEWyVByOM31hsqqVNQ== root@localhost ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEApxKsDbKMflPJp17OLG39v+VtTliqSMmy0C4ipgHLwlRwWTPQoPv0r2yTP03f4O7DABdeNwo+Hz0LxR2QNuMuZBOdri7PH27vshGBGn9OLJI4otw3Aq1m63htQxWXBEhBjZPRZ6PvSOm4RVhHviCL9rW+D3xfZYQtRTp5qDFci4ElNF7x+Z1bwZ1NVsyefcATr3vm+7KfoEqjUQ9QfuNJH0TuTTAcTjz2jQEB7gZsZ7PSpXmMK7vRSuZpf/iRLnCEPSj4nJqsMPEctedq/bKWEWggAsPvKCjr3wvpJdnPH+2zAv6IvaFzWTrLtVY/NBuGosIyXZW84LpplgPym6Z50f04yowKUBSb0vDSq5X3VwiwBdzvEiMSrz9z7fli9vcKUQWUBAAwVbhWDwOOMC2kf0KTSmVNmVMMmorjlUkGafYlUh4SYW+CRrBXi5xVGyw/7uzEWUA26UDDNanptFduAYV8DMlJXaoCDbJbmyLyQ8RJYho8KiNFLYaaZqbZq5O+NQWGcNTGAmqRjy5QD2lTUepCAiY0P24k1HHncj83b8kb8Vx3I6yfZ57y3wwKUbdlljJs+FVegScPAiMutovIeuu0G/InwjGzTAFJju5K2z1IK+CWJMokQRmuPwRcep+X3AUhnzGn6+S5FYefoLOi+8jqs3IJWO6Qk47MVSzt6Rs= diff --git a/base/root/.ssh/id_rsa.pub b/base/root/.ssh/id_rsa.pub index 927ca71..8fae277 100644 --- a/base/root/.ssh/id_rsa.pub +++ b/base/root/.ssh/id_rsa.pub @@ -1 +1 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqb5/Xec12KIY7PiIEs9xEAL2VSgGyJ0aaYU/pd/Fe9GB9wTVH02We8fGHcbB19S0S8W4P6nyadSmVlkUflGVfs6UbFV2IZF1DYnwmTmlP98g9Em25tTcSmr1Mo2GcPJ38t7JQF28SC3hioxtXJlfqG8vi4RiFk6ujHKacPcHRgMJVruqaohqXN49Zlb6m2dfM8QkbsPzUDYksUDGXBWrDAQ7ZsTEYZVaWZ5n6qSvZ54hzZy/h71P0nTsuF4tC91LIs6L8Y1Qga3zfa+ZZZRYvBeEhmhqlUxPzVrd/MDA1CNLUApSRNZpgKMdUT8w+fw2wimwsEWyVByOM31hsqqVNQ== root@h01c001mz.VSOFS1.COM +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqb5/Xec12KIY7PiIEs9xEAL2VSgGyJ0aaYU/pd/Fe9GB9wTVH02We8fGHcbB19S0S8W4P6nyadSmVlkUflGVfs6UbFV2IZF1DYnwmTmlP98g9Em25tTcSmr1Mo2GcPJ38t7JQF28SC3hioxtXJlfqG8vi4RiFk6ujHKacPcHRgMJVruqaohqXN49Zlb6m2dfM8QkbsPzUDYksUDGXBWrDAQ7ZsTEYZVaWZ5n6qSvZ54hzZy/h71P0nTsuF4tC91LIs6L8Y1Qga3zfa+ZZZRYvBeEhmhqlUxPzVrd/MDA1CNLUApSRNZpgKMdUT8w+fw2wimwsEWyVByOM31hsqqVNQ== root@localhost diff --git a/base/root/setup_tsm_client.sh b/base/root/setup_tsm_client.sh index 8db64ef..4b1c920 100755 --- a/base/root/setup_tsm_client.sh +++ b/base/root/setup_tsm_client.sh @@ -4,11 +4,11 @@ onnode all yum -y install TIVsm-BA TIVsm-HSM TIVsm-API echo "Setting up dsm.sys" cat <<EOF > /opt/tivoli/tsm/client/ba/bin/dsm.sys -SErvername sofstsm +SErvername @@CLUSTER@@tsm COMMMethod TCPip TCPPort 1500 - TCPServeraddress tsmserver - ASNODENAME SOFS01 + TCPServeraddress @@CLUSTER@@tsm + ASNODENAME @@TSMNAME@@ PASSWORDACCESS generate EXCLUDE.DIR /.../.snapshots ERRORLOGName /var/log/dsmerror.log @@ -17,7 +17,7 @@ onnode all rsync $HOSTNAME:/opt/tivoli/tsm/client/ba/bin/dsm.sys /opt/tivoli/tsm echo "Setting up dsm.opt" cat <<EOF > /opt/tivoli/tsm/client/ba/bin/dsm.opt -servername sofstsm +servername @@CLUSTER@@tsm EOF onnode all rsync $HOSTNAME:/opt/tivoli/tsm/client/ba/bin/dsm.opt /opt/tivoli/tsm/client/ba/bin diff --git a/base/root/setup_tsm_server.sh b/base/root/setup_tsm_server.sh index 7f7aa08..3e76a5c 100755 --- a/base/root/setup_tsm_server.sh +++ b/base/root/setup_tsm_server.sh @@ -1,13 +1,6 @@ #!/bin/bash -if [ $# -lt 1 ]; then - echo "Usage: setup_tsm_server.sh CLUSTERNAME" - exit 1 -fi - -CLUSTER="$1" - - +CLUSTER=@@CLUSTER@@ yum -y install TIVsm-BA TIVsm-HSM TIVsm-API TIVsm-server || exit 1 @@ -24,11 +17,11 @@ ln -sf /etc/init.d/dsmserv /etc/rc3.d/S99dsmserv echo "Setting up dsm.sys" cat <<EOF > /opt/tivoli/tsm/client/ba/bin/dsm.sys -SErvername sofstsm +SErvername @@CLUSTER@@tsm COMMMethod TCPip TCPPort 1500 - TCPServeraddress tsmserver - ASNODENAME SOFS01 + TCPServeraddress @@CLUSTER@@tsm + ASNODENAME @@TSMNAME@@ PASSWORDACCESS generate EXCLUDE.DIR /.../.snapshots ERRORLOGName /var/log/dsmerror.log @@ -36,7 +29,7 @@ EOF echo "Setting up dsm.opt" cat <<EOF > /opt/tivoli/tsm/client/ba/bin/dsm.opt -servername sofstsm +servername @@CLUSTER@@tsm EOF @@ -46,29 +39,29 @@ upd mg ALLTODISK STANDARD STANDARD migrequiresbkup=no upd mg ALLTODISK STANDARD STANDARD SPACEMGTECHnique=selective activate pol ALLTODISK STANDARD y -register node sofs01 admin -register node ${CLUSTER}n1.VSOFS1.COM admin -register node ${CLUSTER}n2.VSOFS1.COM admin -register node ${CLUSTER}n3.VSOFS1.COM admin -register node ${CLUSTER}n4.VSOFS1.COM admin -upd node sofs01 domain=ALLTODISK -upd node ${CLUSTER}n1.VSOFS1.COM domain=ALLTODISK -upd node ${CLUSTER}n2.VSOFS1.COM domain=ALLTODISK -upd node ${CLUSTER}n3.VSOFS1.COM domain=ALLTODISK -upd node ${CLUSTER}n4.VSOFS1.COM domain=ALLTODISK +register node @@TSMNAME@@ admin +register node ${CLUSTER}n1.@@DOMAIN@@ admin +register node ${CLUSTER}n2.@@DOMAIN@@ admin +register node ${CLUSTER}n3.@@DOMAIN@@ admin +register node ${CLUSTER}n4.@@DOMAIN@@ admin +upd node @@TSMNAME@@ domain=ALLTODISK +upd node ${CLUSTER}n1.@@DOMAIN@@ domain=ALLTODISK +upd node ${CLUSTER}n2.@@DOMAIN@@ domain=ALLTODISK +upd node ${CLUSTER}n3.@@DOMAIN@@ domain=ALLTODISK +upd node ${CLUSTER}n4.@@DOMAIN@@ domain=ALLTODISK rem node client y -grant proxynode target=sofs01 agent=${CLUSTER}n1.VSOFS1.COM,${CLUSTER}n2.VSOFS1.COM,${CLUSTER}n3.VSOFS1.COM,${CLUSTER}n4.VSOFS1.COM -upd node sofs01 backdel=yes -def dbvol /tsmdiskpool/db1.dsm format=100 wait=yes +grant proxynode target=@@TSMNAME@@ agent=${CLUSTER}n1.@@DOMAIN@@,${CLUSTER}n2.@@DOMAIN@@,${CLUSTER}n3.@@DOMAIN@@,${CLUSTER}n4.@@DOMAIN@@ +upd node @@TSMNAME@@ backdel=yes +def dbvol /tsmdiskpool/db1.dsm format=@@TSM_DB_SIZE@@ wait=yes del dbv /opt/tivoli/tsm/server/bin/db.dsm -extend db 84 +extend db `expr 84 @@TSM_DB_SIZE@@ - 16` set logmode rollf -def vol spacemgpool /tsmdiskpool/vol01.dsm format=1024 wait=yes -def vol backuppool /tsmdiskpool/backup1.dsm format=100 wait=yes +def vol spacemgpool /tsmdiskpool/vol01.dsm format=@@TSM_SPACE_MGMT_SIZE@@ wait=yes +def vol backuppool /tsmdiskpool/backup1.dsm format=@@TSM_BACKUP_POOL_SIZE@@ wait=yes del vol /opt/tivoli/tsm/server/bin/backup.dsm y -def vol archivepool /tsmdiskpool/archive1.dsm format=100 wait=yes +def vol archivepool /tsmdiskpool/archive1.dsm format=@@TSM_ACRHIVE_POOL_SIZE@@ wait=yes del vol /opt/tivoli/tsm/server/bin/archive.dsm y EOF diff --git a/config.sample b/config.sample index abb1576..f7793e1 100644 --- a/config.sample +++ b/config.sample @@ -1,6 +1,11 @@ # this is a sample autocluster config file -# you should copy this to the file 'config' -# and edit to suit your needs +# you should create your own config file like this: +# +# . config.sample +# NAME=myname +# VIRTBASE=/virtual +# +# Look through config.sample and see what variables you want to override # where virtual machines are stored on this host VIRTBASE=/virtual @@ -10,6 +15,64 @@ VIRTBASE=/virtual # that will form the basis file for the images for each of the nodes BASENAME="SoFS-1.5-base" +# what timezone to put the nodes in +TIMEZONE="Australia/Canberra" + +# what keyboard type to setup +KEYBOARD="us" + +# the base ISO to install from +ISO="/virtual/ISO/RHEL5.2-Server-20080430.0-x86_64-DVD.iso" + +# the yum repositories to use +YUM_REPOS=' +[SoFS-1.5] +name=SoFS-1.5 +baseurl=http://9.155.61.11/mediasets/SoFS-1.5 +enabled=1 +gpgcheck=0 + +[SoFS-Stable] +name=SOFS-Stable +baseurl=http://9.155.61.11/mediasets/SOFS-Stable +enabled=1 +gpgcheck=0 + +[SOFS] +name=Scale Out File Services Repo with GPFS, CTDB and Samba Packages +baseurl=http://9.155.61.11/mediasets/SOFS +enabled=1 +gpgcheck=0 + +[RHEL5.2] +name=Red Hat Enterprise Linux 5.2 +baseurl=http://9.155.61.11/mediasets/RHEL5.2/x86_64/ +enabled=1 +gpgcheck=0 + +[SoFS-additional] +name=SOFS-additional +baseurl=http://9.155.61.11/mediasets/SOFS-additional +enabled=1 +gpgcheck=0 + +[SoFS-daily] +name=SoFS-daily +baseurl=http://9.155.61.11/mediasets/SoFS-daily +enabled=1 +gpgcheck=0 +' + +# any extra packages to install. List one on each line. To force a package +# not to be installed, list it with a leading - +EXTRA_PACKAGES=' +emacs +' + + +# RHEL install key +INSTALLKEY="2515-dd4e-2152-25dd" + # the kvm binary to use - should be a very recent version # I am using a git snapshot from http://kvm.qumranet.com/kvmwiki/Code KVM="/usr/local/bin/qemu-system-x86_64" @@ -27,9 +90,6 @@ GUIMEM=700000 # on the host NFSSHARE="10.0.0.1:/home/SOFS" -# the base ISO to install from -ISO="/virtual/ISO/RHEL5.2-Server-20080430.0-x86_64-DVD.iso" - # windows domain name the nodes will be part of DOMAIN="VSOFS1.COM" @@ -56,8 +116,10 @@ IPBASE="10.0" # etc etc FIRSTIP="20" -# a web proxy that can get to the fscc-install.mainz.de.ibm.com server -# from the nodes. Usually this runs on the kvm host +# a caching web proxy that can get to the fscc-install.mainz.de.ibm.com server +# from the nodes. If you don't have one on the local network then look in +# host_setup/etc/squid for an example setup you can install on the kvm host +# the web proxy must cache large objects, and have room for several G of cache WEBPROXY="http://10.0.0.1:3128/" # IP gateway (the IP of the kvm host for the clients) @@ -72,10 +134,44 @@ NUMNODES=4 # so start this larger than you think you'll need DISKSIZE="20G" +# size of root partition in megabytes +ROOTSIZE=15000 + +# size of swap partition in megabytes +SWAPSIZE=2000 + # the size of the 3 GPFS shared disks SHAREDDISKSIZE="10G" # the size of the TSM storage disk TSMDISKSIZE="50G" +# what network adapter to use +NICMODEL="e1000" + +# where we will log serial consoles to +KVMLOG="/var/log/kvm" + +# initial root password +ROOTPASSWORD="test01" + +# install language - make it the same as the installers by default +LANGUAGE="$LANG" + +# name of the system in CIFS protocol +CIFSNAME="Samba01" + +# the name that the nodes will use to talk to the TSM server +TSMNAME="SOFS01" + +# how big should the TSM database be +TSM_DB_SIZE=100 + +# how big should the TSM space management pool be +TSM_SPACE_MGMT_SIZE=1024 + +# how big should the TSM backup pool be +TSM_BACKUP_POOL_SIZE=100 +# how big should the TSM archive pool be +TSM_ACRHIVE_POOL_SIZE=100 diff --git a/create_base.sh b/create_base.sh index 7193402..f0a1f42 100755 --- a/create_base.sh +++ b/create_base.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + . config . functions @@ -12,15 +14,21 @@ qemu-img create -f raw "$DISK" $DISKSIZE rm -rf tmp mkdir -p mnt tmp tmp/ISO +echo "Creating kickstart file from template" +substitute_vars "templates/kickstart.cfg" "tmp/ks.cfg" || { + echo "ERROR: substitution failed" + exit 1 +} + echo "Creating kickstart floppy" -dd if=/dev/zero of=tmp/floppy.img bs=1024 count=1440 || exit 1 -mkdosfs tmp/floppy.img || exit 1 -mount -o loop -t msdos tmp/floppy.img mnt || exit 1 -cp ks.cfg mnt || exit 1 -mount -o loop,ro $ISO tmp/ISO || exit 1 +dd if=/dev/zero of=tmp/floppy.img bs=1024 count=1440 +mkdosfs tmp/floppy.img +mount -o loop -t msdos tmp/floppy.img mnt +cp tmp/ks.cfg mnt +mount -o loop,ro $ISO tmp/ISO echo "Setting up bootloader" -cp tmp/ISO/isolinux/isolinux.bin tmp || exit 1 +cp tmp/ISO/isolinux/isolinux.bin tmp cp tmp/ISO/isolinux/vmlinuz tmp || exit 1 cp tmp/ISO/isolinux/initrd.img tmp || exit 1 umount tmp/ISO || exit 1 @@ -28,57 +36,7 @@ umount mnt || exit 1 UUID=`uuidgen` -cat<<EOF > tmp/$NAME.xml -<domain type='kvm'> - <name>$NAME</name> - <uuid>$UUID</uuid> - <memory>$MEM</memory> - <currentMemory>$MEM</currentMemory> - <vcpu>1</vcpu> - <os> - <type>hvm</type> - <loader>$PWD/tmp/isolinux.bin</loader> - <kernel>$PWD/tmp/vmlinuz</kernel> - <initrd>$PWD/tmp/initrd.img</initrd> - <cmdline>console=ttyS0,115200 ks=floppy</cmdline> - </os> - <features> - <acpi/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>$KVM</emulator> - <disk type='file' device='disk'> - <source file='$DISK'/> - <target dev='sda' bus='scsi'/> - </disk> - <disk type='file' device='cdrom'> - <source file='$ISO'/> - <target dev='hdc' bus='ide'/> - <readonly/> - </disk> - <disk type='file' device='floppy'> - <source file='$PWD/tmp/floppy.img'/> - <target dev='fda'/> - <readonly/> - </disk> - <interface type='network'> - <mac address='00:00:00:00:00:01'/> - <model type='e1000'/> - <source network='net1'/> - </interface> - <input type='mouse' bus='ps2'/> - <graphics type='vnc' port='-1' listen='127.0.0.1'/> - <serial type="file"> - <source path="$PWD/install.ttyS0"/> - <target port="1"/> - </serial> - </devices> -</domain> -EOF +substitute_vars templates/install.xml tmp/$NAME.xml # boot the install CD virsh create tmp/$NAME.xml || exit 1 diff --git a/create_cluster.sh b/create_cluster.sh index 62f835c..2bffd2e 100755 --- a/create_cluster.sh +++ b/create_cluster.sh @@ -11,7 +11,7 @@ fi CLUSTER="$1" mkdir -p $VIRTBASE/$CLUSTER -mkdir -p /var/log/kvm +mkdir -p $KVMLOG echo "Creating 3 shared disks" for i in `seq 1 3`; do diff --git a/create_node.sh b/create_node.sh index e99c444..f7bf73c 100755 --- a/create_node.sh +++ b/create_node.sh @@ -5,6 +5,8 @@ if [ $# -lt 2 ]; then exit 1 fi +set -e + . config . functions @@ -26,82 +28,26 @@ mkdir -p $VIRTBASE/$CLUSTER echo "Creating the disk" rm -f "$DISK" -qemu-img create -b "$BASE" -f qcow2 "$DISK" || exit 1 +qemu-img create -b "$BASE" -f qcow2 "$DISK" IPNUM=`expr $FIRSTIP + $NODENUMBER` mount_disk $DISK setup_base setup_network -setup_serial unmount_disk mkdir -p tmp +MAC1=`get_macaddr $CLUSTER $NODENUMBER 1` +MAC2=`get_macaddr $CLUSTER $NODENUMBER 1` +MAC3=`get_macaddr $CLUSTER $NODENUMBER 1` +UUID=`uuidgen` + echo "Creating $NAME.xml" -cat<<EOF > tmp/$NAME.xml -<domain type='kvm'> - <name>$NAME</name> - <uuid>$UUID</uuid> - <memory>$MEM</memory> - <currentMemory>$MEM</currentMemory> - <vcpu>1</vcpu> - <os> - <type>hvm</type> - <boot dev='hd'/> - </os> - <features> - <acpi/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>$KVM</emulator> - <disk type='file' device='disk'> - <source file='$DISK'/> - <target dev='sda' bus='scsi'/> - </disk> - <disk type='file' device='disk'> - <source file='$VIRTBASE/$CLUSTER/shared1'/> - <target dev='sdb' bus='scsi'/> - </disk> - <disk type='file' device='disk'> - <source file='$VIRTBASE/$CLUSTER/shared2'/> - <target dev='sdc' bus='scsi'/> - </disk> - <disk type='file' device='disk'> - <source file='$VIRTBASE/$CLUSTER/shared3'/> - <target dev='sdd' bus='scsi'/> - </disk> - <interface type='network'> - <mac address='`get_macaddr $CLUSTER $NODENUMBER 1`'/> - <model type='e1000'/> - <source network='net1'/> - </interface> - <interface type='network'> - <mac address='`get_macaddr $CLUSTER $NODENUMBER 2`'/> - <model type='e1000'/> - <source network='net2'/> - </interface> - <interface type='network'> - <mac address='`get_macaddr $CLUSTER $NODENUMBER 3`'/> - <model type='e1000'/> - <source network='net3'/> - </interface> - <input type='mouse' bus='ps2'/> - <graphics type='vnc' port='-1' listen='127.0.0.1'/> - <serial type="file"> - <source path="/var/log/kvm/serial.$NAME"/> - <target port="1"/> - </serial> - </devices> -</domain> -EOF +substitute_vars templates/node.xml tmp/$NAME.xml # install the XML file -virsh undefine tmp/$NAME.xml 2>/dev/null - +virsh undefine $NAME 2>&1 > /dev/null || true virsh define tmp/$NAME.xml || exit 1 exit 0 diff --git a/create_tsm.sh b/create_tsm.sh index 3445070..6f36031 100755 --- a/create_tsm.sh +++ b/create_tsm.sh @@ -5,6 +5,8 @@ if [ $# -lt 1 ]; then exit 1 fi +set -e + . config . functions @@ -20,7 +22,7 @@ mkdir -p $VIRTBASE/$CLUSTER echo "Creating the disk" rm -f "$DISK" -qemu-img create -b "$BASE" -f qcow2 "$DISK" || exit 1 +qemu-img create -b "$BASE" -f qcow2 "$DISK" echo "Creating tsm disk" qemu-img create -f qcow2 "$TSMDISK" $TSMDISKSIZE @@ -31,58 +33,14 @@ IPNUM=$FIRSTIP mount_disk $DISK setup_base setup_network -setup_serial unmount_disk UUID=`uuidgen` - +MAC1=`get_macaddr $CLUSTER 99` echo "Creating $NAME.xml" -cat<<EOF > tmp/$NAME.xml -<domain type='kvm'> - <name>$NAME</name> - <uuid>$UUID</uuid> - <memory>$MEM</memory> - <currentMemory>$MEM</currentMemory> - <vcpu>1</vcpu> - <os> - <type>hvm</type> - <boot dev='hd'/> - </os> - <features> - <acpi/> - </features> - <clock offset='utc'/> - <on_poweroff>destroy</on_poweroff> - <on_reboot>restart</on_reboot> - <on_crash>destroy</on_crash> - <devices> - <emulator>$KVM</emulator> - <disk type='file' device='disk'> - <source file='$DISK'/> - <target dev='sda' bus='scsi'/> - </disk> - <disk type='file' device='disk'> - <source file='$TSMDISK'/> - <target dev='sdb' bus='scsi'/> - </disk> - <interface type='network'> - <mac address='`get_macaddr $CLUSTER f 0`'/> - <model type='e1000'/> - <source network='net1'/> - </interface> - <input type='mouse' bus='ps2'/> - <graphics type='vnc' port='-1' listen='127.0.0.1'/> - <serial type="file"> - <source path="/var/log/kvm/serial.$NAME"/> - <target port="1"/> - </serial> - </devices> -</domain> -EOF +substitute_vars templates/tsmserver.xml tmp/$NAME.xml # install the XML file -virsh undefine tmp/$NAME.xml 2>/dev/null - -virsh define tmp/$NAME.xml || exit 1 -exit 0 +virsh undefine $NAME 2>&1 > /dev/null || true +virsh define tmp/$NAME.xml @@ -20,74 +20,44 @@ mount_disk() { modprobe nbd qemu-nbd -p 1300 $1 & [ -r /dev/nb0 ] || { - mknod /dev/nb0 b 43 0 || exit 1 + mknod /dev/nb0 b 43 0 } - nbd-client -d /dev/nb0 2> /dev/null - nbd-client localhost 1300 /dev/nb0 || exit 1 - umount mnt 2> /dev/null - mount -o offset=32256 /dev/nb0 mnt || exit 1 + nbd-client -d /dev/nb0 > /dev/null 2>&1 || true + for i in `seq 1 3`; do + nbd-client localhost 1300 /dev/nb0 > /dev/null 2>&1 && break + sleep 1 + done + [ $i = 3 ] && { + echo "Failed to start nbd-client" + exit 1 + } + + umount mnt 2> /dev/null || true + mount -o offset=32256 /dev/nb0 mnt } unmount_disk() { echo "Unmounting disk" - sync - umount mnt - nbd-client -d /dev/nb0 - killall -q qemu-nbd + umount mnt + nbd-client -d /dev/nb0 > /dev/null 2>&1 || true + killall -q qemu-nbd || true } setup_base() { echo "Copy base files" - chown -R 0.0 base - rsync -Ca base/ mnt/ - chmod 600 mnt/etc/ssh/*key - chmod 600 mnt/root/.ssh/id_rsa -} - - -setup_serial() { - echo "Setting up serial console" - sed 's/console=tty1/console=tty1 console=ttyS0,115200/g' < mnt/boot/grub/grub.conf > mnt/boot/grub/grub.conf.tmp - mv mnt/boot/grub/grub.conf.tmp mnt/boot/grub/grub.conf || exit 1 - mkdir -p /var/log/kvm + # copy the directory structure first + rsync -a --include='*/' --exclude='*' base/ mnt + # now all the files, applying substitutions + for f in `cd base && find . -type f \! -name '*~'`; do + perms=`stat -c %a base/$f` + substitute_vars base/$f mnt/$f + chmod $perms mnt/$f + done } setup_network() { echo "Setting up networks" - cat <<EOF > mnt/etc/sysconfig/network -NETWORKING=yes -NETWORKING_IPV6=no -HOSTNAME=$NAME.$DOMAIN -PEERDNS=no -GATEWAY=$GATEWAY -EOF - - for i in `seq 0 2`; do - cat <<EOF > mnt/etc/sysconfig/network-scripts/ifcfg-eth$i -DEVICE=eth$i -ONBOOT=yes -TYPE=Ethernet -IPADDR=$IPBASE.$i.$IPNUM -NETMASK=255.255.255.0 -EOF - done - - echo "Creating /etc/resolv.conf" - cat <<EOF > mnt/etc/resolv.conf -domain $DOMAIN -search $DNSSEARCH -nameserver $NAMESERVER -EOF - - echo "Creating /etc/hosts" - cat <<EOF > mnt/etc/hosts -127.0.0.1 localhost Samba01 - -$GATEWAY kvmhost -$IPBASE.0.$FIRSTIP tsmserver - -EOF for i in `seq 1 $NUMNODES`; do cat <<EOF >> mnt/etc/hosts @@ -103,10 +73,9 @@ $IPBASE.0.`expr $FIRSTIP + $i` EOF done - echo "Enabling web proxy" - cat <<EOF >> mnt/etc/bashrc -export http_proxy=$WEBPROXY -EOF +[ "$WEBPROXY" = "" ] || { + echo "export http_proxy=$WEBPROXY" >> mnt/etc/bashrc +} echo "Enabling nfs mount of $NFSSHARE" mkdir -p mnt/root/SOFS @@ -115,3 +84,35 @@ $NFSSHARE /root/SOFS nfs intr EOF } +# substite a set of variables of the form @@XX@@ for the shell +# variables $XX in a file +substitute_vars() {( + infile="$1" + outfile="$2" + delimeter="@" + delim2="$delimeter$delimeter" + + VARS=`tr -cs "A-Z_$delimeter" '\012' < "$infile" | + sort -u | + egrep "^$delim2.*$delim2$" | + cut -d$delimeter -f3` + rm -f sed.$$ + touch sed.$$ + for v in $VARS; do + eval "s=\$$v" + s=${s// +/\\n} + s=${s// /\\s} + s=${s//#/\\#} + s=${s//&/\\&} + [ "$s" = "" ] && { + echo "ERROR: No substitution given for ${delim2}$v${delim2} in $infile" + exit 1 + } + echo "s#@@$v@@#$s#g" >> sed.$$ + done + + sed -f sed.$$ < "$infile" > "$outfile" || exit 1 + rm -f sed.$$ +)} + diff --git a/templates/install.xml b/templates/install.xml new file mode 100644 index 0000000..de582e0 --- /dev/null +++ b/templates/install.xml @@ -0,0 +1,50 @@ +<!-- template for initial install of base image --> +<domain type='kvm'> + <name>@@NAME@@</name> + <uuid>@@UUID@@</uuid> + <memory>@@MEM@@</memory> + <currentMemory>@@MEM@@</currentMemory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + <loader>@@PWD@@/tmp/isolinux.bin</loader> + <kernel>@@PWD@@/tmp/vmlinuz</kernel> + <initrd>@@PWD@@/tmp/initrd.img</initrd> + <cmdline>console=ttyS0,115200 ks=floppy</cmdline> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>@@KVM@@</emulator> + <disk type='file' device='disk'> + <source file='@@DISK@@'/> + <target dev='sda' bus='scsi'/> + </disk> + <disk type='file' device='cdrom'> + <source file='@@ISO@@'/> + <target dev='hdc' bus='ide'/> + <readonly/> + </disk> + <disk type='file' device='floppy'> + <source file='@@PWD@@/tmp/floppy.img'/> + <target dev='fda'/> + <readonly/> + </disk> + <interface type='network'> + <mac address='00:00:00:00:00:01'/> + <model type='@@NICMODEL@@'/> + <source network='net1'/> + </interface> + <input type='mouse' bus='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1'/> + <serial type="file"> + <source path="@@PWD@@/install.ttyS0"/> + <target port="1"/> + </serial> + </devices> +</domain> diff --git a/ks.cfg b/templates/kickstart.cfg index df1b68f..e3ff8b4 100644 --- a/ks.cfg +++ b/templates/kickstart.cfg @@ -2,21 +2,20 @@ install cdrom #This is the Installation Key, this may have to bechanged -key 2515-dd4e-2152-25dd -lang en_US.UTF-8 -keyboard us +key @@INSTALLKEY@@ +lang @@LANGUAGE@@ +keyboard @@KEYBOARD@@ skipx text - network --device eth0 --bootproto dhcp -rootpw test01 +rootpw @@ROOTPASSWORD@@ firewall --disabled selinux --disabled authconfig --enableshadow --enablemd5 -timezone --utc Australia/Canberra +timezone --utc @@TIMEZONE@@ halt -bootloader --location=mbr --driveorder=sda --append="rhgb quiet console=tty1 console=ttyS1,115200 console=tty1" +bootloader --location=mbr --driveorder=sda --append="rhgb console=ttyS1,115200 console=tty1" # The following is the partition information you requested @@ -25,8 +24,8 @@ bootloader --location=mbr --driveorder=sda --append="rhgb quiet console=tty1 con # not guaranteed to work #CAUTION: Local Drive may differ from sda! clearpart --drives=sda --initlabel -part / --ondisk=sda --fstype ext3 --size=15000 -part swap --ondisk=sda --size=2000 +part / --ondisk=sda --fstype ext3 --size=@@ROOTSIZE@@ +part swap --ondisk=sda --size=@@SWAPSIZE@@ #The following Part lists all the packages that are needed for the Installation %packages --resolvedeps @@ -104,9 +103,9 @@ lsscsi rsyslog # this isn't on the RHEL-5.2 CD. We need to download it separately #scsi-target-utils -emacs nss-devel nspr-devel +@@EXTRA_PACKAGES@@ #The Following Packages shall not be installed!!! -xen @@ -266,7 +265,7 @@ prio_callout "/sbin/mpath_prio_rdac /dev/%n" echo "Done - Creating multipath.conf" >>/tmp/ks.log echo "." -mkdir /opt/IBM/sofs/scripts +mkdir -p /opt/IBM/sofs/scripts echo 'if ! echo ${PATH} | grep -q /usr/lpp/mmfs/bin ; then if [ `id -u` = 0 ] ; then PATH=/usr/lpp/mmfs/bin:${PATH} @@ -281,50 +280,24 @@ echo "exclude=samba*el5*" >>/etc/yum.conf echo "setting up SoFS repos" cat << EOF > /etc/yum.repos.d/SOFS.repo -[SoFS-1.5] -name=SoFS-1.5 -baseurl=http://9.155.61.11/mediasets/SoFS-1.5 -enabled=1 -gpgcheck=0 - -[SoFS-Stable] -name=SOFS-Stable -baseurl=http://9.155.61.11/mediasets/SOFS-Stable -enabled=1 -gpgcheck=0 - -[SOFS] -name=Scale Out File Services Repo with GPFS, CTDB and Samba Packages -baseurl=http://9.155.61.11/mediasets/SOFS -enabled=1 -gpgcheck=0 - -[RHEL5.2] -name=Red Hat Enterprise Linux 5.2 -baseurl=http://9.155.61.11/mediasets/RHEL5.2/x86_64/ -enabled=1 -gpgcheck=0 - -[SoFS-additional] -name=SOFS-additional -baseurl=http://9.155.61.11/mediasets/SOFS-additional -enabled=1 -gpgcheck=0 - -[SoFS-daily] -name=SoFS-daily -baseurl=http://9.155.61.11/mediasets/SoFS-daily -enabled=1 -gpgcheck=0 +@@YUM_REPOS@@ EOF # install the SoFS packages via a proxy on the host -http_proxy=http://10.0.0.1:3128/ -export http_proxy +[ "@@WEBPROXY@@" = "" ] || { + http_proxy=@@WEBPROXY@@ + export http_proxy +} # force up the network, as kickstart may not have started it -/sbin/ifconfig eth0 10.0.0.199 up +/sbin/ifconfig eth0 @@IPBASE@@.0.@@FIRSTIP@@ up + +cat << EOF > /etc/resolv.conv +domain @@DOMAIN@@ +search @@DNSSEARCH@@ +nameserver @@NAMESERVER@@ +EOF echo "Updating from SoFS repositories" yum -y update @@ -355,12 +328,6 @@ yum -y install SMutil echo "Rebuilding the GPFS modules" (cd /usr/lpp/mmfs/src && make Autoconfig World InstallImages) -echo "Disabling IPv6" -cat <<EOF >> /etc/modprobe.conf -alias net-pf-10 off -alias ipv6 off -EOF - # the TSM packages cause trouble with auto-install # yum -y install TIVsm-API TIVsm-HSM TIVsm-BA @@ -369,9 +336,8 @@ cat << EOF ========================================================= Install done! You should now control-C from this tail, then run - virsh destroy SoFS-1.5-base + virsh destroy @@BASENAME@@ to destroy this virual machine -========================================================= EOF ) 2>&1 | tee /root/postinstall.log > /dev/console diff --git a/templates/node.xml b/templates/node.xml new file mode 100644 index 0000000..bec1b0d --- /dev/null +++ b/templates/node.xml @@ -0,0 +1,72 @@ +<!-- template for initial install of cluster nodes --> +<domain type='kvm'> + <name>@@NAME@@</name> + <uuid>@@UUID@@</uuid> + <memory>@@MEM@@</memory> + <currentMemory>@@MEM@@</currentMemory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>@@KVM@@</emulator> + <disk type='file' device='disk'> + <source file='@@DISK@@'/> + <target dev='sda' bus='scsi'/> + </disk> + <disk type='file' device='disk'> + <source file='@@VIRTBASE@@/@@CLUSTER@@/shared1'/> + <target dev='sdb' bus='scsi'/> + </disk> + <disk type='file' device='disk'> + <source file='@@VIRTBASE@@/@@CLUSTER@@/shared2'/> + <target dev='sdc' bus='scsi'/> + </disk> + <disk type='file' device='disk'> + <source file='@@VIRTBASE@@/@@CLUSTER@@/shared3'/> + <target dev='sdd' bus='scsi'/> + </disk> + <!-- We list all the shared disks twice, so we can play with multipath --> + <disk type='file' device='disk'> + <source file='@@VIRTBASE@@/@@CLUSTER@@/shared1'/> + <target dev='sde' bus='scsi'/> + </disk> + <disk type='file' device='disk'> + <source file='@@VIRTBASE@@/@@CLUSTER@@/shared2'/> + <target dev='sdf' bus='scsi'/> + </disk> + <disk type='file' device='disk'> + <source file='@@VIRTBASE@@/@@CLUSTER@@/shared3'/> + <target dev='sdg' bus='scsi'/> + </disk> + <interface type='network'> + <mac address='@@MAC1@@'/> + <model type='@@NICMODEL@@'/> + <source network='net1'/> + </interface> + <interface type='network'> + <mac address='@@MAC2@@'/> + <model type='@@NICMODEL@@'/> + <source network='net2'/> + </interface> + <interface type='network'> + <mac address='@@MAC3'/> + <model type='@@NICMODEL@@'/> + <source network='net3'/> + </interface> + <input type='mouse' bus='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1'/> + <serial type="file"> + <source path="@@KVMLOG@@/serial.@@NAME@@"/> + <target port="1"/> + </serial> + </devices> +</domain> diff --git a/templates/tsmserver.xml b/templates/tsmserver.xml new file mode 100644 index 0000000..24fe14d --- /dev/null +++ b/templates/tsmserver.xml @@ -0,0 +1,41 @@ +<!-- template for initial install of TSM server node --> +<domain type='kvm'> + <name>@@NAME@@</name> + <uuid>@@UUID@@</uuid> + <memory>@@MEM@@</memory> + <currentMemory>@@MEM@@</currentMemory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>@@KVM@@</emulator> + <disk type='file' device='disk'> + <source file='@@DISK@@'/> + <target dev='sda' bus='scsi'/> + </disk> + <disk type='file' device='disk'> + <source file='@@TSMDISK@@'/> + <target dev='sdb' bus='scsi'/> + </disk> + <interface type='network'> + <mac address='@@MAC1@@'/> + <model type='@@NICMODEL@@'/> + <source network='net1'/> + </interface> + <input type='mouse' bus='ps2'/> + <graphics type='vnc' port='-1' listen='127.0.0.1'/> + <serial type="file"> + <source path="@@KVMLOG@@/serial.@@NAME@@"/> + <target port="1"/> + </serial> + </devices> +</domain> |