From c2634b651b104f689ac569781db3a44b1418bd82 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Tue, 8 Jan 2013 11:22:31 +0000 Subject: [PATCH] Update gpfs_mmsdrfs to use mmsdrrestore to restore gpfs config file git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14801 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/IBMhpc/gpfs/gpfs_mmsdrfs | 142 ++---------------- 1 file changed, 14 insertions(+), 128 deletions(-) diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/gpfs/gpfs_mmsdrfs b/xCAT-IBMhpc/share/xcat/IBMhpc/gpfs/gpfs_mmsdrfs index 38ad996ec..a471ae58e 100755 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/gpfs/gpfs_mmsdrfs +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/gpfs/gpfs_mmsdrfs @@ -1,132 +1,18 @@ -#!/bin/bash +#!/bin/sh +# xCAT postscript to configure GPFS on a compute node. +# Before booting nodes with this postscript, gpfs must be up and configured correctly on the node +# pointed to by the -p flag below. The $MASTER environment variable will be set by xCAT to +# the service node or management node of this booting node. If you want the nodes to get their +# GPFS configuration from a different node, replace $MASTER with that IP address. -# Run this script to sync the GPFS mmsdrfs file into the node images -# Set the SOURCE, TARGETDIR, IMAGE, and SERVICE variables appropriately +cmd="/usr/lpp/mmfs/bin/mmsdrrestore -p $MASTER -R /usr/bin/scp" +$cmd > /dev/null 2>&1 -# Usage: gpfs_mmsdrfs [packimage|liteimg] [syncinstall] -# For Linux, if packimage or liteimg specified, -# will run that command for the image if rsync updated any -# destination files -# If syncinstall specified, and if site.install_loc is blank, -# sync the /install directory to the SERVICE noderange -# if rysnc updated any destination files -# -# To keep your diskless images current with any GPFS changes, run this -# script periodically from cron using the packimage/liteimg and -# syncinstall options as required by your cluster -# - -# The source server:location of the mmsdrfs file. Default is this xCAT MN. -#SOURCE=gpfsmgr:/var/mmfs/gen/mmsdrfs -SOURCE=/var/mmfs/gen/mmsdrfs - -# The target directory on the xCAT MN that holds the master copy -TARGETDIR=/install/mmfs/gen - -# The noderange for service nodes -SERVICE=service - -# The images to be updated (list as many as needed) -# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -# EDIT HERE TO SPECIFY IMAGES TO BE UPDATED!!! -# default is to update all images !!! -# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -IMAGE[1]=ALL_IMAGES -#IMAGE[1]=sles11-ppc64-netboot-service -#IMAGE[2]=sles11-ppc64-netboot-compute - - - - -# If $installroot is set, then this script was called from genimage -# Ignore all IMAGE variables and only rsync to $installroot -if [[ ! -z "$installroot" ]]; then - OS=`uname` - if [[ "$OS" != "AIX" ]]; then - rsync -i -t $SOURCE $installroot/var/mmfs/gen/mmsdrfs - exit - fi +if [[ $? != 0 ]] +then + echo "mmsdrrestore failed!" + exit 2 +else + echo "mmsdrrestore succeeded" fi - -# rsync the GPFS config file to the MN -# DEVELOPER NOTE: Keep all code above this rsync call as short -# and efficient as possible. -# This script may be frequently called from cron. -if [ ! -d $TARGETDIR ]; then - mkdir -p $TARGETDIR -fi -result=`rsync -i -t $SOURCE $TARGETDIR/mmsdrfs` -r1=`echo $result | cut -c1` -if [ "$r1" == ">" ]; then - OS=`uname` - packcmd="" - syncinstall="" - if [ "$1" == "packimage" ] || [ "$1" == "liteimg" ]; then - packcmd=$1 - fi - if [ "$1" == "syncinstall" ] || [ "$2" == "syncinstall" ]; then - if [ -z "`/opt/xcat/bin/nodels $SERVICE`" ]; then - SERVICE="" - fi - installloc=`/opt/xcat/bin/gettab key=installloc site.value` - if [ -z "$installloc" ]; then - syncinstall="yes" - fi - fi - - if [[ -z "${IMAGE[1]}" || "${IMAGE[1]}" == "ALL_IMAGES" ]]; then - if [ $OS = "AIX" ]; then - imgtable="nimimage" - else - imgtable="linuximage" - fi - IMAGE=(`tabdump $imgtable | cut -d, -f1 | grep -v '#' | tr -d '"'`) - fi - if [ $OS = "AIX" ]; then - # do AIX stuff - updates="" - for syncimage in ${IMAGE[@]}; do - spot=`/opt/xcat/bin/gettab imagename=$syncimage nimimage.spot` - if [ -n "$spot" ]; then - dest=`lsnim -Z -a location $spot | grep -v '#' | cut -f2 -d':' ` - if [ -n "$dest" ]; then - mkdir -p $dest/lpp/bos/inst_root/var/mmfs/gen - cp $TARGETDIR/mmsdrfs $dest/lpp/bos/inst_root/var/mmfs/gen/mmsdrfs - if [[ -n "$syncinstall" && -n "$SERVICE" ]]; then - /opt/xcat/bin/xdcp $SERVICE $TARGETDIR/mmsdrfs $dest/lpp/bos/inst_root/var/mmfs/gen - fi - fi - fi - shared_root=`/opt/xcat/bin/gettab imagename=$syncimage nimimage.shared_root` - if [ -n "$shared_root" ]; then - dest=`lsnim -Z -a location $shared_root | grep -v '#' | cut -f2 -d':' ` - if [ -n "$dest" ]; then - mkdir -p $dest/var/mmfs/gen - cp $TARGETDIR/mmsdrfs $dest/var/mmfs/gen/mmsdrfs - if [[ -n "$syncinstall" && -n "$SERVICE" ]]; then - /opt/xcat/bin/xdcp $SERVICE $TARGETDIR/mmsdrfs $dest/var/mmfs/gen - fi - fi - fi - done - - else # do Linux stuff - updates="" - for syncimage in ${IMAGE[@]}; do - dest=`/opt/xcat/bin/gettab imagename=$syncimage linuximage.rootimgdir` - if [ -n "$dest" ]; then - dest=$dest/rootimg/var/mmfs/gen/mmsdrfs - cp $TARGETDIR/mmsdrfs $dest - if [ -n "$packcmd" ]; then - updates="yes" - /opt/xcat/sbin/$packcmd $syncimage - fi - fi - done - - if [ -n "$updates" ] && [ -n "$syncinstall" ] && [ -n "$SERVICE" ]; then - xdcp $SERVICE -r /usr/bin/rsync -o '-e ssh -craz' /install/netboot /install/netboot - fi - fi -fi