Squashed commit of the following:
update the code to handle the scenario when both the parent and child directory exist in the litefile table remove one line from xcat-prepivot.sh updated the manpage for litefile the statelite document is updated /etc/mtab is added as one default entry when "litefile" or "ilitefile" commands are running, even it is not in litefile table git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8100 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
4abe02db34
commit
3822bfc406
@ -142,14 +142,15 @@ litefile => {
|
||||
image => "The name of the image that will use these files, as specified in the osimage table. 'ALL' means use it for all images.",
|
||||
file => "The full pathname of the file. e.g: /etc/hosts. If the path is a directory, then it should be terminated with a '/'. ",
|
||||
options => "Options for the file:\n\n".
|
||||
" blank, tempfs or rw - \"mount --bind\" is used to mount the file/directory to the root image, and the permission for the file/directory will be the same as the original.\n\n".
|
||||
" persistent - the file/directory will be persistent across reboots, and the file/directory will be mounted with \"--bind\" option. If the file/directory doesnot exist at first, it will be created during initialization. If the file/directory exists, it will be left alone. ( Requires the statelite table to be filled out with a spot for persistent storage).\n\n".
|
||||
" con - the contents of the pathname are concatenated to the contents of the existing file. For this directive the searching in the litetree hierarchy does not stop when the first match is found. Con is similar to bind, but all files found in the hierarchy will be concatenated to the file when found. (which is re-designed to use bind option).\n\n".
|
||||
" ro - file will be read only. This file will be located in the directory hierarchy specified in the litetree table. The directory will be mounted on the node while the node is running, and the file will be mounted to this directory with \"--bind -o ro\" opton.\n\n".
|
||||
" link - the file is readwrite and will be placed in tmpfs on the booted node. When searching for the file, the first one to be found in the litetree hierarchy will be used. When the node is rebooted, this file will be reinitialized.\n\n".
|
||||
" link, con - The contents of the pathname are concatenated to the contents of the existing file. For this directive the searching in the litetree hierarchy does not stop when the first match is found. Con is similar to tmpfs, but all files found in the hierarchy will be concatenated to the file when found.\n\n".
|
||||
" link, persistent - This means that the file is readwrite and will be persistent across reboots. If the file does not exist at first, it will be created during initialization. If the file exists, it will be left alone. (Requires the statelite table to be filled out with a spot for persistent storage).\n\n".
|
||||
" link, ro - file will be read only. This file will be located in the directory hierarchy specified in the litetree table. The directory will be mounted on the node while the node is running (not just during the boot process), and the file will be linked to this directory. Changes made to this file on the server will be immediately seen in this file on the node.",
|
||||
qq{ tmpfs - It is the default option if you leave the options column blank. It provides a file or directory for the node to use when booting, its permission will be the same as the original version on the server. In most cases, it is read-write; however, on the next statelite boot, the original version of the file or directory on the server will be used, it means it is non-persistent. This option can be performed on files and directories..\n\n}.
|
||||
qq{ rw - Same as Above.Its name "rw" does NOT mean it always be read-write, even in most cases it is read-write. Please do not confuse it with the "rw" permission in the file system. \n\n}.
|
||||
qq{ persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted on the local file or directory. Anything written to that file or directory is preserved. It means, if the file/directory does not exist at first, it will be copied to the persistent location. Next time the file/directory in the persistent location will be used. The file/directory will be persistent across reboots. Its permission will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. This option can be performed on files and directories. \n\n}.
|
||||
qq{ con - The contents of the pathname are concatenated to the contents of the existing file. For this directive the searching in the litetree hierarchy does not stop when the first match is found. All files found in the hierarchy will be concatenated to the file when found. The permission of the file will be "-rw-r--r--", which means it is read-write for the root user, but readonly for the others. It is non-persistent, when the node reboots, all changes to the file will be lost. It can only be performed on files. Please do not use it for one directory.\n\n}.
|
||||
qq{ ro - The file/directory will be overmounted read-only on the local file/directory. It will be located in the directory hierarchy specified in the litetree table. Changes made to this file or directory on the server will be immediately seen in this file/directory on the node. This option requires that the file/directory to be mounted must be available in one of the entries in the litetree table. This option can be performed on files and directories.\n\n}.
|
||||
qq{ link - It provides one file/directory for the node to use when booting, it is copied from the server, and will be placed in tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to one file/directory in tmpfs. And the permission of the symbolic link is "lrwxrwxrwx", which is not the real permission of the file/directory on the node. So for some application sensitive to file permissions, it will be one issue to use "link" as its option, for example, "/root/.ssh/", which is used for SSH, should NOT use "link" as its option. It is non-persistent, when the node is rebooted, all changes to the file/directory will be lost. This option can be performed on files and directories. \n\n}.
|
||||
qq{ link,con - It works similar to the "con" option. All the files found in the litetree hierarchy will be concatenated to the file when found. The final file will be put to the tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the file/directory in tmpfs. It is non-persistent, when the node is rebooted, all changes to the file will be lost. The option can only be performed on files. \n\n}.
|
||||
qq{ link,persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted to the tmpfs on the booted node, and finally the symbolic link in the local file system will be linked to the over-mounted tmpfs file/directory on the booted node. The file/directory will be persistent across reboots. The permission of the file/directory where the symbolic link points to will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. The option can be performed on files and directories.\n\n}.
|
||||
qq{ link,ro - The file is readonly, and will be placed in tmpfs on the booted node. In the local file system of the booted node, it is one symbolic link to the tmpfs. It is non-persistent, when the node is rebooted, all changes to the file/directory will be lost. This option requires that the file/directory to be mounted must be available in one of the entries in the litetree table. The option can be performed on files and directories.},
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -373,6 +373,8 @@ sub mergeArrays {
|
||||
$attrs->{$_->{priority}} = $_->{directory};
|
||||
}
|
||||
}elsif($type =~ /file|image/){
|
||||
|
||||
my $doesMtabExists = 0;
|
||||
foreach(@$arr){
|
||||
next if($_->{file} eq '');
|
||||
my $o = $_->{options};
|
||||
@ -380,10 +382,18 @@ sub mergeArrays {
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
$o = "rw"; # default option if not provided
|
||||
} else {
|
||||
$o = "tempfs";
|
||||
$o = "tmpfs";
|
||||
}
|
||||
}
|
||||
|
||||
if ($_->{file} eq "/etc/mtab") {
|
||||
$doesMtabExists = 1;
|
||||
# TODO
|
||||
# let the user know the "link" option should be with
|
||||
# /etc/mtab
|
||||
$o = "link";
|
||||
}
|
||||
|
||||
# TODO: put some logic in here to make sure that ro is alone.
|
||||
# if type is ro and con, then this is wrong silly!
|
||||
#if($p eq "ro" and $t eq "con"){
|
||||
@ -393,6 +403,11 @@ sub mergeArrays {
|
||||
#}
|
||||
$attrs->{$_->{file}} = $o;
|
||||
}
|
||||
|
||||
if ($doesMtabExists eq 0) {
|
||||
$attrs->{"/etc/mtab"} = "link";
|
||||
}
|
||||
|
||||
}elsif($type =~ /location/){
|
||||
foreach(@$arr)
|
||||
{
|
||||
|
@ -184,7 +184,7 @@ ResolveLinks () {
|
||||
type=$1
|
||||
path=$2
|
||||
|
||||
parent="`dirname $path`/"
|
||||
parent="`/usr/bin/dirname $path`/"
|
||||
efound=0
|
||||
while [ "$parent" != "//" ]; do
|
||||
for ((j=0;j<$num;j++)); do
|
||||
@ -196,7 +196,7 @@ ResolveLinks () {
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
parent="`dirname $parent`/"
|
||||
parent="`/usr/bin/dirname $parent`/"
|
||||
done
|
||||
|
||||
if [ "$efound" = "1" ]; then
|
||||
@ -344,7 +344,7 @@ ProcessType () {
|
||||
/bin/cat ${1} >>${TMPFS}${2} 2>&1
|
||||
fi
|
||||
;;
|
||||
tempfs) # the default option, same as "tempfs" and "NULL"
|
||||
tempfs) # "tempfs" is kept here for compatibility, "tmpfs" has replaced it
|
||||
ORIG=`echo ${2} | /bin/sed -e 's/\/$//'`
|
||||
TARGET=`echo ${1}`
|
||||
|
||||
@ -361,7 +361,24 @@ ProcessType () {
|
||||
/bin/mount --bind ${TMPFS}${2} /sysroot${ORIG}>>$LOG 2>&1
|
||||
fi
|
||||
;;
|
||||
rw) # the default option, same as "tempfs" and "NULL"
|
||||
tmpfs) # the default option, same as "rw" and "NULL"
|
||||
ORIG=`echo ${2} | /bin/sed -e 's/\/$//'`
|
||||
TARGET=`echo ${1}`
|
||||
|
||||
if [ -d ${TMPFS}${2} ]; then
|
||||
/bin/cp -r -a ${1}* ${TMPFS}${2}
|
||||
echo "cp -r -a ${1}* ${TMPFS}${2}" >>$LOG
|
||||
else
|
||||
/bin/cp -r -a ${1} ${TMPFS}${2}
|
||||
echo "cp -r -a ${1} ${TMPFS}${2}" >>$LOG
|
||||
fi
|
||||
|
||||
if [ "$isChild" = "0" ]; then
|
||||
echo "mount --bind ${TMPFS}${2} /sysroot${ORIG}" >>$LOG
|
||||
/bin/mount --bind ${TMPFS}${2} /sysroot${ORIG}>>$LOG 2>&1
|
||||
fi
|
||||
;;
|
||||
rw) # the default option, same as "tmpfs" and "NULL"
|
||||
ORIG=`echo ${2} | /bin/sed -e 's/\/$//'`
|
||||
TARGET=`echo ${1}`
|
||||
|
||||
@ -436,18 +453,38 @@ FindFile () {
|
||||
type=$2
|
||||
isChild=$3
|
||||
FOUND=0
|
||||
|
||||
cnum=${#CLIST[@]}
|
||||
|
||||
for DIR in `/bin/cat ${SYNCTREE}` ;do
|
||||
DIR=${DIR/:/}
|
||||
if [ -e ${TREEMOUNT}/${DIR}${path} ]; then
|
||||
FOUND=1 # we found it!
|
||||
if [ -d ${TREEMOUNT}/${DIR}${path} ] && [ "0" -eq `/bin/ls -A ${TREEMOUNT}/${DIR}${path} |/usr/bin/wc -l` ]; then
|
||||
FOUND=0
|
||||
else
|
||||
ProcessType ${TREEMOUNT}/${DIR}${path} ${path} ${type} ${isChild}
|
||||
if [ "${2}" = "link,con" ] || [ "${2}" = "con" ]; then
|
||||
continue
|
||||
FOUND=1
|
||||
if [ -d ${TREEMOUNT}/${DIR}${path} ] && [ "${isChild}" = "0" ]; then # the parent with children
|
||||
for ((j=0;j<$cnum;j++)); do
|
||||
set -- ${CLIST[$j]}
|
||||
item=${2}
|
||||
itemDir="`/usr/bin/dirname ${item}`/"
|
||||
if [ "${itemDir}" = "${path}" ]; then
|
||||
if [ -e ${TREEMOUNT}/${DIR}${item} ]; then
|
||||
FOUND=0 # this nfs directory contains the children, so skip it when handling parent
|
||||
continue 2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ "0" -eq `/bin/ls -A ${TREEMOUNT}/${DIR}${path} |/usr/bin/wc -l` ]; then
|
||||
FOUND=0
|
||||
else
|
||||
break
|
||||
ProcessType ${TREEMOUNT}/${DIR}${path} ${path} ${type} ${isChild}
|
||||
fi
|
||||
else # the children and the parents without any children
|
||||
if [ -d ${TREEMOUNT}/${DIR}${path} ] && [ "0" -eq `/bin/ls -A ${TREEMOUNT}/${DIR}${path} |/usr/bin/wc -l` ]; then
|
||||
FOUND=0
|
||||
else
|
||||
ProcessType ${TREEMOUNT}/${DIR}${path} ${path} ${type} ${isChild}
|
||||
if [ "${2}" != "link,con" ] && [ "${2}" != "con" ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -184,7 +184,7 @@ ResolveLinks () {
|
||||
type=$1
|
||||
path=$2
|
||||
|
||||
parent="`dirname $path`/"
|
||||
parent="`/usr/bin/dirname $path`/"
|
||||
efound=0
|
||||
while [ "$parent" != "//" ]; do
|
||||
for ((j=0;j<$num;j++)); do
|
||||
@ -196,7 +196,7 @@ ResolveLinks () {
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
parent="`dirname $parent`/"
|
||||
parent="`/usr/bin/dirname $parent`/"
|
||||
done
|
||||
|
||||
if [ "$efound" = "1" ]; then
|
||||
@ -344,7 +344,7 @@ ProcessType () {
|
||||
/bin/cat ${1} >>${TMPFS}${2} 2>&1
|
||||
fi
|
||||
;;
|
||||
tempfs) # the default option, same as "tempfs" and "NULL"
|
||||
tempfs) # "tempfs" is kept here for compatibility, "tmpfs" has replaced it
|
||||
ORIG=`echo ${2} | /bin/sed -e 's/\/$//'`
|
||||
TARGET=`echo ${1}`
|
||||
|
||||
@ -361,7 +361,24 @@ ProcessType () {
|
||||
/bin/mount --bind ${TMPFS}${2} /sysroot${ORIG}>>$LOG 2>&1
|
||||
fi
|
||||
;;
|
||||
rw) # the default option, same as "tempfs" and "NULL"
|
||||
tmpfs) # the default option, same as "rw" and "NULL"
|
||||
ORIG=`echo ${2} | /bin/sed -e 's/\/$//'`
|
||||
TARGET=`echo ${1}`
|
||||
|
||||
if [ -d ${TMPFS}${2} ]; then
|
||||
/bin/cp -r -a ${1}* ${TMPFS}${2}
|
||||
echo "cp -r -a ${1}* ${TMPFS}${2}" >>$LOG
|
||||
else
|
||||
/bin/cp -r -a ${1} ${TMPFS}${2}
|
||||
echo "cp -r -a ${1} ${TMPFS}${2}" >>$LOG
|
||||
fi
|
||||
|
||||
if [ "$isChild" = "0" ]; then
|
||||
echo "mount --bind ${TMPFS}${2} /sysroot${ORIG}" >>$LOG
|
||||
/bin/mount --bind ${TMPFS}${2} /sysroot${ORIG}>>$LOG 2>&1
|
||||
fi
|
||||
;;
|
||||
rw) # the default option, same as "tmpfs" and "NULL"
|
||||
ORIG=`echo ${2} | /bin/sed -e 's/\/$//'`
|
||||
TARGET=`echo ${1}`
|
||||
|
||||
@ -436,18 +453,38 @@ FindFile () {
|
||||
type=$2
|
||||
isChild=$3
|
||||
FOUND=0
|
||||
|
||||
cnum=${#CLIST[@]}
|
||||
|
||||
for DIR in `/bin/cat ${SYNCTREE}` ;do
|
||||
DIR=${DIR/:/}
|
||||
if [ -e ${TREEMOUNT}/${DIR}${path} ]; then
|
||||
FOUND=1 # we found it!
|
||||
if [ -d ${TREEMOUNT}/${DIR}${path} ] && [ "0" -eq `/bin/ls -A ${TREEMOUNT}/${DIR}${path} |/usr/bin/wc -l` ]; then
|
||||
FOUND=0
|
||||
else
|
||||
ProcessType ${TREEMOUNT}/${DIR}${path} ${path} ${type} ${isChild}
|
||||
if [ "${2}" = "link,con" ] || [ "${2}" = "con" ]; then
|
||||
continue
|
||||
FOUND=1
|
||||
if [ -d ${TREEMOUNT}/${DIR}${path} ] && [ "${isChild}" = "0" ]; then # the parent with children
|
||||
for ((j=0;j<$cnum;j++)); do
|
||||
set -- ${CLIST[$j]}
|
||||
item=${2}
|
||||
itemDir="`/usr/bin/dirname ${item}`/"
|
||||
if [ "${itemDir}" = "${path}" ]; then
|
||||
if [ -e ${TREEMOUNT}/${DIR}${item} ]; then
|
||||
FOUND=0 # this nfs directory contains the children, so skip it when handling parent
|
||||
continue 2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ "0" -eq `/bin/ls -A ${TREEMOUNT}/${DIR}${path} |/usr/bin/wc -l` ]; then
|
||||
FOUND=0
|
||||
else
|
||||
break
|
||||
ProcessType ${TREEMOUNT}/${DIR}${path} ${path} ${type} ${isChild}
|
||||
fi
|
||||
else # the children and the parents without any children
|
||||
if [ -d ${TREEMOUNT}/${DIR}${path} ] && [ "0" -eq `/bin/ls -A ${TREEMOUNT}/${DIR}${path} |/usr/bin/wc -l` ]; then
|
||||
FOUND=0
|
||||
else
|
||||
ProcessType ${TREEMOUNT}/${DIR}${path} ${path} ${type} ${isChild}
|
||||
if [ "${2}" != "link,con" ] && [ "${2}" != "con" ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -63,7 +63,6 @@ if [ ! -z $SNAPSHOTSERVER ]; then
|
||||
fi
|
||||
|
||||
# TODO: handle the dhclient/resolv.conf/ntp, etc
|
||||
echo "TODO: handle the dhclient/resolv/ntp, etc"
|
||||
$NEWROOT/etc/init.d/statelite
|
||||
READONLY=yes
|
||||
export READONLY
|
||||
@ -71,7 +70,7 @@ fastboot=yes
|
||||
export fastboot
|
||||
keep_old_ip=yes
|
||||
export keep_old_ip
|
||||
mount -n --bind /dev $NREWROOT/dev
|
||||
mount -n --bind /dev $NEWROOT/dev
|
||||
mount -n --bind /proc $NEWROOT/proc
|
||||
mount -n --bind /sys $NEWROOT/sys
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user