defect 3135: changed the mount process for the statelite directory (for persistent entries) that make a directory after the node name and remount to the nodename directory instead of nfs root dir for persistent

This commit is contained in:
daniceexi 2014-01-08 04:59:33 -05:00
parent 9470ac6d1a
commit 05a1624439
7 changed files with 160 additions and 40 deletions

View File

@ -719,7 +719,8 @@ sub mknetboot
}
# END service node
}
}
$kcmdline .= "NODE=$node ";
}
else {
$kcmdline =
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix ";

View File

@ -21,20 +21,7 @@ ELIST=[] # entry list, each entry will contain the type and the path
declare -a CLIST
declare -a PLIST
ME=`hostname -s`
MAX=30
TRIES=1
while [ x$ME = x ];do
TRIES=$[ $TRIES+1 ]
if [ $TRIES -eq $MAX ]; then
echo "Can NOT get the hostname of the node. System will fail to enable the persistent files.">/dev/console
break
fi
sleep 1
ME=`hostname -s`
done
PERSISTENT="${MNTDIR}/$SL/persistent/$ME"
PERSISTENT="${MNTDIR}/$SL/persistent"
if [ ! -d $MNTDIR ]; then
echo "statelite is only to be run in initrdfs"

View File

@ -21,20 +21,7 @@ ELIST=[] # entry list, each entry will contain the type and the path
declare -a CLIST
declare -a PLIST
ME=`hostname`
MAX=30
TRIES=1
while [ x$ME = x ];do
TRIES=$[ $TRIES+1 ]
if [ $TRIES -eq $MAX ]; then
echo "Can NOT get the hostname of the node. System will fail to enable the persistent files.">/dev/console
break
fi
sleep 1
ME=`hostname -s`
done
PERSISTENT="${MNTDIR}/$SL/persistent/$ME"
PERSISTENT="${MNTDIR}/$SL/persistent"
if [ ! -d $MNTDIR ]; then
echo "statelite is only to be run in initrdfs"

View File

@ -40,6 +40,9 @@ fi
mount -t tmpfs rw $NEWROOT/$RWDIR
mkdir -p $NEWROOT/$RWDIR/tmpfs
ME=`hostname`
if [ ! -z $NODE ]; then
ME=$NODE
fi
# mount the SNAPSHOT directory here for persistent use.
if [ ! -z $SNAPSHOTSERVER ]; then
@ -65,6 +68,38 @@ if [ ! -z $SNAPSHOTSERVER ]; then
echo "Trying again in $RS seconds..."
sleep $RS
done
# create directory which is named after my node name
mkdir -p $NEWROOT/$RWDIR/persistent/$ME
ITER=0
# umount current persistent mount
while ! umount -l $NEWROOT/$RWDIR/persistent; do
ITER=$(( ITER + 1 ))
if [ "$ITER" == "$MAXTRIES" ]; then
echo "Your are dead, rpower $ME boot to play again."
echo "Cannot umount $NEWROOT/$RWDIR/persistent."
/bin/sh
exit
fi
RS= $(( $RANDOM % 20 ))
echo "Trying again in $RS seconds..."
sleep $RS
done
# mount persistent to server:/rootpath/nodename
ITER=0
while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do
ITER=$(( ITER + 1 ))
if [ "$ITER" == "$MAXTRIES" ]; then
echo "Your are dead, rpower $ME boot to play again."
echo "Possible problems: cannot mount to $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME."
/bin/sh
exit
fi
RS= $(( $RANDOM % 20 ))
echo "Trying again in $RS seconds..."
sleep $RS
done
fi
# TODO: handle the dhclient/resolv.conf/ntp, etc

View File

@ -113,6 +113,10 @@ elif [ -r /rootimg-statelite.gz ]; then
mount -t tmpfs rw $NEWROOT/$RWDIR
mkdir -p $NEWROOT/$RWDIR/tmpfs
ME=`hostname`
if [ ! -z $NODE ]; then
ME=$NODE
fi
# mount the SNAPSHOT directory here for persistent use.
if [ ! -z $STATEMNT ]; then
@ -147,6 +151,38 @@ elif [ -r /rootimg-statelite.gz ]; then
echo "Trying again in $RS seconds ..."
sleep $RS
done
# create directory which is named after my node name
mkdir -p $NEWROOT/$RWDIR/persistent/$ME
ITER=0
# umount current persistent mount
while ! umount -l $NEWROOT/$RWDIR/persistent; do
ITER=$(( ITER + 1 ))
if [ "$ITER" == "$MAXTRIES" ]; then
echo "Your are dead, rpower $ME boot to play again."
echo "Cannot umount $NEWROOT/$RWDIR/persistent."
/bin/sh
exit
fi
RS= $(( $RANDOM % 20 ))
echo "Trying again in $RS seconds..."
sleep $RS
done
# mount persistent to server:/rootpath/nodename
ITER=0
while ! mount $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME $NEWROOT/$RWDIR/persistent -o $MNT_OPTIONS; do
ITER=$(( ITER + 1 ))
if [ "$ITER" == "$MAXTRIES" ]; then
echo "Your are dead, rpower $ME boot to play again."
echo "Possible problems: cannot mount to $SNAPSHOTSERVER:/$SNAPSHOTROOT/$ME."
/bin/sh
exit
fi
RS= $(( $RANDOM % 20 ))
echo "Trying again in $RS seconds..."
sleep $RS
done
fi
$NEWROOT/etc/init.d/localdisk

View File

@ -1224,17 +1224,19 @@ for i in `cat /proc/cmdline`; do
elif [ "\$KEY" == 'STATEMNT' ]; then
STATELITE=1
VALUE=`echo \$i |awk -F= '{print \$2}'`
# the VALUE may be null
if [ ! -z \$VALUE ]; then
SNAPSHOTSERVER=`echo \$VALUE|awk -F: '{print \$1}'`
SNAPSHOTROOT=`echo \$VALUE|awk -F/ '{for(i=2;i<=NF;i++) printf "/%s",\$i}'`
# may be that there is not server and just a directory.
if [ -z \$SNAPSHOTROOT ]
then
SNAPSHOTROOT=\$SNAPSHOTSERVER
SNAPSHOTSERVER=
fi
fi
# the VALUE may be null
if [ ! -z \$VALUE ]; then
SNAPSHOTSERVER=`echo \$VALUE|awk -F: '{print \$1}'`
SNAPSHOTROOT=`echo \$VALUE|awk -F/ '{for(i=2;i<=NF;i++) printf "/%s",\$i}'`
# may be that there is not server and just a directory.
if [ -z \$SNAPSHOTROOT ]
then
SNAPSHOTROOT=\$SNAPSHOTSERVER
SNAPSHOTSERVER=
fi
fi
elif [ "\$KEY" == 'NODE' ]; then
NODENAME=`echo \$i |awk -F= '{print \$2}'`
fi
done
@ -1257,6 +1259,9 @@ if [ "\$STATELITE" = "1" ]; then
MAXTRIES=5
ITER=0
ME=`hostname`
if [ ! -z "\$NODENAME" ]; then
ME=\$NODENAME
fi
if [ "\$NFSROOT" = "1" ]; then
while ! mount.nfs \${SERVER}:\${ROOTDIR}/rootimg \$NEWROOT -r -n -o nolock,rsize=32768,tcp,nfsvers=3,timeo=14; do
ITER=\$(expr \$ITER + 1)
@ -1345,6 +1350,38 @@ EOMS
echo -e "Trying again in \$RS seconds"
sleep \$RS
done
# create directory which is named after my node name
mkdir -p \$NEWROOT/\$RWDIR/persistent/\$ME
ITER=0
# umount current persistent mount
while ! umount -l \$NEWROOT/\$RWDIR/persistent; do
ITER=\$(( ITER + 1 ))
if [ "\$ITER" == "\$MAXTRIES" ]; then
echo "Your are dead, rpower \$ME boot to play again."
echo "Cannot umount \$NEWROOT/\$RWDIR/persistent."
/bin/sh
exit
fi
RS= \$(( \$RANDOM % 20 ))
echo "Trying again in \$RS seconds..."
sleep \$RS
done
# mount persistent to server:/rootpath/nodename
ITER=0
while ! mount \$SNAPSHOTSERVER:/\$SNAPSHOTROOT/\$ME \$NEWROOT/\$RWDIR/persistent -o nolock,rsize=32768; do
ITER=\$(( ITER + 1 ))
if [ "\$ITER" == "\$MAXTRIES" ]; then
echo "Your are dead, rpower \$ME boot to play again."
echo "Possible problems: cannot mount to \$SNAPSHOTSERVER:/\$SNAPSHOTROOT/\$ME."
/bin/sh
exit
fi
RS= \$(( \$RANDOM % 20 ))
echo "Trying again in \$RS seconds..."
sleep \$RS
done
fi
# have to preserve the initial DHCP request.

View File

@ -1172,6 +1172,8 @@ for i in `cat /proc/cmdline`; do
SNAPSHOTSERVER=
fi
fi
elif [ "\$KEY" == 'NODE' ]; then
NODENAME=`echo \$i |awk -F= '{print \$2}'`
fi
done
@ -1186,6 +1188,9 @@ if [ "\$STATELITE" = "1" ]; then
MAXTRIES=15
ITER=0
ME=`hostname`
if [ ! -z "$NODENAME" ]; then
ME=$NODENAME
fi
if [ "\$NFSROOT" = "1" ]; then
while ! mount.nfs \${SERVER}:\${ROOTDIR}/rootimg \$NEWROOT -r -n -o nolock,rsize=32768,tcp,nfsvers=3,timeo=14; do
ITER=\$(expr \$ITER + 1)
@ -1281,6 +1286,38 @@ fi
echo -e "Trying again in \$RS seconds"
sleep \$RS
done
# create directory which is named after my node name
mkdir -p \$NEWROOT/\$RWDIR/persistent/\$ME
ITER=0
# umount current persistent mount
while ! umount -l \$NEWROOT/\$RWDIR/persistent; do
ITER=\$(( ITER + 1 ))
if [ "\$ITER" == "\$MAXTRIES" ]; then
echo "Your are dead, rpower \$ME boot to play again."
echo "Cannot umount \$NEWROOT/\$RWDIR/persistent."
/bin/sh
exit
fi
RS= \$(( \$RANDOM % 20 ))
echo "Trying again in \$RS seconds..."
sleep \$RS
done
# mount persistent to server:/rootpath/nodename
ITER=0
while ! mount \$SNAPSHOTSERVER:/\$SNAPSHOTROOT/\$ME \$NEWROOT/\$RWDIR/persistent -o nolock,\$XCATMNTOPTS; do
ITER=\$(( ITER + 1 ))
if [ "\$ITER" == "\$MAXTRIES" ]; then
echo "Your are dead, rpower \$ME boot to play again."
echo "Possible problems: cannot mount to \$SNAPSHOTSERVER:/\$SNAPSHOTROOT/\$ME."
/bin/sh
exit
fi
RS= \$(( \$RANDOM % 20 ))
echo "Trying again in \$RS seconds..."
sleep \$RS
done
fi
grep '\\(shell\\)' /proc/cmdline >/dev/null && shell