Compare commits
140 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 19a14d711d | |||
| 45d05d26f0 | |||
| 3bb52d4109 | |||
| 86d2a14472 | |||
| 9567b80174 | |||
| cd660ad538 | |||
| 7d38486a08 | |||
| ebe0f60795 | |||
| d4c6c267e8 | |||
| 8235d4ac43 | |||
| abdf84c60f | |||
| e4f555bd71 | |||
| 2f3e76593e | |||
| 64a9d71a53 | |||
| 63b0515072 | |||
| 0b639cb5c2 | |||
| 61ef293909 | |||
| a6590b61bc | |||
| 7d0067c948 | |||
| e4b2e44c1c | |||
| af7a55499c | |||
| a21b141bbd | |||
| 5c784e7b76 | |||
| d6cef63a03 | |||
| a8c7dca997 | |||
| 7d5f94dd29 | |||
| f7896eab97 | |||
| 0e8eb99410 | |||
| 6f8f7c3f52 | |||
| 7a27003c93 | |||
| f92c9e52c2 | |||
| 80785946c3 | |||
| f98eee4e27 | |||
| 2773b2cb0a | |||
| f9790ea536 | |||
| 25203ea1b5 | |||
| bd4d78da84 | |||
| ac3c7fe28c | |||
| ed88f05e47 | |||
| fc7822f93e | |||
| 46ea594db7 | |||
| 43e89b90a2 | |||
| 309bc5cc48 | |||
| 5311349afa | |||
| 4a2fc2bc31 | |||
| e98678711b | |||
| e0e6874bb5 | |||
| 8e3d1735a6 | |||
| a5362a40a0 | |||
| f8b6035f94 | |||
| 32b8f7363e | |||
| 9925cb7099 | |||
| 468d01294a | |||
| 380928afe2 | |||
| fbb5188133 | |||
| 796a855e9f | |||
| 318c8a95b5 | |||
| d366c51298 | |||
| ab402d90a0 | |||
| 44c9aea4e2 | |||
| 312aec61c5 | |||
| 6a11d0230f | |||
| eacf7bb705 | |||
| 66990705cf | |||
| e78a1a792a | |||
| a0348fa10b | |||
| 3593f5c5f6 | |||
| 0aa1bb69f8 | |||
| 24daaf4167 | |||
| e3e3950755 | |||
| 36bc7c7ef7 | |||
| eac2017ebe | |||
| ba6db26013 | |||
| be6c764c15 | |||
| afb39ee9f6 | |||
| 29af239759 | |||
| 1789b73dc7 | |||
| 7e88064d17 | |||
| 8745f3716a | |||
| 31f33bdc6e | |||
| 1800b644a4 | |||
| 83c7a6c518 | |||
| 136a29d4cc | |||
| 760f6bba6e | |||
| 4fd19c1cb3 | |||
| 2fc43ee369 | |||
| db9f372318 | |||
| 2579006170 | |||
| 2e08e93f6a | |||
| ef3f6264a1 | |||
| 4d822dc512 | |||
| 365e767cee | |||
| 6b85f59313 | |||
| d6ac310ac4 | |||
| 94790e7adb | |||
| db4608c4f4 | |||
| c8c259b87d | |||
| c52d9e4173 | |||
| d9f1cddbe2 | |||
| efc0943a60 | |||
| 08e280ab0d | |||
| e5f6a985ee | |||
| b09d4b62d0 | |||
| 3237dc7029 | |||
| 5ad03e3ea3 | |||
| 6ce7c4a5ed | |||
| 028c57b77f | |||
| e39dd3b483 | |||
| 50d9b30366 | |||
| d147b6fab4 | |||
| e55ac17bbf | |||
| 94feb79653 | |||
| d0d7d0fca7 | |||
| c07e084196 | |||
| f0e1f5fd21 | |||
| b1d7fe518d | |||
| aadf88afd8 | |||
| c0a425a610 | |||
| 64edcd07cd | |||
| db9d0474a1 | |||
| c88186c3b2 | |||
| 2679d81c3e | |||
| a72ebc81ed | |||
| cd82e2ed40 | |||
| 0124789e7c | |||
| d709219803 | |||
| 3c3612546a | |||
| 5baf467a50 | |||
| b1634bdf06 | |||
| 1a844bae71 | |||
| 253a919d38 | |||
| 3217183ffb | |||
| 46d9b6345c | |||
| 7ca468b29b | |||
| 0638e0cf77 | |||
| 80f583859f | |||
| a1e9904375 | |||
| 2732e1f90d | |||
| 7c624d9026 | |||
| 9aaae028f2 |
@@ -68,7 +68,6 @@ function makedeb {
|
||||
|
||||
# build all debian packages
|
||||
makedeb xCAT-client $PKG_LOCATION "$BUILD_STRING" $VERSION
|
||||
makedeb xCAT-nbroot $PKG_LOCATION "$BUILD_STRING" $VERSION
|
||||
makedeb perl-xCAT $PKG_LOCATION "$BUILD_STRING" $VERSION
|
||||
makedeb xCAT-server $PKG_LOCATION "$BUILD_STRING" $VERSION
|
||||
makedeb xCAT-UI $PKG_LOCATION "$BUILD_STRING" $VERSION
|
||||
|
||||
+74
-50
@@ -19,6 +19,7 @@
|
||||
# directories that are needed.
|
||||
|
||||
# Usage: buildcore.sh [attr=value attr=value ...]
|
||||
# Before running buildcore.sh, you must change the local git repo to the branch you want built, using: git checkout <branch>
|
||||
# PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release.
|
||||
# Otherwise, and snap build is assumed.
|
||||
# PREGA=1 - means this is a branch that has not been released yet, so during the promote, copy the
|
||||
@@ -26,6 +27,7 @@
|
||||
# BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in prep for a release.
|
||||
# UP=0 or UP=1 - override the default upload behavior
|
||||
# SVNUP=<filename> - control which rpms get built by specifying a coresvnup file
|
||||
# GITUP=<filename> - control which rpms get built by specifying a coregitup file
|
||||
# FRSYUM=0 - put the yum repo and snap builds in the old project web area instead of the FRS area.
|
||||
# EMBED=<embedded-environment> - the environment for which a minimal version of xcat should be built, e.g. zvm or flex
|
||||
# VERBOSE=1 - to see lots of verbose output
|
||||
@@ -68,6 +70,21 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
export HOME=/root # This is so rpm and gpg will know home, even in sudo
|
||||
fi
|
||||
|
||||
# for the git case, query the current branch and set REL (changing master to devel if necessary)
|
||||
function setbranch {
|
||||
#git checkout $BRANCH
|
||||
#REL=`git rev-parse --abbrev-ref HEAD`
|
||||
REL=`git name-rev --name-only HEAD`
|
||||
if [ "$REL" = "master" ]; then
|
||||
REL="devel"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$REL" = "xcat-core" ]; then # using git
|
||||
GIT=1
|
||||
setbranch # this changes the REL variable
|
||||
fi
|
||||
|
||||
# this is needed only when we are transitioning the yum over to frs
|
||||
if [ "$FRSYUM" != 0 ]; then
|
||||
YUMDIR=$FRS
|
||||
@@ -81,27 +98,12 @@ fi
|
||||
if [ -n "$EMBED" ]; then EMBEDDIR="/$EMBED"
|
||||
else EMBEDDIR=""; fi
|
||||
XCATCORE="xcat-core" # core-snap is a sym link to xcat-core
|
||||
echo "svn --quiet up Version"
|
||||
svn --quiet up Version
|
||||
VER=`cat Version`
|
||||
SHORTVER=`cat Version|cut -d. -f 1,2`
|
||||
SHORTSHORTVER=`cat Version|cut -d. -f 1`
|
||||
if [ "$PROMOTE" = 1 ]; then
|
||||
CORE="xcat-core"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-$VER.tar.gz
|
||||
else
|
||||
TARNAME=xcat-core-$VER.tar.bz2
|
||||
fi
|
||||
|
||||
if [ "$GIT" = "1" ]; then # using git - need to include REL in the path where we put the built rpms
|
||||
DESTDIR=../../$REL$EMBEDDIR/$XCATCORE
|
||||
else
|
||||
CORE="core-snap"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-snap.tar.gz
|
||||
else
|
||||
TARNAME=core-rpms-snap.tar.bz2
|
||||
fi
|
||||
DESTDIR=../..$EMBEDDIR/$XCATCORE
|
||||
fi
|
||||
DESTDIR=../..$EMBEDDIR/$XCATCORE
|
||||
SRCD=core-snap-srpms
|
||||
|
||||
# currently aix builds ppc rpms, but someday it should build noarch
|
||||
@@ -111,8 +113,21 @@ else
|
||||
NOARCH=noarch
|
||||
fi
|
||||
|
||||
function setversionvars {
|
||||
VER=`cat Version`
|
||||
SHORTVER=`cat Version|cut -d. -f 1,2`
|
||||
SHORTSHORTVER=`cat Version|cut -d. -f 1`
|
||||
}
|
||||
|
||||
|
||||
if [ "$PROMOTE" != 1 ]; then # very long if statement to not do builds if we are promoting
|
||||
# we are doing a snap build
|
||||
CORE="core-snap"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-snap.tar.gz
|
||||
else
|
||||
TARNAME=core-rpms-snap.tar.bz2
|
||||
fi
|
||||
mkdir -p $DESTDIR
|
||||
SRCDIR=$DESTDIR/../$SRCD
|
||||
mkdir -p $SRCDIR
|
||||
@@ -133,17 +148,33 @@ else
|
||||
#echo "source=$source"
|
||||
fi
|
||||
|
||||
# If they have not given us a premade update file, do an svn update and capture the results
|
||||
if [ -z "$SVNUP" ]; then
|
||||
SVNUP=../coresvnup
|
||||
echo "svn up > $SVNUP"
|
||||
svn up > $SVNUP
|
||||
fi
|
||||
# If they have not given us a premade update file, do an svn update or git pull and capture the results
|
||||
SOMETHINGCHANGED=0
|
||||
if ! $GREP 'At revision' $SVNUP; then
|
||||
SOMETHINGCHANGED=1
|
||||
if [ "$GIT" = "1" ]; then # using git
|
||||
if [ -z "$GITUP" ]; then
|
||||
GITUP=../coregitup
|
||||
echo "git pull > $GITUP"
|
||||
git pull > $GITUP
|
||||
fi
|
||||
if ! $GREP 'Already up-to-date' $GITUP; then
|
||||
SOMETHINGCHANGED=1
|
||||
fi
|
||||
else # using svn
|
||||
GIT=0
|
||||
if [ -z "$SVNUP" ]; then
|
||||
SVNUP=../coresvnup
|
||||
echo "svn up > $SVNUP"
|
||||
svn up > $SVNUP
|
||||
fi
|
||||
if ! $GREP 'At revision' $SVNUP; then
|
||||
SOMETHINGCHANGED=1
|
||||
fi
|
||||
# copy the SVNUP variable to GITUP so the rest of the script doesnt have to worry whether we did svn or git
|
||||
GITUP=$SVNUP
|
||||
fi
|
||||
|
||||
setversionvars
|
||||
|
||||
# Process for making most of the rpms
|
||||
function maker {
|
||||
rpmname="$1"
|
||||
@@ -159,7 +190,7 @@ function maker {
|
||||
}
|
||||
|
||||
# If anything has changed, we should always rebuild perl-xCAT
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # Use to be: $GREP perl-xCAT $SVNUP; then
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # Use to be: $GREP perl-xCAT $GITUP; then
|
||||
UPLOAD=1
|
||||
maker perl-xCAT
|
||||
fi
|
||||
@@ -170,7 +201,7 @@ fi
|
||||
|
||||
# Build the rest of the noarch rpms
|
||||
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test; do
|
||||
if $GREP $rpmname $SVNUP || [ "$BUILDALL" == 1 ]; then
|
||||
if $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then
|
||||
UPLOAD=1
|
||||
if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi # for embedded envs only need to build server special
|
||||
maker $rpmname
|
||||
@@ -182,27 +213,10 @@ for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test; d
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$OSNAME" != "AIX" -a "$EMBED" != "zvm" ]; then
|
||||
if grep -v nbroot2 $SVNUP|$GREP xCAT-nbroot || [ "$BUILDALL" == 1 ]; then
|
||||
UPLOAD=1
|
||||
ORIGFAILEDRPMS="$FAILEDRPMS"
|
||||
for arch in x86_64 x86 ppc64; do
|
||||
./makerpm xCAT-nbroot-core $arch
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-nbroot-core-$arch"; fi
|
||||
done
|
||||
if [ "$FAILEDRPMS" = "$ORIGFAILEDRPMS" ]; then # all succeeded
|
||||
rm -f $DESTDIR/xCAT-nbroot-core*rpm
|
||||
rm -f $SRCDIR/xCAT-nbroot-core*rpm
|
||||
mv $source/RPMS/noarch/xCAT-nbroot-core-*rpm $DESTDIR
|
||||
mv $source/SRPMS/xCAT-nbroot-core-*rpm $SRCDIR
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Build the xCAT and xCATsn rpms for all platforms
|
||||
for rpmname in xCAT xCATsn; do
|
||||
if [ "$EMBED" = "zvm" ]; then break; fi
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $SVNUP; then
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $GITUP; then
|
||||
UPLOAD=1
|
||||
ORIGFAILEDRPMS="$FAILEDRPMS"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
@@ -276,8 +290,8 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
echo "Signing RPMs..."
|
||||
build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
createrepo $DESTDIR
|
||||
createrepo $SRCDIR
|
||||
createrepo --checksum sha $DESTDIR # specifying checksum so the repo will work on rhel5
|
||||
createrepo --checksum sha $SRCDIR
|
||||
rm -f $SRCDIR/repodata/repomd.xml.asc
|
||||
rm -f $DESTDIR/repodata/repomd.xml.asc
|
||||
gpg -a --detach-sign $DESTDIR/repodata/repomd.xml
|
||||
@@ -306,7 +320,17 @@ chmod -R g+w $DESTDIR
|
||||
chgrp -R xcat $SRCDIR
|
||||
chmod -R g+w $SRCDIR
|
||||
|
||||
fi # end of very long if-not-promote
|
||||
else # end of very long if-not-promote
|
||||
# we are only promoting (not building)
|
||||
setversionvars
|
||||
setbranch
|
||||
CORE="xcat-core"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-$VER.tar.gz
|
||||
else
|
||||
TARNAME=xcat-core-$VER.tar.bz2
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $DESTDIR
|
||||
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
<packagereq type="required">xCAT-server</packagereq>
|
||||
<packagereq type="required">xCAT-client</packagereq>
|
||||
<packagereq type="required">perl-xCAT</packagereq>
|
||||
<packagereq type="required">xCAT-nbroot-core-x86_64</packagereq>
|
||||
<packagereq type="required">xCAT-nbroot-core-x86</packagereq>
|
||||
<packagereq type="optional">xCAT-nbroot-core-ppc64</packagereq>
|
||||
</packagelist>
|
||||
</group>
|
||||
</comps>
|
||||
|
||||
+5
-18
@@ -1,34 +1,21 @@
|
||||
#!/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 and svn revision number as arguments" >&2
|
||||
echo "modifyUtils: Error: must specify the xCAT version as an argument" >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
VER=$1
|
||||
SVNREF="svn r$2, "
|
||||
|
||||
#SVNINFO=`svn info 2>/dev/null|grep Revision`
|
||||
#/bin/echo -e $SVNINFO
|
||||
#if [ $? -ne 0 -a -f .svninfo ]; then
|
||||
# SVNINFO=`cat .svninfo 2>/dev/null|grep Revision`
|
||||
#fi
|
||||
#if [ $? -eq 0 ]
|
||||
# then
|
||||
# SVNREF="svn r"`echo $SVNINFO|awk '{print $2}'`", "
|
||||
# else
|
||||
# SVNREF=""
|
||||
# fi
|
||||
|
||||
BUILDDATE=`date`
|
||||
#echo ". '(${SVNREF}built $BUILDDATE)'"
|
||||
#echo ". '(built $BUILDDATE)'"
|
||||
|
||||
if [ "$(uname)" = "AIX" ]
|
||||
then
|
||||
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}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
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}built $BUILDDATE)'"/ xCAT/Version.pm
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ xCAT/Version.pm
|
||||
fi
|
||||
|
||||
@@ -24,7 +24,6 @@ Provides perl xCAT libraries for core functionality. Required for all xCAT inst
|
||||
Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
|
||||
%define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi)
|
||||
%define svninfo %(svn info | grep Revision | awk '{print $2}')
|
||||
|
||||
%prep
|
||||
%setup -q -n perl-xCAT
|
||||
@@ -34,7 +33,7 @@ Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
# as it is in svn.
|
||||
|
||||
# Modify the Version() function in xCAT/Utils.pm to automatically have the correct version
|
||||
./modifyUtils %{version} %{svninfo}
|
||||
./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.
|
||||
|
||||
@@ -408,10 +408,6 @@ sub plugin_command {
|
||||
$req->{emptynoderange} = [1];
|
||||
}
|
||||
|
||||
if(@nodes == 0 ) {
|
||||
print "No nodes or noderanges specified\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (@nodes) { $req->{node} = \@nodes; }
|
||||
my %unhandled_nodes;
|
||||
|
||||
Regular → Executable
+48
-4
@@ -199,7 +199,7 @@ sub getobjattrs
|
||||
# list of object names
|
||||
foreach my $table (keys %tableattrs) {
|
||||
# open the table
|
||||
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 0);
|
||||
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 1);
|
||||
if (!$thistable) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "Could not open the \'$table\' table.";
|
||||
@@ -395,6 +395,44 @@ sub getobjdefs
|
||||
xCAT::MsgUtils->message("E", $rsp, $::callback);
|
||||
}
|
||||
}
|
||||
} elsif (($objtype eq 'auditlog') || ($objtype eq 'eventlog')) {
|
||||
# Special case for auditlog/eventlog
|
||||
# All the auditlog/eventlog attributes are in auditlog/eventlog table,
|
||||
# Do not need to read the table multiple times for each attribute.
|
||||
# The auditlog/eventlog is likely be very big over time,
|
||||
# performance is a big concern with the general logic
|
||||
my @TableRowArray = xCAT::DBobjUtils->getDBtable($objtype);
|
||||
foreach my $objname (sort @{$type_obj{$objtype}}) {
|
||||
if (@TableRowArray)
|
||||
{
|
||||
my $foundinfo = 0;
|
||||
foreach my $entry (@TableRowArray)
|
||||
{
|
||||
if ($entry->{recid} eq $objname)
|
||||
{
|
||||
foreach my $k (keys %{$entry})
|
||||
{
|
||||
# recid is the object name, do not need to be in the attributes list
|
||||
if ($k eq 'recid') { next; }
|
||||
if (defined($entry->{$k}) ) {
|
||||
$foundinfo++;
|
||||
if ($verbose == 1) {
|
||||
$objhash{$objname}{$k} = "$entry->{$k}\t(Table:$objtype - Key:$k)";
|
||||
} else {
|
||||
$objhash{$objname}{$k} = $entry->{$k};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($foundinfo)
|
||||
{
|
||||
$objhash{$objname}{'objtype'} = $objtype;
|
||||
}
|
||||
# There should not be multiple entries with the same recid
|
||||
last;
|
||||
} # end if($entry->
|
||||
} # end foreach my $entry
|
||||
} # end if(@TableTowArray
|
||||
} # end foreach my $objname
|
||||
} else {
|
||||
# get the object type decription from Schema.pm
|
||||
my $datatype = $xCAT::Schema::defspec{$objtype};
|
||||
@@ -578,7 +616,7 @@ sub getDBtable
|
||||
{
|
||||
|
||||
# need to get info from DB
|
||||
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 0);
|
||||
my $thistable = xCAT::Table->new($table, -create => 1);
|
||||
if (!$thistable)
|
||||
{
|
||||
return undef;
|
||||
@@ -2115,7 +2153,7 @@ sub getchildren
|
||||
$::RUNCMD_RC = 1;
|
||||
return undef;
|
||||
}
|
||||
my @ps = $ppctab->getAllNodeAttribs(['node','parent','nodetype']);
|
||||
my @ps = $ppctab->getAllNodeAttribs(['node','parent','nodetype','hcp']);
|
||||
foreach my $entry ( @ps ) {
|
||||
my $p = $entry->{parent};
|
||||
my $c = $entry->{node};
|
||||
@@ -2126,13 +2164,19 @@ sub getchildren
|
||||
# build hash of ppc.parent -> ppc.node
|
||||
push @{$PPCHASH{$p}}, $c;
|
||||
}
|
||||
elsif ($t eq 'blade') {
|
||||
push @{$PPCHASH{$c}}, $entry->{hcp};
|
||||
}
|
||||
} else { # go look in the nodetype table to find nodetype
|
||||
my $type = getnodetype($c);
|
||||
my $type = getnodetype($c, "ppc");
|
||||
if ( $type eq 'fsp' or $type eq 'bpa')
|
||||
{
|
||||
# build hash of ppc.parent -> ppc.node
|
||||
push @{$PPCHASH{$p}}, $c;
|
||||
}
|
||||
elsif ($type eq "blade") {
|
||||
push @{$PPCHASH{$c}}, $entry->{hcp};
|
||||
}
|
||||
}
|
||||
} # not $p and $c
|
||||
}
|
||||
|
||||
@@ -709,8 +709,19 @@ sub pping_hostnames
|
||||
my ($class, @hostnames) = @_;
|
||||
|
||||
my $hostname_list = join ",", @hostnames;
|
||||
# read site table, usefping attribute
|
||||
# if set then run pping -f to use fping
|
||||
# this fixes a broken nmap in Redhat 6.2 with ip alias (3512)
|
||||
my $cmd="$::XCATROOT/bin/pping $hostname_list"; # default
|
||||
my @usefping=xCAT::Utils->get_site_attribute("usefping");
|
||||
if ((defined($usefping[0])) && ($usefping[0] eq "1")) {
|
||||
$cmd = "$::XCATROOT/bin/pping -f $hostname_list";
|
||||
}
|
||||
#my $rsp={};
|
||||
#$rsp->{data}->[0] = "running command $cmd";
|
||||
#xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
my @output =
|
||||
xCAT::Utils->runcmd("$::XCATROOT/bin/pping $hostname_list", -1);
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC !=0) {
|
||||
my $rsp={};
|
||||
$rsp->{data}->[0] = "Error from pping";
|
||||
|
||||
@@ -69,7 +69,7 @@ sub getHcpAttribs
|
||||
}
|
||||
}
|
||||
|
||||
my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype']);
|
||||
my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype', 'hcp']);
|
||||
for my $entry ( @ps ) {
|
||||
my $tmp_parent = $entry->{parent};
|
||||
my $tmp_node = $entry->{node};
|
||||
@@ -78,6 +78,9 @@ sub getHcpAttribs
|
||||
push @{$ppchash{$tmp_parent}{children}}, $tmp_node;
|
||||
#push @{$ppchash{$tmp_parent}}, $tmp_node;
|
||||
}
|
||||
if (defined($tmp_node) && defined($tmp_type) && ($tmp_type eq "blade") && defined($entry->{hcp})) {
|
||||
push @{$ppchash{$tmp_node}{children}}, $entry->{hcp};
|
||||
}
|
||||
|
||||
#if(exists($ppchash{$tmp_node})) {
|
||||
# if( defined($tmp_type) ) {
|
||||
@@ -175,6 +178,8 @@ sub getIPaddress
|
||||
#the $nodetocheck is its' hcp. So set $nodetocheck to $parent variable.
|
||||
#And then get the FSPs IPs for the CEC.
|
||||
$parent = $nodetocheck;
|
||||
} elsif ($type eq "blade") {
|
||||
return $ppc->{$nodetocheck}->{children}->[0];
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ sub rnetboot {
|
||||
my $options = $request->{opt};
|
||||
my $hwtype = @$exp[2];
|
||||
my $result;
|
||||
my $name;
|
||||
my $name = $request->{node};
|
||||
my $callback = $request->{callback};
|
||||
#####################################
|
||||
# Get node data
|
||||
@@ -238,6 +238,13 @@ sub rnetboot {
|
||||
C => $o->{client},
|
||||
m => $o->{mac}
|
||||
);
|
||||
#####################################
|
||||
# Parse node range
|
||||
#####################################
|
||||
if ($name =~ /ARRAY/) {
|
||||
$name = join(',', @$name);
|
||||
}
|
||||
|
||||
#####################################
|
||||
# Strip colons from mac address
|
||||
#####################################
|
||||
|
||||
@@ -236,7 +236,7 @@ sub powercmd {
|
||||
if($action =~ /^lowpower$/) { $action = "cec_on_low_power"; }
|
||||
#if($action =~ /^cycle$/) {$action = "cec_reboot";}
|
||||
if($action =~ /^cycle$/) {$action = "reset";}
|
||||
if($action !~ /^cec_on_autostart$/ && $action !~ /^cec_off$/ && $action !~ /^cec_on_low_power$/ && $action !~ /^onstandby$/ && $action !~ /^reboot_service_processor$/ && $action !~ /^reset$/) {
|
||||
if($action !~ /^cec_on_autostart$/ && $action !~ /^cec_off$/ && $action !~ /^cec_on_low_power$/ && $action !~ /^onstandby$/ && $action !~ /^reboot_service_processor$/ && $action !~ /^reset$/ && $action !~ /^sms$/) {
|
||||
push @output, [$node_name, "\'$action\' command not supported for $$d[4]", -1 ];
|
||||
return (\@output);
|
||||
}
|
||||
|
||||
@@ -116,6 +116,9 @@ sub enumerate_lcds {
|
||||
} else {
|
||||
my @array = split(/\n/, $data);
|
||||
foreach my $a (@array) {
|
||||
if ($a !~ /:\s?[^\s]*\s?[0|1]/) {
|
||||
next;
|
||||
}
|
||||
my @t = split(/:/, $a);
|
||||
my $name = $t[0];
|
||||
$data = $t[1];
|
||||
@@ -429,8 +432,10 @@ sub lcds {
|
||||
}
|
||||
}
|
||||
|
||||
if( $type =~ /lpar/ ) {
|
||||
if( $type eq "lpar" ) {
|
||||
$action = "query_lcds";
|
||||
} elsif ($type eq "blade") {
|
||||
$action = "pblade_query_lcds";
|
||||
} else {
|
||||
$action = "cec_query_lcds";
|
||||
}
|
||||
|
||||
+11
-2
@@ -202,8 +202,11 @@ sub chvm_parse_args {
|
||||
|
||||
|
||||
# pending memory interleaving mode (1- interleaved, 2- non-interleaved)
|
||||
# non-interleaved mode means the memory cannot be shared across the processors in an octant.
|
||||
# interleaved means the memory can be shared.
|
||||
# non-interleaved mode: Memory allocations are only interleaved across the two
|
||||
# memory controllers on a local chip in the octant
|
||||
# interleaved mode: Memory allocations are interleaved evenly across all eight
|
||||
# memory controllers in the octant
|
||||
# Note: A octant with partition value 2-5 can not be set with memory interleaving = 1.
|
||||
if( exists($opt{m}) ) {
|
||||
if( $opt{m} =~ /^interleaved$/ || $opt{m} =~ /^1$/ ) {
|
||||
$opt{m} = 1;
|
||||
@@ -238,6 +241,9 @@ sub chvm_parse_args {
|
||||
if( grep(/^$subelems[1]$/, @ratio ) != 1) {
|
||||
return(usage( "Invalid octant configuration value in $elem.\n For Power 775, octant configuration values only could be 1, 2, 3, 4, 5. Please see the details in manpage of chvm." ));
|
||||
}
|
||||
if( $opt{m} == 1 && $subelems[1] > 1 ) {
|
||||
return(usage("Need to specify \"-m 2\" when specifying an octant configuration value greater than 1. Error!"));
|
||||
}
|
||||
if( exists($octant_cfg{$subelems[0]}) && $octant_cfg{$subelems[0]} == $subelems[1] ) {
|
||||
return(usage("In the octant configuration rule, same octant with different octant configuration value. Error!"));
|
||||
}
|
||||
@@ -249,6 +255,9 @@ sub chvm_parse_args {
|
||||
if( $left < 0 || $left > 7 || $right < 0 || $right > 7) {
|
||||
return(usage("Octant ID only could be 0 to 7 in the octant configuration rule $elem"));
|
||||
}
|
||||
if( $opt{m} == 1 && $subelems[1] > 1 ) {
|
||||
return(usage("Need to specify \"-m 2\" when specifying an octant configuration value greater than 1. Error!"));
|
||||
}
|
||||
if($left == $right) {
|
||||
if( grep(/^$subelems[1]$/, @ratio ) != 1) {
|
||||
return(usage( "Invalid octant configuration value in $elem.\n For Power 775, octant configuration values only could be 1, 2, 3, 4, 5. Please see the details in manpage of chvm." ));
|
||||
|
||||
@@ -1134,6 +1134,10 @@ sub dolitesetup
|
||||
# $file could be full path file name or dir name
|
||||
# ex. /foo/bar/ or /etc/lppcfg
|
||||
my ($node, $option, $file) = split (/\|/, $line);
|
||||
|
||||
if (!$file) {
|
||||
next;
|
||||
}
|
||||
|
||||
# ex. .../inst_root/foo/bar/ or .../inst_root/etc/lppcfg
|
||||
my $instrootfile = $instrootloc . $file;
|
||||
|
||||
@@ -827,7 +827,7 @@ sub get_mac_addr {
|
||||
$done[0] = 0;
|
||||
$cmd[0] = "\" local-mac-address\" ". $phandle . " get-package-property\r";
|
||||
$msg[0] = "Status: return code and mac-address now on stack\n";
|
||||
$pattern[0] = "ok";#"\s*3 >";
|
||||
$pattern[0] = "local-mac-address.*ok";#"\s*3 >";
|
||||
$newstate[0] = 1;
|
||||
|
||||
# cmd(1) is a dot (.). This is a stack manipulation command that removes one
|
||||
@@ -1231,8 +1231,8 @@ sub ping_server{
|
||||
$done[2] = 0;
|
||||
$cmd[2] = "dev /packages/net\r";
|
||||
$msg[2] = "Status: selected the /packages/net node as the active package\n";
|
||||
#$pattern[2] = ".*dev(.*)ok(.*)0 >(.*)";
|
||||
$pattern[2] = "ok";
|
||||
$pattern[2] = ".*dev.*packages.*net(.*)ok(.*)0 >(.*)";
|
||||
#$pattern[2] = "ok";
|
||||
$newstate[2]= 3;
|
||||
|
||||
# state 3, ping the server
|
||||
@@ -1266,6 +1266,7 @@ sub ping_server{
|
||||
# state 5, all done
|
||||
$done[5] = 1;
|
||||
|
||||
|
||||
# for ping, only need to set speed and duplex for ethernet adapters
|
||||
#
|
||||
if ( $list_type eq "ent" ) {
|
||||
@@ -1323,8 +1324,10 @@ sub ping_server{
|
||||
|
||||
$timeout = 300;
|
||||
while ( $done[$state] eq 0 ) {
|
||||
|
||||
send_command($verbose, $rconsole, $cmd[$state]);
|
||||
@result = $rconsole->expect(
|
||||
|
||||
$timeout,
|
||||
[qr/$pattern[$state]/s=>
|
||||
sub {
|
||||
@@ -1362,7 +1365,9 @@ sub ping_server{
|
||||
}
|
||||
],
|
||||
);
|
||||
return 1 if ($rc eq 1);
|
||||
|
||||
return 1 if ($rc eq 1);
|
||||
|
||||
if ( $state eq 1 ) {
|
||||
$adap_conn = $adap_conn_list[$j];
|
||||
$cmd[1] = "\" ethernet,$adap_speed,$adap_conn,$adap_duplex\" encode-string \" chosen-network-type\" property\r";
|
||||
@@ -1849,6 +1854,14 @@ sub boot_network {
|
||||
$state = $newstate[$state];
|
||||
}
|
||||
],
|
||||
# For some old firmware, does not output "----"
|
||||
[qr/BOOTP/=>
|
||||
sub {
|
||||
nc_msg ($verbose, $msg[$state]);
|
||||
$rconsole->clear_accum();
|
||||
$state = $newstate[$state];
|
||||
}
|
||||
],
|
||||
[qr/]/=>
|
||||
sub {
|
||||
nc_msg($verbose, "Unexpected prompt\n");
|
||||
@@ -1917,7 +1930,28 @@ sub Boot {
|
||||
#],
|
||||
[qr/BOOTP/=> #-ex
|
||||
sub {
|
||||
nc_msg($verbose, "# Network boot proceeding, exiting.\n");
|
||||
nc_msg($verbose, "# Network boot proceeding - matched BOOTP, exiting.\n");
|
||||
$rconsole->clear_accum();
|
||||
}
|
||||
],
|
||||
# Welcome to AIX - some old firmware does not output BOOTP or ----
|
||||
[qr/Welcome/=> #-ex
|
||||
sub {
|
||||
nc_msg($verbose, "# Network boot proceeding - matched Welcome, exiting.\n");
|
||||
$rconsole->clear_accum();
|
||||
}
|
||||
],
|
||||
# tftp file download - some old firmware does not output BOOTP or ----
|
||||
[qr/FILE/=> #-ex
|
||||
sub {
|
||||
nc_msg($verbose, "# Network boot proceeding - matched FILE.\n");
|
||||
$rconsole->clear_accum();
|
||||
}
|
||||
],
|
||||
# some old firmware does not output BOOTP or ----
|
||||
[qr/Elapsed/=> #-ex
|
||||
sub {
|
||||
nc_msg($verbose, "# Network boot proceeding - matched Elapsed, exiting.\n");
|
||||
$rconsole->clear_accum();
|
||||
}
|
||||
],
|
||||
@@ -2021,14 +2055,46 @@ sub multiple_open_dev {
|
||||
; \r";
|
||||
send_command($verbose, $rconsole, $command);
|
||||
|
||||
$command = "patch new-open-dev open-dev net-ping \r";
|
||||
send_command($verbose, $rconsole, $command);
|
||||
|
||||
$timeout = 30;
|
||||
$rconsole->expect(
|
||||
$timeout,
|
||||
#[qr/patch new-open-dev(.*)>/=>
|
||||
[qr/>/=>
|
||||
[qr/new-open-dev(.*)ok/=>
|
||||
#[qr/>/=>
|
||||
sub {
|
||||
nc_msg($verbose, "Status: at End of multiple_open_dev \n");
|
||||
$rconsole->clear_accum();
|
||||
}
|
||||
],
|
||||
[qr/]/=>
|
||||
sub {
|
||||
nc_msg($verbose, "Unexpected prompt\n");
|
||||
$rconsole->clear_accum();
|
||||
$rc = 1;
|
||||
}
|
||||
],
|
||||
[timeout =>
|
||||
sub {
|
||||
send_user(2, "Timeout\n");
|
||||
$rconsole->clear_accum();
|
||||
$rc = 1;
|
||||
}
|
||||
],
|
||||
[eof =>
|
||||
sub {
|
||||
send_user(2, "Cannot connect to $node\n");
|
||||
$rconsole->clear_accum();
|
||||
$rc = 1;
|
||||
}
|
||||
],
|
||||
);
|
||||
|
||||
$command = "patch new-open-dev open-dev net-ping \r";
|
||||
send_command($verbose, $rconsole, $command);
|
||||
|
||||
$rconsole->expect(
|
||||
$timeout,
|
||||
[qr/patch new-open-dev(.*)ok/=>
|
||||
#[qr/>/=>
|
||||
sub {
|
||||
nc_msg($verbose, "Status: at End of multiple_open_dev \n");
|
||||
$rconsole->clear_accum();
|
||||
@@ -2057,6 +2123,7 @@ sub multiple_open_dev {
|
||||
}
|
||||
],
|
||||
);
|
||||
|
||||
return $rc;
|
||||
}
|
||||
###################################################################
|
||||
@@ -2540,7 +2607,7 @@ sub lparnetbootexp
|
||||
####################################
|
||||
nc_msg($verbose, "Connecting to the $node.\n");
|
||||
sleep 3;
|
||||
$timeout = 2;
|
||||
$timeout = 10;
|
||||
$rconsole->expect(
|
||||
$timeout,
|
||||
[ qr/Enter.* for help.*/i =>
|
||||
@@ -2749,6 +2816,8 @@ sub lparnetbootexp
|
||||
$done = 0;
|
||||
$retry_count = 0;
|
||||
|
||||
$timeout = 10;
|
||||
|
||||
while (!$done) {
|
||||
my @result = $rconsole->expect(
|
||||
$timeout,
|
||||
@@ -2856,6 +2925,7 @@ sub lparnetbootexp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
##############################
|
||||
# Call multiple_open_dev to
|
||||
# circumvent firmware OPEN-DEV
|
||||
@@ -2890,6 +2960,7 @@ sub lparnetbootexp
|
||||
$match_pat = ".*";
|
||||
}
|
||||
|
||||
|
||||
if($colon) {
|
||||
nc_msg($verbose, "#Type:Location_Code:MAC_Address:Full_Path_Name:Ping_Result:Device_Type:Size_MB:OS:OS_Version:\n");
|
||||
$outputarrayindex++; # start from 1, 0 is used to set as 0
|
||||
@@ -2943,7 +3014,7 @@ sub lparnetbootexp
|
||||
} else {
|
||||
for( $i = 0; $i < $adapter_found; $i++) {
|
||||
if ($adap_type[$i] =~ /$match_pat/) {
|
||||
if ($adap_type[$i] eq "hfi-ent") {
|
||||
if (!($adap_type[$i] eq "hfi-ent")) {
|
||||
$mac_address = get_mac_addr($phandle_array[$i], $rconsole, $node, $verbose);
|
||||
$loc_code = get_adaptr_loc($phandle_array[$i], $rconsole, $node, $verbose);
|
||||
}
|
||||
@@ -3148,12 +3219,12 @@ sub lparnetbootexp
|
||||
}
|
||||
],
|
||||
);
|
||||
return [1] if ($rc eq 1);
|
||||
}
|
||||
nc_msg($verbose, "# bootp sent over network.\n");
|
||||
$rc = Boot($rconsole, $node, $verbose);#, @expect_out);
|
||||
unless ($rc eq 0) {
|
||||
nc_msg($verbose, "Can't boot here. \n");
|
||||
return [1] if ($rc eq 1);
|
||||
nc_msg($verbose, "# bootp sent over network.\n");
|
||||
$rc = Boot($rconsole, $node, $verbose);#, @expect_out);
|
||||
unless ($rc eq 0) {
|
||||
nc_msg($verbose, "Can't boot here. \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -189,12 +189,13 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
@allnodeset = $nodelist->getAllAttribs('node','groups');
|
||||
%allnodehash = map { $_->{node} => 1 } @allnodeset;
|
||||
}
|
||||
my $verify = (scalar(@_) == 1 ? shift : 1);
|
||||
my $verify = (scalar(@_) >= 1 ? shift : 1);
|
||||
my %args = @_;
|
||||
my @nodes= ();
|
||||
#TODO: these env vars need to get passed by the client to xcatd
|
||||
my $nprefix=(defined ($ENV{'XCAT_NODE_PREFIX'}) ? $ENV{'XCAT_NODE_PREFIX'} : 'node');
|
||||
my $nsuffix=(defined ($ENV{'XCAT_NODE_SUFFIX'}) ? $ENV{'XCAT_NODE_SUFFIX'} : '');
|
||||
if ($allnodehash{$atom}) { #The atom is a plain old nodename
|
||||
if (not $args{genericrange} and $allnodehash{$atom}) { #The atom is a plain old nodename
|
||||
return ($atom);
|
||||
}
|
||||
if ($atom =~ /^\(.*\)$/) { # handle parentheses by recursively calling noderange()
|
||||
@@ -208,6 +209,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
}
|
||||
|
||||
# Try to match groups?
|
||||
unless ($args{genericrange}) {
|
||||
unless ($grptab) {
|
||||
$grptab = xCAT::Table->new('nodegroup');
|
||||
}
|
||||
@@ -269,6 +271,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($atom =~ m/[=~]/) { #TODO: this is the clunky, slow code path to acheive the goal. It also is the easiest to write, strange coincidence. Aggregating multiples would be nice
|
||||
my @nodes;
|
||||
@@ -287,7 +290,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
}
|
||||
if ($atom =~ m/^[0-9]+\z/) { # if only numbers, then add the prefix
|
||||
my $nodename=$nprefix.$atom.$nsuffix;
|
||||
return expandatom($nodename,$verify);
|
||||
return expandatom($nodename,$verify,%args);
|
||||
}
|
||||
my $nodelen=@nodes;
|
||||
if ($nodelen > 0) {
|
||||
@@ -322,12 +325,12 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
$subrange=$subrange."$start$subelem" . ($morebrackets?'':$ending) . "$subop";
|
||||
}
|
||||
foreach (split /,/,$subrange) {
|
||||
my @newnodes=expandatom($_, ($morebrackets?0:$verify));
|
||||
my @newnodes=expandatom($_, ($morebrackets?0:$verify), genericrange=>$morebrackets);
|
||||
if (!$morebrackets) { push @nodes,@newnodes; }
|
||||
else {
|
||||
# for each of the new nodes, add the 2nd brackets and then expand
|
||||
foreach my $n (@newnodes) {
|
||||
push @nodes, expandatom("$n$ending", $verify);
|
||||
push @nodes, expandatom("$n$ending", $verify, %args);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,7 +352,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
$suf=$nsuffix;
|
||||
}
|
||||
foreach ("$startnum".."$endnum") {
|
||||
my @addnodes=expandatom($pref.$_.$suf,$verify);
|
||||
my @addnodes=expandatom($pref.$_.$suf,$verify,%args);
|
||||
@nodes=(@nodes,@addnodes);
|
||||
}
|
||||
return (@nodes);
|
||||
@@ -376,7 +379,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
$right=$2;
|
||||
}
|
||||
if ($left eq $right) { #if they said node1-node1 for some strange reason
|
||||
return expandatom($left,$verify);
|
||||
return expandatom($left,$verify,%args);
|
||||
}
|
||||
my @leftarr=split(/(\d+)/,$left);
|
||||
my @rightarr=split(/(\d+)/,$right);
|
||||
@@ -413,7 +416,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
}
|
||||
}
|
||||
foreach ($leftarr[$idx]..$rightarr[$idx]) {
|
||||
my @addnodes=expandatom($prefix.$_.$luffix,$verify);
|
||||
my @addnodes=expandatom($prefix.$_.$luffix,$verify,%args);
|
||||
push @nodes,@addnodes;
|
||||
}
|
||||
return (@nodes); #the return has been built, return, exiting loop and all
|
||||
|
||||
@@ -98,7 +98,7 @@ sub mkhwconn_parse_args
|
||||
#my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]);
|
||||
my $node_parent_hash = $ppctab->getNodeAttribs( $node,[qw(parent)]);
|
||||
#$nodetype = $nodetype_hash->{nodetype};
|
||||
$nodetype = xCAT::DBobjUtils->getnodetype($node);
|
||||
$nodetype = xCAT::DBobjUtils->getnodetype($node,"ppc");
|
||||
$node_parent = $node_parent_hash->{parent};
|
||||
if ( !$nodetype )
|
||||
{
|
||||
@@ -106,7 +106,7 @@ sub mkhwconn_parse_args
|
||||
next;
|
||||
} else
|
||||
{
|
||||
unless ( $nodetype =~ /^(fsp|bpa|frame|cec|hmc)$/)
|
||||
unless ( $nodetype =~ /^(blade|fsp|bpa|frame|cec|hmc)$/)
|
||||
{
|
||||
return ( usage("Node type is incorrect. \n"));
|
||||
}
|
||||
@@ -484,9 +484,13 @@ sub mkhwconn
|
||||
# Get IP address
|
||||
############################
|
||||
my $cnode;
|
||||
my $ntype = xCAT::DBobjUtils::getnodetype($node_name);
|
||||
if ($ntype =~ /^(cec|frame)$/)
|
||||
#my $ntype = xCAT::DBobjUtils::getnodetype($node_name);
|
||||
my $ntype = $$d[4];
|
||||
if ($ntype =~ /^(cec|frame|blade)$/)
|
||||
{
|
||||
if ($ntype eq "blade") {
|
||||
delete $opt->{port};
|
||||
}
|
||||
$cnode = xCAT::DBobjUtils::getchildren($node_name, $opt->{port});
|
||||
} else {
|
||||
$cnode = $node_name;
|
||||
@@ -515,12 +519,17 @@ sub mkhwconn
|
||||
next;
|
||||
}
|
||||
|
||||
my ( undef,undef,$mtms,undef,$type) = @$d;
|
||||
my ( undef,undef,$mtms,undef,$type,$bpa) = @$d;
|
||||
my ($user, $passwd);
|
||||
if ( exists $opt->{P})
|
||||
{
|
||||
($user, $passwd) = ('HMC', $opt->{P});
|
||||
}
|
||||
elsif ($type eq "blade") {
|
||||
$user = "USERID";
|
||||
($user, $passwd) = xCAT::PPCdb::credentials($bpa, $type, $user);
|
||||
$type = "cec";
|
||||
}
|
||||
else
|
||||
{
|
||||
($user, $passwd) = xCAT::PPCdb::credentials( $node_name, $type,'HMC');
|
||||
@@ -703,7 +712,7 @@ sub rmhwconn
|
||||
my $d = $node_hash->{$node_name};
|
||||
|
||||
my ( undef,undef,undef,undef,$type) = @$d;
|
||||
|
||||
if ($type eq "blade") {$type = "cec";}
|
||||
############################
|
||||
# Get IP address
|
||||
############################
|
||||
@@ -720,10 +729,19 @@ sub rmhwconn
|
||||
|
||||
my @ips;
|
||||
foreach my $entry ( @$nodes_found ) {
|
||||
if ( $entry =~ /$mtm\*$serial/) {
|
||||
$entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/;
|
||||
push @ips, $1;
|
||||
if ($entry =~ /type_model_serial_num=([^,]*),/) {
|
||||
my $match_mtm1 = $1;
|
||||
my $match_mtm2 = $match_mtm1;
|
||||
$match_mtm2 =~ s/\-//;
|
||||
if ($match_mtm1 =~ /$mtm\*$serial/ || $match_mtm2 =~ /$mtm\*$serial/) {
|
||||
$entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/;
|
||||
push @ips, $1;
|
||||
}
|
||||
}
|
||||
#if ( $entry =~ /$mtm\*$serial/) {
|
||||
# $entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/;
|
||||
# push @ips, $1;
|
||||
#}
|
||||
}
|
||||
if (!@ips)
|
||||
{
|
||||
|
||||
@@ -74,6 +74,15 @@ sub parse_args {
|
||||
return(usage( "Invalid Argument: $ARGV[0]" ));
|
||||
}
|
||||
####################################
|
||||
# Check -o argument
|
||||
####################################
|
||||
if ( exists($opt{o}) ) {
|
||||
unless (exists($opt{D})){
|
||||
return(usage( "The -o flag must be used with -D flag" ));
|
||||
}
|
||||
|
||||
}
|
||||
####################################
|
||||
# Check argument for ping test
|
||||
####################################
|
||||
if ( exists($opt{D}) ) {
|
||||
|
||||
@@ -533,18 +533,22 @@ sub get_lic_filenames {
|
||||
#############
|
||||
if($fff ne $2) {
|
||||
$upgrade_required = 1;
|
||||
if($activate ne "disruptive") {
|
||||
$msg = "Option --activate's value should be 'disruptive'";
|
||||
return ("", "","", $msg, -1);
|
||||
}
|
||||
} else {
|
||||
|
||||
if(($pns eq $1) && ($4 <= $active_level)) {
|
||||
$msg = $msg. "Upgrade $mtms $activate!";
|
||||
# if($activate ne "concurrent") {
|
||||
# $msg = "Option --actviate's value should be disruptive";
|
||||
# return ("", "","", $msg, -1);
|
||||
# }
|
||||
if(($pns eq $1) && ($3 > $active_level) && ($4 <= $active_level)) {
|
||||
$msg = $msg. "Upgrade $mtms $activate!";
|
||||
if($activate ne "concurrent") {
|
||||
$msg = "Option --actviate's value should be 'concurrent'";
|
||||
return ("", "","", $msg, -1);
|
||||
}
|
||||
} else {
|
||||
$msg = $msg . "Upgrade $mtms!";
|
||||
if($activate !~ /^(disruptive|concurrent)$/) {
|
||||
$msg = "Option --activate's value shouldn't be $activate, and it must be disruptive or concurrent";
|
||||
$msg = $msg . "Upgrade $mtms!";
|
||||
if($activate ne "disruptive") {
|
||||
$msg = "Option --activate's value should be 'disruptive'";
|
||||
return ("", "","", $msg, -1);
|
||||
}
|
||||
}
|
||||
|
||||
+30
-3
@@ -60,9 +60,10 @@ sub usage
|
||||
" -p <template path> [-o output file ] [-t <template count>]\n";
|
||||
my $usagemsg4 = " [-r remove templates] [-s <seednode>]\n";
|
||||
my $usagemsg5 = " [-e exactmatch] [-i ignore] [-V verbose]\n";
|
||||
my $usagemsg5A = " [-l userid] [--devicetype type_of_device]\n";
|
||||
my $usagemsg6 = " {-c <command> | -f <command file>}";
|
||||
my $usagemsg .= $usagemsg1 .= $usagemsg1a .= $usagemsg3 .= $usagemsg4 .=
|
||||
$usagemsg5 .= $usagemsg6;
|
||||
$usagemsg5 .= $usagemsg5A .= $usagemsg6;
|
||||
### end usage mesage
|
||||
|
||||
my $rsp = {};
|
||||
@@ -110,6 +111,8 @@ sub parse_and_run_sinv
|
||||
's|seed=s' => \$options{'seed_node'},
|
||||
'e|exactmatch' => \$options{'exactmatch'},
|
||||
'i|ignorefirst' => \$options{'ignorefirst'},
|
||||
'l|user=s' => \$options{'user'},
|
||||
'devicetype|devicetype=s' => \$options{'devicetype'},
|
||||
'c|cmd=s' => \$options{'sinv_cmd'},
|
||||
'f|file=s' => \$options{'sinv_cmd_file'},
|
||||
'v|version' => \$options{'version'},
|
||||
@@ -198,14 +201,36 @@ sub parse_and_run_sinv
|
||||
# strip off the program and the noderange
|
||||
#
|
||||
my @nodelist = ();
|
||||
my @cmdparts = split(' ', $cmd);
|
||||
my @cmdparts = ();
|
||||
if ($options{'devicetype'}) {
|
||||
# must split different because devices have commands with spaces
|
||||
@cmdparts = split(' ', $cmd,3);
|
||||
} else {
|
||||
@cmdparts = split(' ', $cmd);
|
||||
}
|
||||
my $cmdtype = shift @cmdparts;
|
||||
my $noderange = shift @cmdparts;
|
||||
my @cmd = ();
|
||||
if ($noderange =~ /^-/)
|
||||
if ($noderange =~ /^-/) # if imageupdate not node
|
||||
{ # no noderange
|
||||
push @cmd, $noderange; # put flag back on command
|
||||
}
|
||||
# root is sending the command
|
||||
my @envs;
|
||||
# if -l user id supplied
|
||||
if ($options{'user'}) {
|
||||
push @cmd,"-l";
|
||||
push @cmd,$options{'user'};
|
||||
push @envs,"DSH_TO_USERID=$options{'user'}";
|
||||
}
|
||||
# if device type supplied
|
||||
if ($options{'devicetype'}) {
|
||||
push @cmd,"--devicetype";
|
||||
my $switchtype = $options{'devicetype'};
|
||||
$switchtype =~ s/::/\//g;
|
||||
push @cmd,$switchtype;
|
||||
}
|
||||
|
||||
foreach my $part (@cmdparts)
|
||||
{
|
||||
|
||||
@@ -471,6 +496,7 @@ sub parse_and_run_sinv
|
||||
{
|
||||
command => [$cmdtype],
|
||||
node => \@seed,
|
||||
env => [@envs],
|
||||
arg => [@cmd]
|
||||
},
|
||||
\&$cmdoutput
|
||||
@@ -500,6 +526,7 @@ sub parse_and_run_sinv
|
||||
{
|
||||
command => [$cmdtype],
|
||||
node => \@nodelist,
|
||||
env => [@envs],
|
||||
arg => [@cmd]
|
||||
},
|
||||
\&$cmdoutput
|
||||
|
||||
Regular → Executable
+165
-12
@@ -23,7 +23,10 @@ my $gprlist;
|
||||
my %searchmacs;
|
||||
my %ip4neigh;
|
||||
my %ip6neigh;
|
||||
|
||||
my %servicehash;
|
||||
my %sendhash;
|
||||
my $attrpy = 0;
|
||||
my $serrpy = 0;
|
||||
sub getmulticasthash {
|
||||
my $hash=0;
|
||||
my @nums = unpack("C*",shift);
|
||||
@@ -40,10 +43,13 @@ sub getmulticasthash {
|
||||
|
||||
sub dodiscover {
|
||||
my %args = @_;
|
||||
my $unicast = $args{unicast}; #should be used with -s !
|
||||
my $ipranges = $args{range};
|
||||
my $rspcount = 0;
|
||||
my $rspcount1 = 0;
|
||||
my $sendcount = 1;
|
||||
$xid = int(rand(16384))+1;
|
||||
my %rethash;
|
||||
unless ($args{'socket'}) {
|
||||
if ($ip6support) {
|
||||
$args{'socket'} = IO::Socket::INET6->new(Proto => 'udp');
|
||||
@@ -60,7 +66,7 @@ sub dodiscover {
|
||||
$args{'socket'}->sockopt(SO_RCVBUF,$maxrcvbuf/2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} #end of unless socket
|
||||
unless ($args{SrvTypes}) { croak "SrvTypes argument is required for xCAT::SLP::Dodiscover"; }
|
||||
unless (xCAT::Utils->isAIX()) { # AIX bug, can't set socket with SO_BROADCAST, otherwise multicast can't work.
|
||||
setsockopt($args{'socket'},SOL_SOCKET,SO_BROADCAST,1); #allow for broadcasts to be sent, we know what we are doing
|
||||
@@ -91,11 +97,149 @@ sub dodiscover {
|
||||
}
|
||||
}
|
||||
my $printinfo = join(",", @printip);
|
||||
send_message($args{reqcallback}, 0, "Sending SLP request on interfaces: $printinfo ...") if ($args{reqcallback});
|
||||
if ($unicast) {
|
||||
if (xCAT::Utils->isAIX()){
|
||||
send_message($args{reqcallback}, 1, "lsslp unicast is not supported on AIX");
|
||||
exit 1;
|
||||
}
|
||||
if (! -f "/usr/bin/nmap"){
|
||||
send_message($args{reqcallback}, 1, "nmap does not exist, lsslp unicast is not possible");
|
||||
exit 1;
|
||||
}
|
||||
my @servernodes;
|
||||
my @iprange = split /,/, $ipranges;
|
||||
foreach my $range (@iprange) {
|
||||
`/usr/bin/nmap $range -sn -PE -n --send-ip -T5 `;
|
||||
my $nmapres = `/usr/bin/nmap $range -PE -p 427 -n --send-ip -T5 `;
|
||||
foreach my $line (split(/\n\n/,$nmapres)) {#\n/,$nmapres)) {
|
||||
my $server;
|
||||
foreach my $sline (split(/\n/, $line)) {
|
||||
if ($sline =~ /Nmap scan report for (\d+\.\d+\.\d+\.\d+)/) {
|
||||
$server = $1;
|
||||
}
|
||||
if ($sline =~ /427/ and ($sline =~ /open/ or $sline =~ /filtered/)){
|
||||
push @servernodes, $server;
|
||||
}
|
||||
} # end of foreach line
|
||||
} # end of foreach line
|
||||
} # end of foreach pi-range
|
||||
unless (@servernodes){
|
||||
send_message($args{reqcallback}, 0, "Nmap returns nothing");
|
||||
return undef;
|
||||
}
|
||||
my $number = scalar (@servernodes);
|
||||
send_message($args{reqcallback}, 0, "Begin to do unicast to $number nodes...");
|
||||
my %rechash;
|
||||
pipe CREAD,PWRITE;
|
||||
my $pid = xCAT::Utils->xfork();
|
||||
if ( !defined($pid) ) {
|
||||
send_message($args{reqcallback}, 1, "Fork error: $!" );
|
||||
return undef;
|
||||
} elsif ( $pid == 0 ) {
|
||||
close PWRITE;
|
||||
foreach my $srvtype (@srvtypes) {
|
||||
my $packet = generate_attribute_request(%args, SrvType=>$srvtype);
|
||||
foreach my $destserver (@servernodes) {
|
||||
my $destip = inet_aton($destserver);
|
||||
my $destaddr = sockaddr_in(427,$destip);
|
||||
my $res = $args{'socket'}->send($packet,0,$destaddr);
|
||||
} # end of foreach destserver
|
||||
}# end of foreach services
|
||||
while(<CREAD>){
|
||||
chomp;
|
||||
my $destserver = $_;
|
||||
if ($destserver =~ /NowYouNeedToDie/){
|
||||
close CREAD;
|
||||
exit 0;
|
||||
}
|
||||
foreach my $srvtype (@srvtypes) {
|
||||
my $packet = generate_attribute_request(%args, SrvType=>$srvtype);
|
||||
my $destip = inet_aton($destserver);
|
||||
my $destaddr = sockaddr_in(427,$destip);
|
||||
for( my $j = 0; $j < 1; $j++) {
|
||||
my $res = $args{'socket'}->send($packet,0,$destaddr);
|
||||
} # end of foreach j++
|
||||
}# end of foreach services
|
||||
} # end of while (cread)
|
||||
} else {
|
||||
close CREAD;
|
||||
$rspcount = 0;
|
||||
my $waittime = ($args{Time}>0)?$args{Time}:300;
|
||||
my $deadline = time()+ $waittime;
|
||||
my $waitforsocket = IO::Select->new();
|
||||
$waitforsocket->add($args{'socket'});
|
||||
my $rectime = time() + 5;
|
||||
my $recvzero = 0;
|
||||
while ($deadline > time()) {
|
||||
$rspcount1 = 0;
|
||||
while ($rectime > time()) {
|
||||
while ($waitforsocket->can_read(0)) {
|
||||
my $slppacket;
|
||||
my $peer = $args{'socket'}->recv($slppacket,3000,0);
|
||||
$rechash{$peer} = $slppacket;
|
||||
} #end of can_read
|
||||
} # end of receiving
|
||||
# now begin to parse the packets
|
||||
for my $tp (keys %rechash) {
|
||||
my @restserver ;
|
||||
my $pkg = $tp; #$peerarray[$j];
|
||||
my $slpkg = $rechash{$tp}; #$pkgarray[$j];
|
||||
my( $port,$flow,$ip6n,$ip4n,$scope);
|
||||
my $peername;
|
||||
if ($ip6support) {
|
||||
( $port,$flow,$ip6n,$scope) = Socket6::unpack_sockaddr_in6_all($pkg);
|
||||
$peername = Socket6::inet_ntop(Socket6::AF_INET6(),$ip6n);
|
||||
} else {
|
||||
($port,$ip4n) = sockaddr_in($pkg);
|
||||
$peername = inet_ntoa($ip4n);
|
||||
}
|
||||
if ($peername =~ /\./) { #ipv4
|
||||
$peername =~ s/::ffff://;
|
||||
}
|
||||
if ($rethash{$peername}) {
|
||||
next; #got a dupe, discard
|
||||
}
|
||||
my $result = process_slp_packet(packet=>$slpkg,sockaddr=>$pkg,'socket'=>$args{'socket'}, peername=>$peername, callback=>$args{reqcallback});
|
||||
if ($result) {
|
||||
$rspcount++;
|
||||
$rspcount1++;
|
||||
$result->{peername} = $peername;
|
||||
$result->{scopeid} = $scope;
|
||||
$result->{sockaddr} = $pkg;
|
||||
my $hashkey;
|
||||
if ($peername =~ /fe80/) {
|
||||
$peername .= '%'.$scope;
|
||||
}
|
||||
$rethash{$peername} = $result;
|
||||
if ($args{Callback}) {
|
||||
$args{Callback}->($result);
|
||||
}
|
||||
foreach my $mynode (@servernodes) {
|
||||
unless ($mynode =~ $peername) {
|
||||
push @restserver, $mynode;
|
||||
}#end of mynode=~peername
|
||||
} # end of foreach
|
||||
@servernodes = @restserver;
|
||||
} # end of if result
|
||||
} # end of foreach processing
|
||||
foreach my $node (@servernodes) {
|
||||
syswrite PWRITE,"$node\n";
|
||||
} # end of foreach servernodes
|
||||
$recvzero++ unless ($rspcount1);
|
||||
last if ($recvzero > 2);
|
||||
} # end of while(deadline)
|
||||
syswrite PWRITE,"NowYouNeedToDie\n";
|
||||
close PWRITE;
|
||||
if (@servernodes) {
|
||||
my $miss = join(",", @servernodes);
|
||||
send_message($args{reqcallback}, 0, "Warning: can't get attributes from these nodes' replies: $miss. Please re-send unicast to these nodes.") if ($args{reqcallback});
|
||||
}
|
||||
}# end of parent process
|
||||
} else {
|
||||
send_message($args{reqcallback}, 0, "Sending SLP request on interfaces: $printinfo ...") if ($args{reqcallback} and !$args{nomsg} );
|
||||
foreach my $srvtype (@srvtypes) {
|
||||
send_service_request_single(%args,ifacemap=>$interfaces,SrvType=>$srvtype);
|
||||
}
|
||||
my %rethash;
|
||||
unless ($args{NoWait}) { #in nowait, caller owns the responsibility..
|
||||
#by default, report all respondants within 3 seconds:
|
||||
my $waitforsocket = IO::Select->new();
|
||||
@@ -117,7 +261,7 @@ sub dodiscover {
|
||||
# receive untill there is none
|
||||
########################################
|
||||
while ($waitforsocket->can_read(0)) {
|
||||
my $peer = $args{'socket'}->recv($slppacket,1400,0);
|
||||
my $peer = $args{'socket'}->recv($slppacket,3000,0);
|
||||
push @peerarray, $peer;
|
||||
push @pkgarray, $slppacket;
|
||||
}
|
||||
@@ -170,12 +314,12 @@ sub dodiscover {
|
||||
$interval = time() - $startinterval;
|
||||
if ($args{Time} and $args{Count}) {
|
||||
if ($rspcount >= $args{Count} or $interval >= $args{Time}) {
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback});
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback} and !$args{nomsg});
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($sendcount > $retrytime and $rspcount1 == 0) {
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback});
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback} and !$args{nomsg});
|
||||
last;
|
||||
}
|
||||
#########################
|
||||
@@ -184,19 +328,19 @@ sub dodiscover {
|
||||
if ( $interval > $retryinterval){#* (2**$sendcount))) { #double time
|
||||
$sendcount++;
|
||||
$startinterval = time();
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback});
|
||||
send_message($args{reqcallback}, 0, "Sending SLP request on interfaces: $printinfo ...") if ($args{reqcallback});
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback} and !$args{nomsg});
|
||||
send_message($args{reqcallback}, 0, "Sending SLP request on interfaces: $printinfo ...") if ($args{reqcallback} and !$args{nomsg});
|
||||
foreach my $srvtype (@srvtypes) {
|
||||
send_service_request_single(%args,ifacemap=>$interfaces,SrvType=>$srvtype);
|
||||
}
|
||||
$rspcount1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} #end nowait
|
||||
} #end of if( unicast )
|
||||
|
||||
foreach my $entry (keys %rethash) {
|
||||
handle_new_slp_entity($rethash{$entry})
|
||||
handle_new_slp_entity($rethash{$entry});
|
||||
}
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
foreach my $iface (keys %{$interfaces}) {
|
||||
@@ -226,12 +370,19 @@ sub process_slp_packet {
|
||||
}
|
||||
my $srvtype = $xid_to_srvtype_map{$parsedpacket->{Xid}};
|
||||
my $packet = generate_attribute_request(%args,SrvType=>$srvtype);
|
||||
$sendhash{$args{peername}}->{package} = $packet;
|
||||
$sendhash{$args{peername}}->{sockaddy} = $sockaddy;
|
||||
$serrpy++;
|
||||
$socket->send($packet,0,$sockaddy);
|
||||
return undef;
|
||||
} elsif ($parsedpacket->{FunctionId} == 7) { #attribute reply
|
||||
$attrpy++;
|
||||
$parsedpacket->{SrvType} = $xid_to_srvtype_map{$parsedpacket->{Xid}};
|
||||
$parsedpacket->{attributes} = parse_attribute_reply($parsedpacket->{payload});
|
||||
#delete $parsedpacket->{payload};
|
||||
my $attributes = $parsedpacket->{attributes};
|
||||
my $type = ${$attributes->{'type'}}[0] ;
|
||||
return undef unless ($type) ;
|
||||
return $parsedpacket;
|
||||
} else {
|
||||
return undef;
|
||||
@@ -394,9 +545,11 @@ sub send_service_request_single {
|
||||
$ipnum= $ipnum | (2**(32-$maskbits))-1;
|
||||
my $bcastn = pack("N",$ipnum);
|
||||
my $bcastaddr = sockaddr_in(427,$bcastn);
|
||||
$socket->sockopt(SO_BROADCAST, 1) or die("sockopt: $!\n");
|
||||
$socket->send($packet,0,$bcastaddr);
|
||||
setsockopt($socket,0,IP_MULTICAST_IF,$ipn);
|
||||
$socket->send($packet,0,$ipv4sockaddr);
|
||||
$socket->send($packet,0,$bcastaddr);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2314,8 +2314,9 @@ sub getNodeAttribs
|
||||
my $exp = substr($datum->{$attrib}, 1);
|
||||
chop $exp;
|
||||
my @parts = split('/', $exp, 2);
|
||||
$node =~ s/$parts[0]/$parts[1]/;
|
||||
$datum->{$attrib} = $node;
|
||||
my $retval = $node;
|
||||
$retval =~ s/$parts[0]/$parts[1]/;
|
||||
$datum->{$attrib} = $retval;
|
||||
}
|
||||
elsif ($datum->{$attrib} =~ /^\|.*\|.*\|$/)
|
||||
{
|
||||
|
||||
+22
-8
@@ -36,7 +36,7 @@ my %usage = (
|
||||
LPAR(using Direct FSP Management) specific:
|
||||
rpower <noderange> [on|off|reset|stat|state|boot|of|sms]
|
||||
Blade(using Direct FSP Management) specific:
|
||||
rpower <noderange> [on|off|cycle|state]
|
||||
rpower <noderange> [on|onstandby|off|cycle|state|sms]
|
||||
Blade(using AMM) specific:
|
||||
rpower <noderange> [cycle|softoff] [-V|--verbose]
|
||||
zVM specific:
|
||||
@@ -185,7 +185,7 @@ my %usage = (
|
||||
PPC specific:
|
||||
getmacs <noderange> [-F filter]
|
||||
getmacs <noderange> [-M]
|
||||
getmacs <noderange> [-V| --verbose] [-f] [-d] [--arp] | [-D [-S server] [-G gateway] [-C client]]
|
||||
getmacs <noderange> [-V| --verbose] [-f] [-d] [--arp] | [-D [-o] [-S server] [-G gateway] [-C client]]
|
||||
blade specific:
|
||||
getmacs <noderange> [-V| --verbose] [-d] [--arp] [-i ethN|enN]
|
||||
",
|
||||
@@ -261,8 +261,8 @@ my %usage = (
|
||||
rmvm [-p] [-f]",
|
||||
"lsslp" =>
|
||||
"Usage: lsslp [-h|--help|-v|--version]
|
||||
lsslp [<noderange>][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM]
|
||||
[-t tries][--vpdtable][-C counts][-T timeout]",
|
||||
lsslp [<noderange>][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM|IMM2|FSP]
|
||||
[-u][--range IPranges][-t tries][--vpdtable][-C counts][-T timeout]",
|
||||
"rflash" =>
|
||||
"Usage:
|
||||
rflash [ -h|--help|-v|--version]
|
||||
@@ -317,10 +317,24 @@ my %usage = (
|
||||
renergy noderange [-V] { all | { [savingstatus] [dsavingstatus] [cappingstatus] [cappingmaxmin] [cappingvalue] [cappingsoftmin] [averageAC] [averageDC] [ambienttemp] [exhausttemp] [CPUspeed] [syssbpower] [sysIPLtime] [fsavingstatus] [ffoMin] [ffoVmin] [ffoTurbo] [ffoNorm] [ffovalue] } }
|
||||
renergy noderange [-V] { {savingstatus}={on | off} | {dsavingstatus}={on-norm | on-maxp | off} | {fsavingstatus}={on | off} | {ffovalue}=MHZ | {cappingstatus}={on | off} | {cappingwatt}=watt | {cappingperc}=percentage }
|
||||
|
||||
Blade specific :
|
||||
renergy noderange [-V] { all | pd1all | pd2all | { [pd1status] [pd2status] [pd1policy] [pd2policy] [pd1powermodule1] [pd1powermodule2] [pd2powermodule1] [pd2powermodule2] [pd1avaiablepower] [pd2avaiablepower] [pd1reservedpower] [pd2reservedpower] [pd1remainpower] [pd2remainpower] [pd1inusedpower] [pd2inusedpower] [availableDC] [averageAC] [thermaloutput] [ambienttemp] [mmtemp] } }
|
||||
renergy noderange [-V] { all | { [averageDC] [capability] [cappingvalue] [CPUspeed] [maxCPUspeed] [savingstatus] [dsavingstatus] } }
|
||||
renergy noderange [-V] { {savingstatus}={on | off} | {dsavingstatus}={on-norm | on-maxp | off} }",
|
||||
BladeCenter specific :
|
||||
For Management Modules:
|
||||
renergy noderange [-V] { all | pd1all | pd2all | [pd1status] [pd2status] [pd1policy] [pd2policy] [pd1powermodule1] [pd1powermodule2] [pd2powermodule1] [pd2powermodule2] [pd1avaiablepower] [pd2avaiablepower] [pd1reservedpower] [pd2reservedpower] [pd1remainpower] [pd2remainpower] [pd1inusedpower] [pd2inusedpower] [availableDC] [averageAC] [thermaloutput] [ambienttemp] [mmtemp] }
|
||||
For a blade server nodes:
|
||||
renergy noderange [-V] { all | [averageDC] [capability] [cappingvalue] [CPUspeed] [maxCPUspeed] [savingstatus] [dsavingstatus] }
|
||||
renergy noderange [-V] { savingstatus={on | off} | dsavingstatus={on-norm | on-maxp | off} }
|
||||
|
||||
Flex specific :
|
||||
For Flex Management Modules:
|
||||
renergy noderange [-V] { all | [powerstatus] [powerpolicy] [powermodule] [avaiablepower] [reservedpower] [remainpower] [inusedpower] [availableDC] [averageAC] [thermaloutput] [ambienttemp] [mmtemp] }
|
||||
|
||||
For Flex node (power and x86):
|
||||
renergy noderange [-V] { all | [averageDC] [capability] [cappingvalue] [cappingmaxmin] [cappingmax] [cappingmin] [cappingGmin] [CPUspeed] [maxCPUspeed] [savingstatus] [dsavingstatus] }
|
||||
renergy noderange [-V] { cappingstatus={on | off} | cappingwatt=watt | cappingperc=percentage | savingstatus={on | off} | dsavingstatus={on-norm | on-maxp | off} }
|
||||
|
||||
iDataPlex specific :
|
||||
renergy noderange [-V] [ { cappingmaxmin | cappingmax | cappingmin } ] [cappingstatus] [cappingvalue] [relhistogram]
|
||||
renergy noderange [-V] { cappingstatus={on | enable | off | disable} | {cappingwatt|cappingvalue}=watt }",
|
||||
"updatenode" =>
|
||||
"Usage:
|
||||
updatenode [-h|--help|-v|--version]
|
||||
|
||||
+164
-2
@@ -2384,7 +2384,7 @@ sub my_nets
|
||||
my $n = $_->{net};
|
||||
my $if = $_->{mgtifname};
|
||||
my $nm = $_->{mask};
|
||||
if (!$n || !$if || $nm)
|
||||
if (!$n || !$if || !$nm)
|
||||
{
|
||||
next; #incomplete network
|
||||
}
|
||||
@@ -4049,7 +4049,7 @@ sub getSNList
|
||||
$servicenodetab->close;
|
||||
foreach my $node (@nodes)
|
||||
{
|
||||
if ($service eq "") # want all the service nodes
|
||||
if (! defined ($service) || ($service eq "")) # want all the service nodes
|
||||
{
|
||||
push @servicenodes, $node->{node};
|
||||
}
|
||||
@@ -6439,5 +6439,167 @@ sub pingNodeStatus {
|
||||
|
||||
return %status;
|
||||
}
|
||||
=head3 filter_nodes
|
||||
##########################################################################
|
||||
# Fliter the nodes to specific groups
|
||||
# For specific command, figure out the node lists which should be handled by blade.pm, fsp.pm or ipmi.pm
|
||||
# mp group: the nodes will be handled by blade.pm
|
||||
# fsp group: the nodes will be handled by fsp.pm
|
||||
# bmc group: the nodes will be handled by ipmi.pm
|
||||
# For rspconfig network, the NGP ppc blade will be included in the group of mp, othewise in the fsp group
|
||||
# For getmacs -D, the NGP ppc blade will be included in the group of common fsp, otherwise in the mp group
|
||||
# For renergy command, NGP blade will be moved to mp group
|
||||
##########################################################################
|
||||
=cut
|
||||
|
||||
sub filter_nodes{
|
||||
my ($class, $req, $mpnodes, $fspnodes, $bmcnodes, $nohandle) = @_;
|
||||
|
||||
my (@nodes,@args,$cmd);
|
||||
if (defined($req->{'node'})) {
|
||||
@nodes = @{$req->{'node'}};
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
if (defined($req->{'command'})) {
|
||||
$cmd = $req->{'command'}->[0];
|
||||
}
|
||||
if (defined($req->{'arg'})) {
|
||||
@args = @{$req->{'arg'}};
|
||||
}
|
||||
# get the nodes in the mp table
|
||||
my $mptabhash;
|
||||
my $mptab = xCAT::Table->new("mp");
|
||||
if ($mptab) {
|
||||
$mptabhash = $mptab->getNodesAttribs(\@nodes, ['mpa','nodetype']);
|
||||
}
|
||||
|
||||
# get the nodes in the ppc table
|
||||
my $ppctabhash;
|
||||
my $ppctab = xCAT::Table->new("ppc");
|
||||
if ($ppctab) {
|
||||
$ppctabhash = $ppctab->getNodesAttribs(\@nodes,['hcp']);
|
||||
}
|
||||
|
||||
# get the nodes in the ipmi table
|
||||
my $ipmitabhash;
|
||||
my $ipmitab = xCAT::Table->new("ipmi");
|
||||
if ($ipmitab) {
|
||||
$ipmitabhash = $ipmitab->getNodesAttribs(\@nodes,['bmc']);
|
||||
}
|
||||
|
||||
my (@mp, @ngpfsp, @ngpbmc, @commonfsp, @commonbmc, @unknow);
|
||||
|
||||
# if existing in both 'mpa' and 'ppc', a ngp power blade
|
||||
# if existing in both 'mpa' and 'ipmi', a ngp x86 blade
|
||||
# if only in 'ppc', a common power node
|
||||
# if only in 'ipmi', a common x86 node
|
||||
foreach (@nodes) {
|
||||
if (defined ($mptabhash->{$_}->[0]) && defined ($mptabhash->{$_}->[0]->{'mpa'})) {
|
||||
if (defined ($ppctabhash->{$_}->[0]) && defined ($ppctabhash->{$_}->[0]->{'hcp'})) {
|
||||
# flex power node
|
||||
push @ngpfsp, $_;
|
||||
next;
|
||||
} elsif (defined ($ipmitabhash->{$_}->[0]) && defined ($ipmitabhash->{$_}->[0]->{'bmc'})) {
|
||||
# flex x86 node
|
||||
push @ngpbmc, $_;
|
||||
next;
|
||||
}
|
||||
else {
|
||||
# Non flex blade, but blade node
|
||||
push @mp, $_;
|
||||
next;
|
||||
}
|
||||
} elsif (defined ($ppctabhash->{$_}->[0]) && defined ($ppctabhash->{$_}->[0]->{'hcp'})) {
|
||||
# common power node
|
||||
push @commonfsp, $_;
|
||||
} elsif (defined ($ipmitabhash->{$_}->[0]) && defined ($ipmitabhash->{$_}->[0]->{'bmc'})) {
|
||||
# common bmc node
|
||||
push @commonbmc, $_;
|
||||
} else {
|
||||
push @unknow, $_;
|
||||
}
|
||||
}
|
||||
|
||||
push @{$mpnodes}, @mp;#blade.pm
|
||||
push @{$fspnodes}, @commonfsp;
|
||||
push @{$bmcnodes}, @commonbmc;
|
||||
if (@args && ($cmd eq "rspconfig")) {
|
||||
if (!(grep /^(cec_off_policy|pending_power_on_side)/, @args)) {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
if (grep /^(network=)/, @args) {
|
||||
push @{$mpnodes}, @ngpbmc;
|
||||
}
|
||||
} else {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
}
|
||||
} elsif($cmd eq "getmacs") {
|
||||
if (@args && (grep /^-D$/,@args)) {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
} else {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
}
|
||||
} elsif ($cmd eq "rvitals") {
|
||||
if (@args && (grep /^lcds$/,@args)) {
|
||||
push @{$fspnodes},@ngpfsp;
|
||||
} else {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
}
|
||||
} elsif ($cmd eq "renergy") {
|
||||
push @{$mpnodes}, @ngpbmc;
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
} else {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
}
|
||||
|
||||
push @{$nohandle}, @unknow;
|
||||
|
||||
## TRACE_LINE print "Nodes filter: nodetype [commp:@mp,ngpp:@ngpfsp,comfsp:@commonfsp]. mpnodes [@{$mpnodes}], fspnodes [@{$fspnodes}], bmcnodes [@{$bmcnodes}]\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub version_cmp {
|
||||
my $ver_a = shift;
|
||||
if ($ver_a =~ /xCAT::Utils/)
|
||||
{
|
||||
$ver_a = shift;
|
||||
}
|
||||
my $ver_b = shift;
|
||||
my @array_a = ($ver_a =~ /([-.]|\d+|[^-.\d])/g);
|
||||
my @array_b = ($ver_b =~ /([-.]|\d+|[^-.\d])/g);
|
||||
|
||||
my ($a, $b);
|
||||
my $len_a = @array_a;
|
||||
my $len_b = @array_b;
|
||||
my $len = $len_a;
|
||||
if ( $len_b < $len_a ) {
|
||||
$len = $len_b;
|
||||
}
|
||||
for ( my $i = 0; $i < $len; $i++ ) {
|
||||
$a = $array_a[$i];
|
||||
$b = $array_b[$i];
|
||||
if ($a eq $b) {
|
||||
next;
|
||||
} elsif ( $a eq '-' ) {
|
||||
return -1;
|
||||
} elsif ( $b eq '-') {
|
||||
return 1;
|
||||
} elsif ( $a eq '.' ) {
|
||||
return -1;
|
||||
} elsif ( $b eq '.' ) {
|
||||
return 1;
|
||||
} elsif ($a =~ /^\d+$/ and $b =~ /^\d+$/) {
|
||||
if ($a =~ /^0/ || $b =~ /^0/) {
|
||||
return ($a cmp $b);
|
||||
} else {
|
||||
return ($a <=> $b);
|
||||
}
|
||||
} else {
|
||||
$a = uc $a;
|
||||
$b = uc $b;
|
||||
return ($a cmp $b);
|
||||
}
|
||||
}
|
||||
return ( $len_a <=> $len_b )
|
||||
}
|
||||
1;
|
||||
|
||||
@@ -49,9 +49,11 @@ require Exporter;
|
||||
"1305067911.467189" => "rhels6.1", #ppc64
|
||||
"1321546114.510099" => "rhels6.2", #x86_64
|
||||
"1321546739.676170" => "rhels6.2", #ppc64
|
||||
"1339641244.734735" => "rhels6.3", #ppc64
|
||||
"1339640147.274118" => "rhels6.3", #x86_64
|
||||
"1339638991.532890" => "rhels6.3", #i386
|
||||
"1339641244.734735" => "rhels6.3", #ppc64
|
||||
"1339640147.274118" => "rhels6.3", #x86_64
|
||||
"1339638991.532890" => "rhels6.3", #i386
|
||||
"1359576752.435900" => "rhels6.4", #x86_64
|
||||
"1359576196.686790" => "rhels6.4", #ppc64
|
||||
"1285193176.593806" => "rhelhpc6",
|
||||
"1194015916.783841" => "fedora8",
|
||||
"1194015385.299901" => "fedora8",
|
||||
|
||||
@@ -1,132 +1,18 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# xCAT postscript to configure GPFS on a compute node.
|
||||
# Before booting nodes with this postscript, gpfs must be up and configured correctly on the node
|
||||
# pointed to by the -p flag below. The $MASTER environment variable will be set by xCAT to
|
||||
# the service node or management node of this booting node. If you want the nodes to get their
|
||||
# GPFS configuration from a different node, replace $MASTER with that IP address.
|
||||
|
||||
# Run this script to sync the GPFS mmsdrfs file into the node images
|
||||
# Set the SOURCE, TARGETDIR, IMAGE, and SERVICE variables appropriately
|
||||
cmd="/usr/lpp/mmfs/bin/mmsdrrestore -p $MASTER -R /usr/bin/scp"
|
||||
$cmd > /dev/null 2>&1
|
||||
|
||||
# Usage: gpfs_mmsdrfs [packimage|liteimg] [syncinstall]
|
||||
# For Linux, if packimage or liteimg specified,
|
||||
# will run that command for the image if rsync updated any
|
||||
# destination files
|
||||
# If syncinstall specified, and if site.install_loc is blank,
|
||||
# sync the /install directory to the SERVICE noderange
|
||||
# if rysnc updated any destination files
|
||||
#
|
||||
# To keep your diskless images current with any GPFS changes, run this
|
||||
# script periodically from cron using the packimage/liteimg and
|
||||
# syncinstall options as required by your cluster
|
||||
#
|
||||
|
||||
# The source server:location of the mmsdrfs file. Default is this xCAT MN.
|
||||
#SOURCE=gpfsmgr:/var/mmfs/gen/mmsdrfs
|
||||
SOURCE=/var/mmfs/gen/mmsdrfs
|
||||
|
||||
# The target directory on the xCAT MN that holds the master copy
|
||||
TARGETDIR=/install/mmfs/gen
|
||||
|
||||
# The noderange for service nodes
|
||||
SERVICE=service
|
||||
|
||||
# The images to be updated (list as many as needed)
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
# EDIT HERE TO SPECIFY IMAGES TO BE UPDATED!!!
|
||||
# default is to update all images !!!
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
IMAGE[1]=ALL_IMAGES
|
||||
#IMAGE[1]=sles11-ppc64-netboot-service
|
||||
#IMAGE[2]=sles11-ppc64-netboot-compute
|
||||
|
||||
|
||||
|
||||
|
||||
# If $installroot is set, then this script was called from genimage
|
||||
# Ignore all IMAGE variables and only rsync to $installroot
|
||||
if [[ ! -z "$installroot" ]]; then
|
||||
OS=`uname`
|
||||
if [[ "$OS" != "AIX" ]]; then
|
||||
rsync -i -t $SOURCE $installroot/var/mmfs/gen/mmsdrfs
|
||||
exit
|
||||
fi
|
||||
if [[ $? != 0 ]]
|
||||
then
|
||||
echo "mmsdrrestore failed!"
|
||||
exit 2
|
||||
else
|
||||
echo "mmsdrrestore succeeded"
|
||||
fi
|
||||
|
||||
|
||||
# rsync the GPFS config file to the MN
|
||||
# DEVELOPER NOTE: Keep all code above this rsync call as short
|
||||
# and efficient as possible.
|
||||
# This script may be frequently called from cron.
|
||||
if [ ! -d $TARGETDIR ]; then
|
||||
mkdir -p $TARGETDIR
|
||||
fi
|
||||
result=`rsync -i -t $SOURCE $TARGETDIR/mmsdrfs`
|
||||
r1=`echo $result | cut -c1`
|
||||
if [ "$r1" == ">" ]; then
|
||||
OS=`uname`
|
||||
packcmd=""
|
||||
syncinstall=""
|
||||
if [ "$1" == "packimage" ] || [ "$1" == "liteimg" ]; then
|
||||
packcmd=$1
|
||||
fi
|
||||
if [ "$1" == "syncinstall" ] || [ "$2" == "syncinstall" ]; then
|
||||
if [ -z "`/opt/xcat/bin/nodels $SERVICE`" ]; then
|
||||
SERVICE=""
|
||||
fi
|
||||
installloc=`/opt/xcat/bin/gettab key=installloc site.value`
|
||||
if [ -z "$installloc" ]; then
|
||||
syncinstall="yes"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "${IMAGE[1]}" || "${IMAGE[1]}" == "ALL_IMAGES" ]]; then
|
||||
if [ $OS = "AIX" ]; then
|
||||
imgtable="nimimage"
|
||||
else
|
||||
imgtable="linuximage"
|
||||
fi
|
||||
IMAGE=(`tabdump $imgtable | cut -d, -f1 | grep -v '#' | tr -d '"'`)
|
||||
fi
|
||||
if [ $OS = "AIX" ]; then
|
||||
# do AIX stuff
|
||||
updates=""
|
||||
for syncimage in ${IMAGE[@]}; do
|
||||
spot=`/opt/xcat/bin/gettab imagename=$syncimage nimimage.spot`
|
||||
if [ -n "$spot" ]; then
|
||||
dest=`lsnim -Z -a location $spot | grep -v '#' | cut -f2 -d':' `
|
||||
if [ -n "$dest" ]; then
|
||||
mkdir -p $dest/lpp/bos/inst_root/var/mmfs/gen
|
||||
cp $TARGETDIR/mmsdrfs $dest/lpp/bos/inst_root/var/mmfs/gen/mmsdrfs
|
||||
if [[ -n "$syncinstall" && -n "$SERVICE" ]]; then
|
||||
/opt/xcat/bin/xdcp $SERVICE $TARGETDIR/mmsdrfs $dest/lpp/bos/inst_root/var/mmfs/gen
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
shared_root=`/opt/xcat/bin/gettab imagename=$syncimage nimimage.shared_root`
|
||||
if [ -n "$shared_root" ]; then
|
||||
dest=`lsnim -Z -a location $shared_root | grep -v '#' | cut -f2 -d':' `
|
||||
if [ -n "$dest" ]; then
|
||||
mkdir -p $dest/var/mmfs/gen
|
||||
cp $TARGETDIR/mmsdrfs $dest/var/mmfs/gen/mmsdrfs
|
||||
if [[ -n "$syncinstall" && -n "$SERVICE" ]]; then
|
||||
/opt/xcat/bin/xdcp $SERVICE $TARGETDIR/mmsdrfs $dest/var/mmfs/gen
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
else # do Linux stuff
|
||||
updates=""
|
||||
for syncimage in ${IMAGE[@]}; do
|
||||
dest=`/opt/xcat/bin/gettab imagename=$syncimage linuximage.rootimgdir`
|
||||
if [ -n "$dest" ]; then
|
||||
dest=$dest/rootimg/var/mmfs/gen/mmsdrfs
|
||||
cp $TARGETDIR/mmsdrfs $dest
|
||||
if [ -n "$packcmd" ]; then
|
||||
updates="yes"
|
||||
/opt/xcat/sbin/$packcmd $syncimage
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$updates" ] && [ -n "$syncinstall" ] && [ -n "$SERVICE" ]; then
|
||||
xdcp $SERVICE -r /usr/bin/rsync -o '-e ssh -craz' /install/netboot /install/netboot
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -105,10 +105,10 @@ else # assume Linux
|
||||
echo 'export PATH=$PATH:/usr/lpp/mmfs/bin' > $gpfsprofile.sh
|
||||
echo 'setenv PATH $PATH:/usr/lpp/mmfs/bin' > $gpfsprofile.csh
|
||||
# Turn off LANG support since we did not install other msg catalogs
|
||||
echo 'export LC_CTYPE=POSIX' > $gpfsprofile.sh
|
||||
echo 'setenv LC_CTYPE POSIX' > $gpfsprofile.csh
|
||||
echo 'export LC_ALL=POSIX' > $gpfsprofile.sh
|
||||
echo 'setenv LC_ALL POSIX' > $gpfsprofile.csh
|
||||
echo 'export LC_CTYPE=POSIX' >> $gpfsprofile.sh
|
||||
echo 'setenv LC_CTYPE POSIX' >> $gpfsprofile.csh
|
||||
echo 'export LC_ALL=POSIX' >> $gpfsprofile.sh
|
||||
echo 'setenv LC_ALL POSIX' >> $gpfsprofile.csh
|
||||
chmod 744 $gpfsprofile.sh
|
||||
chmod 744 $gpfsprofile.csh
|
||||
fi
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#image,file,options,comments,disable
|
||||
"ALL","/var/mmfs/","persistent","for GPFS",
|
||||
"ALL","/var/mmfs/","tmpfs","for GPFS",
|
||||
"ALL","/var/adm/ras/","persistent","for GPFS",
|
||||
"ALL","/gpfs/",,"for GPFS",
|
||||
|
||||
|
@@ -0,0 +1,10 @@
|
||||
./opt/ibmhpc/lapi/include*
|
||||
./opt/ibmhpc/lapi/pnsd/include*
|
||||
./opt/ibmhpc/lapi/samples*
|
||||
|
||||
./opt/ibmhpc/pecurrent/ppe.poe/include*
|
||||
./opt/ibmhpc/pecurrent/ppe.poe/man/*
|
||||
./opt/ibmhpc/pecurrent/ppe.poe/samples*
|
||||
./opt/ibmhpc/pecurrent/hal/include*
|
||||
./etc/opt/ibmhpc/license/*.txt
|
||||
|
||||
@@ -13,6 +13,7 @@ package xCAT_plugin::webportal;
|
||||
use strict;
|
||||
require xCAT::Utils;
|
||||
require xCAT::MsgUtils;
|
||||
require xCAT::zvmUtils;
|
||||
require xCAT::DBobjUtils;
|
||||
require IO::Socket::INET;
|
||||
use Getopt::Long;
|
||||
|
||||
+84
-12
@@ -30,10 +30,7 @@ BEGIN
|
||||
# if AIX - make sure we include perl 5.8.2 in INC path.
|
||||
# Needed to find perl dependencies shipped in deps tarball.
|
||||
if ($^O =~ /^aix/i) {
|
||||
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/5.8.2";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2";
|
||||
unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2));
|
||||
}
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
@@ -56,6 +53,7 @@ $::command = "$0 $args";
|
||||
Getopt::Long::Configure("bundling");
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
$::installdir = "/usr/local/mysql"; # current release of xcat-mysql
|
||||
$::debianflag = 0;
|
||||
|
||||
#$::installdir="/opt/xcat/mysql"; # next release of xcat-mysql
|
||||
|
||||
@@ -144,6 +142,9 @@ else
|
||||
$::osname = 'Linux';
|
||||
}
|
||||
|
||||
if ( -e "/etc/debian_version" ){
|
||||
$::debianflag = 1;
|
||||
}
|
||||
# determine whether redhat or sles
|
||||
$::linuxos = xCAT::Utils->osver();
|
||||
|
||||
@@ -151,6 +152,9 @@ $::linuxos = xCAT::Utils->osver();
|
||||
# check to see if mysql is installed
|
||||
#
|
||||
my $cmd = "rpm -qa | grep mysql";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "dpkg -l | grep mysql-server";
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
@@ -186,7 +190,7 @@ if (-e ("/etc/xcat/cfgloc")) # check to see if xcat is using mysql
|
||||
if ($::INIT)
|
||||
{
|
||||
my $message =
|
||||
"The /etc/xcat/cfgloc file is already configured for MySQL. xcat database initialization will not take place.";
|
||||
"The /etc/xcat/cfgloc file is already configured for MySQL and xCAT is using mysql as it's database. No xCAT setup is required.";
|
||||
xCAT::MsgUtils->message("I", "$message");
|
||||
}
|
||||
$::xcatrunningmysql = 1;
|
||||
@@ -201,27 +205,48 @@ if ($::osname eq 'AIX')
|
||||
&setulimits;
|
||||
}
|
||||
|
||||
# if not just odbc update
|
||||
# if not just odbc update and not already running mysql
|
||||
# Get root and admin passwords
|
||||
#
|
||||
if ($odbconly == 0)
|
||||
if (($odbconly == 0) && ( $::xcatrunningmysql == 0))
|
||||
{ # not just updating the odbc
|
||||
if ($ENV{'XCATMYSQLADMIN_PW'}) # input env sets the password
|
||||
{
|
||||
my $pw= $ENV{'XCATMYSQLADMIN_PW'};
|
||||
if ($pw =~ m/[^a-zA-Z0-9]/){ # if not alpha-numerid
|
||||
my $warning =
|
||||
" The password in the env variable XCATMYSQLADMIN_PW is not alpha-numeric.";
|
||||
xCAT::MsgUtils->message("E", $warning);
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$::adminpassword = $ENV{'XCATMYSQLADMIN_PW'};
|
||||
|
||||
}
|
||||
else # prompt for password
|
||||
{
|
||||
my $msg = "Input the password for xcatadmin in the MySQL database: ";
|
||||
my $msg = "Input the alpha-numberic password for xcatadmin in the MySQL database: ";
|
||||
xCAT::MsgUtils->message('I', "$msg");
|
||||
`stty -echo`;
|
||||
chop($::adminpassword = <STDIN>);
|
||||
`stty echo`;
|
||||
|
||||
if ($::adminpassword =~ m/[^a-zA-Z0-9]/){ # if not alpha-numerid
|
||||
my $warning =
|
||||
"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password.";
|
||||
xCAT::MsgUtils->message("E", $warning);
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
if ($ENV{'XCATMYSQLROOT_PW'}) # input env sets the password
|
||||
{
|
||||
my $pw= $ENV{'XCATMYSQLROOT_PW'};
|
||||
if ($pw =~ m/[^a-zA-Z0-9]/){ # if not alpha-numerid
|
||||
my $warning =
|
||||
" The password in the env variable XCATMYSQLROOT_PW is not alpha-numeric.";
|
||||
xCAT::MsgUtils->message("E", $warning);
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$::rootpassword = $ENV{'XCATMYSQLROOT_PW'};
|
||||
|
||||
@@ -234,12 +259,19 @@ if ($odbconly == 0)
|
||||
`stty -echo`;
|
||||
chop($::rootpassword = <STDIN>);
|
||||
`stty echo`;
|
||||
|
||||
if ($::rootpassword =~ m/[^a-zA-Z0-9]/){ # if not alpha-numerid
|
||||
my $warning =
|
||||
"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password.";
|
||||
xCAT::MsgUtils->message("E", $warning);
|
||||
exit 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
# initial setup request
|
||||
if ($::INIT)
|
||||
# initial setup request, if not already running mysql
|
||||
if (($::INIT) && ($::xcatrunningmysql == 0))
|
||||
{
|
||||
|
||||
#
|
||||
@@ -775,6 +807,17 @@ sub initmysqldb
|
||||
}
|
||||
} # end AIX only
|
||||
|
||||
#on debian/ubuntu should comment the bind-adress line in my.cnf
|
||||
if ( $::debianflag ){
|
||||
$cmd = "sed 's/\\(^\\s*bind.*\\)/#\\1/' /etc/mysql/my.cnf > /tmp/my.cnf; mv -f /tmp/my.cnf /etc/mysql/my.cnf;chmod 644 /etc/mysql/my.cnf";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("E", " comment the bind-address line in /etc/mysql/my.cfg failed: $cmd.");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
# Create the MySQL data directory and initialize the grant tables
|
||||
# if not already setup
|
||||
my $cmd2 =
|
||||
@@ -844,12 +887,15 @@ sub mysqlstart
|
||||
}
|
||||
|
||||
# make sure running
|
||||
$cmd = "ps -ef | grep mysqld";
|
||||
$cmd = "ps -ef | grep mysqld | grep -v grep";
|
||||
my $i;
|
||||
for ($i = 0 ; $i < 12 ; $i++)
|
||||
{
|
||||
my @output = xCAT::Utils->runcmd($cmd, 0);
|
||||
my $mysqlcheck = "--datadir"; # see if really running
|
||||
if ( $::debianflag ){
|
||||
$mysqlcheck = "mysqld";
|
||||
}
|
||||
if (grep(/$mysqlcheck/, @output))
|
||||
{
|
||||
sleep 10; # give a few extra seconds to be sure
|
||||
@@ -934,6 +980,9 @@ sub mysqlreboot
|
||||
else
|
||||
{ # sles
|
||||
$cmd = "chkconfig mysql on";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "update-rc.d mysql defaults";
|
||||
}
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
@@ -1376,6 +1425,9 @@ sub setupODBC
|
||||
#
|
||||
# for all OS need unixODBC rpm
|
||||
my $cmd = "rpm -qa | grep unixODBC";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "dpkg -l | grep unixodbc";
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
@@ -1398,6 +1450,16 @@ sub setupODBC
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
elsif ( $::debianflag ){
|
||||
$cmd = "dpkg -l | grep libmyodbc";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $message = "\nlibmyodbc is not installed.";
|
||||
xCAT::MsgUtils->message("E", " $cmd failed. $message");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else # sles
|
||||
{
|
||||
$cmd = "rpm -qa | grep mysql-client";
|
||||
@@ -1471,6 +1533,12 @@ sub setupODBC
|
||||
$cmd = "rpm -ql mysql-connector-odbc | grep libmyodbc..so";
|
||||
@rpmoutput = xCAT::Utils->runcmd($cmd, 0);
|
||||
}
|
||||
elsif ( $::debianflag ){
|
||||
$odbcinstfile = "/etc/odbcinst.ini";
|
||||
$odbcfile = "/etc/odbc.ini";
|
||||
$cmd = "dpkg -L libmyodbc | grep libmyodbc.so";
|
||||
@rpmoutput = xCAT::Utils->runcmd($cmd, 0);
|
||||
}
|
||||
else
|
||||
{ #sles
|
||||
$odbcinstfile = "/etc/unixODBC/odbcinst.ini ";
|
||||
@@ -1551,7 +1619,7 @@ sub setupODBC
|
||||
if ($::RUNCMD_RC != 0) # then xcat entry not there
|
||||
{
|
||||
my $entry =
|
||||
"[xCATDB]\nSERVER =$server\nDATABASE = xcatdb\nUSER = xcatadmin\nPASSWORD = $passwd";
|
||||
"[xCATDB]\nSERVER =$server\nDATABASE = xcatdb\nUSER = $adminid\nPASSWORD = $passwd";
|
||||
$cmd = "echo \"$entry\" >> $rootodbcfile";
|
||||
# secure passwd in verbose mode
|
||||
my $tmpv = $::VERBOSE;
|
||||
@@ -1692,7 +1760,11 @@ sub restorexcatdb
|
||||
|
||||
# restore it
|
||||
my $cmd = "XCATBYPASS=y XCATCFG=\"$xcatcfg\" restorexCATdb -p $::backupdir";
|
||||
# not display passwords in verbose mode
|
||||
my $tmpv = $::VERBOSE;
|
||||
$::VERBOSE = 0;
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
$::VERBOSE = $tmpv;
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("E", " $cmd failed.");
|
||||
|
||||
Executable
+393
@@ -0,0 +1,393 @@
|
||||
#!/usr/bin/perl
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
# Run the asu64 utility out of band to multiple nodes, either sequentially or in parallel
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr';
|
||||
}
|
||||
use strict;
|
||||
close(STDIN);
|
||||
open(STDIN,"<","/dev/null");
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use IO::Socket::SSL;
|
||||
use XML::Simple;
|
||||
$XML::Simple::PREFERRED_PARSER='XML::Parser';
|
||||
use Data::Dumper;
|
||||
use IO::Handle;
|
||||
use IO::Select;
|
||||
use xCAT::Utils;
|
||||
use Getopt::Long;
|
||||
use POSIX qw(:signal_h :errno_h :sys_wait_h);
|
||||
use Thread qw(yield);
|
||||
$::asucmd = '/opt/ibm/toolscenter/asu/asu64';
|
||||
my $interface;
|
||||
my $username;
|
||||
my $passwd;
|
||||
my $fanout;
|
||||
my $batchfile;
|
||||
my $help;
|
||||
Getopt::Long::Configure("require_order");
|
||||
Getopt::Long::Configure("bundling");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions(
|
||||
"i|interface=s" => \$interface,
|
||||
"p|passwd=s" => \$passwd,
|
||||
'l|loginname=s' => \$username,
|
||||
'f|fanout=i' => \$fanout,
|
||||
'b|batch=s' => \$batchfile,
|
||||
'r|retry' => \$::RETRY,
|
||||
'd|donotfilter' => \$::DONOTFILTER,
|
||||
"n|nonodecheck" => \$::NONODECHECK, #does not check the noderange, in this case, noderange need to be a simple list of nodes.
|
||||
"V|verbose" => \$::VERBOSE,
|
||||
'h|help' => \$help,
|
||||
) || $help || ($batchfile && scalar(@ARGV)!=1) || (!$batchfile && scalar(@ARGV)<2) ) {
|
||||
print "Usage: pasu [-V] [-d] [-n] [-i <hostname-suffix>] [-l <user>] [-p <passwd>] [-f <fanout>] <noderange> <command>\n";
|
||||
print " pasu [-V] [-d] [-n] [-i <hostname-suffix>] [-l <user>] [-p <passwd>] [-f <fanout>] -b <batchfile> <noderange>\n";
|
||||
exit;
|
||||
}
|
||||
my %nodehdl;
|
||||
my $xcathost='localhost:3001';
|
||||
my $pasumaxp = 64;
|
||||
if ($ENV{XCATHOST}) {
|
||||
$xcathost=$ENV{XCATHOST};
|
||||
}
|
||||
if ($ENV{XCATPSHFANOUT}) {
|
||||
$pasumaxp=$ENV{XCATPSHFANOUT};
|
||||
}
|
||||
if ($fanout) { # see if they overroad the fanout from the command line
|
||||
$pasumaxp=$fanout;
|
||||
}
|
||||
my $noderange = shift @ARGV;
|
||||
my @nodes=();
|
||||
|
||||
#print "fanout=$fanout, username=$username, noderange=$noderange\n";
|
||||
|
||||
my $nodeattrs;
|
||||
if ($::NONODECHECK) {
|
||||
@nodes=split(/,/, $noderange);
|
||||
}
|
||||
else { # contact xcatd to expand noderange and get ipmi attrs
|
||||
# do not need to do this call, because getting the ipmi atts will also give us a list of nodes
|
||||
#@nodes = expandnoderange($noderange);
|
||||
|
||||
# this is reference to a hash, each key is the nodename and the value is a reference to a hash of attr values
|
||||
$nodeattrs = getipmiattrs($noderange);
|
||||
#print Dumper($nodeattrs);
|
||||
#foreach my $k (keys(%$nodeattrs)) {
|
||||
# print "$k:\n";
|
||||
# my $subhash = $nodeattrs->{$k};
|
||||
# foreach my $k2 (keys(%$subhash)) { print " $k2=", $subhash->{$k2}, "\n"; }
|
||||
#}
|
||||
#exit;
|
||||
@nodes = keys(%$nodeattrs);
|
||||
}
|
||||
|
||||
my ($defaultuser, $defaultpw);
|
||||
if (!defined($username) || !defined($passwd)) {
|
||||
($defaultuser, $defaultpw) = getdefaultcredentials();
|
||||
#if (!defined($username)) { $username = $user; }
|
||||
#if (!defined($passwd)) { $passwd = $pw; }
|
||||
if ($::VERBOSE) { print "default username=$defaultuser, passwd=$defaultpw\n"; }
|
||||
}
|
||||
|
||||
my $children = 0;
|
||||
my $inputs = new IO::Select;
|
||||
my %pids; # pid => node
|
||||
my %exitcodes; # Keep a list of children with known exit codes
|
||||
my %foundcodes;
|
||||
my @retries; # the nodes that fail with connection error
|
||||
|
||||
if ($interface) {
|
||||
foreach (@nodes) {
|
||||
s/$/-$interface/;
|
||||
}
|
||||
}
|
||||
|
||||
# Fork the processes for running asu for each node
|
||||
#todo: i thought we would need retry logic because i thought asu had problems running
|
||||
# in parallel. So far (up to 24 nodes) have not had any problem, but keeping the
|
||||
# logic in just in case.
|
||||
@retries = @nodes;
|
||||
while (scalar(@retries)) {
|
||||
@nodes = @retries;
|
||||
@retries = ();
|
||||
foreach (@nodes) {
|
||||
my $node=$_;
|
||||
my $ipmiattrs = $nodeattrs->{$node};
|
||||
my $bmc = $ipmiattrs->{bmc};
|
||||
if (!defined($bmc)) {
|
||||
print "$node: the ipmi.bmc attribute is not defined, skipping.\n";
|
||||
next;
|
||||
}
|
||||
|
||||
# if we have already forked the max # of simultaneous processes, wait till 1 finishes
|
||||
while ($children > $pasumaxp) { processoutput($inputs); }
|
||||
|
||||
# fork anothe process
|
||||
my $child;
|
||||
$children++;
|
||||
# precedence on the username and password is: cli option, ipmi table, passwd table
|
||||
my ($user, $pw);
|
||||
if (defined($username)) { $user = $username; } # cli option
|
||||
elsif (defined($ipmiattrs->{username})) { $user = $ipmiattrs->{username}; }
|
||||
else { $user = $defaultuser; }
|
||||
if (defined($passwd)) { $pw = $passwd; } # cli option
|
||||
elsif (defined($ipmiattrs->{password})) { $pw = $ipmiattrs->{password}; }
|
||||
else { $pw = $defaultpw; }
|
||||
if ($::VERBOSE) { print "For node $node using bmc=$bmc, user=$user, pw=$pw\n"; }
|
||||
#asunode(\$child,$node,$username,$passwd,@ARGV[1 .. $#ARGV]);
|
||||
asunode(\$child,$node,$bmc,$user,$pw,$batchfile,@ARGV); # child is the fd of the child process
|
||||
$inputs->add($child);
|
||||
$nodehdl{$child} = $node;
|
||||
}
|
||||
|
||||
# quiesce everything
|
||||
while ($inputs->count) {
|
||||
processoutput($inputs);
|
||||
}
|
||||
while (processoutput($inputs)) {};
|
||||
while (wait != -1) {
|
||||
yield;
|
||||
}
|
||||
}
|
||||
|
||||
my $exitcode=0;
|
||||
foreach (values %pids) {
|
||||
my $possible_codes = join ",",keys %foundcodes;
|
||||
unless (defined $exitcodes{$_}) {
|
||||
print stderr "$_: *** pasu missed exit code, probably one of the following: $possible_codes\n";
|
||||
}
|
||||
}
|
||||
foreach (keys %exitcodes) {
|
||||
if ($exitcodes{$_}) {
|
||||
print stderr "$_: *** asu exited with error code ".$exitcodes{$_}.".\n";
|
||||
$exitcode++;
|
||||
}
|
||||
}
|
||||
if ($exitcode) { #Exit code reflects number of failed nodes
|
||||
$exitcode=$exitcode%256; #keep from overflowing valid values
|
||||
unless ($exitcode) { #if number of failed nodes happened to be evenly divisible by 256, make it non-zero again
|
||||
$exitcode++;
|
||||
}
|
||||
}
|
||||
exit($exitcode);
|
||||
|
||||
# Process output on the select stmt from the forked cmds
|
||||
sub processoutput { #This way, one arbiter handles output, no interrupting
|
||||
my $inputs = shift; # the select object that contains all the file descriptors
|
||||
my @readyins = $inputs->can_read(1); # child fds with some output available
|
||||
my $rc = @readyins;
|
||||
my $readyh;
|
||||
foreach $readyh (@readyins) {
|
||||
my $cursel = new IO::Select; # need to do non-blocking reads on this fd
|
||||
$cursel->add($readyh);
|
||||
while ($cursel->can_read(0)) {
|
||||
my $line = <$readyh>;
|
||||
unless ($line) {
|
||||
$inputs->remove($readyh);
|
||||
close($readyh);
|
||||
$exitcodes{$nodehdl{$readyh}} = $? >> 8;
|
||||
$children--;
|
||||
next;
|
||||
}
|
||||
chomp($line);
|
||||
if ($::RETRY && ($line =~ /Connection link error/i) ) {
|
||||
if ($::VERBOSE) { print "Need to retry $nodehdl{$readyh}\n"; }
|
||||
push @retries, $nodehdl{$readyh};
|
||||
} elsif ($::DONOTFILTER || ($line!~/IBM Advanced Settings Utility version/i &&
|
||||
$line!~/Licensed Materials - Property of IBM/i &&
|
||||
$line!~/\(C\) Copyright IBM Corp. \d+-\d+ All Rights Reserved/i &&
|
||||
$line!~/Connected to IMM at IP address/i )) {
|
||||
print $nodehdl{$readyh}.": ".$line."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
no strict 'subs';
|
||||
IO::Handle::flush(stdout);
|
||||
use strict 'subs';
|
||||
yield; #Explicitly give all children a chance to refill any buffers
|
||||
return $rc;
|
||||
}
|
||||
|
||||
# Fork the asu cmd for 1 node
|
||||
sub asunode {
|
||||
my $out = shift; # this is a reference to the child file descriptor
|
||||
my $node = shift;
|
||||
my $bmc = shift;
|
||||
my $username = shift;
|
||||
my $passwd = shift;
|
||||
my $batchfile = shift;
|
||||
my $args;
|
||||
if ($batchfile) {
|
||||
$args = "batch $batchfile";
|
||||
} else {
|
||||
foreach my $a (@_) { $args .= ' ' . xCAT::Utils->quote($a); }
|
||||
}
|
||||
my $cmd = "$::asucmd $args --host $bmc --user $username --password $passwd 2>&1 |";
|
||||
if ($::VERBOSE) { print "forking $cmd\n"; }
|
||||
my $pid = open($$out, $cmd);
|
||||
$pids{$pid} = $node;
|
||||
}
|
||||
|
||||
# Contact xcatd to expand the noderange into a list of nodes
|
||||
sub expandnoderange {
|
||||
my $noderange = shift @_;
|
||||
my @nodes;
|
||||
my @user = getpwuid($>);
|
||||
my $homedir=$user[7];
|
||||
my $client = IO::Socket::SSL->new(
|
||||
PeerAddr=>$xcathost,
|
||||
SSL_key_file=>$homedir."/.xcat/client-cred.pem",
|
||||
SSL_cert_file=>$homedir."/.xcat/client-cred.pem",
|
||||
SSL_ca_file => $homedir."/.xcat/ca.pem",
|
||||
SSL_use_cert => 1,
|
||||
#SSL_verify_mode => 1,
|
||||
);
|
||||
die "Connection failure: $!\n" unless ($client);
|
||||
#todo: get the bmc attr for each node, not the node name itself
|
||||
my %cmdref = (command => 'noderange', noderange => $noderange);
|
||||
$SIG{ALRM} = sub { die "No response getting noderange" };
|
||||
alarm(15);
|
||||
my $msg = XMLout(\%cmdref,RootName=>'xcatrequest', NoAttr=>1, KeyAttr => []);
|
||||
if ($ENV{XCATXMLTRACE}) { print $msg; }
|
||||
print $client $msg;
|
||||
alarm(15);
|
||||
my $response="";
|
||||
while (<$client>) {
|
||||
alarm(0);
|
||||
$response .= $_;
|
||||
if ($response =~ m/<\/xcatresponse>/) {
|
||||
if ($ENV{XCATXMLTRACE}) { print $response; }
|
||||
my $rsp=XMLin($response, ForceArray => ['node']);
|
||||
$response='';
|
||||
if ($rsp->{warning}) {
|
||||
printf "Warning: ".$rsp->{warning}."\n";
|
||||
}
|
||||
if ($rsp->{error}) {
|
||||
die ("ERROR: ".$rsp->{error}."\n");
|
||||
} elsif ($rsp->{node}) {
|
||||
@nodes=@{$rsp->{node}};
|
||||
}
|
||||
if ($rsp->{serverdone}) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
close($client);
|
||||
if ($::VERBOSE) { print 'Nodes:', join(',',@nodes), "\n"; }
|
||||
return @nodes;
|
||||
}
|
||||
|
||||
# Contact xcatd to get from the ipmi table for this list of nodes: bmc, username, password
|
||||
sub getipmiattrs {
|
||||
my $noderange = shift @_;
|
||||
my $nodeattrs; # this will be a reference to a hash
|
||||
my @user = getpwuid($>);
|
||||
my $homedir=$user[7];
|
||||
my $client = IO::Socket::SSL->new(
|
||||
PeerAddr=>$xcathost,
|
||||
SSL_key_file=>$homedir."/.xcat/client-cred.pem",
|
||||
SSL_cert_file=>$homedir."/.xcat/client-cred.pem",
|
||||
SSL_ca_file => $homedir."/.xcat/ca.pem",
|
||||
SSL_use_cert => 1,
|
||||
#SSL_verify_mode => 1,
|
||||
);
|
||||
die "Connection failure: $!\n" unless ($client);
|
||||
my %cmdref = (command => 'getNodesAttribs', noderange => $noderange, table => 'ipmi');
|
||||
push (@{$cmdref{attr}}, qw(bmc username password));
|
||||
$SIG{ALRM} = sub { die "No response getting ipmi attributes" };
|
||||
alarm(15);
|
||||
my $msg = XMLout(\%cmdref,RootName=>'xcatrequest', NoAttr=>1, KeyAttr => []);
|
||||
if ($ENV{XCATXMLTRACE}) { print $msg; }
|
||||
print $client $msg;
|
||||
alarm(15);
|
||||
my $response="";
|
||||
while (<$client>) {
|
||||
alarm(0);
|
||||
$response .= $_;
|
||||
if ($response =~ m/<\/xcatresponse>/) {
|
||||
if ($ENV{XCATXMLTRACE}) { print $response; }
|
||||
my $rsp=XMLin($response, ForceArray => ['node']);
|
||||
$response='';
|
||||
if ($rsp->{warning}) {
|
||||
printf "Warning: ".$rsp->{warning}."\n";
|
||||
}
|
||||
if ($rsp->{error}) {
|
||||
die ("ERROR: ".$rsp->{error}."\n");
|
||||
} elsif ($rsp->{node}) {
|
||||
#print Dumper($rsp->{node});
|
||||
$nodeattrs=$rsp->{node}; # this is reference to a hash, each key is the nodename and the value is a reference to a hash of attr values
|
||||
}
|
||||
if ($rsp->{serverdone}) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
close($client);
|
||||
#if ($::VERBOSE) { print 'Nodes:', join(',',$nodeattrs), "\n"; }
|
||||
return $nodeattrs;
|
||||
}
|
||||
|
||||
# Contact xcatd to get the default user/pw for ipmi in the xcat passwd table
|
||||
sub getdefaultcredentials {
|
||||
my @data;
|
||||
my @user = getpwuid($>);
|
||||
my $homedir=$user[7];
|
||||
my $client = IO::Socket::SSL->new(
|
||||
PeerAddr=>$xcathost,
|
||||
SSL_key_file=>$homedir."/.xcat/client-cred.pem",
|
||||
SSL_cert_file=>$homedir."/.xcat/client-cred.pem",
|
||||
SSL_ca_file => $homedir."/.xcat/ca.pem",
|
||||
SSL_use_cert => 1,
|
||||
#SSL_verify_mode => 1,
|
||||
);
|
||||
die "Connection failure: $!\n" unless ($client);
|
||||
#todo: use lissas new db api instead
|
||||
my %cmdref = (command => 'tabdump', arg => 'passwd');
|
||||
#push (@{$cmdref->{arg}}, 'passwd');
|
||||
$SIG{ALRM} = sub { die "No response getting userid and password" };
|
||||
alarm(15);
|
||||
my $msg = XMLout(\%cmdref,RootName=>'xcatrequest', NoAttr=>1, KeyAttr => []);
|
||||
if ($ENV{XCATXMLTRACE}) { print $msg; }
|
||||
print $client $msg;
|
||||
alarm(15);
|
||||
my $response="";
|
||||
while (<$client>) {
|
||||
alarm(0);
|
||||
$response .= $_;
|
||||
if ($response =~ m/<\/xcatresponse>/) {
|
||||
if ($ENV{XCATXMLTRACE}) { print $response; }
|
||||
my $rsp=XMLin($response, ForceArray => ['node']);
|
||||
$response='';
|
||||
if ($rsp->{warning}) {
|
||||
printf "Warning: ".$rsp->{warning}."\n";
|
||||
}
|
||||
if ($rsp->{error}) {
|
||||
die ("ERROR: ".$rsp->{error}."\n");
|
||||
} elsif ($rsp->{data}) {
|
||||
@data=@{$rsp->{data}};
|
||||
}
|
||||
if ($rsp->{serverdone}) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
close($client);
|
||||
|
||||
# go thru the data lines and find the ipmi row
|
||||
my ($user, $pw);
|
||||
foreach my $d (@data) {
|
||||
#if ($::VERBOSE) { print "$d\n"; }
|
||||
my @cols = split(',', $d);
|
||||
if ($cols[0] eq '"ipmi"') {
|
||||
($user) = $cols[1] =~ /"(.*)"/;
|
||||
($pw) = $cols[2] =~ /"(.*)"/;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if (!defined($user) || !defined($pw)) { die "Did not find the ipmi username and password in the xCAT passwd table.\n"; }
|
||||
return ($user, $pw);
|
||||
}
|
||||
|
||||
# vim: set et ts=2 sts=2 sw=2 :
|
||||
+159
-18
@@ -1,20 +1,48 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
# Used as a convience command combined of [nodech]-nodeset-rpower-[rcons/wcons]
|
||||
# to make ease of node OS provision
|
||||
|
||||
# To use this, sym link your cmd name to this script.
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT =
|
||||
$ENV{'XCATROOT'} ? $ENV{'XCATROOT'}
|
||||
: -d '/opt/xcat' ? '/opt/xcat'
|
||||
: '/usr';
|
||||
}
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use File::Basename;
|
||||
use Getopt::Long;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::Table;
|
||||
use xCAT::NodeRange;
|
||||
|
||||
|
||||
sub usage {
|
||||
print basename($0)." usage:\n";
|
||||
print " ".basename($0)." [-o|--osver [-p|--profile] [-a|--arch] [-c|--console] <noderange>\n"
|
||||
print " ".basename($0)." [-o|--osver] [-p|--profile] [-a|--arch] [-O|--osimage] [-c|--console] <noderange>\n"
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $OSVER;
|
||||
my $PROFILE;
|
||||
my $ARCH;
|
||||
my $CONSOLE;
|
||||
my $OSIMAGE;
|
||||
|
||||
Getopt::Long::Configure("bundling");
|
||||
unless (GetOptions(
|
||||
'o|osver=s' => \$OSVER,
|
||||
'p|profile=s' => \$PROFILE,
|
||||
'a|arch=s' => \$ARCH,
|
||||
'O|osimage=s' => \$OSIMAGE,
|
||||
'c|console' => \$CONSOLE
|
||||
)) {
|
||||
usage;
|
||||
@@ -31,32 +59,145 @@ if ($arraysize == 0) {
|
||||
usage;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $noderange=@ARGV[0];
|
||||
my $rc=0;
|
||||
my %pnhash;
|
||||
my @allnodes;
|
||||
#use Data::Dumper;
|
||||
|
||||
my $nodechline = "";
|
||||
if ($OSVER) {
|
||||
$nodechline = "nodetype.os=$OSVER";
|
||||
}
|
||||
if ($PROFILE) {
|
||||
$nodechline .= " nodetype.profile=$PROFILE";
|
||||
}
|
||||
if ($ARCH) {
|
||||
$nodechline .= " nodetype.arch=$ARCH";
|
||||
# check and complain about the invalid combination of the options,
|
||||
# called when -O is specified or nodetype.provmethod=<osimage>,
|
||||
# ignore -o,-p and -a options and prompt a warning message
|
||||
sub checkoption{
|
||||
my $optstring=shift;
|
||||
if($OSVER) {print 'warning: "'.$optstring.'" specified, "[-o|--osver] '.$OSVER."\" ignored\n"};
|
||||
if($PROFILE) {print 'warning: "'.$optstring.'" specified, "[-p|--profile] '.$PROFILE."\" ignored\n"};
|
||||
if($ARCH) {print 'warning: "'.$optstring.'" specified, "[-a|--arch] '.$OSVER."\" ignored\n"};
|
||||
}
|
||||
|
||||
my $rc;
|
||||
if ($nodechline) {
|
||||
$rc=system("nodech $noderange $nodechline");
|
||||
|
||||
@allnodes=noderange($noderange);
|
||||
|
||||
if($OSIMAGE){
|
||||
|
||||
# -O|--osimage is specified, ignore any -a,-p,-o options,
|
||||
# call "nodeset ... osimage= ..." to set the boot state of the noderange to the specified osimage,
|
||||
# "nodeset" will handle the updating of node attributes such as os,arch,profile,provmethod
|
||||
|
||||
&checkoption("[-O|--osimage] $OSIMAGE");
|
||||
$rc=system("nodeset $noderange osimage=$OSIMAGE");
|
||||
if ($rc) {
|
||||
xCAT::MsgUtils->message("E","nodeset failure");
|
||||
exit 1;
|
||||
};
|
||||
}else
|
||||
{
|
||||
|
||||
# no osimage specified, update the node attributes specified by -a,-p,-o options thru "nodech",
|
||||
# then set the boot state of each node based on the nodetype.provmethod:
|
||||
# 1) if nodetype.provmethod = <osimage>, ignore any -p,-o,-a option, then call "nodeset ... osimage"
|
||||
# 2) if nodetype.provmethod = [install/netboot/statelite], update the node attributes specified by -a,-p,-o options thru "nodech", call "nodeset ... [install/netboot/statelite]"
|
||||
# 3) if nodetype.provmethod is not set, use 'install' as the default value
|
||||
|
||||
# group the nodes according to the nodetype.provmethod
|
||||
|
||||
foreach(@allnodes){
|
||||
my $tab=xCAT::Table->new("nodetype");
|
||||
my $nthash=$tab->getNodeAttribs($_,['provmethod']);
|
||||
$tab->close();
|
||||
if(defined($nthash) and defined($nthash->{'provmethod'}))
|
||||
{
|
||||
push(@{$pnhash{$nthash->{'provmethod'}}},$_);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if nodetype.provmethod is not specified,
|
||||
push(@{$pnhash{'install'}},$_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach my $key (keys %pnhash)
|
||||
{
|
||||
my $rclocal=0;
|
||||
my $nodes=join(',',@{$pnhash{$key}});
|
||||
if($key =~ /^(install|netboot|statelite)$/)
|
||||
{
|
||||
|
||||
# nodetype.provmethod = [install|netboot|statelite]
|
||||
my $nodechline = "";
|
||||
if ($OSVER) {
|
||||
$nodechline = "nodetype.os=$OSVER";
|
||||
}
|
||||
if ($PROFILE) {
|
||||
$nodechline .= " nodetype.profile=$PROFILE";
|
||||
}
|
||||
if ($ARCH) {
|
||||
$nodechline .= " nodetype.arch=$ARCH";
|
||||
}
|
||||
if ($nodechline) {
|
||||
$rclocal=system("nodech $nodes $nodechline");
|
||||
if ($rclocal) {
|
||||
print "nodech failure\n";
|
||||
$rc=$rclocal;
|
||||
}
|
||||
}
|
||||
|
||||
unless($rc){
|
||||
$rclocal=system("nodeset $nodes $key");
|
||||
if ($rclocal) {
|
||||
print "nodeset $nodes failure\n";
|
||||
$rc=$rclocal;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# nodetype.provmethod = <osimage>
|
||||
|
||||
&checkoption("nodetype.provmethod=$key");
|
||||
$rclocal=system("nodeset $nodes osimage=$key");
|
||||
if ($rclocal) {
|
||||
print "nodeset $nodes failure\n";
|
||||
$rc=$rclocal;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if ($rc) { die "nodech failure" };
|
||||
$rc=system("nodeset $noderange install");
|
||||
if ($rc) { die "nodeset failure" };
|
||||
|
||||
if($rc){
|
||||
xCAT::MsgUtils->message("E","nodeset failure");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# call "rsetboot" to set the boot order of the nodehm.mgt=ipmi nodes,for others, assume user has set the correct boot order before "rinstall"
|
||||
system("rsetboot $noderange net");
|
||||
|
||||
# call "rpower" to start the node provision process
|
||||
$rc=system("rpower $noderange boot");
|
||||
if ($rc) { die "rpower failure" };
|
||||
if ($rc) {
|
||||
xCAT::MsgUtils->message("E","rpower failure");
|
||||
exit 1;
|
||||
};
|
||||
|
||||
|
||||
if (basename($0) =~ /rinstall/) {
|
||||
|
||||
|
||||
|
||||
# for rinstall, the -c|--console option can provide the remote console for only 1 node
|
||||
if ($CONSOLE) {
|
||||
if(scalar @allnodes ne 1){
|
||||
xCAT::MsgUtils->message("E","rinstall [-c|--console] will only work if there is only one node in the noderange. See winstall(8) for consoles on multiple systems");
|
||||
exit 1;
|
||||
}
|
||||
exec("rcons $noderange");
|
||||
}
|
||||
} elsif (basename($0) =~ /winstall/) {
|
||||
# winstall can commence a wcons command to the noderange for monitoring the provision cycle
|
||||
|
||||
exec("wcons $noderange");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=head1 NAME
|
||||
|
||||
B<chvm> - Changes HMC-, IVM-, and zVM-managed partition profiles or virtual machines. For Power 775, chvm could be used to change the octant configuration values for generating LPARs; change the I/O slots assignment to LPARs within the same CEC.
|
||||
B<chvm> - Changes HMC-, IVM-, and zVM-managed partition profiles or virtual machines. For Power 775, chvm is used to change the octant configuration values for generating LPARs, set the octant memory interleaving value and change the I/O slots assignment to LPARs within the same CEC.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@@ -14,7 +14,7 @@ B<chvm> [B<-V>| B<--verbose>] I<noderange> [B<-p> I<profile>]
|
||||
|
||||
B<chvm> [B<-V>| B<--verbose>] I<noderange> I<attr>=I<val> [I<attr>=I<val>...]
|
||||
|
||||
=head2 PPC (using Direct FSP Management) specific:
|
||||
=head2 PPC (using Direct FSP Management for Power 775) specific:
|
||||
|
||||
B<chvm> I<noderange> [B<-p> I<profile>]
|
||||
|
||||
@@ -84,13 +84,75 @@ The chvm command modifies the partition profile for the partitions specified in
|
||||
|
||||
This command also supports to change specific partition attributes by specifying one or more "attribute equals value" pairs in command line directly, without whole partition profile.
|
||||
|
||||
=head2 PPC (using Direct FSP Management) specific:
|
||||
=head2 PPC (using Direct FSP Management for Power 775) specific:
|
||||
|
||||
chvm could be used to change the octant configuration values for generating LPARs. chvm is designed to set the Octant configure value to split the CPU and memory for partitions, and set Octant Memory interleaving value. The chvm will only set the pending attributes value. After chvm, the CEC needs to be rebooted manually for the pending values to be enabled. Before reboot the cec, the administrator can use chvm to change the partition plan. If the the partition needs I/O slots, the administrator should use chvm to assign the I/O slots.
|
||||
The chvm command is used to set the Power 775 pending octant partition configuration value, the pending memory interleave value, and also is used to assign the I/O slots to an lpar within the CEC.
|
||||
|
||||
chvm is also designed to assign the I/O slots to the new LPAR. Both the current IO owning lpar and the new IO owning lpar must be powered off before an IO assignment. Otherwise, if the I/O slot is belonged to an Lpar and the LPAR is power on, the command will return an error when trying to assign that slot to a different lpar.
|
||||
The octant configuration value specifies one of five preset configurations. Each configuration specifies the number of lpars per octant and the percentage of CPUs and memory assigned to those lpars. The configuration values include:
|
||||
|
||||
The administrator should use lsvm to get the profile content, and then edit the content, and add the node name with ":" manually before the I/O which will be assigned to the node. And then the profile can be piped into the chvm command, or changed with the -p flag.
|
||||
=over
|
||||
|
||||
=over
|
||||
|
||||
=item B<1> - One partition with all cpus and memory of the octant
|
||||
|
||||
=item B<2> - Two partitions with a 50/50 split of cpus and memory
|
||||
|
||||
=item B<3> - Three partitions with a 25/25/50 split of cpus and memory
|
||||
|
||||
=item B<4> - Four partitions with a 25/25/25/25 split of cpus and memory
|
||||
|
||||
=item B<5> - Two partitions with a 25/75 split of cpus and memory
|
||||
|
||||
=back
|
||||
|
||||
=back
|
||||
|
||||
The memory interleaving value specifies how the memory is accessed within the octant and can be one of two values:
|
||||
|
||||
=over
|
||||
|
||||
=over
|
||||
|
||||
=item B<1> - interleaved or 8MC mode
|
||||
|
||||
Memory allocations are interleaved evenly across all eight memory controllers in the octant. This is the default value if -m is not specified. A value of 1 must NOT be specified if the octant is to be partitioned, i.e. have an octant configuration value of 2-5.
|
||||
|
||||
=item B<2> - non-interleaved or 2MC mode
|
||||
|
||||
Memory allocations are only interleaved across the two memory controllers on a local chip in the octant. A value of 2 MUST be specified if the octant is to be partitioned, i.e. have an octant configuration value of 2-5.
|
||||
|
||||
=back
|
||||
|
||||
=back
|
||||
|
||||
If octants in the same CEC are to have different memory interleaving values then they must be configured in separate chvm commands. For example, if octant zero is to have an octant configuration of 2 and octant one through seven are to have an octant configuration of 1 and a memory interleave value of 1 then the two commands would be:
|
||||
|
||||
chvm lpar1,lpar2 -i 1 -m 2 -r 0:2
|
||||
|
||||
chvm lpar3-lpar9 -i 5 -m 1 -r 1-7:1
|
||||
|
||||
The lsvm command can be used to verify the pending octant configurations are correct for the CEC.
|
||||
|
||||
To activate the pending configuration the CEC needs to be manually rebooted.
|
||||
|
||||
Once the CEC has the correct active configuration, the chvm command can then be used to assign I/O slots to new partitions in the CEC. Once again, the lsvm command can be used to display the current I/O slot assignments of the CEC. Before running the chvm command to update I/O slot assignments, ensure that both the current I/O owning lpar and the new I/O owning lpar are powered off. Otherwise, the chvm will return an error.
|
||||
|
||||
The lsvm command output can be redirected to a file. This file can then be edited to include only the current sixteen I/O slot assignments. A sample of some of the output is:
|
||||
|
||||
1: 537/U78A9.001.0123456-P1-C9/0x21010219/2/1
|
||||
1: 514/U78A9.001.0123456-P1-C17/0x21010202/2/1
|
||||
1: 568/U78A9.001.0123456-P1-C2/0x21010238/2/1
|
||||
1: 561/U78A9.001.0123456-P1-C3/0x21010231/2/1
|
||||
|
||||
The number, as in the above example, or text before the ":" indicates the lpar id of the node or the node name. To change the I/O slot assignment, change this value to the new lpar id or node name, for example, 5 for lpar id 5 or use the node name "lpar5". For example:
|
||||
|
||||
1: 537/U78A9.001.0123456-P1-C9/0x21010219/2/1
|
||||
1: 514/U78A9.001.0123456-P1-C17/0x21010202/2/1
|
||||
5: 568/U78A9.001.0123456-P1-C2/0x21010238/2/1
|
||||
5: 561/U78A9.001.0123456-P1-C3/0x21010231/2/1
|
||||
|
||||
This file can then be piped into the chvm command, or specified with the -p flag.
|
||||
|
||||
=head2 VMware/KVM specific:
|
||||
|
||||
@@ -134,33 +196,39 @@ Verbose output.
|
||||
|
||||
=back
|
||||
|
||||
=head2 PPC (using Direct FSP Management) specific:
|
||||
=head2 PPC (using Direct FSP Management for Power 775) specific:
|
||||
|
||||
=over 10
|
||||
|
||||
=item B<-i>
|
||||
|
||||
Starting numeric id of the newly created partitions. For Power 775 using Direct FSP Management, the id value only could be B<1>, B<5>, B<9>, B<13>, B<17>, B<21>, B<25> and B<29>.
|
||||
Starting numeric id of the first lpar in the octant. Valid id values are B<1>, B<5>, B<9>, B<13>, B<17>, B<21>, B<25> and B<29>. These values correspond to the first lpar id in each of the eight octants.
|
||||
|
||||
=item B<-m>
|
||||
|
||||
memory interleaving. The setting value only could be B<1> or B<2>. B<2> means B<non-interleaved> mode (also 2MC mode), the memory cannot be shared across the processors in an octant. B<1> means B<interleaved> mode (also 8MC mode) , the memory can be shared. The default value is B<1> .
|
||||
1 - interleaved or 8MC mode
|
||||
|
||||
2 - non-interleaved or 2MC mode
|
||||
|
||||
See interleaving description above for more information.
|
||||
|
||||
=item B<-r>
|
||||
|
||||
partition rule.
|
||||
Octant partition configuration rule. The rule specifies the octant and the octant configuration value.
|
||||
|
||||
If all the octants configuration value are same in one CEC, it will be " B<-r> B<0-7>:I<value>" .
|
||||
The format is " B<-r> B<octant_number:value>"
|
||||
|
||||
Multiple octants can be specified in the same rule: " B<-r> B<0-7>:I<value>"
|
||||
|
||||
If the octants use the different configuration value in one cec, it will be "B<-r> B<0>:I<value1>,B<1>:I<value2>,...B<7>:I<value7>", or "B<-r> B<0>:I<value1>,B<1-7>:I<value2>" and so on.
|
||||
|
||||
The octants configuration value for one Octant could be B<1>, B<2>, B<3>, B<4>, B<5>. The meanings of the octants configuration value are as following:
|
||||
The octant configuration value specifies one of five preset configurations (B<1>, B<2>, B<3>, B<4>, B<5>). Each configuration specifies the number of lpars per octant and the percentage of CPUs and memory assigned to those lpars. The configuration values include:
|
||||
|
||||
1 -- 1 partition with all cpus and memory of the octant
|
||||
2 -- 2 partitions with a 50/50 split of cpus and memory
|
||||
3 -- 3 partitions with a 25/25/50 split of cpus and memory
|
||||
4 -- 4 partitions with a 25/25/25/25 split of cpus and memory
|
||||
5 -- 2 partitions with a 25/75 split of cpus and memory
|
||||
1 - One partition with all cpus and memory of the octant
|
||||
2 - Two partitions with a 50/50 split of cpus and memory
|
||||
3 - Three partitions with a 25/25/50 split of cpus and memory
|
||||
4 - Four partitions with a 25/25/25/25 split of cpus and memory
|
||||
5 - Two partitions with a 25/75 split of cpus and memory
|
||||
|
||||
=item B<-p> I<profile>
|
||||
|
||||
@@ -338,9 +406,9 @@ Output is similar to:
|
||||
|
||||
lpar4: Success
|
||||
|
||||
=head2 PPC (using Direct FSP Management) specific:
|
||||
=head2 PPC (using Direct FSP Management for Power 775) specific:
|
||||
|
||||
1. For Power 775, to create a new partition lpar1 on the first octant of the cec cec01, lpar1 will use all the cpu and memory of the octant 0, enter:
|
||||
1. For Power 775, to create a new partition lpar1 on the first octant of CEC cec01, lpar1 will use all the cpu and memory of the octant 0, enter:
|
||||
|
||||
mkdef -t node -o lpar1 mgt=fsp groups=all parent=cec01 nodetype=lpar hcp=cec01
|
||||
|
||||
@@ -353,7 +421,7 @@ Output is similar to:
|
||||
lpar1: Success
|
||||
cec01: Please reboot the CEC cec1 firstly, and then use chvm to assign the I/O slots to the LPARs
|
||||
|
||||
2. For Power 775, to create new partitions lpar1-lpar8 on the whole cec cec01, each LPAR will use all the cpu and memory of each octant, enter:
|
||||
2. For Power 775, to create new partitions lpar1-lpar8 on the whole CEC cec01, each LPAR will use all the cpu and memory of each octant, enter:
|
||||
|
||||
mkdef -t node -o lpar1-lpar8 nodetype=lpar mgt=fsp groups=all parent=cec01 hcp=cec01
|
||||
|
||||
@@ -373,18 +441,21 @@ Output is similar to:
|
||||
lpar8: Success
|
||||
cec01: Please reboot the CEC cec1 firstly, and then use chvm to assign the I/O slots to the LPARs
|
||||
|
||||
3. For Power 775 cec1, to create new partitions lpar1-lpar9, the lpar1 will use 25% CPU and 25% memory of the first octant, and lpar2 will use the left CPU and memory of the first octant. lpar3-lpar9 will use all the cpu and memory of each octant, enter:
|
||||
3. For Power 775 cec1, to create new partitions lpar1-lpar9, where lpar1 will use 25% CPU and memory resource and lpar2 will use the remaining 75% resources of octant 0 and lpar3-lpar9 will use all the cpu and memory of octants 2-7, enter:
|
||||
|
||||
mkdef -t node -o lpar1-lpar9 mgt=fsp groups=all parent=cec1 nodetype=lpar hcp=cec1
|
||||
|
||||
then:
|
||||
|
||||
chvm lpar1-lpar9 -i 1 -m 1 -r 0:5,1-7:1
|
||||
chvm lpar1-lpar2 -i 1 -m 2 -r 0:5
|
||||
chvm lpar3-lpar9 -i 5 -m 1 -r 1-7:1
|
||||
|
||||
Output is similar to:
|
||||
|
||||
lpar1: Success
|
||||
lpar2: Success
|
||||
cec1: Please reboot the CEC cec1 firstly, and then use chvm to assign the I/O slots to the LPARs
|
||||
|
||||
lpar3: Success
|
||||
lpar4: Success
|
||||
lpar5: Success
|
||||
|
||||
@@ -9,7 +9,7 @@ I<lsslp [-h| --help]>
|
||||
I<lsslp [-v| --version]>
|
||||
|
||||
|
||||
I<lsslp [noderange] [-V] [-i ip[,ip..]][-w][-r|-x|-z][-n][-s CEC|FRAME|MM|IVM|RSA|HMC|CMM][-t tries][-I][-C counts][-T timeout][--vpdtable]>
|
||||
I<lsslp [noderange] [-V] [-i ip[,ip..]][-w][-r|-x|-z][-n][-s CEC|FRAME|MM|IVM|RSA|HMC|CMM|IMM2|FSP][-t tries][-I][-C counts][-T timeout][--vpdtable]>
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
@@ -36,6 +36,14 @@ B<-h> Display usage message.
|
||||
|
||||
B<-n> Only display and write the newly discovered hardwares.
|
||||
|
||||
B<-u> Do unicast to a specified IP range. Must be used with -s and --range.
|
||||
The -u flag is not supported on AIX.
|
||||
|
||||
B<--range> Specify one or more IP ranges. Must be use in unicast mode.
|
||||
It accepts multiple formats. For example, 192.168.1.1/24, 40-41.1-2.3-4.1-100.
|
||||
If the range is huge, for example, 192.168.1.1/8, lsslp may take a very long time for node scan.
|
||||
So the range should be exactly specified.
|
||||
|
||||
B<-r> Display Raw SLP response.
|
||||
|
||||
B<-C> The number of the expected responses specified by the user.
|
||||
@@ -277,6 +285,9 @@ e114ngmm1:
|
||||
otherinterfaces=70.0.0.30
|
||||
hwtype=cmm
|
||||
|
||||
10. To use lsslp unicast, enter:
|
||||
lsslp -u -s CEC --range 40-41.1-2.1-2.1-2
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/lsslp
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
=head1 NAME
|
||||
|
||||
B<pasu> - run the ASU to many nodes in parallel
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<pasu> [B<-V>] [B<-d>] [B<-n>] [B<-l> I<user>] [B<-p> I<passwd>] [B<-f> I<fanout>] I<noderange> I<command>
|
||||
|
||||
B<pasu> [B<-V>] [B<-d>] [B<-n>] [B<-l> I<user>] [B<-p> I<passwd>] [B<-f> I<fanout>] B<-b> I<batchfile> I<noderange>
|
||||
|
||||
B<pasu> [B<-h> | B<--help>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<pasu> command runs the ASU command in out-of-band mode in parallel to multiple nodes. Out-of-band mode means
|
||||
that ASU connects from the xCAT management node to the IMM (BMC) of each node to set or query the ASU settings. To
|
||||
see all of the ASU settings available on the node, use the "show all" command. To query or set multiple values,
|
||||
use the B<-b> (batch) option. To group similar output from multiple nodes, use L<xcoll(1)|xcoll.1>.
|
||||
|
||||
Before running B<pasu>, you must install the ASU RPM from IBM. You can download it from the IBM Fix Central site.
|
||||
You also must configure the IMMs properly according to xCAT documentation. Run "B<rpower> I<noderange> B<stat>"
|
||||
to confirm that the IMMs are configured properly.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 10
|
||||
|
||||
=item B<-n|--nonodecheck>
|
||||
|
||||
Do not send the noderange to xcatd to expand it into a list of nodes. Use the noderange exactly as it is specified
|
||||
to pasu. In this case, the noderange must be a simple list of comma-separated hostnames of the IMMs.
|
||||
|
||||
=item B<-l|--loginname> I<username>
|
||||
|
||||
The username to use to connect to the IMMs. If not specified, the row in the xCAT B<passwd> table with key "ipmi"
|
||||
will be used to get the username.
|
||||
|
||||
=item B<-p|--passwd> I<passwd>
|
||||
|
||||
The password to use to connect to the IMMs. If not specified, the row in the xCAT passwd table with key "ipmi"
|
||||
will be used to get the password.
|
||||
|
||||
=item B<-f|--fanout>
|
||||
|
||||
How many processes to run in parallel simultaneously. The default is 64. You can also set the XCATPSHFANOUT
|
||||
environment variable.
|
||||
|
||||
=item B<-b|--batch> -I<batchfile>
|
||||
|
||||
A simple text file that contains multiple ASU commands, each on its own line.
|
||||
|
||||
=item B<-d|--donotfilter>
|
||||
|
||||
By default, pasu filters out (i.e. does not display) the standard initial output from ASU:
|
||||
|
||||
IBM Advanced Settings Utility version 9.30.79N
|
||||
Licensed Materials - Property of IBM
|
||||
(C) Copyright IBM Corp. 2007-2012 All Rights Reserved
|
||||
Connected to IMM at IP address node2-imm
|
||||
|
||||
If you want this output to be displayed, use this flag.
|
||||
|
||||
=item B<-V|--verbose>
|
||||
|
||||
Display verbose messages.
|
||||
|
||||
=item B<-h|--help>
|
||||
|
||||
Display usage message.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 3
|
||||
|
||||
=item 1.
|
||||
|
||||
To display the Com1ActiveAfterBoot setting on 2 nodes:
|
||||
|
||||
pasu node1,node2 show DevicesandIOPorts.Com1ActiveAfterBoot
|
||||
|
||||
Output is similar to:
|
||||
|
||||
node1: DevicesandIOPorts.Com1ActiveAfterBoot=Enable
|
||||
node2: DevicesandIOPorts.Com1ActiveAfterBoot=Enable
|
||||
|
||||
=item 2.
|
||||
|
||||
To display the Com1ActiveAfterBoot setting on all compute nodes:
|
||||
|
||||
pasu compute show DevicesandIOPorts.Com1ActiveAfterBoot | xcoll
|
||||
|
||||
Output is similar to:
|
||||
|
||||
====================================
|
||||
compute
|
||||
====================================
|
||||
DevicesandIOPorts.Com1ActiveAfterBoot=Enable
|
||||
|
||||
=item 3.
|
||||
|
||||
To set several settings on all compute nodes, create a batch file
|
||||
called (for example) asu-settings with contents:
|
||||
|
||||
set DevicesandIOPorts.Com1ActiveAfterBoot Enable
|
||||
set DevicesandIOPorts.SerialPortSharing Enable
|
||||
set DevicesandIOPorts.SerialPortAccessMode Dedicated
|
||||
set DevicesandIOPorts.RemoteConsole Enable
|
||||
|
||||
Then run:
|
||||
|
||||
pasu -b asu-settings compute | xcoll
|
||||
|
||||
Output is similar to:
|
||||
|
||||
====================================
|
||||
compute
|
||||
====================================
|
||||
Batch mode start.
|
||||
[set DevicesandIOPorts.Com1ActiveAfterBoot Enable]
|
||||
DevicesandIOPorts.Com1ActiveAfterBoot=Enable
|
||||
|
||||
[set DevicesandIOPorts.SerialPortSharing Enable]
|
||||
DevicesandIOPorts.SerialPortSharing=Enable
|
||||
|
||||
[set DevicesandIOPorts.SerialPortAccessMode Dedicated]
|
||||
DevicesandIOPorts.SerialPortAccessMode=Dedicated
|
||||
|
||||
[set DevicesandIOPorts.RemoteConsole Enable]
|
||||
DevicesandIOPorts.RemoteConsole=Enable
|
||||
|
||||
Beginning intermediate batch update.
|
||||
Waiting for command completion status.
|
||||
Command completed successfully.
|
||||
Completed intermediate batch update.
|
||||
Batch mode competed successfully.
|
||||
|
||||
=item 4.
|
||||
|
||||
To confirm that all the settings were made on all compute nodes, create a batch file
|
||||
called (for example) asu-show with contents:
|
||||
|
||||
show DevicesandIOPorts.Com1ActiveAfterBoot
|
||||
show DevicesandIOPorts.SerialPortSharing
|
||||
show DevicesandIOPorts.SerialPortAccessMode
|
||||
show DevicesandIOPorts.RemoteConsole
|
||||
|
||||
Then run:
|
||||
|
||||
pasu -b asu-show compute | xcoll
|
||||
|
||||
Output is similar to:
|
||||
|
||||
====================================
|
||||
compute
|
||||
====================================
|
||||
Batch mode start.
|
||||
[show DevicesandIOPorts.Com1ActiveAfterBoot]
|
||||
DevicesandIOPorts.Com1ActiveAfterBoot=Enable
|
||||
|
||||
[show DevicesandIOPorts.SerialPortSharing]
|
||||
DevicesandIOPorts.SerialPortSharing=Enable
|
||||
|
||||
[show DevicesandIOPorts.SerialPortAccessMode]
|
||||
DevicesandIOPorts.SerialPortAccessMode=Dedicated
|
||||
|
||||
[show DevicesandIOPorts.RemoteConsole]
|
||||
DevicesandIOPorts.RemoteConsole=Enable
|
||||
|
||||
Batch mode competed successfully.
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/pasu
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<noderange(3)|noderange.3>, L<rpower(1)|rpower.1>, L<xcoll(1)|xcoll.1>
|
||||
|
||||
@@ -5,17 +5,22 @@ B<rbeacon> - Turns beacon on/off/blink or gives status of a node or noderange.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<rbeacon> [B<-h>|B<--help>|B<-v>|B<--version>]
|
||||
|
||||
=head2 IPMI specific:
|
||||
|
||||
B<rbeacon> I<noderange> {B<on>|B<off>}
|
||||
|
||||
=head2 Blade specific:
|
||||
|
||||
B<rbeacon> I<noderange> {B<on>|B<blink>|B<off>|B<stat>}
|
||||
|
||||
B<rbeacon> [B<-h>|B<--help>]
|
||||
|
||||
B<rbeacon> {B<-v>|B<--version>}
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<rbeacon> Turns beacon (a light on the front of the physical server) on/off/blink or gives status of a node or noderange.
|
||||
|
||||
For B<IPMI specific>, it represents the systems were managed through I<ipmi> mode. And for B<Blade specific>, it represents managing the systems using I<blade> mode.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
rbeacon 1,3 off
|
||||
|
||||
@@ -44,7 +44,7 @@ B<BladeCenter specific :>
|
||||
|
||||
=over 2
|
||||
|
||||
B<For Management Modules as the target:>
|
||||
B<For Management Modules:>
|
||||
|
||||
=over 4
|
||||
|
||||
@@ -58,7 +58,7 @@ B<renergy> I<noderange> [-V] { all | pd1all | pd2all | [pd1status]
|
||||
|
||||
=back
|
||||
|
||||
B<For a blades as the target:>
|
||||
B<For a blade server nodes:>
|
||||
|
||||
=over 4
|
||||
|
||||
@@ -67,12 +67,45 @@ B<renergy> I<noderange> [-V] { all | [averageDC]
|
||||
[savingstatus] [dsavingstatus] }
|
||||
|
||||
B<renergy> I<noderange> [-V] { savingstatus={on | off}
|
||||
| dsavingstatus={on-norm | on-maxp | off} }
|
||||
| dsavingstatus={on-norm | on-maxp | off} }
|
||||
|
||||
=back
|
||||
|
||||
=back
|
||||
|
||||
B<Flex specific :>
|
||||
|
||||
=over 2
|
||||
|
||||
B<For Flex Management Modules:>
|
||||
|
||||
=over 4
|
||||
|
||||
B<renergy> I<noderange> [-V] { all | [powerstatus]
|
||||
[powerpolicy] [powermodule] [avaiablepower] [reservedpower]
|
||||
[remainpower] [inusedpower] [availableDC] [averageAC]
|
||||
[thermaloutput] [ambienttemp] [mmtemp] }
|
||||
|
||||
=back
|
||||
|
||||
B<For Flex node (power and x86):>
|
||||
|
||||
=over 4
|
||||
|
||||
B<renergy> I<noderange> [-V] { all | [averageDC]
|
||||
[capability] [cappingvalue] [cappingmaxmin] [cappingmax]
|
||||
[cappingmin] [cappingGmin] [CPUspeed] [maxCPUspeed]
|
||||
[savingstatus] [dsavingstatus] }
|
||||
|
||||
B<renergy> I<noderange> [-V] { cappingstatus={on | off}
|
||||
| cappingwatt=watt | cappingperc=percentage
|
||||
| savingstatus={on | off} | dsavingstatus={on-norm | on-maxp | off} }
|
||||
|
||||
=back
|
||||
|
||||
=back
|
||||
|
||||
|
||||
B<iDataPlex specific :>
|
||||
|
||||
=over 2
|
||||
@@ -273,10 +306,21 @@ enabled, phase 2 or higher
|
||||
dynamicPowerMeasurementWithPowerCapping: the module with power meter capability,
|
||||
both measurement and capping enabled, phase 2 or higher
|
||||
|
||||
=item B<cappingGmin>
|
||||
|
||||
Query the Guaranteed Minimum power capping value in watts.
|
||||
|
||||
=item B<cappingmax>
|
||||
|
||||
Query the Maximum of power capping value in watts.
|
||||
|
||||
=item B<cappingmaxmin>
|
||||
|
||||
Query the maximum and minimum of power capping value
|
||||
which can be set for a CEC or blade server. (Unit is watt)
|
||||
Query the Maximum and Minimum of power capping value in watts.
|
||||
|
||||
=item B<cappingmin>
|
||||
|
||||
Query the Minimum of power capping value in watts.
|
||||
|
||||
=item B<cappingperc>=B<percentage>
|
||||
|
||||
@@ -414,36 +458,39 @@ Query the maximum processor frequency. (Unit is MHz)
|
||||
Query the current temperature of management module.
|
||||
(Unit is centigrade)
|
||||
|
||||
=item B<pd1status>
|
||||
=item B<pd1status | powerstatus>
|
||||
|
||||
Query the status of power domain 1 for blade management
|
||||
module node.
|
||||
|
||||
=item B<pd1policy>
|
||||
Note: for the attribute without the leading 'pd1' which
|
||||
means there's only one power doamin in the chassis.
|
||||
|
||||
=item B<pd1policy | powerpolicy>
|
||||
|
||||
Query the power management policy of power domain 1.
|
||||
|
||||
=item B<pd1powermodule1>
|
||||
=item B<pd1powermodule1 | powermodule>
|
||||
|
||||
Query the First Power Module capacity in power domain 1.
|
||||
|
||||
=item B<pd1powermodule2>
|
||||
=item B<pd1powermodule2 | powermodule>
|
||||
|
||||
Query the Second Power Module capacity in power domain 1.
|
||||
|
||||
=item B<pd1avaiablepower>
|
||||
=item B<pd1avaiablepower | avaiablepower>
|
||||
|
||||
Query the total available power in power domain 1.
|
||||
|
||||
=item B<pd1reservedpower>
|
||||
=item B<pd1reservedpower | reservedpower>
|
||||
|
||||
Query the power that has been reserved for power domain 1.
|
||||
|
||||
=item B<pd1remainpower>
|
||||
=item B<pd1remainpower | remainpower>
|
||||
|
||||
Query the remaining power available in power domain 1.
|
||||
|
||||
=item B<pd1inusedpower>
|
||||
=item B<pd1inusedpower | inusedpower>
|
||||
|
||||
Query the total power being used in power domain 1.
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ B<rpower> I<noderange> [B<on>|B<off>|B<stat>|B<state>|B<reset>|B<boot>|B<of>|B<s
|
||||
|
||||
=head2 Blade (using Direct FSP Management) specific:
|
||||
|
||||
B<rpower> I<noderange> [B<on>|B<off>|B<cycle>]
|
||||
B<rpower> I<noderange> [B<on>|B<onstandby>|B<off>|B<cycle>|B<sms>]
|
||||
|
||||
=head2 Blade specific:
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ B<rspconfig> I<noderange> B<--resetnet>
|
||||
B<rspconfig> configures various settings in the nodes' service processors. If only a keyword is
|
||||
specified, without the B<=>, it displays the current value.
|
||||
|
||||
For options B<autopower>|B<iocap>|B<dev>|B<celogin1>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>, user need to use I<chdef -t site enableASMI=yes> to enable ASMI first. For options B<dev>|B<celogin1>, user also need to access I<http://w3.pok.ibm.com/organization/prodeng/pw/> to get the dynamic password for 'celogin' and put it in passwd table. After completed the command, user should use I<chdef -t site enableASMI=no> to disable ASMI.
|
||||
For options B<autopower>|B<iocap>|B<dev>|B<celogin1>|B<decfg>|B<memdecfg>|B<procdecfg>|B<time>|B<date>|B<spdump>|B<sysdump>|B<network>, user need to use I<chdef -t site enableASMI=yes> to enable ASMI first. For options B<dev>|B<celogin1>, user also need to contact IBM service to get the dynamic password for 'celogin' and put it in passwd table. After completed the command, user should use I<chdef -t site enableASMI=no> to disable ASMI.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ B<sinv> - Checks the software configuration of the nodes in the cluster.
|
||||
|
||||
=head1 B<SYNOPSIS>
|
||||
|
||||
B<sinv> [B<-o> I<output>] [B<-p> I<template path>] [B<-t> I<template count>] [B<-s> I<seed node>] [B<-i>] [B<-e>] [B<-r>] [B<-V>] [[B<-f> I<command file>] | [B<-c> I<command>]]
|
||||
B<sinv> [B<-o> I<output>] [B<-p> I<template path>] [B<-t> I<template count>] [B<-s> I<seed node>] [B<-i>] [B<-e>] [B<-r>] [B<-V>] [B<--devicetype> I<type_of_device>] [B<-l> I<userID>] [[B<-f> I<command file>] | [B<-c> I<command>]]
|
||||
|
||||
B<sinv> [B<-h> | B<-v>]
|
||||
|
||||
@@ -132,13 +132,33 @@ it would be considered a match, as long as all rpms listed in the template
|
||||
were on the node. With exactmatch set, the output must be identical
|
||||
to the template.
|
||||
|
||||
=item B<--devicetype> I<type_of_device>
|
||||
|
||||
Specify a user-defined device type that references the location
|
||||
of relevant device configuration file. The devicetype value must
|
||||
correspond to a valid device configuration file.
|
||||
xCAT ships some default configuration files
|
||||
for Ethernet switches and and IB switches under
|
||||
I</opt/xcat/share/xcat/devicetype> directory. If you want to overwrite
|
||||
any of the configuration files, please copy it to I</var/opt/xcat/>
|
||||
directory and cutomize it.
|
||||
For example, I<base/IBSwitch/Qlogic/config> is the configuration
|
||||
file location if devicetype is specified as IBSwitch::Qlogic.
|
||||
xCAT will first search config file using I</var/opt/xcat/> as the base.
|
||||
If not found, it will search for it using
|
||||
I</opt/xcat/share/xcat/devicetype/> as the base.
|
||||
|
||||
=item B<-l>|B<--user> I<user_ID>
|
||||
|
||||
Specifies a remote user name to use for remote command execution.
|
||||
|
||||
=item B<-c>|B<--command>
|
||||
|
||||
The xdsh or rinv command that will be run. The command should be enclosed in
|
||||
double quotes to insure correct shell interpretation.
|
||||
double quotes to insure correct shell interpretation. This parameter must only contain, the node range or the image path (Linux) or spot name for AIX. It cannot be used to set additional input flags to xdsh or rinv (for example -s,-T,-e). See examples below.
|
||||
|
||||
B<Note:> do not add the | xdshcoll to the command,
|
||||
it is automatically added by sinv.
|
||||
it is automatically added by sinv. sinv also automatically sets the -v flag for xdsh.
|
||||
|
||||
=item B<-f>|B<--file>
|
||||
|
||||
@@ -239,9 +259,31 @@ B<sinv> I<-c "xdsh node1-node4 lslpp -l | grep bos.adt" -s node1 -e -p /tmp/sin
|
||||
Note: the /tmp/sinv.template file must be empty, otherwise it will be used
|
||||
as an admin generated template.
|
||||
|
||||
=item *
|
||||
|
||||
To execute B<sinv> on the Linux osimage defined for cn1. First build a template from the /etc/hosts on the node. Then run sinv to compare.
|
||||
B<xdsh> I<cn1 "cat /etc/hosts" | xdshcoll > /tmp/sinv2/template"
|
||||
|
||||
B<sinv> I<-c "xdsh -i /install/netboot/rhels6/ppc64/test_ramdisk_statelite/rootimg cat /etc/hosts" -e -t1 -p /tmp/sinv.template -o /tmp/sinv.output>
|
||||
|
||||
=item *
|
||||
|
||||
To execute B<sinv> on the AIX NIM 611dskls spot and compare /etc/hosts to compute1 node, run the following:
|
||||
|
||||
B<xdsh> I<compute1 "cat /etc/hosts" | xdshcoll > /tmp/sinv2/template"
|
||||
|
||||
B<sinv> I<-c "xdsh -i 611dskls cat /etc/hosts" -e -t1 -p /tmp/sinv.template -o /tmp/sinv.output>
|
||||
|
||||
=item *
|
||||
|
||||
To execute B<sinv> on the device mswitch2 and compare to mswitch1
|
||||
|
||||
B<sinv> I<-c "xdsh mswitch enable;show version" -s mswitch1 -p /tmp/sinv/template --devicetype IBSwitch::Mellanox -l admin -t 2>
|
||||
|
||||
|
||||
=back
|
||||
|
||||
=head1 B<Files>
|
||||
B<Files>
|
||||
|
||||
B</opt/xcat/bin/sinv/>
|
||||
|
||||
|
||||
@@ -245,9 +245,7 @@ messages to standard output during execution to each target.
|
||||
|
||||
Verifies each target before executing any remote commands
|
||||
on the target. If a target is not responding, execution of
|
||||
remote commands for the target is canceled. When specified
|
||||
with the B<-i> flag, the user is prompted to retry the
|
||||
verification request.
|
||||
remote commands for the target is canceled.
|
||||
|
||||
=item B<-V>|B<--version>
|
||||
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
=head1 Name
|
||||
|
||||
B<rinstall> - Begin installation on a noderange
|
||||
B<rinstall> - Begin OS provision on a noderange
|
||||
|
||||
=head1 B<Synopsis>
|
||||
|
||||
B<rinstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<-c>|I<--console>] [I<noderange>]
|
||||
B<rinstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<-O>|I<--osimage>] [I<-c>|I<--console>] [I<noderange>]
|
||||
|
||||
=head1 B<Description>
|
||||
|
||||
B<rinstall> is a convience command that will change tables as requested for operating system version, profile, and architecture, call nodeset to modify the network boot configuration, and rpower to begin a boot cycle. If -c is specified, it will then become the
|
||||
text console of the node. If wanting consoles on multiple nodes with a similar command, see L<winstall(8)|winstall.8>.
|
||||
B<rinstall> is a convience command that will change tables as requested for operating system version, profile, and architecture, call B<nodeset> to modify the network boot configuration, call B<rsetboot> net to set the next boot over network (only support nodes with "nodetype.mgt=ipmi", for other nodes, make sure the correct boot order has been set before B<rinstall>), and B<rpower> to begin a boot cycle.
|
||||
|
||||
If [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage> is set, provision the noderange with the osimage specified/configured, ignore the table change options if specified.
|
||||
|
||||
If -c is specified, it will then become the text console of the node. If wanting consoles on multiple nodes with a similar command, see L<winstall(8)|winstall.8>.
|
||||
|
||||
=head1 B<Options>
|
||||
|
||||
@@ -17,21 +20,24 @@ text console of the node. If wanting consoles on multiple nodes with a similar
|
||||
|
||||
=item B<-o>|B<--osver>
|
||||
|
||||
Specifies which os version to install. If unspecified, the current table values are used.
|
||||
Specifies which os version to provision. If unspecified, the current table values are used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
|
||||
=item B<-p>|B<--profile>
|
||||
|
||||
Specifies what profile should be used of the operating system. If not specified the tables are used as is.
|
||||
Specifies what profile should be used of the operating system. If not specified the tables are used as is. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
|
||||
|
||||
=item B<-a>|B<--arch>
|
||||
|
||||
Specifies what architecture of the OS to install. Typically this is unneeded, but if provisioning betweer x86_64 and x86 frequently, this may be a useful flag.
|
||||
Specifies what architecture of the OS to provision. Typically this is unneeded, but if provisioning betweer x86_64 and x86 frequently, this may be a useful flag. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
|
||||
=item B<-O>|B<--osimage>
|
||||
|
||||
Specifies the osimage to provision.
|
||||
|
||||
=item B<-c>|B<--console>
|
||||
|
||||
|
||||
Requests that rinstall become rcons once the install commences. This will only work if there is only one node in the noderange. See L<winstall(8)|winstall.8> for consoles on multiple systems.
|
||||
Requests that rinstall become rcons once the provision commences. This will only work if there is only one node in the noderange. See L<winstall(8)|winstall.8> for consoles on multiple systems.
|
||||
|
||||
=back
|
||||
|
||||
@@ -40,21 +46,21 @@ Requests that rinstall become rcons once the install commences. This will only
|
||||
|
||||
B<rinstall> I<node1-node20>
|
||||
|
||||
Install nodes 1 through 20, using configuration as is from tables.
|
||||
Provison nodes 1 through 20, using configuration as is from tables.
|
||||
|
||||
B<rinstall> -o rhels5.1 -p compute I<node1-node20>
|
||||
|
||||
Install nodes 1 through 20, forcing rhels5.1 and compute profile.
|
||||
Provision nodes 1 through 20, forcing rhels5.1 and compute profile.
|
||||
|
||||
B<rinstall> -O rhels6.4-ppc64-netboot-compute I<node1-node20>
|
||||
|
||||
Provision nodes 1 through 20 with the osimage rhels6.4-ppc64-netboot-compute.
|
||||
|
||||
B<rinstall> -c I<node1>
|
||||
|
||||
Install node1 and start a console to monitor the process
|
||||
Provisoon node1 and start a console to monitor the process.
|
||||
|
||||
|
||||
=head1 B<Author>
|
||||
|
||||
Jarrod B Johnson <jbjohnso@us.ibm.com>
|
||||
|
||||
=head1 B<See> B<Also>
|
||||
|
||||
L<noderange(3)|noderange.3>, L<winstall(8)|winstall.8>, L<rcons(1)|rcons.1>
|
||||
|
||||
@@ -24,6 +24,6 @@ while [ ! -f /tmp/destiny.xml ] || grep error /tmp/destiny.xml; do
|
||||
fi
|
||||
done
|
||||
rm /tmp/destreq.xml
|
||||
DESTINY=`grep destiny /tmp/destiny.xml | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'`
|
||||
DESTINY=`grep '<destiny>' /tmp/destiny.xml | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'`
|
||||
rm /tmp/destiny.xml
|
||||
echo $DESTINY
|
||||
|
||||
@@ -822,7 +822,7 @@ sub parse_ipmi_payload {
|
||||
my @payload = @_;
|
||||
#for now, just trash the headers, this has been validated to death anyway
|
||||
#except seqlun, that one is important
|
||||
unless ($payload[4] == $self->{seqlun} and $payload[0] == $self->{rqaddr} and $payload[1]>>2 == $self->{expectednetfn} and $payload[5] == $self->{expectedcmd} ) {
|
||||
unless ($payload[4] == $self->{seqlun} and $payload[1]>>2 == $self->{expectednetfn} and $payload[5] == $self->{expectedcmd} ) {
|
||||
#both sequence number and arqaddr must match, because we are using rqaddr to extend the sequence number
|
||||
#print "Successfully didn't get confused by stale response ".$payload[4]." and ".($self->{seqlun}-4)."\n";
|
||||
#hexdump(@payload);
|
||||
|
||||
@@ -656,16 +656,15 @@ sub makescript
|
||||
}
|
||||
|
||||
# get postscripts for images
|
||||
my $osimgname = $provmethod;
|
||||
my $et2;
|
||||
if($provmethod !~ /^install$|^netboot$|^statelite$/){ # using imagename
|
||||
my $osimgname = $provmethod;
|
||||
|
||||
if($osimgname =~ /install|netboot|statelite/){
|
||||
$osimgname = "$os-$arch-$provmethod-$profile";
|
||||
}
|
||||
my $et2 =
|
||||
$et2 =
|
||||
$ostab->getAttribs({'imagename' => "$osimgname"}, ['postscripts', 'postbootscripts']);
|
||||
$ps = $et2->{'postscripts'};
|
||||
if ($ps)
|
||||
{
|
||||
$ps = $et2->{'postscripts'};
|
||||
if ($ps)
|
||||
{
|
||||
foreach my $n (split(/,/, $ps))
|
||||
{
|
||||
if (!exists($post_hash{$n}))
|
||||
@@ -674,6 +673,7 @@ sub makescript
|
||||
push @scriptd, $n . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# get postscripts for node specific
|
||||
@@ -724,9 +724,10 @@ sub makescript
|
||||
}
|
||||
|
||||
# get postbootscripts for image
|
||||
my $ips = $et2->{'postbootscripts'};
|
||||
if ($ips)
|
||||
{
|
||||
if($provmethod !~ /^install$|^netboot$|^statelite$/){ # using imagename
|
||||
my $ips = $et2->{'postbootscripts'};
|
||||
if ($ips)
|
||||
{
|
||||
foreach my $n (split(/,/, $ips))
|
||||
{
|
||||
if (!exists($postboot_hash{$n}))
|
||||
@@ -735,6 +736,7 @@ sub makescript
|
||||
push @scriptd, $n . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,11 +13,20 @@ use xCAT::MsgUtils;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT_monitoring::monitorctrl;
|
||||
use Sys::Hostname;
|
||||
use File::Path qw/mkpath/;
|
||||
|
||||
#print "xCAT_monitoring::snmpmon loaded\n";
|
||||
1;
|
||||
|
||||
|
||||
my $confdir;
|
||||
if(xCAT::Utils->isAIX()){
|
||||
$::snmpconfdir = "/opt/freeware/etc";
|
||||
} else {
|
||||
$::snmpconfdir = "/usr/share/snmp";
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head1 xCAT_monitoring:snmpmon
|
||||
@@ -62,7 +71,11 @@ sub start {
|
||||
`/bin/kill -9 $pid`;
|
||||
}
|
||||
# start it up again!
|
||||
system("/usr/sbin/snmptrapd -m ALL");
|
||||
if(xCAT::Utils->isAIX()){
|
||||
system("/opt/freeware/sbin/snmptrapd -m ALL");
|
||||
} else {
|
||||
system("/usr/sbin/snmptrapd -m ALL");
|
||||
}
|
||||
|
||||
# get the PID of the currently running snmpd if it is running.
|
||||
# if it's running then we just leave. Otherwise, if we don't get A PID, then we
|
||||
@@ -265,7 +278,7 @@ sub config {
|
||||
}
|
||||
return (1, "net-snmp is not installed")
|
||||
} else {
|
||||
my ($ret, $err)=configSNMP();
|
||||
my ($ret, $err)=configSNMP(2, $noderef, $callback);
|
||||
if ($ret != 0) { return ($ret, $err);}
|
||||
}
|
||||
|
||||
@@ -323,19 +336,19 @@ sub deconfig {
|
||||
my $callback=shift;
|
||||
my $localhostname=hostname();
|
||||
|
||||
if (-f "/usr/share/snmp/snmptrapd.conf.orig"){
|
||||
if (-f "$::snmpconfdir/snmptrapd.conf.orig"){
|
||||
# copy back the old one
|
||||
`mv -f /usr/share/snmp/snmptrapd.conf.orig /usr/share/snmp/snmptrapd.conf`;
|
||||
`mv -f $::snmpconfdir/snmptrapd.conf.orig $::snmpconfdir/snmptrapd.conf`;
|
||||
} else {
|
||||
if (-f "/usr/share/snmp/snmptrapd.conf"){
|
||||
if (-f "$::snmpconfdir/snmptrapd.conf"){
|
||||
|
||||
# if the file exists, delete all entries that have xcat_traphandler
|
||||
my $cmd = "grep -v xcat_traphandler /usr/share/snmp/snmptrapd.conf ";
|
||||
$cmd .= "> /usr/share/snmp/snmptrapd.conf.unconfig ";
|
||||
my $cmd = "grep -v xcat_traphandler $::snmpconfdir/snmptrapd.conf ";
|
||||
$cmd .= "> $::snmpconfdir/snmptrapd.conf.unconfig ";
|
||||
`$cmd`;
|
||||
|
||||
# move it back to the snmptrapd.conf file.
|
||||
`mv -f /usr/share/snmp/snmptrapd.conf.unconfig /usr/share/snmp/snmptrapd.conf`;
|
||||
`mv -f $::snmpconfdir/snmptrapd.conf.unconfig $::snmpconfdir/snmptrapd.conf`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -837,45 +850,54 @@ sub configSwitch {
|
||||
=cut
|
||||
#--------------------------------------------------------------------------------
|
||||
sub configSNMP {
|
||||
my $action=shift;
|
||||
my $noderef=shift;
|
||||
my $callback=shift;
|
||||
|
||||
my $ret_val=0;
|
||||
my $ret_text="";
|
||||
|
||||
print "configSNMP called \n";
|
||||
my $isSN=xCAT::Utils->isServiceNode();
|
||||
my $master=xCAT::Utils->get_site_Master();
|
||||
my $cmd;
|
||||
# now move /usr/share/snmp/snmptrapd.conf to /usr/share/snmp/snmptrapd.conf.orig
|
||||
|
||||
# now move $::snmpconfdir/snmptrapd.conf to $::snmpconfdir/snmptrapd.conf.orig
|
||||
# if it exists.
|
||||
if (-f "/usr/share/snmp/snmptrapd.conf"){
|
||||
|
||||
mkpath("$::snmpconfdir");
|
||||
if (-f "$::snmpconfdir/snmptrapd.conf"){
|
||||
|
||||
# if the file exists and has references to xcat_traphandler in mn or 'forward' in sn
|
||||
# then there is nothing that needs to be done.
|
||||
if ($isSN) {
|
||||
`/bin/grep "forward default $master" /usr/share/snmp/snmptrapd.conf > /dev/null`;
|
||||
`/bin/grep "forward default $master" $::snmpconfdir/snmptrapd.conf > /dev/null`;
|
||||
} else {
|
||||
`/bin/grep xcat_traphandler /usr/share/snmp/snmptrapd.conf > /dev/null`;
|
||||
`/bin/grep xcat_traphandler $::snmpconfdir/snmptrapd.conf > /dev/null`;
|
||||
}
|
||||
|
||||
# if the return code is 1, then there is no xcat_traphandler, or 'forward'
|
||||
# references and we need to put them in.
|
||||
if($? >> 8){
|
||||
# back up the original file.
|
||||
`/bin/cp -f /usr/share/snmp/snmptrapd.conf /usr/share/snmp/snmptrapd.conf.orig`;
|
||||
`/bin/cp -f $::snmpconfdir/snmptrapd.conf $::snmpconfdir/snmptrapd.conf.orig`;
|
||||
|
||||
# if the file exists and does not have "authCommunity execute,net public" then add it.
|
||||
open(FILE1, "</usr/share/snmp/snmptrapd.conf");
|
||||
open(FILE, ">/usr/share/snmp/snmptrapd.conf.tmp");
|
||||
open(FILE1, "<$::snmpconfdir/snmptrapd.conf");
|
||||
open(FILE, ">$::snmpconfdir/snmptrapd.conf.tmp");
|
||||
my $found=0;
|
||||
my $forward_handled=0;
|
||||
while (readline(FILE1)) {
|
||||
if (/\s*authCommunity.*public/) {
|
||||
$found=1;
|
||||
if (/\s*authCommunity.*public/) {
|
||||
$found=1;
|
||||
if (!/\s*authCommunity\s*.*execute.*public/) {
|
||||
s/authCommunity\s*(.*)\s* public/authCommunity $1,execute public/; #modify it to have 'execute' if found
|
||||
}
|
||||
}
|
||||
if (!/\s*authCommunity\s*.*net.*public/) {
|
||||
s/authCommunity\s*(.*)\s* public/authCommunity $1,net public/; #modify it to have 'net' if found
|
||||
}
|
||||
}
|
||||
} elsif (/\s*forward\s*default/) {
|
||||
if (($isSN) && (!/$master/)) {
|
||||
s/\s*forward/\#forward/; #comment out the old one
|
||||
if (($isSN) && (!/$master/)) {
|
||||
s/\s*forward/\#forward/; #comment out the old one
|
||||
if (!$forward_handled) {
|
||||
print FILE "forward default $master\n";
|
||||
$forward_handled=1;
|
||||
@@ -891,7 +913,7 @@ sub configSNMP {
|
||||
if (!$found) { #add new one if not found
|
||||
print FILE "authCommunity log,execute,net public\n";
|
||||
}
|
||||
|
||||
|
||||
# now add the new traphandle commands:
|
||||
if (!$isSN) {
|
||||
print FILE "traphandle default $::XCATROOT/sbin/xcat_traphandler\n";
|
||||
@@ -899,13 +921,13 @@ sub configSNMP {
|
||||
|
||||
close(FILE1);
|
||||
close(FILE);
|
||||
`mv -f /usr/share/snmp/snmptrapd.conf.tmp /usr/share/snmp/snmptrapd.conf`;
|
||||
`mv -f $::snmpconfdir/snmptrapd.conf.tmp $::snmpconfdir/snmptrapd.conf`;
|
||||
}
|
||||
}
|
||||
else { # The snmptrapd.conf file does not exists
|
||||
# create the file:
|
||||
my $handle = new IO::File;
|
||||
open($handle, ">/usr/share/snmp/snmptrapd.conf");
|
||||
open($handle, ">$::snmpconfdir/snmptrapd.conf");
|
||||
print $handle "authCommunity log,execute,net public\n";
|
||||
if ($isSN) {
|
||||
print $handle "forward default $master\n"; #forward the trap from sn to mn
|
||||
@@ -915,6 +937,146 @@ sub configSNMP {
|
||||
close($handle);
|
||||
}
|
||||
|
||||
|
||||
# Configure SNMPv3 on AIX
|
||||
if(xCAT::Utils->isAIX()){
|
||||
#the identification of this node
|
||||
my @hostinfo=xCAT::Utils->determinehostname();
|
||||
my $isSV=xCAT::Utils->isServiceNode();
|
||||
my %iphash=();
|
||||
foreach(@hostinfo) {$iphash{$_}=1;}
|
||||
if (!$isSV) { $iphash{'noservicenode'}=1;}
|
||||
|
||||
my $all=0;
|
||||
my %nodehash=();
|
||||
if ((!$noderef) || (@$noderef==0)) {$all=1;}
|
||||
else {
|
||||
foreach(@$noderef) { $nodehash{$_}=1;}
|
||||
}
|
||||
|
||||
my %mpa_hash=();
|
||||
my %masterhash=();
|
||||
my @node_a=();
|
||||
my $table=xCAT::Table->new("mp");
|
||||
if ($table) {
|
||||
my @tmp1=$table->getAllNodeAttribs(['node','mpa']);
|
||||
if (@tmp1 > 0) {
|
||||
foreach(@tmp1) {
|
||||
my $node=$_->{node};
|
||||
my $mpa=$_->{mpa};
|
||||
if ((!$all) && (!exists($nodehash{$node})) && (!exists($nodehash{$mpa}))) {next;}
|
||||
|
||||
if ($mpa_hash{$mpa}) { next;} #already handled
|
||||
|
||||
$mpa_hash{$mpa}=1;
|
||||
|
||||
my $pHash=xCAT_monitoring::monitorctrl->getNodeMonServerPair([$mpa], 0);
|
||||
if (ref($pHash) eq 'ARRAY') {
|
||||
if ($callback) {
|
||||
my $rsp={};
|
||||
if ($ret_val) {
|
||||
$rsp->{data}->[0]=$pHash->[1];
|
||||
}
|
||||
$callback->($rsp);
|
||||
} else {
|
||||
xCAT::MsgUtils->message('S', "[mon]: " . $pHash->[1]);
|
||||
}
|
||||
return (0, "");
|
||||
}
|
||||
|
||||
my $pairs=$pHash->{$mpa};
|
||||
my @a_temp=split(':',$pairs);
|
||||
my $monserver=$a_temp[0];
|
||||
my $master=$a_temp[1];
|
||||
|
||||
if ($monserver) {
|
||||
if (!$iphash{$monserver}) { next;} #skip if has sn but not localhost
|
||||
} else {
|
||||
if ($isSV) { next; } #skip if does not have sn but localhost is a sn
|
||||
}
|
||||
|
||||
push(@node_a, $mpa);
|
||||
|
||||
# find the master node and add the node in the hash
|
||||
if(exists($masterhash{$master})) {
|
||||
my $ref=$masterhash{$master};
|
||||
push(@$ref, $mpa);
|
||||
} else { $masterhash{$master}=[$mpa]; }
|
||||
} #foreach
|
||||
}
|
||||
$table->close();
|
||||
}
|
||||
|
||||
if (@node_a==0){ return ($ret_val, $ret_text);} #nothing to handle
|
||||
|
||||
# Read username, password, and mac from DB.
|
||||
foreach my $mpa ( @node_a ) {
|
||||
my $mac;
|
||||
my $user;
|
||||
my $password;
|
||||
|
||||
my $mpatable=xCAT::Table->new("mpa");
|
||||
if ($mpatable) {
|
||||
my $mpa_a = $mpatable->getAttribs({mpa => $mpa}, 'username', 'password');
|
||||
if ( $mpa_a and $mpa_a->{username} and $mpa_a->{password} ) {
|
||||
$user = $mpa_a->{username};
|
||||
$password = $mpa_a->{password};
|
||||
} else {
|
||||
xCAT::MsgUtils->message('E', "No username or password found for $mpa");
|
||||
}
|
||||
}
|
||||
|
||||
my $mactable=xCAT::Table->new("mac");
|
||||
if ( $mactable ) {
|
||||
my $mac_a = $mactable->getAttribs({node=> $mpa}, 'mac');
|
||||
if ( $mac_a and $mac_a->{mac} ) {
|
||||
$mac = $mac_a->{mac};
|
||||
} else {
|
||||
xCAT::MsgUtils->message('E', "No mac found for $mpa");
|
||||
}
|
||||
}
|
||||
|
||||
my $found1=0;
|
||||
my $found2=0;
|
||||
if ( $mac and $user and $password ) {
|
||||
#write configuration file
|
||||
open(FILE1, "<$::snmpconfdir/snmptrapd.conf");
|
||||
open(FILE, ">$::snmpconfdir/snmptrapd.conf.tmp");
|
||||
while (readline(FILE1)) {
|
||||
if (/\s*authUser.*$user/) {
|
||||
$found1=1;
|
||||
if (!/\s*authUser\s*.*execute.*$user/) {
|
||||
s/authUser\s*(.*)\s* $user/authUser $1,execute $user/; #modify it to have 'execute' if found
|
||||
}
|
||||
}
|
||||
if (!/\s*authUser\s*.*net.*$user/) {
|
||||
s/authUser\s*(.*)\s* $user/authUser $1,net $user/; #modify it to have 'net' if found
|
||||
}
|
||||
|
||||
if (/\s*createUser.*$mac.*$user.*$password/) {
|
||||
$found2=1;
|
||||
}
|
||||
|
||||
print FILE $_;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!$found1) { #add new one if not found
|
||||
print FILE "authUser log,execute,net $user\n";
|
||||
}
|
||||
|
||||
if (!$found2) {
|
||||
print FILE "createUser -e 0x8000045001$mac $user SHA $password DES\n";
|
||||
}
|
||||
|
||||
close(FILE1);
|
||||
close(FILE);
|
||||
`mv -f $::snmpconfdir/snmptrapd.conf.tmp $::snmpconfdir/snmptrapd.conf`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# TODO: put the mib files to /usr/share/snmp/mibs
|
||||
return (0, "");
|
||||
}
|
||||
|
||||
@@ -1469,6 +1469,9 @@ sub enable_TFTPhpa
|
||||
# get the version of TCP/IP protocol
|
||||
my $protocols;
|
||||
my $v4only="-4 ";
|
||||
if (xCAT::Utils->osver() =~ /^sle[sc]10/) {
|
||||
$v4only = "";
|
||||
}
|
||||
open($protocols,"<","/proc/net/protocols");
|
||||
if ($protocols) {
|
||||
my $line;
|
||||
|
||||
@@ -273,7 +273,7 @@ sub processArgs
|
||||
}
|
||||
|
||||
# -t node is the default value
|
||||
if (!$::opt_t && !$::opt_a && ($::command eq "lsdef"))
|
||||
if (!$::opt_t && !$::opt_a && !$::opt_h && ($::command eq "lsdef"))
|
||||
{
|
||||
$::opt_t = 'node';
|
||||
}
|
||||
@@ -803,6 +803,10 @@ sub processArgs
|
||||
# for every type of data object get the list of defined objects
|
||||
foreach my $t (keys %{xCAT::Schema::defspec})
|
||||
{
|
||||
# exclude the auditlog and eventlog,
|
||||
# the auditlog and eventlog tables might be very big
|
||||
# use lsdef -t auditlog or lsdef -t eventlog instead
|
||||
if (($t eq 'auditlog') || ($t eq 'eventlog')) { next; }
|
||||
|
||||
$::objectsfrom_opta = 1;
|
||||
|
||||
@@ -1669,7 +1673,7 @@ sub defch
|
||||
{
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] =
|
||||
"\'$attr\' is not a valid attribute name for for an object type of \'$::objtype\'.";
|
||||
"\'$attr\' is not a valid attribute name for an object type of \'$::objtype\'.";
|
||||
$rsp->{data}->[1] = "Skipping to the next attribute.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::callback);
|
||||
$error = 1;
|
||||
@@ -2278,7 +2282,7 @@ sub setFINALattrs
|
||||
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] =
|
||||
"\'$attr\' is not a valid attribute name for for an object type of \'$::objtype\'.";
|
||||
"\'$attr\' is not a valid attribute name for an object type of \'$::objtype\'.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::callback);
|
||||
$error = 1;
|
||||
next;
|
||||
@@ -2729,6 +2733,18 @@ sub defls
|
||||
# for each type
|
||||
foreach my $type (@::clobjtypes)
|
||||
{
|
||||
# Check if -i specifies valid attributes
|
||||
# get the data type definition from Schema.pm
|
||||
my %validattrslist;
|
||||
if ($::opt_i)
|
||||
{
|
||||
my $datatype = $xCAT::Schema::defspec{$type};
|
||||
foreach my $this_attr (sort @{$datatype->{'attrs'}})
|
||||
{
|
||||
my $a = $this_attr->{attr_name};
|
||||
$validattrslist{$a} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
my %defhash;
|
||||
|
||||
@@ -2803,10 +2819,32 @@ sub defls
|
||||
my @attrlist;
|
||||
if (($type ne 'site') && ($type ne 'monitoring'))
|
||||
{
|
||||
# get the list of all attrs for this type object
|
||||
# -i is specified
|
||||
if (scalar(@::AttrList) > 0) {
|
||||
@attrlist = @::AttrList;
|
||||
foreach my $attr (@::AttrList)
|
||||
{
|
||||
# For site and monitoring, does not check if -i attributes are valid
|
||||
if (($type eq 'site') || ($type eq 'monitoring'))
|
||||
{
|
||||
@attrlist = @::AttrList;
|
||||
} else {
|
||||
if (defined($validattrslist{$attr}))
|
||||
{
|
||||
if (!grep(/^$attr$/, @attrlist))
|
||||
{
|
||||
push @attrlist, $attr;
|
||||
}
|
||||
} else {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] =
|
||||
"\'$attr\' is not a valid attribute name for an object type of \'$type\'.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::callback);
|
||||
next;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# get the list of all attrs for this type object
|
||||
# get the data type definition from Schema.pm
|
||||
my $datatype =
|
||||
$xCAT::Schema::defspec{$type};
|
||||
|
||||
@@ -5940,7 +5940,7 @@ sub rmnimres
|
||||
}
|
||||
|
||||
# foreach attr in the image def
|
||||
my $error;
|
||||
my $error=0;
|
||||
foreach my $attr (sort(keys %{$imagedef{$osimage}}))
|
||||
{
|
||||
chomp $attr;
|
||||
@@ -6012,7 +6012,6 @@ sub rmnimres
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "The resource named \'$resname\' will not be removed.\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
$error++;
|
||||
next;
|
||||
}
|
||||
|
||||
@@ -6066,7 +6065,6 @@ sub rmnimres
|
||||
if ($loc)
|
||||
{
|
||||
my $cmd = qq~/usr/bin/rm -R $loc~;
|
||||
my $output = xCAT::Utils->runcmd("$cmd", -1);
|
||||
$output = xCAT::InstUtils->xcmd($callback, $subreq, "xdsh", $targetsn, $cmd, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ sub process_request
|
||||
sub using_dracut
|
||||
{
|
||||
my $os = shift;
|
||||
if ($os =~ /(rhels|rhel)(\d+)/) {
|
||||
if ($os =~ /(rhels|rhel|centos)(\d+)/) {
|
||||
if ($2 >= 6) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -55,13 +55,13 @@ sub handled_commands {
|
||||
getrvidparms => 'nodehm:mgt',
|
||||
rvitals => 'nodehm:mgt=blade|fsp',
|
||||
rinv => 'nodehm:mgt',
|
||||
rbeacon => 'nodehm:mgt',
|
||||
rbeacon => 'nodehm:mgt=blade|fsp',
|
||||
rspreset => 'nodehm:mgt',
|
||||
rspconfig => 'nodehm:mgt=blade|fsp', # Get into blade.pm for rspconfig if mgt equals blade or fsp
|
||||
rbootseq => 'nodehm:mgt',
|
||||
reventlog => 'nodehm:mgt',
|
||||
reventlog => 'nodehm:mgt=blade|fsp',
|
||||
switchblade => 'nodehm:mgt',
|
||||
renergy => 'nodehm:mgt',
|
||||
renergy => 'nodehm:mgt=blade|fsp|ipmi',
|
||||
lsflexnode => 'blade',
|
||||
mkflexnode => 'blade',
|
||||
rmflexnode => 'blade',
|
||||
@@ -400,16 +400,19 @@ sub eventlog { #Tried various optimizations, but MM seems not to do bulk-request
|
||||
my $text=$5;
|
||||
my $matchstring;
|
||||
if ($slot > 0) {
|
||||
$matchstring=sprintf("BLADE_%02d",$slot);
|
||||
#$matchstring=sprintf("BLADE_%02d",$slot);
|
||||
$matchstring=sprintf("NODE_%02d",$slot);
|
||||
} else {
|
||||
$matchstring="^(?!BLADE).*";
|
||||
#$matchstring="^(?!BLADE).*";
|
||||
$matchstring="^(?!NODE).*";
|
||||
}
|
||||
if ($source =~ m/$matchstring$/i) { #MM guys changed their minds on capitalization
|
||||
$numentries++;
|
||||
unshift @output,"$sev:$date $time $text"; #unshift to get it in a sane order
|
||||
} else {
|
||||
foreach (@moreslots) {
|
||||
$matchstring=sprintf("BLADE_%02d",$_);
|
||||
#$matchstring=sprintf("BLADE_%02d",$_);
|
||||
$matchstring=sprintf("NODE_%02d",$_);
|
||||
if ($source =~ m/$matchstring$/i) { #MM guys changed their minds on capitalization
|
||||
$numentries++;
|
||||
unshift @output,"$sev:$date $time $text"; #unshift to get it in a sane order
|
||||
@@ -874,12 +877,15 @@ sub vitals {
|
||||
my $tmp;
|
||||
|
||||
if ( defined $slot and $slot > 0) { #-- querying some blade
|
||||
|
||||
if (grep /watt/,@vitems) {
|
||||
if ($slot < 8) {
|
||||
$tmp = $session->get(["1.3.6.1.4.1.2.3.51.2.2.10.2.1.1.7.".($slot+16)]);
|
||||
if ($mpatype eq 'cmm') {
|
||||
$tmp = $session->get(["1.3.6.1.4.1.2.3.51.2.2.10.2.1.1.7.".($slot+24)]);
|
||||
} else {
|
||||
$tmp = $session->get(["1.3.6.1.4.1.2.3.51.2.2.10.3.1.1.7.".($slot+9)]);
|
||||
if ($slot < 8) {
|
||||
$tmp = $session->get(["1.3.6.1.4.1.2.3.51.2.2.10.2.1.1.7.".($slot+16)]);
|
||||
} else {
|
||||
$tmp = $session->get(["1.3.6.1.4.1.2.3.51.2.2.10.3.1.1.7.".($slot+9)]);
|
||||
}
|
||||
}
|
||||
unless ($tmp =~ /Not Readable/) {
|
||||
if ($tmp =~ /(\d+)W/) {
|
||||
@@ -1483,7 +1489,13 @@ sub rscan {
|
||||
if ($name =~ /Comm Error/) {
|
||||
next;
|
||||
}
|
||||
|
||||
if ($data[1] =~ /\(\s*([^\s]*)\s*\)/) {
|
||||
$name = $1;
|
||||
} elsif ($data[1] =~ /^\s*([^s]*)\s*$/) {
|
||||
$name = $1;
|
||||
$name =~ s/ /_/;
|
||||
$name =~ tr/A-Z/a-z/;
|
||||
}
|
||||
if (exists($opt{u})) {
|
||||
## TRACE_LINE print "Rscan: orig_name [$name]\n";
|
||||
|
||||
@@ -1717,7 +1729,17 @@ sub rscan_stanza {
|
||||
if ($data[1] =~ /Comm Error/) {
|
||||
next;
|
||||
}
|
||||
$result .= "$data[1]:\n\tobjtype=node\n";
|
||||
my $objname;
|
||||
if ($data[1] =~ /\(\s*([^\s]*)\s*\)/) {
|
||||
$objname = $1;
|
||||
} elsif ($data[1] =~ /^\s*([^s]*)\s*$/) {
|
||||
$objname = $1;
|
||||
$objname =~ s/ /_/;
|
||||
$objname =~ tr/A-Z/a-z/;
|
||||
} else {
|
||||
$objname = $data[1];
|
||||
}
|
||||
$result .= "$objname:\n\tobjtype=node\n";
|
||||
|
||||
foreach ( @rscan_attribs ) {
|
||||
my $d = $data[$i++];
|
||||
@@ -2221,6 +2243,25 @@ my $savingstatus_oid = ".1.3.6.1.4.1.2.3.51.2.2.10.4.1.1.1.6"; #bladeDetailsP
|
||||
my $dsavingstatus_oid = ".1.3.6.1.4.1.2.3.51.2.2.10.4.1.1.1.7"; #bladeDetailsDynamicPowerSaver
|
||||
my $dsperformance_oid = ".1.3.6.1.4.1.2.3.51.2.2.10.4.1.1.1.8"; #bladeDetailsDynamicPowerFavorPerformanceOverPower
|
||||
|
||||
# New attributes which supported by CMM
|
||||
my $PowerControl_oid = ".1.3.6.1.4.1.2.3.51.2.2.10.4.1.1.1.9"; #bladeDetailsPowerControl
|
||||
my $PowerPcapMin_oid = ".1.3.6.1.4.1.2.3.51.2.2.10.4.1.1.1.10"; #bladeDetailsPcapMin
|
||||
my $PowerPcapGMin_oid = ".1.3.6.1.4.1.2.3.51.2.2.10.4.1.1.1.11"; #bladeDetailsPcapGuaranteedMin
|
||||
my $PowerPcapMax_oid = ".1.3.6.1.4.1.2.3.51.2.2.10.4.1.1.1.12"; #bladeDetailsPcapMax
|
||||
|
||||
# New table used to control the power management
|
||||
#my $powerPcapMin =".1.3.6.1.4.1.2.3.51.2.22.31.6.1.10"; # componentPowerDetailsPcapMin
|
||||
#my $powerPcapGMin = ".1.3.6.1.4.1.2.3.51.2.22.31.6.1.11"; # componentPowerDetailsPcapGuaranteedMin
|
||||
#my $powerPcapMax = ".1.3.6.1.4.1.2.3.51.2.22.31.6.1.12"; # componentPowerDetailsPcapMax
|
||||
|
||||
#my $powerPcapSet = ".1.3.6.1.4.1.2.3.51.2.22.31.6.1.3"; # componentPowerDetailsMaxPowerConfig
|
||||
#my $powerControl = ".1.3.6.1.4.1.2.3.51.2.22.31.6.1.9"; # componentPowerDetailsPowerControl
|
||||
#my $powersavingstatus_oid = ".1.3.6.1.4.1.2.3.51.2.22.31.6.1.6"; #componentPowerDetailsPowerSaverMode
|
||||
#my $powerdsavingstatus_oid = ".1.3.6.1.4.1.2.3.51.2.22.31.6.1.7"; #componentPowerDetailsDynamicPowerSaver
|
||||
#my $powerdsperformance_oid = ".1.3.6.1.4.1.2.3.51.2.22.31.6.1.8"; #componentPowerDetailsDynamicPowerFavorPerformanceOverPower
|
||||
|
||||
|
||||
|
||||
# The meaning of obj fuelGaugePowerManagementPolicySetting
|
||||
my %pdpolicymap = (
|
||||
'0' => "redundantWithoutPerformanceImpact",
|
||||
@@ -2239,16 +2280,14 @@ my %capabilitymap = (
|
||||
'3' => "dynamicPowerManagement",
|
||||
'4' => "dynamicPowerMeasurement1",
|
||||
'5' => "dynamicPowerMeasurement2",
|
||||
'6' => "dynamicPowerMeasurement2",
|
||||
'6' => "dynamicPowerMeasurementWithPowerCapping",
|
||||
'255' => "notApplicable",
|
||||
);
|
||||
|
||||
# The valid attributes the renergy command can support
|
||||
# 1 for readonly; 2 for write; 3 readwrite
|
||||
|
||||
my %mm_valid_items = (
|
||||
'all' => 1,
|
||||
'pd1all' => 1,
|
||||
'pd2all' => 1,
|
||||
'pd1status' => 1,
|
||||
'pd2status' => 1,
|
||||
'pd1policy' => 1,
|
||||
@@ -2271,8 +2310,45 @@ my %mm_valid_items = (
|
||||
'ambienttemp' => 1,
|
||||
'mmtemp' => 1,
|
||||
);
|
||||
|
||||
my %cmm_valid_items = (
|
||||
'powerstatus' => 1,
|
||||
'powerpolicy' => 1,
|
||||
'powermodule' => 1,
|
||||
'avaiablepower' => 1,
|
||||
'reservedpower' => 1,
|
||||
'remainpower' => 1,
|
||||
'inusedpower' => 1,
|
||||
'availableDC' => 1,
|
||||
'averageAC' => 1,
|
||||
'thermaloutput' => 1,
|
||||
'ambienttemp' => 1,
|
||||
'mmtemp' => 1,
|
||||
);
|
||||
|
||||
my %pd1_valid_items = (
|
||||
'pd1status' => 1,
|
||||
'pd1policy' => 1,
|
||||
'pd1powermodule1' => 1,
|
||||
'pd1powermodule2' => 1,
|
||||
'pd1avaiablepower' => 1,
|
||||
'pd1reservedpower' => 1,
|
||||
'pd1remainpower' => 1,
|
||||
'pd1inusedpower' => 1,
|
||||
);
|
||||
|
||||
my %pd2_valid_items = (
|
||||
'pd2status' => 1,
|
||||
'pd2policy' => 1,
|
||||
'pd2powermodule1' => 1,
|
||||
'pd2powermodule2' => 1,
|
||||
'pd2avaiablepower' => 1,
|
||||
'pd2reservedpower' => 1,
|
||||
'pd2remainpower' => 1,
|
||||
'pd2inusedpower' => 1,
|
||||
);
|
||||
|
||||
my %blade_valid_items = (
|
||||
'all' => 1,
|
||||
'averageDC' => 1,
|
||||
'cappingmaxmin' => 0,
|
||||
'cappingmax' => 0,
|
||||
@@ -2287,6 +2363,22 @@ my %blade_valid_items = (
|
||||
'dsavingstatus' => 3,
|
||||
);
|
||||
|
||||
my %flex_blade_valid_items = (
|
||||
'averageDC' => 1,
|
||||
'cappingmaxmin' => 1,
|
||||
'cappingmax' => 1,
|
||||
'cappingmin' => 1,
|
||||
'cappingGmin' => 1,
|
||||
'capability' => 1,
|
||||
'cappingvalue' => 1,
|
||||
'cappingwatt' => 2,
|
||||
'cappingperc' => 2,
|
||||
'CPUspeed' => 1,
|
||||
'maxCPUspeed' => 1,
|
||||
'cappingstatus' => 3,
|
||||
'savingstatus' => 3,
|
||||
'dsavingstatus' => 3,
|
||||
);
|
||||
|
||||
# use the slot number of serverblade to get the powerdomain number
|
||||
# and the bay number in the powerdomain
|
||||
@@ -2325,6 +2417,9 @@ sub getpdbayinfo {
|
||||
$pdnum = 1;
|
||||
$pdbay = $slot + 17;
|
||||
}
|
||||
} elsif ($bc_type =~ /^7893$/) { # for flex
|
||||
$pdnum = 1;
|
||||
$pdbay = $slot + 24;
|
||||
} else { # for common blade center
|
||||
if ($slot < 7) {
|
||||
$pdnum = 1;
|
||||
@@ -2361,59 +2456,100 @@ sub renergy {
|
||||
if (!$item) {
|
||||
next;
|
||||
}
|
||||
my $readpath = ();
|
||||
my $checkpath = ();
|
||||
if ($item =~ /^all$/) {
|
||||
if ($mpa eq $node) {
|
||||
#handle the mm itself
|
||||
push @readlist, ('pd1status','pd2status','pd1policy','pd2policy',
|
||||
'pd1powermodule1','pd1powermodule2','pd2powermodule1',
|
||||
'pd2powermodule2','pd1avaiablepower','pd2avaiablepower',
|
||||
'pd1reservedpower','pd2reservedpower','pd1remainpower',
|
||||
'pd2remainpower','pd1inusedpower','pd2inusedpower',
|
||||
'availableDC','averageAC','thermaloutput','ambienttemp',
|
||||
'mmtemp');
|
||||
if ($mptype eq "cmm") {
|
||||
$readpath = \%cmm_valid_items;
|
||||
} else { # Assume it's AMM
|
||||
$readpath = \%mm_valid_items;
|
||||
}
|
||||
} else {
|
||||
push @readlist, ('averageDC','capability','cappingvalue','CPUspeed','maxCPUspeed','savingstatus','dsavingstatus');
|
||||
if ($mptype eq "cmm") {
|
||||
$readpath = \%flex_blade_valid_items;
|
||||
} else { # Assume it's AMM
|
||||
$readpath = \%blade_valid_items;
|
||||
}
|
||||
}
|
||||
} elsif ($item =~ /^pd1all$/) {
|
||||
push @readlist, ('pd1status','pd1policy','pd1powermodule1',
|
||||
'pd1powermodule2','pd1avaiablepower','pd1reservedpower',
|
||||
'pd1remainpower','pd1inusedpower');
|
||||
if ($mpa ne $node) {
|
||||
return (1, "pd1all is NOT available for flex or blade center server.");
|
||||
}
|
||||
if ($mptype eq "cmm") { # It only works for AMM
|
||||
return (1, "pd1all is NOT available for flex chassis.");
|
||||
}
|
||||
$readpath = \%pd1_valid_items;
|
||||
} elsif ($item =~ /^pd2all$/) {
|
||||
push @readlist, ('pd2status','pd2policy','pd2powermodule1',
|
||||
'pd2powermodule2','pd2avaiablepower','pd2reservedpower',
|
||||
'pd2remainpower','pd2inusedpower');
|
||||
if ($mpa ne $node) {
|
||||
return (1, "pd2all is NOT available for flex or blade center server.");
|
||||
}
|
||||
if ($mptype eq "cmm") { # It only works for AMM
|
||||
return (1, "pd2all is NOT available for flex chassis.");
|
||||
}
|
||||
$readpath = \%pd2_valid_items;
|
||||
} elsif ($item =~ /^cappingmaxmin$/) {
|
||||
push @readlist, ('cappingmin','cappingmax');
|
||||
} elsif ($item =~ /(.*)=(.*)/) {
|
||||
my $name = $1;
|
||||
my $value = $2;
|
||||
if ($mpa eq $node) {
|
||||
if ($mm_valid_items{$name} < 2) {
|
||||
return (1, "$name is NOT writable.");
|
||||
if ($mptype eq "cmm") {
|
||||
$checkpath = \%cmm_valid_items;
|
||||
} else {
|
||||
$checkpath = \%mm_valid_items;
|
||||
}
|
||||
} else {
|
||||
if ($blade_valid_items{$name} < 2) {
|
||||
return (1, "$name is NOT writable.");
|
||||
if ($mptype eq "cmm") {
|
||||
$checkpath = \%flex_blade_valid_items;
|
||||
} else {
|
||||
$checkpath = \%blade_valid_items;
|
||||
}
|
||||
}
|
||||
|
||||
if ($checkpath->{$name} < 2) {
|
||||
return (1, "$name is NOT writable.");
|
||||
}
|
||||
|
||||
$writelist{$name} = $value;
|
||||
#if ($name eq "cappingwatt" || $name eq "cappingperc") {
|
||||
# push @r4wlist, ('cappingmin','cappingmax');
|
||||
#}
|
||||
if ($name eq "cappingwatt" || $name eq "cappingperc") {
|
||||
push @r4wlist, ('cappingmin','cappingmax');
|
||||
}
|
||||
} else {
|
||||
if ($mpa eq $node) {
|
||||
if ($mm_valid_items{$item} != 1 && $mm_valid_items{$item} != 3) {
|
||||
return (1, "$item is NOT a valid attribute.");
|
||||
if ($mptype eq "cmm") {
|
||||
$checkpath = \%cmm_valid_items;
|
||||
} else {
|
||||
$checkpath = \%mm_valid_items;
|
||||
}
|
||||
} else {
|
||||
if ($blade_valid_items{$item} != 1 && $blade_valid_items{$item} != 3) {
|
||||
return (1, "$item is NOT a valid attribute.");
|
||||
if ($mptype eq "cmm") {
|
||||
$checkpath = \%flex_blade_valid_items;
|
||||
} else {
|
||||
$checkpath = \%blade_valid_items;
|
||||
}
|
||||
}
|
||||
|
||||
if ($checkpath->{$item} != 1 && $checkpath->{$item} != 3) {
|
||||
return (1, "$item is NOT a valid attribute.");
|
||||
}
|
||||
|
||||
push @readlist, $item;
|
||||
}
|
||||
|
||||
# Handle the attribute equals 'all', 'pd1all', 'pd2all'
|
||||
if ($readpath) {
|
||||
foreach (keys %$readpath) {
|
||||
if ($readpath->{$_} == 1 || $readpath->{$_} == 3) {
|
||||
if (/^cappingmaxmin$/) { next;}
|
||||
push @readlist, $_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# does not support to read and write in one command
|
||||
if ( @readlist && %writelist ) {
|
||||
return (1, "Cannot handle read and write in one command.");
|
||||
@@ -2440,15 +2576,15 @@ sub renergy {
|
||||
my @output = ();
|
||||
foreach my $item (sort(@readlist)) {
|
||||
my $oid = "";
|
||||
if ($item eq "pd1status") {
|
||||
if ($item =~ /^(pd1status|powerstatus)$/) {
|
||||
$oid = $pdstatus_oid.".1";
|
||||
} elsif ($item eq "pd2status") {
|
||||
$oid = $pdstatus_oid.".2";
|
||||
} elsif ($item eq "pd1policy") {
|
||||
} elsif ($item =~ /^(pd1policy|powerpolicy)$/) {
|
||||
$oid = $pdpolicy_oid.".1";
|
||||
} elsif ($item eq "pd2policy") {
|
||||
$oid = $pdpolicy_oid.".2";
|
||||
} elsif ($item eq "pd1powermodule1") {
|
||||
} elsif ($item =~ /^(pd1powermodule1|powermodule)$/) {
|
||||
$oid = $pdmodule1_oid.".1";
|
||||
} elsif ($item eq "pd2powermodule1") {
|
||||
$oid = $pdmodule1_oid.".2";
|
||||
@@ -2456,19 +2592,19 @@ sub renergy {
|
||||
$oid = $pdmodule2_oid.".1";
|
||||
} elsif ($item eq "pd2powermodule2") {
|
||||
$oid = $pdmodule2_oid.".2";
|
||||
} elsif ($item eq "pd1avaiablepower") {
|
||||
} elsif ($item =~ /^(pd1avaiablepower|avaiablepower)$/) {
|
||||
$oid = $pdavailablepower_oid.".1";
|
||||
} elsif ($item eq "pd2avaiablepower") {
|
||||
$oid = $pdavailablepower_oid.".2";
|
||||
} elsif ($item eq "pd1reservedpower") {
|
||||
} elsif ($item =~ /^(pd1reservedpower|reservedpower)$/) {
|
||||
$oid = $pdreservepower_oid.".1";
|
||||
} elsif ($item eq "pd2reservedpower") {
|
||||
$oid = $pdreservepower_oid.".2";
|
||||
} elsif ($item eq "pd1remainpower") {
|
||||
} elsif ($item =~ /^(pd1remainpower|remainpower)$/) {
|
||||
$oid = $pdremainpower_oid.".1";
|
||||
} elsif ($item eq "pd2remainpower") {
|
||||
$oid = $pdremainpower_oid.".2";
|
||||
} elsif ($item eq "pd1inusedpower") {
|
||||
} elsif ($item =~ /^(pd1inusedpower|inusedpower)$/) {
|
||||
$oid = $pdinused_oid.".1";
|
||||
} elsif ($item eq "pd2inusedpower") {
|
||||
$oid = $pdinused_oid.".2";
|
||||
@@ -2490,30 +2626,26 @@ sub renergy {
|
||||
$pdnum++;
|
||||
$oid =~ s/pdnum/$pdnum/;
|
||||
$oid = $oid.".".$pdbay;
|
||||
} elsif ($item eq "cappingmax") {
|
||||
my ($pdnum, $pdbay) = getpdbayinfo($bc_type, $slot);
|
||||
$oid = $maxallocpower_oid;
|
||||
$pdnum++;
|
||||
$oid =~ s/pdnum/$pdnum/;
|
||||
$oid = $oid.".".$pdbay;
|
||||
} elsif ($item eq "cappingmin") {
|
||||
my ($pdnum, $pdbay) = getpdbayinfo($bc_type, $slot);
|
||||
$oid = $minallocpower_oid;
|
||||
$pdnum++;
|
||||
$oid =~ s/pdnum/$pdnum/;
|
||||
$oid = $oid.".".$pdbay;
|
||||
} elsif ($item eq "capability") {
|
||||
} elsif ($item eq "capability") {
|
||||
my ($pdnum, $pdbay) = getpdbayinfo($bc_type, $slot);
|
||||
$oid = $powercapability_oid;
|
||||
$pdnum++;
|
||||
$oid =~ s/pdnum/$pdnum/;
|
||||
$oid = $oid.".".$pdbay;
|
||||
} elsif ($item eq "cappingmax") {
|
||||
$oid = $PowerPcapMax_oid.".".$slot;
|
||||
} elsif ($item eq "cappingmin") {
|
||||
$oid = $PowerPcapMin_oid.".".$slot;
|
||||
} elsif ($item eq "cappingGmin") {
|
||||
$oid = $PowerPcapGMin_oid.".".$slot;
|
||||
} elsif ($item eq "cappingvalue") {
|
||||
$oid = $powercapping_oid.".".$slot;
|
||||
} elsif ($item eq "CPUspeed") {
|
||||
$oid = $effCPU_oid.".".$slot;
|
||||
} elsif ($item eq "maxCPUspeed") {
|
||||
$oid = $maxCPU_oid.".".$slot;
|
||||
} elsif ($item eq "cappingstatus") {
|
||||
$oid = $PowerControl_oid.".".$slot;
|
||||
} elsif ($item eq "savingstatus") {
|
||||
$oid = $savingstatus_oid.".".$slot;
|
||||
} elsif ($item eq "dsavingstatus") {
|
||||
@@ -2529,28 +2661,39 @@ sub renergy {
|
||||
if ($data ne ""
|
||||
&& $data ne "NOSUCHINSTANCE"
|
||||
&& $data ne "notApplicable" ) {
|
||||
if ($item =~ /pd[1|2]policy/) {
|
||||
if ($item =~ /^(pd1|pd2|power)policy$/) {
|
||||
push @output, "$item: $pdpolicymap{$data}";
|
||||
} elsif ($item eq "capability") {
|
||||
push @output, "$item: $capabilitymap{$data}";
|
||||
} elsif ($item =~/cappingvalue|averageDC|cappingmax|cappingmin/) {
|
||||
} elsif ($item =~/cappingvalue|averageDC|cappingmax|cappingmin|cappingGmin/) {
|
||||
if ($item eq "cappingvalue" && $data eq "0") {
|
||||
push @output,"$item: na";
|
||||
} else {
|
||||
my $bladewidth = $session->get([$bladewidth_oid.".$slot"]);
|
||||
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
|
||||
$data =~ s/W$//;
|
||||
$data =~ s/[^\d]*$//;
|
||||
foreach (1..$bladewidth-1) {
|
||||
$oid =~ /(\d+)$/;
|
||||
my $next = $1+$_;
|
||||
$oid =~ s/(\d+)$/$next/;
|
||||
my $nextdata=$session->get([$oid]);
|
||||
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
|
||||
$nextdata =~ s/W$//;
|
||||
$nextdata =~ s/[^\d]*$//;
|
||||
$data += $nextdata;
|
||||
}
|
||||
push @output, "$item: $data"."W";
|
||||
}
|
||||
} elsif ($item eq "cappingstatus") {
|
||||
if ($data eq "2" || $data eq "5" || $data eq "10") {
|
||||
# 1 all off; 2 cap;
|
||||
# 4 staticsaving; 5 cap + staticsaving;
|
||||
# 9 dynamicsaving; 10 cap + dynamicsaving;
|
||||
push @output,"$item: on";
|
||||
} elsif ($data eq "0" || $data eq "1" || $data eq "3" || $data eq "4" || $data eq "9") {
|
||||
push @output, "$item: off";
|
||||
} else {
|
||||
push @output,"$item: na";
|
||||
}
|
||||
} elsif ($item eq "savingstatus") {
|
||||
if ($data eq "0") {
|
||||
push @output,"$item: off";
|
||||
@@ -2593,43 +2736,141 @@ sub renergy {
|
||||
foreach my $item (keys %writelist) {
|
||||
my $oid = "";
|
||||
my $svalue;
|
||||
my $cvalue;
|
||||
|
||||
my $capmax;
|
||||
my $capmin;
|
||||
if ($item eq "cappingwatt" || $item eq "cappingperc") {
|
||||
if (0) {
|
||||
foreach my $i (@setneed) {
|
||||
if ($i =~ /^cappingmax: (\d*)W/) {
|
||||
$capmax = $1;
|
||||
} elsif ($i =~ /^cappingmin: (\d*)W/) {
|
||||
$capmin = $1;
|
||||
}
|
||||
if ($item eq "cappingstatus") {
|
||||
if ($writelist{$item} eq "on") {
|
||||
$cvalue = "1";
|
||||
} elsif ($writelist{$item} eq "off") {
|
||||
$cvalue = "0";
|
||||
} else {
|
||||
return (1, "The setting value should be on|off.");
|
||||
}
|
||||
|
||||
if (! (defined ($capmax) && defined ($capmin))) {
|
||||
return (1, "Cannot get the value of cappingmin or cappingmax.");
|
||||
}
|
||||
|
||||
if ($item eq "cappingwatt" && ($writelist{$item} > $capmax || $writelist{$item} < $capmin)) {
|
||||
return (1, "The set value should be in the range $capmin - $capmax.");
|
||||
}
|
||||
|
||||
if ($item eq "cappingperc") {
|
||||
if ($writelist{$item} > 100 || $writelist{$item} < 0) {
|
||||
return (1, "The percentage value should be in the range 0 - 100");
|
||||
}
|
||||
$writelist{$item} = int (($capmax-$capmin)*$writelist{$item}/100 + $capmin);
|
||||
}
|
||||
}
|
||||
|
||||
my $data = $session->set(new SNMP::Varbind([$powercapping_oid, $slot, $writelist{$item} ,'INTEGER']));
|
||||
unless ($data) { return (1,$session->{ErrorStr}); }
|
||||
|
||||
my $ndata=$session->get([$powercapping_oid.".".$slot]);
|
||||
# Get the power control value
|
||||
my $cdata = $session->get([$PowerControl_oid.".".$slot]);
|
||||
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
|
||||
if ($ndata ne $writelist{$item}) {
|
||||
|
||||
# 1 all off; 2 cap;
|
||||
# 4 staticsaving; 5 cap + staticsaving;
|
||||
# 9 dynamicsaving; 10 cap + dynamicsaving;
|
||||
|
||||
if ($cvalue eq "1") {
|
||||
# to enable capping
|
||||
if ($cdata eq "2" || $cdata eq "5" || $cdata eq "10") {
|
||||
return (0, "Power capping has been enabled.");
|
||||
} elsif ($cdata eq "0" || $cdata eq "1") {
|
||||
$cvalue = "2";
|
||||
} elsif ($cdata eq "4") {
|
||||
$cvalue = "5";
|
||||
} elsif ($cdata eq "9") {
|
||||
$cvalue = "10";
|
||||
} else {
|
||||
return (1, "Encountered error to turn on capping.");
|
||||
}
|
||||
} else {
|
||||
# to disable capping
|
||||
if ($cdata eq "1" || $cdata eq "4" || $cdata eq "9") {
|
||||
return (0, "Power capping has been disabled.");
|
||||
} elsif ($cdata eq "2") {
|
||||
$cvalue = "1";
|
||||
} elsif ($cdata eq "5") {
|
||||
$cvalue = "4";
|
||||
} elsif ($cdata eq "10") {
|
||||
$cvalue = "9";
|
||||
} else {
|
||||
return (1, "Encountered error to turn off capping.");
|
||||
}
|
||||
}
|
||||
|
||||
my $data = $session->set(new SNMP::Varbind([$PowerControl_oid, $slot, $cvalue ,'INTEGER']));
|
||||
unless ($data) { return (1,$session->{ErrorStr}); }
|
||||
|
||||
my $rdata=$session->get([$PowerControl_oid.".".$slot]);
|
||||
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
|
||||
if ($rdata ne $cvalue) {
|
||||
return (1, "$item: set operation failed.");
|
||||
}
|
||||
} elsif ($item eq "cappingwatt" || $item eq "cappingperc") {
|
||||
my $bladewidth = $session->get([$bladewidth_oid.".$slot"]);
|
||||
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
|
||||
if ($bladewidth == 1) {
|
||||
foreach my $i (@setneed) {
|
||||
if ($i =~ /^cappingmax: (\d*)W/) {
|
||||
$capmax = $1;
|
||||
} elsif ($i =~ /^cappingmin: (\d*)W/) {
|
||||
$capmin = $1;
|
||||
}
|
||||
}
|
||||
|
||||
if (! (defined ($capmax) && defined ($capmin))) {
|
||||
return (1, "Cannot get the value of cappingmin or cappingmax.");
|
||||
}
|
||||
|
||||
if ($item eq "cappingwatt" && ($writelist{$item} > $capmax || $writelist{$item} < $capmin)) {
|
||||
return (1, "The set value should be in the range $capmin - $capmax.");
|
||||
}
|
||||
|
||||
if ($item eq "cappingperc") {
|
||||
if ($writelist{$item} > 100 || $writelist{$item} < 0) {
|
||||
return (1, "The percentage value should be in the range 0 - 100");
|
||||
}
|
||||
$writelist{$item} = int (($capmax-$capmin)*$writelist{$item}/100 + $capmin);
|
||||
}
|
||||
|
||||
my $data = $session->set(new SNMP::Varbind([$powercapping_oid, $slot, $writelist{$item} ,'INTEGER']));
|
||||
unless ($data) { return (1,$session->{ErrorStr}); }
|
||||
|
||||
my $ndata=$session->get([$powercapping_oid.".".$slot]);
|
||||
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
|
||||
if ($ndata ne $writelist{$item}) {
|
||||
return (1, "$item: set operation failed.");
|
||||
}
|
||||
} elsif ($bladewidth == 2) {
|
||||
# for double wide blade, the capping needs to be set for the two slots one by one
|
||||
# base on the min/max of the slots to know the rate of how many set to slot1 and how many set to slot2
|
||||
my $min1 = $session->get([$PowerPcapMin_oid.".".$slot]);
|
||||
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
|
||||
my $min2 = $session->get([$PowerPcapMin_oid.".".($slot+1)]);
|
||||
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
|
||||
my $max1 = $session->get([$PowerPcapMax_oid.".".$slot]);
|
||||
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
|
||||
my $max2 = $session->get([$PowerPcapMax_oid.".".($slot+1)]);
|
||||
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
|
||||
|
||||
my ($cv1, $cv2);
|
||||
if ($item eq "cappingperc") {
|
||||
if ($writelist{$item} > 100 || $writelist{$item} < 0) {
|
||||
return (1, "The percentage value should be in the range 0 - 100");
|
||||
}
|
||||
$cv1 = int (($max1-$min1)*$writelist{$item}/100 + $min1);
|
||||
$cv2 = int (($max2-$min2)*$writelist{$item}/100 + $min2);
|
||||
} elsif ($item eq "cappingwatt") {
|
||||
if (($min1 + $min2)>$writelist{$item} || ($max1+$max2)< $writelist{$item}) {
|
||||
return (1, "The set value should be in the range ".($min1 + $min2)." - ".($max1+$max2).".");
|
||||
} elsif (($max1 + $max2) == $writelist{$item}) {
|
||||
$cv1 = $max1;
|
||||
$cv2 = $max2;
|
||||
} elsif (($min1 + $min2) == $writelist{$item}) {
|
||||
$cv1 = $min1;
|
||||
$cv2 = $min2;
|
||||
} else {
|
||||
my $x1 = ($max1+$min1)/2;
|
||||
my $x2 = ($max2+$min2)/2;
|
||||
# cv1/cv2 = $x1/$x2; cv1+cv2=$writelist{$item}
|
||||
$cv1 = int ($writelist{$item}*$x1/($x1+$x2));
|
||||
$cv2 = $writelist{$item} - $cv1;
|
||||
}
|
||||
}
|
||||
my $data = $session->set(new SNMP::Varbind([$powercapping_oid, $slot, $cv1 ,'INTEGER']));
|
||||
unless ($data) { return (1,$session->{ErrorStr}); }
|
||||
|
||||
$data = $session->set(new SNMP::Varbind([$powercapping_oid, ($slot+1), $cv2 ,'INTEGER']));
|
||||
unless ($data) { return (1,$session->{ErrorStr}); }
|
||||
} else {
|
||||
return (1, "Don't know the wide of the blade.");
|
||||
}
|
||||
} elsif ($item eq "savingstatus") {
|
||||
if ($writelist{$item} eq "on") {
|
||||
$svalue = "1";
|
||||
@@ -2778,6 +3019,8 @@ sub renergy {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return (1, "$item is NOT a valid attribute..");
|
||||
}
|
||||
|
||||
push @output, "$item: Set operation succeeded.";
|
||||
@@ -3271,12 +3514,12 @@ sub bladecmd {
|
||||
if (defined($vitals_info) and defined($vitals_info->{$currnode})) {
|
||||
my $attr = $vitals_info->{$currnode};
|
||||
my $fsp_api = ($::XCATROOT) ? "$::XCATROOT/sbin/fsp-api" : "/opt/xcat/sbin/fsp-api";
|
||||
my $cmd = "$fsp_api -a query_lcds -T 0 -t 0:$$attr[3]:$$attr[0]:$currnode: 2>&1";
|
||||
my $cmd = "$fsp_api -a pblade_query_lcds -T 0 -t 0:$$attr[3]:$$attr[0]:$currnode: 2>&1";
|
||||
my $res = xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($res !~ /error/i) {
|
||||
my @array = split(/\n/, $res);
|
||||
foreach my $a(@array) {
|
||||
my ($name, $data) = split(/:/,$a);
|
||||
foreach my $a (@array) {
|
||||
my ($name,$data) = split(/:/, $a);
|
||||
if ($data =~ /1\|(\w[\w\s]*)/) {
|
||||
push @result, "Current LCD: $1";
|
||||
} else {
|
||||
@@ -3634,8 +3877,8 @@ sub preprocess_request {
|
||||
|
||||
#parse the arguments for commands
|
||||
if ($command eq "getmacs") {
|
||||
my (@mpnodes, @fspnodes, @nohandle);
|
||||
filter_nodes($request, \@mpnodes, \@fspnodes, \@nohandle);
|
||||
my (@mpnodes, @nohandle);
|
||||
xCAT::Utils->filter_nodes($request, \@mpnodes, undef, undef, \@nohandle);
|
||||
if (@nohandle) {
|
||||
$callback->({data=>"Cannot figure out plugin for nodes:@nohandle"});
|
||||
}
|
||||
@@ -3672,12 +3915,22 @@ sub preprocess_request {
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
#} elsif ($command eq "rspconfig") {
|
||||
my (@mpnodes, @nohandle);
|
||||
xCAT::Utils->filter_nodes($request, \@mpnodes, undef, undef, \@nohandle);
|
||||
if (@nohandle) {
|
||||
$callback->({data=>"Error: Cannot figure out plugin for nodes:@nohandle"});
|
||||
}
|
||||
if (@mpnodes) {
|
||||
$noderange = \@mpnodes;
|
||||
} else {
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
} elsif ($command =~ /^(rspconfig|rvitals)$/) {
|
||||
# All the nodes with mgt=blade or mgt=fsp will get here
|
||||
# filter out the nodes for blade.pm
|
||||
my (@mpnodes, @fspnodes, @nohandle);
|
||||
filter_nodes($request, \@mpnodes, \@fspnodes, \@nohandle);
|
||||
my (@mpnodes, @nohandle);
|
||||
xCAT::Utils->filter_nodes($request, \@mpnodes, undef, undef, \@nohandle);
|
||||
if (@nohandle) {
|
||||
$callback->({data=>"Cannot figure out plugin for nodes:@nohandle"});
|
||||
}
|
||||
@@ -3711,10 +3964,19 @@ sub preprocess_request {
|
||||
return [];
|
||||
}
|
||||
|
||||
my %mpatype = ();
|
||||
foreach my $node (@$noderange) {
|
||||
my $ent=$mptabhash->{$node}->[0]; #$mptab->getNodeAttribs($node,['mpa', 'id']);
|
||||
if (defined($ent->{mpa})) { push @{$mpa_hash{$ent->{mpa}}{nodes}}, $node;}
|
||||
elsif ($indiscover) {
|
||||
my $mpaent;
|
||||
if (defined($ent->{mpa})) {
|
||||
push @{$mpa_hash{$ent->{mpa}}{nodes}}, $node;
|
||||
unless ($mpatype{$ent->{mpa}}) {
|
||||
my $mpaent = $mptab->getNodeAttribs($ent->{mpa},['nodetype']);
|
||||
if ($mpaent && $mpaent->{'nodetype'}) {
|
||||
$mpatype{$ent->{mpa}} = $mpaent->{'nodetype'};
|
||||
}
|
||||
}
|
||||
} elsif ($indiscover) {
|
||||
next;
|
||||
} else {
|
||||
$callback->({data=>["no mpa defined for node $node"]});
|
||||
@@ -3723,7 +3985,7 @@ sub preprocess_request {
|
||||
}
|
||||
if (defined($ent->{id})) { push @{$mpa_hash{$ent->{mpa}}{ids}}, $ent->{id};}
|
||||
else { push @{$mpa_hash{$ent->{mpa}}{ids}}, "";}
|
||||
if (defined($ent->{nodetype})) { push @{$mpa_hash{$ent->{mpa}}{nodetype}}, $ent->{nodetype};}
|
||||
if (defined($mpatype{$ent->{mpa}})) { push @{$mpa_hash{$ent->{mpa}}{nodetype}}, $mpatype{$ent->{mpa}};}
|
||||
else { push @{$mpa_hash{$ent->{mpa}}{nodetype}}, "mm";}
|
||||
}
|
||||
|
||||
@@ -3755,90 +4017,6 @@ sub preprocess_request {
|
||||
return \@requests;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Fliter the nodes that are NGP ppc blade node or common fsp node
|
||||
# For rspconfig network, the NGP ppc blade will be included in the group of mp, othewise in the fsp group
|
||||
# For getmacs -D, the NGP ppc blade will be included in the group of common fsp, otherwise in the mp group
|
||||
##########################################################################
|
||||
sub filter_nodes{
|
||||
my ($req, $mpnodes, $fspnodes, $nohandle) = @_;
|
||||
|
||||
my (@nodes,@args,$cmd);
|
||||
if (defined($req->{'node'})) {
|
||||
@nodes = @{$req->{'node'}};
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
if (defined($req->{'command'})) {
|
||||
$cmd = $req->{'command'}->[0];
|
||||
}
|
||||
if (defined($req->{'arg'})) {
|
||||
@args = @{$req->{'arg'}};
|
||||
}
|
||||
# get the nodes in the mp table
|
||||
my $mptabhash;
|
||||
my $mptab = xCAT::Table->new("mp");
|
||||
if ($mptab) {
|
||||
$mptabhash = $mptab->getNodesAttribs(\@nodes, ['mpa','nodetype']);
|
||||
}
|
||||
|
||||
# get the parent of the service processor
|
||||
# for the NGP ppc blade, the ppc.parent is the mpa
|
||||
my $ppctabhash;
|
||||
my $ppctab = xCAT::Table->new("ppc");
|
||||
if ($ppctab) {
|
||||
$ppctabhash = $ppctab->getNodesAttribs(\@nodes,['nodetype']);
|
||||
}
|
||||
|
||||
my (@mp, @ngpfsp, @commonfsp, @unknow);
|
||||
my %fspparent;
|
||||
# Get the parent for each node
|
||||
foreach (@nodes) {
|
||||
if (defined ($mptabhash->{$_}->[0]->{'mpa'})) {
|
||||
if (defined ($ppctabhash->{$_}->[0]->{'nodetype'}) && ($ppctabhash->{$_}->[0]->{'nodetype'} eq "blade")) {
|
||||
push @ngpfsp, $_;
|
||||
next;
|
||||
}
|
||||
else {
|
||||
# Non NGP power blade
|
||||
push @mp, $_;
|
||||
next;
|
||||
}
|
||||
} elsif (defined ($ppctabhash->{$_}->[0]->{'nodetype'})) {
|
||||
# otherwise, this is a general power node
|
||||
push @commonfsp, $_;
|
||||
} else {
|
||||
push @unknow, $_;
|
||||
}
|
||||
}
|
||||
|
||||
push @{$mpnodes}, @mp;
|
||||
push @{$fspnodes}, @commonfsp;
|
||||
if (@args && ($cmd eq "rspconfig")) {
|
||||
if (!(grep /^(cec_off_policy|pending_power_on_side)/, @args)) {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
} else {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
}
|
||||
} elsif($cmd eq "getmacs") {
|
||||
if (@args && (grep /^-D$/,@args)) {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
} else {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
}
|
||||
} elsif ($cmd eq "rvitals") {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
} else {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
}
|
||||
|
||||
push @{$nohandle}, @unknow;
|
||||
|
||||
## TRACE_LINE print "Nodes filter: nodetype [commp:@mp,ngpp:@ngpfsp,comfsp:@commonfsp]. mpnodes [@{$mpnodes}], fspnodes [@{$fspnodes}]\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
sub build_more_info{
|
||||
my $noderange=shift;
|
||||
my $callback=shift;
|
||||
@@ -3852,16 +4030,24 @@ sub build_more_info{
|
||||
my %mpa_hash=();
|
||||
my $mptabhash = $mptab->getNodesAttribs($noderange,['mpa','id','nodetype']);
|
||||
|
||||
my %mpatype = ();
|
||||
foreach my $node (@$noderange) {
|
||||
my $ent=$mptabhash->{$node}->[0]; #$mptab->getNodeAttribs($node,['mpa', 'id']);
|
||||
if (defined($ent->{mpa})) { push @{$mpa_hash{$ent->{mpa}}{nodes}}, $node;}
|
||||
else {
|
||||
if (defined($ent->{mpa})) {
|
||||
push @{$mpa_hash{$ent->{mpa}}{nodes}}, $node;
|
||||
unless ($mpatype{$ent->{mpa}}) {
|
||||
my $mpaent = $mptab->getNodeAttribs($ent->{mpa},['nodetype']);
|
||||
if ($mpaent && $mpaent->{'nodetype'}) {
|
||||
$mpatype{$ent->{mpa}} = $mpaent->{'nodetype'};
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$callback->({data=>["no mpa defined for node $node"]});
|
||||
return @moreinfo;;
|
||||
}
|
||||
if (defined($ent->{id})) { push @{$mpa_hash{$ent->{mpa}}{ids}}, $ent->{id};}
|
||||
else { push @{$mpa_hash{$ent->{mpa}}{ids}}, "";}
|
||||
if (defined($ent->{nodetype})) { push @{$mpa_hash{$ent->{mpa}}{nodetype}}, $ent->{nodetype};}
|
||||
if (defined($mpatype{$ent->{mpa}})) { push @{$mpa_hash{$ent->{mpa}}{nodetype}}, $mpatype{$ent->{mpa}};}
|
||||
else { push @{$mpa_hash{$ent->{mpa}}{nodetype}}, "mm";}
|
||||
}
|
||||
|
||||
@@ -4177,13 +4363,15 @@ sub clicmds {
|
||||
my $curraddr = $mpa;
|
||||
if ($args{curraddr}) {
|
||||
$curraddr = $args{curraddr};
|
||||
} elsif (defined($handled{'initnetwork'})) {
|
||||
} elsif (defined($handled{'initnetwork'}) or defined($handled{'USERID'})) {
|
||||
# get the IP of mpa from the hosts.otherinterfaces
|
||||
my $hoststab = xCAT::Table->new('hosts');
|
||||
if ($hoststab) {
|
||||
my $hostdata = $hoststab->getNodeAttribs($node, ['otherinterfaces']);
|
||||
if (!$hostdata->{'otherinterfaces'}) {
|
||||
return ([1,\@unhandled,"Cannot find the temporary IP from the hosts.otherinterfaces"]);
|
||||
if (!defined($handled{'USERID'})) {
|
||||
return ([1,\@unhandled,"Cannot find the temporary IP from the hosts.otherinterfaces"]);
|
||||
}
|
||||
} else {
|
||||
$curraddr = $hostdata->{'otherinterfaces'};
|
||||
}
|
||||
@@ -4283,7 +4471,7 @@ sub clicmds {
|
||||
|
||||
my $reset;
|
||||
foreach (keys %handled) {
|
||||
if (/^snmpcfg/) { $result = snmpcfg($t,$handled{$_},$user,$pass,$mm); }
|
||||
if (/^snmpcfg/) { $result = snmpcfg($t,$handled{$_},$user,$pass,$mm,$node); }
|
||||
elsif (/^sshcfg$/) { $result = sshcfg($t,$handled{$_},$user,$mm); }
|
||||
elsif (/^network$/) { $result = network($t,$handled{$_},$mpa,$mm,$node,$nodeid); }
|
||||
elsif (/^initnetwork$/) { $result = network($t,$handled{$_},$mpa,$mm,$node,$nodeid,1); $reset=1; }
|
||||
@@ -4297,6 +4485,14 @@ sub clicmds {
|
||||
elsif (/^userpassword$/) {$result = passwd($t, $mpa, $1, $handled{$_}, $promote_pass, $mm);}
|
||||
if (!defined($result)) {next;}
|
||||
push @data, "$_: @$result";
|
||||
if (/^initnetwork$/) {
|
||||
if (!@$result[0]) {
|
||||
my $hoststab = xCAT::Table->new('hosts');
|
||||
if ($hoststab) {
|
||||
$hoststab->setNodeAttribs($mpa, {otherinterfaces=>''});
|
||||
}
|
||||
}
|
||||
}
|
||||
$Rc |= shift(@$result);
|
||||
push @cfgtext,@$result;
|
||||
}
|
||||
@@ -4444,11 +4640,11 @@ sub get_blades_for_mpa {
|
||||
my %blades_hash = ();
|
||||
my $mptab = xCAT::Table->new('mp');
|
||||
my $ppctab = xCAT::Table->new('ppc');
|
||||
my @attribs = qw(id pprofile parent hcp);
|
||||
my @attribs = qw(id nodetype parent hcp);
|
||||
if (!defined($mptab) or !defined($ppctab)) {
|
||||
return undef;
|
||||
}
|
||||
my @nodearray = $mptab->getAttribs({mpa=>$mpa,nodetype=>"blade"}, qw(node));
|
||||
my @nodearray = $mptab->getAttribs({mpa=>$mpa}, qw(node));
|
||||
my @blades = ();
|
||||
my $nodesattrs;
|
||||
if (!defined(@nodearray)) {
|
||||
@@ -4466,12 +4662,11 @@ sub get_blades_for_mpa {
|
||||
my @values = ();
|
||||
if (!defined($att)) {
|
||||
next;
|
||||
} elsif ($att and $att->{parent} and ($att->{parent} ne $mpa)) {
|
||||
} elsif (!defined($att->{parent}) or ($att->{parent} ne $mpa) or !defined($att->{nodetype}) or $att->{nodetype} ne "blade") {
|
||||
next;
|
||||
}
|
||||
my $request;
|
||||
my $nodetype = "blade";
|
||||
my $hcp_ip = xCAT::FSPUtils::getIPaddress($request, $nodetype, $att->{hcp});
|
||||
my $hcp_ip = xCAT::FSPUtils::getIPaddress($request, $att->{nodetype}, $att->{hcp});
|
||||
if (!defined($hcp_ip) or ($hcp_ip == -3)) {
|
||||
next;
|
||||
}
|
||||
@@ -4547,7 +4742,7 @@ sub passwd {
|
||||
} elsif ($res =~ /The hdwr_svr daemon is not currently running/i) {
|
||||
return ([1, "Update password for 'hdwr_svr' failed because the 'hdwr_svr' daemon is not currently running. Please recreate the connections between blades and hdwr_svr."]);
|
||||
}
|
||||
my $hws_cmd = "$fsp_api -a reset_hws_pw -u $user -p $oldpass -P $pass -T 0 -t 0:$$att[3]:$$att[0]:$node_name: 2>&1";
|
||||
my $hws_cmd = "$fsp_api -a reset_hws_pw -u HMC -p $oldpass -P $pass -T 0 -t 0:$$att[3]:$$att[0]:$node_name: 2>&1";
|
||||
#print "===>set_hws_cmd=$hws_cmd\n";
|
||||
|
||||
$res = xCAT::Utils->runcmd($hws_cmd, -1);
|
||||
@@ -4786,6 +4981,7 @@ sub snmpcfg {
|
||||
my $uid = shift;
|
||||
my $pass = shift;
|
||||
my $mm = shift;
|
||||
my $node = shift;
|
||||
|
||||
if ($value !~ /^enable|disable$/i) {
|
||||
return([1,"Invalid argument '$value' (enable|disable)"]);
|
||||
@@ -4823,10 +5019,11 @@ sub snmpcfg {
|
||||
}
|
||||
|
||||
my $cmd;
|
||||
my $ipfn = xCAT::Utils->my_ip_facing($node);
|
||||
if ($mptype =~ /^[a]?mm$/) {
|
||||
$cmd= "users -$id -ap sha -at write -ppw $pass -pp $pp -T system:$mm";
|
||||
} elsif ($mptype eq "cmm"){
|
||||
$cmd= "users -n $uid -ap sha -at set -ppw $pass -pp $pp -T system:$mm";
|
||||
$cmd= "users -n $uid -ap sha -at set -ppw $pass -pp $pp -T system:$mm -i $ipfn";
|
||||
}
|
||||
@data = $t->cmd($cmd);
|
||||
|
||||
@@ -5240,7 +5437,7 @@ sub dompa {
|
||||
}
|
||||
# Only telnet commands
|
||||
unless ( @$args ) {
|
||||
if($command ne "getmacs"){
|
||||
if(($command ne "getmacs")&& ($command ne "rbeacon")){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1009,7 +1009,8 @@ sub add_or_delete_records {
|
||||
}
|
||||
my $zone;
|
||||
foreach $zone (keys %{$ctx->{updatesbyzone}}) {
|
||||
my $resolver = Net::DNS::Resolver->new(nameservers=>[$ctx->{nsmap}->{$zone}]);
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone});
|
||||
my $resolver = Net::DNS::Resolver->new(nameservers=>[$ip]);
|
||||
my $entry;
|
||||
my $numreqs = 300; # limit to 300 updates in a payload, something broke at 644 on a certain sample, choosing 300 for now
|
||||
my $update = Net::DNS::Update->new($zone);
|
||||
|
||||
Regular → Executable
+1
-1
@@ -236,7 +236,7 @@ sub setdestiny {
|
||||
(my $portent) = $sitetab->getAttribs({key=>'xcatdport'},'value');
|
||||
(my $mastent) = $sitetab->getAttribs({key=>'master'},'value');
|
||||
my $enthash = $nodetype->getNodesAttribs(\@nodes,[qw(arch)]);
|
||||
my $resents = $restab->getNodeAttribs(\@nodes,[qw(xcatmaster)]);
|
||||
my $resents = $restab->getNodesAttribs(\@nodes,[qw(xcatmaster)]);
|
||||
foreach (@nodes) {
|
||||
my $ent = $enthash->{$_}->[0]; #$nodetype->getNodeAttribs($_,[qw(arch)]);
|
||||
unless ($ent and $ent->{arch}) {
|
||||
|
||||
@@ -4,6 +4,7 @@ package xCAT_plugin::fsp;
|
||||
use strict;
|
||||
use xCAT::PPC;
|
||||
use xCAT::DBobjUtils;
|
||||
use xCAT::Utils;
|
||||
use xCAT_plugin::hmc;
|
||||
|
||||
##########################################################################
|
||||
@@ -12,7 +13,7 @@ use xCAT_plugin::hmc;
|
||||
sub handled_commands {
|
||||
return {
|
||||
rpower => 'nodehm:power,mgt',
|
||||
reventlog => 'nodehm:mgt',
|
||||
#reventlog => 'nodehm:mgt',
|
||||
rspconfig => 'nodehm:mgt',
|
||||
mkhwconn => 'nodehm:mgt',
|
||||
rmhwconn => 'nodehm:mgt',
|
||||
@@ -72,13 +73,12 @@ sub preprocess_request {
|
||||
my $callback = $arg2;
|
||||
getmulcon($node,$callback);
|
||||
return [];
|
||||
}
|
||||
#if ($arg1->{command}->[0] eq "rspconfig") {
|
||||
if ($arg1->{command}->[0] =~ /rspconfig|rvitals/) {
|
||||
}
|
||||
if ($arg1->{command}->[0] =~ /rspconfig|rvitals|getmacs|renergy/) {
|
||||
# All the nodes with mgt=blade or mgt=fsp will get here
|
||||
# filter out the nodes for fsp.pm
|
||||
my (@mpnodes, @fspnodes, @nohandle);
|
||||
filter_nodes($arg1, \@mpnodes, \@fspnodes, \@nohandle);
|
||||
my (@fspnodes, @nohandle);
|
||||
xCAT::Utils->filter_nodes($arg1, undef, \@fspnodes, undef, \@nohandle);
|
||||
if (@fspnodes) {
|
||||
$arg1->{noderange} = \@fspnodes;
|
||||
} else {
|
||||
@@ -86,15 +86,6 @@ sub preprocess_request {
|
||||
}
|
||||
}
|
||||
|
||||
if ($arg1->{command}->[0] eq "getmacs") {
|
||||
my (@mpnodes, @fspnodes, @nohandle);
|
||||
filter_nodes($arg1, \@mpnodes, \@fspnodes, \@nohandle);
|
||||
if (@fspnodes) {
|
||||
$arg1->{noderange} = \@fspnodes;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
xCAT::PPC::preprocess_request(__PACKAGE__,@_);
|
||||
}
|
||||
|
||||
@@ -105,88 +96,6 @@ sub process_request {
|
||||
xCAT::PPC::process_request(__PACKAGE__,@_);
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Fliter the nodes that are NGP ppc blade node or common fsp node
|
||||
# For rspconfig network, the NGP ppc blade will be included in the group of mp, othewise in the fsp group
|
||||
# For getmacs -D, the NGP ppc blade will be included in the group of common fsp, otherwise in the mp group
|
||||
##########################################################################
|
||||
sub filter_nodes{
|
||||
my ($req, $mpnodes, $fspnodes, $nohandle) = @_;
|
||||
|
||||
my (@nodes,@args,$cmd);
|
||||
if (defined($req->{'node'})) {
|
||||
@nodes = @{$req->{'node'}};
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
if (defined($req->{'command'})) {
|
||||
$cmd = $req->{'command'}->[0];
|
||||
}
|
||||
if (defined($req->{'arg'})) {
|
||||
@args = @{$req->{'arg'}};
|
||||
}
|
||||
# get the nodes in the mp table
|
||||
my $mptabhash;
|
||||
my $mptab = xCAT::Table->new("mp");
|
||||
if ($mptab) {
|
||||
$mptabhash = $mptab->getNodesAttribs(\@nodes, ['mpa','nodetype']);
|
||||
}
|
||||
|
||||
# get the parent of the service processor
|
||||
# for the NGP ppc blade, the ppc.parent is the mpa
|
||||
my $ppctabhash;
|
||||
my $ppctab = xCAT::Table->new("ppc");
|
||||
if ($ppctab) {
|
||||
$ppctabhash = $ppctab->getNodesAttribs(\@nodes,['nodetype']);
|
||||
}
|
||||
my (@mp, @ngpfsp, @commonfsp, @unknow);
|
||||
my %fspparent;
|
||||
# Get the parent for each node
|
||||
foreach (@nodes) {
|
||||
if (defined ($mptabhash->{$_}->[0]->{'mpa'})) {
|
||||
if (defined ($ppctabhash->{$_}->[0]->{'nodetype'}) && ($ppctabhash->{$_}->[0]->{'nodetype'} eq "blade")) {
|
||||
push @ngpfsp, $_;
|
||||
next;
|
||||
}
|
||||
else {
|
||||
# Non NGP power blade
|
||||
push @mp, $_;
|
||||
next;
|
||||
}
|
||||
} elsif (defined ($ppctabhash->{$_}->[0]->{'nodetype'})) {
|
||||
# otherwise, this is a general power node
|
||||
push @commonfsp, $_;
|
||||
} else {
|
||||
push @unknow, $_;
|
||||
}
|
||||
}
|
||||
|
||||
push @{$mpnodes}, @mp;
|
||||
push @{$fspnodes}, @commonfsp;
|
||||
if (@args && ($cmd eq "rspconfig")) {
|
||||
if (!(grep /^(cec_off_policy|pending_power_on_side)/, @args)) {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
} else {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
}
|
||||
} elsif($cmd eq "getmacs") {
|
||||
if (@args && (grep /^-D$/,@args)) {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
} else {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
}
|
||||
} elsif ($cmd eq "rvitals") {
|
||||
push @{$mpnodes},@ngpfsp;
|
||||
} else {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
}
|
||||
|
||||
push @{$nohandle}, @unknow;
|
||||
|
||||
## TRACE_LINE print "Nodes filter: nodetype [commp:@mp,ngpp:@ngpfsp,comfsp:@commonfsp]. mpnodes [@{$mpnodes}], fspnodes [@{$fspnodes}]\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# get hcp and id for rcons with fsp
|
||||
##########################################################################
|
||||
|
||||
@@ -65,9 +65,10 @@ sub process_request
|
||||
$client = $request->{'_xcat_clienthost'}->[0];
|
||||
}
|
||||
|
||||
my $origclient = $client;
|
||||
if ($client) { ($client) = noderange($client) };
|
||||
unless ($client) { #Not able to do identify the host in question
|
||||
xCAT::MsgUtils->message("S","Received getpostscript from $client, which couldn't be correlated to a node (domain mismatch?)");
|
||||
xCAT::MsgUtils->message("S","Received getpostscript from $origclient, which couldn't be correlated to a node (domain mismatch?)");
|
||||
return;
|
||||
}
|
||||
my $state;
|
||||
|
||||
@@ -5800,6 +5800,11 @@ sub preprocess_request {
|
||||
$chunksize=$::XCATSITEVALS{syspowermaxnodes};
|
||||
$delayincrement=$::XCATSITEVALS{syspowerinterval};
|
||||
}
|
||||
} elsif ($command eq "renergy") {
|
||||
# filter out the nodes which should be handled by ipmi.pm
|
||||
my (@bmcnodes, @nohandle);
|
||||
xCAT::Utils->filter_nodes($request, undef, undef, \@bmcnodes, \@nohandle);
|
||||
$realnoderange = \@bmcnodes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -177,6 +177,7 @@ sub get_storage_pool_by_url {
|
||||
unless ($path =~ /^\//) {
|
||||
$path = '/'.$path;
|
||||
}
|
||||
$path =~ s/\/\z//; #delete trailing / if table specifies, a perfectly understable 'mistake'
|
||||
my $checkpath = $pool->findnodes("/pool/target/path/text()")->[0]->data;
|
||||
if ($checkpath eq $path) {
|
||||
last;
|
||||
@@ -2425,7 +2426,7 @@ sub process_request {
|
||||
unless ($libvirtsupport) {
|
||||
$libvirtsupport = eval {
|
||||
require Sys::Virt;
|
||||
if (Sys::Virt->VERSION < "0.2.0") {
|
||||
if ( xCAT::Utils::version_cmp(Sys::Virt->VERSION, "0.2.0") < 0 ) {
|
||||
die;
|
||||
}
|
||||
1;
|
||||
|
||||
@@ -16,6 +16,7 @@ use xCAT::PPCdb;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT::Utils;
|
||||
|
||||
my $option_s;
|
||||
|
||||
#require xCAT::MacMap;
|
||||
require xCAT_plugin::blade;
|
||||
@@ -37,12 +38,14 @@ use constant {
|
||||
SERVICE_IVM => "integrated-virtualization-manager",
|
||||
SERVICE_MM => "management-module",
|
||||
SERVICE_CMM => "chassis-management-module",
|
||||
SERVICE_IMM2 => "integrated-management-module2",
|
||||
SERVICE_RSA => "remote-supervisor-adapter",
|
||||
SERVICE_RSA2 => "remote-supervisor-adapter-2",
|
||||
#SLP_CONF => "/usr/local/etc/slp.conf",
|
||||
#SLPTOOL => "/usr/local/bin/slptool",
|
||||
TYPE_MM => "mm",
|
||||
TYPE_CMM => "cmm",
|
||||
TYPE_IMM2 => "imm2",
|
||||
TYPE_RSA => "rsa",
|
||||
TYPE_BPA => "bpa",
|
||||
TYPE_HMC => "hmc",
|
||||
@@ -69,6 +72,7 @@ my %service_slp = (
|
||||
@{[ SERVICE_IVM ]} => TYPE_IVM,
|
||||
@{[ SERVICE_MM ]} => TYPE_MM,
|
||||
@{[ SERVICE_CMM ]} => TYPE_CMM,
|
||||
@{[ SERVICE_IMM2 ]} => TYPE_IMM2,
|
||||
@{[ SERVICE_RSA ]} => TYPE_RSA,
|
||||
@{[ SERVICE_RSA2 ]} => TYPE_RSA
|
||||
);
|
||||
@@ -140,6 +144,7 @@ my %globalhwtype = (
|
||||
frame => $::NODETYPE_FRAME,
|
||||
cec => $::NODETYPE_CEC,
|
||||
cmm => $::NODETYPE_CMM,
|
||||
imm2 => $::NODETYPE_IMM2,
|
||||
);
|
||||
my %globalnodetype = (
|
||||
fsp => $::NODETYPE_PPC,
|
||||
@@ -160,6 +165,7 @@ my %globalmgt = (
|
||||
ivm => "ivm",
|
||||
rsa => "blade",
|
||||
cmm => "blade",
|
||||
imm2 => "blade",
|
||||
hmc => "hmc",
|
||||
);
|
||||
my %globalid = (
|
||||
@@ -227,6 +233,7 @@ sub parse_args {
|
||||
FRAME => HARDWARE_SERVICE.":".SERVICE_FRAME,
|
||||
RSA => HARDWARE_SERVICE.":".SERVICE_RSA.":",
|
||||
CMM => HARDWARE_SERVICE.":".SERVICE_CMM,
|
||||
IMM2 => HARDWARE_SERVICE.":".SERVICE_IMM2,
|
||||
MM => HARDWARE_SERVICE.":".SERVICE_MM.":"
|
||||
);
|
||||
#############################################
|
||||
@@ -255,7 +262,7 @@ sub parse_args {
|
||||
# Process command-line flags
|
||||
#############################################
|
||||
if (!GetOptions( \%opt,
|
||||
qw(h|help V|Verbose v|version i=s x z w r s=s e=s t=s m c n C=s T=s I updatehosts makedhcp resetnet vpdtable))) {
|
||||
qw(h|help V|Verbose v|version i=s x z w r s=s e=s t=s m c n C=s T=s I u range=s updatehosts makedhcp resetnet vpdtable))) {
|
||||
return( usage() );
|
||||
}
|
||||
|
||||
@@ -305,6 +312,7 @@ sub parse_args {
|
||||
if ( !exists( $services{$opt{s}} )) {
|
||||
return(usage( "Invalid service: $opt{s}" ));
|
||||
}
|
||||
$option_s = $opt{s};
|
||||
$globalopt{service} = $services{$opt{s}};
|
||||
}
|
||||
#############################################
|
||||
@@ -397,6 +405,18 @@ sub parse_args {
|
||||
$globalopt{n} = 1;
|
||||
}
|
||||
|
||||
if ( exists( $opt{u} )) {
|
||||
$globalopt{u} = 1;
|
||||
unless (exists( $opt{s} ) and exists ($opt{range})) {
|
||||
return( usage( "-u should be used with -s and --range" ));
|
||||
}
|
||||
$globalopt{range} = $opt{range};
|
||||
}
|
||||
if (exists( $opt{range} )) {
|
||||
unless (exists( $opt{u} )) {
|
||||
return( usage( "range is used in unicast mode" ));
|
||||
}
|
||||
}
|
||||
##############################################
|
||||
# warn for no discovered nodes in database
|
||||
##############################################
|
||||
@@ -515,7 +535,12 @@ sub invoke_dodiscover {
|
||||
$arg{Retry} = $maxt;
|
||||
$arg{Count} = $globalopt{C} if($globalopt{C});
|
||||
$arg{Time} = $globalopt{T} if($globalopt{T});
|
||||
$arg{nomsg} = 1 if($globalopt{z} or $globalopt{x});
|
||||
$arg{reqcallback} = $request->{callback} if($request->{callback});
|
||||
if ($globalopt{u}) {
|
||||
$arg{unicast} = 1;
|
||||
$arg{range} = $globalopt{range};
|
||||
}
|
||||
my ($searchmacsref,$sendcount,$rsp) = xCAT::SLP::dodiscover(%arg);
|
||||
|
||||
|
||||
@@ -965,12 +990,13 @@ sub parse_responses {
|
||||
###########################################
|
||||
my %atthash;
|
||||
if (( $type eq SERVICE_RSA ) or ( $type eq SERVICE_RSA2 ) or
|
||||
( $type eq SERVICE_MM )) {
|
||||
( $type eq SERVICE_MM ) or ( $type eq SERVICE_IMM2 )) {
|
||||
$atthash{type} = $service_slp{$type};
|
||||
$atthash{mtm} = ${$attributes->{'enclosure-machinetype-model'}}[0];
|
||||
$atthash{serial} = ${$attributes->{'enclosure-serial-number'}}[0];
|
||||
$atthash{slot} = int(${$attributes->{'slot'}}[0]);
|
||||
$atthash{ip} = ${$attributes->{'ip-address'}}[0];
|
||||
if ( $type eq SERVICE_IMM2 ) { $atthash{ip} = ${$attributes->{'ipv4-address'}}[0]; }
|
||||
else { $atthash{ip} = ${$attributes->{'ip-address'}}[0]; }
|
||||
$atthash{mac} = $rsp;
|
||||
$atthash{hostname} = get_host_from_url($request, $attributes);
|
||||
$atthash{otherinterfaces} = ${$attributes->{'ip-address'}}[0];
|
||||
@@ -995,6 +1021,10 @@ sub parse_responses {
|
||||
$atthash{otherinterfaces} = ${$attributes->{'ipv4-address'}}[0];
|
||||
$outhash{'Server-'.$atthash{mtm}.'-SN'.$atthash{serial}} = \%atthash;
|
||||
$$length = length( $atthash{ip}) if ( length( $atthash{ip} ) > $$length );
|
||||
if (exists($::OLD_DATA_CACHE{"mp*".$atthash{mtm}."*".$atthash{serial}})){
|
||||
$atthash{hostname} = $::OLD_DATA_CACHE{"mp*".$atthash{mtm}."*".$atthash{serial}};
|
||||
push @matchnode,'Server-'.$atthash{mtm}.'-SN'.$atthash{serial};
|
||||
}
|
||||
trace( $request, "Discover node $atthash{hostname}: type is $atthash{type}, \
|
||||
mtm is $atthash{mtm}, sn is $atthash{serial}, side is $atthash{side}, \
|
||||
ip is $atthash{ip}, mac is $atthash{mac}, mname is $atthash{mname},\
|
||||
@@ -1022,7 +1052,70 @@ sub parse_responses {
|
||||
trace( $request, "Discover node $atthash{hostname}: type is $atthash{type},\
|
||||
mtm is $atthash{mtm},sn is $atthash{serial}, ip is $atthash{ip},\
|
||||
mac is $atthash{mac}, otherinterfaces is $atthash{otherinterfaces}" );
|
||||
}else {
|
||||
}elsif (($type eq SERVICE_FSP) && (${$attributes->{'machinetype-model'}}[0] =~ /^7895|1457|7954/ )) {
|
||||
# Skip this entry if "-s CEC" was specified - we do not list FSP entries for Flex when only CECs were requested
|
||||
next unless ($option_s ne "CEC");
|
||||
|
||||
#begin to define fsp and bpa
|
||||
my %tmphash;
|
||||
$tmphash{type} = ($type eq SERVICE_BPA) ? TYPE_BPA : TYPE_FSP;
|
||||
$tmphash{mtm} = ${$attributes->{'machinetype-model'}}[0];
|
||||
$tmphash{serial} = ${$attributes->{'serial-number'}}[0];
|
||||
$tmphash{ip} = ${$searchmacs{$rsp}}{peername};
|
||||
my $loc = ($tmphash{ip} =~ ${$attributes->{'ip-address'}}[0]) ? 0:1; #every entry has two ip-addresses
|
||||
$tmphash{side} = (int(${$attributes->{'slot'}}[0]) == 0) ? 'B-'.$loc:'A-'.$loc;
|
||||
$tmphash{mac} = $rsp;
|
||||
$tmphash{parent} = 'Server-'.$tmphash{mtm}.'-SN'.$tmphash{serial};
|
||||
$tmphash{hostname} = $tmphash{ip};
|
||||
$tmphash{url} = ${$searchmacs{$rsp}}{payload};
|
||||
$tmphash{otherinterfaces} = ${$searchmacs{$rsp}}{peername};
|
||||
$tmphash{bpcmtm} = ${$attributes->{'bpc-machinetype-model'}}[0];
|
||||
$tmphash{bpcsn} = ${$attributes->{'bpc-serial-number'}}[0];
|
||||
$tmphash{fid} = int(${$attributes->{'frame-number'}}[0]);
|
||||
$tmphash{cid} = int(${$attributes->{'cage-number'}}[0]);
|
||||
$outhash{$tmphash{ip}} = \%tmphash;
|
||||
$$length = length( $tmphash{ip}) if ( length( $tmphash{ip} ) > $$length );
|
||||
trace( $request, "Discover node $tmphash{hostname}:type is $tmphash{type}, mtm is $tmphash{mtm}, \
|
||||
sn is $tmphash{serial}, side is $tmphash{side},parent is $tmphash{parent},ip is $tmphash{ip}, \
|
||||
cec id is $tmphash{cid} , frame id is $tmphash{fid},mac is $tmphash{mac}, \
|
||||
otherinterfaces is $tmphash{otherinterfaces}" );
|
||||
|
||||
#####################################################################
|
||||
#define another side to fix the issue that the result is imcomplete
|
||||
#####################################################################
|
||||
my %tmphash1;
|
||||
$tmphash1{ip} = (${$searchmacs{$rsp}}{peername} =~ ${$attributes->{'ip-address'}}[0])?${$attributes->{'ip-address'}}[1]:${$attributes->{'ip-address'}}[0];
|
||||
unless ($outhash{$tmphash1{ip}}) {
|
||||
my $validflag = 1;
|
||||
foreach (@invalidiplist){
|
||||
if ( $tmphash1{ip} =~ /^($_)/ ){
|
||||
$validflag = 0;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($validflag == 1) {
|
||||
$tmphash1{type} = ($type eq SERVICE_BPA) ? TYPE_BPA : TYPE_FSP;
|
||||
$tmphash1{mtm} = ${$attributes->{'machinetype-model'}}[0];
|
||||
$tmphash1{serial} = ${$attributes->{'serial-number'}}[0];
|
||||
my $loc = ($tmphash1{ip} =~ ${$attributes->{'ip-address'}}[0]) ? 0:1; #every entry has two ip-addresses
|
||||
$tmphash1{side} = (int(${$attributes->{'slot'}}[0]) == 0) ? 'B-'.$loc:'A-'.$loc;
|
||||
$tmphash1{mac} = xCAT::SLP::get_mac_for_addr($tmphash1{ip});
|
||||
$tmphash1{parent} = 'Server-'.$tmphash1{mtm}.'-SN'.$tmphash1{serial};
|
||||
$tmphash1{hostname} = $tmphash1{ip};
|
||||
$tmphash1{otherinterfaces} = ${$searchmacs{$rsp}}{peername};
|
||||
$tmphash1{bpcmtm} = ${$attributes->{'bpc-machinetype-model'}}[0];
|
||||
$tmphash1{bpcsn} = ${$attributes->{'bpc-serial-number'}}[0];
|
||||
$tmphash1{fid} = int(${$attributes->{'frame-number'}}[0]);
|
||||
$tmphash1{cid} = int(${$attributes->{'cage-number'}}[0]);
|
||||
$outhash{$tmphash1{ip}} = \%tmphash1;
|
||||
$$length = length( $tmphash1{ip}) if ( length( $tmphash1{ip} ) > $$length );
|
||||
trace( $request, "Discover another node $tmphash1{hostname}:type is $tmphash1{type}, mtm is $tmphash1{mtm}, \
|
||||
sn is $tmphash1{serial}, side is $tmphash1{side},parent is $tmphash1{parent},ip is $tmphash1{ip}, \
|
||||
cec id is $tmphash1{cid} , frame id is $tmphash1{fid},mac is $tmphash1{mac}, \
|
||||
otherinterfaces is $tmphash1{otherinterfaces}" );
|
||||
}
|
||||
}
|
||||
}else {
|
||||
#begin to define fsp and bpa
|
||||
my %tmphash;
|
||||
$tmphash{type} = ($type eq SERVICE_BPA) ? TYPE_BPA : TYPE_FSP;
|
||||
@@ -1138,7 +1231,7 @@ sub parse_responses {
|
||||
$newhostname = $::OLD_DATA_CACHE{"frame*".${$outhash{$h}}{mtm}."*".${$outhash{$h}}{serial}};
|
||||
if ($newhostname) {
|
||||
${$outhash{$h}}{hostname} = $newhostname ;
|
||||
trace ( $request, "$h find hostname $newhostname");
|
||||
trace ( $request, "$h found hostname $newhostname");
|
||||
push @matchnode, $h;
|
||||
}
|
||||
}
|
||||
@@ -1160,7 +1253,7 @@ sub parse_responses {
|
||||
$parent = $existing_node if ($existing_node);
|
||||
}
|
||||
${$outhash{$h}}{parent} = $parent;
|
||||
trace( $request, "$h find parent $parent") if ($parent);
|
||||
trace( $request, "$h found parent $parent") if ($parent);
|
||||
}
|
||||
|
||||
trace( $request, "\n\n\nBegin to find cec hostname");
|
||||
@@ -1168,7 +1261,7 @@ sub parse_responses {
|
||||
if(${$outhash{$h}}{type} eq TYPE_CEC) {
|
||||
my $newhostname1 = $::OLD_DATA_CACHE{"cec*".${$outhash{$h}}{mtm}.'*'.${$outhash{$h}}{serial}};
|
||||
if ($newhostname1) {
|
||||
trace( $request, "$h find hostname $newhostname1 with mtms");
|
||||
trace( $request, "$h found hostname $newhostname1 with mtms");
|
||||
${$outhash{$h}}{hostname} = $newhostname1;
|
||||
push @matchnode, $h;
|
||||
}
|
||||
@@ -1177,7 +1270,7 @@ sub parse_responses {
|
||||
my $newhostname2 = $::OLD_DATA_CACHE{"cec*".$tp.'*'.${$outhash{$h}}{cid}};
|
||||
if ($newhostname2) {
|
||||
${$outhash{$h}}{hostname} = $newhostname2;
|
||||
trace( $request, "$h find hostname $newhostname2 with parent and id");
|
||||
trace( $request, "$h found hostname $newhostname2 with parent and id");
|
||||
push @matchnode, $h;
|
||||
}
|
||||
}
|
||||
@@ -1185,16 +1278,17 @@ sub parse_responses {
|
||||
|
||||
trace( $request, "\n\n\nBegin to find fsp/bpa's hostname and parent");
|
||||
foreach my $h ( keys %outhash ) {
|
||||
# Added a skip if processing Flex blades
|
||||
if(${$outhash{$h}}{type} eq TYPE_FSP or ${$outhash{$h}}{type} eq TYPE_BPA) {
|
||||
$newhostname = $::OLD_DATA_CACHE{${$outhash{$h}}{type}."*".${$outhash{$h}}{mtm}.'*'.${$outhash{$h}}{serial}.'*'.${$outhash{$h}}{side}};
|
||||
if ($newhostname){
|
||||
${$outhash{$h}}{hostname} = $newhostname ;
|
||||
trace( $request, "$h find hostname $newhostname");
|
||||
trace( $request, "$h found hostname $newhostname");
|
||||
push @matchnode, $h;
|
||||
}
|
||||
my $ptmp = ${$outhash{$h}}{parent};
|
||||
${$outhash{$h}}{parent} = ${$outhash{$ptmp}}{hostname};
|
||||
trace( $request, "$h find parent ${$outhash{$ptmp}}{hostname}");
|
||||
${$outhash{$h}}{parent} = ${$outhash{$ptmp}}{hostname} unless((${$outhash{$h}}{type} eq TYPE_FSP) && ${$outhash{$h}}{mtm} =~ /^7895|1457|7954/ );
|
||||
trace( $request, "$h found parent ${$outhash{$ptmp}}{hostname}");
|
||||
#check if fsp/bpa's ip is valid
|
||||
my $vip = check_ip(${$outhash{$h}}{ip});
|
||||
unless ( $vip ) { #which means the ip is a valid one
|
||||
@@ -1210,10 +1304,11 @@ sub parse_responses {
|
||||
${$outhash{$child}}{fid} = ${$outhash{$h}}{fid};
|
||||
${$outhash{$child}}{cid} = ${$outhash{$h}}{cid};
|
||||
trace( $request, "child is $child, fid is ${$outhash{$child}}{fid}, cid is ${$outhash{$child}}{cid}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} # end - process fsp and bpa
|
||||
} # end process responses loop
|
||||
|
||||
##########################################################
|
||||
# If there is -n flag, skip the matched nodes
|
||||
##########################################################
|
||||
@@ -1250,7 +1345,9 @@ sub parse_responses {
|
||||
}
|
||||
send_msg ( $request, 0, "These nodes defined in database but can't be discovered: $notdisnode \n");
|
||||
}
|
||||
|
||||
foreach my $no(keys %outhash) {
|
||||
delete $outhash{$no} unless ( ${$outhash{$no}}{hostname} );
|
||||
}
|
||||
return \%outhash;
|
||||
}
|
||||
##########################################################################
|
||||
@@ -1639,7 +1736,7 @@ sub process_request {
|
||||
$min = "more than 2";
|
||||
}
|
||||
#my $start1 = Time::HiRes::gettimeofday();
|
||||
send_msg( \%request, 0, "$sendcount requests with $rspc responses. Now processing responses. This will take $min minutes...");
|
||||
send_msg( \%request, 0, "$sendcount requests with $rspc responses. Now processing responses. This will take $min minutes...") unless ($globalopt{x} or $globalopt{z});
|
||||
format_output( \%request, $searchmacsref);
|
||||
#my $elapsed1 = Time::HiRes::gettimeofday() - $start1;
|
||||
#send_msg( \%request, 0, "$num nodes takes $elapsed1");
|
||||
|
||||
@@ -257,6 +257,13 @@ sub process_request {
|
||||
# the directory/file in litefile table must be the absolute path ("/***")
|
||||
foreach my $entry (@$listNew) {
|
||||
my @tmp = split (/\s+/, $entry);
|
||||
|
||||
# check the validity of the option
|
||||
if ($tmp[1] !~ /^(tmpfs|persistent|localdisk|rw|ro|con|link|tmpfs,rw|link,ro|link,persistent|link,con)$/) {
|
||||
$callback->({error=>[qq{ $tmp[2] has invalid option. The valid options: tmpfs persistent localdisk rw ro con link tmpfs,rw link,ro link,persistent link,con}], errorcode=>[1]});
|
||||
return;
|
||||
}
|
||||
|
||||
unless ($tmp[2] =~ m{^/}) {
|
||||
$callback->({error=>[qq{ $tmp[2] is not one absolute path. }], errorcode=>[1]});
|
||||
return;
|
||||
|
||||
@@ -477,65 +477,12 @@ sub preprocess_updatenode
|
||||
}
|
||||
|
||||
if (scalar(@sns) && $::SECURITY) {
|
||||
|
||||
$::CALLBACK = $callback;
|
||||
$::NODEOUT = ();
|
||||
|
||||
# setup the ssh keys
|
||||
my $req_sshkey = {%$request};
|
||||
$req_sshkey->{node} = \@sns;
|
||||
$req_sshkey->{security}->[0] = "yes";
|
||||
if ($::USER) {
|
||||
$req_sshkey->{user}->[0] = $::USER;
|
||||
}
|
||||
if ($::DEVICETYPE) {
|
||||
$req_sshkey->{devicetype}->[0] = $::DEVICETYPE;
|
||||
}
|
||||
|
||||
updatenode($req_sshkey, \&updatenode_cb, $subreq);
|
||||
|
||||
# run the postscripts: remoteshell, servicenode
|
||||
if ($postscripts eq "allkeys44444444security") {
|
||||
my ($rc, $AIXnodes, $Linuxnodes) = xCAT::InstUtils->getOSnodes(\@sns);
|
||||
|
||||
my $req_rs = {%$request};
|
||||
my $ps;
|
||||
if (scalar(@{$AIXnodes})) {
|
||||
$ps = "aixremoteshell,servicenode";
|
||||
$req_rs->{rerunps}->[0] = "yes";
|
||||
$req_rs->{rerunps4security}->[0] = "yes";
|
||||
$req_rs->{node} = $AIXnodes;
|
||||
$req_rs->{postscripts} = [$ps];
|
||||
updatenode($req_rs, \&updatenode_cb, $subreq);
|
||||
}
|
||||
|
||||
if (scalar(@{$Linuxnodes})) {
|
||||
$ps = "remoteshell,servicenode";
|
||||
$req_rs->{rerunps}->[0] = "yes";
|
||||
$req_rs->{rerunps4security}->[0] = "yes";
|
||||
$req_rs->{node} = $Linuxnodes;
|
||||
$req_rs->{postscripts} = [$ps];
|
||||
updatenode($req_rs, \&updatenode_cb, $subreq);
|
||||
}
|
||||
}
|
||||
|
||||
# parse the output of update security for sns
|
||||
foreach my $sn (keys %{$::NODEOUT}) {
|
||||
if (!grep /^$sn$/, @sns) {
|
||||
next;
|
||||
}
|
||||
if ( (grep /ps ok/, @{$::NODEOUT->{$sn}})
|
||||
&& (grep /ssh ok/, @{$::NODEOUT->{$sn}}) ) {
|
||||
push @good_sns, $sn;
|
||||
}
|
||||
}
|
||||
|
||||
if ($::VERBOSE) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Update security for following service nodes: @sns.";
|
||||
push @{$rsp->{data}}, " Following service nodes have been updated successfully: @good_sns";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
# cannot use updatenode -k to compute nodes, whose master is a service node
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "updatenode -k is not supported to compute nodes in a hierarchical cluster.";
|
||||
push @{$rsp->{data}}, " To update ssh keys on compute nodes , use xdsh -K";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback,1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# build each request for each service node
|
||||
|
||||
@@ -1146,7 +1146,7 @@ ions.\n";
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "$::msgstr Could not create a NIM definition for \'$group\'.\n";
|
||||
$rsp->{data}->[0] = "$::msgstr Error running command \'$cmd\'.\n";
|
||||
if ($::verbose)
|
||||
{
|
||||
$rsp->{data}->[1] = "$output";
|
||||
|
||||
@@ -214,9 +214,20 @@ sub preprocess_request
|
||||
# if it is not being service by the MN
|
||||
if (!grep(/$snkey/, @MNnodeipaddr))
|
||||
{
|
||||
|
||||
# if it is a good SN, one ready to service the nodes
|
||||
if (grep(/$snkey/, @::good_SN))
|
||||
#if it is a good SN, one ready to service the nodes
|
||||
# split if a pool
|
||||
# if one in the pool is good, send the command to the
|
||||
# daemon
|
||||
my @sn_list = split ',', $snkey;
|
||||
my $goodsn=0;
|
||||
foreach my $sn (@sn_list) {
|
||||
if (grep(/$sn/, @::good_SN)) {
|
||||
$goodsn=1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
# found a good service node
|
||||
if ($goodsn == 1)
|
||||
{
|
||||
my $noderequests =
|
||||
&process_nodes($req, $sn, $snkey,$synfiledir);
|
||||
|
||||
@@ -3670,13 +3670,13 @@ sub nodeSet {
|
||||
$userId =~ tr/a-z/A-Z/;
|
||||
|
||||
# Get install directory and domain from site table
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("installdir");
|
||||
my @entries = xCAT::Utils->get_site_attribute("installdir");
|
||||
my $installDir = $entries[0];
|
||||
@entries = xCAT::TableUtils->get_site_attribute("domain");
|
||||
@entries = xCAT::Utils->get_site_attribute("domain");
|
||||
my $domain = $entries[0];
|
||||
@entries = xCAT::TableUtils->get_site_attribute("master");
|
||||
@entries = xCAT::Utils->get_site_attribute("master");
|
||||
my $master = $entries[0];
|
||||
@entries = xCAT::TableUtils->get_site_attribute("xcatdport");
|
||||
@entries = xCAT::Utils->get_site_attribute("xcatdport");
|
||||
my $xcatdPort = $entries[0];
|
||||
|
||||
# Get node OS, arch, and profile from 'nodetype' table
|
||||
@@ -4870,7 +4870,7 @@ sub updateNode {
|
||||
$userId =~ tr/a-z/A-Z/;
|
||||
|
||||
# Get install directory
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("installdir");
|
||||
my @entries = xCAT::Utils->get_site_attribute("installdir");
|
||||
my $installDir = $entries[0];
|
||||
|
||||
# Get host IP and hostname from /etc/hosts
|
||||
@@ -5410,10 +5410,7 @@ sub changeHypervisor {
|
||||
}
|
||||
|
||||
# resetsmapi
|
||||
elsif ( $args->[0] eq "--resetsmapi" ) {
|
||||
# This is no longer supported in chvm. Using chhypervisor instead.
|
||||
changeHypervisor( $callback, $node, $args );
|
||||
|
||||
elsif ( $args->[0] eq "--resetsmapi" ) {
|
||||
# Assuming zVM 6.1 or older
|
||||
# Force each worker machine off
|
||||
my @workers = ('VSMWORK1', 'VSMWORK2', 'VSMWORK3', 'VSMREQIN', 'VSMREQIU');
|
||||
|
||||
+7
-15
@@ -1010,16 +1010,6 @@ sub plugin_command {
|
||||
unless (@nodes) {
|
||||
$req->{emptynoderange} = [1];
|
||||
}
|
||||
|
||||
if(@nodes == 0) {
|
||||
my $rsp = {errorcode=>1,error=>"NO node or noderange specified"};
|
||||
$rsp->{serverdone} = {};
|
||||
if ($sock) {
|
||||
print $sock XMLout($rsp,RootName=>'xcatresponse' ,NoAttr=>1);
|
||||
}
|
||||
return ($rsp);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (@nodes) { $req->{node} = \@nodes; }
|
||||
@@ -1221,8 +1211,8 @@ sub plugin_command {
|
||||
if ($sock) { close $pfd; }
|
||||
unless ($handler_hash{$_} == 1) {
|
||||
#ok, if nodes have numbers, this sorts them numerically... roughly..
|
||||
#if node doesn't, then it spews a message, need to fix
|
||||
my @nodes = sort {($a =~ /(\d+)/)[0] <=> ($b =~ /(\d+)/)[0] || $a cmp $b } (keys %{$handler_hash{$_}});
|
||||
#if node doesn't, then it sorts out alphabetically.
|
||||
my @nodes = sort {($a =~ /(\d+)/ ? $1 : -1)[0] <=> ($b =~ /(\d+)/ ? $1 : -1)[0] || $a cmp $b } (keys %{$handler_hash{$_}});
|
||||
$req->{node}=\@nodes;
|
||||
}
|
||||
no strict "refs";
|
||||
@@ -1526,7 +1516,7 @@ sub dispatch_request {
|
||||
#flock($dlock,LOCK_UN);
|
||||
if ($errstr) {
|
||||
if ($numdests == 1) {
|
||||
dispatch_callback({error=>["Unable to dispatch hierarchical sub-command to ".$ENV{XCATHOST}.". This service node may be down or its xcatd daemon may not be responding."],errorcode=>[1]});
|
||||
dispatch_callback({error=>["Unable to dispatch hierarchical sub-command to ".$ENV{XCATHOST}.". Error: $errstr."],errorcode=>[1]});
|
||||
xCAT::MsgUtils->message("S","Error dispatching request to ".$ENV{XCATHOST}.": ".$errstr);
|
||||
} else {
|
||||
xCAT::MsgUtils->message("S","Error dispatching request to ".$ENV{XCATHOST}.", trying other service nodes: ".$errstr);
|
||||
@@ -1742,7 +1732,7 @@ sub service_connection {
|
||||
my $bytesread;
|
||||
do { $bytesread=sysread($sock,$line,65536,length($line)) } while ($bytesread);
|
||||
if (length($line)==0) {
|
||||
if (not defined $bytesread and $! == EAGAIN) { next; } #
|
||||
if (not defined $bytesread and ($! == EAGAIN or $! == ECHILD)) { next; } # ECHILD makes no sense, but some platform does
|
||||
last;
|
||||
}
|
||||
$flags=fcntl($sock,F_GETFL,0);
|
||||
@@ -1895,7 +1885,9 @@ sub send_pending_responses {
|
||||
$blocks += 1;
|
||||
}
|
||||
foreach (0..$blocks) {
|
||||
do {
|
||||
syswrite($sock,$resp,4096,$_*4096);
|
||||
} while (($! == EAGAIN) or ($! == ECHILD));
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -2001,7 +1993,7 @@ sub validate {
|
||||
# check to see if peerhost is trusted
|
||||
foreach $rule (@$policies) {
|
||||
|
||||
if (($rule->{name} and (($rule->{name} eq $peerhost) || ($rule->{name} eq $peerhostorg))) && ($rule->{rule}=~ /trusted/i)) {
|
||||
if (($rule->{name} and $rule->{name} eq $peername) && ($rule->{rule}=~ /trusted/i)) {
|
||||
$peerstatus="Trusted";
|
||||
last;
|
||||
}
|
||||
|
||||
@@ -39,10 +39,18 @@
|
||||
# This command can only be run by a root user.
|
||||
#
|
||||
####################################################################
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT =
|
||||
$ENV{'XCATROOT'} ? $ENV{'XCATROOT'}
|
||||
: -d '/opt/xcat' ? '/opt/xcat'
|
||||
: '/usr';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use File::Spec;
|
||||
use Getopt::Long;
|
||||
use strict;
|
||||
require xCAT::MsgUtils;
|
||||
my $OSname;
|
||||
my @Commands_array;
|
||||
my $Command_name;
|
||||
@@ -94,7 +102,7 @@ sub run_cmd {
|
||||
print "\n\tExecuting: $Command \n";
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "Timeout\n" };
|
||||
alarm 60;
|
||||
alarm 600;
|
||||
@output = `$Command`;
|
||||
alarm 0;
|
||||
};
|
||||
@@ -193,7 +201,7 @@ sub snap_it {
|
||||
|
||||
@files_array = (
|
||||
"/etc/xcat/*","$::ROOTHOME/.xcat/*", "$INSTALLDIR/autoinst/*",
|
||||
"$INSTALLDIR/postscripts/*", "$INSTALLDIR/prescripts/*",
|
||||
"$INSTALLDIR/postscripts/*", "$INSTALLDIR/prescripts/*", "$INSTALLDIR/custom/*",
|
||||
"/tftpboot/*", "/var/log/consoles/*",
|
||||
"/etc/*-release", "/etc/dhcpd.conf",
|
||||
"/var/lib/dhcpd/dhcpd.leases", "/etc/hosts", "/etc/resolv.conf",
|
||||
@@ -217,7 +225,7 @@ sub snap_it {
|
||||
@Commands_array = (
|
||||
"uname -a","ifconfig -a","netstat -in","netstat -rn","env",
|
||||
"reventlog -a","lsmod","/sbin/lspci","lssrc -a","rpm -qa",
|
||||
"ls $installdir",
|
||||
"ls $installdir","/bin/crontab -l",
|
||||
"find /tftpboot -size -32k","ls -lR $xcatroot",
|
||||
"arp -a","ps -edlf","ps -aux","ulimit -a","df -k","oslevel",
|
||||
"netstat -A","errpt -a","/usr/sbin/instfix -i",
|
||||
@@ -227,10 +235,10 @@ sub snap_it {
|
||||
@Commands_array = (
|
||||
"uname -a","ifconfig -a","netstat -in","netstat -rn","env",
|
||||
"reventlog -a","lsmod","/sbin/lspci","lssrc -a","rpm -qa",
|
||||
"ls $installdir",
|
||||
"ls $installdir","/usr/bin/crontab -l",
|
||||
"find /tftpboot -size -32k","ls -lR $xcatroot",
|
||||
"arp -a","ps -edlf","ps -aux","ulimit -a","df -k",
|
||||
"cat /etc/issue","lsxcatd -a");
|
||||
"cat /etc/issue","lsxcatd -a","cat /proc/meminfo", "cat /proc/cpuinfo");
|
||||
}
|
||||
foreach my $item (@Commands_array) {
|
||||
$Command = $item;
|
||||
@@ -332,7 +340,11 @@ if ($::HELP ) {
|
||||
exit 0;
|
||||
}
|
||||
if ($::VERSION) {
|
||||
print " xcatsnap tool version 1.0\n";
|
||||
my $version = xCAT::Utils->Version();
|
||||
$version .= "\n";
|
||||
xCAT::MsgUtils->message("N", $version);
|
||||
exit 0;
|
||||
|
||||
exit 0;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,3 +5,4 @@ tcl
|
||||
tk
|
||||
tcsh
|
||||
libgcc.ppc
|
||||
gcc-gfortran
|
||||
|
||||
@@ -5,3 +5,4 @@ perl
|
||||
tcl
|
||||
tk
|
||||
tcsh
|
||||
gcc-gfortran
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
# Sample script to customize options for Mellonax OFED IB support
|
||||
@@ -42,9 +42,9 @@ if [ $OS != "AIX" ]; then
|
||||
#download_dir=`echo $OFED_DIR | cut -d '/' -f3-`
|
||||
#wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=5 ftp://$SITEMASTER/$download_dir/ 2> /tmp/wget.log
|
||||
download_dir=$OFED_DIR
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=6 --reject "index.html*" --no-parent http://$SITEMASTER$download_dir/ 2> /tmp/wget.log
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=6 --reject "index.html*" --no-parent http://$SITEMASTER$download_dir/.mlnx 2>> /tmp/wget.log
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=6 --reject "index.html*" --no-parent http://$SITEMASTER$download_dir/.supported_kernels 2>> /tmp/wget.log
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=6 --reject "index.html*" --no-parent http://$MASTER$download_dir/ 2> /tmp/wget.log
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=6 --reject "index.html*" --no-parent http://$MASTER$download_dir/.mlnx 2>> /tmp/wget.log
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=6 --reject "index.html*" --no-parent http://$MASTER$download_dir/.supported_kernels 2>> /tmp/wget.log
|
||||
#rpm -Uvh --force libibverbs-devel*.rpm
|
||||
perl -x mlnxofedinstall --without-32bit --force
|
||||
rm -Rf /tmp/ofed
|
||||
|
||||
@@ -88,6 +88,7 @@ else
|
||||
while [ $num -lt $loop_number ]
|
||||
do
|
||||
`rmdev -d -l ib$num >/dev/null 2>&1`
|
||||
`rmdev -d -l iba$num >/dev/null 2>&1`
|
||||
n=`expr $num % 2`
|
||||
if [ $n == 1 ]
|
||||
then
|
||||
@@ -96,7 +97,9 @@ else
|
||||
fi
|
||||
num=`expr $num + 1`
|
||||
done
|
||||
|
||||
`rmdev -dl icm >/dev/null 2>&1`
|
||||
mkdev -c management -s infiniband -t icm
|
||||
cfgmgr
|
||||
loop_number=`lsdev -Cc adapter |grep iba |wc -l`
|
||||
|
||||
fi
|
||||
@@ -116,8 +119,10 @@ do
|
||||
if [ $NODE ]
|
||||
then
|
||||
hostname="$NODE-$nic"
|
||||
shortname=$NODE
|
||||
else
|
||||
hostname="$HOST-$nic"
|
||||
shortname=$HOST
|
||||
fi
|
||||
`ifconfig $nic up`
|
||||
if [ $PLTFRM == "Linux" ]
|
||||
@@ -172,24 +177,25 @@ GATEWAY=$gateway" > $dir/ifcfg-$nic
|
||||
fi
|
||||
elif [ $PLTFRM == "AIX" ]
|
||||
then
|
||||
lsdev -C | grep icm | grep Available
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
mkdev -c management -s infiniband -t icm
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
mkdev -l icm
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
#lsdev -C | grep icm | grep Available
|
||||
#if [ $? -ne 0 ]
|
||||
#then
|
||||
# mkdev -c management -s infiniband -t icm
|
||||
# if [ $? -ne 0 ]
|
||||
# then
|
||||
# mkdev -l icm
|
||||
# if [ $? -ne 0 ]
|
||||
# then
|
||||
# exit $?
|
||||
# fi
|
||||
# fi
|
||||
#fi
|
||||
|
||||
#Configure the IB interfaces. Customize the port num.
|
||||
iba_num=$num
|
||||
ib_adapter="iba$iba_num"
|
||||
port=1
|
||||
chdev -l $ib_adapter -a hostname=$shortname
|
||||
mkiba -a $ip -i $nic -A $ib_adapter -p $port -P -1 -S up -m $netmask
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -85,11 +85,17 @@ else
|
||||
num0=`expr $num \* 2`
|
||||
num1=`expr $num0 + 1`
|
||||
`rmdev -d -l ib$num0 >/dev/null 2>&1`
|
||||
`rmdev -d -l iba$num0 >/dev/null 2>&1`
|
||||
`rmdev -d -l ib$num1 >/dev/null 2>&1`
|
||||
`rmdev -d -l iba$num1 >/dev/null 2>&1`
|
||||
`rmdev -d -l ml$num >/dev/null 2>&1`
|
||||
num=`expr $num + 1`
|
||||
done
|
||||
|
||||
`rmdev -dl icm >/dev/null 2>&1`
|
||||
mkdev -c management -s infiniband -t icm
|
||||
cfgmgr
|
||||
|
||||
ib_number=`lsdev -Cc adapter |grep iba |wc -l`
|
||||
loop_number=`expr $ib_number \* 2`
|
||||
|
||||
@@ -109,8 +115,10 @@ do
|
||||
if [ $NODE ]
|
||||
then
|
||||
hostname="$NODE-$nic"
|
||||
shortname=$NODE;
|
||||
else
|
||||
hostname="$HOST-$nic"
|
||||
shortname=$HOST;
|
||||
fi
|
||||
`ifconfig $nic up`
|
||||
if [ $PLTFRM == "Linux" ]
|
||||
@@ -180,19 +188,19 @@ GATEWAY=$gateway" > $dir/ifcfg-$nic
|
||||
fi
|
||||
elif [ $PLTFRM == "AIX" ]
|
||||
then
|
||||
lsdev -C | grep icm | grep Available
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
mkdev -c management -s infiniband -t icm
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
mkdev -l icm
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
#lsdev -C | grep icm | grep Available
|
||||
#if [ $? -ne 0 ]
|
||||
#then
|
||||
# mkdev -c management -s infiniband -t icm
|
||||
# if [ $? -ne 0 ]
|
||||
# then
|
||||
# mkdev -l icm
|
||||
# if [ $? -ne 0 ]
|
||||
# then
|
||||
# exit $?
|
||||
# fi
|
||||
# fi
|
||||
#fi
|
||||
|
||||
#Configure the IB interfaces. Customize the port num.
|
||||
|
||||
@@ -204,6 +212,7 @@ GATEWAY=$gateway" > $dir/ifcfg-$nic
|
||||
else
|
||||
port=2
|
||||
fi
|
||||
chdev -l $ib_adapter -a hostname=$shortname
|
||||
mkiba -a $ip -i $nic -A $ib_adapter -p $port -P -1 -S up -m $netmask
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
cmdline
|
||||
|
||||
lang en_US
|
||||
langsupport en_US
|
||||
network --bootproto dhcp
|
||||
|
||||
#
|
||||
@@ -92,11 +91,6 @@ text
|
||||
#
|
||||
firewall --disabled
|
||||
|
||||
#
|
||||
# mouse selection
|
||||
#
|
||||
#mouse genericps/2 --emulthree
|
||||
mouse none
|
||||
|
||||
#
|
||||
# Select a zone
|
||||
@@ -151,7 +145,7 @@ reboot
|
||||
#
|
||||
#end of section
|
||||
#
|
||||
%packages --resolvedeps
|
||||
%packages
|
||||
#INCLUDE_DEFAULT_PKGLIST#
|
||||
|
||||
%pre
|
||||
@@ -179,6 +173,6 @@ remove_qla
|
||||
remove_lpfc
|
||||
echo "All qla modules removed"
|
||||
sleep 10
|
||||
#INCLUDE:../scripts/pre.rh#
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh#
|
||||
%post
|
||||
#INCLUDE:../scripts/post.rh#
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rh#
|
||||
|
||||
@@ -86,7 +86,7 @@ run_ps () {
|
||||
echo "\"\`date\` Running postscript: \$@\"" | tee -a \$logfile
|
||||
#./\$@ 2>&1 1> /tmp/tmp4xcatlog
|
||||
#cat /tmp/tmp4xcatlog | tee -a \$logfile
|
||||
./\$@ 2>&1 | tee -a $logfile
|
||||
./\$@ 2>&1 | tee -a \$logfile
|
||||
else
|
||||
echo "\"\`date\` Postscript \$1 does NOT exist.\"" | tee -a \$logfile
|
||||
fi
|
||||
@@ -125,11 +125,12 @@ chkconfig --add xcatpostinit1
|
||||
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript`
|
||||
echo "$TMP" > /xcatpost/mypostscript
|
||||
|
||||
/xcatpost/mypostscript
|
||||
|
||||
export NODE=#TABLE:nodelist:THISNODE:node#
|
||||
export OSVER=#TABLE:nodetype:THISNODE:os#
|
||||
export ARCH=#TABLE:nodetype:THISNODE:arch#
|
||||
addsiteyum
|
||||
/xcatpost/mypostscript
|
||||
sed -i 's/^serial/#serial/' /boot/grub/grub.conf
|
||||
sed -i 's/^terminal/#terminal/' /boot/grub/grub.conf
|
||||
updateflag.awk $MASTER 3002
|
||||
|
||||
@@ -12,5 +12,8 @@ R:popt*
|
||||
R:rsync*
|
||||
|
||||
# using Perl 5.10.1
|
||||
R:perl-Net_SSLeay.pm-1.30-3*
|
||||
# used for AIX 7.1.2 and older
|
||||
#R:perl-Net_SSLeay.pm-1.30-3*
|
||||
# used for AIX 7.1.3 and above
|
||||
R:perl-Net_SSLeay.pm-1.55-3*
|
||||
R:perl-IO-Socket-SSL*
|
||||
|
||||
@@ -32,7 +32,7 @@ R:expat*
|
||||
R:fping*
|
||||
|
||||
R:libxml2*
|
||||
R:net-snmp-5.4.2.1-2*
|
||||
R:net-snmp-5.7.2-2*
|
||||
R:net-snmp-devel*
|
||||
R:net-snmp-perl*
|
||||
R:openslp-xcat*
|
||||
|
||||
@@ -29,7 +29,7 @@ R:curl*
|
||||
R:expat*
|
||||
R:fping*
|
||||
R:libxml2*
|
||||
R:net-snmp-5.4.2.1-3*
|
||||
R:net-snmp-5.7.2-3*
|
||||
R:net-snmp-devel*
|
||||
R:net-snmp-perl*
|
||||
R:openslp-xcat*
|
||||
@@ -47,7 +47,10 @@ R:perl-Net-DNS*
|
||||
R:perl-Net-IP*
|
||||
R:perl-Net-Telnet*
|
||||
R:perl-version-0.82-2*
|
||||
R:perl-Net_SSLeay.pm-1.30-3*
|
||||
# used for AIX 7.1.2 and older
|
||||
#R:perl-Net_SSLeay.pm-1.30-3*
|
||||
# used for AIX 7.1.3 and above
|
||||
R:perl-Net_SSLeay.pm-1.55-3*
|
||||
R:perl-IO-Socket-SSL*
|
||||
R:unixODBC*
|
||||
|
||||
|
||||
@@ -21,6 +21,17 @@ declare -a CLIST
|
||||
declare -a PLIST
|
||||
|
||||
ME=`hostname -s`
|
||||
MAX=30
|
||||
TRIES=1
|
||||
while [ x$ME = x ];do
|
||||
TRIES=$[ $TRIES+1 ]
|
||||
if [ $TRIES -eq $MAX ]; then
|
||||
echo "Can NOT get the hostname of the node. System will fail to enable the persistent files.">/dev/console
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
ME=`hostname -s`
|
||||
done
|
||||
|
||||
PERSISTENT="${MNTDIR}/$SL/persistent/$ME"
|
||||
|
||||
@@ -539,3 +550,7 @@ ResolveLinks
|
||||
#cp -r -a ${DEFAULT}/* /.snapshot/tmpfs/
|
||||
# foo
|
||||
|
||||
# Copy the fake network interface configuration file to /etc/sysconfig/network to handle
|
||||
# the issue of reboot nfs-based statelite
|
||||
/bin/cp /tmp/ifcfg-* $MNTDIR/etc/sysconfig/network
|
||||
|
||||
|
||||
@@ -21,6 +21,17 @@ declare -a CLIST
|
||||
declare -a PLIST
|
||||
|
||||
ME=`hostname`
|
||||
MAX=30
|
||||
TRIES=1
|
||||
while [ x$ME = x ];do
|
||||
TRIES=$[ $TRIES+1 ]
|
||||
if [ $TRIES -eq $MAX ]; then
|
||||
echo "Can NOT get the hostname of the node. System will fail to enable the persistent files.">/dev/console
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
ME=`hostname -s`
|
||||
done
|
||||
|
||||
PERSISTENT="${MNTDIR}/$SL/persistent/$ME"
|
||||
|
||||
|
||||
@@ -1469,6 +1469,8 @@ sub generic_post { #This function is meant to leave the image in a state approxi
|
||||
print $cfgfile " FLOWFLAG=\"-h\"\n";
|
||||
print $cfgfile " fi\n";
|
||||
print $cfgfile " if [ -x /sbin/initctl ]; then\n"; # Upstart style
|
||||
# The syntax of next line is not correct, that means it does NOthing. (rh6 and higher)
|
||||
# And it should NOT work for rh6 and higher, otherwise it will cauase multiple agetty for ttySx
|
||||
print $cfgfile " initctl emit --no-wait fedora.serial-console-available \$COTTY \$COSPEED\n";
|
||||
print $cfgfile " else\n";
|
||||
print $cfgfile " echo xco:2345:respawn:/sbin/agetty \$FLOWFLAG \$COTTY \$COSPEED xterm >> /etc/inittab\n";
|
||||
|
||||
@@ -990,6 +990,11 @@ while ! ifconfig | grep inet; do
|
||||
sleep 1
|
||||
netstart \$IFACE
|
||||
done
|
||||
# Add a fake interface configuration file for the boot interface to skip the
|
||||
# ifdown of the interface during the reboot/shutdown to skip the fs broken of
|
||||
# nfs based file system
|
||||
echo "STARTMODE=nfsroot" > /tmp/ifcfg-\$IFACE
|
||||
|
||||
ip addr add dev lo 127.0.0.1/8
|
||||
ip link set lo up
|
||||
cd /
|
||||
@@ -1253,7 +1258,12 @@ EOMS
|
||||
close($inifile);
|
||||
open($inifile,">"."/tmp/xcatinitrd.$$/bin/netstart");
|
||||
print $inifile "#!/bin/bash \n";
|
||||
print $inifile "dhcpcd \${1}\n";
|
||||
if ($osver_host == 10) {
|
||||
print $inifile "dhcpcd \${1}\n";
|
||||
} else { # for sles11 or higher
|
||||
# -p is used to keep the network connection during the shutdown. Used for nfs-based statelite shutdown
|
||||
print $inifile "dhcpcd \${1} -p\n";
|
||||
}
|
||||
|
||||
#-- Bring other NICs up in /bin/netstart in initrd for NIC failover
|
||||
foreach (split /,/,$othernics) {
|
||||
@@ -1301,9 +1311,11 @@ END
|
||||
|
||||
if ($arch =~ /x86_64/) {
|
||||
push @filestoadd,"lib64/libnss_dns.so.2";
|
||||
push @filestoadd,"lib64/libnss_files.so.2";
|
||||
}
|
||||
else {
|
||||
push @filestoadd,"lib/libnss_dns.so.2";
|
||||
push @filestoadd,"lib/libnss_files.so.2";
|
||||
}
|
||||
|
||||
# cross-platfrom support on power6&7 etc
|
||||
@@ -1506,6 +1518,14 @@ sub generic_post { # This function is meant to leave the image in a state approx
|
||||
print $cfgfile "# Short-Description: gettyset\n";
|
||||
print $cfgfile "# Description:\n";
|
||||
print $cfgfile "### END INIT INFO\n";
|
||||
print $cfgfile "VERS=`grep VERSION /etc/SuSE-release`\n";
|
||||
print $cfgfile "if [ -n \"\$VERS\" ]; then\n";
|
||||
print $cfgfile " VERNUM=`echo \$VERS|awk -F= \'{print \$2}\'|sed -e \'s/ //g\'`\n";
|
||||
print $cfgfile "fi\n";
|
||||
print $cfgfile "if [ \"\$VERNUM\" -gt 10 ]; then\n";
|
||||
print $cfgfile " exit\n";
|
||||
print $cfgfile "fi\n";
|
||||
print $cfgfile "\n";
|
||||
print $cfgfile "for i in `cat /proc/cmdline`; do\n";
|
||||
print $cfgfile ' KEY=`echo $i|cut -d= -f 1`' . "\n";
|
||||
print $cfgfile " if [ \"\$KEY\" == \"console\" -a \"\$i\" != \"console=tty0\" ]; then\n";
|
||||
|
||||
@@ -427,7 +427,7 @@ export SEP_INSTALL_PATH=/tmp
|
||||
# UXSPI environment variable
|
||||
export UXLITE_CLEAN_INVFILE=1
|
||||
export UXSPI_CLEAN_INVFILE=1
|
||||
export UXSPI_BINARY_PATH=`find /toolscenter/uxspi -name '*uxspi*.anyos*' | sort | tail -n 1`
|
||||
export UXSPI_BINARY_PATH=`find /toolscenter/uxspi -name '*uxspi*.anyos*bin' | sort | tail -n 1`
|
||||
export UXSPI_GUI_CMD="xterm -geometry 168x58+5+5 +sb -e ${UXSPI_BINARY_PATH}"
|
||||
export UXSPI_TUI_CMD="${UXSPI_BINARY_PATH} update --tui --firmware -l ${UXSPI_BOOTABLE} --timeout=${UXSPI_TIMEOUT}"
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ BEGIN
|
||||
}
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use xCAT::Utils;
|
||||
use Getopt::Long;
|
||||
|
||||
use strict;
|
||||
@@ -39,21 +38,25 @@ GetOptions( 'V|verbose' => \$::VERBOSE,
|
||||
if ($help) {
|
||||
print "DB2 Table Reorganization utility.\n";
|
||||
print
|
||||
"This script can be set as a cron job or run on the command line to reorg the xcatdb DB2 database tables.\n";
|
||||
"This script can be set as a cron job or run on the command line to reorg the xcatdb DB2 database tables. It automatically added as a cron job, if you use the db2sqlsetup command to create your DB2 database setup for xCAT. \n";
|
||||
print "Usage:\n";
|
||||
print "\t--V - Verbose mode\n";
|
||||
print "\t--h - usage\n";
|
||||
print
|
||||
"\t--t -comma delimitated list of tables.\n Without this flag it reorgs all tables in the xcatdb database .\n";
|
||||
print "\n";
|
||||
print "Author: Lissa Valletta\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
require xCAT::Utils;
|
||||
|
||||
# check to see if running DB2
|
||||
my $DBname = xCAT::Utils->get_DBName;
|
||||
if ($DBname ne "DB2") {
|
||||
|
||||
print " Reorg of table only supported for DB2 database\n";
|
||||
`logger -txcat " reorgtbls:Only supports DB2 database"` ;
|
||||
`logger -p local4.err -t xcat " reorgtbls:Only supports DB2 database"` ;
|
||||
exit 1;
|
||||
|
||||
}
|
||||
@@ -64,7 +67,7 @@ if ($tablelist) { # input list of tables
|
||||
@tablist = xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
`logger -txcat " reorgtbls:error in select tabname from syscat.tables"` ;
|
||||
`logger -p local4.err -t xcat " reorgtbls:error in select tabname from syscat.tables"` ;
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
@@ -96,22 +99,23 @@ foreach my $table (@tablist) {
|
||||
$table =~ tr/a-z/A-Z/; # convert to upper
|
||||
if ($::VERBOSE) {
|
||||
print " Reorg of table $table\n";
|
||||
`logger -p local4.info -t xcat " Reorg of table $table."`;
|
||||
}
|
||||
$cmd="$::XCATROOT/sbin/runsqlcmd \"reorg indexes all for table $table allow write access;\"";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
`logger -txcat " reorgtbls:error $cmd"`;
|
||||
`logger -p local4.warning -t xcat " reorgtbls:error $cmd"`;
|
||||
} else {
|
||||
`logger -txcat " reorgtbls:reorg indexes for $table"`;
|
||||
`logger -p local4.info -t xcat " reorgtbls:reorg indexes for $table"`;
|
||||
}
|
||||
$cmd="$::XCATROOT/sbin/runsqlcmd \"reorg table $table inplace allow write access;\"";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
`logger -txcat " reorgtbls:error $cmd"`;
|
||||
`logger -p local4.warning -t xcat " reorgtbls:error $cmd"`;
|
||||
} else {
|
||||
`logger -txcat " reorgtbls:reorg $table inplace"`;
|
||||
`logger -p local4.info -t xcat " reorgtbls:reorg $table inplace"`;
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd `dirname $0`
|
||||
if [ ! -d repos/$OSVER/$ARCH ]; then
|
||||
logger -t xcat "addsiteyum: repos/$OSVER/$ARCH is not a directory"
|
||||
exit;
|
||||
logger -t xcat -p local4.err "addsiteyum: repos/$OSVER/$ARCH is not a directory"
|
||||
exit -1;
|
||||
fi
|
||||
for i in repos/$OSVER/$ARCH/*
|
||||
do
|
||||
@@ -12,4 +12,13 @@ do
|
||||
TARGFILE=`basename $i`
|
||||
TARGFILE=`echo $TARGFILE|sed -e s/.tmpl$/.repo/`
|
||||
sed -e s!#INSTSERVER#!$MASTER! $i > /etc/yum.repos.d/$TARGFILE
|
||||
|
||||
# disable the internet repos which are created by addsiteyum
|
||||
if [ -r "/etc/yum.repos.d/CentOS-Base.repo" ]; then
|
||||
TMP=`sed -e '/enabled/d' /etc/yum.repos.d/CentOS-Base.repo | sed -e '/^gpgkey/i enabled=0'`
|
||||
echo "$TMP" > /etc/yum.repos.d/CentOS-Base.repo
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -96,18 +96,40 @@ ONBOOT=yes
|
||||
" >/etc/sysconfig/network-scripts/ifcfg-bond0
|
||||
fi
|
||||
|
||||
if [[ $NTYPE != service ]]
|
||||
then
|
||||
if echo $MASTER | egrep '^([0-9]+.){3}[0-9]+$'
|
||||
then
|
||||
XCATMASTER=`grep "$MASTER " /etc/hosts | grep -v "^#" | awk '{print $2}' | awk -F '.' '{print $1}' | sed 's/-hf.*//g'`
|
||||
GATEWAY_IP=`ping -c 3 $XCATMASTER-bond0 -I hf0 2>/dev/null | grep "data" | sed 's/.* (\([0-9.]*\)).*/\1/' | uniq 2>&1`
|
||||
|
||||
elif [ -n "$MASTER" ]
|
||||
then
|
||||
XCATMASTER=`echo $MASTER | awk -F-hf '{print $1}'`
|
||||
GATEWAY_IP=`ping -c 3 $XCATMASTER-bond0 -I hf0 2>/dev/null | grep "data" | sed 's/.* (\([0-9.]*\)).*/\1/' | uniq 2>&1`
|
||||
fi
|
||||
|
||||
if [ -n "$GATEWAY_IP" ]
|
||||
then
|
||||
sed -i "/GATEWAY.*/d" /etc/sysconfig/network
|
||||
echo "GATEWAY=$GATEWAY_IP" >> /etc/sysconfig/network
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
x=0
|
||||
while [ $x -le $i ]; do
|
||||
ip link set dev hf${x} down
|
||||
sleep 2
|
||||
echo +hf${x} > /sys/class/net/bond0/bonding/slaves
|
||||
x=$((x+1))
|
||||
done
|
||||
|
||||
bond-mld > m.out 2>&1 &
|
||||
ip link set dev bond0 mtu 65536
|
||||
|
||||
ifdown bond0
|
||||
ifup bond0
|
||||
bond-mld > m.out 2>&1 &
|
||||
|
||||
else
|
||||
# Configurartion for AIX
|
||||
|
||||
+21
-5
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/sh
|
||||
# IBM(c) 2010 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -101,6 +101,21 @@ if [ -z "$OSPKGDIR" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
default_pkgdir="$INSTALLDIR/$OSVER/$ARCH"
|
||||
if [ $OSPKGDIR == $default_pkgdir ]; then
|
||||
if ( pmatch "$OSVER" "rhels5*" ); then
|
||||
if [ $ARCH == "x86_64" ]; then
|
||||
OSPKGDIR="$OSPKGDIR/Server"
|
||||
fi
|
||||
fi
|
||||
if ( pmatch "$OSVER" "sles*" ); then
|
||||
OSPKGDIR="$OSPKGDIR/1"
|
||||
elif ( pmatch "$OSVER" "SL5*" ); then
|
||||
OSPKGDIR="$OSPKGDIR/SL"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "$SDKDIR" != "" ]; then
|
||||
if [ $mounted -eq 0 ]; then
|
||||
SDKDIR="$NFSSERVER/$SDKDIR"
|
||||
@@ -108,11 +123,12 @@ if [ "$SDKDIR" != "" ]; then
|
||||
fi
|
||||
|
||||
if [ $mounted -eq 0 ]; then
|
||||
OSPKGDIR_NO_PREFIX=${OSPKGDIR#$INSTALLDIR}
|
||||
#OSPKGDIR_NO_PREFIX=${OSPKGDIR#$INSTALLDIR}
|
||||
|
||||
if [ "$OSPKGDIR" != "$OSPKGDIR_NO_PREFIX" ]; then
|
||||
OSPKGDIR="$NFSSERVER/$OSPKGDIR_NO_PREFIX"
|
||||
fi
|
||||
#if [ "$OSPKGDIR" != "$OSPKGDIR_NO_PREFIX" ]; then
|
||||
# OSPKGDIR="$NFSSERVER/$OSPKGDIR_NO_PREFIX"
|
||||
#fi
|
||||
OSPKGDIR="$NFSSERVER/$OSPKGDIR"
|
||||
fi
|
||||
|
||||
logger -t xcat "NFSSERVER=$NFSSERVER"
|
||||
|
||||
@@ -160,7 +160,7 @@ then
|
||||
service ssh restart
|
||||
fi
|
||||
else
|
||||
service sshd start
|
||||
service sshd restart
|
||||
fi
|
||||
|
||||
kill -9 $CREDPID
|
||||
|
||||
@@ -347,7 +347,7 @@ run_ps () {
|
||||
echo \"\`date\` Running postscript: \$@\" | tee -a \$logfile
|
||||
#./\$@ 2>&1 1> /tmp/tmp4xcatlog
|
||||
#cat /tmp/tmp4xcatlog | tee -a \$logfile
|
||||
./\$@ 2>&1 | tee -a $logfile
|
||||
./\$@ 2>&1 | tee -a \$logfile
|
||||
else
|
||||
echo \"\`date\` Postscript \$1 does NOT exist.\" | tee -a \$logfile
|
||||
fi
|
||||
|
||||
@@ -7,6 +7,6 @@ Standards-Version: 3.7.2
|
||||
|
||||
Package: xcatsn
|
||||
Architecture: all
|
||||
Depends: ${perl:Depends}, xcat-server (>= 2.5.0), perl-xcat (>= 2.5.0), xcat-client (>= 2.5.0), libdbd-sqlite3-perl, libxml-parser-perl, atftp-xcat, conserver, yaboot-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, fping, bind9, vsftpd, ipmitool (>=1.8.9), xnba-undi, syslinux-xcat, xcat-nbroot-oss-x86, xcat-nbroot-core-x86, xcat-nbkernel-x86, xcat-nbroot-oss-amd64, xcat-nbroot-core-amd64, xcat-nbkernel-amd64, xcat-nbroot-oss-ppc64, xcat-nbroot-core-ppc64, xcat-nbkernel-ppc64, syslinux
|
||||
Depends: ${perl:Depends}, xcat-server (>= 2.5.0), perl-xcat (>= 2.5.0), xcat-client (>= 2.5.0), libdbd-sqlite3-perl, libxml-parser-perl, atftp-xcat, conserver, yaboot-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, fping, bind9, vsftpd, ipmitool (>=1.8.9), xnba-undi, syslinux-xcat, syslinux
|
||||
Description: Metapackage for a common, default xCAT service node setup
|
||||
xCATsn is a service node management package intended for at-scale management, including hardware management and software management.
|
||||
|
||||
+18
-3
@@ -38,9 +38,8 @@ Requires: perl-IO-Stty
|
||||
%endif
|
||||
|
||||
%ifarch i386 i586 i686 x86 x86_64
|
||||
# All versions of the nb rpms are pulled in so an x86 MN can manage nodes of any arch.
|
||||
# The nb rpms are used for dhcp-based discovery, and flashing, so for now we do not need them on a ppc MN.
|
||||
Requires: xCAT-nbroot-oss-x86 xCAT-nbroot-core-x86 xCAT-nbkernel-x86 xCAT-nbroot-oss-x86_64 xCAT-nbroot-core-x86_64 xCAT-nbkernel-x86_64 xCAT-nbroot-oss-ppc64 xCAT-nbroot-core-ppc64 xCAT-nbkernel-ppc64 syslinux
|
||||
# The xCAT-genesis-x86_64 rpm is used for dhcp-based discovery, and flashing, so for now we do not need it on a ppc MN.
|
||||
Requires: syslinux xCAT-genesis-x86_64
|
||||
Requires: ipmitool-xcat >= 1.8.9
|
||||
Requires: xnba-undi syslinux-xcat
|
||||
%endif
|
||||
@@ -93,6 +92,17 @@ fi
|
||||
%endif
|
||||
|
||||
%post
|
||||
# create dir for the current pid and move the original ones from /tmp/xcat to /var/run/xcat
|
||||
mkdir -p /var/run/xcat
|
||||
if [ -r "/tmp/xcat/installservice.pid" ]; then
|
||||
mv /tmp/xcat/installservice.pid /var/run/xcat/installservice.pid
|
||||
fi
|
||||
if [ -r "/tmp/xcat/udpservice.pid" ]; then
|
||||
mv /tmp/xcat/udpservice.pid /var/run/xcat/udpservice.pid
|
||||
fi
|
||||
if [ -r "/tmp/xcat/mainservice.pid" ]; then
|
||||
mv /tmp/xcat/mainservice.pid /var/run/xcat/mainservice.pid
|
||||
fi
|
||||
|
||||
if [ "$1" = "1" ]; then #Only if installing for the first time..
|
||||
|
||||
@@ -128,6 +138,11 @@ fi
|
||||
/etc/init.d/$apachedaemon reload
|
||||
fi
|
||||
echo "xCATsn is now installed"
|
||||
%else
|
||||
# start xcatd on AIX
|
||||
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/restartxcatd
|
||||
echo "xCATsn is now installed"
|
||||
|
||||
%endif
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user