for defect 3087228

add two checkpoints in InstUtils.pm and aixlitesetup

    if the entry in litefile table is one file and the entry in spot is one directory,
    or the entry in litefile table is one directory and the entry in spot is one file,
    there will be one error message to indicate the user to update the spot or the litefile table

    One loop is added to do the check in InstUtils.pm;

    in aixlitesetup script, two checkpoints are added to make sure the entries in litetree is comatible with the litefile entry

    Also add one checkpoint in aixinstall.pm to see the return code of dolitesetup

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7864 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
mxi1 2010-10-15 08:34:00 +00:00
parent 9053081d90
commit b841208705
3 changed files with 57 additions and 3 deletions

View File

@ -978,6 +978,7 @@ sub dolitesetup
if ( ! -d "$instrootloc/.default" ) {
my $mcmd = qq~/bin/mkdir -m 644 -p $instrootloc/.default ~;
my $output = xCAT::Utils->runcmd("$mcmd", -1);
if ($::RUNCMD_RC != 0)
{
my $rsp;
push @{$rsp->{data}}, "Could not create $instrootloc/.default.\n";
@ -989,6 +990,7 @@ sub dolitesetup
if ( ! -d "$instrootloc/.statelite" ) {
my $mcmd = qq~/bin/mkdir -m 644 -p $instrootloc/.statelite ~;
my $output = xCAT::Utils->runcmd("$mcmd", -1);
if ($::RUNCMD_RC != 0)
{
my $rsp;
push @{$rsp->{data}}, "Could not create $instrootloc/.statelite.\n";
@ -1003,6 +1005,41 @@ sub dolitesetup
# read the litefile and try to copy into $default
# everything in the litefile command output should be processed
foreach my $line (@litefiles) {
# $file could be full path file name or dir name
# ex. /foo/bar/ or /etc/lppcfg
my ($node, $option, $file) = split (/\|/, $line);
# ex. .../inst_root/foo/bar/ or .../inst_root/etc/lppcfg
my $instrootfile = $instrootloc . $file;
# there's one scenario to be handled firstly
# in litefile table, there's one entry: /path/to/file, which is one file
# however, there's already one directory named "/path/to/file/"
#
# Or:
# the entry in litefile is "/path/to/file/", which is one directory
# however, there's already one file named "/path/to/file"
#
# in these cases,
# need to indicate the user there's already one existing file/directory in the spot
# then, exit
if ($file =~ m/\/$/ and -f $instrootfile) {
my $rsp;
push @{$rsp->{data}}, qq{there is already one file named "$file", but the entry in litefile table is set to one directory, please check it};
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
if ($file !~ m/\/$/ and -d $instrootfile) {
my $rsp;
push @{$rsp->{data}}, qq{there is already one directory named "$file", but the entry in litefile table is set to one file, please check it};
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
my @copiedfiles;
foreach my $line (@litefiles) {

View File

@ -5696,6 +5696,12 @@ sub updatespot
# if this has a shared_root resource then
# it might need statelite setup
my $rc=xCAT::InstUtils->dolitesetup($image, \%imghash, \@nodelist, $callback, $subreq);
if ($rc eq 1) { # error
my $rsp;
push @{$rsp->{data}}, qq{There's one error when doing statelite setup, see the error message above};
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
# Modify the rc.dd-boot script

View File

@ -256,11 +256,22 @@ FindFile () {
SRC=`echo ${MOUNTDIR}/${SERVER}${DIR}${path} | sed -e 's/\/\//\//'`
# ex. /.statelite/mnt/10.2.0.200/etc/FScfg
# ex. /.statelite/mnt/10.2.0.200/root/ssh/
if [ -e ${SRC} ]; then
PATHEND=`expr ${#path} - 1` # get the last char of the path
if [ ${path[${PATHEND}]} -ne '/' ] && [ -d ${SRC} ]; then
FOUND=0
continue
fi
FOUND=1
ProcessType ${SRC} ${path} ${type} ${isChild}
break
if [ ${path[${PATHEND}]} -eq "/" ] && [ -f ${SRC} ]; then
FOUND=0
continue
fi
FOUND=1
ProcessType ${SRC} ${path} ${type} ${isChild}
break
fi
done