From c444f232b8465de0140c7d03131ec04385f4af97 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Sat, 23 Jul 2011 04:36:47 +0000 Subject: [PATCH] defect 3370678:fix the problem that statelite could not handle the link,persistent option correctly git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10144 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../netboot/add-on/statelite/rc.statelite | 23 +++++++++++-------- .../add-on/statelite/rc.statelite.ppc.redhat | 23 +++++++++++-------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite index a7c40c892..8b51f99cd 100755 --- a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite +++ b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite @@ -292,10 +292,6 @@ ProcessType () { PATH=`echo ${PATH} | /bin/sed -e 's/\/$//'` TARGET=${TMPFS}${PATH} - if [ -d ${TARGET} ]; then - echo "rm -Rf ${TARGET}" >>$LOG 2>&1 - /bin/rm -Rf ${TARGET} 2>&1 >>$LOG - fi if [ ! -d ${PERSISTENT}${PPATH} ]; then /bin/mkdir -p ${PERSISTENT}${PPATH} 2>&1 >>$LOG @@ -309,22 +305,31 @@ ProcessType () { fi if [ "$isChild" = "1" ]; then - num=${#PLIST[@]} + pnum=${#PLIST[@]} echo "${PPATH}: " - for ((i=0;i<$num; i++)); do - set -- ${PLIST[$i]} + parent="$PPATH/" + while [ "$parent" != "//" ]; do + for ((p=0;p<$pnum; p++)); do + set -- ${PLIST[$p]} itype=$1 ipath=$2 - if [ "$PPATH" = "$ipath" ]; then + if [ "$parent" = "$ipath" ]; then echo "${itype}" - if [ "$itype" = "link,persistent" ]; then + #if [ "$itype" = "link,persistent" ]; then + if [ "$itype" = "link" -o "$itype" = "tmpfs,rw" ]; then # mount it to ${TARGET} echo "mount --bind ${PERSISTENT}${PATH} ${TARGET}" >>$LOG 2>&1 /bin/mount --bind ${PERSISTENT}${PATH} ${TARGET} fi fi + done + parent="`/usr/bin/dirname $parent`/" done else + if [ -d ${TARGET} ]; then + echo "rm -Rf ${TARGET}" >>$LOG 2>&1 + /bin/rm -Rf ${TARGET} 2>&1 >>$LOG + fi # finally make the tmpfs link point to the persistent file # you have to get rid of the ${MNTDIR} directory in the beginning # so that when the chroot happens the link is valid. diff --git a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat index 67af180db..50cbe0f6f 100755 --- a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat +++ b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat @@ -292,10 +292,6 @@ ProcessType () { PATH=`echo ${PATH} | /bin/sed -e 's/\/$//'` TARGET=${TMPFS}${PATH} - if [ -d ${TARGET} ]; then - echo "rm -Rf ${TARGET}" >>$LOG 2>&1 - /bin/rm -Rf ${TARGET} 2>&1 >>$LOG - fi if [ ! -d ${PERSISTENT}${PPATH} ]; then /bin/mkdir -p ${PERSISTENT}${PPATH} 2>&1 >>$LOG @@ -309,22 +305,31 @@ ProcessType () { fi if [ "$isChild" = "1" ]; then - num=${#PLIST[@]} + pnum=${#PLIST[@]} echo "${PPATH}: " - for ((i=0;i<$num; i++)); do - set -- ${PLIST[$i]} + parent="$PPATH/" + while [ "$parent" != "//" ]; do + for ((p=0;p<$pnum; p++)); do + set -- ${PLIST[$p]} itype=$1 ipath=$2 - if [ "$PPATH" = "$ipath" ]; then + if [ "$parent" = "$ipath" ]; then echo "${itype}" - if [ "$itype" = "link,persistent" ]; then + #if [ "$itype" = "link,persistent" ]; then + if [ "$itype" = "link" -o "$itype" = "tmpfs,rw" ]; then # mount it to ${TARGET} echo "mount --bind ${PERSISTENT}${PATH} ${TARGET}" >>$LOG 2>&1 /bin/mount --bind ${PERSISTENT}${PATH} ${TARGET} fi fi + done + parent="`/usr/bin/dirname $parent`/" done else + if [ -d ${TARGET} ]; then + echo "rm -Rf ${TARGET}" >>$LOG 2>&1 + /bin/rm -Rf ${TARGET} 2>&1 >>$LOG + fi # finally make the tmpfs link point to the persistent file # you have to get rid of the ${MNTDIR} directory in the beginning # so that when the chroot happens the link is valid.