Compare commits
47 Commits
fix/makero
...
fix/makero
Author | SHA1 | Date | |
---|---|---|---|
b366a38464 | |||
71ba4c3d00 | |||
3e11b02f14 | |||
5982836805 | |||
d22815398a | |||
5fd991246a | |||
6bb22d2342 | |||
d5cb13be6d | |||
3c7870afbc | |||
b169de45ef | |||
bc8d13c9c0 | |||
997a8e36d0 | |||
51e53737a2 | |||
69598e32f7 | |||
ebbfe29f5c | |||
7848b733b3 | |||
69455327e6 | |||
469126c759 | |||
af908aafdf | |||
c5172263b9 | |||
788b616458 | |||
d84f7d5e9e | |||
0579db7baa | |||
f252d167a1 | |||
a0bbb92921 | |||
b572e045fb | |||
af9b887d23 | |||
40319ab858 | |||
f88f454e9a | |||
9a71aee476 | |||
a2e384931a | |||
09df503e1e | |||
3a65f12683 | |||
e867ef90e9 | |||
276554154f | |||
1ece21a021 | |||
c6486a6228 | |||
c540c616ab | |||
a698e1757d | |||
9e3dfa484b | |||
8887485857 | |||
cf5fc84937 | |||
da3d528caf | |||
843a32e664 | |||
9ceb62cdaa | |||
e62178aee8 | |||
c418e9aeb9 |
88
build-debs-all
Executable file
88
build-debs-all
Executable file
@ -0,0 +1,88 @@
|
||||
#!/bin/bash
|
||||
###########
|
||||
#
|
||||
# This script call make<package>deb and create the deb packages
|
||||
# for xCAT
|
||||
#
|
||||
# Author: Leonardo Tonetto <tonetto@linux.vnet.ibm.com>
|
||||
# Revisor: Adalberto Medeiros <adalbas@linux.vnet.ibm.com>
|
||||
# Revisor2: Arif Ali <aali@ocf.co.uk>
|
||||
#
|
||||
# Input:
|
||||
#
|
||||
# $1 is the build type/location
|
||||
# $2 is the string added to the debian/changelog of each package
|
||||
#
|
||||
############
|
||||
|
||||
##############
|
||||
# Get input
|
||||
##############
|
||||
|
||||
PKG_LOCATION=$1 # local | snap | alpha
|
||||
if [ -z $PKG_LOCATION ]; then
|
||||
PKG_LOCATION="local"
|
||||
fi
|
||||
BUILD_STRING=$2
|
||||
if [ -z $BUILD_STRING ]; then
|
||||
BUILD_STRING="Personal Build"
|
||||
fi
|
||||
XCAT_VERSION=`cat Version`
|
||||
TRUNK_REVISION=`svnversion | cut -d ":" -f1`
|
||||
CUR_DATE=`date +%Y%m%d`
|
||||
VERSION="${XCAT_VERSION}-${PKG_LOCATION}${CUR_DATE}"
|
||||
|
||||
function makedeb {
|
||||
SRC_ROOT=$1
|
||||
PKG_LOCATION=$2
|
||||
BUILD_STRING=$3
|
||||
VERSION=$4
|
||||
|
||||
#
|
||||
# Make DEBs
|
||||
#
|
||||
# build perl-xCAT - deps are libsoap-lite-perl, libdigest-sha1-perl, libdbi-perl
|
||||
#
|
||||
|
||||
find $SRC_ROOT -maxdepth 2 -name debian -type d | while read DEBIAN_DIR
|
||||
do
|
||||
DIR=`echo ${DEBIAN_DIR} | sed -e 's/[/]debian$//'`
|
||||
cd ${DIR}
|
||||
dch -v $VERSION -b -c debian/changelog "$BUILD_STRING"
|
||||
dpkg-buildpackage
|
||||
cd -
|
||||
RC=$?
|
||||
if [ ${RC} -gt 0 ]
|
||||
then
|
||||
echo "Warning: ${DEBIAN_DIR} failed exit code ${RC}"
|
||||
fi
|
||||
done
|
||||
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
# Eliminate unnecessary directories and debian/files made by dpkg-buildpackage
|
||||
|
||||
find $SRC_ROOT -maxdepth 3 -type d -name "xcat-*" | grep debian | xargs rm -rf
|
||||
find $SRC_ROOT -maxdepth 3 -type f -name "files" | grep debian | xargs rm -f
|
||||
}
|
||||
|
||||
# build all debian packages
|
||||
packages="xCAT-client xCAT-nbroot xCAT-nbroot2 perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-IBMhpc xCAT-rmc"
|
||||
|
||||
for file in `echo $packages`
|
||||
do
|
||||
makedeb $file $PKG_LOCATION "$BUILD_STRING" $VERSION
|
||||
done
|
||||
|
||||
if [ -d debs ]; then
|
||||
rm -rf debs
|
||||
fi
|
||||
|
||||
mkdir debs
|
||||
mv xcat* debs/
|
||||
mv perl-xcat* debs/
|
||||
|
||||
echo $VERSION > latest_version
|
||||
|
||||
exit 0
|
@ -44,8 +44,10 @@ FRS=/home/frs/project/x/xc/xcat
|
||||
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal"
|
||||
ZVMBUILD="perl-xCAT xCAT-server xCAT-UI"
|
||||
ZVMLINK="xCAT-client xCAT xCATsn"
|
||||
PCMBUILD="xCAT"
|
||||
PCMLINK="perl-xCAT xCAT-client xCAT-server xCAT-buildkit xCAT-genesis-scripts-x86_64"
|
||||
# xCAT has PCM specific configuration - conserver-xcat, syslinux-xcat
|
||||
# xCAT-server has PCM specific configuration - RESTAPI(perl-JSON)
|
||||
PCMBUILD="xCAT xCAT-server"
|
||||
PCMLINK="perl-xCAT xCAT-client xCAT-buildkit xCAT-genesis-scripts-x86_64"
|
||||
# Note: for FSM, the FlexCAT rpm is built separately from gsa/git
|
||||
FSMBUILD="perl-xCAT xCAT-client xCAT-server"
|
||||
FSMLINK=""
|
||||
|
@ -8,10 +8,22 @@
|
||||
OSNAME=$(uname)
|
||||
NAMEALL=$(uname -a)
|
||||
|
||||
for i in $*; do
|
||||
# upper case the variable name
|
||||
varstring=`echo "$i"|cut -d '=' -f 1|tr '[a-z]' '[A-Z]'`=`echo "$i"|cut -d '=' -f 2`
|
||||
export $varstring
|
||||
done
|
||||
|
||||
if [ -z "$CURDIR" ]; then
|
||||
echo "get current directory!"
|
||||
CURDIR=$(pwd)
|
||||
fi
|
||||
|
||||
echo "CURDIR is $CURDIR"
|
||||
echo "OSNAME is $OSNAME!"
|
||||
echo "NAMEALL is $NAMEALL"
|
||||
|
||||
ls /code/xcat-core
|
||||
ls $CURDIR/makerpm
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "Error:no repo exist, exit 1."
|
||||
@ -25,10 +37,9 @@ if ! flock -n 8; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#used only for hard code, will change later
|
||||
cd /code/xcat-core
|
||||
|
||||
rm -rf build/
|
||||
#delete old package if there is
|
||||
rm -rf $CURDIR/build/
|
||||
cd $CURDIR
|
||||
|
||||
echo "==============================================="
|
||||
echo $NAMEALL | egrep "Ubuntu"
|
||||
@ -43,7 +54,7 @@ echo "This is an Ubuntu system"
|
||||
short_ver=`cat Version|cut -d. -f 1,2`
|
||||
pkg_version="${short_ver}-${pkg_type}${cur_date}"
|
||||
|
||||
mkdir -p /code/xcat-core/build
|
||||
mkdir -p $CURDIR/build
|
||||
|
||||
for rpmname in xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test; do
|
||||
rpmname_low=`echo $rpmname | tr '[A-Z]' '[a-z]'`
|
||||
@ -57,11 +68,11 @@ echo "This is an Ubuntu system"
|
||||
echo "Error: $rpmname build package failed exit code $rc"
|
||||
fi
|
||||
cd -
|
||||
mv ${rpmname_low}* /code/xcat-core/build
|
||||
mv ${rpmname_low}* $CURDIR/build
|
||||
|
||||
done
|
||||
#delete all files except .deb file
|
||||
find /code/xcat-core/build/* ! -name *.deb | xargs rm -f
|
||||
find $CURDIR/build/* ! -name *.deb | xargs rm -f
|
||||
|
||||
else
|
||||
#This is not an Ubuntu system
|
||||
@ -70,36 +81,56 @@ echo "This is an $OSNAME system"
|
||||
rm -rf /root/rpmbuild/RPMS/noarch/*
|
||||
rm -rf /root/rpmbuild/RPMS/x86_64/*
|
||||
rm -rf /root/rpmbuild/RPMS/ppc64/*
|
||||
mkdir build/
|
||||
mkdir -p $CURDIR/build/
|
||||
|
||||
#always build perl-xCAT
|
||||
$CURDIR/makerpm perl-xCAT
|
||||
|
||||
|
||||
# Build the rest of the noarch rpms
|
||||
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-test xCAT-buildkit; do
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi
|
||||
./makerpm $rpmname
|
||||
$CURDIR/makerpm $rpmname
|
||||
done
|
||||
|
||||
#build xCAT-genesis-scripts if it is x86_64 platform
|
||||
ARCH=$(uname -p)
|
||||
if [ "$ARCH" = "x64_64" ]; then
|
||||
./makerpm xCAT-genesis-scripts x86_64
|
||||
$CURDIR/makerpm xCAT-genesis-scripts x86_64
|
||||
fi
|
||||
|
||||
|
||||
# Build the xCAT and xCATsn rpms for all platforms
|
||||
for rpmname in xCAT xCATsn; do
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
./makerpm $rpmname
|
||||
$CURDIR/makerpm $rpmname
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
|
||||
else
|
||||
for arch in x86_64 ppc64 s390x; do
|
||||
./makerpm $rpmname $arch
|
||||
$CURDIR/makerpm $rpmname $arch
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
cp /root/rpmbuild/RPMS/noarch/* build/
|
||||
cp /root/rpmbuild/RPMS/x86_64/* build/
|
||||
cp /root/rpmbuild/RPMS/ppc64/* build/
|
||||
cp /root/rpmbuild/RPMS/noarch/* $CURDIR/build/
|
||||
cp /root/rpmbuild/RPMS/x86_64/* $CURDIR/build/
|
||||
cp /root/rpmbuild/RPMS/ppc64/* $CURDIR/build/
|
||||
|
||||
#begin to create repo for redhat platform
|
||||
|
||||
if [ "$OSNAME" != "AIX" ]; then
|
||||
cat >$CURDIR/build/xCAT-core.repo << EOF
|
||||
[xcat-2-core]
|
||||
name=xCAT 2 Core packages
|
||||
baseurl=file://$CURDIR/build
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
EOF
|
||||
|
||||
cp $CURDIR/build/xCAT-core.repo /etc/yum.repos.d/
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
@ -1,20 +1,21 @@
|
||||
#!/bin/sh
|
||||
# Put the version, svn revision #, and build date into the Version function in Version.pm
|
||||
|
||||
if [ -z "$1" ]
|
||||
if [ -z "$2" ]
|
||||
then
|
||||
echo "modifyUtils: Error: must specify the xCAT version as an argument" >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
VER=$1
|
||||
GITREF="git commit $2, "
|
||||
|
||||
BUILDDATE=`date`
|
||||
#echo ". '(built $BUILDDATE)'"
|
||||
|
||||
if [ "$(uname)" = "AIX" ]
|
||||
then
|
||||
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
|
||||
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${GITREF}built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
|
||||
mv xCAT/Version.pm.new xCAT/Version.pm
|
||||
else
|
||||
if [ -f "/etc/debian_version" ];then
|
||||
@ -22,5 +23,5 @@ else
|
||||
else
|
||||
FILENAME="xCAT/Version.pm"
|
||||
fi
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ $FILENAME
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${GITREF}built $BUILDDATE)'"/ $FILENAME
|
||||
fi
|
||||
|
@ -23,6 +23,8 @@ Provides: perl-xCAT = %{epoch}:%{version}
|
||||
Provides perl xCAT libraries for core functionality. Required for all xCAT installations.
|
||||
Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
|
||||
%define gitinfo %(git log -n 1 | head -n 1 | cut -f 2 -d ' ')
|
||||
|
||||
%define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi)
|
||||
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
|
||||
|
||||
@ -36,7 +38,7 @@ Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
%if %fsm
|
||||
%else
|
||||
# Modify the Version() function in xCAT/Utils.pm to automatically have the correct version
|
||||
./modifyUtils %{version}
|
||||
./modifyUtils %{version} %{gitinfo}
|
||||
|
||||
# Build the pod version of the man pages for each DB table. It puts them in the man5 and man7 subdirs.
|
||||
# Then convert the pods to man pages and html pages.
|
||||
|
@ -1568,7 +1568,18 @@ hwinv => {
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
|
||||
token => {
|
||||
cols => [qw(tokenid username expire comments disable)],
|
||||
keys => [qw(tokenid)],
|
||||
table_desc => 'The token of users for authentication.',
|
||||
descriptions => {
|
||||
tokenid => 'It is a UUID as an unified identify for the user.',
|
||||
username => 'The user name.',
|
||||
expire => 'The expire time for this token.',
|
||||
comments => 'Any user-provided notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
); # end of tabspec definition
|
||||
|
||||
|
||||
|
@ -2393,7 +2393,7 @@ sub getFreeRepoSpace {
|
||||
if ($master eq $ip) {
|
||||
# If the master IP and node IP match, then it is the management node
|
||||
my $out = `$sudo /bin/df -h /install | sed 1d`;
|
||||
$out =~ s/\h+/ /g;
|
||||
# causing problems on other platforms $out =~ s/\h+/ /g;$out =~ s/\h+/ /g;
|
||||
my @results = split(' ', $out);
|
||||
return ($results[3]);
|
||||
}
|
||||
|
@ -67,11 +67,13 @@ sub opsaddbmnode {
|
||||
|
||||
my $help;
|
||||
my $version;
|
||||
my $verbose;
|
||||
my $host;
|
||||
|
||||
if(!GetOptions(
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$version,
|
||||
'V|verbose' => \$verbose,
|
||||
's=s' => \$host,
|
||||
))
|
||||
{
|
||||
@ -243,7 +245,18 @@ sub opsaddbmnode {
|
||||
$disk = 1;
|
||||
}
|
||||
|
||||
#print "$bmc, $bmc_user, $bmc_password, $mac, $cpu, $memory, $disk\n";
|
||||
if ($verbose) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Attributes gathered from the xCAT database:";
|
||||
push @{$rsp->{data}}, " bmc=$bmc";
|
||||
push @{$rsp->{data}}, " bmc_user=$bmc_user";
|
||||
push @{$rsp->{data}}, " bmc_password=$bmc_password";
|
||||
push @{$rsp->{data}}, " mac=$mac";
|
||||
push @{$rsp->{data}}, " cpu=$cpu";
|
||||
push @{$rsp->{data}}, " memory=$memory";
|
||||
push @{$rsp->{data}}, " disk=$disk";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
#call OpenStack command to add the node into the OpenStack as
|
||||
#a baremetal node.
|
||||
@ -263,7 +276,14 @@ sub opsaddbmnode {
|
||||
}
|
||||
$cmd_tmp .= " $host $cpu $memory $disk $mac";
|
||||
|
||||
my $cmd = qq~source \~/openrc;$cmd_tmp~;
|
||||
my $cmd = qq~$cmd_tmp~;
|
||||
if ($verbose) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "The command to run on $host:";
|
||||
push @{$rsp->{data}}, " $cmd";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
#print "cmd=$cmd\n";
|
||||
my $output =
|
||||
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$host], $cmd, 0);
|
||||
@ -271,8 +291,17 @@ sub opsaddbmnode {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "OpenStack creating baremetal node $node:";
|
||||
push @{$rsp->{data}}, "$output";
|
||||
push @{$rsp->{data}}, "The command was: $cmd";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
} else {
|
||||
if (($verbose) && ($output)) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$output";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,6 +325,7 @@ sub opsaddimage {
|
||||
|
||||
my $help;
|
||||
my $version;
|
||||
my $verbose;
|
||||
#my $cloud;
|
||||
my $ops_img_names;
|
||||
my $controller;
|
||||
@ -303,6 +333,7 @@ sub opsaddimage {
|
||||
if(!GetOptions(
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$version,
|
||||
'V|verbose' => \$verbose,
|
||||
'c=s' => \$controller,
|
||||
'n=s' => \$ops_img_names,
|
||||
))
|
||||
@ -391,16 +422,46 @@ sub opsaddimage {
|
||||
}
|
||||
my $cmd_tmp = "glance image-create --name $new_name --public --disk-format qcow2 --container-format bare --property xcat_image_name=\'$image\' < /tmp/$image.qcow2";
|
||||
|
||||
my $cmd = qq~touch /tmp/$image.qcow2;source \~/openrc;$cmd_tmp;rm /tmp/$image.qcow2~;
|
||||
#print "cmd=$cmd\ncontroller=$controller\n";
|
||||
my $cmd = qq~touch /tmp/$image.qcow2;$cmd_tmp~;
|
||||
if ($verbose) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "The command to run on $controller:";
|
||||
push @{$rsp->{data}}, " $cmd";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
my $output =
|
||||
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$controller], $cmd, 0);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "OpenStack creating image $new_name:";
|
||||
push @{$rsp->{data}}, "$output";
|
||||
push @{$rsp->{data}}, "The command was: $cmd";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
} else {
|
||||
if (($verbose) && ($output)) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$output";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
my $cmd1 = qq~rm /tmp/$image.qcow2~;
|
||||
if ($verbose) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "The command to run on $controller:";
|
||||
push @{$rsp->{data}}, " $cmd1";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
my $output1 =
|
||||
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$controller], $cmd1, 0);
|
||||
if (($verbose) && ($output1)) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$output1";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -845,7 +906,7 @@ sub opsaddbmnode_usage {
|
||||
|
||||
$rsp->{data}->[0]= "Usage: opsaddbmnode -h";
|
||||
$rsp->{data}->[1]= " opsaddbmnode -v";
|
||||
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host>";
|
||||
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host> [-V]";
|
||||
$cb->($rsp);
|
||||
}
|
||||
|
||||
@ -863,7 +924,7 @@ sub opsaddimage_usage {
|
||||
|
||||
$rsp->{data}->[0]= "Usage: opsaddimage -h";
|
||||
$rsp->{data}->[1]= " opsaddimage -v";
|
||||
$rsp->{data}->[2]= " opsaddimage <image1,image2...> [-n <new_name1,new_name2...> -c <controller>";
|
||||
$rsp->{data}->[2]= " opsaddimage <image1,image2...> [-n <new_name1,new_name2...> -c <controller> [-V]";
|
||||
$cb->($rsp);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ B<opsaddbmnode> - It adds xCAT baremetal nodes to an OpenStack cloud.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<opsaddbmnode> I<noderange> B<-s> I<service_host>
|
||||
B<opsaddbmnode> I<noderange> B<-s> I<service_host> [B<-V>|B<--verbose>]
|
||||
|
||||
B<opsaddbmnode> [B<-h>|B<--help>]
|
||||
|
||||
@ -59,6 +59,8 @@ I<noderage> is a comma separated node or node group names.
|
||||
|
||||
=item B<-v|--version> The Command Version.
|
||||
|
||||
=item B<-V|--verbose> Verbose output.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
@ -4,7 +4,7 @@ B<opsaddimage> - It adds or removes nodes for the vlan.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<opsaddimage> I<image1,image2,...> B<-n> I<new_name1,new_name2,...> [B<-c> I<controller>]
|
||||
B<opsaddimage> I<image1,image2,...> B<-n> I<new_name1,new_name2,...> [B<-c> I<controller>] [B<-V>|B<--verbose>]
|
||||
|
||||
B<opsaddimage> [B<-h>|B<--help>]
|
||||
|
||||
@ -35,6 +35,8 @@ I<image1,image1...> a comma separated xCAT images names.
|
||||
|
||||
=item B<-v|--version> The Command Version.
|
||||
|
||||
=item B<-V|--verbose> Verbose output.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
@ -31,7 +31,7 @@ if (!GetOptions(
|
||||
"nonodecheck" => \$::NONODECHECK, #does not check the noderange, in this case, noderange need to be a list of nodes.
|
||||
'h|help' => \$help,
|
||||
) || $help || scalar(@ARGV)<2 ) {
|
||||
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] [--nonodecheck] <noderange> <command>\n";
|
||||
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] [--nonodecheck] [-t <timeout value in seconds>] <noderange> <command>\n";
|
||||
exit;
|
||||
}
|
||||
my %nodehdl;
|
||||
|
2
xCAT-genesis-builder/xCAT-genesis-base.spec
Normal file → Executable file
2
xCAT-genesis-builder/xCAT-genesis-base.spec
Normal file → Executable file
@ -59,4 +59,4 @@ fi
|
||||
|
||||
%Files
|
||||
%defattr(-,root,root)
|
||||
/
|
||||
/opt/xcat/share/xcat/netboot/genesis/%{tarch}
|
||||
|
@ -10,6 +10,7 @@ use xCAT::Table;
|
||||
use xCAT::MsgUtils;
|
||||
use Data::Dumper;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT::Utils;
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head1 xCAT::XCATD
|
||||
@ -270,4 +271,67 @@ sub validate {
|
||||
xCAT::MsgUtils->message("S","Request matched no policy rule: peername=$peername, peerhost=$peerhost ".$request->{command}->[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $tokentimeout = 86400; # one day
|
||||
# this subroutine search the token table
|
||||
# 1. find the existed token entry for the user and reset the expire time
|
||||
# 1.1. if not find existed token, create a new one and add it to token table
|
||||
# 2. clean up the expired token
|
||||
#
|
||||
# this subroutine is called after the account has been authorized
|
||||
sub gettoken {
|
||||
my $class=shift;
|
||||
my $req = shift;
|
||||
|
||||
my $user = $req->{gettoken}->[0]->{username}->[0];
|
||||
my $tokentb = xCAT::Table->new('token');
|
||||
unless ($tokentb) {
|
||||
return undef;
|
||||
}
|
||||
my $tokens = $tokentb->getAllEntries;
|
||||
my $expiretime = time() + $tokentimeout;
|
||||
foreach my $token (@{$tokens}) {
|
||||
if ($token->{username} eq $user) {
|
||||
#delete old token
|
||||
$tokentb->delEntries({'tokenid'=>$token->{tokenid}});
|
||||
} else {
|
||||
#clean the expired token
|
||||
if ($token->{expire} > $expiretime) {
|
||||
$tokentb->delEntries({'tokenid'=>$token->{tokenid}});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# create a new token for this request
|
||||
my $uuid = xCAT::Utils->genUUID();
|
||||
$tokentb->setAttribs({tokenid=>$uuid, username => $user}, {expire => $expiretime});
|
||||
$tokentb->close();
|
||||
|
||||
return ($uuid, $expiretime);
|
||||
}
|
||||
|
||||
# verify the token has correct entry in token table and expire time is not exceeded.
|
||||
sub verifytoken {
|
||||
my $class=shift;
|
||||
my $req = shift;
|
||||
|
||||
my $tokenid = $req->{tokens}->[0]->{tokenid}->[0];
|
||||
my $tokentb = xCAT::Table->new('token');
|
||||
unless ($tokentb) {
|
||||
return undef;
|
||||
}
|
||||
my $token = $tokentb->getAttribs({'tokenid' => $tokenid}, ('username', 'expire'));
|
||||
if (defined ($token) && defined ($token->{'username'}) && defined ($token->{'expire'})) {
|
||||
my $expiretime = time() + $tokentimeout;
|
||||
if ($token->{'expire'} < time()) {
|
||||
$tokentb->delEntries({'tokenid'=>$token->{tokenid}});
|
||||
return undef;
|
||||
} else {
|
||||
return $token->{'username'};
|
||||
}
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -663,6 +663,11 @@ sub mkinstall
|
||||
|
||||
my $prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform";
|
||||
my $postscript = "$::XCATROOT/share/xcat/install/scripts/post.$platform";
|
||||
|
||||
# for powerkvm VM ubuntu LE#
|
||||
if ($arch =~ /ppc64/i and $platform eq "ubuntu") {
|
||||
$prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform.ppc64";
|
||||
}
|
||||
|
||||
if (-r "$prescript"){
|
||||
$preerr =
|
||||
@ -687,6 +692,12 @@ sub mkinstall
|
||||
$callback->({node =>[{name => [$node], error => [$errtmp], errorcode => [1]}]});
|
||||
next;
|
||||
}
|
||||
|
||||
if ($arch =~ /ppc64/i and !(-e "$pkgdir/install/netboot/initrd.gz")) {
|
||||
$callback->({error => ["The netboot initrd not found in $pkgdir/install/netboot, pls download first"],
|
||||
errorcode=>[1]});
|
||||
next;
|
||||
}
|
||||
my $tftpdir = "/tftpboot";
|
||||
|
||||
# create the node-specific post scripts
|
||||
@ -697,7 +708,7 @@ sub mkinstall
|
||||
|
||||
if (
|
||||
(
|
||||
$arch =~ /x86/ and
|
||||
($arch =~ /x86/ and
|
||||
(
|
||||
( -r "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
|
||||
and $kernpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
|
||||
@ -710,6 +721,14 @@ sub mkinstall
|
||||
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
|
||||
)
|
||||
)
|
||||
) or (
|
||||
$arch =~ /ppc64/i and (
|
||||
-r "$pkgdir/install/vmlinux"
|
||||
and $kernpath = "$pkgdir/install/vmlinux"
|
||||
and -r "$pkgdir/install/netboot/initrd.gz"
|
||||
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
){
|
||||
|
@ -323,7 +323,9 @@ sub setdestiny {
|
||||
noupdateinitrd=>$noupdateinitrd,
|
||||
ignorekernelchk=>$ignorekernelchk,}, \&relay_response);
|
||||
if ($errored) {
|
||||
$callback->({error=>"Some nodes failed to set up $state resources, aborting"});
|
||||
my @myself = xCAT::NetworkUtils->determinehostname();
|
||||
my $myname = $myself[(scalar @myself)-1];
|
||||
$callback->({error=>"Some nodes failed to set up $state resources on server $myname, aborting"});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -881,8 +881,8 @@ sub check_options
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback, 0);
|
||||
return 0;
|
||||
}
|
||||
# if not help, dhcpd needs to be running
|
||||
if (!($opt->{h})) {
|
||||
# if not help and not -n, dhcpd needs to be running
|
||||
if (!($opt->{h})&& (!($opt->{n}))) {
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
my @output = xCAT::Utils->runcmd("service dhcpd status", -1);
|
||||
if ($::RUNCMD_RC != 0) { # not running
|
||||
|
@ -449,7 +449,7 @@ sub process_makeroutes {
|
||||
delete_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name, $route_hash->{ifname});
|
||||
}
|
||||
else {
|
||||
set_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name,$route_hash->{ifname});
|
||||
set_route($callback, $route_hash->{net}, $route_hash->{mask}, $gw_ip, $gw_name, $route_hash->{ifname});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -526,6 +526,7 @@ sub route_exists {
|
||||
my $mask = shift;
|
||||
my $gw_ip = shift;
|
||||
my $gw=shift;
|
||||
my $ifname = shift;
|
||||
|
||||
my $islinux=xCAT::Utils->isLinux();
|
||||
|
||||
@ -557,7 +558,8 @@ sub route_exists {
|
||||
my $net1=$a[0];
|
||||
my $mask1=$a[2];
|
||||
my $gw1=$a[1];
|
||||
if (($net1 eq $net) && ($mask1 eq $mask) && (($gw1 eq $gw) || ($gw1 eq $gw_ip))) {
|
||||
my $ifname1=$a[7];
|
||||
if (($net1 eq $net) && ($mask1 eq $mask) && (($gw1 eq $gw) || ($gw1 eq $gw_ip) || ($ifname1 eq $ifname))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -602,20 +604,24 @@ sub set_route {
|
||||
#print "set_route get called\n";
|
||||
|
||||
my $result;
|
||||
if (!route_exists($net, $mask, $gw_ip, $gw)) {
|
||||
if (!route_exists($net, $mask, $gw_ip, $gw, $ifname)) {
|
||||
#set temporay route
|
||||
my $cmd;
|
||||
# ipv6 network
|
||||
if ($net =~ /:/) {
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
$cmd="ip -6 route add $net/$mask via $gw_ip";
|
||||
if ( $gw_ip == "" || $gw_ip == "::" ) {
|
||||
$cmd="ip -6 route add $net/$mask dev $ifname";
|
||||
} else {
|
||||
$cmd="ip -6 route add $net/$mask via $gw_ip";
|
||||
}
|
||||
} else {
|
||||
# AIX TODO
|
||||
}
|
||||
} else {
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
|
||||
$cmd="route add -net $net netmask $mask dev $ifname";
|
||||
$cmd="route add -net $net netmask $mask dev $ifname";
|
||||
} else {
|
||||
$cmd="route add -net $net netmask $mask gw $gw_ip";
|
||||
}
|
||||
@ -680,18 +686,26 @@ sub delete_route {
|
||||
#print "delete_route get called\n";
|
||||
|
||||
my $result;
|
||||
if (route_exists($net, $mask, $gw_ip, $gw)) {
|
||||
if (route_exists($net, $mask, $gw_ip, $gw, $ifname)) {
|
||||
#delete route temporarily
|
||||
my $cmd;
|
||||
if ($net =~ /:/) {
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
$cmd = "ip -6 route delete $net/$mask via $gw_ip";
|
||||
if ( $gw_ip == "" || $gw_ip == "::" ) {
|
||||
$cmd = "ip -6 route delete $net/$mask dev $ifname";
|
||||
} else {
|
||||
$cmd = "ip -6 route delete $net/$mask via $gw_ip";
|
||||
}
|
||||
} else {
|
||||
# AIX TODO
|
||||
}
|
||||
} else {
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
$cmd="route delete -net $net netmask $mask gw $gw_ip";
|
||||
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
|
||||
$cmd="route delete -net $net netmask $mask dev $ifname";
|
||||
} else {
|
||||
$cmd="route delete -net $net netmask $mask gw $gw_ip";
|
||||
}
|
||||
} else {
|
||||
$cmd="route delete -net $net -netmask $mask $gw_ip";
|
||||
}
|
||||
@ -831,14 +845,22 @@ sub addPersistentRoute_Sles {
|
||||
#print "old output=" . join("\n", @output) . "\n";
|
||||
my $hasConfiged=0;
|
||||
if (@output && (@output > 0)) {
|
||||
$hasConfiged=checkConfig_Sles($net, $mask, $gw_ip, $gw, \@output);
|
||||
$hasConfiged=checkConfig_Sles($net, $mask, $gw_ip, $gw, $ifname, \@output);
|
||||
}
|
||||
#print "hasConfiged=$hasConfiged\n";
|
||||
my $new_config;
|
||||
if ($net =~ /:/) {
|
||||
$new_config = "$net/$mask $gw_ip - -\n";
|
||||
if ( $gw_ip == "" || $gw_ip == "::" ) {
|
||||
$new_config = "$net/$mask :: - $ifname\n";
|
||||
} else {
|
||||
$new_config = "$net/$mask $gw_ip - -\n";
|
||||
}
|
||||
} else {
|
||||
$new_config="$net $gw_ip $mask $ifname\n";
|
||||
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
|
||||
$new_config="$net 0.0.0.0 $mask $ifname\n";
|
||||
} else {
|
||||
$new_config="$net $gw_ip $mask $ifname\n";
|
||||
}
|
||||
}
|
||||
if (!$hasConfiged) {
|
||||
push(@output, $new_config);
|
||||
@ -876,7 +898,7 @@ sub deletePersistentRoute_Sles {
|
||||
my @new_output=();
|
||||
my $bigfound=0;
|
||||
foreach my $tmp_conf (@output) {
|
||||
my $found = checkConfig_Sles($net, $mask, $gw_ip, $gw, [$tmp_conf]);
|
||||
my $found = checkConfig_Sles($net, $mask, $gw_ip, $gw, $ifname, [$tmp_conf]);
|
||||
if (!$found) {
|
||||
push(@new_output, $tmp_conf);
|
||||
} else {
|
||||
@ -913,13 +935,18 @@ sub checkConfig_Sles {
|
||||
my $mask = shift;
|
||||
my $gw_ip = shift;
|
||||
my $gw=shift;
|
||||
my $ifname=shift;
|
||||
my $output=shift;
|
||||
|
||||
# Format:
|
||||
# DESTINATION GATEWAY NETMASK INTERFACE
|
||||
# DESTINATION/PREFIXLEN GATEWAY - INTERFACE
|
||||
|
||||
# ipv4 format: 192.168.0.0 207.68.156.51 255.255.0.0 eth1
|
||||
# ipv6 format: fd59::/64 fd57:faaf:e1ab:336:21a:64ff:fe01:1 - -
|
||||
foreach my $line (@$output) {
|
||||
my @a=split(' ', $line);
|
||||
my ($net1,$mask1,$gw1);
|
||||
my ($net1,$mask1,$gw1,$ifname1);
|
||||
if ($net =~ /:/) {
|
||||
if (@a>0) {
|
||||
my $ipv6net = $a[0];
|
||||
@ -929,6 +956,10 @@ sub checkConfig_Sles {
|
||||
$gw1=$a[1];
|
||||
if ($gw1 eq '-') { $gw1=$gw_ip; }
|
||||
}
|
||||
if (@a>3) {
|
||||
$ifname1=$a[3];
|
||||
if ($ifname1 eq '-') { $ifname1=$ifname;}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (@a>0) {
|
||||
@ -943,10 +974,14 @@ sub checkConfig_Sles {
|
||||
$mask1=$a[2];
|
||||
if ($mask1 eq '-') { $mask1=$mask;}
|
||||
}
|
||||
if (@a>3) {
|
||||
$ifname1=$a[3];
|
||||
if ($ifname1 eq '-') { $ifname1=$ifname;}
|
||||
}
|
||||
}
|
||||
|
||||
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip\n";
|
||||
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip))) {
|
||||
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip ifname=$ifname1\n";
|
||||
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip) || ($ifname1 && $ifname1 eq $ifname))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -970,13 +1005,13 @@ sub addPersistentRoute_RH {
|
||||
if ($net =~ /:/) {
|
||||
$filename="/etc/sysconfig/static-routes-ipv6";
|
||||
} else {
|
||||
$filename="/etc/sysconfig/sysconfig/route-$ifname";
|
||||
$filename="/etc/sysconfig/static-routes";
|
||||
}
|
||||
my @output=getConfig($filename);
|
||||
#print "old output=" . join("\n", @output) . "\n";
|
||||
my $hasConfiged=0;
|
||||
if (@output && (@output > 0)) {
|
||||
$hasConfiged=checkConfig_RH($net, $mask, $gw_ip, $gw, \@output);
|
||||
$hasConfiged=checkConfig_RH($net, $mask, $gw_ip, $gw, $ifname, \@output);
|
||||
}
|
||||
#print "hasConfiged=$hasConfiged\n";
|
||||
my $new_config;
|
||||
@ -991,7 +1026,11 @@ sub addPersistentRoute_RH {
|
||||
|
||||
$new_config="$ifname $net/$mask $gw_ip";
|
||||
} else {
|
||||
$new_config="$net/$mask via $gw_ip dev $ifname\n";
|
||||
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
|
||||
$new_config="any net $net netmask $mask dev $ifname\n";
|
||||
} else {
|
||||
$new_config="any net $net netmask $mask gw $gw_ip\n";
|
||||
}
|
||||
}
|
||||
if (!$hasConfiged) {
|
||||
push(@output, $new_config);
|
||||
@ -1028,14 +1067,14 @@ sub deletePersistentRoute_RH {
|
||||
if ($net =~ /:/) {
|
||||
$filename="/etc/sysconfig/static-routes-ipv6";
|
||||
} else {
|
||||
$filename="/etc/sysconfig/network-scripts/route-$ifname";
|
||||
$filename="/etc/sysconfig/static-routes";
|
||||
}
|
||||
my @output=getConfig($filename);
|
||||
#print "old output=" . join("\n", @output) . "\n";
|
||||
my @new_output=();
|
||||
my $bigfound=0;
|
||||
foreach my $tmp_conf (@output) {
|
||||
my $found = checkConfig_RH($net, $mask, $gw_ip, $gw, [$tmp_conf]);
|
||||
my $found = checkConfig_RH($net, $mask, $gw_ip, $gw, $ifname, [$tmp_conf]);
|
||||
if (!$found) {
|
||||
push(@new_output, $tmp_conf);
|
||||
} else {
|
||||
@ -1050,7 +1089,7 @@ sub deletePersistentRoute_RH {
|
||||
if ($net =~ /:/) {
|
||||
$rsp->{data}->[0]= "$host: Removed persistent route \"$ifname $net/$mask $gw_ip\" from $filename.";
|
||||
} else {
|
||||
$rsp->{data}->[0]= "$host: Removed persistent route \"$net/$mask via $gw_ip dev $ifname\" from $filename.";
|
||||
$rsp->{data}->[0]= "$host: Removed persistent route \"any net $net netmask $mask gw $gw_ip $ifname\" from $filename.";
|
||||
}
|
||||
$callback->($rsp);
|
||||
} else {
|
||||
@ -1058,7 +1097,7 @@ sub deletePersistentRoute_RH {
|
||||
if ($net =~ /:/) {
|
||||
$rsp->{data}->[0]= "$host: Persistent route \"$ifname $net/$mask $gw_ip\" does not exist in $filename.";
|
||||
} else {
|
||||
$rsp->{data}->[0]= "$host: Persistent route \"$net/$mask via $gw_ip dev $ifname\" does not exist in $filename.";
|
||||
$rsp->{data}->[0]= "$host: Persistent route \"any net $net netmask $mask gw $gw_ip $ifname\" does not exist in $filename.";
|
||||
}
|
||||
$callback->($rsp);
|
||||
}
|
||||
@ -1069,14 +1108,16 @@ sub checkConfig_RH {
|
||||
my $mask = shift;
|
||||
my $gw_ip = shift;
|
||||
my $gw=shift;
|
||||
my $ifname=shift;
|
||||
my $output=shift;
|
||||
|
||||
foreach my $line (@$output) {
|
||||
my @a=split(' ', $line);
|
||||
#The format is: any net 172.16.0.0 netmask 255.240.0.0 gw 192.168.0.1 eth0
|
||||
# ipv6 format: eth1 fd60::/64 fd57::214:5eff:fe15:1
|
||||
my ($net1,$mask1,$gw1);
|
||||
my ($net1,$mask1,$gw1,$ifname1);
|
||||
if ($net =~ /:/) {
|
||||
$ifname1 = $a[0];
|
||||
if (@a>1) {
|
||||
my $ipv6net = $a[1];
|
||||
($net1,$mask1) = split("/",$ipv6net);
|
||||
@ -1094,13 +1135,18 @@ sub checkConfig_RH {
|
||||
if ($mask1 eq '-') { $mask1=$mask;}
|
||||
}
|
||||
if (@a>6) {
|
||||
$gw1=$a[6];
|
||||
if ($gw1 eq '-') { $gw1=$gw_ip; }
|
||||
if ( $a[5] eq 'dev' ) {
|
||||
$ifname1=$a[6];
|
||||
if ($ifname1 eq '-') { $ifname1=$ifname;}
|
||||
} else {
|
||||
$gw1=$a[6];
|
||||
if ($gw1 eq '-') { $gw1=$gw_ip; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip\n";
|
||||
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip))) {
|
||||
#print "net=$net1,$net mask=$mask1,$mask gw=$gw1,$gw_ip ifname=$ifname1,ifname\n";
|
||||
if (($net1 && $net1 eq $net) && ($mask1 && $mask1 eq $mask) && (($gw1 && $gw1 eq $gw) || ($gw1 && $gw1 eq $gw_ip) || ($ifname1 && $ifname1 eq $ifname))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -1124,15 +1170,20 @@ sub addPersistentRoute_Debian{
|
||||
|
||||
#ipv6
|
||||
if ( $net =~ /:/){
|
||||
$cmd = "grep \"$net/$mask gw $gw_ip\" $conf_file";
|
||||
$route_conf = " up route -A inet6 add $net/$mask gw $gw_ip \n down route -A inet6 del $net/$mask gw $gw_ip \n";
|
||||
if ( $gw_ip == "" || $gw_ip == "::" ) {
|
||||
$cmd = "grep \"$net/$mask dev $ifname\" $conf_file";
|
||||
$route_conf = " up route -A inet6 add $net/$mask dev $ifname \n down route -A inet6 del $net/$mask dev $ifname \n";
|
||||
} else {
|
||||
$cmd = "grep \"$net/$mask gw $gw_ip\" $conf_file";
|
||||
$route_conf = " up route -A inet6 add $net/$mask gw $gw_ip \n down route -A inet6 del $net/$mask gw $gw_ip \n";
|
||||
}
|
||||
}
|
||||
else { #ipv4
|
||||
$cmd = "grep \"-net $net netmask $mask gw $gw_ip\" $conf_file";
|
||||
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
|
||||
$route_conf = " up route add -net $net netmask $mask dev $ifname \n down route del -net $net netmask $mask dev $ifname\n";
|
||||
$route_conf = " up route add -net $net netmask $mask dev $ifname \n down route del -net $net netmask $mask dev $ifname \n";
|
||||
} else {
|
||||
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip\n";
|
||||
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1191,10 +1242,18 @@ sub deletePersistentRoute_Debian{
|
||||
preParse_Debian();
|
||||
#ipv6
|
||||
if ( $net =~ /:/){
|
||||
$match = "$net/$mask gw $gw_ip";
|
||||
if ( $gw_ip == "" || $gw_ip == "::" ) {
|
||||
$match = "$net/$mask dev $ifname";
|
||||
} else {
|
||||
$match = "$net/$mask gw $gw_ip";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$match = "net $net netmask $mask gw $gw_ip";
|
||||
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
|
||||
$match = "net $net netmask $mask dev $ifname";
|
||||
} else {
|
||||
$match = "net $net netmask $mask gw $gw_ip";
|
||||
}
|
||||
}
|
||||
|
||||
open(FH, "<", $conf_file);
|
||||
|
@ -412,7 +412,7 @@ sub mkinstall
|
||||
$custmplpath = "$installroot/custom/install/hyperv";
|
||||
$tmplpath = "$::XCATROOT/share/xcat/install/hyperv";
|
||||
}
|
||||
my $tmplfile=xCAT::SvrUtils::get_tmpl_file_name($custmplpath, $profile, $os, $arch);
|
||||
$tmplfile=xCAT::SvrUtils::get_tmpl_file_name($custmplpath, $profile, $os, $arch);
|
||||
if (! $tmplfile) { $tmplfile=xCAT::SvrUtils::get_tmpl_file_name($tmplpath, $profile, $os, $arch); }
|
||||
}
|
||||
|
||||
|
@ -590,11 +590,11 @@ sub usage
|
||||
my $usagemsg2="";
|
||||
if ($command eq "mkzone") {
|
||||
$usagemsg1 = " mkzone -h \n mkzone -v \n";
|
||||
$usagemsg2 = " mkzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key] \n [-a <noderange>] [-g] [-f] [-s <yes/no>]";
|
||||
$usagemsg2 = " mkzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key>] \n [-a <noderange>] [-g] [-f] [-s <yes/no>]";
|
||||
} else {
|
||||
if ($command eq "chzone") {
|
||||
$usagemsg1 = " chzone -h \n chzone -v \n";
|
||||
$usagemsg2 = " chzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key] \n [-K] [-a <noderange>] [-r <noderange>] [-g] [-s <yes/no>]";
|
||||
$usagemsg2 = " chzone <zonename> [-V] [--defaultzone] [-k <full path to the ssh RSA private key>] \n [-K] [-a <noderange>] [-r <noderange>] [-g] [-s <yes/no>]";
|
||||
} else {
|
||||
if ($command eq "rmzone") {
|
||||
$usagemsg1 = " rmzone -h \n rmzone -v \n";
|
||||
|
@ -328,35 +328,42 @@ sleep 0.05; #up to 50 ms outage possible
|
||||
my $conn;
|
||||
next unless $conn = $socket->accept;
|
||||
|
||||
my @clients;
|
||||
if ($inet6support) {
|
||||
@clients = gethostbyaddr($conn->peeraddr,AF_INET6);
|
||||
unless (@clients) { @clients = gethostbyaddr($conn->peeraddr,AF_INET); }
|
||||
} else {
|
||||
@clients = gethostbyaddr($conn->peeraddr,AF_INET);
|
||||
}
|
||||
my $client_name;
|
||||
my $client_aliases;
|
||||
my @clients;
|
||||
if ($inet6support) {
|
||||
($client_name,$client_aliases) = gethostbyaddr($conn->peeraddr,AF_INET6);
|
||||
unless ($client_name) { ($client_name,$client_aliases) = gethostbyaddr($conn->peeraddr,AF_INET); }
|
||||
} else {
|
||||
($client_name,$client_aliases) = gethostbyaddr($conn->peeraddr,AF_INET);
|
||||
}
|
||||
|
||||
$clients[0] = $client_name;
|
||||
if ($client_aliases) {
|
||||
push @clients, split(/\s+/,$client_aliases);
|
||||
}
|
||||
|
||||
my $validclient=0;
|
||||
my $node;
|
||||
my $domain;
|
||||
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains(\@clients);
|
||||
my %nodedomains = %{$nd};
|
||||
|
||||
foreach my $client (@clients) {
|
||||
$domain = $nodedomains{$client};
|
||||
my @ndn = ($client);
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains(\@ndn);
|
||||
my %nodedomains = %{$nd};
|
||||
$domain = $nodedomains{$client};
|
||||
$client =~ s/\..*//;
|
||||
if ($domain) {
|
||||
$client =~ s/\.$domain//;
|
||||
} else {
|
||||
$client =~ s/\..*//;
|
||||
if ($domain) {
|
||||
$client =~ s/\.$domain//;
|
||||
} else {
|
||||
$client =~ s/\..*//;
|
||||
}
|
||||
#ensure this is coming from a node IP at least
|
||||
($node) = noderange($client);
|
||||
if ($node) { #Means the source isn't valid
|
||||
$validclient=1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
#ensure this is coming from a node IP at least
|
||||
($node) = noderange($client);
|
||||
if ($node) { #Means the source isn't valid
|
||||
$validclient=1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
unless ($validclient) {
|
||||
@ -2089,6 +2096,40 @@ sub service_connection {
|
||||
delete($req->{becomeuser}); #Remove it to keep it from view
|
||||
}
|
||||
|
||||
# If the request is to aquire a token for a specific account
|
||||
if (defined $req->{gettoken}) {
|
||||
# authencitate the username:password
|
||||
$peername=becomeuser($req->{gettoken}->[0]->{username}->[0],
|
||||
$req->{gettoken}->[0]->{password}->[0]);
|
||||
my $resp;
|
||||
if ($peername) {
|
||||
# for a valid account, get a token
|
||||
my ($tokenid, $exptime) = xCAT::xcatd->gettoken($req);
|
||||
my ($sec,$min,$hour,$mday,$mon,$year) = localtime($exptime);
|
||||
$year += 1900;
|
||||
my $htime = "$year-$mon-$mday $hour:$min:$sec";
|
||||
$resp = {data=>[{token => [{id => $tokenid, expire => $htime}]}]};
|
||||
} else {
|
||||
$resp={error=>["Authentication failure"],errorcode=>[1]};
|
||||
}
|
||||
$resp->{serverdone}=[ undef ] ;
|
||||
send_response($resp,$sock);
|
||||
return;
|
||||
}
|
||||
|
||||
# If user trying to use 'token' to authenticate
|
||||
if (defined $req->{tokens}) {
|
||||
# get the valid user name by the token id
|
||||
$peername = xCAT::xcatd->verifytoken($req);
|
||||
unless (defined $peername) {
|
||||
my $resp={error=>["Authentication failure"],errorcode=>[1]};
|
||||
$resp->{serverdone}=[ undef ] ;
|
||||
send_response($resp,$sock);
|
||||
return;
|
||||
}
|
||||
delete($req->{tokenid});
|
||||
}
|
||||
|
||||
#we have a full request..
|
||||
#printf $request."\n";
|
||||
$request="";
|
||||
|
148
xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64
Normal file
148
xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64
Normal file
@ -0,0 +1,148 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -c /dev/vcs ]; then
|
||||
mknod /dev/vcs c 7 0
|
||||
fi
|
||||
|
||||
debconf-get open-iscsi/targets > /tmp/q
|
||||
|
||||
cat >/tmp/foo.sh <<EOF
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# If no arguments:
|
||||
#
|
||||
# 1) Start child process to connect as client to master, and re-execute this script to send
|
||||
# "installmonitor" to master. Do not wait for child process.
|
||||
#
|
||||
# 2) Loop forever. For each iteration, start child process as server waiting for a client
|
||||
# connection. Once a connection is established, child process re-executes this script to
|
||||
# handle request from that particular client.
|
||||
#
|
||||
|
||||
if [ \$# -eq 0 ]; then
|
||||
xcatdhost="#XCATVAR:XCATMASTER#"
|
||||
xcatdport="#TABLE:site:key=xcatiport:value#"
|
||||
NODESTATUS="#TABLEBLANKOKAY:site:key=nodestatus:value#"
|
||||
|
||||
|
||||
/usr/bin/nc "\$xcatdhost" "\$xcatdport" -e /tmp/foo.sh install_monitor &
|
||||
|
||||
if [ -z "\$NODESTATUS" ] || [ "\$NODESTATUS" != "0" -a "\$NODESTATUS" != "N" -a "\$NODESTATUS" != "n" ];
|
||||
then
|
||||
|
||||
/usr/bin/nc "\$xcatdhost" "\$xcatdport" -e /tmp/foo.sh installstatus installing &
|
||||
|
||||
fi
|
||||
|
||||
while true; do
|
||||
/usr/bin/nc -l -p 3001 -e /tmp/foo.sh serve_client
|
||||
done
|
||||
|
||||
exit 1 # never reached; reboot ends this
|
||||
fi
|
||||
|
||||
#
|
||||
# If the script was called with the "install_monitor" argument, stdin and stdout are
|
||||
# connected to an xCAT daemon on the master. Write the "installmonitor" request to the
|
||||
# daemon.
|
||||
#
|
||||
|
||||
if [ "\$1" = "install_monitor" ]; then
|
||||
cmd=""
|
||||
while [ "\$cmd" != "done" ]; do
|
||||
read cmd remainder
|
||||
|
||||
if [ "\$cmd" == "ready" ]; then
|
||||
echo "installmonitor"
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
# If the script was called with the "installstatus" argument, stdin and stdout are
|
||||
# connected to an xCAT daemon on the master.
|
||||
# Write the "installstatus xx" request to the daemon to update thenode installation status.
|
||||
if [ "\$1" = "installstatus" ]; then
|
||||
cmd=""
|
||||
while [ "\$cmd" != "done" ]; do
|
||||
read cmd remainder
|
||||
|
||||
if [ "\$cmd" == "ready" ]; then
|
||||
echo "installstatus \$2"
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# When execution reaches here, script called with "serve_client" argument, which means
|
||||
# stdin and stdout are connected to a client. Read the request from the client, provide
|
||||
# the answer to the client, and terminate.
|
||||
#
|
||||
|
||||
read cmd arg remainder
|
||||
|
||||
case "\$cmd" in
|
||||
# "sh") #TODO: ENABLE IF DEBUG
|
||||
# output=\$(eval \$arg \$remainder)
|
||||
# echo "\$output"
|
||||
# echo "EOO"
|
||||
# ;;
|
||||
|
||||
"screendump")
|
||||
output=\$(eval chvt \$arg; cat /dev/vcs)
|
||||
echo "\$output"
|
||||
;;
|
||||
|
||||
"stat")
|
||||
sedcmds='/^[^ ]+ +[^ ]+ +install /h; \${ g; s,^[^ ]+ +[^ ]+ +install +([^ ]+) +[^ ]+ ([^ ]+).*,installing \1 \2,; p }'
|
||||
output=\$(sed -nre "\$sedcmds" /target/var/log/dpkg.log 2>/dev/null)
|
||||
|
||||
if [ -z "\$output" ]; then
|
||||
output="installing prep"
|
||||
fi
|
||||
|
||||
echo "\$output"
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
chmod 755 /tmp/foo.sh
|
||||
|
||||
/tmp/foo.sh >/tmp/foo.log 2>&1 &
|
||||
|
||||
|
||||
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
echo "ubuntu-efi ::" > /tmp/partitioning
|
||||
echo " 512 512 1024 fat16" >> /tmp/partitioning
|
||||
echo ' $iflabel{ gpt } $reusemethod{ } method{ efi } format{ }' >> /tmp/partitioning
|
||||
echo " ." >> /tmp/partitioning
|
||||
else
|
||||
echo "ubuntu-boot ::" > /tmp/partitioning
|
||||
|
||||
echo "8 1 1 prep" >> /tmp/partitioning
|
||||
echo ' $primary{ } $bootable{ } method{ prep }' >> /tmp/partitioning
|
||||
echo " ." >> /tmp/partitioning
|
||||
|
||||
echo "100 50 100 ext4" >> /tmp/partitioning
|
||||
echo ' $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ /boot }' >> /tmp/partitioning
|
||||
echo " ." >> /tmp/partitioning
|
||||
fi
|
||||
echo "500 10000 1000000000 ext4" >> /tmp/partitioning
|
||||
echo " method{ format } format{ } use_filesystem{ } filesystem{ ext4 } mountpoint{ / }" >> /tmp/partitioning
|
||||
echo " ." >> /tmp/partitioning
|
||||
echo "2048 512 300% linux-swap" >> /tmp/partitioning
|
||||
echo " method{ swap } format{ }" >> /tmp/partitioning
|
||||
echo " ." >> /tmp/partitioning
|
||||
exit 0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,19 +16,23 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
|
||||
AutoReqProv: no
|
||||
%endif
|
||||
|
||||
# AIX will build with an arch of "ppc"
|
||||
# also need to fix Requires for AIX
|
||||
%ifos linux
|
||||
BuildArch: noarch
|
||||
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser grub2-xcat
|
||||
Obsoletes: atftp-xcat
|
||||
%endif
|
||||
|
||||
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
|
||||
|
||||
%define pcm %(if [ "$pcm" = "1" ];then echo 1; else echo 0; fi)
|
||||
%define notpcm %(if [ "$pcm" = "1" ];then echo 0; else echo 1; fi)
|
||||
|
||||
# AIX will build with an arch of "ppc"
|
||||
# also need to fix Requires for AIX
|
||||
%ifos linux
|
||||
BuildArch: noarch
|
||||
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser
|
||||
Obsoletes: atftp-xcat
|
||||
%endif
|
||||
|
||||
%if %notpcm
|
||||
Requires: grub2-xcat
|
||||
%endif
|
||||
|
||||
%if %fsm
|
||||
# nothing needed here
|
||||
%else
|
||||
|
@ -4,24 +4,45 @@ package genrestapidoc;
|
||||
|
||||
my @apigroups = (
|
||||
{
|
||||
groupname => 'node',
|
||||
groupname => 'tokens',
|
||||
header => "Token Resources",
|
||||
desc => "The URI list which can be used to create tokens for account .",
|
||||
resources => ['tokens'],
|
||||
},
|
||||
{
|
||||
groupname => 'nodes',
|
||||
header => "Node Resources",
|
||||
desc => "The URI list which can be used to create, query, change and manage nodes.",
|
||||
resources => ['allnode', 'nodeallattr', 'nodeattr', 'power', 'energy', 'energyattr', 'serviceprocessor', 'nextboot',
|
||||
'vitals', 'vitalsattr', 'inventory', 'inventoryattr', 'eventlog', 'beacon', 'bootstat',
|
||||
'updating','filesyncing','software_maintenance','postscript', 'nodeshell', 'nodecopy',]
|
||||
desc => "The URI list which can be used to create, query, change and manage node objects.",
|
||||
resources => ['allnode', 'nodeallattr', 'nodeattr', 'nodehost', 'nodedns', 'nodedhcp', 'nodestat', 'subnodes',
|
||||
'power', 'energy', 'energyattr', 'serviceprocessor', 'nextboot', 'bootstate',
|
||||
'vitals', 'vitalsattr', 'inventory', 'inventoryattr', 'eventlog', 'beacon',
|
||||
'updating','filesyncing','software_maintenance','postscript', 'nodeshell', 'nodecopy',
|
||||
]
|
||||
},
|
||||
{
|
||||
groupname => 'groups',
|
||||
header => "Group Resources",
|
||||
desc => "The URI list which can be used to create, query, change and manage group objects.",
|
||||
resources => ['all_groups','group_allattr','group_attr',
|
||||
]
|
||||
},
|
||||
{
|
||||
groupname => 'services',
|
||||
header => "Services Resources",
|
||||
desc => "The URI list which can be used to manage the dns and dhcp services on xCAT MN.",
|
||||
resources => ['dns','dhcp','host', 'slpnodes', 'specific_slpnodes',]
|
||||
},
|
||||
{
|
||||
groupname => 'policy',
|
||||
header => "Policy Resources",
|
||||
desc => "URI list which can be used to create, query, change and manage policy entries.",
|
||||
desc => "The URI list which can be used to create, query, change and manage policy entries.",
|
||||
resources => ['policy', 'policy_allattr', 'policy_attr']
|
||||
},
|
||||
{
|
||||
groupname => 'globalconf',
|
||||
header => "Global Configuration Resources",
|
||||
desc => "URI list which can be used to create, query, change global configuration.",
|
||||
resources => ['all_site']
|
||||
desc => "The URI list which can be used to create, query, change global configuration.",
|
||||
resources => ['all_site', 'site']
|
||||
},
|
||||
{
|
||||
groupname => 'table',
|
||||
@ -29,6 +50,12 @@ my @apigroups = (
|
||||
desc => "URI list which can be used to create, query, change global configuration.",
|
||||
resources => ['table_nodes', 'table_rows']
|
||||
},
|
||||
{
|
||||
groupname => 'osimage',
|
||||
header => "Osimage resources",
|
||||
desc => "URI list which can be used to query, create osimage resources.",
|
||||
resources => ['osimage', 'osimage_allattr']
|
||||
},
|
||||
{
|
||||
# groupname => 'network',
|
||||
resources => ['network', 'network_allattr']
|
||||
@ -91,7 +118,7 @@ sub outtext {
|
||||
push @errmsg, "Error format in:[".$def->{desc}."]\n";
|
||||
}
|
||||
|
||||
if ($parts[2] && $parts[3] && $parts[4]) {
|
||||
if ($parts[2] && $parts[3] && ($parts[4] || $opt ne "GET")) {
|
||||
my ($uri, $data);
|
||||
if ($parts[3] =~ /\s+/) {
|
||||
($uri, $data) = split(/ /, $parts[3]);
|
||||
@ -168,7 +195,7 @@ sub outwiki {
|
||||
push @errmsg, "Error format for:[".$def->{desc}."]\n";
|
||||
}
|
||||
|
||||
if ($parts[2] && $parts[3] && $parts[4]) {
|
||||
if ($parts[2] && $parts[3] && ($parts[4] || $opt ne "GET")) {
|
||||
my ($uri, $data);
|
||||
if ($parts[3] =~ /\s+/) {
|
||||
($uri, $data) = split(/ /, $parts[3]);
|
||||
@ -239,9 +266,14 @@ sub gendoc {
|
||||
} else {
|
||||
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{PUT}, "PUT", $URIdef->{$groupname}->{$res});
|
||||
}
|
||||
$headdone = 1;
|
||||
}
|
||||
if (defined ($URIdef->{$groupname}->{$res}->{POST})) {
|
||||
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST");
|
||||
if ($headdone) {
|
||||
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST");
|
||||
} else {
|
||||
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST", $URIdef->{$groupname}->{$res});
|
||||
}
|
||||
}
|
||||
if (defined ($URIdef->{$groupname}->{$res}->{DELETE})) {
|
||||
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{DELETE}, "DELETE");
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,53 @@
|
||||
#first define
|
||||
start:Linux_sn_installation_flat_x86_64_redhat
|
||||
os:Linux
|
||||
cmd:makedns -n
|
||||
check:rc==0
|
||||
cmd:chdef $$SN groups=service,all
|
||||
check:rc==0
|
||||
cmd:chdef -t group service arch=__GETNODEATTR($$SN,arch)__ os=__GETNODEATTR($$SN,os)__ profile=service netboot=xnba primarynic=eth0
|
||||
check:rc==0
|
||||
cmd:chdef -t group -o service setupnfs=1 setupdhcp=1 setuptftp=1 setupnameserver=1 setupconserver=1
|
||||
check:rc==0
|
||||
cmd:chdef $$SN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN
|
||||
check:rc==0
|
||||
cmd:makeconservercf
|
||||
check:rc==0
|
||||
cmd:cat /etc/conserver.cf | grep $$SN
|
||||
check:output=~$$SN
|
||||
cmd:sleep 60
|
||||
cmd:makedhcp -n
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:service dhcpd restart
|
||||
check:rc==0
|
||||
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-service synclists=/install/custom/install/rh/service.synclist
|
||||
check:rc==0
|
||||
cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-service otherpkglist=/opt/xcat/share/xcat/install/rh/service.rhels6.x86_64.otherpkgs.pkglist
|
||||
check:rc==0
|
||||
cmd:mkdir -p /install/post/otherpkgs/rhels6.3/x86_64/xcat/
|
||||
check:rc==0
|
||||
cmd:cp -rf /xcat-core /install/post/otherpkgs/__GETNODEATTR($$CN,os)__/x86_64/xcat/
|
||||
check:rc==0
|
||||
cmd:createrepo /install/post/otherpkgs/__GETNODEATTR($$CN,os)__/x86_64/xcat/xcat-core
|
||||
check:rc==0
|
||||
cmd:for i in mysql-server mysql mysql-bench mysql-devel mysql-connector-odbc; do cat /opt/xcat/share/xcat/install/rh/service.rhels6.x86_64.pkglist|grep "$i$";if [ $? -ne 0 ] ; then echo "$i" >> /opt/xcat/share/xcat/install/rh/service.rhels6.x86_64.pkglist; fi done
|
||||
cmd:chtab node=service postscripts.postscripts="servicenode,odbcsetup"
|
||||
check:rc==0
|
||||
cmd:nodeset $$SN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-service
|
||||
check:rc==0
|
||||
cmd:rsetboot $$SN net
|
||||
check:rc==0
|
||||
cmd:rpower $$SN reset
|
||||
check:rc==0
|
||||
cmd:sleep 700
|
||||
cmd:ping $$SN -c 3
|
||||
check:output=~64 bytes from $$SN
|
||||
cmd:lsdef -l $$SN | grep status
|
||||
check:output=~booted
|
||||
cmd:xdsh $$SN date
|
||||
check:rc==0
|
||||
check:output=~\d\d:\d\d:\d\d
|
||||
cmd:xdsh $$SN nodels
|
||||
check:rc==0
|
||||
end
|
@ -107,7 +107,8 @@ route_exists()
|
||||
net1=`echo $x|cut -d',' -f1`
|
||||
gw1=`echo $x|cut -d',' -f2`
|
||||
mask1=`echo $x|cut -d',' -f3`
|
||||
if [ "$net" = "$net1" ] && [ "$mask" = "$mask1" ] && [ "$gw" = "$gw1" ]; then
|
||||
ifname1=`echo $x|cut -d',' -f8`
|
||||
if [ "$net" = "$net1" ] && [ "$mask" = "$mask1" ] && [ "$gw" = "$gw1" ] && [ "$ifname" = "$ifname1" ]; then
|
||||
ret=1
|
||||
break
|
||||
fi
|
||||
@ -174,11 +175,21 @@ add_persistent_route()
|
||||
filename="/etc/sysconfig/network/routes";
|
||||
if echo $net | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
route="$net/$mask $gw - -"
|
||||
route1="$net\/$mask $gw - -";
|
||||
if [ $gw_ip = "" -o $gw_ip = "::" ] ; then
|
||||
route="$net/$mask :: - $ifname"
|
||||
route1="$net\/$mask :: - $ifname";
|
||||
else
|
||||
route="$net/$mask $gw - -"
|
||||
route1="$net\/$mask $gw - -";
|
||||
fi
|
||||
else
|
||||
route="$net $gw $mask $ifname";
|
||||
route1="$net $gw $mask $ifname";
|
||||
if [ $gw_ip = "" -o $gw_ip = "0.0.0.0" ] ; then
|
||||
route="$net 0.0.0.0 $mask $ifname";
|
||||
route1="$net 0.0.0.0 $mask $ifname";
|
||||
else
|
||||
route="$net $gw $mask $ifname";
|
||||
route1="$net $gw $mask $ifname";
|
||||
fi
|
||||
fi
|
||||
if [ -f $filename ]; then
|
||||
grep "$route" $filename 2>&1 1>/dev/null
|
||||
@ -221,10 +232,18 @@ add_persistent_route()
|
||||
echo $net | grep : 2>&1 1>/dev/null
|
||||
#ipv6
|
||||
if [ $? -eq 0 ];then
|
||||
matchstr="$net/$mask gw $gw"
|
||||
if [ "$gw" = "" -o "$gw" = "::" ] ; then
|
||||
matchstr="$net/$mask dev $ifname"
|
||||
else
|
||||
matchstr="$net/$mask gw $gw"
|
||||
fi
|
||||
v6flag=1
|
||||
else
|
||||
matchstr="net $net netmask $mask gw $gw"
|
||||
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
|
||||
matchstr="net $net netmask $mask dev $ifname"
|
||||
else
|
||||
matchstr="net $net netmask $mask gw $gw"
|
||||
fi
|
||||
fi
|
||||
|
||||
grep "$matchstr" $filename 2>&1 1>/dev/null
|
||||
@ -237,12 +256,17 @@ add_persistent_route()
|
||||
if [ $? -eq 0 -a $foundflag -eq 1 ];then
|
||||
foundflag=0
|
||||
if [ $v6flag -eq 1 ];then
|
||||
echo " up route -A inet6 add $net/$mask gw $gw" >> $tempfile
|
||||
echo " down route -A inet6 del $net/$mask gw $gw" >> $tempfile
|
||||
if [ "$gw" = "" -o "$gw" = "::" ] ; then
|
||||
echo " up route -A inet6 add $net/$mask dev $ifname" >> $tempfile
|
||||
echo " down route -A inet6 del $net/$mask dev $ifname" >> $tempfile
|
||||
else
|
||||
echo " up route -A inet6 add $net/$mask gw $gw" >> $tempfile
|
||||
echo " down route -A inet6 del $net/$mask gw $gw" >> $tempfile
|
||||
fi
|
||||
else
|
||||
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
|
||||
echo " up route add -net $net netmask $mask dev $ifname" >> $tempfile
|
||||
echo " down route del -net $net netmask $mask dev $ifname" >> $tempfile
|
||||
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
|
||||
echo " up route add -net $net netmask $mask dev $ifname" >> $tempfile
|
||||
echo " down route del -net $net netmask $mask dev $ifname" >> $tempfile
|
||||
else
|
||||
echo " up route add -net $net netmask $mask gw $gw" >> $tempfile
|
||||
echo " down route del -net $net netmask $mask gw $gw" >> $tempfile
|
||||
@ -260,12 +284,17 @@ add_persistent_route()
|
||||
#the insert place is the last line of the config file
|
||||
if [ $foundflag -eq 1 ];then
|
||||
if [ $v6flag -eq 1 ];then
|
||||
echo " up route -A inet6 add $net/$mask gw $gw" >> $tempfile
|
||||
echo " down route -A inet6 del $net/$mask gw $gw" >> $tempfile
|
||||
if [ "$gw" = "" -o "$gw" = "::" ] ; then
|
||||
echo " up route -A inet6 add $net/$mask dev $ifname" >> $tempfile
|
||||
echo " down route -A inet6 del $net/$mask dev $ifname" >> $tempfile
|
||||
else
|
||||
echo " up route -A inet6 add $net/$mask gw $gw" >> $tempfile
|
||||
echo " down route -A inet6 del $net/$mask gw $gw" >> $tempfile
|
||||
fi
|
||||
else
|
||||
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
|
||||
echo " up route add -net $net netmask $mask dev $ifname" >> $tempfile
|
||||
echo " down route del -net $net netmask $mask dev $ifname" >> $tempfile
|
||||
echo " up route add -net $net netmask $mask dev $ifname" >> $tempfile
|
||||
echo " down route del -net $net netmask $mask dev $ifname" >> $tempfile
|
||||
else
|
||||
echo " up route add -net $net netmask $mask gw $gw" >> $tempfile
|
||||
echo " down route del -net $net netmask $mask gw $gw" >> $tempfile
|
||||
@ -283,14 +312,22 @@ add_persistent_route()
|
||||
# ipv6 net
|
||||
if echo $net | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
if [ "$gw" = "" ] ; then
|
||||
$gw = "::";
|
||||
fi
|
||||
filename="/etc/sysconfig/static-routes-ipv6";
|
||||
route="$ifname $net/$mask $gw";
|
||||
# $net/mask does not work with sed cmd
|
||||
route1="$ifname $net\/$mask $gw";
|
||||
else
|
||||
filename="/etc/sysconfig/network-scripts/route-$ifname";
|
||||
route="$net/$mask via $gw dev $ifname";
|
||||
route1="$net\/$mask via $gw dev $ifname";
|
||||
filename="/etc/sysconfig/static-routes";
|
||||
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
|
||||
route="any net $net netmask $mask dev $ifname";
|
||||
route1="any net $net netmask $mask dev $ifname";
|
||||
else
|
||||
route="any net $net netmask $mask gw $gw $ifname";
|
||||
route1="any net $net netmask $mask gw $gw $ifname";
|
||||
fi
|
||||
fi
|
||||
if [ -f $filename ]; then
|
||||
grep "$route" $filename 2>&1 1>/dev/null
|
||||
@ -350,15 +387,23 @@ rm_persistent_route()
|
||||
# ipv6 net
|
||||
if echo $net | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
route="$net/$mask $gw - -";
|
||||
route1="$net\/$mask $gw - -";
|
||||
if [ $gw = "" -o $gw = "::" ] ; then
|
||||
route="$net/$mask :: - $ifname";
|
||||
route1="$net\/$mask :: - $ifname";
|
||||
else
|
||||
route="$net/$mask $gw - -";
|
||||
route1="$net\/$mask $gw - -";
|
||||
fi
|
||||
else
|
||||
if [ $gw = "" ] ; then
|
||||
$gw = "0.0.0.0";
|
||||
fi
|
||||
if [ -n "$ifname" ]; then
|
||||
route="$net $gw $mask $ifname";
|
||||
route1="$net $gw $mask $ifname";
|
||||
else
|
||||
route="$net $gw $mask";
|
||||
route1="$net $gw $mask";
|
||||
route="$net $gw $mask -";
|
||||
route1="$net $gw $mask -";
|
||||
fi
|
||||
fi
|
||||
if [ -f $filename ]; then
|
||||
@ -386,10 +431,18 @@ rm_persistent_route()
|
||||
echo $net | grep : 2>&1 1>/dev/null
|
||||
#ipv6
|
||||
if [ $? -eq 0 ];then
|
||||
matchstr="$net/$mask gw $gw"
|
||||
if [ $gw = "" -o $gw = "::" ] ; then
|
||||
matchstr="$net/$mask dev $ifname"
|
||||
else
|
||||
matchstr="$net/$mask gw $gw"
|
||||
fi
|
||||
v6flag=1
|
||||
else
|
||||
matchstr="net $net netmask $mask gw $gw"
|
||||
if [ $gw = "" -o $gw = "0.0.0.0" ] ; then
|
||||
matchstr="net $net netmask $mask dev $ifname"
|
||||
else
|
||||
matchstr="net $net netmask $mask gw $gw"
|
||||
fi
|
||||
fi
|
||||
|
||||
grep "$matchstr" $filename
|
||||
@ -407,12 +460,22 @@ rm_persistent_route()
|
||||
then
|
||||
filename="/etc/sysconfig/static-routes-ipv6";
|
||||
# $net/$mask does not work with sed
|
||||
route="$ifname $net\/$mask $gw"
|
||||
route1="$ifname $net/$mask $gw"
|
||||
if [ "$gw" = "" -o "$gw" = "::" ] ; then
|
||||
route="$ifname $net\/$mask ::"
|
||||
route1="$ifname $net/$mask ::"
|
||||
else
|
||||
route="$ifname $net\/$mask $gw"
|
||||
route1="$ifname $net/$mask $gw"
|
||||
fi
|
||||
else
|
||||
filename="/etc/sysconfig/network-scripts/route-$ifname";
|
||||
route="$net/$mask via $gw dev $ifname";
|
||||
route1="$net\/$mask via $gw dev $ifname";
|
||||
filename="/etc/sysconfig/static-routes";
|
||||
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
|
||||
route="any net $net netmask $mask dev $ifname";
|
||||
route1="any net $net netmask $mask dev $ifname";
|
||||
else
|
||||
route="any net $net netmask $mask gw $gw $ifname";
|
||||
route1="any net $net netmask $mask gw $gw $ifname";
|
||||
fi
|
||||
fi
|
||||
if [ -f $filename ]; then
|
||||
grep "$route" $filename 2>&1 1>/dev/null
|
||||
@ -441,7 +504,11 @@ if [ "$op" = "add" ]; then
|
||||
if echo $net | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
cmd="ip -6 route add $net/$mask via $gw"
|
||||
if [ "$gw" = "" -o "$gw" = "::" ] ; then
|
||||
cmd="ip -6 route add $net/$mask dev $ifname"
|
||||
else
|
||||
cmd="ip -6 route add $net/$mask via $gw"
|
||||
fi
|
||||
else
|
||||
# AIX TODO
|
||||
cmd="ip -6 route add $net/$mask via $gw"
|
||||
@ -449,9 +516,9 @@ if [ "$op" = "add" ]; then
|
||||
else
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
|
||||
cmd="route add -net $net netmask $mask dev $ifname"
|
||||
else
|
||||
cmd="route add -net $net netmask $mask gw $gw"
|
||||
cmd="route add -net $net netmask $mask dev $ifname"
|
||||
else
|
||||
cmd="route add -net $net netmask $mask gw $gw"
|
||||
fi
|
||||
else
|
||||
cmd="route add -net $net -netmask $mask $gw"
|
||||
@ -486,14 +553,22 @@ elif [ "$op" = "delete" ]; then
|
||||
if echo $net | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
cmd="ip -6 route delete $net/$mask via $gw"
|
||||
if [ "$gw" = "" -o "$gw" = "::" ] ; then
|
||||
cmd="ip -6 route delete $net/$mask dev $ifname"
|
||||
else
|
||||
cmd="ip -6 route delete $net/$mask via $gw"
|
||||
fi
|
||||
else
|
||||
# AIX TODO
|
||||
cmd="ip -6 route delete $net/$mask via $gw"
|
||||
fi
|
||||
else
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
cmd="route delete -net $net netmask $mask gw $gw"
|
||||
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
|
||||
cmd="route delete -net $net netmask $mask dev $ifname"
|
||||
else
|
||||
cmd="route delete -net $net netmask $mask gw $gw"
|
||||
fi
|
||||
else
|
||||
cmd="route delete -net $net -netmask $mask $gw"
|
||||
fi
|
||||
|
@ -42,12 +42,16 @@ download_postscripts()
|
||||
return 1;
|
||||
fi
|
||||
|
||||
if [ -f /opt/xcat/xcatinfo ]; then
|
||||
INSTALLDIR=`grep 'INSTALLDIR' /opt/xcat/xcatinfo |cut -d= -f2`
|
||||
fi
|
||||
# Do not override the parameter --installdir
|
||||
if [ -z "$INSTALLDIR" ]; then
|
||||
INSTALLDIR="/install"
|
||||
if [ -f /opt/xcat/xcatinfo ]; then
|
||||
INSTALLDIR=`grep 'INSTALLDIR' /opt/xcat/xcatinfo |cut -d= -f2`
|
||||
fi
|
||||
if [ -z "$INSTALLDIR" ]; then
|
||||
INSTALLDIR="/install"
|
||||
fi
|
||||
fi
|
||||
|
||||
max_retries=5
|
||||
retry=0
|
||||
rc=1 # this is a fail return
|
||||
|
Reference in New Issue
Block a user