Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a8479cd85 | |||
| f3449882b3 | |||
| 8f3b04bd1a | |||
| abbd20549a |
@@ -1,88 +0,0 @@
|
||||
#!/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
|
||||
+2
-5
@@ -44,10 +44,8 @@ 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"
|
||||
# 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"
|
||||
PCMBUILD="xCAT"
|
||||
PCMLINK="perl-xCAT xCAT-client xCAT-server 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=""
|
||||
@@ -243,7 +241,6 @@ for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xC
|
||||
#if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi # for zvm embedded env only need to build server and UI
|
||||
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-SoftLayer" ]; then continue; fi # do not build xCAT-softlayer on aix
|
||||
if $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then
|
||||
UPLOAD=1
|
||||
maker $rpmname
|
||||
|
||||
+19
-73
@@ -8,29 +8,10 @@
|
||||
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"
|
||||
|
||||
grep -i 'SUSE' /etc/issue
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "This is a SUSE system!"
|
||||
OS="SUSE";
|
||||
fi
|
||||
|
||||
|
||||
ls $CURDIR/makerpm
|
||||
ls /code/xcat-core
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "Error:no repo exist, exit 1."
|
||||
@@ -44,9 +25,10 @@ if ! flock -n 8; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#delete old package if there is
|
||||
rm -rf $CURDIR/build/
|
||||
cd $CURDIR
|
||||
#used only for hard code, will change later
|
||||
cd /code/xcat-core
|
||||
|
||||
rm -rf build/
|
||||
|
||||
echo "==============================================="
|
||||
echo $NAMEALL | egrep "Ubuntu"
|
||||
@@ -61,7 +43,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 $CURDIR/build
|
||||
mkdir -p /code/xcat-core/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]'`
|
||||
@@ -75,85 +57,49 @@ echo "This is an Ubuntu system"
|
||||
echo "Error: $rpmname build package failed exit code $rc"
|
||||
fi
|
||||
cd -
|
||||
mv ${rpmname_low}* $CURDIR/build
|
||||
mv ${rpmname_low}* /code/xcat-core/build
|
||||
|
||||
done
|
||||
#delete all files except .deb file
|
||||
find $CURDIR/build/* ! -name *.deb | xargs rm -f
|
||||
find /code/xcat-core/build/* ! -name *.deb | xargs rm -f
|
||||
|
||||
else
|
||||
#This is not an Ubuntu system
|
||||
echo "This is an $OSNAME system"
|
||||
|
||||
if [ "$OS" = "SUSE" ]; then
|
||||
rm -rf /usr/src/packages/RPMS/noarch/*
|
||||
rm -rf /usr/src/packages/RPMS/x86_64/*
|
||||
rm -rf /usr/src/packages/RPMS/ppc64/*
|
||||
else
|
||||
rm -rf /root/rpmbuild/RPMS/noarch/*
|
||||
rm -rf /root/rpmbuild/RPMS/x86_64/*
|
||||
rm -rf /root/rpmbuild/RPMS/ppc64/*
|
||||
fi
|
||||
|
||||
mkdir -p $CURDIR/build/
|
||||
|
||||
#always build perl-xCAT
|
||||
$CURDIR/makerpm perl-xCAT
|
||||
|
||||
|
||||
rm -rf /root/rpmbuild/RPMS/noarch/*
|
||||
rm -rf /root/rpmbuild/RPMS/x86_64/*
|
||||
rm -rf /root/rpmbuild/RPMS/ppc64/*
|
||||
mkdir build/
|
||||
# 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
|
||||
$CURDIR/makerpm $rpmname
|
||||
./makerpm $rpmname
|
||||
done
|
||||
|
||||
#build xCAT-genesis-scripts if it is x86_64 platform
|
||||
ARCH=$(uname -p)
|
||||
if [ "$ARCH" = "x64_64" ]; then
|
||||
$CURDIR/makerpm xCAT-genesis-scripts x86_64
|
||||
./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
|
||||
$CURDIR/makerpm $rpmname
|
||||
./makerpm $rpmname
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
|
||||
else
|
||||
for arch in x86_64 ppc64 s390x; do
|
||||
$CURDIR/makerpm $rpmname $arch
|
||||
./makerpm $rpmname $arch
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$OS" = "SUSE" ]; then
|
||||
cp /usr/src/packages/RPMS/noarch/* $CURDIR/build/
|
||||
cp /usr/src/packages/RPMS/x86_64/* $CURDIR/build/
|
||||
cp /usr/src/packages/RPMS/ppc64/* $CURDIR/build/
|
||||
else
|
||||
cp /root/rpmbuild/RPMS/noarch/* $CURDIR/build/
|
||||
cp /root/rpmbuild/RPMS/x86_64/* $CURDIR/build/
|
||||
cp /root/rpmbuild/RPMS/ppc64/* $CURDIR/build/
|
||||
fi
|
||||
|
||||
#begin to create repo for redhat platform
|
||||
|
||||
grep -i 'Red' /etc/issue;
|
||||
if [ "$OSNAME" != "AIX" -a $? -eq 0 ]; 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/
|
||||
else
|
||||
rm -f /etc/zypp/repos.d/xCAT-core.repo
|
||||
zypper ar file://$CURDIR/build xCAT-core
|
||||
fi
|
||||
cp /root/rpmbuild/RPMS/noarch/* build/
|
||||
cp /root/rpmbuild/RPMS/x86_64/* build/
|
||||
cp /root/rpmbuild/RPMS/ppc64/* build/
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
#!/bin/sh
|
||||
# Put the version, svn revision #, and build date into the Version function in Version.pm
|
||||
|
||||
if [ -z "$2" ]
|
||||
if [ -z "$1" ]
|
||||
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"/". ' (${GITREF}built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
|
||||
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
|
||||
mv xCAT/Version.pm.new xCAT/Version.pm
|
||||
else
|
||||
if [ -f "/etc/debian_version" ];then
|
||||
@@ -23,5 +22,5 @@ else
|
||||
else
|
||||
FILENAME="xCAT/Version.pm"
|
||||
fi
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${GITREF}built $BUILDDATE)'"/ $FILENAME
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ $FILENAME
|
||||
fi
|
||||
|
||||
@@ -23,8 +23,6 @@ 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)
|
||||
|
||||
@@ -38,7 +36,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} %{gitinfo}
|
||||
./modifyUtils %{version}
|
||||
|
||||
# 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.
|
||||
|
||||
+24
-34
@@ -598,7 +598,7 @@ sub _execute_dsh
|
||||
}
|
||||
else
|
||||
{
|
||||
# HERE: This is where the output shows up
|
||||
# LKV: This is where the output shows up
|
||||
#print STDOUT @{$output_buffers{$user_target}};
|
||||
#print STDERR @{$error_buffers{$user_target}};
|
||||
chomp(@{$output_buffers{$user_target}});
|
||||
@@ -3993,7 +3993,8 @@ sub parse_and_run_dsh
|
||||
{
|
||||
$options{'user'} = $ENV{'DSH_TO_USERID'};
|
||||
}
|
||||
if ((!(defined($nodes))) && (!(defined($options{'rootimg'}))))
|
||||
|
||||
if ((!(defined(@$nodes))) && (!(defined($options{'rootimg'}))))
|
||||
{ # no nodes and not -i option, error
|
||||
my $rsp = ();
|
||||
$rsp->{error}->[0] = "Unless using -i option, noderange is required.";
|
||||
@@ -4032,7 +4033,7 @@ sub parse_and_run_dsh
|
||||
{ # from sinv, discard this name
|
||||
undef @$nodes;
|
||||
}
|
||||
if (@$nodes)
|
||||
if (defined(@$nodes))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
@@ -4404,7 +4405,7 @@ sub parse_and_run_dcp
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((!(defined($nodes))) && (!(defined($options{'rootimg'}))))
|
||||
if ((!(defined(@$nodes))) && (!(defined($options{'rootimg'}))))
|
||||
{ # no nodes and not -i option, error
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "Unless using -i option, noderange is required.";
|
||||
@@ -4501,7 +4502,7 @@ sub parse_and_run_dcp
|
||||
#
|
||||
# build list of nodes
|
||||
my @nodelist;
|
||||
if (@$nodes)
|
||||
if (defined(@$nodes))
|
||||
{ # there are nodes
|
||||
@nodelist = @$nodes;
|
||||
$options{'nodes'} = join(',', @nodelist);
|
||||
@@ -4971,8 +4972,7 @@ sub parse_rsync_input_file_on_MN
|
||||
$::process_line = 0;
|
||||
my $destfileisdir;
|
||||
my $clause=0;
|
||||
my $addmergescript =0;
|
||||
my $addappendscript =0;
|
||||
|
||||
open(INPUTFILE, "< $input_file") || die "File $input_file does not exist\n";
|
||||
while (my $line = <INPUTFILE>)
|
||||
{
|
||||
@@ -5013,16 +5013,12 @@ sub parse_rsync_input_file_on_MN
|
||||
# this triggers the running of the appendscript
|
||||
$::appendscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
|
||||
}
|
||||
|
||||
# add the append script to the sync
|
||||
if ($addappendscript == 0) { # only add once
|
||||
my $appscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
|
||||
my $appendscriptline = "$appscript -> $appscript";
|
||||
$syncappendscript=1; # syncing the xdcpappend.sh script
|
||||
&build_append_rsync($appendscriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncappendscript);
|
||||
$addappendscript=1;
|
||||
}
|
||||
} # end APPEND clause
|
||||
my $appscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
|
||||
my $appendscriptline = "$appscript -> $appscript";
|
||||
$syncappendscript=1; # syncing the xdcpappend.sh script
|
||||
&build_append_rsync($appendscriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncappendscript);
|
||||
}
|
||||
if ($clause =~ /MERGE:/) {
|
||||
# location of the base merge script
|
||||
# for MERGE we have to sync the mergescript and the
|
||||
@@ -5034,16 +5030,12 @@ sub parse_rsync_input_file_on_MN
|
||||
# this triggers the running of the mergescript
|
||||
$::mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
|
||||
}
|
||||
|
||||
# add the merge script to the sync
|
||||
if ($addmergescript == 0) { # only add once
|
||||
my $mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
|
||||
my $mergescriptline = "$mergescript -> $mergescript";
|
||||
$syncmergescript=1; # syncing the xdcpmerge.sh script
|
||||
&build_merge_rsync($mergescriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncmergescript);
|
||||
$addmergescript=1;
|
||||
}
|
||||
} # end MERGE clause
|
||||
my $mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
|
||||
my $mergescriptline = "$mergescript -> $mergescript";
|
||||
$syncmergescript=1; # syncing the xdcpmerge.sh script
|
||||
&build_merge_rsync($mergescriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncmergescript);
|
||||
}
|
||||
|
||||
}
|
||||
} else { # not processing EXECUTE, EXECUTEALWAYS or APPEND
|
||||
@@ -5207,7 +5199,6 @@ sub build_append_rsync
|
||||
push @::appendlines,$line;
|
||||
}
|
||||
my $src_file = $1; # append file left of arror
|
||||
my $orig_src_file = $1; # append file left of arror
|
||||
# it will be sync'd to $nodesyncfiledir/$append_file
|
||||
my $dest_file = $nodesyncfiledir;
|
||||
$dest_file .= $src_file;
|
||||
@@ -5236,7 +5227,7 @@ sub build_append_rsync
|
||||
# to pick up files from /var/xcat/syncfiles...
|
||||
if ($onServiceNode == 1) {
|
||||
my $newsrcfile = $syncdir; # add SN syndir on front
|
||||
$newsrcfile .= $orig_src_file;
|
||||
$newsrcfile .= $src_file;
|
||||
$src_file=$newsrcfile;
|
||||
}
|
||||
# destination file name
|
||||
@@ -5319,8 +5310,7 @@ sub build_merge_rsync
|
||||
if ($syncmergescript == 0) { # don't add the xdcpmerge.sh line
|
||||
push @::mergelines,$line;
|
||||
}
|
||||
my $src_file = $1; # merge file left of arrow
|
||||
my $orig_src_file = $1;
|
||||
my $src_file = $1; # merge file left of arror
|
||||
# it will be sync'd to $nodesyncfiledir/$merge_file
|
||||
my $dest_file = $nodesyncfiledir;
|
||||
$dest_file .= $src_file;
|
||||
@@ -5349,7 +5339,7 @@ sub build_merge_rsync
|
||||
# to pick up files from /var/xcat/syncfiles...
|
||||
if ($onServiceNode == 1) {
|
||||
my $newsrcfile = $syncdir; # add SN syndir on front
|
||||
$newsrcfile .= $orig_src_file;
|
||||
$newsrcfile .= $src_file;
|
||||
$src_file=$newsrcfile;
|
||||
}
|
||||
# destination file name
|
||||
@@ -6039,11 +6029,11 @@ sub run_always_rsync_postscripts
|
||||
# if on the service node need to add the $syncdir directory
|
||||
# to the path
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
my $tmps=$syncdir . $ps;
|
||||
push @args, $tmps;
|
||||
} else{
|
||||
push @args, $ps;
|
||||
my $tmpp=$syncdir . $ps;
|
||||
$ps=$tmpp;
|
||||
}
|
||||
push @args, $ps;
|
||||
|
||||
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
|
||||
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
|
||||
@@ -253,6 +253,64 @@ use strict;
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
=head3
|
||||
ifconfig_inet
|
||||
|
||||
Builds a list of all IP Addresses bound to the local host and
|
||||
stores them in a global list
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Globals:
|
||||
@local_inet
|
||||
|
||||
Error:
|
||||
None
|
||||
|
||||
Example:
|
||||
xCAT::DSHCore->ifconfig_inet;
|
||||
|
||||
Comments:
|
||||
Internal routine only
|
||||
|
||||
=cut
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
sub ifconfig_inet
|
||||
{
|
||||
my @local_inet = ();
|
||||
|
||||
if ($^O eq 'aix')
|
||||
{
|
||||
my @ip_address = ();
|
||||
my @output = `/usr/sbin/ifconfig -a`;
|
||||
|
||||
foreach my $line (@output)
|
||||
{
|
||||
($line =~ /inet ((\d{1,3}?\.){3}(\d){1,3})\s/o)
|
||||
&& (push @local_inet, $1);
|
||||
}
|
||||
}
|
||||
|
||||
elsif ($^O eq 'linux')
|
||||
{
|
||||
my @ip_address = ();
|
||||
my @output = `/sbin/ifconfig -a`;
|
||||
|
||||
foreach my $line (@output)
|
||||
{
|
||||
($line =~ /inet addr:((\d{1,3}?\.){3}(\d){1,3})\s/o)
|
||||
&& (push @local_inet, $1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
+31
-199
@@ -16,7 +16,7 @@ use xCAT::Usage;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT::FSPUtils;
|
||||
use xCAT::VMCommon;
|
||||
use Data::Dumper;
|
||||
#use Data::Dumper;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
##############################################
|
||||
# Globals
|
||||
@@ -48,15 +48,6 @@ sub parse_args {
|
||||
##########################################################################
|
||||
# Parse the chvm command line for options and operands
|
||||
##########################################################################
|
||||
my @query_array = ();
|
||||
my %param_list_map = (
|
||||
'vmcpus' => 'part_get_lpar_processing',
|
||||
'vmmemory' => 'part_get_lpar_memory',
|
||||
'vmphyslots' => 'part_get_all_io_bus_info',
|
||||
'vmnics' => 'part_get_all_vio_info',
|
||||
'vmstorage' => 'part_get_all_vio_info',
|
||||
'del_vadapter' => 'part_get_all_vio_info'
|
||||
);
|
||||
|
||||
sub chvm_parse_extra_options {
|
||||
my $args = shift;
|
||||
@@ -66,7 +57,6 @@ sub chvm_parse_extra_options {
|
||||
if (ref($args) ne 'ARRAY') {
|
||||
return "$args";
|
||||
}
|
||||
my %tmp_hash = ();
|
||||
foreach (@$args) {
|
||||
my ($cmd, $value) = split (/\=/, $_);
|
||||
if (!defined($value)) {
|
||||
@@ -85,24 +75,14 @@ sub chvm_parse_extra_options {
|
||||
# return "'$value' invalid";
|
||||
# }
|
||||
} elsif (grep(/^$cmd$/, @support_ops)) {
|
||||
if (exists($param_list_map{$cmd})) {
|
||||
$tmp_hash{$param_list_map{$cmd}} = 1;
|
||||
}
|
||||
if (exists($opt->{p775})) {
|
||||
return "'$cmd' doesn't work for Power 775 machines.";
|
||||
} elsif ($cmd eq "del_vadapter") {
|
||||
if ($value !~ /^\d+$/) {
|
||||
return "Invalid param '$value', only one slot id can be specified";
|
||||
}
|
||||
|
||||
} elsif ($cmd eq "vmothersetting") {
|
||||
if ($value =~ /hugepage:\s*(\d+)/i) {
|
||||
$opt->{huge_page} = $1;
|
||||
$tmp_hash{'get_huge_page'} = 1;
|
||||
}
|
||||
if ($value =~ /bsr:\s*(\d+)/i) {
|
||||
$opt->{bsr} = $1;
|
||||
$tmp_hash{'get_cec_bsr'} = 1;
|
||||
}
|
||||
next;
|
||||
} elsif ($cmd eq "vmstorage") {
|
||||
@@ -177,7 +157,6 @@ sub chvm_parse_extra_options {
|
||||
}
|
||||
$opt->{$cmd} = $value;
|
||||
}
|
||||
@query_array = keys(%tmp_hash);
|
||||
return undef;
|
||||
}
|
||||
|
||||
@@ -740,7 +719,7 @@ sub lsvm_parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose l|long p775 updatedb) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|verbose l|long p775) )) {
|
||||
return( usage() );
|
||||
}
|
||||
if (exists($opt{l}) && !exists($opt{p775})) {
|
||||
@@ -779,12 +758,11 @@ sub modify {
|
||||
return op_extra_cmds ($request, $hash) if ($request->{opt}->{lparname} || $request->{opt}->{huge_page});
|
||||
return ([["Error", "Miss argument\n".$usage_string, 1]]);
|
||||
}
|
||||
|
||||
sub do_op_extra_cmds {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my @values = ();
|
||||
my %lpar_hash = ();
|
||||
|
||||
while (my ($mtms, $h) = each(%$hash)) {
|
||||
my $memhash;
|
||||
while (my($name, $d) = each(%$h)) {
|
||||
@@ -849,17 +827,17 @@ sub do_op_extra_cmds {
|
||||
if ($2 == "G" or $2 == '') {
|
||||
$min = $min * 1024;
|
||||
}
|
||||
$min = int($min/$memsize);
|
||||
$min = $min/$memsize;
|
||||
my $cur = $3;
|
||||
if ($4 == "G" or $4 == '') {
|
||||
$cur = $cur * 1024;
|
||||
}
|
||||
$cur = int($cur/$memsize);
|
||||
$cur = $cur/$memsize;
|
||||
my $max = $5;
|
||||
if ($6 == "G" or $6 == '') {
|
||||
$max = $max * 1024;
|
||||
}
|
||||
$max = int($max/$memsize);
|
||||
$max = $max/$memsize;
|
||||
$request->{opt}->{$op} ="$min/$cur/$max";
|
||||
$param = $request->{opt}->{$op};
|
||||
} else {
|
||||
@@ -892,15 +870,8 @@ sub do_op_extra_cmds {
|
||||
push @values, [$name, "Success", '0'];
|
||||
}
|
||||
}
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, 1, \@query_array);
|
||||
# need to add update db here
|
||||
$lpar_hash{$name} = $rethash;
|
||||
$lpar_hash{$name}->{parent} = @$d[3];
|
||||
}
|
||||
}
|
||||
if (%lpar_hash) {
|
||||
update_vm_db($request, \%lpar_hash);
|
||||
}
|
||||
return \@values;
|
||||
}
|
||||
sub check_node_info {
|
||||
@@ -1681,7 +1652,6 @@ my @partition_query_actions = qw(part_get_partition_cap part_get_hyp_process_and
|
||||
sub parse_part_get_info {
|
||||
my $hash = shift;
|
||||
my $data = shift;
|
||||
my $lparid = shift;
|
||||
my @array = split /\n/, $data;
|
||||
foreach my $line (@array) {
|
||||
chomp($line);
|
||||
@@ -1702,12 +1672,9 @@ sub parse_part_get_info {
|
||||
$hash->{bus}->{$3}->{cur_lparid} = $1;
|
||||
$hash->{bus}->{$3}->{bus_slot} = $2;
|
||||
$hash->{bus}->{$3}->{des} = $4;
|
||||
if ($lparid and $lparid eq $1) {
|
||||
push @{$hash->{lpar_phy_bus}}, $3;
|
||||
}
|
||||
} elsif ($line =~ /Phy drc_index:(\w+), Port group: (\w+), Phy port id: (\w+)/) {
|
||||
$hash->{phy_drc_group_port}->{$1}->{$2}->{$3} = '1';
|
||||
#} elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) {
|
||||
} elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) {
|
||||
if (($2 == -1) && ($4 == 255)) {
|
||||
$hash->{logic_drc_phydrc}->{$3}->{$5} = $1;
|
||||
#$hash->{logic_drc_phydrc}->{$5}->{$1} = [$2,$3,$4];
|
||||
@@ -1720,49 +1687,12 @@ sub parse_part_get_info {
|
||||
$hash->{lpar0_used_mem} = $2;
|
||||
$hash->{phy_min_mem_req} = $3;
|
||||
#print "===>lpar0_used_mem:$hash->{lpar0_used_mem}.\n";
|
||||
} elsif ($line =~ /Curr Memory (Min|Req|Max):\s*([\d]*)[^\(]*\((\d+)\s*regions\)/) {
|
||||
if ($1 eq 'Min') {
|
||||
$hash->{lpar_mem_min} = $2
|
||||
} elsif ($1 eq 'Max') {
|
||||
$hash->{lpar_mem_max} = $2;
|
||||
} else {
|
||||
$hash->{lpar_mem_req} = $2;
|
||||
$hash->{lpar_used_regions} = $3;
|
||||
}
|
||||
} elsif ($line =~ /Curr Processor (Min|Req|Max):\s*(\d+)/) {
|
||||
if ($1 eq 'Min') {
|
||||
$hash->{lpar_cpu_min} = $2;
|
||||
} elsif ($1 eq 'Max') {
|
||||
$hash->{lpar_cpu_max} = $2;
|
||||
} else {
|
||||
$hash->{lpar_cpu_req} = $2;
|
||||
}
|
||||
} elsif ($line =~ /\s*lpar_id=(\d+),type=vSCSI,slot=(\d+),attr=(\d+).*remote_lpar_id=0x(\w+),remote_slot_num=0x(\w+)/) {
|
||||
if ($3 eq '0') {
|
||||
my $lparid = hex($4);
|
||||
my $slotid = hex($5);
|
||||
push @{$hash->{lpar_vmstorage_client}}, "$lparid:$slotid";
|
||||
} else {
|
||||
if (exists($hash->{lpar_vmstorage_server})) {
|
||||
$hash->{lpar_vmstorage_server}++;
|
||||
} else {
|
||||
$hash->{lpar_vmstorage_server} = 1;
|
||||
}
|
||||
}
|
||||
} elsif ($line =~ /\s*lpar_id=(\d+),type=(vEth),slot=(\d+).*port_vlan_id=(\d+),mac_addr=(\w+)/) {
|
||||
push @{$hash->{lpar_vmnics}}, "vlan$4";
|
||||
} elsif ($line =~ /Curr Memory Req:[^\(]*\((\d+)\s*regions\)/) {
|
||||
$hash->{lpar_used_regions} = $1;
|
||||
} elsif ($line =~ /Available huge page memory\(in pages\):\s*(\d+)/) {
|
||||
$hash->{huge_page_avail} = $1;
|
||||
} elsif ($line =~ /Available BSR array:\s*(\d+)/) {
|
||||
$hash->{cec_bsr_avail} = $1;
|
||||
} elsif ($line =~ /^\d+\/(\d+)\/\d+$/) {
|
||||
if ($1 ne 0) {
|
||||
push @{$hash->{lpar_othersetting}}, "hugepage:$1";
|
||||
}
|
||||
} elsif ($line =~ /^(\d+)\.$/) {
|
||||
if ($1 ne 0) {
|
||||
push @{$hash->{lpar_othersetting}}, "bsr:$1";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1773,7 +1703,6 @@ sub query_cec_info_actions {
|
||||
my $td = shift;
|
||||
my $usage = shift;
|
||||
my $action_array = shift;
|
||||
my $lpar_hash = shift;
|
||||
my $lparid = @$td[0];
|
||||
my $data;
|
||||
my @array = ();
|
||||
@@ -1788,16 +1717,12 @@ sub query_cec_info_actions {
|
||||
chomp(@$values[1]);
|
||||
#if ($action eq "part_get_partition_cap" and (@$values[1] =~ /Error:/i or @$values[2] ne 0)) {
|
||||
if (@$values[1] =~ /Error:/i or @$values[2] ne 0) {
|
||||
next; #return ([[@$values]]);
|
||||
return ([[@$values]]);
|
||||
}
|
||||
if (@$values[1] =~ /^$/) {
|
||||
next;
|
||||
}
|
||||
if ($usage eq 1 or $usage eq 2) {
|
||||
&parse_part_get_info(\%hash, @$values[1], $lparid);
|
||||
}
|
||||
|
||||
if ($usage eq 0 or $usage eq 2) {
|
||||
if ($usage eq 0) {
|
||||
if ($lparid) {
|
||||
if ($action eq "lpar_lhea_mac") {
|
||||
my @output = split /\n/,@$values[1];
|
||||
@@ -1852,72 +1777,18 @@ sub query_cec_info_actions {
|
||||
}
|
||||
#$data .= "@$values[1]\n\n";
|
||||
push @array, [$name, @$values[1], @$values[2]];
|
||||
}
|
||||
}
|
||||
if ($usage eq 0 or $usage eq 2) {
|
||||
#return $data;
|
||||
if ($usage eq 2) {
|
||||
%$lpar_hash = %hash;
|
||||
} else {
|
||||
&parse_part_get_info(\%hash, @$values[1]);
|
||||
}
|
||||
}
|
||||
if ($usage eq 0) {
|
||||
#return $data;
|
||||
return \@array;
|
||||
} else {
|
||||
return \%hash;
|
||||
}
|
||||
}
|
||||
|
||||
sub update_vm_db {
|
||||
my $request = shift;
|
||||
my $lpar_hash = shift;
|
||||
my $vm_hd = xCAT::Table->new('vm');
|
||||
my %name_id_map = ();
|
||||
my $commit = 0;
|
||||
foreach (keys (%$lpar_hash)) {
|
||||
my %db_update = ();
|
||||
my $node_hash = $lpar_hash->{$_};
|
||||
if (exists($node_hash->{lpar_cpu_min})) {
|
||||
$db_update{cpus} = "$node_hash->{lpar_cpu_min}/$node_hash->{lpar_cpu_req}/$node_hash->{lpar_cpu_max}";
|
||||
}
|
||||
if (exists($node_hash->{lpar_mem_min})) {
|
||||
$db_update{memory} = "$node_hash->{lpar_mem_min}/$node_hash->{lpar_mem_req}/$node_hash->{lpar_mem_max}";
|
||||
}
|
||||
if (exists($node_hash->{lpar_vmstorage_server})) {
|
||||
$db_update{storage} = $node_hash->{lpar_vmstorage_server};
|
||||
} elsif (exists($node_hash->{lpar_vmstorage_client})) {
|
||||
my @tmp_array = ();
|
||||
foreach (@{$node_hash->{lpar_vmstorage_client}}) {
|
||||
if (/(\d+):(\d+)/) {
|
||||
if (exists($name_id_map{$1})) {
|
||||
push @tmp_array, "$name_id_map{$1}:$2";
|
||||
} else {
|
||||
my $vios_name = &find_lpar_name($request, $node_hash->{parent}, $1);
|
||||
if (defined($vios_name)) {
|
||||
$name_id_map{$1} = $vios_name;
|
||||
push @tmp_array, "$vios_name:$2";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$db_update{storage} = join(",",@tmp_array);
|
||||
}
|
||||
if (exists($node_hash->{lpar_vmnics})) {
|
||||
$db_update{nics} = join(",",@{$node_hash->{lpar_vmnics}});
|
||||
}
|
||||
if (exists($node_hash->{lpar_phy_bus})) {
|
||||
$db_update{physlots} = join(",",@{$node_hash->{lpar_phy_bus}});
|
||||
}
|
||||
if (exists($node_hash->{lpar_othersetting})) {
|
||||
$db_update{othersettings} = join(",",@{$node_hash->{lpar_othersetting}});
|
||||
}
|
||||
if (%db_update) {
|
||||
$vm_hd->setNodeAttribs($_,\%db_update);
|
||||
$commit = 1;
|
||||
}
|
||||
}
|
||||
if ($commit) {
|
||||
$vm_hd->commit;
|
||||
}
|
||||
}
|
||||
|
||||
#my @partition_query_actions = qw(part_get_partition_cap part_get_num_of_lpar_slots part_get_hyp_config_process_and_mem part_get_hyp_avail_process_and_mem part_get_service_authority_lpar_id part_get_shared_processing_resource part_get_all_vio_info lpar_lhea_mac part_get_all_io_bus_info part_get_lpar_processing part_get_lpar_memory get_huge_page get_cec_bsr);
|
||||
sub query_cec_info {
|
||||
my $request = shift;
|
||||
@@ -1925,36 +1796,25 @@ sub query_cec_info {
|
||||
my $args = $request->{opt};
|
||||
my @td = ();
|
||||
my @result = ();
|
||||
my $usage = 0;
|
||||
my %lpar_hash = ();
|
||||
#print Dumper($request);
|
||||
#print Dumper($hash);
|
||||
while (my ($mtms,$h) = each(%$hash) ) {
|
||||
while (my ($name, $d) = each (%$h)) {
|
||||
my %tmp_hash = ();
|
||||
@td = @$d;
|
||||
if (@$d[0] == 0 && @$d[4] !~ /lpar|vios/) {
|
||||
last;
|
||||
}
|
||||
#my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","lpar_lhea_mac","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
|
||||
if ($args->{updatedb}) {
|
||||
$usage = 2;
|
||||
}
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, $usage, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","part_get_all_vio_info","get_huge_page","get_cec_bsr"], \%tmp_hash);
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","part_get_all_vio_info","get_huge_page","get_cec_bsr"]);
|
||||
#push @result, [$name, $rethash, 0];
|
||||
push @result, @$rethash;
|
||||
$lpar_hash{$name} = \%tmp_hash;
|
||||
$lpar_hash{$name}->{parent} = @$d[3];
|
||||
}
|
||||
if (@td[0] == 0) {
|
||||
my $rethash = query_cec_info_actions($request, @td[3],\@td, $usage);
|
||||
my $rethash = query_cec_info_actions($request, @td[3],\@td, 0);
|
||||
#push @result, [@td[3], $rethash, 0];
|
||||
push @result, @$rethash;
|
||||
}
|
||||
}
|
||||
if ($args->{updatedb} and %lpar_hash) {
|
||||
update_vm_db($request, \%lpar_hash);
|
||||
}
|
||||
return \@result;
|
||||
}
|
||||
|
||||
@@ -2071,19 +1931,6 @@ sub find_lpar_id {
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub find_lpar_name {
|
||||
my $request = shift;
|
||||
my $parent = shift;
|
||||
my $id = shift;
|
||||
my %mapping = %{$request->{ppc}->{$parent}->{mapping}};
|
||||
foreach (keys %mapping) {
|
||||
if ($mapping{$_} eq $id) {
|
||||
return $_;
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub create_lpar {
|
||||
my $request = shift;
|
||||
my $name = shift;
|
||||
@@ -2207,7 +2054,6 @@ sub mkspeclpar {
|
||||
my $opt = $request->{opt};
|
||||
my $values;
|
||||
my @result = ();
|
||||
my %lpar_hash = ();
|
||||
my $vmtab = xCAT::Table->new( 'vm');
|
||||
unless($vmtab) {
|
||||
return([["Error","Cannot open vm table", 1]]);
|
||||
@@ -2280,9 +2126,9 @@ sub mkspeclpar {
|
||||
return([[$name, "Parameter for 'vmmemory' is invalid", 1]]);
|
||||
}
|
||||
my $memsize = $memhash->{mem_region_size};
|
||||
$mmin = int(($mmin + $memsize - 1) / $memsize);
|
||||
$mcur = int(($mcur + $memsize - 1) / $memsize);
|
||||
$mmax = int(($mmax + $memsize - 1) / $memsize);
|
||||
$mmin = ($mmin + $memsize) / $memsize;
|
||||
$mcur = ($mcur + $memsize) / $memsize;
|
||||
$mmax = ($mmax + $memsize) / $memsize;
|
||||
$tmp_ent->{memory} = "$mmin/$mcur/$mmax";
|
||||
$tmp_ent->{mem_region_size} = $memsize;
|
||||
} else {
|
||||
@@ -2332,27 +2178,21 @@ sub mkspeclpar {
|
||||
$tmp_ent->{storage} = \@array;
|
||||
}
|
||||
} else {
|
||||
if (exists($tmp_ent->{storage})) {
|
||||
my @tmp_array = split ",",$tmp_ent->{storage};
|
||||
my $storage_array = undef;
|
||||
foreach (@tmp_array) {
|
||||
if (/([\w_-]*):(\d+)/) {
|
||||
my $vios = &find_lpar_id($request, @$d[3], $1);
|
||||
my $r_slotid = $2;
|
||||
if (defined($vios)) {
|
||||
push @$storage_array, "0,$vios,$r_slotid";
|
||||
} else {
|
||||
return ([[$name, "Cannot find lparid for Server lpar:$1"]]);
|
||||
}
|
||||
} else {
|
||||
return ([[$name, "Parameter for 'vmstorage' is invalid", 1]]);
|
||||
if (exists($tmp_ent->{storage}) and $tmp_ent->{storage} !~ /^[\w_-]*:\d+$/) {
|
||||
return ([[$name, "Parameter for 'vmstorage' is invalid", 1]]);
|
||||
} elsif (exists($tmp_ent->{storage})) {
|
||||
if ($tmp_ent->{storage} =~ /([\w_-]*):(\d+)/) {
|
||||
my $vios = &find_lpar_id($request, @$d[3], $1);
|
||||
my $r_slotid = $2;
|
||||
if (!defined($vios)) {
|
||||
return ([[$name, "Cannot find lparid for Server lpar:$1"]]);
|
||||
}
|
||||
$tmp_ent->{storage} = ["0,$vios,$r_slotid"];
|
||||
}
|
||||
$tmp_ent->{storage} = $storage_array;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tmp_ent->{hyp_config_mem} = $memhash->{hyp_config_mem};
|
||||
$tmp_ent->{hyp_avail_mem} = $memhash->{hyp_avail_mem};
|
||||
if (exists($tmp_ent->{othersettings})) {
|
||||
@@ -2373,18 +2213,10 @@ sub mkspeclpar {
|
||||
$tmp_ent->{logic_drc_phydrc} = $memhash->{logic_drc_phydrc};
|
||||
$values = &create_lpar($request, $name, $d, $tmp_ent);
|
||||
push @result, $values;
|
||||
#need to add update db here
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, 1, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
|
||||
$lpar_hash{$name} = $rethash;
|
||||
$lpar_hash{$name}->{parent} = @$d[3];
|
||||
|
||||
$name = undef;
|
||||
$d = undef;
|
||||
}
|
||||
}
|
||||
if (%lpar_hash) {
|
||||
update_vm_db($request, \%lpar_hash);
|
||||
}
|
||||
return \@result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1023,7 +1023,7 @@ sub dolitesetup
|
||||
$nrange = join(',',@nodel);
|
||||
}
|
||||
|
||||
@flist = xCAT::Utils->runcmd("/opt/xcat/bin/litefile $nrange", -1);
|
||||
my @flist = xCAT::Utils->runcmd("/opt/xcat/bin/litefile $nrange", -1);
|
||||
if (scalar(@flist) > 0) {
|
||||
foreach my $l (@flist) {
|
||||
my ($j1, $j2, $file) = split /\s+/, $l;
|
||||
|
||||
@@ -19,7 +19,6 @@ use File::Path;
|
||||
use Math::BigInt;
|
||||
use Socket;
|
||||
use xCAT::GlobalDef;
|
||||
use Data::Dumper;
|
||||
use strict;
|
||||
use warnings "all";
|
||||
my $socket6support = eval { require Socket6 };
|
||||
@@ -697,26 +696,19 @@ sub get_nic_ip
|
||||
# Base address:0x2600 Memory:fbfe0000-fc0000080
|
||||
#
|
||||
# eth1 ...
|
||||
# Redhat7
|
||||
#eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
|
||||
# inet 10.1.0.178 netmask 255.255.0.0 broadcast 10.1.255.255
|
||||
#
|
||||
##############################################################
|
||||
my @adapter= split /\n{2,}/, $result;
|
||||
foreach ( @adapter ) {
|
||||
if ( !($_ =~ /LOOPBACK/ ) and
|
||||
$_ =~ /UP( |,|>)/ and
|
||||
$_ =~ /$mode/ ) {
|
||||
if ( !($_ =~ /LOOPBACK / ) and
|
||||
$_ =~ /UP / and
|
||||
$_ =~ /$mode / ) {
|
||||
my @ip = split /\n/;
|
||||
for my $ent ( @ip ) {
|
||||
if ($ent =~ /^(eth\d|ib\d|hf\d)\s+/) {
|
||||
$nic = $1;
|
||||
}
|
||||
if ($ent =~ /^(eth\d:|ib\d:|hf\d:)\s+/) {
|
||||
$nic = $1;
|
||||
}
|
||||
$ent=~ s/addr://; # works for Redhat7 also
|
||||
if ( $ent =~ /^\s*inet \s*(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
}
|
||||
if ( $ent =~ /^\s*inet addr:\s*(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
$iphash{$nic} = $1;
|
||||
next;
|
||||
}
|
||||
@@ -1628,10 +1620,8 @@ sub gethost_ips
|
||||
else
|
||||
{
|
||||
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
|
||||
#@ip = split(":", $addr1);
|
||||
#push @ipaddress, $ip[1];
|
||||
$addr1 =~ s/.*://;
|
||||
push @ipaddress, $addr1;
|
||||
@ip = split(":", $addr1);
|
||||
push @ipaddress, $ip[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1991,108 +1981,6 @@ sub isIpaddr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 getSubnetGateway
|
||||
Description:
|
||||
Get gateway from the networks table of the specified net.
|
||||
|
||||
Arguments:
|
||||
net: the net, ie. the "net" field of the networks table
|
||||
Returns:
|
||||
Return a string, of the gateway
|
||||
undef - Failed to get the gateway
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $gateway = xCAT::NetworkUtils::getSubnetGateway('192.168.1.0');
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getSubnetGateway
|
||||
{
|
||||
my $netname=shift;
|
||||
if( $netname =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$netname=shift;
|
||||
}
|
||||
|
||||
my $gateway=undef;
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
unless($nettab) { die "No entry defined in networks"; }
|
||||
my @nets = $nettab->getAllAttribs('net','gateway');
|
||||
foreach(@nets)
|
||||
{
|
||||
if("$_->{net}" eq "$netname")
|
||||
{
|
||||
$gateway = $_->{gateway};
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 getNodeNameservers
|
||||
Description:
|
||||
Get nameservers of specified nodes.
|
||||
The priority: noderes.nameservers > networks.nameservers > site.nameservers
|
||||
Arguments:
|
||||
node: node name list
|
||||
Returns:
|
||||
Return a hash ref, of the $nameservers{$node}
|
||||
undef - Failed to get the nameservers
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $nameservers = xCAT::NetworkUtils::getNodeNameservers(\@node);
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getNodeNameservers{
|
||||
my $nodes=shift;
|
||||
if( $nodes =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$nodes=shift;
|
||||
}
|
||||
my @nodelist = @$nodes;
|
||||
my %nodenameservers;
|
||||
my $nrtab = xCAT::Table->new('noderes',-create=>0);
|
||||
my %nrhash = %{$nrtab->getNodesAttribs(\@nodelist,['nameservers'])};
|
||||
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
my %nethash = xCAT::DBobjUtils->getNetwkInfo( \@nodelist );
|
||||
|
||||
my @nameservers = xCAT::TableUtils->get_site_attribute("nameservers");
|
||||
my $sitenameservers=$nameservers[0];
|
||||
|
||||
|
||||
foreach my $node (@nodelist){
|
||||
if ($nrhash{$node} and $nrhash{$node}->[0] and $nrhash{$node}->[0]->{nameservers})
|
||||
{
|
||||
$nodenameservers{$node}=$nrhash{$node}->[0]->{nameservers};
|
||||
}elsif($nethash{$node}{nameservers})
|
||||
{
|
||||
$nodenameservers{$node}=$nethash{$node}{nameservers};
|
||||
}elsif($sitenameservers)
|
||||
{
|
||||
$nodenameservers{$node}=$sitenameservers;
|
||||
}
|
||||
}
|
||||
|
||||
return \%nodenameservers;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getNodeNetworkCfg
|
||||
@@ -2119,23 +2007,17 @@ sub getNodeNameservers{
|
||||
sub getNodeNetworkCfg
|
||||
{
|
||||
my $node = shift;
|
||||
if( $node =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$node =shift;
|
||||
}
|
||||
|
||||
|
||||
my $nets = xCAT::NetworkUtils::my_nets();
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
my $mask = undef;
|
||||
my $gateway = undef;
|
||||
for my $net (keys %$nets)
|
||||
{
|
||||
my $netname;
|
||||
($netname,$mask) = split /\//, $net;
|
||||
$gateway=xCAT::NetworkUtils::getSubnetGateway($netname);
|
||||
last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1));
|
||||
}
|
||||
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0));
|
||||
return ($ip, $node, undef, xCAT::NetworkUtils::formatNetmask($mask,1,0));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -2313,7 +2195,6 @@ sub isValidHostname
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 isValidFQDN
|
||||
|
||||
@@ -156,7 +156,7 @@ sub connect {
|
||||
# Shell prompt regexp based on HW Type
|
||||
##################################################
|
||||
my %prompt = (
|
||||
hmc => "~>\\s*\$",
|
||||
hmc => "~> \$",
|
||||
ivm => "\\\$ \$"
|
||||
);
|
||||
##################################################
|
||||
|
||||
@@ -921,11 +921,6 @@ site => {
|
||||
" '0' value means include all the nodes in the subnet.\n\n".
|
||||
" pruneservices: Whether to enable service pruning when noderm is run (i.e.\n".
|
||||
" removing DHCP entries when noderm is executed)\n\n".
|
||||
" managedaddressmode: The mode of networking configuration during node provision.\n".
|
||||
" If set to 'static', the network configuration will be configured \n".
|
||||
" in static mode based on the node and network definition on MN.\n".
|
||||
" If set to 'dhcp', the network will be configured with dhcp protocol.\n".
|
||||
" The default is 'dhcp'.\n\n".
|
||||
" ------------\n".
|
||||
"DNS ATTRIBUTES\n".
|
||||
" ------------\n".
|
||||
@@ -946,12 +941,6 @@ site => {
|
||||
" \"<xcatmaster>\" to mean the DNS server for each node should be the\n".
|
||||
" node that is managing it (either its service node or the management\n".
|
||||
" node).\n\n".
|
||||
" externaldns: To specify that external dns is used. If externaldns is set to any value\n".
|
||||
" then, makedns command will not start the local nameserver on xCAT MN. \n".
|
||||
" Default is to start the local nameserver.\n\n".
|
||||
" dnsupdaters: The value are \',\' separated string which will be added to the zone config\n".
|
||||
" section. This is an interface for user to add configuration entries to\n".
|
||||
" the zone sections in named.conf.\n\n".
|
||||
" -------------------------\n".
|
||||
"HARDWARE CONTROL ATTRIBUTES\n".
|
||||
" -------------------------\n".
|
||||
@@ -1107,10 +1096,6 @@ site => {
|
||||
" will not interfere.\n\n".
|
||||
" vmwarereconfigonpower: When set to no, the VMWare plugin will make no effort to\n".
|
||||
" push vm.cpus/vm.memory updates from xCAT to VMWare.\n\n".
|
||||
" persistkvmguests: Keep the kvm definition on the kvm hypervisor when you power off\n".
|
||||
" the kvm guest node. This is useful for you to manually change the \n".
|
||||
" kvm xml definition file in virsh for debugging. Set anything means\n".
|
||||
" enable.\n\n".
|
||||
" --------------------\n".
|
||||
"XCAT DAEMON ATTRIBUTES\n".
|
||||
" --------------------\n".
|
||||
@@ -1583,18 +1568,7 @@ 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
|
||||
|
||||
|
||||
|
||||
Executable → Regular
+3
-4
@@ -429,6 +429,7 @@ rmdir \"/tmp/$to_userid\" \n";
|
||||
# Need to check if nodes are in a zone.
|
||||
my @zones;
|
||||
my $tab = xCAT::Table->new("zone");
|
||||
my @zones;
|
||||
if ($tab)
|
||||
{
|
||||
# if we have zones, need to send the zone keys to each node in the zone
|
||||
@@ -622,7 +623,7 @@ sub sendkeysTOzones
|
||||
my ($class, $ref_nodes,$expecttimeout) = @_;
|
||||
my @nodes=$ref_nodes;
|
||||
my $n_str = $nodes[0];
|
||||
@nodes= split(",", $n_str);
|
||||
my @nodes= split(",", $n_str);
|
||||
my $rsp = ();
|
||||
my $cmd;
|
||||
my $roothome = xCAT::Utils->getHomeDir("root");
|
||||
@@ -1177,9 +1178,7 @@ sub getAppStatus
|
||||
my ($class, $nodes_ref, $application) = @_;
|
||||
my @nodes = @$nodes_ref;
|
||||
|
||||
# FIXME: why autocommit matters for a read-only subroutine getNodesAttribs?
|
||||
# but could not get the appstatus without the autocommit=0
|
||||
my $nltab = xCAT::Table->new('nodelist', -autocommit => 0);
|
||||
my $nltab = xCAT::Table->new('nodelist');
|
||||
my $nodeappstat = $nltab->getNodesAttribs(\@nodes,['appstatus']);
|
||||
|
||||
my $ret_nodeappstat;
|
||||
|
||||
@@ -222,7 +222,7 @@ my %usage = (
|
||||
lsvm <noderange> [-a|--all]
|
||||
PPC (using Direct FSP Management) specific:
|
||||
lsvm <noderange> [-l|--long] --p775
|
||||
lsvm <noderange>
|
||||
lsvm <noderange>
|
||||
zVM specific:
|
||||
lsvm noderange
|
||||
lsvm noderange --getnetworknames
|
||||
|
||||
@@ -3487,60 +3487,4 @@ sub fullpathbin
|
||||
|
||||
return $fullpath;
|
||||
}
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 gettimezone
|
||||
returns the name of the timezone defined on the Linux distro.
|
||||
This routine was written to replace the use of /etc/sysconfig/clock which in no
|
||||
longer supported on future Linux releases such as RHEL7. It is suppose to be a routine
|
||||
that can find the timezone on any Linux OS or AIX.
|
||||
Arguments:
|
||||
none
|
||||
Returns:
|
||||
Name of timezone, for example US/Eastern
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
None
|
||||
Example:
|
||||
my $timezone = xCAT::Utils->gettimezone();
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub gettimezone
|
||||
{
|
||||
my ($class) = @_;
|
||||
|
||||
my $tz;
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
$tz= $ENV{'TZ'};
|
||||
} else { # all linux
|
||||
my $localtime = "/etc/localtime";
|
||||
my $zoneinfo = "/usr/share/zoneinfo";
|
||||
my $cmd = "find $zoneinfo -type f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV";
|
||||
my $zone_result = xCAT::Utils->runcmd("$cmd", 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
$tz="Could not determine timezone checksum";
|
||||
return $tz;
|
||||
}
|
||||
my @zones = split /\n/, $zone_result;
|
||||
|
||||
$zones[0] =~ s/$zoneinfo\///;
|
||||
if (!$zones[0]) { # if we still did not get one, then default
|
||||
$tz = `cat /etc/timezone`;
|
||||
chomp $tz;
|
||||
} else {
|
||||
$tz=$zones[0];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return $tz;
|
||||
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -29,7 +29,6 @@ require Exporter;
|
||||
"1272326751.405938" => "centos5.5",
|
||||
"1330913492.861127" => "centos5.8",#x86_64
|
||||
"1357930415.252042" => "centos5.9",#x86_64
|
||||
"1381776971.473332" => "centos5.10",#x86_64
|
||||
"1195488871.805863" => "centos4.6",
|
||||
"1195487524.127458" => "centos4.6",
|
||||
"1301444731.448392" => "centos5.6",
|
||||
@@ -71,7 +70,6 @@ require Exporter;
|
||||
"1321545261.599847" => "rhelhpc6.2",#x86_64
|
||||
"1339640148.070971" => "rhelhpc6.3",#x86_64
|
||||
"1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode
|
||||
"1384196516.465862" => "rhelhpc6.5",#x86_64, RHEL ComputeNode
|
||||
"1194015916.783841" => "fedora8",
|
||||
"1194015385.299901" => "fedora8",
|
||||
"1210112435.291709" => "fedora9",
|
||||
|
||||
+3755
-917
File diff suppressed because it is too large
Load Diff
@@ -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`;
|
||||
# causing problems on other platforms $out =~ s/\h+/ /g;$out =~ s/\h+/ /g;
|
||||
$out =~ s/\h+/ /g;
|
||||
my @results = split(' ', $out);
|
||||
return ($results[3]);
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ if [ $OS != "AIX" ]; then
|
||||
mkdir -p /tmp/gpfs_updates
|
||||
rm -f -R /tmp/gpfs_updates/*
|
||||
cd /tmp/gpfs_updates
|
||||
# wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=3 ftp://$MASTER/$UPDATES_DIR/*.rpm 2> /tmp/wget.log
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=4 --reject "index.html*" --no-parent http://$MASTER$INSTALL_DIR/$UPDATES_DIR/ 2> /tmp/wget.log
|
||||
# wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=3 ftp://$SITEMASTER/$UPDATES_DIR/*.rpm 2> /tmp/wget.log
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=4 --reject "index.html*" --no-parent http://$SITEMASTER$INSTALL_DIR/$UPDATES_DIR/ 2> /tmp/wget.log
|
||||
if [ -n "`ls *.rpm 2> /dev/null`" ] ; then
|
||||
rpm -Uvh *.rpm
|
||||
fi
|
||||
|
||||
@@ -67,13 +67,11 @@ sub opsaddbmnode {
|
||||
|
||||
my $help;
|
||||
my $version;
|
||||
my $verbose;
|
||||
my $host;
|
||||
|
||||
if(!GetOptions(
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$version,
|
||||
'V|verbose' => \$verbose,
|
||||
's=s' => \$host,
|
||||
))
|
||||
{
|
||||
@@ -245,18 +243,7 @@ sub opsaddbmnode {
|
||||
$disk = 1;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
#print "$bmc, $bmc_user, $bmc_password, $mac, $cpu, $memory, $disk\n";
|
||||
|
||||
#call OpenStack command to add the node into the OpenStack as
|
||||
#a baremetal node.
|
||||
@@ -276,14 +263,7 @@ sub opsaddbmnode {
|
||||
}
|
||||
$cmd_tmp .= " $host $cpu $memory $disk $mac";
|
||||
|
||||
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);
|
||||
}
|
||||
my $cmd = qq~source \~/openrc;$cmd_tmp~;
|
||||
#print "cmd=$cmd\n";
|
||||
my $output =
|
||||
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$host], $cmd, 0);
|
||||
@@ -291,17 +271,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +296,6 @@ sub opsaddimage {
|
||||
|
||||
my $help;
|
||||
my $version;
|
||||
my $verbose;
|
||||
#my $cloud;
|
||||
my $ops_img_names;
|
||||
my $controller;
|
||||
@@ -333,7 +303,6 @@ sub opsaddimage {
|
||||
if(!GetOptions(
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$version,
|
||||
'V|verbose' => \$verbose,
|
||||
'c=s' => \$controller,
|
||||
'n=s' => \$ops_img_names,
|
||||
))
|
||||
@@ -422,46 +391,16 @@ 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;$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 $cmd = qq~touch /tmp/$image.qcow2;source \~/openrc;$cmd_tmp;rm /tmp/$image.qcow2~;
|
||||
#print "cmd=$cmd\ncontroller=$controller\n";
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -906,7 +845,7 @@ sub opsaddbmnode_usage {
|
||||
|
||||
$rsp->{data}->[0]= "Usage: opsaddbmnode -h";
|
||||
$rsp->{data}->[1]= " opsaddbmnode -v";
|
||||
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host> [-V]";
|
||||
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host>";
|
||||
$cb->($rsp);
|
||||
}
|
||||
|
||||
@@ -924,7 +863,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> [-V]";
|
||||
$rsp->{data}->[2]= " opsaddimage <image1,image2...> [-n <new_name1,new_name2...> -c <controller>";
|
||||
$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<-V>|B<--verbose>]
|
||||
B<opsaddbmnode> I<noderange> B<-s> I<service_host>
|
||||
|
||||
B<opsaddbmnode> [B<-h>|B<--help>]
|
||||
|
||||
@@ -59,8 +59,6 @@ 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<-V>|B<--verbose>]
|
||||
B<opsaddimage> I<image1,image2,...> B<-n> I<new_name1,new_name2,...> [B<-c> I<controller>]
|
||||
|
||||
B<opsaddimage> [B<-h>|B<--help>]
|
||||
|
||||
@@ -35,8 +35,6 @@ 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
|
||||
|
||||
@@ -38,6 +38,8 @@ if (scalar(@ARGV)>1) { $usage->(1); }
|
||||
my $hnmatch = $ARGV[0]; # if they specified a hostname match, only show svrs that start with that
|
||||
|
||||
readconf("$ENV{HOME}/.slconfig"); # get the userid and api key from the config file
|
||||
#my $api_username = 'SL276540';
|
||||
#my $api_key = '799d5d9267a927a330ec016f00bfe17e6fc532d203cf68b3b0d997b2d27a3ce1';
|
||||
|
||||
my $slinstalled = eval { push @INC, $CONFIG{apidir}; require SoftLayer::API::SOAP; };
|
||||
if (!$slinstalled) { die "Error: the SoftLayer::API::SOAP perl module is not installed. Download it using 'git clone https://github.com/softlayer/softlayer-api-perl-client' and put the directory in ~/.slconfig ."; }
|
||||
@@ -62,23 +64,12 @@ foreach my $server (@$servers) {
|
||||
print "\tbmc=".$server->{remoteManagementComponent}->{ipmiIpAddress}."\n";
|
||||
print "\tbmcusername=".$server->{remoteManagementAccounts}->[0]->{username}."\n";
|
||||
print "\tbmcpassword=".$server->{remoteManagementAccounts}->[0]->{password}."\n";
|
||||
|
||||
# find the 1st active private nic that is not the bmc
|
||||
foreach my $nic (@{$server->{backendNetworkComponents}}) {
|
||||
#print "nic:\n"; foreach my $key (keys(%$nic)) { print " $key = ", $nic->{$key}, "\n"; }
|
||||
if ($nic->{status} eq 'ACTIVE' && $nic->{name} eq 'eth' && $nic->{macAddress} && $nic->{primaryIpAddress}) {
|
||||
# found it
|
||||
print "\tmac=".$nic->{macAddress}."\n";
|
||||
print "\tip=".$nic->{primaryIpAddress}."\n";
|
||||
}
|
||||
}
|
||||
#print "\tip=".$server->{privateIpAddress}."\n"; # getting this from the backendNetworkComponents instead
|
||||
print "\tserial=".$server->{manufacturerSerialNumber}."\n";
|
||||
print "\tmac=".$server->{backendNetworkComponents}->[0]->{macAddress}."\n";
|
||||
print "\tip=".$server->{privateIpAddress}."\n";
|
||||
print "\tnetboot=xnba\n";
|
||||
print "\tarch=x86_64\n";
|
||||
print "\tusercomment=hostname:".$server->{fullyQualifiedDomainName}.", user:".$server->{operatingSystem}->{passwords}->[0]->{username}.", pw:".$server->{operatingSystem}->{passwords}->[0]->{password}."\n";
|
||||
|
||||
verbose('SoftLayer API bare metal server entry: ' . Dumper($server));
|
||||
#print Dumper($server->{remoteManagementAccounts});
|
||||
#print "#Softlayer_account_info_for ".$server->{fullyQualifiedDomainName} . " Username: ";
|
||||
#print $server->{operatingSystem}->{passwords}->[0]->{username} . " Password: ";
|
||||
|
||||
@@ -13,12 +13,11 @@ use Socket;
|
||||
my $HELP;
|
||||
my $VERBOSE;
|
||||
my $WAITTIME;
|
||||
my $PROVMETHOD;
|
||||
my $XCATNETBOOTTITLE = 'xCAT network boot kernel and initrd';
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [-w <waittime>] [-p <provmethod] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
|
||||
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [-w <waittime>] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
|
||||
if (!$exitcode) {
|
||||
print "Modify the grub config file on the node to boot the specified kernel and initrd.\n";
|
||||
}
|
||||
@@ -31,7 +30,7 @@ if (-f '/etc/os-release') { die "This script doesn't support ubuntu yet.\n"; }
|
||||
Getopt::Long::Configure("bundling");
|
||||
#Getopt::Long::Configure("pass_through");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME, 'p|provmethod=s' => \$PROVMETHOD)) { $usage->(1); }
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME)) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
if (scalar(@ARGV) != 4) { $usage->(1); }
|
||||
@@ -61,29 +60,13 @@ sub addKernelParms {
|
||||
$args->{kernelparms} =~ s/<nodename>/$nodename/g;
|
||||
|
||||
# get node ip and add it to the kernel parms
|
||||
my ($nic, $ip, $netmask, $network, $broadcast, $gateway, $mac) = getNodeIpInfo($args);
|
||||
my ($nic, $ip, $netmask, $gateway) = getNodeIpInfo($args);
|
||||
if (!$ip) { die "Error: could not find the NIC that would connect to the xCAT mgmt node's IP (".$args->{mnip}.").\n"; }
|
||||
# if we are booting genesis, need to add the BOOTIF parm
|
||||
my $bootif;
|
||||
if ($args->{kernelpath} =~ m/genesis\.kernel\.x86_64/) {
|
||||
$bootif = $mac;
|
||||
$bootif =~ s/:/-/g;
|
||||
$bootif = "BOOTIF=01-$bootif";
|
||||
}
|
||||
|
||||
if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') {
|
||||
# add additional parms for sysclone
|
||||
# DEVICE=eth0 IPADDR=10.0.0.99 NETMASK=255.255.255.0 NETWORK=10.0.0.0 BROADCAST=10.0.0.255 GATEWAY=10.0.0.1 GATEWAYDEV=eth0
|
||||
#todo: should we also add ETHER_SLEEP=$WAITTIME textmode=1 dns=$mnip ?
|
||||
$args->{kernelparms} .= " $bootif IPADDR=$ip NETMASK=$netmask NETWORK=$network BROADCAST=$broadcast GATEWAY=$gateway HOSTNAME=$nodename DEVICE=$nic GATEWAYDEV=$nic";
|
||||
}
|
||||
else { # scripted install or genesis shell
|
||||
$args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
|
||||
}
|
||||
$args->{kernelparms} .= " hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
|
||||
}
|
||||
|
||||
|
||||
# get this nodes nic, ip, netmask, gateway, and mac. Returns them in a 5 element array.
|
||||
# get this nodes nic, ip, netmask, and gateway. Returns them in a 4 element array.
|
||||
sub getNodeIpInfo {
|
||||
my $args = shift @_;
|
||||
my ($ipprefix) = $args->{mnip}=~m/^(\d+\.\d+)\./; #todo: this is a hack, just using the 1st 2 octets of the mn ip addr
|
||||
@@ -91,14 +74,13 @@ sub getNodeIpInfo {
|
||||
|
||||
# parse ip addr show output, looking for ipprefix, to determine nic and ip
|
||||
my @output = runcmd("ip addr show");
|
||||
my ($nic, $mac, $ipandmask);
|
||||
my ($nic, $ipandmask);
|
||||
foreach my $line (@output) {
|
||||
my ($nictmp, $mactmp, $iptmp);
|
||||
my ($nictmp, $iptmp);
|
||||
if (($nictmp) = $line=~m/^\d+:\s+(\S+): /) { $nic = $nictmp; } # new stanza, remember it
|
||||
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) |) { $mac = $mactmp; } # got mac, remember it
|
||||
if (($iptmp) = $line=~m/^\s+inet\s+($ipprefix\S+) /) { $ipandmask = $iptmp; last; } # got ip, we are done
|
||||
}
|
||||
my ($ip, $netmask, $network, $broadcast) = convertIpAndMask($ipandmask);
|
||||
my ($ip, $netmask) = convertIpAndMask($ipandmask);
|
||||
|
||||
# if the nic is a bonded nic (common on sl), then find the 1st real nic that is part of it
|
||||
my $realnic = $nic;
|
||||
@@ -106,12 +88,6 @@ sub getNodeIpInfo {
|
||||
my @nics = grep(m/\s+master\s+$nic\s+/, @output);
|
||||
if (!scalar(@nics)) { die "Error: can't find the NICs that are part of $nic.\n"; }
|
||||
($realnic) = $nics[0]=~m/^\d+:\s+(\S+): /;
|
||||
# go back thru the ip add show output and find the mac of this nic
|
||||
foreach my $line (@output) {
|
||||
my ($nictmp, $mactmp, $foundnic);
|
||||
if (($nictmp) = $line=~m/^\d+:\s+(\S+): / && $nictmp eq $realnic) { $foundnic = 1; }
|
||||
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) | && $foundnic) { $mac = $mactmp; last; } # got mac, we are done
|
||||
}
|
||||
}
|
||||
|
||||
# finally, find the gateway
|
||||
@@ -126,37 +102,19 @@ sub getNodeIpInfo {
|
||||
verbose("using xCAT mgmt node IP as the fall back gateway.");
|
||||
}
|
||||
|
||||
verbose("IP info: realnic=$realnic, ip=$ip, netmask=$netmask, gateway=$gateway, mac=$mac");
|
||||
return ($realnic, $ip, $netmask, $network, $broadcast, $gateway, $mac);
|
||||
verbose("IP info: realnic=$realnic, ip=$ip, netmask=$netmask, gateway=$gateway");
|
||||
return ($realnic, $ip, $netmask, $gateway);
|
||||
}
|
||||
|
||||
|
||||
# Convert an ip/mask in slash notation (like 10.1.1.1/26) to separate ip, netmask, network, and broadcast values,
|
||||
# like: 10.1.1.1, 255.255.255.192, 10.1.1.0, 10.1.1.63
|
||||
# Convert an ip/mask in slash notation (like 10.0.0.1/26) to separate ip and netmask like 10.0.0.1 and 255.255.255.192
|
||||
sub convertIpAndMask {
|
||||
my $ipandmask = shift @_;
|
||||
my ($ip, $masknum) = split('/', $ipandmask);
|
||||
|
||||
# build the netmask
|
||||
my $nmbin = oct("0b" . '1' x $masknum . '0' x (32-$masknum)); # create a str like '1111100', then convert to binary
|
||||
my @nmarr=unpack('C4',pack('N',$nmbin)); # separate into the 4 octets
|
||||
my $netmask=join('.',@nmarr); # put them together into the normal looking netmask
|
||||
|
||||
# create binary form of ip
|
||||
my @iparr=split(/\./,$ip);
|
||||
my ( $ipbin ) = unpack('N', pack('C4',@iparr ) );
|
||||
|
||||
# Calculate network address by logical AND operation of ip & netmask and convert network address to IP address format
|
||||
my $netbin = ( $ipbin & $nmbin );
|
||||
my @netarr=unpack('C4', pack('N',$netbin ) );
|
||||
my $network=join(".",@netarr);
|
||||
|
||||
# Calculate broadcast address by inverting the netmask and adding it to the network address
|
||||
my $bcbin = ( $ipbin & $nmbin ) + ( ~ $nmbin );
|
||||
my @bcarr=unpack('C4', pack('N',$bcbin ) ) ;
|
||||
my $broadcast=join(".",@bcarr);
|
||||
|
||||
return ($ip, $netmask, $network, $broadcast);
|
||||
my $netbin = oct("0b" . '1' x $masknum . '0' x (32-$masknum)); # create a str like '1111100', then convert to binary
|
||||
my @netarr=unpack('C4',pack('N',$netbin)); # separate into the 4 octets
|
||||
my $netmask=join('.',@netarr); # put them together into the normal looking netmask
|
||||
return ($ip, $netmask);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,9 +45,7 @@ copyFilesToNodes($noderange, \%bootparms);
|
||||
|
||||
updateGrubOnNodes($noderange, \%bootparms);
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); }
|
||||
if (!$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
|
||||
exit(0);
|
||||
|
||||
@@ -56,28 +54,23 @@ exit(0);
|
||||
sub getBootParms {
|
||||
my $nr = shift @_;
|
||||
my %bootparms;
|
||||
my @output = runcmd("nodels $nr bootparams.kernel bootparams.initrd bootparams.kcmdline nodetype.provmethod");
|
||||
my @output = runcmd("nodels $nr bootparams.kernel bootparams.initrd bootparams.kcmdline");
|
||||
|
||||
# the attributes can be displayed in a different order than requested, so need to grep for them
|
||||
foreach my $attr (qw(bootparams.kernel bootparams.initrd bootparams.kcmdline nodetype.provmethod)) {
|
||||
my ($a) = $attr =~ m/\.(.*)$/;
|
||||
my @gresults = grep(/^\S+:\s+$attr:/, @output);
|
||||
my @gresults;
|
||||
foreach my $a (qw(kernel initrd kcmdline)) {
|
||||
my $attr = "bootparams.$a";
|
||||
@gresults = grep(/^\S+:\s+$attr:/, @output);
|
||||
if (!scalar(@gresults)) { die "Error: attribute $attr not defined for the noderange. Did you run 'nodeset <noderange> osimage=<osimage>' ?\n"; }
|
||||
# for now just pick the 1st one. They should all be the same, except for the node name in kcmdline
|
||||
chomp($gresults[0]);
|
||||
$gresults[0] =~ s/^\S+:\s+$attr:\s*//;
|
||||
$bootparms{$a} = $gresults[0];
|
||||
if ($a eq 'kcmdline') { $bootparms{$a} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|; }
|
||||
}
|
||||
$bootparms{kcmdline} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|;
|
||||
|
||||
# from the nodes provmethod, get the osimage provmethod, so we know the type of install
|
||||
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod");
|
||||
chomp($output[0]);
|
||||
my ($junk, $provmethod) = split(/=/, $output[0]);
|
||||
$bootparms{osimageprovmethod} = $provmethod;
|
||||
|
||||
# get the mgmt node cluster-facing ip addr
|
||||
@output = runcmd('lsdef -t site -ci master');
|
||||
@output = runcmd('lsdef -t site -i master -c');
|
||||
chomp($output[0]);
|
||||
my ($junk, $ip) = split(/=/, $output[0]);
|
||||
$bootparms{mnip} = $ip;
|
||||
@@ -106,7 +99,7 @@ sub copyFilesToNodes {
|
||||
# Form the remote file name, using the last 2 parts of the path, separated by "-"
|
||||
sub remoteFilename {
|
||||
my $f = shift @_;
|
||||
$f =~ s|^.*?([^/]+)/([^/]+)$|$1-$2|;
|
||||
$f =~ s|^.*/([^/]+)/([^/]+)$|$1-$2|;
|
||||
return $f;
|
||||
}
|
||||
|
||||
@@ -120,7 +113,7 @@ sub updateGrubOnNodes {
|
||||
my @output = runcmd('which modifygrub');
|
||||
my $modifygrub = $output[0];
|
||||
chomp($modifygrub);
|
||||
my $cmd = "xdsh $nr -e $modifygrub $vtxt -w $WAITTIME -p " . $bootparms->{osimageprovmethod} . ' ' . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
|
||||
my $cmd = "xdsh $nr -e $modifygrub $vtxt -w $WAITTIME " . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
|
||||
# we need to quote the kernel parms, both here when passing it to xdsh, and on the node
|
||||
# when xdsh is passing it to modifygrub. The way to get single quotes inside single quotes
|
||||
# is to quote each of the outer single quotes with double quotes.
|
||||
@@ -145,55 +138,15 @@ sub modifyAutoinstFiles {
|
||||
# Edit each file to have chroot.sles insert a wait at the end of /etc/init.d/network
|
||||
# this finds the end of boot.sh script (which is chroot.sles)
|
||||
my $search = '\n\]\]>\s*</source>\s*</script>\s*</chroot-scripts>';
|
||||
|
||||
# hack the /etc/init.d/network script to put a wait in it
|
||||
my $file = '/mnt/etc/init.d/network'; # at this point in the installation, the permanent file system is just mounted
|
||||
#my $waitstring = 'echo Sleeping for 55s;sleep 55';
|
||||
# this is the string to insert in the nodes /etc/init.d/network script. It is a while loop pinging the mn, but some of the chars need to be escaped for sed
|
||||
my $waitstring = 'echo -n Waiting to reach xCAT mgmt node ' . $bootparms->{mnip} . '.;xcatretries=60;while \[ \$\(\(xcati+=1\)\) -le \$xcatretries \] \&\& ! ping -c2 -w3 ' . $bootparms->{mnip} .' \>\/dev\/null 2\>\&1; do echo -n .; done; if \[ \$xcati -le \$xcatretries \]; then echo success; else echo failed; fi; sleep 3';
|
||||
# this is the string to insert in the nodes /etc/init.d/network script. It is a while loop pinging the mn, but some of the chars need to be escape for sed
|
||||
my $waitstring = 'echo Waiting to reach xCAT mgmt node...;while \[ \$\(\(xcati+=1\)\) -le 60 \] \&\& ! ping -c2 -w3 ' . $bootparms->{mnip} .'; do echo i=\$xcati ; done; sleep 10';
|
||||
# this crazy sed string is from google. It gathers up the whole file into the hold buffer, and then the substitution is done on the whole file
|
||||
my $sedstring = q|sed -n '1h;1!H;${;g;s/\(\t\treload_firewall\n\)\n/\1\t\t| . $waitstring . q(\n\n/g;p;}') . " $file > $file.new";
|
||||
# finally create the perl replace string that will be used to modify the autoinst file
|
||||
my $replace = "$sedstring\nchmod 755 $file.new; mv -f $file.new $file";
|
||||
|
||||
# Now instead we add a script that gets invoked by the OS after the nic is brought up
|
||||
# these are specific to SLES
|
||||
#my $netdir = '/etc/sysconfig/network';
|
||||
#my $filename = '/etc/sysconfig/network/if-up.d/xcat-sl-wait';
|
||||
#my $mnip = $bootparms->{mnip};
|
||||
#todo: to support rhel, use these values instead
|
||||
#my $netdir='/etc/sysconfig/network-scripts';
|
||||
#my $filename='/sbin/ifup-local';
|
||||
|
||||
# this does not work, because midway thru the autoyast process, the if-up.d scripts do not seem to get invoked
|
||||
# so autoyast fails to get he media
|
||||
#my $replace = qq(
|
||||
#FILENAME=$filename
|
||||
#NETDIR=$netdir
|
||||
#MNIP=$mnip
|
||||
#);
|
||||
# $replace .= q(
|
||||
#cat >$FILENAME << EOF1
|
||||
#MNIP=$MNIP
|
||||
#NETDIR=$NETDIR
|
||||
#EOF1
|
||||
#
|
||||
# this part of the file we do NOT want to expand the variables in the content
|
||||
#cat >>$FILENAME << 'EOF2'
|
||||
#NIC="$1"
|
||||
# look in this ifcfg script to get the nics ip to see if this is the one we should be waiting on
|
||||
#NICIP=`awk -F= '/^IPADDR/ {print $2}' $NETDIR/ifcfg-$NIC | tr -d \' `
|
||||
#if [ "${NICIP%.*.*}" != "${MNIP%.*.*}" ]; then exit; fi # hack: compare the 1st 2 octets
|
||||
#echo -n Waiting to reach xCAT mgmt node $MNIP.
|
||||
#xcatretries=60
|
||||
#while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $MNIP >/dev/null 2>&1; do echo -n .; done
|
||||
#if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
|
||||
#sleep 3
|
||||
#EOF2
|
||||
#
|
||||
#chmod +x $FILENAME
|
||||
#);
|
||||
|
||||
# now actually update the file
|
||||
print "Updating /install/autoinst files.\n";
|
||||
foreach my $n (@nodes) {
|
||||
@@ -204,15 +157,6 @@ sub modifyAutoinstFiles {
|
||||
}
|
||||
|
||||
|
||||
# Copy softlayer specific systemimager post-install scripts to the systemimager location.
|
||||
# These cause si to use static ip and insert a wait into the bring up of the network.
|
||||
sub copySyscloneFiles {
|
||||
my $cmd = "cp -f /opt/xcat/share/xcat/sysclone/post-install/* /install/sysclone/scripts/post-install";
|
||||
print "Copying SoftLayer-specific post scripts to the SystemImager post-install directory.\n";
|
||||
runcmd($cmd);
|
||||
}
|
||||
|
||||
|
||||
# this is like multi-line sed replace function
|
||||
# Args: filename, search-string, replace-string
|
||||
sub sed {
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Add a script that will run when the network is brought up to wait until the
|
||||
# xcat mn can be pinged.
|
||||
|
||||
. /tmp/post-install/variables.txt
|
||||
|
||||
if [ -d "/etc/sysconfig/network-scripts/" ];then
|
||||
#redhat
|
||||
NETDIR=/etc/sysconfig/network-scripts
|
||||
filename=/sbin/ifup-local
|
||||
elif [ -d "/etc/sysconfig/network/" ];then
|
||||
#suse
|
||||
NETDIR=/etc/sysconfig/network
|
||||
filename=/etc/sysconfig/network/if-up.d/xcat-sl-wait
|
||||
else
|
||||
#ubuntu
|
||||
echo "Does not support ubuntu."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the wait script, overwriting a copy that may have come from the golden client
|
||||
# (in case the mn/image server is different).
|
||||
# this part of the file we want to expand the variables in the content
|
||||
cat >$filename << EOF1
|
||||
MNIP=$IMAGESERVER
|
||||
NETDIR=$NETDIR
|
||||
EOF1
|
||||
|
||||
# this part of the file we do NOT want to expand the variables in the content
|
||||
cat >>$filename << 'EOF2'
|
||||
NIC="$1"
|
||||
# look in this ifcfg script to get the nics ip to see if this is the one we should be waiting on
|
||||
NICIP=`awk -F= '/^IPADDR/ {print $2}' $NETDIR/ifcfg-$NIC | tr -d \' `
|
||||
if [ "${NICIP%.*.*}" != "${MNIP%.*.*}" ]; then exit; fi # hack: compare the 1st 2 octets
|
||||
echo -n Waiting to reach xCAT mgmt node $MNIP.
|
||||
xcatretries=60
|
||||
while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $MNIP >/dev/null 2>&1; do echo -n .; done
|
||||
if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
|
||||
sleep 3
|
||||
EOF2
|
||||
|
||||
chmod +x $filename
|
||||
@@ -1,101 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configure network settings after SI has installed the OS
|
||||
|
||||
. /tmp/post-install/variables.txt
|
||||
|
||||
# determine if we should be using a static ip or dhcp
|
||||
staticIP () {
|
||||
# Eventually we should use the SI variable IP_ASSIGNMENT_METHOD below to determine this.
|
||||
# But this requires a patch in both xcat/sysclone (to set si_getimage -ip-assignment method)
|
||||
# and SI (to set IP_ASSIGNMENT_METHOD as a result of that). Until both of those patches
|
||||
# are in the main releases, assume that if we have set the IPADDR kernel parm for the boot
|
||||
# kernel to use static ip, that the final OS should use static ip too.
|
||||
# Note: the IPADDR environment variable will be set by SI, even if it got it thru dhcp, so
|
||||
# that is not a reliable way to decide.
|
||||
str=`cat /proc/cmdline`
|
||||
#str='netmask=255.255.255.192 IPADDR=10.54.51.11 GATEWAY=10.54.51.1 dns=10.54.51.2 hostname=sap64-4 DEVICE=eth0'
|
||||
for parm in $str; do
|
||||
key=`echo $parm|awk -F= '{print $1}'`
|
||||
value=`echo $parm|awk -F= '{print $2}'`
|
||||
if [[ $key == "IPADDR" || $key == "ipaddr" ]]; then
|
||||
return 0 # yes, we should use static ip
|
||||
fi
|
||||
done
|
||||
if [[ -n $IP_ASSIGNMENT_METHOD && ${IP_ASSIGNMENT_METHOD,,} == "static" ]]; then
|
||||
return 0 # this means yes/true
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
#delete the udev rule in the image
|
||||
rule_file=`ls /etc/udev/rules.d/*net_persistent_names.rules 2>/dev/null`
|
||||
if [ -n "$rule_file" ];then
|
||||
rm -f $rule_file
|
||||
fi
|
||||
|
||||
hostname $HOSTNAME
|
||||
|
||||
device_names=`ifconfig -a | grep -i hwaddr | grep -i 'Ethernet' | grep -v usb| awk '{print $1}'`
|
||||
str_cfg_file=''
|
||||
if [ -d "/etc/sysconfig/network-scripts/" ];then
|
||||
#redhat
|
||||
grep -i HOSTNAME /etc/sysconfig/network
|
||||
if [ $? -eq 0 ];then
|
||||
sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network
|
||||
else
|
||||
echo "HOSTNAME=$HOSTNAME" >> /etc/sysconfig/network
|
||||
fi
|
||||
if staticIP; then
|
||||
# set static ip from variables in variables.txt
|
||||
i="$DEVICE"
|
||||
str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=static" >> $str_cfg_file
|
||||
echo "ONBOOT=yes" >> $str_cfg_file
|
||||
echo "IPADDR=$IPADDR" >> $str_cfg_file
|
||||
echo "NETMASK=$NETMASK" >> $str_cfg_file
|
||||
echo "NETWORK=$NETWORK" >> $str_cfg_file
|
||||
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
|
||||
#todo: add gateway config? Not sure, because the boot kernels gateway might not be the final OS gateway
|
||||
else
|
||||
# use dhcp for all nics
|
||||
for i in $device_names;do
|
||||
str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=dhcp" >> $str_cfg_file
|
||||
echo "NM_CONTROLLED=yes" >> $str_cfg_file
|
||||
echo "ONBOOT=yes" >> $str_cfg_file
|
||||
done
|
||||
fi
|
||||
elif [ -d "/etc/sysconfig/network/" ];then
|
||||
#suse
|
||||
echo "$HOSTNAME" > /etc/HOSTNAME
|
||||
if staticIP; then
|
||||
# set static ip from variables in variables.txt
|
||||
i="$DEVICE"
|
||||
str_cfg_file="/etc/sysconfig/network/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=static" >> $str_cfg_file
|
||||
echo "STARTMODE=onboot" >> $str_cfg_file
|
||||
echo "IPADDR=$IPADDR" >> $str_cfg_file
|
||||
echo "NETMASK=$NETMASK" >> $str_cfg_file
|
||||
echo "NETWORK=$NETWORK" >> $str_cfg_file
|
||||
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
|
||||
#todo: add gateway config? Not sure, because the boot kernels gateway might not be the final OS gateway
|
||||
else
|
||||
# use dhcp for all nics
|
||||
for i in $device_names;do
|
||||
str_cfg_file="/etc/sysconfig/network/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=dhcp" >> $str_cfg_file
|
||||
echo "STARTMODE=onboot" >> $str_cfg_file
|
||||
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> $str_cfg_file
|
||||
done
|
||||
fi
|
||||
else
|
||||
#ubuntu
|
||||
echo "Does not support ubuntu."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -47,7 +47,6 @@ mkdir -p $RPM_BUILD_ROOT/install/postscripts
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
|
||||
|
||||
cp -p -R share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
|
||||
|
||||
@@ -57,9 +56,6 @@ chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
|
||||
cp -d postscripts/* $RPM_BUILD_ROOT/install/postscripts
|
||||
chmod 755 $RPM_BUILD_ROOT/install/postscripts/*
|
||||
|
||||
cp -d si-post-install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
|
||||
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install/*
|
||||
|
||||
cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer/*
|
||||
|
||||
|
||||
+28
-59
@@ -8,9 +8,10 @@
|
||||
|
||||
|
||||
|
||||
This script automates the setup of the MySQL/MariaDB server and creates the xCAT database to run
|
||||
xCAT on MySQL/MariaDB.
|
||||
Note: it will setup an xcat database (xcatdb),a xcatadmin id , and a MySQL root password.
|
||||
This is script is called after the installation or upgrade of MySQL
|
||||
on xCAT. It will automate the setup of the MySQL and xCAT to run
|
||||
xCAT on the MySQL DB.
|
||||
Note: if will setup an xcatdb,a xcatadmin, and a MySQL root password.
|
||||
It will interact for the
|
||||
password to assign, unless the XCATMYSQLADMIN_PW and the XCATMYSQLROOT_PW
|
||||
env variables are set to the admin and mysql root password, resp.
|
||||
@@ -149,8 +150,8 @@ $::linuxos = xCAT::Utils->osver();
|
||||
|
||||
#
|
||||
# check to see if mysql is installed
|
||||
#
|
||||
my $cmd = "rpm -qa | grep -i perl-DBD-mysql";
|
||||
#
|
||||
my $cmd = "rpm -qa | grep mysql";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "dpkg -l | grep mysql-server";
|
||||
}
|
||||
@@ -158,17 +159,10 @@ xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $message =
|
||||
"\nMySQL perl DBD is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs.";
|
||||
"\nMySQL is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs.";
|
||||
xCAT::MsgUtils->message("E", " $cmd failed. $message");
|
||||
exit(1);
|
||||
}
|
||||
# is this MariaDB or MySQL
|
||||
$::MariaDB=0;
|
||||
$cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC == 0) {
|
||||
$::MariaDB=1;
|
||||
}
|
||||
|
||||
# check to see if MySQL is running
|
||||
$::mysqlrunning = 0;
|
||||
@@ -334,6 +328,7 @@ if (($::INIT) && ($::xcatrunningmysql == 0))
|
||||
# MySQL not running, then initialize the database
|
||||
if ($::mysqlrunning == 0)
|
||||
{
|
||||
|
||||
# Add mysql user and group for AIX
|
||||
# Correct directory permissions
|
||||
#
|
||||
@@ -441,7 +436,7 @@ sub usage
|
||||
{
|
||||
xCAT::MsgUtils->message(
|
||||
'I',
|
||||
"Usage:\nmysqlsetup - Performs the setup of MySQL or MariaDB for xCAT to use as its database. See man mysqlsetup for more information."
|
||||
"Usage:\nmysqlsetup - Performs the setup of MySQL for xCAT to use as its database. See man mysqlsetup for more information."
|
||||
);
|
||||
my $msg =
|
||||
"mysqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-f|hostfile] [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-u|--update> <-f|hostfile> [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]\n <-L|--LL> [-V|--verbose]";
|
||||
@@ -875,20 +870,14 @@ sub mysqlstart
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($::MariaDB==1) { # running MariaDB
|
||||
$cmd = "service mariadb start";
|
||||
|
||||
} else { # it is mysql
|
||||
|
||||
if ($::linuxos =~ /rh.*/)
|
||||
{
|
||||
if ($::linuxos =~ /rh.*/)
|
||||
{
|
||||
$cmd = "service mysqld start";
|
||||
}
|
||||
else
|
||||
{ # sles
|
||||
}
|
||||
else
|
||||
{ # sles
|
||||
$cmd = "service mysql start";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
@@ -984,21 +973,16 @@ sub mysqlreboot
|
||||
}
|
||||
else # linux
|
||||
{
|
||||
if ($::MariaDB==1 ) { # MariaDB not MySQL
|
||||
|
||||
$cmd = "chkconfig mariadb on";
|
||||
} else { # mysql
|
||||
if ($::linuxos =~ /rh.*/)
|
||||
{
|
||||
$cmd = "chkconfig mysqld on";
|
||||
}
|
||||
else
|
||||
{ # sles
|
||||
$cmd = "chkconfig mysql on";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "update-rc.d mysql defaults";
|
||||
}
|
||||
}
|
||||
if ($::linuxos =~ /rh.*/)
|
||||
{
|
||||
$cmd = "chkconfig mysqld on";
|
||||
}
|
||||
else
|
||||
{ # sles
|
||||
$cmd = "chkconfig mysql on";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "update-rc.d mysql defaults";
|
||||
}
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
@@ -1074,12 +1058,7 @@ sub setupxcatdb
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $pwd_sent = 0;
|
||||
my $pwd_prompt = 'Enter password: ';
|
||||
my $mysql_prompt;
|
||||
if ($::MariaDB == 1) { # setup MariaDB
|
||||
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
|
||||
} else {
|
||||
$mysql_prompt = 'mysql> ';
|
||||
}
|
||||
my $mysql_prompt = 'mysql> ';
|
||||
my $expect_log = undef;
|
||||
my $debug = 0;
|
||||
#if ($::VERBOSE)
|
||||
@@ -1199,12 +1178,7 @@ sub setupLL
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $pwd_sent = 0;
|
||||
my $pwd_prompt = 'Enter password: ';
|
||||
my $mysql_prompt;
|
||||
if ($::MariaDB == 1) { # setup MariaDB
|
||||
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
|
||||
} else {
|
||||
$mysql_prompt = 'mysql> ';
|
||||
}
|
||||
my $mysql_prompt = 'mysql> ';
|
||||
my $expect_log = undef;
|
||||
my $debug = 0;
|
||||
#if ($::VERBOSE)
|
||||
@@ -1334,12 +1308,7 @@ sub addhosts
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $pwd_sent = 0;
|
||||
my $pwd_prompt = 'Enter password: ';
|
||||
my $mysql_prompt;
|
||||
if ($::MariaDB == 1) { # setup MariaDB
|
||||
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
|
||||
} else {
|
||||
$mysql_prompt = 'mysql> ';
|
||||
}
|
||||
my $mysql_prompt = 'mysql> ';
|
||||
my $expect_log = undef;
|
||||
|
||||
foreach my $host (@hosts)
|
||||
|
||||
@@ -65,7 +65,7 @@ else { # the normal case of the user running the cmd - expand the noderange us
|
||||
SSL_cert_file=> xCAT::Utils->getHomeDir()."/.xcat/client-cred.pem",
|
||||
SSL_ca_file => xCAT::Utils->getHomeDir()."/.xcat/ca.pem",
|
||||
SSL_use_cert => 1,
|
||||
SSL_verify_mode => 1,
|
||||
#SSL_verify_mode => 1,
|
||||
);
|
||||
die "Connection failure: $!\n" unless ($client);
|
||||
my %cmdref = (command => 'noderange', noderange => $noderange);
|
||||
|
||||
+1
-1
@@ -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] [-t <timeout value in seconds>] <noderange> <command>\n";
|
||||
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] [--nonodecheck] <noderange> <command>\n";
|
||||
exit;
|
||||
}
|
||||
my %nodehdl;
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
=head1 Name
|
||||
|
||||
B<mkvlan> - Create vlan on switches
|
||||
|
||||
=head1 B<Synopsis>
|
||||
|
||||
B<mkvlan> [B<-h>|B<--help>|B<?>|B<-v>|B<--version>]
|
||||
|
||||
B<mkvlan> {Ivlanid} -n I<noderange> {B-i <interface>|B-m <netmask> |B-t <subnet>}
|
||||
|
||||
=head1 B<Description>
|
||||
|
||||
B<mkvlan> creates tagged vlan on the switches corresponding to the attributes defined in the B<switch> table
|
||||
|
||||
=head1 B<Options>
|
||||
|
||||
=over 7
|
||||
|
||||
=item B<vlanid>
|
||||
|
||||
The vlan to tag on the switch.
|
||||
|
||||
=item B<interface>
|
||||
|
||||
List all buses for each I/O slot.
|
||||
|
||||
=item B<netmask>
|
||||
|
||||
Retrieves number of processors, speed, total memory, and DIMM
|
||||
locations.
|
||||
|
||||
=item B<subnet>
|
||||
|
||||
Retrieves model number.
|
||||
|
||||
=item B<-h>|B<--help>|B<?>
|
||||
|
||||
Print help.
|
||||
|
||||
=item B<-v>|B<--version>
|
||||
|
||||
Print version.
|
||||
|
||||
=back
|
||||
|
||||
=back
|
||||
|
||||
=head1 B<Examples>
|
||||
|
||||
=over 4
|
||||
|
||||
=item *
|
||||
|
||||
To make a private vlan for stand-alone nodes for the management network, enter:
|
||||
|
||||
mkvlan -n node1,node2,node3
|
||||
|
||||
=item *
|
||||
|
||||
You can specify vlan id, subnet and netmask etc, enter:
|
||||
|
||||
mkvlan 3 -n node1,node2,node3 -t 10.3.2.0 -m 255.255.255.0
|
||||
|
||||
=item *
|
||||
|
||||
To create a tagged vlan on an interface, enter:
|
||||
|
||||
mkvlan -n node1,node2,node3 -i eth1
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<noderange(3)|noderange.3>, L<lsvlan(1)|lsvlan.1>
|
||||
@@ -1,6 +1,6 @@
|
||||
=head1 NAME
|
||||
|
||||
B<mysqlsetup> - Sets up the MySQL or MariaDB database for xCAT to use.
|
||||
B<mysqlsetup> - Sets up the MySQL database for xCAT to use.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@@ -19,10 +19,9 @@ B<mysqlsetup> {B<-L>|B<--LL>} [-V|--verbose]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<mysqlsetup> - Sets up the MySQL or MariaDB database (linux only for MariaDB) for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code or MariaDB code has been installed. Before running the init option, the MySQL server should be stopped, if it is running. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL or MariaDB and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in
|
||||
B<mysqlsetup> - Sets up the MySQL database for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code has been installed. Before running the init option, the MySQL server should be stopped. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_MySQL_as_the_xCAT_DB
|
||||
Two passwords must be supplied for the setup, a password for the xcatadmin id and a password for the root id in the MySQL database. These will be prompted for interactively, unless the environment variables XCATMYSQLADMIN_PW and XCATMYSQLROOT_PW are set to the passwords for the xcatadmin id and root id in the database,resp.
|
||||
Note below we refer to MySQL but it works the same for MariaDB.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
@@ -42,8 +41,8 @@ Displays verbose messages.
|
||||
|
||||
=item B<-i|--init>
|
||||
|
||||
The init option is used to setup a xCAT database on an installed MySQL or MariaDB server for xCAT to use. The mysqlsetup script will check for the installed MariaDB server rpm first and will use MariaDB if it is installed. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database.
|
||||
On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL or MariaDB rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init.
|
||||
The init option is used to setup an installed MySQL database so that xCAT can use the database. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database.
|
||||
On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init.
|
||||
|
||||
=item B<-u|--update>
|
||||
|
||||
|
||||
@@ -123,28 +123,6 @@ Wake up the target nodes which is in B<suspend> state.
|
||||
|
||||
Don't try to run B<wake> against the 'on' state node, it would cause the node gets to 'off' state.
|
||||
|
||||
For some of xCAT hardware such as NeXtScale, it may need to enable S3 before using B<wake>. The following steps can be used to enable S3. Please reference L<pasu(1)|pasu.1> for "pasu" usage.
|
||||
|
||||
[root@xcatmn home]# echo "set Power.S3Enable Enable" > power-setting
|
||||
[root@xcatmn home]# pasu -b power-setting node01
|
||||
node01: Batch mode start.
|
||||
node01: [set Power.S3Enable Enable]
|
||||
node01: Power.S3Enable=Enable
|
||||
node01:
|
||||
node01: Beginning intermediate batch update.
|
||||
node01: Waiting for command completion status.
|
||||
node01: Command completed successfully.
|
||||
node01: Completed intermediate batch update.
|
||||
node01: Batch mode completed successfully.
|
||||
|
||||
[root@xcatmn home]# pasu node01 show all|grep -i s3
|
||||
node01: IMM.Community_HostIPAddress3.1=
|
||||
node01: IMM.Community_HostIPAddress3.2=
|
||||
node01: IMM.Community_HostIPAddress3.3=
|
||||
node01: IMM.DNS_IP_Address3=0.0.0.0
|
||||
node01: IMM.IPv6DNS_IP_Address3=::
|
||||
node01: Power.S3Enable=Enable
|
||||
|
||||
=item B<stat>|B<state>
|
||||
|
||||
Print the current power state/status.
|
||||
|
||||
@@ -49,8 +49,6 @@ Remove the DNS records.
|
||||
|
||||
Update DNS records to the external DNS server listed in /etc/resolv.conf.
|
||||
|
||||
Enabling the site attribute I<externaldns> means use 'external' DNS by default. If setting I<externaldns> to 1, you need NOT use B<-e> flag in every makedns call.
|
||||
|
||||
=item B<noderange>
|
||||
|
||||
A set of comma delimited node names and/or group names. See the "noderange" man page for details on additional supported formats.
|
||||
|
||||
@@ -253,6 +253,9 @@ dracut_install /usr/share/zoneinfo/posix/America/Knox_IN
|
||||
dracut_install /usr/share/zoneinfo/posix/America/Goose_Bay
|
||||
dracut_install /usr/share/zoneinfo/posix/EET
|
||||
dracut_install /usr/share/zoneinfo/posix/EST5EDT
|
||||
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh89
|
||||
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh88
|
||||
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh87
|
||||
dracut_install /usr/share/zoneinfo/posix/MST
|
||||
dracut_install /usr/share/zoneinfo/posix/Iceland
|
||||
dracut_install /usr/share/zoneinfo/posix/Atlantic/Faeroe
|
||||
@@ -393,6 +396,7 @@ dracut_install /usr/share/zoneinfo/posix/NZ-CHAT
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Istanbul
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Kuwait
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Saigon
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh89
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Urumqi
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Brunei
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Ujung_Pandang
|
||||
@@ -434,6 +438,7 @@ dracut_install /usr/share/zoneinfo/posix/Asia/Tokyo
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Macao
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Rangoon
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh88
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Jakarta
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Aden
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Calcutta
|
||||
@@ -471,6 +476,7 @@ dracut_install /usr/share/zoneinfo/posix/Asia/Tel_Aviv
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Taipei
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Kabul
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Macau
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh87
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Choibalsan
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Vientiane
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Dacca
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
instmods nfs sunrpc
|
||||
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf
|
||||
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf
|
||||
instmods macvlan macvtap 8021q bridge bonding vmxnet3 cpufreq_ondemand acpi-cpufreq powernow-k8 cdc_ether
|
||||
instmods mptctl #LSI firmware management requires this
|
||||
instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys
|
||||
|
||||
Executable → Regular
+1
-1
@@ -59,4 +59,4 @@ fi
|
||||
|
||||
%Files
|
||||
%defattr(-,root,root)
|
||||
/opt/xcat/share/xcat/netboot/genesis/%{tarch}
|
||||
/
|
||||
|
||||
@@ -5,7 +5,6 @@ clear
|
||||
echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bashrc
|
||||
echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile
|
||||
mkdir -p /etc/ssh
|
||||
mkdir -p /var/tmp/
|
||||
mkdir -p /var/empty/sshd
|
||||
echo root:x:0:0::/:/bin/bash >> /etc/passwd
|
||||
echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd
|
||||
|
||||
@@ -204,7 +204,7 @@ for bmcu in $BMCUS; do
|
||||
if [ "$bmcu" = "" ]; then continue; fi
|
||||
DISABLEUSERS="1 2 3 4"
|
||||
if [ ! -z "$LOCKEDUSERS" ]; then
|
||||
USERSLOT=`ipmitool -d $idev user list $LANCHAN |grep -v ^ID|awk '{print $1 " " $2}'|grep -w "$BMCUS"|awk '{print $1}'`
|
||||
USERSLOT=`ipmitool -d $idev user list $LANCHAN |grep -v ^ID|awk '{print $1 " " $2}'|grep " $BMCUS"|awk '{print $1}'`
|
||||
if [ -z "$USERSLOT" ]; then
|
||||
USERSLOT=4
|
||||
fi
|
||||
@@ -239,7 +239,7 @@ done
|
||||
TRIES=0
|
||||
# Last param in ipmitool user priv is the channel to set it on.
|
||||
# Penguin boxes are all channel 2
|
||||
CURRPRIV=`ipmitool -d $idev user list $LANCHAN|grep ^$USERSLOT|awk '{print $6}'`
|
||||
CURRPRIV=`ipmitool -d $idev user list 1|grep ^$USERSLOT|awk '{print $6}'`
|
||||
if [ "$CURRPRIV" != "ADMINISTRATOR" ]; then
|
||||
while ! ipmitool -d $idev user priv $USERSLOT 4 $LANCHAN; do
|
||||
sleep 1
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
# Bug reported by Jeff Lang <jrlang@uwyo.edu>. Thanks, Jeff!
|
||||
#
|
||||
|
||||
modprobe acpi_cpufreq 2>/dev/null # on some machines this fails
|
||||
modprobe acpi_cpufreq
|
||||
modprobe cpufreq_ondemand
|
||||
if ls /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor &>/dev/null; then
|
||||
for gov in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
|
||||
echo -n ondemand > $gov
|
||||
done
|
||||
fi
|
||||
for gov in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
|
||||
echo -n ondemand > $gov
|
||||
done
|
||||
if [ ! -z "$BOOTIF" ]; then
|
||||
BOOTIF=`echo $BOOTIF|sed -e s/01-// -e s/-/:/g`
|
||||
echo -n "Waiting for device with address $BOOTIF to appear.."
|
||||
@@ -76,91 +74,22 @@ echo '};' >> /var/lib/lldpad/lldpad.conf
|
||||
done
|
||||
echo '};' >> /var/lib/lldpad/lldpad.conf
|
||||
lldpad -d
|
||||
|
||||
# Caclulate the broadcast address of a given IP address and mask.
|
||||
bcastcalc(){
|
||||
read oct1 oct2 oct3 oct4 << HERE
|
||||
$(echo "$1" | sed -e 's/\./ /g')
|
||||
HERE
|
||||
read msk1 msk2 msk3 msk4 << HERE
|
||||
$(echo "$2" | sed -e 's/\./ /g')
|
||||
HERE
|
||||
ipa=$(($oct1+(255-($oct1 | $msk1))))
|
||||
ipb=$(($oct2+(255-($oct2 | $msk2))))
|
||||
ipc=$(($oct3+(255-($oct3 | $msk3))))
|
||||
ipd=$(($oct4+(255-($oct4 | $msk4))))
|
||||
echo "$ipa.$ipb.$ipc.$ipd"
|
||||
}
|
||||
|
||||
# Calculates the number of bits in a netmask for converting something like 255.255.255.192 to 26 so
|
||||
# you can use the notation 10.0.0.1/26
|
||||
mask2prefix() {
|
||||
nbits=0
|
||||
old_ifs=$IFS
|
||||
IFS=.
|
||||
for dec in $1 ; do
|
||||
case $dec in
|
||||
255) let nbits+=8;;
|
||||
254) let nbits+=7;;
|
||||
252) let nbits+=6;;
|
||||
248) let nbits+=5;;
|
||||
240) let nbits+=4;;
|
||||
224) let nbits+=3;;
|
||||
192) let nbits+=2;;
|
||||
128) let nbits+=1;;
|
||||
0);;
|
||||
*) echo "Error: $dec is not recognised"; exit 1
|
||||
esac
|
||||
done
|
||||
IFS=$old_ifs
|
||||
echo "$nbits"
|
||||
}
|
||||
|
||||
# see if they specified static ip info, otherwise use dhcp
|
||||
for parm in `cat /proc/cmdline`; do
|
||||
key=`echo $parm|awk -F= '{print $1}'`
|
||||
value=`echo $parm|awk -F= '{print $2}'`
|
||||
if [[ ${key,,} == "hostip" || ${key,,} == "ipaddr" ]]; then
|
||||
hostip=$value
|
||||
elif [[ ${key,,} == "netmask" ]]; then
|
||||
netmask=$value
|
||||
elif [[ ${key,,} == "gateway" ]]; then
|
||||
gateway=$value
|
||||
elif [[ ${key,,} == "netdevice" || ${key,,} == "device" ]]; then
|
||||
netdevice=$value
|
||||
fi
|
||||
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic &
|
||||
#we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce
|
||||
#chances that we'll perform a partial discovery
|
||||
#in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up
|
||||
dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases &
|
||||
NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'`
|
||||
export NICSTOBRINGUP
|
||||
for nic in $NICSTOBRINGUP; do
|
||||
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) &
|
||||
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) &
|
||||
done
|
||||
if [[ -n $hostip && -n $netmask && -n $gateway && -n $netdevice ]]; then
|
||||
# doing static ip
|
||||
numbits=$(mask2prefix $netmask)
|
||||
broadcast=$(bcastcalc $hostip $netmask)
|
||||
echo "Setting static IP=$hostip/$numbits broadcast=$broadcast gateway=$gateway netdevice=$netdevice ..."
|
||||
ip addr add $hostip/$numbits broadcast $broadcast dev $netdevice scope global label $netdevice
|
||||
ip link set $netdevice up
|
||||
ip route replace to default via $gateway dev $netdevice
|
||||
# in softlayer it takes up to 60 seconds for the nic to actually be able to communicate
|
||||
echo -n Waiting to reach xCAT mgmt node $gateway.
|
||||
xcatretries=60
|
||||
while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $gateway >/dev/null 2>&1; do echo -n .; done
|
||||
if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
|
||||
sleep 3
|
||||
else
|
||||
echo "Setting IP via DHCP..."
|
||||
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic &
|
||||
#we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce
|
||||
#chances that we'll perform a partial discovery
|
||||
#in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up
|
||||
dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases &
|
||||
NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'`
|
||||
export NICSTOBRINGUP
|
||||
for nic in $NICSTOBRINGUP; do
|
||||
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) &
|
||||
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) &
|
||||
done
|
||||
fi
|
||||
|
||||
openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 &
|
||||
|
||||
|
||||
|
||||
|
||||
gripeiter=101
|
||||
echo -n "Acquiring network addresses.."
|
||||
while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; do
|
||||
|
||||
@@ -7,6 +7,6 @@ Standards-Version: 3.7.2
|
||||
|
||||
Package: xcat-server
|
||||
Architecture: all
|
||||
Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl
|
||||
Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl
|
||||
Description: Server and configuration utilities of the xCAT management project
|
||||
xCAT-server provides the core server and configuration management components of xCAT. This package should be installed on your management server
|
||||
|
||||
@@ -122,7 +122,6 @@ sub new {
|
||||
unless ($ipmi2support) {
|
||||
$self->{ipmi15only} = 1;
|
||||
}
|
||||
$self->{privlevel} = 4;
|
||||
unless ($args{'bmc'} and defined $args{'userid'} and defined $args{'password'}) {
|
||||
$self->{error}="bmc, userid, and password must be specified";
|
||||
return $self;
|
||||
@@ -310,7 +309,7 @@ sub session_activated {
|
||||
|
||||
sub set_admin_level {
|
||||
my $self= shift;
|
||||
$self->subcmd(netfn=>0x6,command=>0x3b,data=>[$self->{privlevel}],callback=>\&admin_level_set,callback_args=>$self);
|
||||
$self->subcmd(netfn=>0x6,command=>0x3b,data=>[4],callback=>\&admin_level_set,callback_args=>$self);
|
||||
}
|
||||
sub admin_level_set {
|
||||
my $rsp = shift;
|
||||
@@ -688,7 +687,7 @@ sub send_rakp3 {
|
||||
$self->{rmcptag}+=1;
|
||||
my @payload = ($self->{rmcptag},0,0,0,@{$self->{pendingsessionid}});
|
||||
my @user = unpack("C*",$self->{userid});
|
||||
push @payload,unpack("C*",hmac_sha1(pack("C*",@{$self->{remoterandomnumber}},@{$self->{sidm}},$self->{privlevel},scalar @user,@user),$self->{password}));
|
||||
push @payload,unpack("C*",hmac_sha1(pack("C*",@{$self->{remoterandomnumber}},@{$self->{sidm}},4,scalar @user,@user),$self->{password}));
|
||||
$self->sendpayload(payload=>\@payload,type=>$payload_types{'rakp3'});
|
||||
}
|
||||
|
||||
@@ -702,7 +701,7 @@ sub send_rakp1 {
|
||||
push @{$self->{randomnumber}},$randomnumber;
|
||||
}
|
||||
push @payload, @{$self->{randomnumber}};
|
||||
push @payload,($self->{privlevel},0,0); # request priv
|
||||
push @payload,(4,0,0); # request admin
|
||||
my @user = unpack("C*",$self->{userid});
|
||||
push @payload,scalar @user;
|
||||
push @payload,@user;
|
||||
@@ -818,13 +817,6 @@ sub got_rakp2 {
|
||||
}
|
||||
$byte = shift @data;
|
||||
unless ($byte == 0x00) {
|
||||
if ($byte == 0x9 and $self->{privlevel} == 4) {
|
||||
# this is probably an environment that wants to give us only operator
|
||||
# try to connect again at 3.
|
||||
$self->{privlevel} = 3;
|
||||
$self->relog();
|
||||
return;
|
||||
}
|
||||
if ($byte == 0x02) { #invalid session id is almost certainly because a retry on rmcp+ open session response rendered our session id invalid, ignore this in the hope that we'll get an answer for our retry that invalidated us..
|
||||
#$self->relog();
|
||||
#TODO: probably should disable RAKP1 retry here... high likelihood that we'll just spew a bad RAKP1 and Open Session Request retry would be more appropriate to try to discern a valid session id
|
||||
@@ -849,7 +841,7 @@ sub got_rakp2 {
|
||||
#Data now represents authcode.. sha1 only..
|
||||
my @user = unpack("C*",$self->{userid});
|
||||
my $ulength = scalar @user;
|
||||
my $hmacdata = pack("C*",(@{$self->{sidm}},@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},$self->{privlevel},$ulength,@user));
|
||||
my $hmacdata = pack("C*",(@{$self->{sidm}},@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},4,$ulength,@user));
|
||||
my @expectedhash = (unpack("C*",hmac_sha1($hmacdata,$self->{password})));
|
||||
foreach (0..(scalar(@expectedhash)-1)) {
|
||||
if ($expectedhash[$_] != $data[$_]) {
|
||||
@@ -858,7 +850,7 @@ sub got_rakp2 {
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
$self->{sik} = hmac_sha1(pack("C*",@{$self->{randomnumber}},@{$self->{remoterandomnumber}},$self->{privlevel},$ulength,@user),$self->{password});
|
||||
$self->{sik} = hmac_sha1(pack("C*",@{$self->{randomnumber}},@{$self->{remoterandomnumber}},4,$ulength,@user),$self->{password});
|
||||
$self->{k1} = hmac_sha1(pack("C*",1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),$self->{sik});
|
||||
$self->{k2} = hmac_sha1(pack("C*",2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2),$self->{sik});
|
||||
my @aeskey = unpack("C*",$self->{k2});
|
||||
|
||||
@@ -1392,9 +1392,7 @@ sub collect_all_attribs_for_tables_in_template
|
||||
$::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = $ent->{$node}->[0]->{$attrib};
|
||||
|
||||
#for noderes.xcatmaster
|
||||
if ($tabname =~ /^noderes$/ && $attrib =~ /^xcatmaster$/ &&
|
||||
( ! exists($::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}) ||
|
||||
$::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} == "" ) )
|
||||
if ($tabname =~ /^noderes$/ && $attrib =~ /^xcatmaster$/ && ! exists($::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster}))
|
||||
{
|
||||
my $value;
|
||||
$value = xCAT::NetworkUtils->my_ip_facing($node);
|
||||
|
||||
@@ -115,7 +115,6 @@ sub run_remote_shell_api {
|
||||
my $rc=1;
|
||||
if ($t) {
|
||||
#Wait for command prompt
|
||||
$t->print("\t");
|
||||
my ($prematch, $match) = $t->waitfor(Match => '/login[: ]*$/i',
|
||||
Match => '/username[: ]*$/i',
|
||||
Match => '/password[: ]*$/i',
|
||||
|
||||
@@ -14,7 +14,6 @@ use xCAT::ADUtils; #to allow setting of one-time machine passwords
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use xCAT::NetworkUtils;
|
||||
use XML::Simple;
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
@@ -104,13 +103,6 @@ sub subvars {
|
||||
$ENV{NODESTATUS}=$tmp;
|
||||
}
|
||||
|
||||
|
||||
my @managedaddressmode = xCAT::TableUtils->get_site_attribute("managedaddressmode");
|
||||
my $tmp=$managedaddressmode[0];
|
||||
if( defined($tmp) ){
|
||||
$ENV{MANAGEDADDRESSMODE}=$tmp;
|
||||
}
|
||||
|
||||
#replace the env with the right value so that correct include files can be found
|
||||
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
|
||||
|
||||
@@ -237,7 +229,6 @@ sub subvars {
|
||||
$inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
|
||||
$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
|
||||
$inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
|
||||
$inc =~ s/#YAST2NET#/yast2network()/eg;
|
||||
$inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
|
||||
$inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
|
||||
$inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
|
||||
@@ -281,9 +272,7 @@ sub subvars {
|
||||
my $tempstr = "%include /tmp/partitionfile\n";
|
||||
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/;
|
||||
#modify the content in the file, and write into %pre part
|
||||
#$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
$partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
|
||||
|
||||
$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
$partcontent .= "chmod 755 /tmp/partscript\n";
|
||||
$partcontent .= "/tmp/partscript\n";
|
||||
#replace the #XCA_PARTITION_SCRIPT#
|
||||
@@ -293,8 +282,7 @@ sub subvars {
|
||||
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
|
||||
my $tempstr = "<drive><device>XCATPARTITIONTEMP</device></drive>";
|
||||
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$tempstr/;
|
||||
#$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
$partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
|
||||
$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
$partcontent .= "chmod 755 /tmp/partscript\n";
|
||||
$partcontent .= "/tmp/partscript\n";
|
||||
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
|
||||
@@ -663,12 +651,9 @@ sub esxipv6setup {
|
||||
return 'esxcfg-vmknic -i '.$v6addr.'/64 "Management Network"'." #ESXISTATICV6\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sub kickstartnetwork {
|
||||
my $line = "network --onboot=yes --bootproto=";
|
||||
my $hoststab;
|
||||
my $line = "network --onboot=yes --bootproto=";
|
||||
my $hoststab;
|
||||
my $mactab = xCAT::Table->new('mac',-create=>0);
|
||||
unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; }
|
||||
my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1);
|
||||
@@ -682,258 +667,12 @@ sub kickstartnetwork {
|
||||
$hoststab->setNodeAttribs($node,{ip=>$ulaaddr});
|
||||
$line .= $ulaaddr;
|
||||
} elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
|
||||
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
|
||||
unless($ipaddr) { die "cannot resolve the network configuration of $node"; }
|
||||
|
||||
if($gateway eq '<xcatmaster>'){
|
||||
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
|
||||
}
|
||||
|
||||
$line .="static --device=$suffix --ip=$ipaddr --netmask=$netmask --gateway=$gateway --hostname=$hostname ";
|
||||
|
||||
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
|
||||
my @nameserverARR=split (",",$nameservers{$node});
|
||||
my @nameserversIP;
|
||||
foreach (@nameserverARR)
|
||||
{
|
||||
my $ip;
|
||||
if($_ eq '<xcatmaster>'){
|
||||
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
|
||||
}else{
|
||||
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
|
||||
}
|
||||
push @nameserversIP, $ip;
|
||||
|
||||
}
|
||||
|
||||
if (scalar @nameserversIP) {
|
||||
$line .=" --nameserver=". join(",",@nameserversIP);
|
||||
}
|
||||
|
||||
|
||||
#return "#KSNET static unsupported";
|
||||
return "#KSNET static unsupported";
|
||||
} else {
|
||||
$line .= "dhcp --device=$suffix";
|
||||
}
|
||||
return $line;
|
||||
}
|
||||
|
||||
|
||||
sub yast2network {
|
||||
my $line;
|
||||
my $hoststab;
|
||||
my $mactab = xCAT::Table->new('mac',-create=>0);
|
||||
unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; }
|
||||
my $ent = $mactab->getNodeAttribs($node,['mac'],prefetchcache=>1);
|
||||
unless ($ent and $ent->{mac}) { die "missing mac data for $node"; }
|
||||
my $suffix = $ent->{mac};
|
||||
$suffix = lc($suffix);
|
||||
if ($::XCATSITEVALS{managedaddressmode} eq "autoula") {
|
||||
#TODO
|
||||
return "#YAST2NET autoula unsupported"
|
||||
} elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) {
|
||||
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
|
||||
unless($ipaddr) { die "cannot resolve the network configuration of $node"; }
|
||||
|
||||
if($gateway eq '<xcatmaster>'){
|
||||
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
|
||||
}
|
||||
|
||||
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
|
||||
|
||||
my @nameserverARR=split (",",$nameservers{$node});
|
||||
|
||||
my @nameserversIP;
|
||||
foreach (@nameserverARR)
|
||||
{
|
||||
my $ip;
|
||||
if($_ eq '<xcatmaster>'){
|
||||
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
|
||||
}else{
|
||||
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
|
||||
}
|
||||
push @nameserversIP, $ip;
|
||||
|
||||
}
|
||||
|
||||
# get the domains for each node - one call for all nodes in hosts file
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains([$node]);
|
||||
my %nodedomains = %$nd;
|
||||
my $domain=$nodedomains{$node};
|
||||
my $networkhash={
|
||||
'networking' => [
|
||||
{
|
||||
'dns' => [
|
||||
{
|
||||
'domain' => [
|
||||
"$domain"
|
||||
],
|
||||
'dhcp_hostname' => [
|
||||
{
|
||||
'content' => 'false',
|
||||
'config:type' => 'boolean'
|
||||
}
|
||||
],
|
||||
'dhcp_resolv' => [
|
||||
{
|
||||
'content' => 'false',
|
||||
'config:type' => 'boolean'
|
||||
}
|
||||
],
|
||||
'nameservers' => [
|
||||
{
|
||||
'config:type' => 'list',
|
||||
'nameserver' => [@nameserversIP]
|
||||
}
|
||||
],
|
||||
'hostname' => [
|
||||
$hostname
|
||||
],
|
||||
'searchlist' => [
|
||||
{
|
||||
'search' => [
|
||||
$domain
|
||||
],
|
||||
'config:type' => 'list'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'interfaces' => [
|
||||
{
|
||||
'interface' => [
|
||||
{
|
||||
'bootproto' => [
|
||||
'static'
|
||||
],
|
||||
'startmode' => [
|
||||
'onboot'
|
||||
],
|
||||
'netmask' => [
|
||||
$netmask
|
||||
],
|
||||
'device' => [
|
||||
'eth0'
|
||||
],
|
||||
'ipaddr' => [
|
||||
$ipaddr
|
||||
]
|
||||
}
|
||||
],
|
||||
'config:type' => 'list'
|
||||
}
|
||||
],
|
||||
'routing' => [
|
||||
{
|
||||
'ip_forward' => [
|
||||
{
|
||||
'content' => 'false',
|
||||
'config:type' => 'boolean'
|
||||
}
|
||||
],
|
||||
'routes' => [
|
||||
{
|
||||
'route' => [
|
||||
{
|
||||
'destination' => [
|
||||
'default'
|
||||
],
|
||||
'gateway' => [
|
||||
$gateway
|
||||
],
|
||||
'netmask' => [
|
||||
'-'
|
||||
],
|
||||
'device' => [
|
||||
'-'
|
||||
]
|
||||
}
|
||||
],
|
||||
'config:type' => 'list'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
my $xml = new XML::Simple(KeepRoot => 1);
|
||||
$line=$xml->XMLout($networkhash);
|
||||
|
||||
#return "#KSNET static unsupported";
|
||||
} else {
|
||||
|
||||
my $networkhash={
|
||||
'networking' => [
|
||||
{
|
||||
'dns' => [
|
||||
{
|
||||
'domain' => [
|
||||
'local'
|
||||
],
|
||||
'dhcp_hostname' => [
|
||||
{
|
||||
'content' => 'true',
|
||||
'config:type' => 'boolean'
|
||||
}
|
||||
],
|
||||
'hostname' => [
|
||||
'linux'
|
||||
],
|
||||
'dhcp_resolv' => [
|
||||
{
|
||||
'content' => 'true',
|
||||
'config:type' => 'boolean'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'interfaces' => [
|
||||
{
|
||||
'interface' => [
|
||||
{
|
||||
'startmode' => [
|
||||
'onboot'
|
||||
],
|
||||
'bootproto' => [
|
||||
'dhcp'
|
||||
],
|
||||
'device' => [
|
||||
'eth0'
|
||||
]
|
||||
}
|
||||
],
|
||||
'config:type' => 'list'
|
||||
}
|
||||
],
|
||||
'routing' => [
|
||||
{
|
||||
'ip_forward' => [
|
||||
{
|
||||
'content' => 'false',
|
||||
'config:type' => 'boolean'
|
||||
}
|
||||
],
|
||||
'routes' => [
|
||||
{
|
||||
'config:type' => 'list'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
my $xml = new XML::Simple(KeepRoot => 1);
|
||||
$line=$xml->XMLout($networkhash);
|
||||
|
||||
}
|
||||
|
||||
return $line;
|
||||
}
|
||||
|
||||
sub autoulaaddress {
|
||||
my $suffix = shift;
|
||||
my $prefix = $::XCATSITEVALS{autoulaprefix};
|
||||
|
||||
@@ -10,7 +10,6 @@ use xCAT::Table;
|
||||
use xCAT::MsgUtils;
|
||||
use Data::Dumper;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT::Utils;
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head1 xCAT::XCATD
|
||||
@@ -271,67 +270,4 @@ 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;
|
||||
|
||||
@@ -379,7 +379,8 @@ sub parse_attr_for_osimage{
|
||||
sub processArgs
|
||||
{
|
||||
my $gotattrs = 0;
|
||||
if ( defined ($::args) && @{$::args} ) {
|
||||
|
||||
if (defined(@{$::args})) {
|
||||
@ARGV = @{$::args};
|
||||
} else {
|
||||
if ($::command eq "lsdef") {
|
||||
@@ -390,9 +391,8 @@ sub processArgs
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
if ( defined ($::args) && @{$::args} ) {
|
||||
if ( scalar(@{$::args}) eq 1 and $::args->[0] eq '-S')
|
||||
{
|
||||
if ( scalar(@{$::args}) eq 1 and $::args->[0] eq '-S')
|
||||
{
|
||||
if ($::command eq "lsdef") {
|
||||
push @ARGV, "-t";
|
||||
push @ARGV, "node";
|
||||
@@ -400,7 +400,6 @@ sub processArgs
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($::command eq "lsdef") {
|
||||
@@ -2464,21 +2463,15 @@ sub defch
|
||||
|
||||
# give results
|
||||
my $rsp;
|
||||
my $nodenum = scalar(keys %::FINALATTRS);
|
||||
if ($nodenum) {
|
||||
$rsp->{data}->[0] =
|
||||
"The database was updated for the following objects:";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::callback);
|
||||
$rsp->{data}->[0] =
|
||||
"The database was updated for the following objects:";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::callback);
|
||||
|
||||
my $n = 1;
|
||||
foreach my $o (sort(keys %::FINALATTRS))
|
||||
{
|
||||
$rsp->{data}->[$n] = "$o\n";
|
||||
$n++;
|
||||
}
|
||||
} else {
|
||||
$rsp->{data}->[0] =
|
||||
"No database was updated";
|
||||
my $n = 1;
|
||||
foreach my $o (sort(keys %::FINALATTRS))
|
||||
{
|
||||
$rsp->{data}->[$n] = "$o\n";
|
||||
$n++;
|
||||
}
|
||||
xCAT::MsgUtils->message("I", $rsp, $::callback);
|
||||
}
|
||||
@@ -2486,13 +2479,8 @@ sub defch
|
||||
{
|
||||
my $rsp;
|
||||
my $nodenum = scalar(keys %::FINALATTRS);
|
||||
if ($nodenum) {
|
||||
$rsp->{data}->[0] =
|
||||
"$nodenum object definitions have been created or modified.";
|
||||
} else {
|
||||
$rsp->{data}->[0] =
|
||||
"No object definitions have been created or modified.";
|
||||
}
|
||||
$rsp->{data}->[0] =
|
||||
"$nodenum object definitions have been created or modified.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::callback);
|
||||
if (scalar(keys %newobjects) > 0)
|
||||
{
|
||||
@@ -2640,9 +2628,6 @@ sub setFINALattrs
|
||||
{
|
||||
# special case for the nic* attributes
|
||||
# merge nic*.eth0, nic*.eth1
|
||||
unless(exists($::CLIATTRS{$objname})) {
|
||||
next;
|
||||
}
|
||||
if ($::CLIATTRS{$objname}{objtype} eq 'node')
|
||||
{
|
||||
# Even if only the nicips.eth0 is specified with CLI,
|
||||
|
||||
@@ -232,7 +232,8 @@ sub parse_args
|
||||
my $args = $request->{arg};
|
||||
my $gotattrs = 0;
|
||||
my %opt =();
|
||||
if ( defined ($args) && @{$args}) {
|
||||
|
||||
if (defined(@{$args})) {
|
||||
@ARGV = @{$args};
|
||||
} else {
|
||||
return 2;
|
||||
|
||||
@@ -154,13 +154,6 @@ sub preprocess_request
|
||||
# - either the NIMprime attr of the site table or the management node
|
||||
my $nimprime = xCAT::InstUtils->getnimprime();
|
||||
chomp $nimprime;
|
||||
if (!defined($nimprime))
|
||||
{
|
||||
my $rsp={};
|
||||
$rsp->{error}->[0] = "Could not determine nimprime. Check if nimprime defined in site table or site table master is not resolvable to the MN name.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $cb,1);
|
||||
return undef;
|
||||
}
|
||||
my $nimprimeip = xCAT::NetworkUtils->getipaddr($nimprime);
|
||||
if ($nimprimeip =~ /:/) #IPv6
|
||||
{
|
||||
@@ -624,7 +617,7 @@ sub nimnodeset
|
||||
|
||||
my $Sname = xCAT::InstUtils->myxCATname();
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -1800,7 +1793,7 @@ sub chkosimage
|
||||
|
||||
my $image_name;
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -2267,7 +2260,7 @@ sub mknimimage
|
||||
my $dump_name;
|
||||
my $install_dir = xCAT::TableUtils->getInstallDir();
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -4240,7 +4233,7 @@ sub mk_spot
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, " The cpcosi command failed. \n$output\n";
|
||||
push @{$rsp->{data}}, " The cpcosi command failed. \n$output\n";
|
||||
push @{$rsp->{data}},
|
||||
"Could not create a NIM definition for \'$spot_name\'.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
@@ -5705,7 +5698,7 @@ sub prermnimimage
|
||||
my @servicenodes = (); # pass back list of service nodes
|
||||
my %imagedef; # pass back image def hash
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -6215,7 +6208,7 @@ sub rmnimimage
|
||||
%allsn = %{$nodehash};
|
||||
}
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -7822,7 +7815,7 @@ sub prenimnodecust
|
||||
@nodelist = @$nodes;
|
||||
}
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -8060,7 +8053,7 @@ sub nimnodecust
|
||||
@nodelist = @$nodes;
|
||||
}
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -8217,7 +8210,7 @@ sub prenimnodeset
|
||||
my $subreq = shift;
|
||||
my $error = 0;
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -9944,7 +9937,7 @@ sub define_SN_resource
|
||||
}
|
||||
|
||||
my %attrs;
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -10983,7 +10976,7 @@ sub mkdsklsnode
|
||||
# - just set global for now
|
||||
$::callback = $callback;
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -12993,7 +12986,7 @@ sub make_SN_resource
|
||||
}
|
||||
|
||||
my %attrs;
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -13653,7 +13646,7 @@ sub prermdsklsnode
|
||||
{
|
||||
my $callback = shift;
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
@@ -13763,7 +13756,7 @@ sub rmdsklsnode
|
||||
# - just set global for now
|
||||
$::callback = $callback;
|
||||
|
||||
if ( defined ($::args) && @{$::args} )
|
||||
if (defined(@{$::args}))
|
||||
{
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
|
||||
@@ -1381,24 +1381,18 @@ sub mkinstall
|
||||
$instserver=$ent->{nfsserver};
|
||||
}
|
||||
|
||||
if ($::XCATSITEVALS{managedaddressmode} =~ /static/){
|
||||
unless($instserver eq '!myipfn!'){
|
||||
my($host,$ip)=xCAT::NetworkUtils->gethostnameandip($instserver);
|
||||
$instserver=$ip;
|
||||
}
|
||||
}
|
||||
my $httpprefix=$pkgdir;
|
||||
if ($installroot =~ /\/$/) {
|
||||
$httpprefix =~ s/^$installroot/\/install\//;
|
||||
} else {
|
||||
$httpprefix =~ s/^$installroot/\/install/;
|
||||
}
|
||||
|
||||
my $kcmdline;
|
||||
if ($pkvm) {
|
||||
$kcmdline = "ksdevice=bootif kssendmac text selinux=0 rd.dm=0 rd.md=0 repo=$httpmethod://$instserver:$httpport$httpprefix/packages/ kvmp.inst.auto=$httpmethod://$instserver:$httpport/install/autoinst/$node root=live:$httpmethod://$instserver:$httpport$httpprefix/LiveOS/squashfs.img";
|
||||
} else {
|
||||
$kcmdline ="quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
|
||||
$kcmdline =
|
||||
"quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
|
||||
. $instserver . ":". $httpport
|
||||
. "/install/autoinst/"
|
||||
. $node;
|
||||
@@ -1452,48 +1446,6 @@ sub mkinstall
|
||||
unless ($ksdev eq "bootif" and $os =~ /7/) {
|
||||
$kcmdline .= " ksdevice=" . $ksdev;
|
||||
}
|
||||
|
||||
#if site.managedaddressmode=static, specify the network configuration as kernel options
|
||||
#to avoid multicast dhcp
|
||||
if($::XCATSITEVALS{managedaddressmode} =~ /static/){
|
||||
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
|
||||
unless($ipaddr) {
|
||||
$callback->(
|
||||
{
|
||||
error => [
|
||||
"cannot resolve the ip address of $node"
|
||||
],
|
||||
errorcode => [1]
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if($gateway eq '<xcatmaster>'){
|
||||
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
|
||||
}
|
||||
|
||||
$kcmdline .=" ip=$ipaddr netmask=$netmask gateway=$gateway hostname=$hostname ";
|
||||
|
||||
|
||||
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
|
||||
my @nameserverARR=split (",",$nameservers{$node});
|
||||
my @nameserversIP;
|
||||
foreach (@nameserverARR)
|
||||
{
|
||||
my $ip;
|
||||
if($_ eq '<xcatmaster>'){
|
||||
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
|
||||
}else{
|
||||
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
|
||||
}
|
||||
push @nameserversIP, $ip;
|
||||
|
||||
}
|
||||
|
||||
if(scalar @nameserversIP){
|
||||
$kcmdline .=" dns=".join(",",@nameserversIP);
|
||||
}
|
||||
}
|
||||
|
||||
#TODO: dd=<url> for driver disks
|
||||
if (defined($sent->{serialport}))
|
||||
|
||||
@@ -51,7 +51,7 @@ sub getzonesfornet {
|
||||
die "Not supporting having a mask like $mask on an ipv6 network like $net";
|
||||
}
|
||||
my $netnum= getipaddr($net,GetNumber=>1);
|
||||
unless ($netnum) { return (); }
|
||||
unless ($netnum) { return (); }
|
||||
$netnum->brsft(128-$maskbits);
|
||||
my $prefix=$netnum->as_hex();
|
||||
my $nibbs=$maskbits/4;
|
||||
@@ -229,7 +229,7 @@ sub process_request {
|
||||
}
|
||||
}
|
||||
if ($::XCATSITEVALS{externaldns}) {
|
||||
$external=1;
|
||||
$external=1;
|
||||
}
|
||||
|
||||
if ($help)
|
||||
@@ -325,73 +325,73 @@ sub process_request {
|
||||
if ($allnodes) {
|
||||
#read all nodelist specified nodes
|
||||
} else {
|
||||
if (not $request->{node} and $deletemode) {
|
||||
#when this was permitted, it really ruined peoples' days
|
||||
xCAT::SvrUtils::sendmsg([1,"makedns -d without noderange or -a is not supported"],$callback);
|
||||
umask($oldmask);
|
||||
return;
|
||||
}
|
||||
my @contents;
|
||||
my $domain;
|
||||
if ($request->{node}) { #leverage makehosts code to flesh out the options
|
||||
require xCAT_plugin::hosts;
|
||||
my @content1;
|
||||
my @content2;
|
||||
xCAT_plugin::hosts::add_hosts_content(nodelist=>$request->{node},callback=>$callback,hostsref=>\@content1);
|
||||
xCAT_plugin::hosts::donics(nodes=>$request->{node},callback=>$callback,hostsref=>\@content2);
|
||||
if (not $request->{node} and $deletemode) {
|
||||
#when this was permitted, it really ruined peoples' days
|
||||
xCAT::SvrUtils::sendmsg([1,"makedns -d without noderange or -a is not supported"],$callback);
|
||||
umask($oldmask);
|
||||
return;
|
||||
}
|
||||
my @contents;
|
||||
my $domain;
|
||||
if ($request->{node}) { #leverage makehosts code to flesh out the options
|
||||
require xCAT_plugin::hosts;
|
||||
my @content1;
|
||||
my @content2;
|
||||
xCAT_plugin::hosts::add_hosts_content(nodelist=>$request->{node},callback=>$callback,hostsref=>\@content1);
|
||||
xCAT_plugin::hosts::donics(nodes=>$request->{node},callback=>$callback,hostsref=>\@content2);
|
||||
@contents = (@content1, @content2);
|
||||
} else {
|
||||
#legacy behavior, read from /etc/hosts
|
||||
my $hostsfile;
|
||||
open($hostsfile,"<","/etc/hosts");
|
||||
flock($hostsfile,LOCK_SH);
|
||||
@contents = <$hostsfile>;
|
||||
flock($hostsfile,LOCK_UN);
|
||||
close($hostsfile);
|
||||
}
|
||||
} else {
|
||||
#legacy behavior, read from /etc/hosts
|
||||
my $hostsfile;
|
||||
open($hostsfile,"<","/etc/hosts");
|
||||
flock($hostsfile,LOCK_SH);
|
||||
@contents = <$hostsfile>;
|
||||
flock($hostsfile,LOCK_UN);
|
||||
close($hostsfile);
|
||||
}
|
||||
my $addr;
|
||||
my $name;
|
||||
my $canonical;
|
||||
my $aliasstr;
|
||||
my @aliases;
|
||||
my $names;
|
||||
my @hosts;
|
||||
my %nodehash;
|
||||
|
||||
foreach (@contents) {
|
||||
chomp; #no newline
|
||||
s/#.*//; #strip comments;
|
||||
s/^[ \t\n]*//; #remove leading whitespace
|
||||
next unless ($_); #skip empty lines
|
||||
($addr,$names) = split /[ \t]+/,$_,2;
|
||||
|
||||
if ($addr !~ /^\d+\.\d+\.\d+\.\d+$/ and $addr !~ /^[abcdef0123456789:]+$/) {
|
||||
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, address seems malformed.", $callback);
|
||||
next;
|
||||
}
|
||||
unless ($names =~ /^[a-z0-9\. \t\n-]+$/i) {
|
||||
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback);
|
||||
next;
|
||||
}
|
||||
|
||||
my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($addr);
|
||||
push @hosts, $host;
|
||||
$nodehash{$addr}{names}=$names;
|
||||
$nodehash{$addr}{host}=$host;
|
||||
}
|
||||
my @hosts;
|
||||
my %nodehash;
|
||||
|
||||
# get the domains for each node - one call for all nodes in hosts file
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
|
||||
my %nodedomains = %$nd;
|
||||
|
||||
foreach my $n (keys %nodehash) {
|
||||
$addr=$n;
|
||||
$names=$nodehash{$n}{names};
|
||||
# - need domain for this node
|
||||
my $host = $nodehash{$n}{host};
|
||||
$domain=$nodedomains{$host};
|
||||
# remove the first . at domain name since it's not accepted by high dns parser
|
||||
if ($domain =~ /^\./) { $domain =~ s/^\.//;; }
|
||||
foreach (@contents) {
|
||||
chomp; #no newline
|
||||
s/#.*//; #strip comments;
|
||||
s/^[ \t\n]*//; #remove leading whitespace
|
||||
next unless ($_); #skip empty lines
|
||||
($addr,$names) = split /[ \t]+/,$_,2;
|
||||
|
||||
if ($addr !~ /^\d+\.\d+\.\d+\.\d+$/ and $addr !~ /^[abcdef0123456789:]+$/) {
|
||||
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, address seems malformed.", $callback);
|
||||
next;
|
||||
}
|
||||
unless ($names =~ /^[a-z0-9\. \t\n-]+$/i) {
|
||||
xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names contain invalid characters (valid characters include a through z, numbers and the '-', but not '_'", $callback);
|
||||
next;
|
||||
}
|
||||
|
||||
my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($addr);
|
||||
push @hosts, $host;
|
||||
$nodehash{$addr}{names}=$names;
|
||||
$nodehash{$addr}{host}=$host;
|
||||
}
|
||||
|
||||
# get the domains for each node - one call for all nodes in hosts file
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
|
||||
my %nodedomains = %$nd;
|
||||
|
||||
foreach my $n (keys %nodehash) {
|
||||
$addr=$n;
|
||||
$names=$nodehash{$n}{names};
|
||||
# - need domain for this node
|
||||
my $host = $nodehash{$n}{host};
|
||||
$domain=$nodedomains{$host};
|
||||
# remove the first . at domain name since it's not accepted by high dns parser
|
||||
if ($domain =~ /^\./) { $domain =~ s/^\.//;; }
|
||||
|
||||
($canonical,$aliasstr) = split /[ \t]+/,$names,2;
|
||||
if ($aliasstr) {
|
||||
@@ -407,7 +407,7 @@ sub process_request {
|
||||
unless ($canonical =~ /$domain/) {
|
||||
$canonical.=".".$domain;
|
||||
}
|
||||
# for only the sake of comparison, ensure consistant dot suffix
|
||||
# for only the sake of comparison, ensure consistant dot suffix
|
||||
unless ($canonical =~ /\.\z/) { $canonical .= '.' }
|
||||
foreach my $alias (@aliases) {
|
||||
unless ($alias =~ /$domain/) {
|
||||
@@ -419,13 +419,13 @@ sub process_request {
|
||||
if ($alias eq $canonical) {
|
||||
next;
|
||||
}
|
||||
# remember alias for CNAM records later
|
||||
# remember alias for CNAM records later
|
||||
$ctx->{aliases}->{$node}->{$alias}=1;
|
||||
}
|
||||
|
||||
|
||||
# exclude the nodes not belong to any nets defined in networks table
|
||||
# because only the nets defined in networks table will be add
|
||||
# zones later.
|
||||
# zones later.
|
||||
my $found = 0;
|
||||
foreach (@networks)
|
||||
{
|
||||
@@ -508,13 +508,13 @@ sub process_request {
|
||||
|
||||
$ctx->{domain} =~ s/^\.//; # remove . if it's the first char of domain name
|
||||
$ctx->{zonestotouch}->{$ctx->{domain}}=1;
|
||||
foreach (@networks) {
|
||||
if ($_->{domain}) {
|
||||
$_->{domain} =~ s/^\.//; # remove . if it's the first char of domain name
|
||||
$ctx->{zonestotouch}->{$_->{domain}}=1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (@networks) {
|
||||
if ($_->{domain}) {
|
||||
$_->{domain} =~ s/^\.//; # remove . if it's the first char of domain name
|
||||
$ctx->{zonestotouch}->{$_->{domain}}=1;
|
||||
}
|
||||
}
|
||||
|
||||
xCAT::SvrUtils::sendmsg("Getting reverse zones, this may take several minutes for a large cluster.", $callback);
|
||||
|
||||
foreach (@nodes) {
|
||||
@@ -528,10 +528,10 @@ sub process_request {
|
||||
xCAT::SvrUtils::sendmsg("Completed getting reverse zones.", $callback);
|
||||
|
||||
if (1) {
|
||||
#TODO: function to detect and return 1 if the master server is
|
||||
# DNS SOA for all the zones we care about here, we are examining
|
||||
#TODO: function to detect and return 1 if the master server is
|
||||
# DNS SOA for all the zones we care about here, we are examining
|
||||
# files to assure that our key is in named.conf, the zones we
|
||||
# care about are there, and that if active directory is in use,
|
||||
# care about are there, and that if active directory is in use,
|
||||
# allow the domain controllers to update specific zones
|
||||
@entries = xCAT::TableUtils->get_site_attribute("directoryprovider");
|
||||
$site_entry = $entries[0];
|
||||
@@ -541,13 +541,13 @@ sub process_request {
|
||||
if ( defined($site_entry)) {
|
||||
my @dservers = split /[ ,]/,$site_entry;
|
||||
$ctx->{adservers} = \@dservers;
|
||||
|
||||
############################
|
||||
# - should this include all domains?
|
||||
# - multi-domains not supported with activedirectory
|
||||
# - TODO in future release
|
||||
###################
|
||||
|
||||
|
||||
############################
|
||||
# - should this include all domains?
|
||||
# - multi-domains not supported with activedirectory
|
||||
# - TODO in future release
|
||||
###################
|
||||
|
||||
$ctx->{adzones} = {
|
||||
"_msdcs.". $ctx->{domain} => 1,
|
||||
"_sites.". $ctx->{domain} => 1,
|
||||
@@ -556,51 +556,51 @@ sub process_request {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@entries = xCAT::TableUtils->get_site_attribute("dnsupdaters");
|
||||
$site_entry = $entries[0];
|
||||
if ( defined($site_entry) ) {
|
||||
my @nservers = split /[ ,]/,$site_entry;
|
||||
$ctx->{dnsupdaters} = \@nservers;
|
||||
my @nservers = split /[ ,]/,$site_entry;
|
||||
$ctx->{dnsupdaters} = \@nservers;
|
||||
}
|
||||
unless ($external) { # only generate the named.conf and zone files for xCAT dns when NOT using external dns
|
||||
if ($zapfiles || $slave) { #here, we unlink all the existing files to start fresh
|
||||
if (xCAT::Utils->isAIX())
|
||||
unless ($external) {
|
||||
if ($zapfiles || $slave) { #here, we unlink all the existing files to start fresh
|
||||
if (xCAT::Utils->isAIX())
|
||||
{
|
||||
system("/usr/bin/stopsrc -s $service");
|
||||
}
|
||||
else
|
||||
{
|
||||
system("service $service stop"); #named may otherwise hold on to stale journal filehandles
|
||||
}
|
||||
my $conf = get_conf();
|
||||
unlink $conf;
|
||||
my $DBDir = get_dbdir();
|
||||
foreach (<$DBDir/db.*>) {
|
||||
unlink $_;
|
||||
}
|
||||
}
|
||||
#We manipulate local namedconf
|
||||
$ctx->{dbdir} = get_dbdir();
|
||||
$ctx->{zonesdir} = get_zonesdir();
|
||||
chmod 0775, $ctx->{dbdir}; # assure dynamic dns can actually execute against the directory
|
||||
|
||||
update_namedconf($ctx, $slave);
|
||||
|
||||
unless ($slave)
|
||||
{
|
||||
system("/usr/bin/stopsrc -s $service");
|
||||
update_zones($ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
system("service $service stop"); #named may otherwise hold on to stale journal filehandles
|
||||
}
|
||||
my $conf = get_conf();
|
||||
unlink $conf;
|
||||
my $DBDir = get_dbdir();
|
||||
foreach (<$DBDir/db.*>) {
|
||||
unlink $_;
|
||||
}
|
||||
}
|
||||
#We manipulate local namedconf
|
||||
$ctx->{dbdir} = get_dbdir();
|
||||
$ctx->{zonesdir} = get_zonesdir();
|
||||
chmod 0775, $ctx->{dbdir}; # assure dynamic dns can actually execute against the directory
|
||||
|
||||
update_namedconf($ctx, $slave);
|
||||
|
||||
unless ($slave)
|
||||
{
|
||||
update_zones($ctx);
|
||||
}
|
||||
|
||||
if ($ctx->{restartneeded}) {
|
||||
xCAT::SvrUtils::sendmsg("Restarting $service", $callback);
|
||||
|
||||
if ($ctx->{restartneeded}) {
|
||||
xCAT::SvrUtils::sendmsg("Restarting $service", $callback);
|
||||
|
||||
if (xCAT::Utils->isAIX())
|
||||
{
|
||||
#try to stop named
|
||||
my $cmd = "/usr/bin/stopsrc -s $service";
|
||||
my @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
|
||||
|
||||
$cmd = "/usr/bin/startsrc -s $service";
|
||||
@output=xCAT::Utils->runcmd($cmd, 0);
|
||||
my $outp = join('', @output);
|
||||
@@ -624,7 +624,7 @@ sub process_request {
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$cmd = "service $service start";
|
||||
@output=xCAT::Utils->runcmd($cmd, 0);
|
||||
$outp = join('', @output);
|
||||
@@ -636,57 +636,56 @@ sub process_request {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
xCAT::SvrUtils::sendmsg("Restarting named complete", $callback);
|
||||
}
|
||||
}
|
||||
|
||||
xCAT::SvrUtils::sendmsg("Restarting named complete", $callback);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
unless ($ctx->{privkey}) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Unable to update DNS due to lack of credentials in passwd to communicate with remote server"], $callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($slave)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
# check if named is active before update dns records.
|
||||
unless ($external) { # only start xCAT local dns when NOT using external dns
|
||||
if (xCAT::Utils->isAIX())
|
||||
if (xCAT::Utils->isAIX())
|
||||
{
|
||||
my $cmd = "/usr/bin/lssrc -s $service |grep active";
|
||||
my @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $cmd = "/usr/bin/lssrc -s $service |grep active";
|
||||
my @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
$cmd = "/usr/bin/startsrc -s $service";
|
||||
@output=xCAT::Utils->runcmd($cmd, 0);
|
||||
my $outp = join('', @output);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
$cmd = "/usr/bin/startsrc -s $service";
|
||||
@output=xCAT::Utils->runcmd($cmd, 0);
|
||||
my $outp = join('', @output);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
my $cmd = "service $service status|grep running";
|
||||
my @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $cmd = "service $service status|grep running";
|
||||
my @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
$cmd = "service $service start";
|
||||
@output=xCAT::Utils->runcmd($cmd, 0);
|
||||
my $outp = join('', @output);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
$cmd = "service $service start";
|
||||
@output=xCAT::Utils->runcmd($cmd, 0);
|
||||
my $outp = join('', @output);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -694,12 +693,12 @@ sub process_request {
|
||||
#now we stick to Net::DNS style updates, with TSIG if possible. TODO: kerberized (i.e. Windows) DNS server support, maybe needing to use nsupdate -g....
|
||||
if ($external)
|
||||
{
|
||||
# based on /etc/resolv.conf
|
||||
# based on /etc/resolv.conf
|
||||
$ctx->{resolver} = Net::DNS::Resolver->new();
|
||||
}
|
||||
else
|
||||
{
|
||||
# default to localhost
|
||||
# default to localhost
|
||||
$ctx->{resolver} = Net::DNS::Resolver->new(nameservers=>['127.0.0.1']);
|
||||
}
|
||||
|
||||
@@ -717,9 +716,9 @@ sub get_zonesdir {
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("bindzones");
|
||||
my $site_entry = $entries[0];
|
||||
|
||||
if ( defined($site_entry) ) {
|
||||
$ZonesDir= $site_entry;
|
||||
}
|
||||
if ( defined($site_entry) ) {
|
||||
$ZonesDir= $site_entry;
|
||||
}
|
||||
|
||||
return "$ZonesDir";
|
||||
}
|
||||
@@ -728,16 +727,16 @@ sub get_conf {
|
||||
my $conf="/etc/named.conf";
|
||||
|
||||
# is this ubuntu ?
|
||||
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
|
||||
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
|
||||
$conf="/etc/bind/named.conf";
|
||||
}
|
||||
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("bindconf");
|
||||
my $site_entry = $entries[0];
|
||||
|
||||
if ( defined($site_entry) ) {
|
||||
$conf= $site_entry;
|
||||
}
|
||||
if ( defined($site_entry) ) {
|
||||
$conf= $site_entry;
|
||||
}
|
||||
|
||||
return "$conf";
|
||||
}
|
||||
@@ -747,9 +746,9 @@ sub get_dbdir {
|
||||
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("binddir");
|
||||
my $site_entry = $entries[0];
|
||||
if ( defined($site_entry) ) {
|
||||
$DBDir = $site_entry;
|
||||
}
|
||||
if ( defined($site_entry) ) {
|
||||
$DBDir = $site_entry;
|
||||
}
|
||||
|
||||
if ( -d "$DBDir" ) {
|
||||
return "$DBDir"
|
||||
@@ -790,13 +789,13 @@ sub update_zones {
|
||||
my $name = hostname;
|
||||
my $node = $name;
|
||||
|
||||
# get the domain for the node - which is the local hostname
|
||||
my ($host, $nip) = xCAT::NetworkUtils->gethostnameandip($node);
|
||||
my @hosts;
|
||||
push (@hosts, $host);
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
|
||||
my %nodedomains = %$nd;
|
||||
my $domain = $nodedomains{$host};
|
||||
# get the domain for the node - which is the local hostname
|
||||
my ($host, $nip) = xCAT::NetworkUtils->gethostnameandip($node);
|
||||
my @hosts;
|
||||
push (@hosts, $host);
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains(\@hosts);
|
||||
my %nodedomains = %$nd;
|
||||
my $domain = $nodedomains{$host};
|
||||
|
||||
xCAT::SvrUtils::sendmsg("Updating zones.", $callback);
|
||||
|
||||
@@ -830,7 +829,7 @@ sub update_zones {
|
||||
my $serial = ($mday * 100) + (($mon + 1) * 10000) + (($year + 1900) * 1000000);
|
||||
|
||||
foreach $currzone (@neededzones) {
|
||||
my $zonefilename = $currzone;
|
||||
my $zonefilename = $currzone;
|
||||
if ($currzone =~ /IN-ADDR\.ARPA/) {
|
||||
$currzone =~ s/\.IN-ADDR\.ARPA.*//;
|
||||
my @octets = split/\./,$currzone;
|
||||
@@ -854,7 +853,7 @@ sub update_zones {
|
||||
}
|
||||
flock($zonehdl,LOCK_UN);
|
||||
close($zonehdl);
|
||||
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
|
||||
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
|
||||
chown(scalar(getpwnam('root')),scalar(getgrnam('bind')),$dbdir."/db.$zonefilename");
|
||||
}
|
||||
else{
|
||||
@@ -890,7 +889,7 @@ sub update_namedconf {
|
||||
$gotoptions=1;
|
||||
my $skip=0;
|
||||
do {
|
||||
#push @newnamed,"\t\t//listen-on-v6 { any; };\n";
|
||||
#push @newnamed,"\t\t//listen-on-v6 { any; };\n";
|
||||
if ($ctx->{forwarders} and $line =~ /forwarders {/) {
|
||||
push @newnamed,"\tforwarders \{\n";
|
||||
$skip=1;
|
||||
@@ -1006,11 +1005,11 @@ sub update_namedconf {
|
||||
}
|
||||
}
|
||||
unless ($gotoptions) {
|
||||
push @newnamed,"options {\n";
|
||||
push @newnamed,"options {\n";
|
||||
unless ($slave && xCAT::Utils->isLinux()) {
|
||||
push @newnamed,"\tdirectory \"".$ctx->{zonesdir}."\";\n";
|
||||
}
|
||||
push @newnamed,"\t\t//listen-on-v6 { any; };\n";
|
||||
push @newnamed,"\t\t//listen-on-v6 { any; };\n";
|
||||
if ($ctx->{forwarders}) {
|
||||
push @newnamed,"\tforwarders {\n";
|
||||
foreach (@{$ctx->{forwarders}}) {
|
||||
@@ -1129,7 +1128,7 @@ sub update_namedconf {
|
||||
for my $l (@newnamed) { print $newnameconf $l; }
|
||||
flock($newnameconf,LOCK_UN);
|
||||
close($newnameconf);
|
||||
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
|
||||
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
|
||||
chown (scalar(getpwnam('root')),scalar(getgrnam('bind')),$namedlocation);
|
||||
}
|
||||
else{
|
||||
@@ -1157,9 +1156,9 @@ sub add_or_delete_records {
|
||||
$ctx->{nsmap} = {}; #will store a map to known NS records to avoid needless redundant queries to sort nodes into domains
|
||||
$ctx->{updatesbyzone}={}; #sort all updates into their respective zones for bulk update for fewer DNS transactions
|
||||
|
||||
# get node domains
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains(\@{$ctx->{nodes}});
|
||||
my %nodedomains = %{$nd};
|
||||
# get node domains
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains(\@{$ctx->{nodes}});
|
||||
my %nodedomains = %{$nd};
|
||||
|
||||
foreach $node (@{$ctx->{nodes}}) {
|
||||
my $name = $node;
|
||||
@@ -1169,8 +1168,8 @@ sub add_or_delete_records {
|
||||
next;
|
||||
}
|
||||
|
||||
my $domain = $nodedomains{$node};
|
||||
if ($domain =~ /^\./) { $domain =~ s/^\.//; } # remove . if it's the first char of domain name
|
||||
my $domain = $nodedomains{$node};
|
||||
if ($domain =~ /^\./) { $domain =~ s/^\.//; } # remove . if it's the first char of domain name
|
||||
|
||||
unless ($name =~ /$domain/) { $name .= ".".$domain } # $name needs to represent fqdn, but must preserve $node as a nodename for cfg lookup
|
||||
|
||||
@@ -1178,9 +1177,9 @@ sub add_or_delete_records {
|
||||
@ips = ($ctx->{hoststab}->{$node}->[0]->{ip});
|
||||
} else {
|
||||
@ips = getipaddr($node,GetAllAddresses=>1);
|
||||
if (not @ips and keys %{$ctx->{nodeips}->{$node}}) {
|
||||
@ips = keys %{$ctx->{nodeips}->{$node}};
|
||||
}
|
||||
if (not @ips and keys %{$ctx->{nodeips}->{$node}}) {
|
||||
@ips = keys %{$ctx->{nodeips}->{$node}};
|
||||
}
|
||||
if (!defined($ips[0])) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Unable to find an IP for $node in hosts table or via system lookup (i.e. /etc/hosts)"], $callback);
|
||||
next;
|
||||
@@ -1215,7 +1214,7 @@ sub add_or_delete_records {
|
||||
}
|
||||
my $zone;
|
||||
foreach $zone (keys %{$ctx->{updatesbyzone}}) {
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone});
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone});
|
||||
if( !defined $ip) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Please make sure $ctx->{nsmap}->{$zone} exist either in /etc/hosts or DNS."], $callback);
|
||||
return 1;
|
||||
@@ -1297,9 +1296,9 @@ sub find_nameserver_for_dns {
|
||||
}
|
||||
|
||||
if (defined $ctx->{aliases}->{$node}) {
|
||||
foreach (keys %{$ctx->{aliases}->{$node}}) {
|
||||
push @rrcontent, "$_ IN CNAME $name";
|
||||
}
|
||||
foreach (keys %{$ctx->{aliases}->{$node}}) {
|
||||
push @rrcontent, "$_ IN CNAME $name";
|
||||
}
|
||||
}
|
||||
if ($ctx->{deletemode}) {
|
||||
push @rrcontent,"$name TXT";
|
||||
@@ -1312,7 +1311,7 @@ sub find_nameserver_for_dns {
|
||||
unless (defined $ctx->{nsmap}->{$zone}) { #ok, we already thought about this zone and made a decision
|
||||
if ($zone =~ /^\.*192.IN-ADDR.ARPA\.*/ or $zone =~ /^\.*172.IN-ADDR.ARPA\.*/ or $zone =~ /127.IN-ADDR.ARPA\.*/ or $zone =~ /^\.*IN-ADDR.ARPA\.*/ or $zone =~ /^\.*ARPA\.*/) {
|
||||
$ctx->{nsmap}->{$zone} = 0; #ignore zones that are likely to appear, but probably not ours
|
||||
} elsif ($::XCATSITEVALS{ddnsserver}) {
|
||||
} elsif ($::XCATSITEVALS{ddnsserver}) {
|
||||
$ctx->{nsmap}->{$zone} = $::XCATSITEVALS{ddnsserver};
|
||||
} else {
|
||||
my $reply = $ctx->{resolver}->query($zone,'NS');
|
||||
@@ -1393,9 +1392,9 @@ sub get_dns_slave
|
||||
foreach my $sn (@ents)
|
||||
{
|
||||
if ($sn->{'nameserver'} == 2)
|
||||
{
|
||||
{
|
||||
push @sns, $sn->{'node'};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@slaves = xCAT::NodeRange::noderange(join(',',@sns));
|
||||
|
||||
@@ -663,11 +663,6 @@ 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 =
|
||||
@@ -692,12 +687,6 @@ 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
|
||||
@@ -708,7 +697,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"
|
||||
@@ -721,14 +710,6 @@ 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,9 +323,7 @@ sub setdestiny {
|
||||
noupdateinitrd=>$noupdateinitrd,
|
||||
ignorekernelchk=>$ignorekernelchk,}, \&relay_response);
|
||||
if ($errored) {
|
||||
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"});
|
||||
$callback->({error=>"Some nodes failed to set up $state resources, aborting"});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -881,8 +881,8 @@ sub check_options
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback, 0);
|
||||
return 0;
|
||||
}
|
||||
# if not help and not -n, dhcpd needs to be running
|
||||
if (!($opt->{h})&& (!($opt->{n}))) {
|
||||
# if not help, dhcpd needs to be running
|
||||
if (!($opt->{h})) {
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
my @output = xCAT::Utils->runcmd("service dhcpd status", -1);
|
||||
if ($::RUNCMD_RC != 0) { # not running
|
||||
@@ -2647,7 +2647,6 @@ sub newconfig
|
||||
push @dhcpconf, "#xCAT generated dhcp configuration\n";
|
||||
push @dhcpconf, "\n";
|
||||
push @dhcpconf, "authoritative;\n";
|
||||
push @dhcpconf, "option conf-file code 209 = text;\n";
|
||||
push @dhcpconf, "option space isan;\n";
|
||||
push @dhcpconf, "option isan-encap-opts code 43 = encapsulate isan;\n";
|
||||
push @dhcpconf, "option isan.iqn code 203 = string;\n";
|
||||
|
||||
@@ -1332,7 +1332,7 @@ sub fpc_firmxfer_watch {
|
||||
return;
|
||||
}
|
||||
my $percent = 0;
|
||||
if ($rsp->{data} and (scalar(@{$rsp->{data}}) > 0)) {
|
||||
if ($rsp->{data} and (length(@{$rsp->{data}}) > 0)) {
|
||||
$percent = $rsp->{data}->[0];
|
||||
}
|
||||
#$callback->({sinfo=>"$percent%"});
|
||||
@@ -2971,13 +2971,12 @@ sub parsefru {
|
||||
my $currsize;
|
||||
if ($bytes->[$curridx] <= 5) { #don't even try to parse unknown stuff
|
||||
#some records don't comply to any SPEC
|
||||
while (not $last and $curridx < (scalar @$bytes)) {
|
||||
while (not $last) {
|
||||
if ($bytes->[$curridx+1] & 128) {
|
||||
$last=1;
|
||||
}
|
||||
$currsize=$bytes->[$curridx+2];
|
||||
push @{$fruhash->{extra}},@{$bytes}[$curridx..$curridx+4+$currsize-1];
|
||||
$curridx += 5 + $currsize;
|
||||
push @{$fruhash->{extra}},$bytes->[$curridx..$curridx+4+$currsize-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3563,7 +3563,8 @@ sub create_error_response {
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub lskit_processargs {
|
||||
if ( defined ($::args) && @{$::args} ){
|
||||
|
||||
if ( defined( @{$::args} ) ) {
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
|
||||
@@ -3664,7 +3665,7 @@ sub lskit_processargs {
|
||||
#-----------------------------------------------------------------------------
|
||||
sub lskitcomp_processargs {
|
||||
|
||||
if ( defined ($::args) && @{$::args} ){
|
||||
if ( defined( @{$::args} ) ) {
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
|
||||
@@ -3757,7 +3758,7 @@ sub lskitcomp_processargs {
|
||||
#-----------------------------------------------------------------------------
|
||||
sub lskitdeployparam_processargs {
|
||||
|
||||
if ( defined ($::args) && @{$::args} ){
|
||||
if ( defined( @{$::args} ) ) {
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ sub lskmodules_usage {
|
||||
#-----------------------------------------------------------------------------
|
||||
sub processArgs {
|
||||
|
||||
if ( defined ($::args) && @{$::args} ) {
|
||||
if ( defined( @{$::args} ) ) {
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
|
||||
|
||||
@@ -470,7 +470,26 @@ sub build_diskstruct {
|
||||
my $currdev;
|
||||
my @suffixes=('a','b','d'..'zzz');
|
||||
my $suffidx=0;
|
||||
my $storagemodel = $confdata->{vm}->{$node}->[0]->{storagemodel};
|
||||
if ($cdloc) {
|
||||
my $cdhash;
|
||||
$cdhash->{device}='cdrom';
|
||||
if ($cdloc =~ /^\/dev/) {
|
||||
$cdhash->{type}='block';
|
||||
} else {
|
||||
$cdhash->{type}='file';
|
||||
}
|
||||
$cdhash->{source}->{file}=$cdloc;
|
||||
$cdhash->{readonly};
|
||||
$cdhash->{target}->{dev}='hdc';
|
||||
push @returns,$cdhash;
|
||||
} else { #give the VM an empty optical drive, to allow chvm live attach/remove
|
||||
my $cdhash;
|
||||
$cdhash->{device}='cdrom';
|
||||
$cdhash->{type}='file';
|
||||
$cdhash->{readonly};
|
||||
$cdhash->{target}->{dev}='hdc';
|
||||
push @returns,$cdhash;
|
||||
}
|
||||
my $cachemethod = "none";
|
||||
if ( $confdata->{vm}->{$node}->[0]->{storagecache}) {
|
||||
$cachemethod = $confdata->{vm}->{$node}->[0]->{storagecache};
|
||||
@@ -487,7 +506,7 @@ sub build_diskstruct {
|
||||
my $model = $1;
|
||||
unless ($model) {
|
||||
#if not defined, model will stay undefined like above
|
||||
$model = $storagemodel;
|
||||
$model = $confdata->{vm}->{$node}->[0]->{storagemodel};
|
||||
unless ($model) { $model = 'ide'; } #if still not defined, ide
|
||||
}
|
||||
my $prefix='hd';
|
||||
@@ -555,34 +574,6 @@ sub build_diskstruct {
|
||||
push @returns,$diskhash;
|
||||
}
|
||||
}
|
||||
my $cdprefix='hd';
|
||||
if ($storagemodel eq 'virtio') {
|
||||
$cdprefix='vd';
|
||||
} elsif ($storagemodel eq 'scsi') {
|
||||
$cdprefix='sd';
|
||||
}
|
||||
$suffidx += 1;
|
||||
if ($cdloc) {
|
||||
my $cdhash;
|
||||
$cdhash->{device}='cdrom';
|
||||
if ($cdloc =~ /^\/dev/) {
|
||||
$cdhash->{type}='block';
|
||||
} else {
|
||||
$cdhash->{type}='file';
|
||||
}
|
||||
$cdhash->{source}->{file}=$cdloc;
|
||||
$cdhash->{readonly};
|
||||
$cdhash->{target}->{dev}=$cdprefix.$suffixes[$suffidx];
|
||||
push @returns,$cdhash;
|
||||
} else { #give the VM an empty optical drive, to allow chvm live attach/remove
|
||||
my $cdhash;
|
||||
$cdhash->{device}='cdrom';
|
||||
$cdhash->{type}='file';
|
||||
$cdhash->{readonly};
|
||||
$cdhash->{target}->{dev}=$cdprefix.$suffixes[$suffidx];
|
||||
push @returns,$cdhash;
|
||||
}
|
||||
|
||||
return \@returns;
|
||||
}
|
||||
sub getNodeUUID {
|
||||
@@ -663,16 +654,10 @@ sub build_xmldesc {
|
||||
my %args=@_;
|
||||
my $cdloc=$args{cd};
|
||||
my %xtree=();
|
||||
my $hypcpumodel = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cpumodel};
|
||||
$xtree{type}='kvm';
|
||||
$xtree{name}->{content}=$node;
|
||||
$xtree{uuid}->{content}=getNodeUUID($node);
|
||||
$xtree{os} = build_oshash();
|
||||
if (defined($hypcpumodel) and $hypcpumodel eq "ppc64") {
|
||||
$xtree{os}->{type}->{arch} = "ppc64";
|
||||
$xtree{os}->{type}->{machine} = "pseries";
|
||||
delete $xtree{os}->{bios};
|
||||
}
|
||||
if ($args{memory}) {
|
||||
$xtree{memory}->{content}=getUnits($args{memory},"M",1024);
|
||||
if ($confdata->{vm}->{$node}->[0]->{memory}) {
|
||||
@@ -738,12 +723,8 @@ sub build_xmldesc {
|
||||
} else {
|
||||
$xtree{devices}->{graphics}->{password}=genpassword(20);
|
||||
}
|
||||
if (defined($hypcpumodel) and $hypcpumodel eq 'ppc64') {
|
||||
$xtree{devices}->{emulator}->{content} = "/usr/bin/qemu-system-ppc64";
|
||||
} else {
|
||||
$xtree{devices}->{sound}->{model}='ac97';
|
||||
}
|
||||
|
||||
$xtree{devices}->{sound}->{model}='ac97';
|
||||
|
||||
$xtree{devices}->{console}->{type}='pty';
|
||||
$xtree{devices}->{console}->{target}->{port}='1';
|
||||
return XMLout(\%xtree,RootName=>"domain");
|
||||
@@ -3007,17 +2988,7 @@ sub dohyp {
|
||||
return 1,"General error establishing libvirt communication";
|
||||
}
|
||||
}
|
||||
if (($command eq 'mkvm' or $command eq 'chvm') and $hypconn) {
|
||||
my $nodeinfo = $hypconn->get_node_info();
|
||||
if (exists($nodeinfo->{model})) {
|
||||
$confdata->{$hyp}->{cpumodel} = $nodeinfo->{model};
|
||||
}
|
||||
}
|
||||
|
||||
foreach $node (sort (keys %{$hyphash{$hyp}->{nodes}})) {
|
||||
if ($confdata->{$hyp}->{cpumodel} and $confdata->{$hyp}->{cpumodel} =~ /ppc64/i) {
|
||||
$confdata->{vm}->{$node}->[0]->{storagemodel} = "scsi";
|
||||
}
|
||||
my ($rc,@output) = guestcmd($hyp,$node,$command,@$args);
|
||||
|
||||
foreach(@output) {
|
||||
|
||||
@@ -26,7 +26,8 @@ sub preprocess_request
|
||||
my @requests = ({%$req}); #first element is local instance
|
||||
|
||||
$::args = $req->{arg};
|
||||
if ( defined ($::args) && @{$::args} ) {
|
||||
|
||||
if (defined(@{$::args})) {
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
|
||||
@@ -87,7 +88,7 @@ sub process_request
|
||||
|
||||
$::args = $request->{arg};
|
||||
|
||||
if ( defined ($::args) && @{$::args} ) {
|
||||
if (defined(@{$::args})) {
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
|
||||
|
||||
@@ -412,13 +412,13 @@ sub create_imgconf_file {
|
||||
my $rootpw = undef;
|
||||
my $passwdtab = xCAT::Table->new('passwd');
|
||||
if ($passwdtab) {
|
||||
my $et = $passwdtab->getAttribs({key => 'vios', username => 'padmin'}, 'password');
|
||||
my $et = $passwdtab->getAttribs({key => 'system', username => 'root'}, 'password');
|
||||
if ($et and defined ($et->{'password'})) {
|
||||
$rootpw = $et->{'password'};
|
||||
}
|
||||
}
|
||||
unless (defined($rootpw)) {
|
||||
return "Unable to find requested password from passwd, with key=vios,username=padmin";
|
||||
return "Unable to find requested password from passwd, with key=system,username=root";
|
||||
}
|
||||
unless (-e $bootimg_root."/viobootimg") {
|
||||
return "Unable to find VIOS bootimg file";
|
||||
|
||||
@@ -447,22 +447,20 @@ sub process_request {
|
||||
|
||||
if ($do_dhcpsetup) {
|
||||
foreach my $node (@normalnodeset) {
|
||||
my $server = xCAT::TableUtils->GetMasterNodeName($node);
|
||||
my $ipfn = xCAT::NetworkUtils->my_ip_facing($server);
|
||||
if(($server != 1) and defined($ipfn)) {
|
||||
my $fpath = "http://$ipfn/tftpboot/petitboot/$node";
|
||||
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=> [$node],
|
||||
arg=>['-l','-s','option conf-file \"'.$fpath.'\";']},$callback);
|
||||
} else {
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=> [$node],
|
||||
arg=>['-s','option conf-file \"'.$fpath.'\";']},$callback);
|
||||
}
|
||||
}
|
||||
|
||||
my $fpath = "http://9.3.190.175/tftpboot/petitboot/$node";
|
||||
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=> [$node],
|
||||
arg=>['-l','-s','conf-file = \"'.$fpath.'\";']},$callback);
|
||||
} else {
|
||||
$sub_req->({command=>['makedhcp'],
|
||||
node=> [$node],
|
||||
arg=>['-s','conf-file = \"'.$fpath.'\";']},$callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#now run the end part of the prescripts
|
||||
|
||||
@@ -54,7 +54,6 @@ my $command;
|
||||
my $args;
|
||||
# Put arguments in a hash.
|
||||
my %args_dict;
|
||||
my %general_arg;
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
@@ -101,8 +100,6 @@ sub process_request {
|
||||
$command = $request->{command}->[0];
|
||||
$args = $request->{arg};
|
||||
|
||||
my $gereral_arg = get_general_args();
|
||||
|
||||
# There is no need to acquire lock for command nodediscoverstatus, nodediscoverls and noderegenips.
|
||||
if ($command eq "nodediscoverstatus"){
|
||||
nodediscoverstatus();
|
||||
@@ -115,11 +112,7 @@ sub process_request {
|
||||
return;
|
||||
}
|
||||
|
||||
my $non_block = 1;
|
||||
if ( $general_arg{'blockmode'} == 1) {
|
||||
$non_block = 0;
|
||||
}
|
||||
my $lock = xCAT::Utils->acquire_lock("nodemgmt", $non_block);
|
||||
my $lock = xCAT::Utils->acquire_lock("nodemgmt", 1);
|
||||
if (! $lock){
|
||||
setrsp_errormsg("Cannot acquire lock, another process is already running.");
|
||||
return;
|
||||
@@ -138,7 +131,7 @@ sub process_request {
|
||||
);
|
||||
|
||||
setrsp_errormsg("Cannot $errormsg_dict{$command} while node discovery is running.");
|
||||
xCAT::Utils->release_lock($lock, $non_block);
|
||||
xCAT::Utils->release_lock($lock, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -163,32 +156,7 @@ sub process_request {
|
||||
nodechmac();
|
||||
}
|
||||
|
||||
xCAT::Utils->release_lock($lock, $non_block);
|
||||
}
|
||||
|
||||
sub get_general_args
|
||||
{
|
||||
my ($help, $ver, $blockmode);
|
||||
%general_arg = ();
|
||||
@ARGV = ();
|
||||
if($args) {
|
||||
@ARGV = @$args;
|
||||
}
|
||||
GetOptions(
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$ver,
|
||||
'b|block' => \$blockmode,
|
||||
);
|
||||
|
||||
if($help){
|
||||
$general_arg{'help'} = 1;
|
||||
}
|
||||
if($ver){
|
||||
$general_arg{'version'} = 1;
|
||||
}
|
||||
if ($blockmode) {
|
||||
$general_arg{'blockmode'} = 1;
|
||||
}
|
||||
xCAT::Utils->release_lock($lock, 1);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
@@ -234,21 +202,37 @@ sub validate_args{
|
||||
my $enabledparamsref = shift;
|
||||
my $mandatoryparamsref = shift;
|
||||
|
||||
if ($general_arg{'help'} == 1){
|
||||
my %process_help_commands = (
|
||||
'nodediscoverstart' => 1,
|
||||
'nodediscoverstop' => 1,
|
||||
'nodediscoverls' => 1,
|
||||
'nodediscoverstatus' => 1,
|
||||
);
|
||||
# The -h -v are handled by seqdiscovery.pm
|
||||
# -t -u -l only works for nodediscoverls, and them only handled by seqdiscovery.pm
|
||||
my ($help, $ver, $type, $uuid, $long);
|
||||
|
||||
# do not process help message for these noddiscover* commands, cover them in seqdiscovery.pm
|
||||
unless ($process_help_commands{$command} == 1) {
|
||||
setrsp_infostr($helpmsg);
|
||||
return 0;
|
||||
}
|
||||
@ARGV = ();
|
||||
if($args) {
|
||||
@ARGV = @$args;
|
||||
}
|
||||
GetOptions(
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$ver,
|
||||
't=s' => \$type,
|
||||
'u=s' => \$uuid,
|
||||
'l' => \$long,
|
||||
);
|
||||
|
||||
if($help){
|
||||
# just return to make sequential discovery to handle it
|
||||
return 0;
|
||||
}
|
||||
|
||||
if($ver){
|
||||
# just return to make sequential discovery to handle it
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($type || $uuid || $long) {
|
||||
# these args for general discovery, return directly
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $parseret = parse_args();
|
||||
if ($parseret){
|
||||
setrsp_errormsg($parseret);
|
||||
@@ -498,8 +482,6 @@ Usage:
|
||||
$warnstr = "Warning: failed to import some nodes.";
|
||||
setrsp_progress($warnstr);
|
||||
}
|
||||
# setup node provisioning status.
|
||||
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>\@nodelist, arg=>['defined']}, $request_command, -1, 2);
|
||||
|
||||
setrsp_progress("Configuring nodes...");
|
||||
my $retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>\@nodelist, sequential=>[1], macflag=>[$mac_addr_mode]}, $request_command, 0, 2);
|
||||
@@ -744,6 +726,9 @@ Usage:
|
||||
# Update nodes' attributes
|
||||
foreach (@$nodes) {
|
||||
$updatenodeshash{$_}{'groups'} .= $profile_groups;
|
||||
if ($profile_status){
|
||||
$updatenodeshash{$_}{'status'} = $profile_status;
|
||||
}
|
||||
}
|
||||
|
||||
#update DataBase.
|
||||
@@ -752,11 +737,6 @@ Usage:
|
||||
$nodetab->setNodesAttribs(\%updatenodeshash);
|
||||
$nodetab->close();
|
||||
|
||||
#update node's status:
|
||||
if($profile_status eq "defined"){
|
||||
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>$nodes, arg=>['defined']}, $request_command, -1, 2);
|
||||
}
|
||||
|
||||
my $retref;
|
||||
my $retstrref;
|
||||
# Call update plugins first.
|
||||
@@ -1174,7 +1154,17 @@ Usage:
|
||||
|
||||
# Update node's status.
|
||||
setrsp_progress("Updating node status...");
|
||||
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>[$hostname], arg=>['defined']}, $request_command, -1, 2);
|
||||
my $nodelisttab = xCAT::Table->new('nodelist',-create=>1);
|
||||
my (
|
||||
$sec, $min, $hour, $mday, $mon,
|
||||
$year, $wday, $yday, $isdst
|
||||
) = localtime(time);
|
||||
my $currtime = sprintf("%02d-%02d-%04d %02d:%02d:%02d",
|
||||
$mon + 1, $mday, $year + 1900,
|
||||
$hour, $min, $sec);
|
||||
|
||||
$nodelisttab->setNodeAttribs($hostname, {status=>'defined', statustime=>$currtime});
|
||||
$nodelisttab->close();
|
||||
|
||||
setrsp_progress("Updated MAC address.");
|
||||
}
|
||||
@@ -1450,9 +1440,7 @@ Usage:
|
||||
my $mactab = xCAT::Table->new("mac");
|
||||
my $macsref = $mactab->getNodesAttribs(\@nodes, ['mac']);
|
||||
my $nodelisttab = xCAT::Table->new("nodelist");
|
||||
# Get node current provisioning status.
|
||||
my $provisionapp = "provision";
|
||||
my $provision_status = xCAT::TableUtils->getAppStatus(\@nodes,$provisionapp);
|
||||
my $statusref = $nodelisttab->getNodesAttribs(\@nodes, ['status']);
|
||||
|
||||
my $rspentry;
|
||||
my $i = 0;
|
||||
@@ -1473,8 +1461,8 @@ Usage:
|
||||
}
|
||||
}
|
||||
|
||||
if ($provision_status->{$_}){
|
||||
$rspentry->{node}->[$i]->{"status"} = $provision_status->{$_};
|
||||
if ($statusref->{$_}->[0]){
|
||||
$rspentry->{node}->[$i]->{"status"} = $statusref->{$_}->[0]->{status};
|
||||
} else{
|
||||
$rspentry->{node}->[$i]->{"status"} = "defined";
|
||||
}
|
||||
@@ -1638,8 +1626,6 @@ sub findme{
|
||||
}
|
||||
|
||||
my @nodelist = keys %hostinfo_dict;
|
||||
# setup node provisioning status.
|
||||
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>\@nodelist, arg=>['defined']}, $request_command, -1, 2);
|
||||
|
||||
# call makehosts to get the IP by resolving the name
|
||||
my $retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>\@nodelist, sequential=>[1]}, $request_command, 0, 2);
|
||||
|
||||
@@ -250,7 +250,7 @@ sub runrollupdate_usage {
|
||||
sub processArgs {
|
||||
my $gotattrs = 0;
|
||||
|
||||
if ( defined ($::args) && @{$::args} ) {
|
||||
if ( defined( @{$::args} ) ) {
|
||||
@ARGV = @{$::args};
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -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,7 +526,6 @@ sub route_exists {
|
||||
my $mask = shift;
|
||||
my $gw_ip = shift;
|
||||
my $gw=shift;
|
||||
my $ifname = shift;
|
||||
|
||||
my $islinux=xCAT::Utils->isLinux();
|
||||
|
||||
@@ -558,8 +557,7 @@ sub route_exists {
|
||||
my $net1=$a[0];
|
||||
my $mask1=$a[2];
|
||||
my $gw1=$a[1];
|
||||
my $ifname1=$a[7];
|
||||
if (($net1 eq $net) && ($mask1 eq $mask) && (($gw1 eq $gw) || ($gw1 eq $gw_ip) || ($ifname1 eq $ifname))) {
|
||||
if (($net1 eq $net) && ($mask1 eq $mask) && (($gw1 eq $gw) || ($gw1 eq $gw_ip))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -604,24 +602,20 @@ sub set_route {
|
||||
#print "set_route get called\n";
|
||||
|
||||
my $result;
|
||||
if (!route_exists($net, $mask, $gw_ip, $gw, $ifname)) {
|
||||
if (!route_exists($net, $mask, $gw_ip, $gw)) {
|
||||
#set temporay route
|
||||
my $cmd;
|
||||
# ipv6 network
|
||||
if ($net =~ /:/) {
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
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";
|
||||
}
|
||||
$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";
|
||||
}
|
||||
@@ -686,26 +680,18 @@ sub delete_route {
|
||||
#print "delete_route get called\n";
|
||||
|
||||
my $result;
|
||||
if (route_exists($net, $mask, $gw_ip, $gw, $ifname)) {
|
||||
if (route_exists($net, $mask, $gw_ip, $gw)) {
|
||||
#delete route temporarily
|
||||
my $cmd;
|
||||
if ($net =~ /:/) {
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
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";
|
||||
}
|
||||
$cmd = "ip -6 route delete $net/$mask via $gw_ip";
|
||||
} else {
|
||||
# AIX TODO
|
||||
}
|
||||
} else {
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
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";
|
||||
}
|
||||
$cmd="route delete -net $net netmask $mask gw $gw_ip";
|
||||
} else {
|
||||
$cmd="route delete -net $net -netmask $mask $gw_ip";
|
||||
}
|
||||
@@ -845,22 +831,14 @@ 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, $ifname, \@output);
|
||||
$hasConfiged=checkConfig_Sles($net, $mask, $gw_ip, $gw, \@output);
|
||||
}
|
||||
#print "hasConfiged=$hasConfiged\n";
|
||||
my $new_config;
|
||||
if ($net =~ /:/) {
|
||||
if ( $gw_ip == "" || $gw_ip == "::" ) {
|
||||
$new_config = "$net/$mask :: - $ifname\n";
|
||||
} else {
|
||||
$new_config = "$net/$mask $gw_ip - -\n";
|
||||
}
|
||||
$new_config = "$net/$mask $gw_ip - -\n";
|
||||
} else {
|
||||
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";
|
||||
}
|
||||
$new_config="$net $gw_ip $mask $ifname\n";
|
||||
}
|
||||
if (!$hasConfiged) {
|
||||
push(@output, $new_config);
|
||||
@@ -898,7 +876,7 @@ sub deletePersistentRoute_Sles {
|
||||
my @new_output=();
|
||||
my $bigfound=0;
|
||||
foreach my $tmp_conf (@output) {
|
||||
my $found = checkConfig_Sles($net, $mask, $gw_ip, $gw, $ifname, [$tmp_conf]);
|
||||
my $found = checkConfig_Sles($net, $mask, $gw_ip, $gw, [$tmp_conf]);
|
||||
if (!$found) {
|
||||
push(@new_output, $tmp_conf);
|
||||
} else {
|
||||
@@ -935,18 +913,13 @@ 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,$ifname1);
|
||||
my ($net1,$mask1,$gw1);
|
||||
if ($net =~ /:/) {
|
||||
if (@a>0) {
|
||||
my $ipv6net = $a[0];
|
||||
@@ -956,10 +929,6 @@ 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) {
|
||||
@@ -974,14 +943,10 @@ 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 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))) {
|
||||
#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))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1005,13 +970,13 @@ sub addPersistentRoute_RH {
|
||||
if ($net =~ /:/) {
|
||||
$filename="/etc/sysconfig/static-routes-ipv6";
|
||||
} else {
|
||||
$filename="/etc/sysconfig/static-routes";
|
||||
$filename="/etc/sysconfig/sysconfig/route-$ifname";
|
||||
}
|
||||
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, $ifname, \@output);
|
||||
$hasConfiged=checkConfig_RH($net, $mask, $gw_ip, $gw, \@output);
|
||||
}
|
||||
#print "hasConfiged=$hasConfiged\n";
|
||||
my $new_config;
|
||||
@@ -1026,11 +991,7 @@ sub addPersistentRoute_RH {
|
||||
|
||||
$new_config="$ifname $net/$mask $gw_ip";
|
||||
} else {
|
||||
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";
|
||||
}
|
||||
$new_config="$net/$mask via $gw_ip dev $ifname\n";
|
||||
}
|
||||
if (!$hasConfiged) {
|
||||
push(@output, $new_config);
|
||||
@@ -1067,14 +1028,14 @@ sub deletePersistentRoute_RH {
|
||||
if ($net =~ /:/) {
|
||||
$filename="/etc/sysconfig/static-routes-ipv6";
|
||||
} else {
|
||||
$filename="/etc/sysconfig/static-routes";
|
||||
$filename="/etc/sysconfig/network-scripts/route-$ifname";
|
||||
}
|
||||
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, $ifname, [$tmp_conf]);
|
||||
my $found = checkConfig_RH($net, $mask, $gw_ip, $gw, [$tmp_conf]);
|
||||
if (!$found) {
|
||||
push(@new_output, $tmp_conf);
|
||||
} else {
|
||||
@@ -1089,7 +1050,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 \"any net $net netmask $mask gw $gw_ip $ifname\" from $filename.";
|
||||
$rsp->{data}->[0]= "$host: Removed persistent route \"$net/$mask via $gw_ip dev $ifname\" from $filename.";
|
||||
}
|
||||
$callback->($rsp);
|
||||
} else {
|
||||
@@ -1097,7 +1058,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 \"any net $net netmask $mask gw $gw_ip $ifname\" does not exist in $filename.";
|
||||
$rsp->{data}->[0]= "$host: Persistent route \"$net/$mask via $gw_ip dev $ifname\" does not exist in $filename.";
|
||||
}
|
||||
$callback->($rsp);
|
||||
}
|
||||
@@ -1108,16 +1069,14 @@ 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,$ifname1);
|
||||
my ($net1,$mask1,$gw1);
|
||||
if ($net =~ /:/) {
|
||||
$ifname1 = $a[0];
|
||||
if (@a>1) {
|
||||
my $ipv6net = $a[1];
|
||||
($net1,$mask1) = split("/",$ipv6net);
|
||||
@@ -1135,18 +1094,13 @@ sub checkConfig_RH {
|
||||
if ($mask1 eq '-') { $mask1=$mask;}
|
||||
}
|
||||
if (@a>6) {
|
||||
if ( $a[5] eq 'dev' ) {
|
||||
$ifname1=$a[6];
|
||||
if ($ifname1 eq '-') { $ifname1=$ifname;}
|
||||
} else {
|
||||
$gw1=$a[6];
|
||||
if ($gw1 eq '-') { $gw1=$gw_ip; }
|
||||
}
|
||||
$gw1=$a[6];
|
||||
if ($gw1 eq '-') { $gw1=$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))) {
|
||||
#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))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1170,20 +1124,15 @@ sub addPersistentRoute_Debian{
|
||||
|
||||
#ipv6
|
||||
if ( $net =~ /:/){
|
||||
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";
|
||||
}
|
||||
$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";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1242,18 +1191,10 @@ sub deletePersistentRoute_Debian{
|
||||
preParse_Debian();
|
||||
#ipv6
|
||||
if ( $net =~ /:/){
|
||||
if ( $gw_ip == "" || $gw_ip == "::" ) {
|
||||
$match = "$net/$mask dev $ifname";
|
||||
} else {
|
||||
$match = "$net/$mask gw $gw_ip";
|
||||
}
|
||||
$match = "$net/$mask gw $gw_ip";
|
||||
}
|
||||
else {
|
||||
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";
|
||||
}
|
||||
$match = "net $net netmask $mask gw $gw_ip";
|
||||
}
|
||||
|
||||
open(FH, "<", $conf_file);
|
||||
|
||||
Executable → Regular
-52
@@ -956,8 +956,6 @@ sub mkinstall
|
||||
my $tmppkgdir=$pkgdir;
|
||||
my @srcdirs = split(",", $pkgdir);
|
||||
$pkgdir = $srcdirs[0];
|
||||
# trim the "/" in /install/sles11.3/x86_64/
|
||||
$pkgdir =~ s/\/$//;
|
||||
if( $pkgdir =~/^($installroot\/$os\/$arch)$/) {
|
||||
$srcdirs[0]="$pkgdir/1";
|
||||
$tmppkgdir=join(",", @srcdirs);
|
||||
@@ -1074,14 +1072,6 @@ sub mkinstall
|
||||
{
|
||||
$netserver = $ent->{nfsserver};
|
||||
}
|
||||
|
||||
if ($::XCATSITEVALS{managedaddressmode} =~ /static/){
|
||||
unless($netserver eq '!myipfn!'){
|
||||
my($host,$ip)=xCAT::NetworkUtils->gethostnameandip($netserver);
|
||||
$netserver=$ip;
|
||||
}
|
||||
}
|
||||
|
||||
my $httpprefix = $pkgdir;
|
||||
if ($installroot =~ /\/$/) { #must prepend /install/
|
||||
$httpprefix =~ s/^$installroot/\/install\//;
|
||||
@@ -1146,48 +1136,6 @@ sub mkinstall
|
||||
$kcmdline .= " dud=file:/cus_driverdisk/$_";
|
||||
}
|
||||
|
||||
#if site.managedaddressmode=static, specify the network configuration as kernel options
|
||||
#to avoid multicast dhcp
|
||||
if($::XCATSITEVALS{managedaddressmode} =~ /static/){
|
||||
my ($ipaddr,$hostname,$gateway,$netmask)=xCAT::NetworkUtils->getNodeNetworkCfg($node);
|
||||
unless($ipaddr) {
|
||||
$callback->(
|
||||
{
|
||||
error => [
|
||||
"cannot resolve the ip address of $node"
|
||||
],
|
||||
errorcode => [1]
|
||||
}
|
||||
);
|
||||
}
|
||||
if($gateway eq '<xcatmaster>'){
|
||||
$gateway = xCAT::NetworkUtils->my_ip_facing($ipaddr);
|
||||
}
|
||||
$kcmdline .=" hostip=$ipaddr netmask=$netmask gateway=$gateway hostname=$hostname ";
|
||||
|
||||
|
||||
my %nameservers=%{xCAT::NetworkUtils->getNodeNameservers([$node])};
|
||||
my @nameserverARR=split (",",$nameservers{$node});
|
||||
my @nameserversIP;
|
||||
foreach (@nameserverARR)
|
||||
{
|
||||
my $ip;
|
||||
if($_ eq '<xcatmaster>'){
|
||||
$ip = xCAT::NetworkUtils->my_ip_facing($gateway);
|
||||
}else{
|
||||
(undef,$ip) = xCAT::NetworkUtils->gethostnameandip($_);
|
||||
}
|
||||
push @nameserversIP, $ip;
|
||||
|
||||
}
|
||||
|
||||
if(scalar @nameserversIP){
|
||||
$kcmdline .=" dns=".join(",",@nameserversIP);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (defined $sent->{serialport})
|
||||
{
|
||||
unless ($sent->{serialspeed})
|
||||
|
||||
@@ -2975,21 +2975,6 @@ sub getAttribs
|
||||
# <comments>This is a comment</comments>
|
||||
#</xcatrequest>
|
||||
#
|
||||
#
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>setAttribs</command>
|
||||
#<table>networks</table>
|
||||
#<keys>
|
||||
# <net>10.0.1.0</net>
|
||||
# <mask>255.255.255.0</mask>
|
||||
#</keys>
|
||||
#<attr>
|
||||
# <netname>mynet</netname>
|
||||
# <gateway>10.0.1.254</gateway>
|
||||
#</attr>
|
||||
#</xcatrequest>
|
||||
|
||||
sub setAttribs
|
||||
{
|
||||
my $request = shift;
|
||||
|
||||
@@ -14,7 +14,6 @@ use xCAT::Schema;
|
||||
use Data::Dumper;
|
||||
use xCAT::Utils;
|
||||
use xCAT::SvrUtils;
|
||||
use xCAT::Scope;
|
||||
use xCAT::Usage;
|
||||
use Storable qw(dclone);
|
||||
use xCAT::TableUtils;
|
||||
@@ -189,7 +188,6 @@ sub preprocess_updatenode
|
||||
my @requests = ();
|
||||
|
||||
my $installdir = xCAT::TableUtils->getInstallDir();
|
||||
my $localhost = hostname();
|
||||
|
||||
# subroutine to display the usage
|
||||
sub updatenode_usage
|
||||
@@ -253,40 +251,20 @@ sub preprocess_updatenode
|
||||
$callback->($rsp);
|
||||
return;
|
||||
}
|
||||
|
||||
# preprocess generate mypostscripts files (-g) for hierarchy
|
||||
# if no sharedtftp then we need to broadcast this updatenode -g to all service nodes inorder
|
||||
# to be able to support service node pools
|
||||
#
|
||||
# Just generate mypostscripts file and get out
|
||||
if ($::GENMYPOST)
|
||||
{
|
||||
# precreatemypostscript has to be yes/1 or do nothing
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts");
|
||||
if ($entries[0] ) {
|
||||
$entries[0] =~ tr/a-z/A-Z/;
|
||||
if ($entries[0] =~ /^(1|YES)$/ ) {
|
||||
# now check if sharedtftp = 0, if it is we need to broadcast to all the servicenode
|
||||
# if there are service nodes
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
|
||||
my $t_entry = $entries[0];
|
||||
if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) {
|
||||
# see if there are any servicenodes. If so then run updatenode -g on all of them
|
||||
my @SN;
|
||||
my @CN;
|
||||
my $nodes = $request->{node};
|
||||
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
|
||||
if (@CN >0 ) { # if compute nodes broadcast to all servicenodes
|
||||
return xCAT::Scope->get_broadcast_scope($request,@_);
|
||||
}
|
||||
} else { # sharedtftp=yes, just run on MN
|
||||
my $notmpfiles=1;
|
||||
my $nofiles=0;
|
||||
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Generated new mypostscript files on $localhost";
|
||||
$callback->($rsp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $notmpfiles=1;
|
||||
my $nofiles=0;
|
||||
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Generated new mypostscript files";
|
||||
$callback->($rsp);
|
||||
} else { # not valid unless precreatemypostscripts enabled
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
@@ -295,7 +273,7 @@ sub preprocess_updatenode
|
||||
$callback->($rsp);
|
||||
return ;
|
||||
}
|
||||
} else { # precreatemypostscripts not in the site table
|
||||
} else { # not in the site table
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
|
||||
@@ -303,9 +281,8 @@ sub preprocess_updatenode
|
||||
$callback->($rsp);
|
||||
return ;
|
||||
}
|
||||
} # end GENMYPOST
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
# -c must work with -S for AIX node
|
||||
if ($::CMDLINE && !$::SWMAINTENANCE)
|
||||
@@ -1033,6 +1010,27 @@ sub updatenode
|
||||
|
||||
}
|
||||
|
||||
#create each /tftpboot/mypostscript/mypostscript.<nodename> for each node
|
||||
# This first removes the old one if precreatemypostscripts =0 or undefined
|
||||
# call create files but no tmp files
|
||||
my $notmpfiles=1;
|
||||
my $nofiles=0;
|
||||
#my $nofiles=1;
|
||||
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
|
||||
|
||||
# convert the hashes back to the way they were passed in
|
||||
my $flatreq = xCAT::InstUtils->restore_request($request, $callback);
|
||||
my $imgdefs;
|
||||
my $updates;
|
||||
if ($flatreq->{imagedef})
|
||||
{
|
||||
$imgdefs = $flatreq->{imagedef};
|
||||
}
|
||||
if ($flatreq->{updateinfo})
|
||||
{
|
||||
$updates = $flatreq->{updateinfo};
|
||||
}
|
||||
|
||||
# get the NIM primary server name
|
||||
my $nimprime = xCAT::InstUtils->getnimprime();
|
||||
chomp $nimprime;
|
||||
@@ -1045,7 +1043,6 @@ sub updatenode
|
||||
'A|updateallsw' => \$::ALLSW,
|
||||
'c|cmdlineonly' => \$::CMDLINE,
|
||||
'd=s' => \$::ALTSRC,
|
||||
'g|genmypost' => \$::GENMYPOST,
|
||||
'h|help' => \$::HELP,
|
||||
'v|version' => \$::VERSION,
|
||||
'V|verbose' => \$::VERBOSE,
|
||||
@@ -1088,60 +1085,6 @@ sub updatenode
|
||||
$::attrres{$attr} = $value;
|
||||
}
|
||||
}
|
||||
# Just generate mypostscripts file and get out
|
||||
if ($::GENMYPOST)
|
||||
{
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts");
|
||||
if ($entries[0] ) {
|
||||
$entries[0] =~ tr/a-z/A-Z/;
|
||||
if ($entries[0] =~ /^(1|YES)$/ ) {
|
||||
|
||||
my $notmpfiles=1;
|
||||
my $nofiles=0;
|
||||
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Generated new mypostscript files on $localhostname";
|
||||
$callback->($rsp);
|
||||
} else { # not valid unless precreatemypostscripts enabled
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
|
||||
$rsp->{errorcode}->[0] =1;
|
||||
$callback->($rsp);
|
||||
return ;
|
||||
}
|
||||
} else { # not in the site table
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"This option is only valid if site table precreatemypostscripts attribute is 1 or YES";
|
||||
$rsp->{errorcode}->[0] =1;
|
||||
$callback->($rsp);
|
||||
return ;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#create each /tftpboot/mypostscript/mypostscript.<nodename> for each node
|
||||
# This first removes the old one if precreatemypostscripts =0 or undefined
|
||||
# call create files but no tmp files
|
||||
my $notmpfiles=1;
|
||||
my $nofiles=0;
|
||||
#my $nofiles=1;
|
||||
xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles);
|
||||
|
||||
# convert the hashes back to the way they were passed in
|
||||
my $flatreq = xCAT::InstUtils->restore_request($request, $callback);
|
||||
my $imgdefs;
|
||||
my $updates;
|
||||
if ($flatreq->{imagedef})
|
||||
{
|
||||
$imgdefs = $flatreq->{imagedef};
|
||||
}
|
||||
if ($flatreq->{updateinfo})
|
||||
{
|
||||
$updates = $flatreq->{updateinfo};
|
||||
}
|
||||
|
||||
# if not just using the -k flag, then set all nodes to syncing in
|
||||
# nodelist updatestatus for the other updatenode options
|
||||
if (!($::SECURITY)) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,183 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
package xCAT_plugin::vlan;
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use strict;
|
||||
use warnings "all";
|
||||
use xCAT::GlobalDef;
|
||||
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use xCAT::SvrUtils;
|
||||
use xCAT::Usage;
|
||||
use xCAT::NodeRange;
|
||||
|
||||
sub handled_commands {
|
||||
return {
|
||||
mkvlan => 'switch:vlan,port,switch', # in progress
|
||||
chvlan => 'switch:vlan,port,switch', # in progress
|
||||
lsvlan => 'switch:vlan,port,switch', # in progress
|
||||
rmvlan => 'switch:vlan,port,switch', # in progress
|
||||
}
|
||||
}
|
||||
|
||||
use POSIX "WNOHANG";
|
||||
use IO::Handle;
|
||||
use IO::Socket;
|
||||
use IO::Select;
|
||||
|
||||
#local to module
|
||||
my $callback;
|
||||
my $timeout;
|
||||
my $port;
|
||||
my $debug;
|
||||
my $ndebug = 0;
|
||||
my $sock;
|
||||
my $noclose;
|
||||
my %sessiondata; #hold per session variables, in preparation for single-process strategy
|
||||
my %pendingtransactions; #list of peers with callbacks, callback arguments, and timer expiry data
|
||||
my $enable_cache="yes";
|
||||
my $cache_dir = "/var/cache/xcat";
|
||||
|
||||
my $vlanid;
|
||||
|
||||
sub process_request
|
||||
{
|
||||
my $req = shift;
|
||||
my $callback = shift;
|
||||
my $reqcmd = shift;
|
||||
|
||||
if ($command eq 'mkvlan')
|
||||
{
|
||||
return mkvlan($req, $callback, $reqcmd);
|
||||
}
|
||||
elsif ($command eq 'chvlan')
|
||||
{
|
||||
return chvlan($req, $callback, $reqcmd);
|
||||
}
|
||||
elsif ($command eq 'lsvlan')
|
||||
{
|
||||
return lsvlan($req, $callback, $reqcmd);
|
||||
}
|
||||
elsif ($command eq 'rmvlan')
|
||||
{
|
||||
return rmvlan($req, $callback, $reqcmd);
|
||||
}
|
||||
}
|
||||
|
||||
sub mkvlan
|
||||
{
|
||||
my $request = shift;
|
||||
my $callback = shift;
|
||||
my $reqcmd = shift;
|
||||
|
||||
# Variables for this function
|
||||
my $vlanid;
|
||||
|
||||
# A quick function for usage information for the command
|
||||
my $mkvlan_usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
my %rsp;
|
||||
push @{$rsp{data}}, "Usage: mkvlan [vlanid] -n noderange [-t subnet | -m netmask | -i interface]";
|
||||
push @{$rsp{data}}, " mkvlan [-?|-h|--help]";
|
||||
if ($exitcode) { $rsp{errorcode} = $exitcode; }
|
||||
$callback->(\%rsp);
|
||||
};
|
||||
|
||||
# Go through the arguments, and get the relevant information
|
||||
@ARGV = @{$req->{arg}};
|
||||
|
||||
#Detect if the first variable is a number or not, as it may be the vlanid
|
||||
if ($ARGV[0] !~ /\D/) {$vlanid=$ARGV[0];}
|
||||
|
||||
GetOptions(
|
||||
't=s' => \$subnet,
|
||||
'm=s' => \$mask,
|
||||
'n=s' => \$noderange,
|
||||
'i=s' => \$interface,
|
||||
'h|?|help' => \$help,
|
||||
'v|version' => \$VERSION,
|
||||
);
|
||||
|
||||
# Show usage info if help is defined
|
||||
if ($help) { $mkvlan_usage->(0); return;}
|
||||
|
||||
# Node range must be defined
|
||||
if (!defined($noderange)) { $mkvlan_usage->(1); return;}
|
||||
|
||||
# Display the version of the code
|
||||
if ($VERSION) {
|
||||
my %rsp;
|
||||
my $version = xCAT::Utils->Version();
|
||||
$rsp{data}->[0] = "$version";
|
||||
$cb->(\%rsp);
|
||||
return;
|
||||
}
|
||||
|
||||
# put the nodes in an array
|
||||
my @nodes = split(/,/,$noderange);
|
||||
my $swtab = xCAT::Table->new('switch');
|
||||
my $swhash = $swtab->getNodesAttribs(\@nodes,['switch','vlan','port','interface']);
|
||||
|
||||
foreach (@nodes)
|
||||
{
|
||||
my $node = $_;
|
||||
|
||||
foreach (@$swhash->{$node})
|
||||
{
|
||||
my $nswhash = $_;
|
||||
|
||||
my $switch = $nswhash->{'switch'};
|
||||
my $vlan = $nswhash->{'vlan'};
|
||||
my $port = $nswhash->{'port'};
|
||||
my $swinterface = $nswhash->{'interface'};
|
||||
|
||||
if ($vlanid == "" || !defined($vlanid)) {$vlanid = $vlan;}
|
||||
if ($interface == "" || !defined($interface)) { $interface = $swinterface;}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub lsvlan
|
||||
{
|
||||
my $request = shift;
|
||||
my $callback = shift;
|
||||
my $reqcmd = shift;
|
||||
|
||||
my @args = @{$req->{arg}} if(exists($req->{arg}));
|
||||
|
||||
# A quick function for usage information for the command
|
||||
my $lsvlan_usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
my %rsp;
|
||||
push @{$rsp{data}}, "Usage: mkvlan vlanid";
|
||||
push @{$rsp{data}}, " mkvlan [-?|-h|--help]";
|
||||
if ($exitcode) { $rsp{errorcode} = $exitcode; }
|
||||
$callback->(\%rsp);
|
||||
};
|
||||
|
||||
# Go through the arguments, and get the relevant information
|
||||
@ARGV = @{$req->{arg}};
|
||||
|
||||
#Detect if the first variable is a number or not, as it may be the vlanid
|
||||
if ($ARGV[0] !~ /\D/) {$vlanid=$ARGV[0];}
|
||||
|
||||
GetOptions(
|
||||
'h|?|help' => \$help,
|
||||
);
|
||||
|
||||
# Show usage info if help is defined
|
||||
if ($help) { $lsvlan_usage->(0); return; }
|
||||
# Show usage if we have less then 2 arguments, or the vlan option is not defined
|
||||
if (scalar(@ARGV)<1 || !defined($vlanid)) { $lsvlan_usage->(1); return; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
@@ -412,7 +412,7 @@ sub mkinstall
|
||||
$custmplpath = "$installroot/custom/install/hyperv";
|
||||
$tmplpath = "$::XCATROOT/share/xcat/install/hyperv";
|
||||
}
|
||||
$tmplfile=xCAT::SvrUtils::get_tmpl_file_name($custmplpath, $profile, $os, $arch);
|
||||
my $tmplfile=xCAT::SvrUtils::get_tmpl_file_name($custmplpath, $profile, $os, $arch);
|
||||
if (! $tmplfile) { $tmplfile=xCAT::SvrUtils::get_tmpl_file_name($tmplpath, $profile, $os, $arch); }
|
||||
}
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ sub prexcat2nim
|
||||
my @nodelist=(); # pass back list of nodes - if applicable
|
||||
my @servicenodes=(); # pass back list of service nodes - if applicable
|
||||
|
||||
if ( defined ($::args) && @{$::args} ) {
|
||||
if (defined(@{$::args})) {
|
||||
@ARGV = @{$::args};
|
||||
} else {
|
||||
&xcat2nim_usage($callback);
|
||||
@@ -359,7 +359,7 @@ sub processArgs
|
||||
|
||||
my $gotattrs = 0;
|
||||
|
||||
if ( defined ($::args) && @{$::args} ) {
|
||||
if (defined(@{$::args})) {
|
||||
@ARGV = @{$::args};
|
||||
} else {
|
||||
return 3;
|
||||
|
||||
@@ -131,16 +131,6 @@ sub process_request
|
||||
&usage($callback,$command);
|
||||
exit 1;
|
||||
}
|
||||
# if the ARGS still have data we have invalid input
|
||||
if (@ARGV) {
|
||||
my $args=join(',', @ARGV);
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"The input to the command: $command contained invalid arguments: $args.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if ($options{'help'})
|
||||
{
|
||||
&usage($callback,$command);
|
||||
@@ -180,14 +170,6 @@ sub process_request
|
||||
}
|
||||
}
|
||||
}
|
||||
# cannot enter -K and -k
|
||||
if (($options{'sshkeypath'}) && ($options{'gensshkeys'})) {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"The input of -k and -K is not valid on the command : $command.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# check for site.sshbetweennodes attribute, put out a warning it will not be used as long
|
||||
# as zones are defined in the zone table.
|
||||
@@ -491,18 +473,6 @@ sub rmzone
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return 1;
|
||||
}
|
||||
# see if they input invalid flags
|
||||
if (($$options{'sshkeypath'}) || ($$options{'gensshkeys'}) ||
|
||||
( $$options{'addnoderange'}) || ( $$options{'rmnoderange'}) ||
|
||||
( $$options{'defaultzone'}) ||
|
||||
($$options{'sshbetweennodes'})) {
|
||||
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"The following flags are not valid input for the rmzone command: -k,-K,-a,-r,-f,-s ";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return 1;
|
||||
}
|
||||
# check to see if the input zone already exists
|
||||
# cannot remove it if it is not defined
|
||||
my $zonename=$request->{zonename};
|
||||
@@ -620,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";
|
||||
@@ -735,9 +705,6 @@ sub addtozonetable
|
||||
my $curdefaultzone = xCAT::Zone->getdefaultzone($callback);
|
||||
if (!(defined ($curdefaultzone))) { # no default defined
|
||||
$tb_cols{defaultzone} ="yes";
|
||||
$tab->setAttribs({zonename => $zonename}, \%tb_cols);
|
||||
$tab->commit();
|
||||
$tab->close();
|
||||
} else { # already a default
|
||||
if ($$options{'force'}) { # force the default
|
||||
$tb_cols{defaultzone} ="yes";
|
||||
@@ -813,9 +780,6 @@ sub updatezonetable
|
||||
my $curdefaultzone = xCAT::Zone->getdefaultzone($callback);
|
||||
if (!(defined ($curdefaultzone))) { # no default defined
|
||||
$tb_cols{defaultzone} ="yes";
|
||||
$tab->setAttribs({zonename => $zonename}, \%tb_cols);
|
||||
$tab->commit();
|
||||
$tab->close();
|
||||
} else { # already a default
|
||||
if ($$options{'force'}) { # force the default
|
||||
$tb_cols{defaultzone} ="yes";
|
||||
|
||||
@@ -12,7 +12,6 @@ use Getopt::Long;
|
||||
use strict;
|
||||
#This or something like this must always be available and not depend on server
|
||||
#Otherwise, can't set things to let server run in the first place
|
||||
#
|
||||
|
||||
sub usage {
|
||||
print "Usage:\n";
|
||||
|
||||
@@ -1020,6 +1020,44 @@ sub genSSHNodeHostKey
|
||||
|
||||
}
|
||||
|
||||
# is_lsb_ubuntu return value indicates whether system appears to be Ubuntu.
|
||||
# Using required /etc/lsb-release file, instead of optional lsb_release command.
|
||||
|
||||
sub is_lsb_ubuntu
|
||||
{
|
||||
if (open(my $relfile, "<", "/etc/lsb-release")) {
|
||||
my @text = <$relfile>;
|
||||
close($relfile);
|
||||
chomp(@text);
|
||||
my $distrib_id = '';
|
||||
|
||||
foreach (@text) {
|
||||
if ( $_ =~ /^\s*DISTRIB_ID=(.*)$/ ) {
|
||||
$distrib_id = $1; # last DISTRIB_ID value in file used
|
||||
}
|
||||
}
|
||||
|
||||
if ( $distrib_id =~ /^(Ubuntu|"Ubuntu")\s*$/ ) {
|
||||
return 1; # return "true"
|
||||
}
|
||||
}
|
||||
|
||||
return 0; # return "false"
|
||||
}
|
||||
|
||||
sub is_debian
|
||||
{
|
||||
if ( -e "/etc/debian_version" && -e "/etc/issue"){
|
||||
open(my $relfile, "<", "/etc/issue");
|
||||
my $line = <$relfile>;
|
||||
close($relfile);
|
||||
if ( $line =~ /debian.*/i ){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub is_redhat6sp4
|
||||
{
|
||||
if( -e "/etc/redhat-release" ){
|
||||
@@ -1034,6 +1072,21 @@ sub is_redhat6sp4
|
||||
}
|
||||
|
||||
|
||||
# on Ubuntu need to painstakingly compare /etc/localtime with files under
|
||||
# /usr/share/zoneinfo since /etc/localtime # isn't always a symbolic link
|
||||
sub discover_timezone_ubuntu
|
||||
{
|
||||
my $localtime = "/etc/localtime";
|
||||
my $zoneinfo = "/usr/share/zoneinfo";
|
||||
|
||||
my $zone_result = `find $zoneinfo -type f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV`;
|
||||
|
||||
my @zones = split /\n/, $zone_result;
|
||||
|
||||
$zones[0] =~ s/$zoneinfo\///;
|
||||
|
||||
return $zones[0];
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -1105,7 +1158,6 @@ sub initDB
|
||||
|
||||
# set value based on OS
|
||||
my ($domain, $timezone);
|
||||
my $timezone = xCAT::Utils->gettimezone();
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
my ($name, $rest) = split('\.', $hname);
|
||||
@@ -1118,10 +1170,35 @@ sub initDB
|
||||
$domain = "";
|
||||
}
|
||||
|
||||
$timezone = $ENV{'TZ'};
|
||||
}
|
||||
else # linux
|
||||
{
|
||||
$domain = `hostname -d`;
|
||||
my $tz;
|
||||
if (-f "/etc/redhat-release")
|
||||
{
|
||||
|
||||
# on Redhat look for "ZONE"
|
||||
$tz =
|
||||
`grep ^ZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'`;
|
||||
}
|
||||
elsif ( is_lsb_ubuntu() || is_debian() )
|
||||
{
|
||||
$tz = discover_timezone_ubuntu;
|
||||
if (!$tz){
|
||||
$tz = `cat /etc/timezone`;
|
||||
chomp $tz;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# on SuSE look for "TIMEZONE"
|
||||
$tz =
|
||||
`grep ^TIMEZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'`;
|
||||
}
|
||||
$timezone = $tz;
|
||||
}
|
||||
|
||||
chomp $timezone;
|
||||
@@ -1896,7 +1973,6 @@ sub setuphttp
|
||||
{
|
||||
|
||||
my $cmd;
|
||||
my $distro = xCAT::Utils->osver();
|
||||
# restart httpd
|
||||
if (-e "/etc/init.d/apache2")
|
||||
{ #for sles/ubuntu
|
||||
@@ -1924,7 +2000,8 @@ sub setuphttp
|
||||
# enable httpd
|
||||
if (-e "/etc/init.d/apache2")
|
||||
{
|
||||
if ( $distro =~ /ubuntu.*/ || $distro =~ /debian.*/i) {
|
||||
if (is_lsb_ubuntu() || is_debian() )
|
||||
{ # for ubuntu
|
||||
$cmd = "/usr/sbin/update-rc.d apache2 enable";
|
||||
}
|
||||
else
|
||||
@@ -1932,6 +2009,18 @@ sub setuphttp
|
||||
$cmd = "/sbin/chkconfig apache2 on";
|
||||
}
|
||||
}
|
||||
# elsif (-e "/sbin/chkconfig")
|
||||
# {
|
||||
# $cmd = "/sbin/chkconfig httpd on";
|
||||
# }
|
||||
# elsif (-e "/usr/sbin/chkconfig")
|
||||
# {
|
||||
# $cmd = "/usr/sbin/chkconfig httpd on";
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# $cmd = "chkconfig httpd on";
|
||||
# }
|
||||
else
|
||||
{
|
||||
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
|
||||
@@ -2164,7 +2253,6 @@ sub setupMNinDB
|
||||
sub startnamedonboot
|
||||
{
|
||||
# start named on boot
|
||||
my $distro = xCAT::Utils->osver();
|
||||
if (xCAT::Utils->isAIX())
|
||||
{
|
||||
#/etc/inittab
|
||||
@@ -2184,7 +2272,7 @@ sub startnamedonboot
|
||||
#chkconfig
|
||||
my $serv = "named";
|
||||
my $cmd = "/sbin/chkconfig $serv on";
|
||||
if ( $distro =~ /ubuntu.*/ || $distro =~ /debian.*/i) {
|
||||
if ( is_lsb_ubuntu() || is_debian() ){
|
||||
$serv = "bind9";
|
||||
$cmd = "update-rc.d $serv enable";
|
||||
}
|
||||
|
||||
+22
-63
@@ -328,42 +328,35 @@ sleep 0.05; #up to 50 ms outage possible
|
||||
my $conn;
|
||||
next unless $conn = $socket->accept;
|
||||
|
||||
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 @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 $validclient=0;
|
||||
my $node;
|
||||
my $domain;
|
||||
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains(\@clients);
|
||||
my %nodedomains = %{$nd};
|
||||
|
||||
foreach my $client (@clients) {
|
||||
my @ndn = ($client);
|
||||
my $nd = xCAT::NetworkUtils->getNodeDomains(\@ndn);
|
||||
my %nodedomains = %{$nd};
|
||||
$domain = $nodedomains{$client};
|
||||
$client =~ s/\..*//;
|
||||
if ($domain) {
|
||||
$client =~ s/\.$domain//;
|
||||
} else {
|
||||
$domain = $nodedomains{$client};
|
||||
$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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
unless ($validclient) {
|
||||
@@ -2096,40 +2089,6 @@ 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="";
|
||||
|
||||
@@ -67,7 +67,7 @@ cert_opt = ca_default # Certificate field options
|
||||
|
||||
default_days = 7300 # how long to certify for
|
||||
default_crl_days= 30 # how long before next CRL
|
||||
default_md = sha1 # which md to use.
|
||||
default_md = sha256 # which md to use.
|
||||
preserve = no # keep passed DN ordering
|
||||
|
||||
# A few difference way of specifying how similar the request should look
|
||||
@@ -98,6 +98,7 @@ emailAddress = optional
|
||||
|
||||
####################################################################
|
||||
[ req ]
|
||||
default_md = sha256
|
||||
default_bits = 2048
|
||||
default_keyfile = private/ca-key.pem
|
||||
distinguished_name = req_distinguished_name
|
||||
|
||||
@@ -72,12 +72,12 @@ release_lock();
|
||||
|
||||
my ($user,$pass);
|
||||
if ($username) {
|
||||
$user = "-U '$username'";
|
||||
$user = "-U $username";
|
||||
} else {
|
||||
$user = '';
|
||||
}
|
||||
if ($password) {
|
||||
$pass = "-P '$password'";
|
||||
$pass = "-P $password";
|
||||
} else {
|
||||
$pass = '';
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
|
||||
|
||||
#partition / --ondisk=/dev/mapper/ibmpkvm_vg_root-ibmpkvm_lv_root
|
||||
partition / --ondisk=/dev/sda
|
||||
network --bootproto dhcp
|
||||
network --device eth0 --bootproto dhcp
|
||||
|
||||
%post
|
||||
touch "/startpost"
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#
|
||||
|
||||
lang en_US
|
||||
#network --bootproto dhcp
|
||||
#KICKSTARTNET#
|
||||
network --bootproto dhcp
|
||||
|
||||
#
|
||||
# Where's the source?
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#!/bin/sh
|
||||
export MANAGEDADDRESSMODE="#XCATVAR:MANAGEDADDRESSMODE#"
|
||||
|
||||
cd /etc/sysconfig/network
|
||||
|
||||
if [ "$MANAGEDADDRESSMODE" != "static" ]
|
||||
then
|
||||
rm -f ifcfg-eth-id*
|
||||
rm -f ifcfg-myri*
|
||||
cat >ifcfg-eth0 <<EOF
|
||||
@@ -12,7 +8,7 @@ DEVICE=eth0
|
||||
BOOTPROTO=dhcp
|
||||
STARTMODE=onboot
|
||||
EOF
|
||||
fi
|
||||
|
||||
. /tmp/prinicsetting
|
||||
rm /tmp/prinicsetting
|
||||
if [ "$PRINIC" != "eth0" ]
|
||||
@@ -26,12 +22,7 @@ then
|
||||
# echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$MANAGEDADDRESSMODE" != "static" ]
|
||||
then
|
||||
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> ifcfg-$PRINIC
|
||||
fi
|
||||
|
||||
perl -pi -e 's/^FIREWALL="yes"/FIREWALL="no"/' /etc/sysconfig/network/config
|
||||
/etc/init.d/network restart
|
||||
|
||||
|
||||
@@ -182,10 +182,9 @@ addsiteyum
|
||||
/xcatpost/mypostscript
|
||||
sed -i 's/^serial/#serial/' /boot/grub/grub.conf
|
||||
sed -i 's/^terminal/#terminal/' /boot/grub/grub.conf
|
||||
|
||||
#the following command should always be run to prevent infinite installation loops
|
||||
updateflag.awk $MASTER 3002
|
||||
|
||||
if [ -z "$NODESTATUS" ] || [ "$NODESTATUS" != "0" -a "$NODESTATUS" != "N" -a "$NODESTATUS" != "n" ]; then
|
||||
updateflag.awk $MASTER 3002
|
||||
fi
|
||||
cd /
|
||||
#rm -Rf /xcatpost
|
||||
#rm -f /xcatpost/mypostscript
|
||||
|
||||
@@ -184,7 +184,7 @@ if [ -z "$instdisk" ]; then
|
||||
"ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct
|
||||
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
||||
;;
|
||||
"mptsas"|"mpt2sas"|"mpt3sas") #*PROBABLY* not SAN, but SAS SAN is possible
|
||||
"mptsas"|"mpt2sas") #*PROBABLY* not SAN, but SAS SAN is possible
|
||||
if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
||||
;;
|
||||
*)
|
||||
@@ -219,10 +219,7 @@ if [ `uname -m` = "ppc64" ]; then
|
||||
echo 'part None --fstype "PPC PReP Boot" --ondisk '$instdisk' --size 8' >> /tmp/partitioning
|
||||
fi
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
echo 'bootloader --driveorder='$instdisk >> /tmp/partitioning
|
||||
echo 'part /boot/efi --size 50 --ondisk '$instdisk' --fstype vfat' >> /tmp/partitioning
|
||||
else
|
||||
echo 'bootloader' >> /tmp/partitioning
|
||||
fi
|
||||
|
||||
#TODO: ondisk detection, /dev/disk/by-id/edd-int13_dev80 for legacy maybe, and no idea about efi. at least maybe blacklist SAN if mptsas/mpt2sas/megaraid_sas seen...
|
||||
|
||||
@@ -159,7 +159,7 @@ if [ -z "$instdisk" ]; then
|
||||
"ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct
|
||||
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
||||
;;
|
||||
"mptsas"|"mpt2sas"|"mpt3sas") #*PROBABLY* not SAN, but SAS SAN is possible
|
||||
"mptsas"|"mpt2sas") #*PROBABLY* not SAN, but SAS SAN is possible
|
||||
if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -145,7 +145,7 @@ if [ -z "$instdisk" ]; then
|
||||
"ata_piix4"|"PMC MaxRAID"|"ahci"|"megaraid_sas") #certainly direct
|
||||
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
||||
;;
|
||||
"mptsas"|"mpt2sas"|"mpt3sas") #*PROBABLY* not SAN, but SAS SAN is possible
|
||||
"mptsas"|"mpt2sas") #*PROBABLY* not SAN, but SAS SAN is possible
|
||||
if [ -z "$probablyfirstdirectdisk" ]; then probablyfirstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
#!/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
|
||||
|
||||
@@ -63,7 +63,25 @@
|
||||
<surname/>
|
||||
</user>
|
||||
</users>
|
||||
#YAST2NET#
|
||||
<networking>
|
||||
<dns>
|
||||
<dhcp_hostname config:type="boolean">true</dhcp_hostname>
|
||||
<dhcp_resolv config:type="boolean">true</dhcp_resolv>
|
||||
<domain>local</domain>
|
||||
<hostname>linux</hostname>
|
||||
</dns>
|
||||
<interfaces config:type="list">
|
||||
<interface>
|
||||
<bootproto>dhcp</bootproto>
|
||||
<device>eth0</device>
|
||||
<startmode>onboot</startmode>
|
||||
</interface>
|
||||
</interfaces>
|
||||
<routing>
|
||||
<ip_forward config:type="boolean">false</ip_forward>
|
||||
<routes config:type="list"/>
|
||||
</routing>
|
||||
</networking>
|
||||
<scripts>
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.sles#
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/chroot.sles#
|
||||
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# stateless
|
||||
#
|
||||
# chkconfig: 345 11 99
|
||||
# description: action stateless
|
||||
#
|
||||
# Source the library functions
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
|
||||
ZONE="US/Mountain"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting stateless configuration: "
|
||||
|
||||
if [ -r /etc/stateless_done ]
|
||||
then
|
||||
echo_failure
|
||||
echo
|
||||
echo " already run!"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
#initrd=xcat/netboot/fedora8/x86_64/compute/initrd.gz imgurl=nfs://rro000/install/netboot/fedora8/x86_64/compute/rootimg console=ttyS1,19200n8r BOOT_IMAGE=xcat/netboot/fedora8/x86_64/compute/kernel
|
||||
cat /proc/cmdline | grep imgurl >/dev/null 2>&1
|
||||
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
echo_failure
|
||||
echo
|
||||
echo " imgurl missing from /proc/cmdline, i.e. stateful!"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
for i in $(cat /proc/cmdline)
|
||||
do
|
||||
KEY=$(echo $i | awk -F= '{print $1}')
|
||||
VALUE=$(echo $i | awk -F= '{print $2}')
|
||||
|
||||
if [ "$KEY" = "imgurl" ]
|
||||
then
|
||||
SERVER=$(echo $VALUE | awk -F/ '{print $3}')
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$SERVER" ]
|
||||
then
|
||||
echo_failure
|
||||
echo
|
||||
echo "bogus server in imgurl"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo
|
||||
echo " Universal Server: $SERVER"
|
||||
|
||||
echo -n " Syslog: "
|
||||
echo "*.* @$SERVER" >/etc/rsyslog.conf
|
||||
echo_success
|
||||
echo
|
||||
|
||||
if [ -r /etc/rc.d/init.d/ntpd ]
|
||||
then
|
||||
echo -n " NTP: "
|
||||
if [ ! -r /etc/sysconfig/clock ]
|
||||
then
|
||||
echo "ZONE=\"$ZONE\"
|
||||
UTC=true
|
||||
ARC=false" >/etc/sysconfig/clock
|
||||
fi
|
||||
|
||||
echo "server $SERVER
|
||||
driftfile /etc/ntp/drift
|
||||
multicastclient
|
||||
broadcastdelay 0.008
|
||||
disable auth
|
||||
keys /etc/ntp/keys
|
||||
trustedkey 65535
|
||||
requestkey 65535
|
||||
controlkey 65535" >/etc/ntp.conf
|
||||
|
||||
echo "$SERVER" >/etc/ntp/step-tickers
|
||||
|
||||
echo_success
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ -r /etc/ldap.conf -a -r /etc/resolv.conf ]
|
||||
then
|
||||
echo -n " LDAP: "
|
||||
|
||||
DC=$(
|
||||
cat /etc/resolv.conf | \
|
||||
egrep '(domain|search)' | \
|
||||
head -1 | \
|
||||
awk '{print $2}' | \
|
||||
sed 's/\./,dc=/g' | \
|
||||
sed 's/^/dc=/'
|
||||
)
|
||||
|
||||
echo "host $SERVER
|
||||
base $DC
|
||||
nss_base_passwd ou=People,$DC
|
||||
nss_base_shadow ou=People,$DC
|
||||
nss_base_group ou=Group,$DC
|
||||
timelimit 120
|
||||
bind_timelimit 120
|
||||
idle_timelimit 3600
|
||||
nss_initgroups_ignoreusers root,ldap,named,avahi,haldaemon,dbus,radvd,tomcat,radiusd,news,mailman,nscd
|
||||
ssl no
|
||||
tls_cacertdir /etc/openldap/cacerts
|
||||
pam_password md5" >/etc/ldap.conf
|
||||
|
||||
echo "URI ldap://$SERVER
|
||||
BASE $DC
|
||||
TLS_CACERTDIR /etc/openldap/cacerts" >/etc/openldap/ldap.conf
|
||||
|
||||
cd /etc
|
||||
cp nsswitch.conf nsswitch.conf.ORIG
|
||||
sed -r 's/^((passwd|shadow|group):.*)/\1 ldap/' <nsswitch.conf.ORIG >nsswitch.conf
|
||||
|
||||
cd /etc/pam.d
|
||||
cp system-auth system-auth.ORIG
|
||||
sed -r 's/(account\s+required\s+pam_unix.so)/account sufficient pam_ldap.so\n\1/' <system-auth.ORIG >system-auth
|
||||
|
||||
echo_success
|
||||
echo
|
||||
fi
|
||||
touch /etc/stateless_done
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: stateless {start|stop}"
|
||||
exit 1
|
||||
esac
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
################################################################################
|
||||
# Create a generic HPC image
|
||||
# This script is an example of how to create an HPC image with xCAT stateless.
|
||||
# in this example you may need to change some of the parameters. In the future
|
||||
# we should probably place this in the database...
|
||||
# All good sys admins can reproduce their environments. Creating a stateless
|
||||
# image should be reproducable. Doing this with a script is a good idea.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
|
||||
# specify the OS stuff. You'll probably want to change this. If you do then you'll
|
||||
# need to make sure there is a *.pkglist and *.exlist
|
||||
PROFILE=compute
|
||||
ARCH=x86_64
|
||||
OS=centos5.3
|
||||
|
||||
# this is where the OS image will reside
|
||||
IMGROOT=/install/netboot/$OS/$ARCH/$PROFILE/rootimg
|
||||
|
||||
# remove the old image if it exists.
|
||||
rm -rf /install/netboot/$OS/$ARCH/$PROFILE
|
||||
|
||||
# generate the base image
|
||||
# for IBM: tg3 in older blades, bnx in newer stuff, and igb in the nehalem based products.
|
||||
/opt/xcat/share/xcat/netboot/centos/genimage -i eth0 -n libphy,tg3,bnx2,igb -o $OS -p $PROFILE
|
||||
|
||||
# update the yum database in the image
|
||||
rm -rf $IMGROOT/etc/yum.repos.d
|
||||
yum --installroot=$IMGROOT clean all
|
||||
cp -a /etc/yum.repos.d/ $IMGROOT/etc/
|
||||
rm -rf $IMGROOT/etc/yum.repos.d/xCAT-*
|
||||
|
||||
# no selinux!!
|
||||
echo SELINUX=disabled > $IMGROOT/etc/sysconfig/selinux
|
||||
|
||||
# fix respawns
|
||||
cp $IMGROOT/etc/inittab $IMGROOT/etc/inittab.ORIG
|
||||
grep -v 38400 $IMGROOT/etc/inittab.ORIG > $IMGROOT/etc/inittab
|
||||
|
||||
# filesystem setup, you'll want to customize this. We have swap and scratch
|
||||
# configured here. But if you don't have disks then this may not help.
|
||||
# we name our / partition the image name (compute by default) plus a timestamp.
|
||||
|
||||
TIME=`date +%s`
|
||||
cp $IMGROOT/etc/fstab $IMGROOT/etc/fstab.ORIG
|
||||
echo "proc /proc proc rw 0 0
|
||||
sysfs /sys sysfs rw 0 0
|
||||
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
|
||||
$PROFILE-$TIME / tmpfs rw 0 1
|
||||
#/dev/sda1 swap swap defaults 0 0
|
||||
#/dev/sda2 /scratch ext3 defaults 0 0
|
||||
" > $IMGROOT/etc/fstab
|
||||
mkdir $IMGROOT/scratch
|
||||
|
||||
### get ntp to start on boot
|
||||
chroot $IMGROOT chkconfig --level 345 ntpd on
|
||||
|
||||
#### user stuff so that we can do some work ####
|
||||
cp /etc/shadow $IMGROOT/etc/
|
||||
cp /etc/group $IMGROOT/etc/
|
||||
cp /etc/passwd $IMGROOT/etc/
|
||||
cp /etc/hosts $IMGROOT/etc/
|
||||
|
||||
### scaling fixes #####
|
||||
echo "# increase TCP max buffer size
|
||||
net.core.rmem_max = 33554432
|
||||
net.core.wmem_max = 33554432
|
||||
net.core.rmem_default = 65536
|
||||
net.core.wmem_default = 65536
|
||||
# increase Linux autotuning TCP buffer limits
|
||||
# min, default, and max number of bytes to use
|
||||
net.ipv4.tcp_rmem = 4096 33554432 33554432
|
||||
net.ipv4.tcp_wmem = 4096 33554432 33554432
|
||||
net.ipv4.tcp_mem= 33554432 33554432 33554432
|
||||
net.ipv4.route.flush=1
|
||||
net.core.netdev_max_backlog=1500
|
||||
|
||||
#GPFS / NFS Tuning
|
||||
net.ipv4.conf.all.arp_filter = 1
|
||||
net.ipv4.conf.all.rp_filter = 1
|
||||
net.ipv4.neigh.default.gc_thresh1 = 1024
|
||||
net.ipv4.neigh.default.gc_thresh2 = 4096
|
||||
net.ipv4.neigh.default.gc_thresh3 = 8192
|
||||
net.ipv4.neigh.default.gc_stale_time = 24" >> $IMGROOT/etc/sysctl.conf
|
||||
|
||||
## Limits: need to make sure users can have unlimited memory (ulimit -l unlimited)
|
||||
cp /etc/security/limits.conf $IMGROOT/etc/security/
|
||||
|
||||
### add torque ###
|
||||
/opt/xcat/share/xcat/netboot/add-on/torque/add_torque $IMGROOT mgt /opt/torque / local
|
||||
|
||||
# update the limit on pegged memory limit and if they have old xCAT then make sure
|
||||
# it says torque instead of pbs in the paths of the config file.
|
||||
perl -pi -e 's/ulimit -n 20000/ulimit -n 20000; ulimit -l unlimited/g' $IMGROOT/etc/init.d/pbs_mom
|
||||
perl -pi -e 's/spool\/pbs/spool\/torque/g' $IMGROOT/etc/init.d/pbs_mom
|
||||
perl -pi -e 's/spool\/pbs/spool\/torque/g' $IMGROOT/etc/init.d/pbs_mom
|
||||
perl -pi -e 's/PBS_HOME=\/var\/spool\/pbs/PBS_HOME=\/var\/spool\/torque/g' $IMGROOT/var/spool/torque/mom_priv/epilogue
|
||||
perl -pi -e 's/PBS_HOME=\/var\/spool\/pbs/PBS_HOME=\/var\/spool\/torque/g' $IMGROOT/var/spool/torque/mom_priv/prologue
|
||||
perl -pi -e 's/PBS_HOME=\/var\/spool\/pbs/PBS_HOME=\/var\/spool\/torque/g' $IMGROOT/var/spool/torque/mom_priv/takedownnode
|
||||
|
||||
### stateless init script does NTP, syslog, etc. ####
|
||||
cp /etc/localtime $IMGROOT/etc/
|
||||
cp /opt/xcat/share/xcat/netboot/add-on/stateless/stateless $IMGROOT/etc/init.d/
|
||||
perl -pi -e 's!Mountain!Mexico/General!g' $IMGROOT/etc/init.d/stateless
|
||||
perl -pi -e 's/driftfile \/etc\/ntp/driftfile \/var\/lib\/ntp/g' $IMGROOT/etc/init.d/stateless
|
||||
perl -pi -e 's/keys \/etc\/ntp/keys \/var\/lib\/ntp/g' $IMGROOT/etc/init.d/stateless
|
||||
rm -rf $IMGROOT/etc/sysconfig/clock
|
||||
chroot $IMGROOT chkconfig --level 345 stateless on
|
||||
chroot $IMGROOT chkconfig --level 345 rsyslog on
|
||||
|
||||
### make sure dhcp boot protocol is set to none ###
|
||||
perl -pi -e 's/dhcp/none/g' $IMGROOT/etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
|
||||
#### add GPFS stuff ###
|
||||
# this is an example of a stateless GPFS implementation. Uncomment the below if you
|
||||
# want GPFS. Make sure you have the GPFS RPMs to do this.
|
||||
#GPFSSRCDIR=/install/GPFS
|
||||
#yum --installroot=$IMGROOT -y install glibc ksh compat-libstdc++-33 binutils rsh
|
||||
#rpm -ivh --root=$IMGROOT $GPFSSRCDIR/gpfs.base*rpm
|
||||
#rpm -ivh --root=$IMGROOT $GPFSSRCDIR/gpfs.gpl*rpm
|
||||
#rpm -ivh --root=$IMGROOT $GPFSSRCDIR/gpfs.msg*rpm
|
||||
#rpm -Uivh --root=$IMGROOT $GPFSSRCDIR/updates/gpfs.base*rpm
|
||||
#rpm -Uivh --root=$IMGROOT $GPFSSRCDIR/updates/gpfs.gpl*rpm
|
||||
#rpm -Uivh --root=$IMGROOT $GPFSSRCDIR/updates/gpfs.msg*rpm
|
||||
##
|
||||
#AUTOGPFSDIR=/opt/xcat/share/xcat/netboot/add-on/autogpfs
|
||||
#cp $AUTOGPFSDIR/autogpfsc.pl $IMGROOT/usr/sbin
|
||||
#cp $AUTOGPFSDIR/autogpfsc $IMGROOT/etc/init.d/
|
||||
#echo "SERVERS=mgt
|
||||
#PORT=3003
|
||||
#BLOCK=no" >> $IMGROOT/etc/sysconfig/autogpfsc
|
||||
#
|
||||
#chroot $IMGROOT chkconfig --level 345 autogpfsc on
|
||||
#cp $GPFSSRCDIR/2.6.18-128.el5/* $IMGROOT/usr/lpp/mmfs/bin/
|
||||
#cp /etc/profile.d/gpfs.sh $IMGROOT/etc/profile.d/
|
||||
### End GPFS Stuff ####
|
||||
|
||||
|
||||
### IB Stuff ####
|
||||
# if you have InfiniBand on your machines then you probably have an OFED distribution you
|
||||
# need to add. Here is an example of how to add it.
|
||||
#echo "Adding InfiniBand"
|
||||
#yum --installroot=$IMGROOT -y install bind-utils which rpm tcl tk glibc-devel.i386 pciutils expat libgfortran.x86_64 libgomp.x86_64 tcsh
|
||||
#
|
||||
#IBROOT=/install/voltaire/VoltaireOFED-1.4.2_2-k2.6.18-128.el5-x86_64
|
||||
#mount -o bind /proc $IMGROOT/proc
|
||||
#mount -o bind /sys $IMGROOT/sys
|
||||
#mount -o bind $IBROOT $IMGROOT/mnt
|
||||
#chroot $IMGROOT /mnt/install.sh --without-mpi
|
||||
#umount $IMGROOT/mnt
|
||||
#umount $IMGROOT/sys
|
||||
#umount $IMGROOT/proc
|
||||
# configure IB IP address
|
||||
#echo "IP=\`host \$HOSTNAME-ib0 | awk '{ print \$4 }' | head -1\`" >> $IMGROOT/etc/rc.d/rc.local
|
||||
#echo "ifconfig ib0 \$IP" >> $IMGROOT/etc/rc.d/rc.local
|
||||
#echo "ifconfig ib0 netmask 255.255.0.0" >> $IMGROOT/etc/rc.d/rc.local
|
||||
### End IB Stuff ####
|
||||
|
||||
# configure name resolution
|
||||
# change this to what you want it to be. (this is in site.tab as the domain and nameservers)
|
||||
echo "search cluster.foo
|
||||
nameserver 172.20.0.1" >$IMGROOT/etc/resolv.conf
|
||||
|
||||
|
||||
### uniq-i-fy Torque OS name
|
||||
echo "opsys compute_centos5.3" >> $IMGROOT/var/spool/torque/mom_priv/config
|
||||
|
||||
packimage -p $PROFILE -a $ARCH -o $OS
|
||||
echo "Image $PROFILE-$TIME created"
|
||||
@@ -177,7 +177,7 @@ if ($netdriver) {
|
||||
|
||||
# Add the default driver list
|
||||
if ($arch eq 'x86' or $arch eq 'x86_64') {
|
||||
push @ndrivers, qw/tg3 bnx2 bnx2x e1000 e1000e virtio_net virtio_balloon igb mlx_en be2net/;
|
||||
push @ndrivers, qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en be2net/;
|
||||
} elsif ($arch eq 'ppc64') {
|
||||
push @ndrivers, qw/tg3 e1000 e1000e igb ibmveth ehea be2net/;
|
||||
} elsif ($arch eq "s390x") {
|
||||
|
||||
@@ -46,7 +46,7 @@ fi
|
||||
# remove user from index
|
||||
index=`grep $CNA /etc/xcat/ca/index | cut -f4 2>&1`
|
||||
for id in $index; do
|
||||
openssl ca -startdate 19600101010101Z -config /etc/xcat/ca/openssl.cnf -revoke /etc/xcat/ca/certs/$id.pem
|
||||
openssl ca -config /etc/xcat/ca/openssl.cnf -revoke /etc/xcat/ca/certs/$id.pem
|
||||
done
|
||||
mkdir -p $USERHOME/.xcat
|
||||
cd $USERHOME/.xcat
|
||||
@@ -60,7 +60,7 @@ cd $XCATDIR/ca
|
||||
# - seems to be a problem with the use of the wildcard in the Makefile
|
||||
# - calling cmds directly instead - should be safe
|
||||
# make sign
|
||||
openssl ca -startdate 600101010101Z -config openssl.cnf -in root.csr -out root.cert
|
||||
openssl ca -config openssl.cnf -in root.csr -out root.cert
|
||||
if [ -f root.cert ]; then
|
||||
rm root.csr
|
||||
fi
|
||||
|
||||
@@ -33,7 +33,7 @@ cd $XCATDIR/ca
|
||||
# - call cmds directly instead - seems safe
|
||||
# make sign
|
||||
|
||||
openssl ca -startdate 600101010101Z -config openssl.cnf -in `hostname`.csr -out `hostname`.cert -extensions server
|
||||
openssl ca -config openssl.cnf -in `hostname`.csr -out `hostname`.cert -extensions server
|
||||
if [ -f `hostname`.cert ]; then
|
||||
rm `hostname`.csr
|
||||
fi
|
||||
|
||||
@@ -30,9 +30,5 @@ sed -e "s@##XCATCADIR##@$XCATCADIR@" $XCATROOT/share/xcat/ca/openssl.cnf.tmpl >
|
||||
cp $XCATROOT/share/xcat/ca/Makefile $XCATCADIR/
|
||||
cd $XCATCADIR
|
||||
make init
|
||||
#openssl req -nodes -config openssl.cnf -days 7300 -x509 -newkey rsa:2048 -out ca-cert.pem -extensions v3_ca -outform PEM -subj /CN="$CNA"
|
||||
openssl genrsa -out private/ca-key.pem 2048
|
||||
chmod 600 private/ca-key.pem
|
||||
openssl req -new -key private/ca-key.pem -config openssl.cnf -out ca-req.csr -subj /CN="$CNA" -outform PEM
|
||||
openssl ca -selfsign -keyfile private/ca-key.pem -in ca-req.csr -startdate 700101010101Z -days 7305 -extensions v3_ca -config openssl.cnf -out ca-cert.pem
|
||||
openssl req -nodes -config openssl.cnf -days 7300 -x509 -newkey rsa:2048 -out ca-cert.pem -extensions v3_ca -outform PEM -subj /CN="$CNA"
|
||||
cd -
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Regular → Executable
+7
-17
@@ -16,28 +16,18 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
|
||||
AutoReqProv: no
|
||||
%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
|
||||
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser grub2-xcat
|
||||
Obsoletes: atftp-xcat
|
||||
%endif
|
||||
|
||||
# The aix rpm cmd forces us to do this outside of ifos type stmts
|
||||
%if %notpcm
|
||||
%ifos linux
|
||||
%ifnarch s390x
|
||||
# PCM does not use or ship grub2-xcat
|
||||
Requires: grub2-xcat
|
||||
%endif
|
||||
%endif
|
||||
%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)
|
||||
|
||||
%if %fsm
|
||||
# nothing needed here
|
||||
@@ -167,7 +157,7 @@ rm $RPM_BUILD_ROOT/%{prefix}/sbin/stopstartxcatd
|
||||
#rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/blade.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hpblade.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hpilo.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ipmi.pm
|
||||
#rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ipmi.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/nodediscover.pm
|
||||
#rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/switch.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/xen.pm
|
||||
@@ -389,7 +379,7 @@ fi
|
||||
%post
|
||||
%ifos linux
|
||||
ln -sf $RPM_INSTALL_PREFIX0/sbin/xcatd /usr/sbin/xcatd
|
||||
|
||||
|
||||
if [ "$1" = "1" ]; then #Only if installing for the first time..
|
||||
if [ -x /usr/lib/lsb/install_initd ]; then
|
||||
/usr/lib/lsb/install_initd /etc/init.d/xcatd
|
||||
|
||||
@@ -4,64 +4,34 @@ package genrestapidoc;
|
||||
|
||||
my @apigroups = (
|
||||
{
|
||||
groupname => 'tokens',
|
||||
header => "Token Resources",
|
||||
desc => "The URI list which can be used to create tokens for account .",
|
||||
resources => ['tokens'],
|
||||
},
|
||||
{
|
||||
groupname => 'nodes',
|
||||
groupname => 'node',
|
||||
header => "Node Resources",
|
||||
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 => 'osimages',
|
||||
header => "Osimage resources",
|
||||
desc => "URI list which can be used to query, create osimage resources.",
|
||||
resources => ['osimage', 'osimage_allattr', 'osimage_attr', 'osimage_op']
|
||||
},
|
||||
{
|
||||
groupname => 'networks',
|
||||
header => "Network Resources",
|
||||
desc => "The URI list which can be used to create, query, change and manage network objects.",
|
||||
resources => ['allnetwork', 'network_allattr','network_attr']
|
||||
|
||||
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',]
|
||||
},
|
||||
{
|
||||
groupname => 'policy',
|
||||
header => "Policy Resources",
|
||||
desc => "The URI list which can be used to create, query, change and manage policy entries.",
|
||||
desc => "URI list which can be used to create, query, change and manage policy entries.",
|
||||
resources => ['policy', 'policy_allattr', 'policy_attr']
|
||||
},
|
||||
{
|
||||
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 => 'globalconf',
|
||||
header => "Global Configuration Resources",
|
||||
desc => "The URI list which can be used to create, query, change global configuration.",
|
||||
resources => ['all_site', 'site']
|
||||
desc => "URI list which can be used to create, query, change global configuration.",
|
||||
resources => ['all_site']
|
||||
},
|
||||
{
|
||||
groupname => 'services',
|
||||
header => "Service Resources",
|
||||
desc => "The URI list which can be used to manage the host, dns and dhcp services on xCAT MN.",
|
||||
resources => ['dns','dhcp','host', 'slpnodes', 'specific_slpnodes',]
|
||||
},
|
||||
{
|
||||
groupname => 'tables',
|
||||
groupname => 'table',
|
||||
header => "Table Resources",
|
||||
desc => "URI list which can be used to create, query, change table entries.",
|
||||
resources => ['table_nodes', 'table_nodes_attrs', 'table_all_rows', 'table_rows', 'table_rows_attrs']
|
||||
desc => "URI list which can be used to create, query, change global configuration.",
|
||||
resources => ['table_nodes', 'table_rows']
|
||||
},
|
||||
{
|
||||
# groupname => 'network',
|
||||
resources => ['network', 'network_allattr']
|
||||
},
|
||||
);
|
||||
|
||||
@@ -110,41 +80,31 @@ sub outtext {
|
||||
print " Returns: $parts[2]\n";
|
||||
}
|
||||
}
|
||||
my @example_array = ();
|
||||
if (defined($def->{example})) {
|
||||
push @example_array, $def->{example};
|
||||
} else {
|
||||
foreach (1..10) {
|
||||
if (defined($def->{'example'.$_})) {
|
||||
push @example_array, $def->{'example'.$_};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (@example_array) {
|
||||
foreach my $line (@example_array) {
|
||||
my @parts = split ('\|', $line);
|
||||
print " Example:\n";
|
||||
|
||||
if ($parts[1]) {
|
||||
print " $parts[1]\n";
|
||||
} else {
|
||||
push @errmsg, "Error format in:[".$def->{desc}."]\n";
|
||||
}
|
||||
|
||||
if ($parts[2] && $parts[3] && ($parts[4] || $opt ne "GET")) {
|
||||
my ($uri, $data);
|
||||
if ($parts[3] =~ /\s+/) {
|
||||
($uri, $data) = split(/ /, $parts[3]);
|
||||
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
|
||||
} else {
|
||||
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$parts[3]$postfix\'\n";
|
||||
}
|
||||
$parts[4] =~ s/\n/\n /g;
|
||||
print " $parts[4]\n";
|
||||
} else {
|
||||
push @errmsg, "Error format in:[".$def->{desc}."]\n";
|
||||
}
|
||||
if (defined ($def->{example})) {
|
||||
my @parts = split ('\|', $def->{example});
|
||||
print " Example:\n";
|
||||
|
||||
if ($parts[1]) {
|
||||
print " $parts[1]\n";
|
||||
} else {
|
||||
push @errmsg, "Error format in:[".$def->{desc}."]\n";
|
||||
}
|
||||
|
||||
if ($parts[2] && $parts[3] && $parts[4]) {
|
||||
my ($uri, $data);
|
||||
if ($parts[3] =~ /\s+/) {
|
||||
($uri, $data) = split(/ /, $parts[3]);
|
||||
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
|
||||
} else {
|
||||
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$parts[3]$postfix\'\n";
|
||||
}
|
||||
$parts[4] =~ s/\n/\n /g;
|
||||
print " $parts[4]\n";
|
||||
} else {
|
||||
push @errmsg, "Error format in:[".$def->{desc}."]\n";
|
||||
}
|
||||
|
||||
} else {
|
||||
push @errmsg, "Error format in:[".$def->{desc}."]\n";
|
||||
}
|
||||
@@ -198,42 +158,30 @@ sub outwiki {
|
||||
}
|
||||
}
|
||||
|
||||
my @example_array = ();
|
||||
if (defined($def->{example})) {
|
||||
push @example_array, $def->{example};
|
||||
} else {
|
||||
foreach (1..10) {
|
||||
if (defined($def->{'example'.$_})) {
|
||||
push @example_array, $def->{'example'.$_};
|
||||
}
|
||||
if (defined ($def->{example})) {
|
||||
my @parts = split ('\|', $def->{example});
|
||||
print "'''Example:'''\n\n";
|
||||
|
||||
if ($parts[1]) {
|
||||
print "$parts[1]\n";
|
||||
} else {
|
||||
push @errmsg, "Error format for:[".$def->{desc}."]\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (@example_array) {
|
||||
foreach my $line (@example_array) {
|
||||
my @parts = split ('\|', $line);
|
||||
print "'''Example:'''\n\n";
|
||||
|
||||
if ($parts[1]) {
|
||||
print "$parts[1]\n";
|
||||
} else {
|
||||
push @errmsg, "Error format for:[".$def->{desc}."]\n";
|
||||
}
|
||||
|
||||
if ($parts[2] && $parts[3] && ($parts[4] || $opt ne "GET")) {
|
||||
my ($uri, $data);
|
||||
if ($parts[3] =~ /\s+/) {
|
||||
($uri, $data) = split(/ /, $parts[3]);
|
||||
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
|
||||
} else {
|
||||
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$parts[3]$postfix\'\n";
|
||||
}
|
||||
$parts[4] =~ s/\n/\n /g;
|
||||
print " $parts[4]\n";
|
||||
if ($parts[2] && $parts[3] && $parts[4]) {
|
||||
my ($uri, $data);
|
||||
if ($parts[3] =~ /\s+/) {
|
||||
($uri, $data) = split(/ /, $parts[3]);
|
||||
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
|
||||
} else {
|
||||
push @errmsg, "Error format for:[".$def->{desc}."]\n";
|
||||
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$parts[3]$postfix\'\n";
|
||||
}
|
||||
$parts[4] =~ s/\n/\n /g;
|
||||
print " $parts[4]\n";
|
||||
} else {
|
||||
push @errmsg, "Error format for:[".$def->{desc}."]\n";
|
||||
}
|
||||
|
||||
} else {
|
||||
push @errmsg, "Error format for:[".$def->{desc}."]\n";
|
||||
}
|
||||
@@ -291,14 +239,9 @@ sub gendoc {
|
||||
} else {
|
||||
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{PUT}, "PUT", $URIdef->{$groupname}->{$res});
|
||||
}
|
||||
$headdone = 1;
|
||||
}
|
||||
if (defined ($URIdef->{$groupname}->{$res}->{POST})) {
|
||||
if ($headdone) {
|
||||
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST");
|
||||
} else {
|
||||
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST", $URIdef->{$groupname}->{$res});
|
||||
}
|
||||
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST");
|
||||
}
|
||||
if (defined ($URIdef->{$groupname}->{$res}->{DELETE})) {
|
||||
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{DELETE}, "DELETE");
|
||||
|
||||
+654
-1168
File diff suppressed because it is too large
Load Diff
@@ -1,197 +1,135 @@
|
||||
#! /bin/sh
|
||||
#!/bin/bash
|
||||
# IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
# Test driver for xcatws.cgi, pass 3 arguments to it: user, password, noderange
|
||||
# This test driver will create to dummy nodes, wstest1 and wstest2, so make sure those
|
||||
# names don't conflict with your nodes on this MN.
|
||||
# You also have to pass in a noderange of 2 real system x nodes that can be used
|
||||
# to test some of the r cmds, xdsh, xdcp, nodestat.
|
||||
|
||||
# Get all the parameters
|
||||
for i in $@
|
||||
do
|
||||
if [ "$paramname" = "USER" ]; then
|
||||
USER=$i
|
||||
paramname=
|
||||
fi
|
||||
if [ "$paramname" = "PW" ]; then
|
||||
PW=$i
|
||||
paramname=
|
||||
fi
|
||||
if [ "$paramname" = "HOST" ]; then
|
||||
HOST=$i
|
||||
paramname=
|
||||
fi
|
||||
|
||||
if [ $i = '-u' ]; then
|
||||
paramname=USER
|
||||
fi
|
||||
if [ $i = '-p' ]; then
|
||||
paramname=PW
|
||||
fi
|
||||
if [ $i = '-h' ]; then
|
||||
paramname=HOST
|
||||
fi
|
||||
if [ $i = '-c' ]; then
|
||||
cert=yes
|
||||
fi
|
||||
if [ $i = '-t' ]; then
|
||||
token=yes
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
# display the usage message
|
||||
function usage {
|
||||
echo "Usage:"
|
||||
echo " xcatws-test.sh -u <USER> -p <pw> [-t]"
|
||||
echo " xcatws-test.sh -u <USER> -p <pw> -h <FQDN - Full hostname of server> [-c] [-t]"
|
||||
echo " -u The username of xCAT user which is used to access xCAT resource"
|
||||
echo " -p The password of username"
|
||||
echo " <FQDN of xCAT MN> The fully qualified hostname of xCAT management node. It can be an IP if using -k."
|
||||
echo " -c Check the server identity. The server certificate authentication must be enabled."
|
||||
echo " -t Using token authentication method."
|
||||
}
|
||||
|
||||
if [ "$USER" = "" ] || [ "$PW" = "" ]; then
|
||||
echo "Error: Miss username or password"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$cert" = "yes" ] && [ "$HOST" = "" ]; then
|
||||
echo "Error: -c must be used with -h that user needs specify the FQDN of xCAT MN"
|
||||
usage
|
||||
exit 1
|
||||
user=$1
|
||||
pw=$2
|
||||
nr=$3
|
||||
if [ -z "$3" ]; then
|
||||
echo "Usage: chkrc <user> <pw> <noderange>"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$HOST" = "" ]; then
|
||||
HOST="127.0.0.1"
|
||||
fi
|
||||
|
||||
|
||||
format='format=json&pretty=1'
|
||||
ctype='-H Content-Type:application/json'
|
||||
|
||||
# Perform the REST API request
|
||||
function REST {
|
||||
METHOD=$1 # it should be GET/PUT/POST/DELETE
|
||||
SRC=$2 # The resource path like /nodes/node1
|
||||
DATA=$3 # The operation data for PUT/POST/DELETE
|
||||
if [ "$DATA" != "" ]; then
|
||||
datamsg="$ctype -d $DATA"
|
||||
fi
|
||||
if [ "$cert" = "yes" ]; then
|
||||
if [ "$token" = "yes" ]; then
|
||||
CMD="curl -X $METHOD --cacert /tmp/ca-cert.pem -H X-Auth-Token:$TOKENID $datamsg https://$HOST/xcatws$SRC?pretty=1"
|
||||
else
|
||||
CMD="curl -X $METHOD --cacert /tmp/ca-cert.pem $datamsg https://$HOST/xcatws$SRC?pretty=1&userName=$USER&password=$PW"
|
||||
fi
|
||||
else
|
||||
if [ "$token" = "yes" ]; then
|
||||
CMD="curl -X $METHOD -k -H X-Auth-Token:$TOKENID $datamsg https://$HOST/xcatws$SRC?pretty=1"
|
||||
else
|
||||
CMD="curl -X $METHOD -k $datamsg https://$HOST/xcatws$SRC?pretty=1&userName=$USER&password=$PW"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
echo "Run: [$RESTMSG]"
|
||||
echo " $CMD"
|
||||
echo "Output:"
|
||||
`$CMD 2>/dev/null >/tmp/xcatws-test.log`
|
||||
cat "/tmp/xcatws-test.log"
|
||||
echo ""
|
||||
|
||||
ERROR=`grep "errorcode" "/tmp/xcatws-test.log"`
|
||||
if [ "$ERROR" != "" ]; then
|
||||
echo "FAILED to continue. See the error message in 'error' section."
|
||||
echo ""
|
||||
exit 2
|
||||
fi
|
||||
function chkrc
|
||||
{
|
||||
rc=$?
|
||||
{ set +x; } 2>/dev/null
|
||||
if [[ $1 == "not" ]]; then
|
||||
if [[ $rc -eq 0 ]]; then
|
||||
echo "Test failed!"
|
||||
exit
|
||||
fi
|
||||
else
|
||||
if [[ $rc -gt 0 ]]; then
|
||||
echo "Test failed!"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
echo ''
|
||||
set -x
|
||||
}
|
||||
|
||||
function PUT {
|
||||
SRC=$1
|
||||
}
|
||||
# pcregrep -M 'abc.*(\n|.)*efg' test.txt
|
||||
|
||||
# echo debug message
|
||||
echo "***********************************************************"
|
||||
echo "** Username: $USER"
|
||||
echo "** Password: $PW"
|
||||
echo "** Hostname: $HOST"
|
||||
#todo: add a test case for every api call that is documented
|
||||
set -x
|
||||
# clean up from last time
|
||||
curl -# -X DELETE -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw" >/dev/null; echo ''
|
||||
|
||||
# create test nodes
|
||||
curl -# -X POST -k "https://127.0.0.1/xcatws/node/wstest1-wstest2?userName=$user&password=$pw&$format" $ctype --data '{"groups":"wstest","netboot":"xnba"}' \
|
||||
| grep -q '2 object definitions have been created'; chkrc
|
||||
|
||||
# list all nodes and make sure they are in the list
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&$format" \
|
||||
| pcregrep -qM '"wstest1",\n\s*"wstest2"'; chkrc
|
||||
|
||||
# list all node's group and netboot attributes
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&field=groups&field=netboot" \
|
||||
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
|
||||
|
||||
# list all attributes of all nodes
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&field=ALL" \
|
||||
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
|
||||
|
||||
# list the noderange and make sure they are in the list
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&$format" \
|
||||
| pcregrep -qM '"wstest1",\n\s*"wstest2"'; chkrc
|
||||
|
||||
# list all node's group and netboot attributes
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&field=groups&field=netboot" \
|
||||
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
|
||||
|
||||
# list all attributes of all nodes
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&field=ALL" \
|
||||
| grep -qE '"nodename":"wstest1".*"groups":"wstest"'; chkrc
|
||||
|
||||
# change some attributes
|
||||
curl -# -X PUT -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&$format" $ctype --data '{"room":"222","netboot":"pxe"}' \
|
||||
| grep -q '2 object definitions have been created or modified'; chkrc
|
||||
|
||||
# verify they got the new values
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&field=room&field=netboot" \
|
||||
| grep -qE '"nodename":"wstest1".*"room":"222"'; chkrc
|
||||
|
||||
# delete the nodes
|
||||
curl -# -X DELETE -k "https://127.0.0.1/xcatws/node/wstest?userName=$user&password=$pw&$format" \
|
||||
| grep -q '2 object definitions have been removed'; chkrc
|
||||
|
||||
# list all nodes and make sure they are not in the list
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node?userName=$user&password=$pw&$format" \
|
||||
| pcregrep -qM '"wstest1",\n\s*"wstest2"'; chkrc not
|
||||
|
||||
# list the power state of the noderange
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/power?userName=$user&password=$pw&$format" \
|
||||
| grep -q '"power":"on"'; chkrc
|
||||
|
||||
# list the nodestat state of the noderange
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/status?userName=$user&password=$pw&$format" \
|
||||
| grep -q '":"sshd"'; chkrc
|
||||
|
||||
# list the node inventory of the noderange
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/inventory?userName=$user&password=$pw&$format" \
|
||||
| grep -q '"Board manufacturer":"IBM"'; chkrc
|
||||
|
||||
# list the node vitals of the noderange
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/vitals?userName=$user&password=$pw&$format" \
|
||||
| grep -q '"Cooling Fault":"false"'; chkrc
|
||||
|
||||
# list the node energy settings of the noderange
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/node/$nr/energy?userName=$user&password=$pw&$format&field=cappingstatus&field=cappingmaxmin" \
|
||||
| grep -q '"cappingstatus":"off"'; chkrc
|
||||
|
||||
# run a cmd on the noderange
|
||||
curl -# -X POST -k "https://127.0.0.1/xcatws/node/$nr/dsh?userName=$user&password=$pw&$format" $ctype --data '{"command":"pwd"}' \
|
||||
| grep -q '"/root"'; chkrc
|
||||
|
||||
# copy a file to the noderange
|
||||
curl -# -X POST -k "https://127.0.0.1/xcatws/node/$nr/dcp?userName=$user&password=$pw&$format" $ctype --data '{"source":"/root/.bashrc","target":"/tmp/"}' \
|
||||
| grep -q '"errorcode":"0"'; chkrc
|
||||
|
||||
# test the table calls
|
||||
curl -# -X GET -k "https://127.0.0.1/xcatws/table/nodelist/wstest?userName=$user&password=$pw&$format"
|
||||
|
||||
|
||||
# get the CA of server certificate
|
||||
if [ "$cert" = "yes" ]; then
|
||||
rm -f /tmp/ca-cert.pem
|
||||
cd /tmp
|
||||
wget http://$HOST/install/postscripts/ca/ca-cert.pem 2>1 1>/dev/null
|
||||
echo "** Using CA /tmp/ca-cert.pem for server certificate checking"
|
||||
fi
|
||||
exit
|
||||
|
||||
# get a token
|
||||
if [ "$token" = "yes" ]; then
|
||||
TOKENID=$(curl -X POST -k "https://$HOST/xcatws/tokens?pretty=1" -H Content-Type:application/json --data "{\"userName\":\"$USER\",\"password\":\"$PW\"}" 2>/dev/null | grep '"id"' | awk -F: {'print $2'} | awk -F \" {'print $2'})
|
||||
echo "** Using Token: $TOKENID to authenticate"
|
||||
fi
|
||||
|
||||
echo "***********************************************************"
|
||||
echo ""
|
||||
#curl -X GET -k "https://127.0.0.1/xcatws/groups?userName=$user&password=$pw&$format"
|
||||
|
||||
# clean the env
|
||||
rmdef -t node restapinode[1-9] 1>/dev/null 2>1
|
||||
rmdef -t group restapi 1>/dev/null 2>1
|
||||
|
||||
# get all resources
|
||||
RESTMSG="Get all available resource"
|
||||
REST GET "/"
|
||||
|
||||
# test global conf
|
||||
RESTMSG="Get all global configuration resource"
|
||||
REST GET "/globalconf"
|
||||
|
||||
RESTMSG="Change the global configuration domain to cluster.com"
|
||||
REST PUT "/globalconf/attrs/domain" '{"domain":"cluster.com"}'
|
||||
|
||||
RESTMSG="Get the global configuration domain"
|
||||
REST GET "/globalconf/attrs/domain"
|
||||
|
||||
# test node create/change/list/delete
|
||||
RESTMSG="Create node restapinode1"
|
||||
REST POST "/nodes/restapinode1" '{"groups":"restapi","arch":"x86_64","mgt":"ipmi","netboot":"xnba"}'
|
||||
|
||||
RESTMSG="Display the node restapinode1"
|
||||
REST GET "/nodes/restapinode1"
|
||||
|
||||
RESTMSG="Change the attributes for node restapinode1"
|
||||
REST PUT "/nodes/restapinode1" '{"mgt":"fsp","netboot":"yaboot"}'
|
||||
|
||||
RESTMSG="Display the node restapinode1"
|
||||
REST GET "/nodes/restapinode1"
|
||||
|
||||
RESTMSG="Delete node restapinode1"
|
||||
REST DELETE "/nodes/restapinode1"
|
||||
|
||||
# test multiple nodes manipulation
|
||||
RESTMSG="Create node restapinode1 and restapinode2"
|
||||
REST POST "/nodes/restapinode1,restapinode2" '{"groups":"restapi","arch":"x86_64","mgt":"ipmi","netboot":"xnba"}'
|
||||
|
||||
RESTMSG="Display the node restapinode1 and restapinode2"
|
||||
REST GET "/nodes/restapinode1,restapinode2"
|
||||
|
||||
RESTMSG="Change the attributes for node restapinode1 and restapinode2"
|
||||
REST PUT "/nodes/restapinode1,restapinode2" '{"mgt":"hmc","netboot":"grub2"}'
|
||||
|
||||
RESTMSG="Display the node restapinode1 and restapinode2"
|
||||
REST GET "/nodes/restapinode1,restapinode2"
|
||||
|
||||
RESTMSG="Display all the nodes in the cluster"
|
||||
REST GET "/nodes"
|
||||
|
||||
# test group
|
||||
RESTMSG="Display the group restapi"
|
||||
REST GET "/groups/restapi"
|
||||
|
||||
RESTMSG="Change attributes for group restapi"
|
||||
REST PUT "/groups/restapi" '{"os":"rh7"}'
|
||||
|
||||
RESTMSG="Display the group restapi"
|
||||
REST GET "/groups/restapi"
|
||||
|
||||
RESTMSG="Display the nodes in group restapi"
|
||||
REST GET "/nodes/restapi"
|
||||
#curl -X GET -k "https://127.0.0.1/xcatws/images?userName=$user&password=$pw&$format"
|
||||
#curl -X GET -k "https://127.0.0.1/xcatws/images?userName=$user&password=$pw&$format&field=osvers"
|
||||
#curl -X GET -k "https://127.0.0.1/xcatws/images/bp-netboot?userName=$user&password=$pw&$format"
|
||||
#curl -X GET -k "https://127.0.0.1/xcatws/images/bp-netboot?userName=$user&password=$pw&$format&field=osvers"
|
||||
|
||||
#todo: remove when these test cases are in xcatws-test.pl
|
||||
#./xcatws-test.pl -u "https://127.0.0.1/xcatws/node/test001?userName=$user&password=$pw" -m GET
|
||||
#./xcatws-test.pl -u "https://127.0.0.1/xcatws/node/test001?userName=$user&password=$pw" -m PUT "nodepos.room=foo"
|
||||
|
||||
+1954
-2450
File diff suppressed because it is too large
Load Diff
@@ -25,7 +25,7 @@ cmd:copycds $$ISO
|
||||
check:rc==0
|
||||
cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
|
||||
check:rc==0
|
||||
cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
|
||||
cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__
|
||||
check:rc==0
|
||||
cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
|
||||
check:rc==0
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user