Compare commits
218 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b7f389e979 | |||
| 59dcc1871b | |||
| 45c1175e17 | |||
| 679b0d053d | |||
| 3d8a1746b7 | |||
| 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 | |||
| 441261bb2f | |||
| 80dbeffa85 | |||
| 39123d48ac | |||
| b8c42d07ae | |||
| 7368174669 | |||
| 3b64245ca6 | |||
| 8311f248fb | |||
| 82b0440a02 | |||
| e889ef17b1 | |||
| a815abaaed | |||
| ec266f7000 | |||
| 4633498a4b | |||
| 0a521cb31a | |||
| 31323d58fa | |||
| a1e1afdb9e | |||
| b0a21076e9 | |||
| 4b5a7005b1 | |||
| 3860a56041 | |||
| 7f5e911c2a | |||
| 180ba59b72 | |||
| 5e5710ad4e | |||
| 79deb0acf5 | |||
| 42cb10b6aa | |||
| 4b8ed14152 | |||
| 4854e5ca69 | |||
| 7f0e7d53ef | |||
| ac5654aae4 | |||
| 1a5bb68586 | |||
| d65d73f9e4 | |||
| fa973b8fd1 | |||
| 2d3d927056 | |||
| d82ee6e7f2 | |||
| e63d9a9967 | |||
| a0bd8f6a46 | |||
| 9d55a3b3c1 | |||
| 34f16337a1 | |||
| 6521a0df7e | |||
| 9af37d48bb | |||
| 7bb0967496 | |||
| 3f8c9bced2 | |||
| 21d1017f86 | |||
| 08a7dc5c78 | |||
| bf2247a181 | |||
| 52e71591be | |||
| b3c477dd6f | |||
| c7cae12392 | |||
| f8c5b0c53b | |||
| 72cbbc912d | |||
| d2f0431829 | |||
| d18d235f1d | |||
| aa1fcd2493 | |||
| ac28aa7e16 | |||
| b8b4c75c39 | |||
| d31122325b | |||
| bc7491ebde | |||
| 3e3eb858e5 | |||
| 55b09cf8b5 | |||
| 15316700a9 | |||
| be879dd88e | |||
| 8c19948f3b | |||
| 4106dec47e | |||
| 7c7b6330ed | |||
| 72c0326c2e | |||
| c1bf69de94 | |||
| 8935e432a2 | |||
| 95cb15d18e | |||
| d1c2a26b2b | |||
| eedb72cac5 | |||
| ae81e14bed | |||
| 1dab5cbb5b | |||
| a10635241e | |||
| fd8ebe93b8 | |||
| 45a2783186 |
@@ -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
|
||||
}
|
||||
|
||||
@@ -242,6 +242,11 @@ sub execute_dcp
|
||||
\@targets_waiting, \%targets_active
|
||||
);
|
||||
}
|
||||
if (scalar(@targets_failed) > 0)
|
||||
{
|
||||
#$::DCP_NODES_FAILED = join ",", @targets_failed;
|
||||
@::DCP_NODES_FAILED = @targets_failed;
|
||||
}
|
||||
|
||||
return (scalar(@targets_failed) + scalar(keys(%unresolved_targets)));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
#####################################
|
||||
|
||||
@@ -287,15 +287,21 @@ sub deconfig {
|
||||
my $Location_code;
|
||||
my $RID;
|
||||
my $TYPE;
|
||||
if(ref($node->{GARDRECORD}) ne "ARRAY") {
|
||||
my $dres;
|
||||
if (ref($node->{GARDRECORD}) eq "ARRAY") {
|
||||
$dres = $node->{GARDRECORD};
|
||||
} elsif (ref($node->{GARDRECORD}) eq "HASH") {
|
||||
push @$dres, $node->{GARDRECORD};
|
||||
} else {
|
||||
push @result,[$name,"NO Deconfigured resources", 0];
|
||||
return( \@result );
|
||||
}
|
||||
push @result,[$name,"Deconfigured resources", 0];
|
||||
push @result,[$name,"Location_code RID Call_Out_Method Call_Out_Hardware_State TYPE", 0];
|
||||
push @result,[$name,"$node->{Location_code} $node->{RID}", 0];
|
||||
foreach my $unit(@{$node->{GARDRECORD}}) {
|
||||
|
||||
#foreach my $unit(@{$node->{GARDRECORD}}) {
|
||||
foreach my $unit(@$dres) {
|
||||
while (my ($key, $unit3) = each(%$unit) ) {
|
||||
|
||||
if($key eq "GARDUNIT") {
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,6 +848,9 @@ site => {
|
||||
" match the path in the installdir attribute.\n\n".
|
||||
" ipmidispatch: Whether or not to send ipmi hw control operations to the service\n".
|
||||
" node of the target compute nodes. Default is 'y'.\n\n".
|
||||
" hwctrldispatch: Whether or not to send hw control operations to the service\n".
|
||||
" node of the target nodes. Default is 'y'.(At present, this attribute\n".
|
||||
" only be used for IBM Flex System)\n\n".
|
||||
" ipmimaxp: The max # of processes for ipmi hw ctrl. The default is 64. Currently,\n".
|
||||
" this is only used for HP hw control.\n\n".
|
||||
" ipmiretries: The # of retries to use when communicating with BMCs. Default is 3.\n\n".
|
||||
|
||||
+14
-3
@@ -299,7 +299,11 @@ sub handle_dbc_request {
|
||||
$opentables{$tablename}->{$autocommit} = xCAT::Table->new(@args);
|
||||
}
|
||||
if ($opentables{$tablename}->{$autocommit}) {
|
||||
return 1;
|
||||
if ($opentables{$tablename}->{$autocommit^1}) {
|
||||
$opentables{$tablename}->{$autocommit}->{cachepeer}=$opentables{$tablename}->{$autocommit^1};
|
||||
$opentables{$tablename}->{$autocommit^1}->{cachepeer}=$opentables{$tablename}->{$autocommit};
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -312,6 +316,10 @@ sub handle_dbc_request {
|
||||
unless ($opentables{$tablename}->{$autocommit}) {
|
||||
return undef;
|
||||
}
|
||||
if ($opentables{$tablename}->{$autocommit^1}) {
|
||||
$opentables{$tablename}->{$autocommit}->{cachepeer}=$opentables{$tablename}->{$autocommit^1};
|
||||
$opentables{$tablename}->{$autocommit^1}->{cachepeer}=$opentables{$tablename}->{$autocommit};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($functionname eq 'getAllAttribs') {
|
||||
@@ -2096,6 +2104,7 @@ sub getNodesAttribs {
|
||||
|
||||
sub _refresh_cache { #if cache exists, force a rebuild, leaving reference counts alone
|
||||
my $self = shift; #dbworker check not currently required
|
||||
if ($self->{cachepeer}->{_cachestamp}) { $self->{cachepeer}->{_cachestamp}=0; }
|
||||
if ($self->{_use_cache}) { #only do things if cache is set up
|
||||
$self->_build_cache(1); #for now, rebuild the whole thing.
|
||||
#in the future, a faster cache update may be possible
|
||||
@@ -2305,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} =~ /^\|.*\|.*\|$/)
|
||||
{
|
||||
@@ -3243,6 +3253,7 @@ sub delEntries
|
||||
$stmt->execute(@stargs);
|
||||
$stmt->finish;
|
||||
|
||||
$self->_refresh_cache(); #cache is invalid, refresh
|
||||
#notify the interested parties
|
||||
if ($notif == 1)
|
||||
{
|
||||
|
||||
+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]
|
||||
|
||||
+168
-4
@@ -1070,16 +1070,18 @@ sub runcmd
|
||||
my $errout;
|
||||
open (PIPE, "$cmd |");
|
||||
while (<PIPE>) {
|
||||
push @$outref, $_;
|
||||
chomp; # get rid of the newline, because the client will add one
|
||||
if ($::CALLBACK){
|
||||
$rsp->{data}->[0] = $_;
|
||||
$::CALLBACK->($rsp);
|
||||
} else {
|
||||
xCAT::MsgUtils->message("D", "$_");
|
||||
}
|
||||
$output .= $_;
|
||||
#$output .= $_;
|
||||
}
|
||||
# store the return string
|
||||
push @$outref,$output;
|
||||
#push @$outref,$output;
|
||||
}
|
||||
|
||||
# now if not streaming process errors
|
||||
@@ -2382,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
|
||||
}
|
||||
@@ -4047,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};
|
||||
}
|
||||
@@ -6437,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",
|
||||
|
||||
+105
-12
@@ -310,25 +310,19 @@ sub isZvmNode {
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# zVM guest ID
|
||||
my $id;
|
||||
|
||||
# Look in 'zvm' table
|
||||
my $tab = xCAT::Table->new( 'zvm', -create => 1, -autocommit => 0 );
|
||||
|
||||
my @results = $tab->getAllAttribsWhere( "node like '%" . $node . "%'", 'userid' );
|
||||
foreach (@results) {
|
||||
|
||||
# Get userID
|
||||
$id = $_->{'userid'};
|
||||
|
||||
# Return 'TRUE' if given node is in the table
|
||||
if ($id) {
|
||||
return ('TRUE');
|
||||
if ($_->{'userid'}) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ('FALSE');
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
@@ -722,7 +716,7 @@ sub getUserEntryWODisk {
|
||||
return;
|
||||
}
|
||||
|
||||
my $out = `ssh $hcp "$dir/getuserentry $userId" | grep -v "MDISK"`;
|
||||
my $out = `ssh $hcp "$dir/smcli Image_Query_DM -T $userId" | sed '\$d' | grep -v "MDISK"`;
|
||||
|
||||
# Create a file to save output
|
||||
open( DIRENTRY, ">$file" );
|
||||
@@ -1111,12 +1105,12 @@ sub getUserProfile {
|
||||
if ( $curTime > $fileTime + $interval ) {
|
||||
|
||||
# Get user profiles and save it in a file
|
||||
$out = `ssh $hcp "$hcpDir/getuserprofile $profile > $file"`;
|
||||
$out = `ssh $hcp "$hcpDir/smcli Profile_Query_DM -T $profile > $file"`;
|
||||
}
|
||||
} else {
|
||||
|
||||
# Get user profiles and save it in a file
|
||||
$out = `ssh $hcp "$hcpDir/getuserprofile $profile > $file"`;
|
||||
$out = `ssh $hcp "$hcpDir/smcli Profile_Query_DM -T $profile > $file"`;
|
||||
}
|
||||
|
||||
# Return the file contents
|
||||
@@ -1188,4 +1182,103 @@ sub getOsVersion {
|
||||
}
|
||||
|
||||
return xCAT::zvmUtils->trimStr($os);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getZfcpInfo
|
||||
|
||||
Description : Get the zFCP device info
|
||||
Arguments : Node
|
||||
Returns : zFCP device info
|
||||
Example : my $info = xCAT::zvmUtils->getZfcpInfo($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getZfcpInfo {
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Get zFCP device info
|
||||
my $info = `ssh -o ConnectTimeout=2 $node "lszfcp -D"`;
|
||||
my @zfcp = split("\n", $info);
|
||||
if (!$info || $info =~ m/No zfcp support/i) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Get SCSI device and their attributes
|
||||
my $scsi = `ssh -o ConnectTimeout=2 $node "lsscsi"`;
|
||||
$info = "";
|
||||
|
||||
my @args;
|
||||
my $tmp;
|
||||
my $id;
|
||||
my $device;
|
||||
my $wwpn;
|
||||
my $lun;
|
||||
my $size;
|
||||
|
||||
foreach (@zfcp) {
|
||||
@args = split(" ", $_);
|
||||
$id = $args[1];
|
||||
@args = split("/", $args[0]);
|
||||
|
||||
$device = $args[0];
|
||||
$wwpn = $args[1];
|
||||
$lun = $args[2];
|
||||
|
||||
# Make sure WWPN and LUN do not have 0x prefix
|
||||
$wwpn = xCAT::zvmUtils->replaceStr($wwpn, "0x", "");
|
||||
$lun = xCAT::zvmUtils->replaceStr($lun, "0x", "");
|
||||
|
||||
# Find the device name
|
||||
$tmp = `echo "$scsi" | egrep -i $id`;
|
||||
$tmp = substr($tmp, index($tmp, "/dev/"));
|
||||
chomp($tmp);
|
||||
|
||||
# Find the size in MiB
|
||||
$size = `ssh -o ConnectTimeout=2 $node "sg_readcap $tmp" | egrep -i "Device size:"`;
|
||||
$size =~ s/Device size: //g;
|
||||
@args = split(",", $size);
|
||||
$size = xCAT::zvmUtils->trimStr($args[1]);
|
||||
|
||||
$info .= "Device: $device WWPN: 0x$wwpn LUN: 0x$lun Size: $size\n";
|
||||
}
|
||||
|
||||
$info = xCAT::zvmUtils->tabStr($info);
|
||||
return ($info);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 isHypervisor
|
||||
|
||||
Description : Determines if a given node is in the 'hypervisor' table
|
||||
Arguments : Node
|
||||
Returns : 1 Node exists
|
||||
0 Node does not exists
|
||||
Example : my $out = xCAT::zvmUtils->isHypervisor($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub isHypervisor {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Look in 'zvm' table
|
||||
my $tab = xCAT::Table->new( "hypervisor", -create => 1, -autocommit => 0 );
|
||||
|
||||
my @results = $tab->getAllAttribsWhere( "node like '%" . $node . "%'", 'type' );
|
||||
foreach (@results) {
|
||||
|
||||
# Return 'TRUE' if given node is in the table
|
||||
if ($_->{"type"} eq "zvm") {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ I:ppe.loc.license
|
||||
#I:ppedev.hpct
|
||||
|
||||
# LAPI
|
||||
I:rsct.lapi
|
||||
#I:rsct.lapi
|
||||
#I:rsct.sci
|
||||
|
||||
# AIX bundle file for ESSL and PESSL packages
|
||||
|
||||
@@ -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,9 @@
|
||||
# AIX bundle package list for PE
|
||||
|
||||
# POE
|
||||
#I:ppe.man
|
||||
I:ppe.rte
|
||||
I:ppe.loc.license
|
||||
|
||||
# PE HPC toolkit, needed on login node
|
||||
#I:ppedev.hpct
|
||||
@@ -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
|
||||
|
||||
@@ -9,5 +9,5 @@ I:ppe.loc.license
|
||||
#I:ppedev.hpct
|
||||
|
||||
# LAPI
|
||||
I:rsct.lapi
|
||||
#I:rsct.lapi
|
||||
#I:rsct.sci
|
||||
|
||||
@@ -111,6 +111,10 @@ if [ "$OS" != "AIX" ]; then
|
||||
chmod 400 $installroot/root/.ckpt.key
|
||||
fi
|
||||
|
||||
# Ensure that the /etc/security/privcmds file has a complte set of entries.
|
||||
if [ "$OS" == "AIX" ]; then
|
||||
/usr/sbin/trustchk -ry ALL >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# BSR configuration, uncomment the following lines to enable BSR configuration on Power Linux cluter.
|
||||
#if [ "$OS" != "AIX" ]; then
|
||||
|
||||
@@ -347,7 +347,6 @@ legend {
|
||||
|
||||
.actionBar {
|
||||
display: inline-table;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.actionBar div {
|
||||
|
||||
@@ -178,7 +178,7 @@ function loadUserTable(data) {
|
||||
});
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var actionBar = $('<div class="actionBar"></div>').css("width", "400px");
|
||||
|
||||
var createLnk = $('<a>Create</a>');
|
||||
createLnk.click(function() {
|
||||
@@ -687,7 +687,7 @@ function configImagePanel(data) {
|
||||
});
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var actionBar = $('<div class="actionBar"></div>').css("width", "400px");
|
||||
|
||||
// Create a profile
|
||||
var createLnk = $('<a>Create</a>');
|
||||
@@ -1193,7 +1193,7 @@ function configGroupPanel(data) {
|
||||
});
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var actionBar = $('<div class="actionBar"></div>').css("width", "400px");
|
||||
|
||||
// Create a group
|
||||
var createLnk = $('<a>Create</a>');
|
||||
|
||||
+442
-242
@@ -200,16 +200,16 @@ zvmPlugin.prototype.loadServiceInventory = function(data) {
|
||||
|
||||
// Do not continue if error is found
|
||||
if (data.rsp[0].indexOf('Error') > -1) {
|
||||
var warn = createWarnBar(data.rsp[0]);
|
||||
$('#' + tabId).append(warn);
|
||||
return;
|
||||
var warn = createWarnBar(data.rsp[0]);
|
||||
$('#' + tabId).append(warn);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get node inventory
|
||||
var inv = data.rsp[0].split(node + ':');
|
||||
|
||||
// Create array of property keys
|
||||
var keys = new Array('userId', 'host', 'os', 'arch', 'hcp', 'priv', 'memory', 'proc', 'disk', 'nic');
|
||||
var keys = new Array('userId', 'host', 'os', 'arch', 'hcp', 'priv', 'memory', 'proc', 'disk', 'zfcp', 'nic');
|
||||
|
||||
// Create hash table for property names
|
||||
var attrNames = new Object();
|
||||
@@ -222,6 +222,7 @@ zvmPlugin.prototype.loadServiceInventory = function(data) {
|
||||
attrNames['memory'] = 'Total Memory:';
|
||||
attrNames['proc'] = 'Processors:';
|
||||
attrNames['disk'] = 'Disks:';
|
||||
attrNames['zfcp'] = 'zFCP:';
|
||||
attrNames['nic'] = 'NICs:';
|
||||
|
||||
// Create hash table for node attributes
|
||||
@@ -269,7 +270,10 @@ zvmPlugin.prototype.loadServiceInventory = function(data) {
|
||||
*/
|
||||
fieldSet = $('<fieldset id="' + node + '_monitor"></fieldset>');
|
||||
legend = $('<legend>Monitoring [<a style="font-weight: normal; color: blue; text-decoration: none;">Refresh</a>]</legend>');
|
||||
fieldSet.append(legend);
|
||||
fieldSet.append(legend);
|
||||
// var info = createInfoBar('No data available');
|
||||
// fieldSet.append(info.css('width', '300px'));
|
||||
|
||||
getMonitorMetrics(node);
|
||||
|
||||
// Refresh monitoring charts on-click
|
||||
@@ -457,6 +461,51 @@ zvmPlugin.prototype.loadServiceInventory = function(data) {
|
||||
dasdTable.append(dasdBody);
|
||||
item.append(dasdTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* zFCP section
|
||||
*/
|
||||
else if (keys[k] == 'zfcp') {
|
||||
// Create a label - Property name
|
||||
label = $('<label>' + attrNames[keys[k]].replace(':', '') + '</label>');
|
||||
item.append(label);
|
||||
|
||||
// Create a table to hold NIC data
|
||||
var zfcpTable = $('<table></table>');
|
||||
var zfcpBody = $('<tbody></tbody>');
|
||||
|
||||
// Table columns - Virtual device, Adapter Type, Port Name, # of Devices, MAC Address, and LAN Name
|
||||
var zfcpTabRow = $('<thead class="ui-widget-header"> <th>Virtual Device #</th> <th>Port Name</th> <th>Unit Number</th> <th>Size</th></thead>');
|
||||
zfcpTable.append(zfcpTabRow);
|
||||
var zfcpVDev, zfcpPortName, zfcpLun, zfcpSize;
|
||||
|
||||
// Loop through each zFCP device
|
||||
if (attrs[keys[k]]) {
|
||||
for (l = 0; l < attrs[keys[k]].length; l++) {
|
||||
if (attrs[keys[k]][l]) {
|
||||
args = attrs[keys[k]][l].split(' ');
|
||||
|
||||
// Get zFCP virtual device, port name (WWPN), unit number (LUN), and size
|
||||
zfcpVDev = $('<td>' + args[1].replace('0.0.', '') + '</td>');
|
||||
zfcpPortName = $('<td>' + args[4] + '</td>');
|
||||
zfcpLun = $('<td>' + args[7] + '</td>');
|
||||
zfcpSize = $('<td>' + args[args.length - 2] + ' ' + args[args.length - 1] + '</td>');
|
||||
|
||||
// Create a new row for each zFCP device
|
||||
zfcpTabRow = $('<tr></tr>');
|
||||
zfcpTabRow.append(zfcpVDev);
|
||||
zfcpTabRow.append(zfcpPortName);
|
||||
zfcpTabRow.append(zfcpLun);
|
||||
zfcpTabRow.append(zfcpSize);
|
||||
|
||||
zfcpBody.append(zfcpTabRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zfcpTable.append(zfcpBody);
|
||||
item.append(zfcpTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* NIC section
|
||||
@@ -671,8 +720,8 @@ zvmPlugin.prototype.loadClonePage = function(node) {
|
||||
if (!inputs.eq(i).val()
|
||||
&& inputs.eq(i).attr('name') != 'diskPw'
|
||||
&& inputs.eq(i).attr('name') != 'diskPool'
|
||||
&& inputs.eq(i).attr('name') != 'ip'
|
||||
&& inputs.eq(i).attr('name') != 'hostname') {
|
||||
&& inputs.eq(i).attr('name') != 'ip'
|
||||
&& inputs.eq(i).attr('name') != 'hostname') {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
@@ -915,10 +964,10 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
// Check for error
|
||||
var error = false;
|
||||
if (data.rsp[0].indexOf('Error') > -1) {
|
||||
error = true;
|
||||
|
||||
var warn = createWarnBar(data.rsp[0]);
|
||||
$('#' + tabId).append(warn);
|
||||
error = true;
|
||||
|
||||
var warn = createWarnBar(data.rsp[0]);
|
||||
$('#' + tabId).append(warn);
|
||||
}
|
||||
|
||||
// Get node inventory
|
||||
@@ -934,7 +983,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
statBar.hide();
|
||||
|
||||
// Create array of property keys
|
||||
var keys = new Array('userId', 'host', 'os', 'arch', 'hcp', 'priv', 'memory', 'proc', 'disk', 'nic');
|
||||
var keys = new Array('userId', 'host', 'os', 'arch', 'hcp', 'priv', 'memory', 'proc', 'disk', 'zfcp', 'nic');
|
||||
|
||||
// Create hash table for property names
|
||||
var attrNames = new Object();
|
||||
@@ -947,12 +996,13 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
attrNames['memory'] = 'Total Memory:';
|
||||
attrNames['proc'] = 'Processors:';
|
||||
attrNames['disk'] = 'Disks:';
|
||||
attrNames['zfcp'] = 'zFCP:';
|
||||
attrNames['nic'] = 'NICs:';
|
||||
|
||||
// Create hash table for node attributes
|
||||
var attrs;
|
||||
if (!error) {
|
||||
attrs = getAttrs(keys, attrNames, inv);
|
||||
attrs = getAttrs(keys, attrNames, inv);
|
||||
}
|
||||
|
||||
// Create division to hold user entry
|
||||
@@ -1013,7 +1063,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
|
||||
// Do not continue if error
|
||||
if (error) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1033,7 +1083,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
// Create a label - Property name
|
||||
label = $('<label>' + attrNames[keys[k]] + '</label>');
|
||||
item.append(label);
|
||||
|
||||
|
||||
for (var l = 0; l < attrs[keys[k]].length; l++) {
|
||||
// Create a input - Property value(s)
|
||||
// Handle each property uniquely
|
||||
@@ -1073,7 +1123,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
label = $('<label>' + attrNames[keys[k]].replace(':', '') + '</label>');
|
||||
item.append(label);
|
||||
|
||||
// Loop through each line
|
||||
// Loop through each line
|
||||
for (l = 0; l < attrs[keys[k]].length; l++) {
|
||||
// Create a new list item for each line
|
||||
hwItem = $('<li></li>');
|
||||
@@ -1143,6 +1193,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
// Open dialog to confirm
|
||||
var confirmDialog = $('<div><p>Are you sure you want to remove this processor?</p></div>');
|
||||
confirmDialog.dialog({
|
||||
title: "Confirm",
|
||||
modal: true,
|
||||
width: 300,
|
||||
buttons: {
|
||||
@@ -1249,6 +1300,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
// Open dialog to confirm
|
||||
var confirmDialog = $('<div><p>Are you sure you want to remove this disk?</p></div>');
|
||||
confirmDialog.dialog({
|
||||
title: "Confirm",
|
||||
modal: true,
|
||||
width: 300,
|
||||
buttons: {
|
||||
@@ -1315,6 +1367,100 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
|
||||
item.append(dasdTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* zFCP section
|
||||
*/
|
||||
else if (keys[k] == 'zfcp') {
|
||||
// Create a label - Property name
|
||||
label = $('<label>' + attrNames[keys[k]].replace(':', '') + '</label>');
|
||||
item.append(label);
|
||||
|
||||
// Create a table to hold NIC data
|
||||
var zfcpTable = $('<table></table>');
|
||||
var zfcpBody = $('<tbody></tbody>');
|
||||
var zfcpFooter = $('<tfoot></tfoot>');
|
||||
|
||||
/**
|
||||
* Remove zFCP
|
||||
*/
|
||||
contextMenu = [ {
|
||||
'Remove' : function(menuItem, menu) {
|
||||
var addr = $(this).text();
|
||||
var portName = $(this).parents('tr').find('td:eq(1)').text();
|
||||
var unitNo = $(this).parents('tr').find('td:eq(2)').text();
|
||||
|
||||
// Open dialog to confirm
|
||||
var confirmDialog = $('<div><p>Are you sure you want to remove this zFCP device?</p></div>');
|
||||
confirmDialog.dialog({
|
||||
title: "Confirm",
|
||||
modal: true,
|
||||
width: 300,
|
||||
buttons: {
|
||||
"Ok": function(){
|
||||
removeZfcp(node, addr, portName, unitNo);
|
||||
$(this).dialog("close");
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} ];
|
||||
|
||||
// Table columns - Virtual device, Adapter Type, Port Name, # of Devices, MAC Address, and LAN Name
|
||||
var zfcpTabRow = $('<thead class="ui-widget-header"> <th>Virtual Device #</th> <th>Port Name</th> <th>Unit Number</th> <th>Size</th></thead>');
|
||||
zfcpTable.append(zfcpTabRow);
|
||||
var zfcpVDev, zfcpPortName, zfcpLun, zfcpSize;
|
||||
|
||||
// Loop through each zFCP device
|
||||
if (attrs[keys[k]]) {
|
||||
for (l = 0; l < attrs[keys[k]].length; l++) {
|
||||
if (attrs[keys[k]][l]) {
|
||||
args = attrs[keys[k]][l].split(' ');
|
||||
|
||||
// Get zFCP virtual device, port name (WWPN), unit number (LUN), and size
|
||||
zfcpVDev = $('<td></td>');
|
||||
zfcpLink = $('<a>' + args[1].replace('0.0.', '') + '</a>');
|
||||
|
||||
// Append context menu to link
|
||||
zfcpLink.contextMenu(contextMenu, {
|
||||
theme : 'vista'
|
||||
});
|
||||
zfcpVDev.append(zfcpLink);
|
||||
|
||||
zfcpPortName = $('<td>' + args[4] + '</td>');
|
||||
zfcpLun = $('<td>' + args[7] + '</td>');
|
||||
zfcpSize = $('<td>' + args[args.length - 2] + ' ' + args[args.length - 1] + '</td>');
|
||||
|
||||
// Create a new row for each zFCP device
|
||||
zfcpTabRow = $('<tr></tr>');
|
||||
zfcpTabRow.append(zfcpVDev);
|
||||
zfcpTabRow.append(zfcpPortName);
|
||||
zfcpTabRow.append(zfcpLun);
|
||||
zfcpTabRow.append(zfcpSize);
|
||||
|
||||
zfcpBody.append(zfcpTabRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zfcpTable.append(zfcpBody);
|
||||
|
||||
/**
|
||||
* Add zFCP device
|
||||
*/
|
||||
var addZfcpLink = $('<a>Add zFCP</a>');
|
||||
addZfcpLink.bind('click', function(event) {
|
||||
var hcp = attrs['hcp'][0].split('.');
|
||||
openAddZfcpDialog(node, hcp[0]);
|
||||
});
|
||||
zfcpFooter.append(addZfcpLink);
|
||||
zfcpTable.append(zfcpFooter);
|
||||
|
||||
item.append(zfcpTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* NIC section
|
||||
@@ -1339,6 +1485,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
// Open dialog to confirm
|
||||
var confirmDialog = $('<div><p>Are you sure you want to remove this NIC?</p></div>');
|
||||
confirmDialog.dialog({
|
||||
title: "Confirm",
|
||||
modal: true,
|
||||
width: 300,
|
||||
buttons: {
|
||||
@@ -1381,7 +1528,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
args = attrs[keys[k]][l + 1].split(' ');
|
||||
nicLanName = $('<td>' + args[args.length - 2] + ' ' + args[args.length - 1] + '</td>');
|
||||
|
||||
// Create a new row for each DASD
|
||||
// Create a new row for each NIC
|
||||
nicTabRow = $('<tr></tr>');
|
||||
nicTabRow.append(nicVDev);
|
||||
nicTabRow.append(nicType);
|
||||
@@ -1545,12 +1692,40 @@ zvmPlugin.prototype.addNode = function() {
|
||||
var addNodeForm = $('<div id="addZvm" class="form"></div>');
|
||||
var info = createInfoBar('Add a z/VM node range');
|
||||
addNodeForm.append(info);
|
||||
addNodeForm.append('<div><label>Node range:</label><input type="text" name="node"/></div>');
|
||||
addNodeForm.append('<div><label>User ID range:</label><input type="text" name="userId"/></div>');
|
||||
addNodeForm.append('<div><label>IP address range (optional):</label><input name="ip" type="text"></div>');
|
||||
addNodeForm.append('<div><label>Hostname range (optional):</label><input name="hostname" type="text"></div>');
|
||||
addNodeForm.append('<div><label>Hardware control point:</label><input type="text" name="hcp"/></div>');
|
||||
addNodeForm.append('<div><label>Groups:</label><input type="text" name="groups"/></div>');
|
||||
|
||||
// Create provision type drop down
|
||||
var type = $('<div></div>');
|
||||
var typeLabel = $('<label>Type:</label>');
|
||||
var typeSelect = $('<select type="text" name="type"></select>');
|
||||
typeSelect.append('<option value="vm" selected="selected">VM</option>');
|
||||
typeSelect.append('<option value="host">Host</option>');
|
||||
type.append(typeLabel);
|
||||
type.append(typeSelect);
|
||||
addNodeForm.append(type);
|
||||
|
||||
addNodeForm.append('<div><label>Node range *:</label><input type="text" name="node"/></div>');
|
||||
addNodeForm.append('<div><label>User ID range *:</label><input type="text" name="userId"/></div>');
|
||||
addNodeForm.append('<div><label>Hardware control point *:</label><input type="text" name="hcp"/></div>');
|
||||
addNodeForm.append('<div><label>Groups *:</label><input type="text" name="groups"/></div>');
|
||||
addNodeForm.append('<div><label>Operating system *:</label><input type="text" name="os"/></div>');
|
||||
addNodeForm.append('<div><label>IP address range:</label><input name="ip" type="text"></div>');
|
||||
addNodeForm.append('<div><label>Hostname range:</label><input name="hostname" type="text"></div>');
|
||||
addNodeForm.append('<div><label>* required</label></div>');
|
||||
|
||||
// OS field only required for hosts
|
||||
addNodeForm.find('input[name=os]').parent().hide();
|
||||
|
||||
// Toggle user Id on select
|
||||
typeSelect.change(function(){
|
||||
var selected = $(this).val();
|
||||
if (selected == 'host') {
|
||||
addNodeForm.find('input[name=userId]').parent().toggle();
|
||||
addNodeForm.find('input[name=os]').parent().toggle();
|
||||
} else {
|
||||
addNodeForm.find('input[name=userId]').parent().toggle();
|
||||
addNodeForm.find('input[name=os]').parent().toggle();
|
||||
}
|
||||
});
|
||||
|
||||
// Open form as a dialog
|
||||
addNodeForm.dialog({
|
||||
@@ -1563,213 +1738,166 @@ zvmPlugin.prototype.addNode = function() {
|
||||
$(this).find('.ui-state-error').remove();
|
||||
|
||||
// Get inputs
|
||||
var type = $(this).find('select[name=type]').val();
|
||||
var nodeRange = $(this).find('input[name=node]').val();
|
||||
var ipRange = $(this).find('input[name=ip]').val();
|
||||
var hostnameRange = $(this).find('input[name=hostname]').val();
|
||||
var userIdRange = $(this).find('input[name=userId]').val();
|
||||
var userIdRange = $(this).find('input[name=userId]').val();
|
||||
var os = $(this).find('input[name=os]').val();
|
||||
var group = $(this).find('input[name=groups]').val();
|
||||
var hcp = $(this).find('input[name=hcp]').val();
|
||||
|
||||
// Show warning message if inputs are not complete
|
||||
if (!nodeRange || !userIdRange || !group || !hcp) {
|
||||
var warn = createWarnBar('Please provide a value for each missing field!');
|
||||
warn.prependTo($(this));
|
||||
|
||||
// Check required fields
|
||||
if (type == 'host') {
|
||||
if (!nodeRange || !os || !group || !hcp) {
|
||||
var warn = createWarnBar('Please provide a value for each missing field!');
|
||||
warn.prependTo($(this));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Check node range and user ID range
|
||||
// Range can be given as gpok10-gpok20, gpok[10-20], or gpok10+10
|
||||
var errMsg = '';
|
||||
var ready = true;
|
||||
if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) {
|
||||
if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) {
|
||||
errMsg = errMsg + 'A user ID range and node range needs to be given. ';
|
||||
if (!nodeRange || !userIdRange || !group || !hcp) {
|
||||
var warn = createWarnBar('Please provide a value for each missing field!');
|
||||
warn.prependTo($(this));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check node range and user ID range
|
||||
// Range can be given as gpok10-gpok20, gpok[10-20], or gpok10+10
|
||||
var errMsg = '';
|
||||
var ready = true;
|
||||
if (nodeRange.indexOf('-') > -1 || userIdRange.indexOf('-') > -1) {
|
||||
if (nodeRange.indexOf('-') < 0 || userIdRange.indexOf('-') < 0) {
|
||||
errMsg = errMsg + 'A user ID range and node range needs to be given. ';
|
||||
ready = false;
|
||||
} else {
|
||||
var tmp = nodeRange.split('-');
|
||||
|
||||
// Get starting index
|
||||
var nodeStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var nodeEnd = parseInt(tmp[1].match(/\d+/));
|
||||
|
||||
tmp = userIdRange.split('-');
|
||||
|
||||
// Get starting index
|
||||
var userIdStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var userIdEnd = parseInt(tmp[1].match(/\d+/));
|
||||
|
||||
var ipStart = "", ipEnd = "";
|
||||
if (ipRange != "" && ipRange != null) {
|
||||
tmp = ipRange.split('-');
|
||||
|
||||
// Get starting IP address
|
||||
ipStart = tmp[0].substring(tmp[0].lastIndexOf(".") + 1);
|
||||
// Get ending IP address
|
||||
ipEnd = tmp[1].substring(tmp[1].lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
var hostnameStart = "", hostnameEnd = "";
|
||||
if (hostnameRange != "" && hostnameRange != null) {
|
||||
tmp = hostnameRange.split('-');
|
||||
|
||||
// Get starting hostname
|
||||
hostnameStart = parseInt(tmp[0].substring(0, tmp[0].indexOf(".")).match(/\d+/));
|
||||
// Get ending hostname
|
||||
hostnameEnd = parseInt(tmp[1].substring(0, tmp[1].indexOf(".")).match(/\d+/));
|
||||
}
|
||||
|
||||
// If starting and ending index do not match
|
||||
if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) {
|
||||
errMsg = errMsg + 'The node range and user ID range does not match. ';
|
||||
ready = false;
|
||||
}
|
||||
|
||||
// If an IP address range is given and the starting and ending index do not match
|
||||
if (ipRange != "" && ipRange != null && (!(nodeStart == ipStart) || !(nodeEnd == ipEnd))) {
|
||||
errMsg = errMsg + 'The node range and IP address range does not match. ';
|
||||
ready = false;
|
||||
}
|
||||
|
||||
// If a hostname range is given and the starting and ending index do not match
|
||||
if (hostnameRange != "" && hostnameRange != null && (!(nodeStart == hostnameStart) || !(nodeEnd == hostnameEnd))) {
|
||||
errMsg = errMsg + 'The node range and hostname range does not match. ';
|
||||
ready = false;
|
||||
} else {
|
||||
var tmp = nodeRange.split('-');
|
||||
|
||||
// Get starting index
|
||||
var nodeStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var nodeEnd = parseInt(tmp[1].match(/\d+/));
|
||||
|
||||
tmp = userIdRange.split('-');
|
||||
|
||||
// Get starting index
|
||||
var userIdStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var userIdEnd = parseInt(tmp[1].match(/\d+/));
|
||||
|
||||
var ipStart = "", ipEnd = "";
|
||||
if (ipRange) {
|
||||
tmp = ipRange.split('-');
|
||||
|
||||
// Get starting IP address
|
||||
ipStart = tmp[0].substring(tmp[0].lastIndexOf(".") + 1);
|
||||
// Get ending IP address
|
||||
ipEnd = tmp[1].substring(tmp[1].lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
var hostnameStart = "", hostnameEnd = "";
|
||||
if (hostnameRange) {
|
||||
tmp = hostnameRange.split('-');
|
||||
|
||||
// Get starting hostname
|
||||
hostnameStart = parseInt(tmp[0].substring(0, tmp[0].indexOf(".")).match(/\d+/));
|
||||
// Get ending hostname
|
||||
hostnameEnd = parseInt(tmp[1].substring(0, tmp[1].indexOf(".")).match(/\d+/));
|
||||
}
|
||||
|
||||
// If starting and ending index do not match
|
||||
if (!(nodeStart == userIdStart) || !(nodeEnd == userIdEnd)) {
|
||||
errMsg = errMsg + 'The node range and user ID range does not match. ';
|
||||
ready = false;
|
||||
}
|
||||
|
||||
// If an IP address range is given and the starting and ending index do not match
|
||||
if (ipRange && !(nodeStart == ipStart) || !(nodeEnd == ipEnd)) {
|
||||
errMsg = errMsg + 'The node range and IP address range does not match. ';
|
||||
ready = false;
|
||||
}
|
||||
|
||||
// If a hostname range is given and the starting and ending index do not match
|
||||
if (hostnameRange && !(nodeStart == hostnameStart) || !(nodeEnd == hostnameEnd)) {
|
||||
errMsg = errMsg + 'The node range and hostname range does not match. ';
|
||||
ready = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there are no errors
|
||||
if (ready) {
|
||||
$('#addZvm').append(createLoader());
|
||||
}
|
||||
|
||||
// If there are no errors
|
||||
if (ready) {
|
||||
$('#addZvm').append(createLoader());
|
||||
|
||||
// Change dialog buttons
|
||||
$('#addZvm').dialog('option', 'buttons', {
|
||||
'Close':function(){
|
||||
$('#addZvm').dialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
// If a node range is given
|
||||
if (nodeRange.indexOf('-') > -1 && userIdRange.indexOf('-') > -1) {
|
||||
var tmp = nodeRange.split('-');
|
||||
|
||||
// Get node base name
|
||||
var nodeBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
// Get starting index
|
||||
var nodeStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var nodeEnd = parseInt(tmp[1].match(/\d+/));
|
||||
|
||||
tmp = userIdRange.split('-');
|
||||
|
||||
// Get user ID base name
|
||||
var userIdBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
|
||||
// Change dialog buttons
|
||||
$('#addZvm').dialog('option', 'buttons', {
|
||||
'Close':function(){
|
||||
$('#addZvm').dialog('close');
|
||||
}
|
||||
});
|
||||
var ipBase = "";
|
||||
if (ipRange != "" && ipRange != null) {
|
||||
tmp = ipRange.split('-');
|
||||
|
||||
// Get network base
|
||||
ipBase = tmp[0].substring(0, tmp[0].lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
// If a node range is given
|
||||
if (nodeRange.indexOf('-') > -1 && userIdRange.indexOf('-') > -1) {
|
||||
var tmp = nodeRange.split('-');
|
||||
|
||||
// Get node base name
|
||||
var nodeBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
// Get starting index
|
||||
var nodeStart = parseInt(tmp[0].match(/\d+/));
|
||||
// Get ending index
|
||||
var nodeEnd = parseInt(tmp[1].match(/\d+/));
|
||||
|
||||
tmp = userIdRange.split('-');
|
||||
|
||||
// Get user ID base name
|
||||
var userIdBase = tmp[0].match(/[a-zA-Z]+/);
|
||||
var domain = "";
|
||||
if (hostnameRange != "" && hostnameRange != null) {
|
||||
tmp = hostnameRange.split('-');
|
||||
|
||||
// Get domain name
|
||||
domain = tmp[0].substring(tmp[0].indexOf("."));
|
||||
}
|
||||
|
||||
// Loop through each node in the node range
|
||||
for ( var i = nodeStart; i <= nodeEnd; i++) {
|
||||
var node = nodeBase + i.toString();
|
||||
var userId = userIdBase + i.toString();
|
||||
var inst = i + '/' + nodeEnd;
|
||||
|
||||
var args = "";
|
||||
if (type == 'host') {
|
||||
args = node + ';zvm.hcp=' + hcp
|
||||
+ ';nodehm.mgt=zvm;hypervisor.type=zvm;groups=' + group
|
||||
+ ';nodetype.os=' + os;
|
||||
} else {
|
||||
args = node + ';zvm.hcp=' + hcp
|
||||
+ ';zvm.userid=' + userId
|
||||
+ ';nodehm.mgt=zvm' + ';groups=' + group;
|
||||
}
|
||||
|
||||
var ipBase = "";
|
||||
if (ipRange) {
|
||||
tmp = ipRange.split('-');
|
||||
|
||||
// Get network base
|
||||
ipBase = tmp[0].substring(0, tmp[0].lastIndexOf(".") + 1);
|
||||
if (ipRange != "" && ipRange != null) {
|
||||
var ip = ipBase + i.toString();
|
||||
args += ';hosts.ip=' + ip;
|
||||
}
|
||||
|
||||
var domain = "";
|
||||
if (hostnameRange) {
|
||||
tmp = hostnameRange.split('-');
|
||||
|
||||
// Get domain name
|
||||
domain = tmp[0].substring(tmp[0].indexOf("."));
|
||||
if (hostnameRange != "" && hostnameRange != null) {
|
||||
var hostname = node + domain;
|
||||
args += ';hosts.hostnames=' + hostname;
|
||||
}
|
||||
|
||||
// Loop through each node in the node range
|
||||
for ( var i = nodeStart; i <= nodeEnd; i++) {
|
||||
var node = nodeBase + i.toString();
|
||||
var userId = userIdBase + i.toString();
|
||||
var inst = i + '/' + nodeEnd;
|
||||
|
||||
var args = node + ';zvm.hcp=' + hcp
|
||||
+ ';zvm.userid=' + userId
|
||||
+ ';nodehm.mgt=zvm' + ';groups=' + group;
|
||||
|
||||
if (ipRange) {
|
||||
var ip = ipBase + i.toString();
|
||||
args += ';hosts.ip=' + ip;
|
||||
}
|
||||
|
||||
if (hostnameRange) {
|
||||
var hostname = node + domain;
|
||||
args += ';hosts.hostnames=' + hostname;
|
||||
}
|
||||
|
||||
/**
|
||||
* (1) Define node
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : args,
|
||||
msg : 'cmd=addnewnode;inst=' + inst + ';noderange=' + nodeRange
|
||||
},
|
||||
|
||||
/**
|
||||
* Return function on successful AJAX call
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
success : function (data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
|
||||
// Get instance returned and node range
|
||||
var inst = args[1].replace('inst=', '');
|
||||
var nodeRange = args[2].replace('noderange=', '');
|
||||
|
||||
// If the last node was added
|
||||
var tmp = inst.split('/');
|
||||
if (tmp[0] == tmp[1]) {
|
||||
// Update /etc/hosts
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makehosts',
|
||||
tgt : '',
|
||||
args : '',
|
||||
msg : ''
|
||||
}
|
||||
});
|
||||
|
||||
// Remove loader
|
||||
$('#addZvm img').remove();
|
||||
|
||||
// If there was an error, do not continue
|
||||
if (rsp.length) {
|
||||
$('#addZvm').prepend(createWarnBar('Failed to create node definitions'));
|
||||
} else {
|
||||
$('#addZvm').prepend(createInfoBar('Node definitions created for ' + nodeRange));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var args = nodeRange + ';zvm.hcp=' + hcp
|
||||
+ ';zvm.userid=' + userIdRange
|
||||
+ ';nodehm.mgt=zvm' + ';groups=' + group;
|
||||
|
||||
if (ipRange)
|
||||
args += ';hosts.ip=' + ipRange;
|
||||
|
||||
if (hostnameRange)
|
||||
args += ';hosts.hostnames=' + hostnameRange;
|
||||
|
||||
// Only one node to add
|
||||
/**
|
||||
* (1) Define node
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@@ -1777,9 +1905,9 @@ zvmPlugin.prototype.addNode = function() {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : args,
|
||||
msg : 'cmd=addnewnode;node=' + nodeRange
|
||||
msg : 'cmd=addnewnode;inst=' + inst + ';noderange=' + nodeRange
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Return function on successful AJAX call
|
||||
*
|
||||
@@ -1791,38 +1919,110 @@ zvmPlugin.prototype.addNode = function() {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
var node = args[1].replace('node=', '');
|
||||
|
||||
// Get instance returned and node range
|
||||
var inst = args[1].replace('inst=', '');
|
||||
var nodeRange = args[2].replace('noderange=', '');
|
||||
|
||||
// Update /etc/hosts
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makehosts',
|
||||
tgt : '',
|
||||
args : '',
|
||||
msg : ''
|
||||
// If the last node was added
|
||||
var tmp = inst.split('/');
|
||||
if (tmp[0] == tmp[1]) {
|
||||
// Update /etc/hosts
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makehosts',
|
||||
tgt : '',
|
||||
args : '',
|
||||
msg : ''
|
||||
}
|
||||
});
|
||||
|
||||
// Remove loader
|
||||
$('#addZvm img').remove();
|
||||
|
||||
// If there was an error, do not continue
|
||||
if (rsp.length) {
|
||||
$('#addZvm').prepend(createWarnBar('Failed to create node definitions'));
|
||||
} else {
|
||||
$('#addZvm').prepend(createInfoBar('Node definitions created for ' + nodeRange));
|
||||
}
|
||||
});
|
||||
|
||||
// Remove loader
|
||||
$('#addZvm img').remove();
|
||||
|
||||
// If there was an error, do not continue
|
||||
if (rsp.length) {
|
||||
$('#addZvm').prepend(createWarnBar('Failed to create node definitions'));
|
||||
} else {
|
||||
$('#addZvm').prepend(createInfoBar('Node definitions created for ' + node));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar(errMsg);
|
||||
warn.prependTo($(this));
|
||||
}
|
||||
} // End of else
|
||||
} else {
|
||||
var args = "";
|
||||
if (type == 'host') {
|
||||
args = nodeRange + ';zvm.hcp=' + hcp
|
||||
+ ';nodehm.mgt=zvm;hypervisor.type=zvm;groups=' + group
|
||||
+ ';nodetype.os=' + os;
|
||||
} else {
|
||||
args = nodeRange + ';zvm.hcp=' + hcp
|
||||
+ ';zvm.userid=' + userIdRange
|
||||
+ ';nodehm.mgt=zvm' + ';groups=' + group;
|
||||
}
|
||||
|
||||
if (ipRange)
|
||||
args += ';hosts.ip=' + ipRange;
|
||||
|
||||
if (hostnameRange)
|
||||
args += ';hosts.hostnames=' + hostnameRange;
|
||||
|
||||
// Only one node to add
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : args,
|
||||
msg : 'cmd=addnewnode;node=' + nodeRange
|
||||
},
|
||||
|
||||
/**
|
||||
* Return function on successful AJAX call
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
success : function (data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
var node = args[1].replace('node=', '');
|
||||
|
||||
// Update /etc/hosts
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makehosts',
|
||||
tgt : '',
|
||||
args : '',
|
||||
msg : ''
|
||||
}
|
||||
});
|
||||
|
||||
// Remove loader
|
||||
$('#addZvm img').remove();
|
||||
|
||||
// If there was an error, do not continue
|
||||
if (rsp.length) {
|
||||
$('#addZvm').prepend(createWarnBar('Failed to create node definitions'));
|
||||
} else {
|
||||
$('#addZvm').prepend(createInfoBar('Node definitions created for ' + node));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar(errMsg);
|
||||
warn.prependTo($(this));
|
||||
}
|
||||
},
|
||||
"Cancel": function(){
|
||||
$(this).dialog( "close" );
|
||||
|
||||
+942
-234
File diff suppressed because it is too large
Load Diff
@@ -634,7 +634,7 @@ function loadNodes(data) {
|
||||
$('#nodesTab').append(info);
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var actionBar = $('<div class="actionBar"></div>').css("width", "400px");
|
||||
|
||||
/**
|
||||
* Create menu for actions to perform against a given node
|
||||
@@ -877,7 +877,7 @@ function loadNodes(data) {
|
||||
powerCol.unbind('click');
|
||||
monitorCol.unbind('click');
|
||||
commentCol.unbind('click');
|
||||
|
||||
|
||||
// Create enough space for loader to be displayed
|
||||
// Center align power, ping, and comments
|
||||
$('#' + nodesTableId + ' td:nth-child(3),td:nth-child(4),td:nth-child(5)').css({
|
||||
@@ -1204,7 +1204,7 @@ function addNodes2Table(data) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get node status
|
||||
var status = '';
|
||||
if (attrs[node]['status']){
|
||||
@@ -1212,7 +1212,7 @@ function addNodes2Table(data) {
|
||||
}
|
||||
|
||||
rows[nodeRowPos][headersCol['status']] = status;
|
||||
|
||||
|
||||
// Go through each header
|
||||
for (var key in headersCol) {
|
||||
// Do not put comments and status in twice
|
||||
@@ -1231,7 +1231,7 @@ function addNodes2Table(data) {
|
||||
// This is done after datatable is updated because
|
||||
// you cannot insert an object using fnUpdate()
|
||||
var comments = attrs[node]['usercomment'];
|
||||
|
||||
|
||||
// If no comments exists, show 'No comments' and
|
||||
// set icon image source
|
||||
var iconSrc;
|
||||
@@ -1241,7 +1241,7 @@ function addNodes2Table(data) {
|
||||
} else {
|
||||
iconSrc = 'images/nodes/ui-icon-comment.png';
|
||||
}
|
||||
|
||||
|
||||
// Create icon for node comments
|
||||
var tipID = node + 'Tip';
|
||||
var commentsCol = $('#' + node).parent().parent().find('td').eq(5);
|
||||
@@ -1261,7 +1261,7 @@ function addNodes2Table(data) {
|
||||
icon.tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
effect: "fade",
|
||||
opacity: 0.8,
|
||||
relative: true,
|
||||
delay: 500
|
||||
|
||||
@@ -617,7 +617,7 @@ function updateSelectNodeDiv() {
|
||||
*/
|
||||
function createActionMenu() {
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var actionBar = $('<div class="actionBar"></div>').css("width", "400px");
|
||||
|
||||
// Power on
|
||||
var powerOnLnk = $('<a>Power on</a>');
|
||||
|
||||
@@ -209,7 +209,7 @@ function loadImages(data) {
|
||||
});
|
||||
|
||||
// Actions
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var actionBar = $('<div class="actionBar"></div>').css("width", "370px");
|
||||
var advancedLnk = '<a>Advanced</a>';
|
||||
var advancedMenu = createMenu([copyCDLnk, generateLnk]);
|
||||
|
||||
@@ -236,8 +236,8 @@ function loadImages(data) {
|
||||
* Enable editable columns
|
||||
*/
|
||||
|
||||
// Do not make 1st column editable
|
||||
$('#' + imgTableId + ' td:not(td:nth-child(1))').editable(
|
||||
// Do not make 1st or 2nd columns editable
|
||||
$('#' + imgTableId + ' td:not(td:nth-child(1),td:nth-child(2))').editable(
|
||||
function(value, settings) {
|
||||
// Get column index
|
||||
var colPos = this.cellIndex;
|
||||
@@ -1030,6 +1030,7 @@ function openEditImagePage(tgtImage) {
|
||||
|
||||
// Create an input for each definable attribute
|
||||
var div, label, input, value;
|
||||
var attrIndex = 0;
|
||||
// Set node attribute
|
||||
origAttrs[tgtImage]['imagename'] = tgtImage;
|
||||
for (var key in defAttrs) {
|
||||
@@ -1044,7 +1045,21 @@ function openEditImagePage(tgtImage) {
|
||||
// Create label and input for attribute
|
||||
div = $('<div></div>').css('display', 'inline');
|
||||
label = $('<label>' + key + ':</label>').css('vertical-align', 'middle');
|
||||
input = $('<input type="text" id="' + key + '" value="' + value + '" title="' + defAttrs[key] + '"/>').css('margin-top', '5px');
|
||||
input = $('<input type="text" id="' + key + '" value="' + value + '" title="' + defAttrs[key] + '"/>').css({
|
||||
'margin-top': '5px',
|
||||
'float': 'none',
|
||||
'width': 'inherit'
|
||||
});
|
||||
|
||||
// There is an element called groups that will override the defaults for the groups attribute.
|
||||
// Hence, the input must have use CSS to override the float and width.
|
||||
|
||||
// Split attributes into 3 per row
|
||||
if (attrIndex > 0 && !(attrIndex % 3)) {
|
||||
div.css('display', 'inline-block');
|
||||
}
|
||||
|
||||
attrIndex++;
|
||||
|
||||
// Create server browser
|
||||
switch (key) {
|
||||
@@ -1177,8 +1192,7 @@ function openEditImagePage(tgtImage) {
|
||||
$(this).css('border-color', 'blue');
|
||||
});
|
||||
|
||||
div.append(label);
|
||||
div.append(input);
|
||||
div.append(label, input);
|
||||
setPropsForm.append(div);
|
||||
}
|
||||
|
||||
|
||||
@@ -559,7 +559,7 @@ function loadNodesTable(data) {
|
||||
});
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var actionBar = $('<div class="actionBar"></div>').css('width', '370px');
|
||||
|
||||
// Prepend menu to datatable
|
||||
var actionsLnk = $('<a>Actions</a>');
|
||||
@@ -997,10 +997,8 @@ function setOSImageCookies(data) {
|
||||
|
||||
// Only save install boot
|
||||
if (provMethod.indexOf('install') > -1) {
|
||||
if (!osComments) {
|
||||
osComments = "No descritption";
|
||||
imageNames.push(osImage + ':' + osComments);
|
||||
} else {
|
||||
if (osComments) {
|
||||
// Only enable images where description and selectable comments exist
|
||||
// Set default description and selectable
|
||||
selectable = "no";
|
||||
desc = "No description";
|
||||
|
||||
@@ -1056,3 +1056,18 @@ function getNodesChecked(datatableId) {
|
||||
|
||||
return tgts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if return message contains errors
|
||||
*
|
||||
* @param msg Return message
|
||||
* @return 0 If return message contains no errors
|
||||
* -1 If return message contains errors
|
||||
*/
|
||||
function containErrors(msg) {
|
||||
if (msg.indexOf('Failed') > -1 || msg.indexOf('Error') > -1) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -234,10 +235,6 @@ sub provzlinux {
|
||||
# Set nodetype definitions
|
||||
$out = `chtab node=$node noderes.netboot=zvm nodetype.nodetype=osi nodetype.provmethod=install nodetype.os=$os nodetype.arch=$arch nodetype.profile=$profile nodetype.comments="owner:$owner"`;
|
||||
|
||||
# Update hosts table and DNS
|
||||
`makehosts`;
|
||||
`makedns`;
|
||||
|
||||
# Create user directory entry replacing LXUSR with user ID
|
||||
# Use /opt/zhcp/conf/default.direct on zHCP as the template
|
||||
# USER LXUSR PSWD 512M 1G G
|
||||
@@ -265,9 +262,18 @@ sub provzlinux {
|
||||
# Read XML file
|
||||
my $data = $xml->XMLin($tmpl);
|
||||
|
||||
my $devices = $data->{'dasd'}->{'devices'}->{'listentry'};
|
||||
foreach (@$devices) {
|
||||
|
||||
my $devices_ref = $data->{'dasd'}->{'devices'}->{'listentry'};
|
||||
my @devices;
|
||||
|
||||
if (ref($devices_ref) eq 'HASH') {
|
||||
# In the case of 1 device in the listentry, push hash into array
|
||||
push(@devices, $devices_ref);
|
||||
} else {
|
||||
# Listentry is an array reference
|
||||
@devices = @$devices_ref;
|
||||
}
|
||||
|
||||
foreach (@devices) {
|
||||
# Get disk virtual address and disk type
|
||||
$type = $_->{'drivers'}->{'listentry'}->{'modules'}->{'module_entry'}->{'listentry'};
|
||||
$virt_addr = $_->{'sysfs_bus_id'};
|
||||
@@ -316,6 +322,10 @@ sub provzlinux {
|
||||
$virt_addr = $virt_addr + 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Update hosts table and DNS
|
||||
`makehosts`;
|
||||
`makedns`;
|
||||
|
||||
# Update DHCP
|
||||
`makedhcp -a`;
|
||||
@@ -674,6 +684,7 @@ sub clonezlinux {
|
||||
$out = `chtab node=$node noderes.netboot=zvm nodetype.nodetype=osi nodetype.provmethod=install nodetype.os=$os nodetype.arch=$arch nodetype.profile=$profile nodetype.comments="owner:$owner"`;
|
||||
|
||||
# Update hosts table and DNS
|
||||
sleep(5); # Time needed to update /etc/hosts
|
||||
`makehosts`;
|
||||
`makedns`;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ my $krpmver;
|
||||
my $kerneldir;
|
||||
my $mode;
|
||||
my $interactive;
|
||||
|
||||
my $onlyinitrd;
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 print_usage - usage message
|
||||
@@ -51,8 +51,8 @@ sub print_usage
|
||||
{
|
||||
print "Usage:\n";
|
||||
print " genimage\n\n";
|
||||
print ' genimage -o <osver> [-a <arch>] -p <profile> -i <nodebootif> -n <nodenetdrivers> [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive]'."\n\n";
|
||||
print ' genimage [-o <osver>] [-a <arch>] [-p <profile>] [-i <nodebootif>] [-n <nodenetdrivers>] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] <imagename>'."\n\n";
|
||||
print ' genimage -o <osver> [-a <arch>] -p <profile> -i <nodebootif> -n <nodenetdrivers> [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive]'."\n\n";
|
||||
print ' genimage [-o <osver>] [-a <arch>] [-p <profile>] [-i <nodebootif>] [-n <nodenetdrivers>] [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] <imagename>'."\n\n";
|
||||
print " --permission is used for statelite only\n";
|
||||
print " -g is used for SLES only\n\n";
|
||||
print " -m is used for urbuntu, debian and fedora12 only\n\n";
|
||||
@@ -60,6 +60,7 @@ sub print_usage
|
||||
print " genimage\n";
|
||||
print " genimage --interactive\n";
|
||||
print " genimage -i eth0 -n tg3 -o sles11 -p compute\n";
|
||||
print " genimage -i eth0 -n tg3 -o sles11 -p compute --onlyinitrd\n";
|
||||
print " genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute --interactive\n";
|
||||
print " genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute\n";
|
||||
print " genimage -i eth0 -n igb,e1000e,e1000,bnx2,tg3 -o centos5.4 -p nfsroot --permission 777\n";
|
||||
@@ -82,6 +83,7 @@ if (!GetOptions(
|
||||
'permission=s' => \$permission,
|
||||
'kerneldir=s' => \$kerneldir,
|
||||
'interactive' => \$interactive,
|
||||
'onlyinitrd' => \$onlyinitrd,
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$version,
|
||||
)) {
|
||||
@@ -210,7 +212,7 @@ if ((!$imagename) && (!$os)){
|
||||
|
||||
chomp($os);
|
||||
}
|
||||
print " OS: $os\n";
|
||||
if ($os) { print " OS: $os\n"; }
|
||||
|
||||
|
||||
|
||||
@@ -280,7 +282,7 @@ if ((!$imagename) && (!$profile)){
|
||||
}
|
||||
}
|
||||
}
|
||||
print " Profile: $profile\n";
|
||||
if ($profile) { print " Profile: $profile\n"; }
|
||||
|
||||
# get the interface
|
||||
if ((!$imagename) && (!$interface)){
|
||||
@@ -309,7 +311,7 @@ if ((!$imagename) && (!$interface)){
|
||||
}
|
||||
}
|
||||
}
|
||||
print " Interface: $interface\n";
|
||||
if ($interface) { print " Interface: $interface\n"; }
|
||||
|
||||
|
||||
|
||||
@@ -388,6 +390,10 @@ if ($interactive) {
|
||||
push @arg, "--interactive";
|
||||
}
|
||||
|
||||
if ($onlyinitrd) {
|
||||
push @arg, "--onlyinitrd";
|
||||
}
|
||||
|
||||
my $cmdref;
|
||||
push (@{$cmdref->{arg}}, @arg);
|
||||
$cmdref->{command}->[0] = "genimage";
|
||||
|
||||
+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");
|
||||
}
|
||||
|
||||
@@ -20,6 +20,38 @@ B<chhypervisor> I<noderange> [B<-d>]
|
||||
|
||||
=back
|
||||
|
||||
B<zVM specific :>
|
||||
|
||||
=over 2
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--adddisk2pool> I<function> I<region> I<volume> I<group>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--addzfcp2pool> I<pool> I<status> I<wwpn> I<lun> I<size> I<owner>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--diskpool> I<name>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--diskpoolnames>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--fcpchannels> I<state>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--getnetworknames>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--getnetwork> I<name>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--removediskfrompool> I<function> I<region> I<group>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--removezfcpfrompool> I<pool> I<lun>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--resetsmapi>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--smcli> I<function> I<arguments>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--zfcppoolnames>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<--zfcppool> I<pool> I<space>]
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<chhypervisor> command can be used to configure the RHEV-h host.
|
||||
@@ -31,15 +63,17 @@ After registering, the network interfaces of host need to be added to the 'netwo
|
||||
RHEV. And the power management for the host should be configured so that
|
||||
rhev-m could make proper decision when certain host encountered error.
|
||||
|
||||
The B<chhypervisor> command can also be used to configure the zVM host.
|
||||
|
||||
For each host, an entry should be added to the hypervisor table:
|
||||
|
||||
The columns of hypervisor table:
|
||||
|
||||
=over 2
|
||||
|
||||
B<hypervisor.node> - rhev-h host name.
|
||||
B<hypervisor.node> - rhev-h host name or zVM host name.
|
||||
|
||||
B<hypervisor.type> - Must be set to 'rhevh'.
|
||||
B<hypervisor.type> - Must be set to 'rhevh' or 'zvm'.
|
||||
|
||||
B<hypervisor.mgr> - The rhev manager (The FQDN of rhev-m server) for the host.
|
||||
|
||||
@@ -52,6 +86,8 @@ default is 'Default' cluster if not specified.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=head2 RHEV specific :
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<-a>
|
||||
@@ -113,6 +149,79 @@ Display usage message.
|
||||
|
||||
=back
|
||||
|
||||
=head2 zVM specific :
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<--adddisk2pool> I<function> I<region> I<volume> I<group>
|
||||
|
||||
Add a disk to a disk pool defined in the EXTENT CONTROL. Function type can be
|
||||
either: (4) Define region as full volume and add to group OR (5) Add existing
|
||||
region to group. If the volume already exists in the EXTENT CONTROL, use
|
||||
function 5. If the volume does not exist in the EXTENT CONTROL, but is attached
|
||||
to SYSTEM, use function 4.
|
||||
|
||||
=item B<--addzfcp2pool> I<pool> I<status> I<wwpn> I<lun> I<size> I<owner>
|
||||
|
||||
Add a zFCP device to a device pool defined in xCAT. The device must have been
|
||||
carved up in the storage controller and configured with a WWPN/LUN before it
|
||||
can be added to the xCAT storage pool. z/VM does not have the ability to
|
||||
communicate directly with the storage controller to carve up disks dynamically.
|
||||
|
||||
=item B<--diskpool> I<name>
|
||||
|
||||
List the configuration for a given disk pool.
|
||||
|
||||
=item B<--diskpoolnames>
|
||||
|
||||
List the disk pool names available.
|
||||
|
||||
=item B<--fcpchannels> I<state>
|
||||
|
||||
List the state of real FCP adapter devices.
|
||||
|
||||
=item B<--getnetworknames>
|
||||
|
||||
List the defined network names available for a given host.
|
||||
|
||||
=item B<--getnetwork> I<name>
|
||||
|
||||
List the configuration for a given network.
|
||||
|
||||
=item B<--removediskfrompool> I<function> I<region> I<group>
|
||||
|
||||
Remove a disk from a disk pool defined in the EXTENT CONTROL. Function type can
|
||||
be either: (1) Remove region, (2) Remove region from group, (3) Remove region
|
||||
from all groups, OR (7) Remove entire group .
|
||||
|
||||
=item B<--removezfcpfrompool> I<pool> I<lun>
|
||||
|
||||
Remove a zFCP device from a device pool defined in xCAT.
|
||||
|
||||
=item B<--resetsmapi>
|
||||
|
||||
Reset z/VM SMAPI, assuming the SMAPI worker machines to reset are: VSMWORK1,
|
||||
VSMWORK2, VSMWORK3, VSMREQIN, and VSMREQIU.
|
||||
|
||||
=item B<--smcli> I<function> I<arguments>
|
||||
|
||||
Execute a SMAPI function. A list of APIs supported can be found by using the
|
||||
help flag, e.g. chhypervisor pokdev61 --smcli -h. Specific arguments associated
|
||||
with a SMAPI function can be found by using the help flag for the function,
|
||||
e.g. chhypervisor pokdev61 --smcli Image_Query_DM -h. Only z/VM 5.4 SMAPI
|
||||
functions are supported at this time. Additional SMAPI functions will be added
|
||||
in subsequent zHCP versions.
|
||||
|
||||
=item B<--zfcppoolnames>
|
||||
|
||||
List the zFCP device pool names available.
|
||||
|
||||
=item B<--zfcppool> I<pool> I<space>
|
||||
|
||||
List the devices in a given zFCP device pool. Space can be either: free or used.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
@@ -121,6 +230,8 @@ Display usage message.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=head2 RHEV specific :
|
||||
|
||||
=over 2
|
||||
|
||||
=item 1.
|
||||
@@ -150,6 +261,77 @@ To deactivate the host 'host1', enter:
|
||||
|
||||
=back
|
||||
|
||||
=head2 zVM specific :
|
||||
|
||||
=over 2
|
||||
|
||||
=item 1.
|
||||
To add a disk to a disk pool defined in the EXTENT CONTROL, enter:
|
||||
|
||||
chhypervisor pokdev61 --adddisk2pool 4 DM1234 DM1234 POOL1
|
||||
|
||||
=item 2.
|
||||
To add a zFCP device to a device pool defined in xCAT, enter:
|
||||
|
||||
chhypervisor pokdev61 --addzfcp2pool zfcp1 free 500501234567C890 4012345600000000 8G
|
||||
|
||||
=item 3.
|
||||
To list the free disks in a given disk pool, enter:
|
||||
|
||||
chhypervisor pokdev61 --diskpool POOL1 free
|
||||
|
||||
=item 4.
|
||||
To list the disk pool names available, enter:
|
||||
|
||||
chhypervisor pokdev61 --diskpoolnames
|
||||
|
||||
=item 5.
|
||||
To list the state of real FCP adapter devices, enter:
|
||||
|
||||
chhypervisor pokdev61 --fcpchannels free
|
||||
|
||||
=item 6.
|
||||
To list the configuration for a given network, enter:
|
||||
|
||||
chhypervisor pokdev61 --getnetwork GLAN1
|
||||
|
||||
=item 7.
|
||||
To list the defined network names available for a given node, enter:
|
||||
|
||||
chhypervisor pokdev61 --getnetworknames
|
||||
|
||||
=item 8.
|
||||
To remove a region from a group in the EXTENT CONTROL, enter:
|
||||
|
||||
chhypervisor pokdev61 --removediskfrompool 2 DM1234 POOL1
|
||||
|
||||
=item 9.
|
||||
To remove a zFCP device from a device pool defined in xCAT, enter:
|
||||
|
||||
chhypervisor pokdev61 --removezfcpfrompool zfcp1 4012345600000000
|
||||
|
||||
=item 10.
|
||||
To reset z/VM SMAPI, enter:
|
||||
|
||||
chhypervisor pokdev61 --resetsmapi
|
||||
|
||||
=item 11.
|
||||
To execute a SMAPI function (Image_Query_DM), enter:
|
||||
|
||||
chhypervisor pokdev61 --smcli Image_Query_DM -T LNX3
|
||||
|
||||
=item 12.
|
||||
To list the zFCP device pool names available, enter:
|
||||
|
||||
chhypervisor pokdev61 --zfcppoolnames
|
||||
|
||||
=item 13.
|
||||
To list the devices in a given zFCP device pool, enter:
|
||||
|
||||
chhypervisor pokdev61 --zfcppool zfcp1
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/chhypervisor
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,9 +6,9 @@ B<genimage> - Generates a stateless image to be used for a diskless install.
|
||||
|
||||
B<genimage>
|
||||
|
||||
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>]
|
||||
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>]
|
||||
|
||||
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] I<imagename>
|
||||
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] I<imagename>
|
||||
|
||||
|
||||
B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
|
||||
@@ -53,8 +53,10 @@ for statelite: B<liteimg>
|
||||
|
||||
Becides prompting for the input for some paramters, the B<genimage> command takes default quesses for the parameters not specified or not defined in the I<osimage> and I<linuximage> tables. It also makes default answers for questions from yum/zypper command when installing rpms into the image. Please use --interactive flag if you want yum/zypper command to prompt you for the answers.
|
||||
|
||||
The B<genimage> command must be run on a system that is the same architecture as the nodes it will be
|
||||
used on. If the management node is not the same architecture, copy the contents of
|
||||
If B<--onlyinitrd> is specified, only regenerates the initrd for a stateless image to be used for a diskless install.
|
||||
|
||||
The B<genimage> command must be run on a system that is the same architecture and same distro with same majar release version as the nodes it will be
|
||||
used on. If the management node is not the same architecture or same distro level, copy the contents of
|
||||
/opt/xcat/share/xcat/netboot/<os> to a system that is the proper architecture, and mount /install from
|
||||
the management node to that system. Then change directory to /opt/xcat/share/xcat/netboot/<os> and run ./genimage.
|
||||
|
||||
@@ -104,6 +106,17 @@ which may prove important in some cases.
|
||||
|
||||
The maximum size allowed for the root file system in the image. Specify in bytes, or can append k, m, or g.
|
||||
|
||||
=item B<--onlyinitrd>
|
||||
|
||||
Regenerates the initrd for a stateless image to be used for a diskless install.
|
||||
|
||||
|
||||
Regenerates the initrd that is part of a stateless/statelite image that is used to boot xCAT nodes in a stateless/stateli
|
||||
te mode.
|
||||
The generated initrd will be put in /install/netboot/<OS>/<arch>/<profile>.
|
||||
|
||||
The B<genimage --onlyinitrd> command will generate two initial ramdisks, one is B<initrd-statelite.gz> for B<statelite> mode, the other one is B<initrd-stateless.gz> for B<stateless> mode.
|
||||
|
||||
=item B<--permission> I<permission>
|
||||
|
||||
The mount permission of B</.statelite> directory for B<statelite> mode, which is only used for B<statelite> mode, and the default permission is 755.
|
||||
@@ -193,6 +206,11 @@ x86_64 and place it in the
|
||||
|
||||
genimage myimagename --interactive
|
||||
|
||||
=item 9
|
||||
|
||||
To regenerate the initrd for a fedora8 image for a compute node architecture x86_64 and place it in the /install/netboot/fedora8/x86_64/compute/rootimg directory: change directory to /opt/xcat/share/xcat/netboot/fedora and run:
|
||||
|
||||
genimage --onlyinitrd -i eth0 -n tg3,bnx2 -o fedora8 -p compute
|
||||
|
||||
=back
|
||||
|
||||
@@ -206,4 +224,4 @@ x86_64 and place it in the
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<geninitrd(1)|geninitrd.1>, L<packimage(1)|packimage.1>, L<liteimg(1)|liteimg.1>
|
||||
L<packimage(1)|packimage.1>, L<liteimg(1)|liteimg.1>
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
=head1 NAME
|
||||
|
||||
B<geninitrd> - Regenerates the initrd for a stateless image to be used for a diskless install.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<geninitrd> [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<-o> I<OS>] [B<-p>] [I<profile>] [B<-l> I<rootlimit>] [B<-k> I<kernel_version>] [B<--permission> I<permission>]
|
||||
|
||||
B<geninitrd> [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<-o> I<OS>] [B<-p>] [I<profile>] [B<-l> I<rootlimit>] [B<-k> I<kernel_version>] [B<--permission> I<permission>] imagename
|
||||
|
||||
B<geninitrd> [B<-h> | B<--help> | B<-v> | B<--version>]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Regenerates the initrd that is part of a stateless/statelite image that is used to boot xCAT nodes in a stateless/statelite mode.
|
||||
The generated initrd will be put in /install/netboot/<OS>/<arch>/<profile>.
|
||||
|
||||
The B<geninitrd> command must be run on a system that is the same architecture as the nodes it will be
|
||||
used on. If the management node is not the same architecture, copy the contents of
|
||||
/opt/xcat/share/xcat/netboot/<OS> to a system that is the proper architecture, and mount /install from
|
||||
the management node to that system.
|
||||
|
||||
The B<geninitrd> command will generate two initial ramdisks, one is B<initrd-statelite.gz> for B<statelite> mode, the other one is B<initrd-stateless.gz> for B<stateless> mode.
|
||||
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 12
|
||||
|
||||
=item B<-o> I<OS>
|
||||
|
||||
The operating system for the image: fedora8, rhel5, sles10, etc. The OS packages must be in
|
||||
/install/<OS>/<arch> (use L<copycds(8)|copycds.8>).
|
||||
|
||||
=item B<-p> I<profile>
|
||||
|
||||
The profile (e.g. compute, service) to use to create the image. This determines what package lists are
|
||||
used from /opt/xcat/share/xcat/netboot/<OS> to create the image with. When deploying nodes with this image,
|
||||
the nodes' nodetype.profile attribute must be set to this same value.
|
||||
|
||||
=item B<-i> I<nodebootif>
|
||||
|
||||
The network interface the diskless node will boot over (e.g. eth0).
|
||||
|
||||
=item B<-n> I<nodenetdrivers>
|
||||
|
||||
The driver modules needed for the network interface. Note: the order that the drivers are specified in
|
||||
is important.
|
||||
|
||||
=item B<-l> I<rootlimit>
|
||||
|
||||
The maximum size allowed for the root file system in the image. Specify in bytes, or can append k, m, or g.
|
||||
|
||||
=item B<-k> I<kernel_version>
|
||||
|
||||
Use this flag if you want to use a specific version of the kernel in the image. Defaults to the first kernel found
|
||||
in the install image.
|
||||
|
||||
=item B<-v>
|
||||
|
||||
Display version.
|
||||
|
||||
=item B<-h>
|
||||
|
||||
Display usage message.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 3
|
||||
|
||||
=item 1.
|
||||
|
||||
To regenerate the initrd for a fedora8 image for a compute node architecture x86_64 and place it in the
|
||||
/install/netboot/fedora8/x86_64/compute/rootimg directory: change directory to
|
||||
/opt/xcat/share/xcat/netboot/fedora and run:
|
||||
|
||||
geninitrd -i eth0 -n tg3,bnx2 -o fedora8 -p compute
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/share/xcat/netboot/<OS>/geninitrd
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<genimage(1)|genimage.1>, L<packimage(1)|packimage.1>
|
||||
@@ -18,7 +18,7 @@ B<getmacs> I<noderange> [B<-V>| B<--verbose>] [B<-f>] [B<-d>] [B<--arp>] | [B<-D
|
||||
|
||||
=head2 blade specific:
|
||||
|
||||
B<getmacs> I<noderange> [B<-V>| B<--verbose>] [B<-d>] [B<--arp>]
|
||||
B<getmacs> I<noderange> [B<-V>| B<--verbose>] [B<-d>] [B<--arp>] [B<-i> I<ethN>|I<enN>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -32,7 +32,7 @@ Note: If network adapters are physically assigned to LPARs, getmacs cannot read
|
||||
|
||||
For IBM Flex Compute Node (Compute Node for short) specific:
|
||||
|
||||
Note: If "B<-d>" is specified, all the MAC of the blades will be displayed. Otherwise, the number of MAC address that the 'installnic' attribute of the blade specified will be write to mac table.
|
||||
Note: If "B<-d>" is specified, all the MAC of the blades will be displayed. If no option specified, the first MAC address of the blade will be written to mac table.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
@@ -88,6 +88,10 @@ B<-V>
|
||||
|
||||
Verbose output.
|
||||
|
||||
B<-i>
|
||||
|
||||
Specify the interface whose mac address will be collected and written into mac table. If 4 mac addresses are returned by option '-d', they all are the mac addresses of the blade. The N can start from 0(map to the eth0 of the blade) to 3. If 5 mac addresses are returned, the 1st mac address must be the mac address of the blade's FSP, so the N will start from 1(map to the eth0 of the blade) to 4.
|
||||
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
echo $drivers
|
||||
dracut_install wget openssl tar ipmitool cpio gzip lsmod ethtool modprobe touch echo cut wc
|
||||
dracut_install wget openssl tar mstflint ipmitool cpio gzip lsmod ethtool modprobe touch echo cut wc
|
||||
dracut_install netstat # broadcom update requires
|
||||
dracut_install uniq # mellanox update requires
|
||||
dracut_install grep ip hostname awk egrep grep dirname expr
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
instmods nfs sunrpc
|
||||
instmods e1000 e1000e virtio_net igb ines mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb qlge mptsas mpt2sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf
|
||||
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb qlge mptsas mpt2sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf
|
||||
instmods macvlan macvtap 8021q bridge bonding vmxnet3 acpi-cpufreq powernow-k8 cdc_ether
|
||||
instmods mptctl #LSI firmware management requires this
|
||||
instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -16,11 +16,12 @@ use warnings "all";
|
||||
use Time::HiRes qw/time/;
|
||||
|
||||
use IO::Socket::INET qw/!AF_INET6 !PF_INET6/;
|
||||
my $initialtimeout=0.809;
|
||||
my $initialtimeout=0.5;
|
||||
use constant STATE_OPENSESSION=>1;
|
||||
use constant STATE_EXPECTINGRAKP2=>2;
|
||||
use constant STATE_EXPECTINGRAKP4=>3;
|
||||
use constant STATE_ESTABLISHED=>4;
|
||||
use constant STATE_FAILED=>5;
|
||||
#my $ipmidbg;
|
||||
#open($ipmidbg,">","/tmp/ipmidbg");
|
||||
#sub dprint {
|
||||
@@ -43,6 +44,7 @@ use IO::Select;
|
||||
#use Data::Dumper;
|
||||
use Digest::MD5 qw/md5/;
|
||||
my $pendingpackets=0;
|
||||
my %tabooseq;
|
||||
my $maxpending; #determined dynamically based on rcvbuf detection
|
||||
my $ipmi2support = eval {
|
||||
require Digest::SHA1;
|
||||
@@ -370,6 +372,15 @@ sub checksum {
|
||||
sub subcmd {
|
||||
my $self = shift;
|
||||
my %args = @_;
|
||||
$self->{expectedcmd}=$args{command};
|
||||
$self->{expectednetfn}=$args{netfn}+1;
|
||||
my $seqincrement=7;
|
||||
while ($tabooseq{$self->{expectednetfn}}->{$self->{expectedcmd}}->{$self->{seqlun}} and $seqincrement) { #avoid using a seqlun formerly marked 'taboo', but don't advance by more than 7, just in case
|
||||
$tabooseq{$self->{expectednetfn}}->{$self->{expectedcmd}}->{$self->{seqlun}}--; #forgive a taboo lun over time...
|
||||
$self->{seqlun} += 4; #increment by 1<<2
|
||||
$self->{seqlun} &= 0xff; #make sure we don't get too large a seqlun
|
||||
$seqincrement--; #assure seq number doesn't go beyond 7 even if it means going taboo, one enhancement would be to pick the *least* taboo instead of just giving up
|
||||
}
|
||||
my $rsaddr=0x20; #figrue 13-4, rssa by old code
|
||||
my @rnl = ($rsaddr,$args{netfn}<<2);
|
||||
my @rest = ($self->{rqaddr},$self->{seqlun},$args{command},@{$args{data}});
|
||||
@@ -450,15 +461,17 @@ sub timedout {
|
||||
return;
|
||||
}
|
||||
$self->{nowait}=1;
|
||||
$self->{timeout} = $self->{timeout}*1.5;
|
||||
$self->{timeout} += 1; #$self->{timeout}*2;
|
||||
if ($self->{noretry}) { return; }
|
||||
if ($self->{timeout} > 7) { #giveup, really
|
||||
$self->{timeout}=$initialtimeout;
|
||||
if ($self->{timeout} > 5) { #giveup, really
|
||||
$self->{timeout}=$initialtimeout+(0.5*rand());
|
||||
my $rsp={};
|
||||
$rsp->{error} = "timeout";
|
||||
$self->{ipmicallback}->($rsp,$self->{ipmicallback_args});
|
||||
$self->{nowait}=0;
|
||||
return;
|
||||
} elsif ($self->{sessionestablishmentcontext} == STATE_FAILED) {
|
||||
return;
|
||||
}
|
||||
if ($self->{sessionestablishmentcontext} == STATE_OPENSESSION) { #in this particular case, we want to craft a new rmcp session request with a new client side session id, to aid in distinguishing retry from new
|
||||
$self->open_rmcpplus_request();
|
||||
@@ -469,6 +482,7 @@ sub timedout {
|
||||
} elsif ($self->{sessionestablishmentcontext} == STATE_EXPECTINGRAKP4) { #in this particular case, we want to craft a new rmcp session request with a new client side session id, to aid in distinguishing retry from new
|
||||
$self->relog();
|
||||
} else {
|
||||
$self->{hasretried}=1; #remember that we have retried at the moment
|
||||
$self->sendpayload(%{$self->{pendingargs}},nowait=>1); #do not induce the xmit to wait for packets, just spit it out. timedout is in a wait-for-packets loop already, so it's fine
|
||||
}
|
||||
$self->{nowait}=0;
|
||||
@@ -674,7 +688,7 @@ sub init {
|
||||
$self->{'sessionid'} = [0,0,0,0]; # init session id
|
||||
$self->{'authtype'}=0; # first messages will have auth type of 0
|
||||
$self->{'ipmiversion'}='1.5'; # send first packet as 1.5
|
||||
$self->{'timeout'}=$initialtimeout; #start at a quick timeout, increase on retry
|
||||
$self->{'timeout'}=$initialtimeout+(0.5*rand()); #start at a quick timeout, increase on retry
|
||||
$self->{'seqlun'}=0; #the IPMB seqlun combo, increment by 4s
|
||||
$self->{rqaddr}=0x81; #Per table '5-4' system sofware ids in the ipmi spec, we are allowed 0x81-0x8d software ids
|
||||
#A problem with ipmi is that chatty commands (rinv) can mistake stale data for new if sequence number overflows
|
||||
@@ -786,6 +800,7 @@ sub got_rakp2 {
|
||||
my @expectedhash = (unpack("C*",hmac_sha1($hmacdata,$self->{password})));
|
||||
foreach (0..(scalar(@expectedhash)-1)) {
|
||||
if ($expectedhash[$_] != $data[$_]) {
|
||||
$self->{sessionestablishmentcontext}=STATE_FAILED;
|
||||
$self->{onlogon}->("ERROR: Incorrect password provided",$self->{onlogon_args});
|
||||
return 9;
|
||||
}
|
||||
@@ -807,12 +822,19 @@ 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
|
||||
if ($payload[4] != $self->{seqlun} or $payload[0] != $self->{rqaddr}) {
|
||||
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);
|
||||
return 1; #response mismatch
|
||||
}
|
||||
if ($self->{hasretried}) { #if we sent this out multiple times, mark the sequence as taboo
|
||||
$self->{hasretried}=0;
|
||||
$tabooseq{$self->{expectednetfn}}->{$self->{expectedcmd}}->{$self->{seqlun}}=16; #consider a lun taboo for 16 overflow cycles
|
||||
}
|
||||
#set to impossible values to reflect the fact we expect *no* command/nnetfn at the moment
|
||||
$self->{expectednetfn}=0x1ff;
|
||||
$self->{expectedcmd}=0x1ff;
|
||||
$self->{seqlun} += 4; #increment by 1<<2
|
||||
if ($self->{seqlun} > 0xff) { #overflow case
|
||||
#Problem with rqaddr iteration strategy to get more sequence numbers, changing swid invalidates reservation ids for some BMCs...
|
||||
@@ -831,7 +853,7 @@ sub parse_ipmi_payload {
|
||||
$rsp->{cmd} = shift @payload;
|
||||
$rsp->{code} = shift @payload;
|
||||
$rsp->{data} = \@payload;
|
||||
$self->{timeout}=$initialtimeout;
|
||||
$self->{timeout}=$initialtimeout+(0.5*rand());
|
||||
$self->{ipmicallback}->($rsp,$self->{ipmicallback_args});
|
||||
return 0;
|
||||
}
|
||||
@@ -947,7 +969,7 @@ sub sendpayload {
|
||||
$sessions_waiting{$self}->{ipmisession}=$self;
|
||||
if ($args{delayxmit}) {
|
||||
$sessions_waiting{$self}->{timeout}=time()+$args{delayxmit};
|
||||
$self->{timeout}=$initialtimeout/1.5; #since we are burning one of the retry attempts, start the backoff algorithm faster to make it come out even
|
||||
$self->{timeout}=($initialtimeout+(0.5*rand()))/2; #since we are burning one of the retry attempts, start the backoff algorithm faster to make it come out even
|
||||
undef $args{delayxmit};
|
||||
return; #don't actually transmit packet, use retry timer to start us off
|
||||
} else {
|
||||
|
||||
@@ -2000,8 +2000,19 @@ sub preprocess_request {
|
||||
# build an individual request for each service node
|
||||
my $service = "xcat";
|
||||
my @hcps=keys(%hcp_hash);
|
||||
my $sn = xCAT::Utils->get_ServiceNode(\@hcps, $service, "MN");
|
||||
|
||||
my $sn;
|
||||
my @dfmdispatch = xCAT::Utils->get_site_attribute("hwctrldispatch");
|
||||
if (defined($dfmdispatch[0]) and ($dfmdispatch[0] =~ /0|n/i)) {
|
||||
if ($masters[0]) {
|
||||
push @{$sn->{$masters[0]}}, @hcps;
|
||||
} else {
|
||||
$callback->({data=>["The value of the attribute master in the site table is NOT set"]});
|
||||
$req = {};
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$sn = xCAT::Utils->get_ServiceNode(\@hcps, $service, "MN");
|
||||
}
|
||||
# build each request for each service node
|
||||
foreach my $snkey (keys %$sn)
|
||||
{
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -770,15 +770,12 @@ sub nimnodeset
|
||||
#
|
||||
# See if we need to create a resolv_conf resource
|
||||
#
|
||||
|
||||
my $RChash;
|
||||
$RChash = &chk_resolv_conf($callback, \%objhash, \@nodelist, \%nethash, \%imagehash, \%attrs, \%nodeosi, $subreq);
|
||||
if ( !$RChash ){
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not check NIM resolv_conf resource.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
my %resolv_conf_hash = &chk_resolv_conf($callback, \%objhash, \@nodelist, \%nethash, \%imagehash, \%attrs, \%nodeosi, $subreq);
|
||||
if ( !%resolv_conf_hash ){
|
||||
# my $rsp;
|
||||
# push @{$rsp->{data}}, "Could not check NIM resolv_conf resource.\n";
|
||||
# xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
}
|
||||
my %resolv_conf_hash = %{$RChash};
|
||||
|
||||
#
|
||||
# Get a list of all nim resource types
|
||||
@@ -3459,7 +3456,7 @@ sub mknimimage
|
||||
#
|
||||
# get mksysb resource
|
||||
#
|
||||
$mksysb_name = &mk_mksysb(\%::attrres, $callback);
|
||||
$mksysb_name = &mk_mksysb(\%::attrres, $callback, $subreq);
|
||||
chomp $mksysb_name;
|
||||
$newres{mksysb} = $mksysb_name;
|
||||
if (!defined($mksysb_name))
|
||||
@@ -3595,7 +3592,6 @@ sub mknimimage
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Set root password in diskless images
|
||||
#
|
||||
@@ -3619,38 +3615,35 @@ sub mknimimage
|
||||
$method = $et->{'cryptmethod'};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($rootpw) {
|
||||
if ( $::VERBOSE) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "Setting the root password in the spot \'$spot_name\'\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
if ($rootpw) {
|
||||
if ( $::VERBOSE) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "Setting the root password in the spot \'$spot_name\'\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
chomp $rootpw;
|
||||
my $pwcmd;
|
||||
if ($method) {
|
||||
$pwcmd = qq~$::XCATROOT/bin/xcatchroot -i $spot_name "/usr/bin/echo root:$rootpw | /usr/bin/chpasswd -e -c" >/dev/null 2>&1~;
|
||||
} else {
|
||||
$pwcmd = qq~$::XCATROOT/bin/xcatchroot -i $spot_name "/usr/bin/echo root:$rootpw | /usr/bin/chpasswd -c" >/dev/null 2>&1~;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
chomp $rootpw;
|
||||
my $pwcmd;
|
||||
if ($method) {
|
||||
$pwcmd = qq~$::XCATROOT/bin/xcatchroot -i $spot_name "/usr/bin/echo root:$rootpw | /usr/bin/chpasswd -e -c" >/dev/null 2>&1~;
|
||||
} else {
|
||||
$pwcmd = qq~$::XCATROOT/bin/xcatchroot -i $spot_name "/usr/bin/echo root:$rootpw | /usr/bin/chpasswd -c" >/dev/null 2>&1~;
|
||||
}
|
||||
|
||||
# secure passwd in verbose mode
|
||||
my $tmpv = $::VERBOSE;
|
||||
$::VERBOSE = 0;
|
||||
# secure passwd in verbose mode
|
||||
my $tmpv = $::VERBOSE;
|
||||
$::VERBOSE = 0;
|
||||
|
||||
my $out = xCAT::Utils->runcmd("$pwcmd", -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Unable to set root password.";
|
||||
push @{$rsp->{data}}, "$out\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
my $out = xCAT::Utils->runcmd("$pwcmd", -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Unable to set root password.";
|
||||
push @{$rsp->{data}}, "$out\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
}
|
||||
$::VERBOSE = $tmpv;
|
||||
}
|
||||
$::VERBOSE = $tmpv;
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
@@ -4632,7 +4625,7 @@ sub mk_resolv_conf_file
|
||||
|
||||
Returns:
|
||||
- undef
|
||||
- ptr to hash of resolv_conf resource names
|
||||
- hash of resolv_conf resource names
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -5094,7 +5087,7 @@ sub chk_resolv_conf
|
||||
} # end if $create_res
|
||||
} # end foreach node
|
||||
|
||||
return \%resolv_conf_hash;
|
||||
return %resolv_conf_hash;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
@@ -5274,12 +5267,15 @@ sub mk_mksysb
|
||||
{
|
||||
my $attrs = shift;
|
||||
my $callback = shift;
|
||||
my $sub_req = shift;
|
||||
|
||||
my %attrres;
|
||||
if ($attrs) {
|
||||
%attrres = %{$attrs};
|
||||
}
|
||||
|
||||
my $snode;
|
||||
|
||||
my @validattrs = ("verbose", "nfs_vers", "nfs_sec", "dest_dir", "group", "source", "size_preview", "exclude_files", "mksysb_flags", "mk_image");
|
||||
|
||||
my $mksysb_name = $::image_name . "_mksysb";
|
||||
@@ -5307,10 +5303,46 @@ sub mk_mksysb
|
||||
{
|
||||
|
||||
# create the mksysb definition
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Creating a NIM mksysb resource called \'$mksysb_name\'. This could take a while.\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
|
||||
if ($::MKSYSBNODE)
|
||||
{
|
||||
|
||||
# get the server for the node
|
||||
my $nrtab = xCAT::Table->new('noderes');
|
||||
my @nodes;
|
||||
push @nodes, $::MKSYSBNODE;
|
||||
|
||||
my $nrhash;
|
||||
if ($nrtab)
|
||||
{
|
||||
$nrhash = $nrtab->getNodesAttribs(\@nodes, ['servicenode']);
|
||||
}
|
||||
|
||||
my ($remote_server, $junk) = (split /,/, $nrhash->{$::MKSYSBNODE}->[0]->{'servicenode'});
|
||||
$nrtab->close();
|
||||
|
||||
my $nimprime = xCAT::InstUtils->getnimprime();
|
||||
chomp $nimprime;
|
||||
|
||||
if ($remote_server) {
|
||||
$snode = $remote_server;
|
||||
} else {
|
||||
$snode = $nimprime;
|
||||
}
|
||||
chomp $snode;
|
||||
|
||||
# do we have a seperate service node to handle
|
||||
my $doSN;
|
||||
my $nimprimeip = xCAT::NetworkUtils->getipaddr($nimprime);
|
||||
my $snodeip = xCAT::NetworkUtils->getipaddr($snode);
|
||||
if ($nimprimeip ne $snodeip) {
|
||||
$doSN++;
|
||||
}
|
||||
|
||||
# get the location for the new resource
|
||||
my $loc;
|
||||
if ($::opt_l)
|
||||
{
|
||||
@@ -5321,13 +5353,40 @@ sub mk_mksysb
|
||||
$loc = "$install_dir/nim/mksysb/$::image_name";
|
||||
}
|
||||
|
||||
# create the nim command
|
||||
my $location = "$loc/$mksysb_name";
|
||||
my $nimcmd = "/usr/sbin/nim -Fo define -t mksysb -a server=master ";
|
||||
# check for relevant cmd line attrs
|
||||
my %cmdattrs;
|
||||
if ( ($::NFSv4) && (!$attrres{nfs_vers}) )
|
||||
{
|
||||
$cmdattrs{nfs_vers}=4;
|
||||
}
|
||||
|
||||
if (%attrres) {
|
||||
foreach my $attr (keys %attrres) {
|
||||
if (grep(/^$attr$/, @validattrs) ) {
|
||||
$cmdattrs{$attr} = $attrres{$attr};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (%cmdattrs) {
|
||||
foreach my $attr (keys %cmdattrs) {
|
||||
$nimcmd .= "-a $attr=$cmdattrs{$attr} ";
|
||||
}
|
||||
}
|
||||
|
||||
$nimcmd .= " -a location=$location -a mk_image=yes -a source=$::MKSYSBNODE $mksysb_name 2>&1";
|
||||
|
||||
# create resource location for mksysb image
|
||||
my $cmd = "/usr/bin/mkdir -p $loc";
|
||||
my $output = xCAT::Utils->runcmd("$cmd", -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
|
||||
# create a local dir on nimprime
|
||||
my $output=xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $nimprime, $cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not create $loc.\n";
|
||||
push @{$rsp->{data}}, "Could not create $loc on $nimprime.\n";
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
push @{$rsp->{data}}, "$output\n";
|
||||
@@ -5336,64 +5395,155 @@ sub mk_mksysb
|
||||
return undef;
|
||||
}
|
||||
|
||||
# check the file system space needed
|
||||
# about 1800 MB for a mksysb image???
|
||||
my $sysbsize = 1800;
|
||||
if (&chkFSspace($loc, $sysbsize, $callback) != 0)
|
||||
{
|
||||
|
||||
# error
|
||||
return undef;
|
||||
}
|
||||
# if $snode is not nimprime then create dir on snode
|
||||
if ($doSN) {
|
||||
$output=xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $snode, $cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not create $loc on $snode.\n";
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
push @{$rsp->{data}}, "$output\n";
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
my $rsp;
|
||||
push @{$rsp->{data}},
|
||||
"Creating a NIM mksysb resource called \'$mksysb_name\'. This could take a while.\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
|
||||
# create sys backup from remote node and define res
|
||||
my $location = "$loc/$mksysb_name";
|
||||
my $nimcmd = "/usr/sbin/nim -Fo define -t mksysb -a server=master ";
|
||||
|
||||
# check for relevant cmd line attrs
|
||||
my %cmdattrs;
|
||||
if ( ($::NFSv4) && (!$attrres{nfs_vers}) )
|
||||
# check if the res is already defined on $snode
|
||||
# Get a list of all defined resources
|
||||
$cmd = qq~/usr/sbin/lsnim -c resources | /usr/bin/cut -f1 -d' ' 2>/dev/null~;
|
||||
my $reslist = xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $snode, $cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
$cmdattrs{nfs_vers}=4;
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not get NIM resource definitions on $snode.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return undef;
|
||||
}
|
||||
my @nimres;
|
||||
foreach my $res (split(/\n/, $reslist )) {
|
||||
$res =~ s/$snode:\s+//;
|
||||
chomp $res;
|
||||
push @nimres, $res;
|
||||
}
|
||||
|
||||
if (%attrres) {
|
||||
foreach my $attr (keys %attrres) {
|
||||
if (grep(/^$attr$/, @validattrs) ) {
|
||||
$cmdattrs{$attr} = $attrres{$attr};
|
||||
}
|
||||
}
|
||||
if (grep(/^$mksysb_name$/, @nimres))
|
||||
{
|
||||
# error if it is
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "The $mksysb_name resource is already defined on $snode.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
# otherwise create it
|
||||
|
||||
# check the file system space needed
|
||||
# about 1800 MB for a mksysb image???
|
||||
# can't really predict how big it could be 1G, 6G ??
|
||||
# TBD - maybe check size of / on target node???
|
||||
# if (&chkFS($loc, $sysbsize, $snode, $sub_req, $callback) != 0) {
|
||||
# # error
|
||||
# my $rsp;
|
||||
# push @{$rsp->{data}}, "Insufficient space available for $loc on $snode.\n";
|
||||
# xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
# }
|
||||
|
||||
# create the mksysb image of a node - run the command on
|
||||
# the NIM master for the node
|
||||
|
||||
$output=xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $snode, $nimcmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}},
|
||||
"Could not define mksysb resource named \'$mksysb_name\' on $snode.\n";
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
push @{$rsp->{data}}, "$output\n";
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
if (%cmdattrs) {
|
||||
foreach my $attr (keys %cmdattrs) {
|
||||
$nimcmd .= "-a $attr=$cmdattrs{$attr} ";
|
||||
}
|
||||
}
|
||||
# if this service node is not the nimprime (management node)
|
||||
# then copy the mksysb to the nimprime and define it there.
|
||||
if ($doSN) { # we have a seperate SN
|
||||
|
||||
$nimcmd .= " -a location=$location -a mk_image=yes -a source=$::MKSYSBNODE $mksysb_name 2>&1";
|
||||
$output = xCAT::Utils->runcmd("$nimcmd", -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}},
|
||||
"Could not define mksysb resource named \'$mksysb_name\'.\n";
|
||||
if ($::VERBOSE)
|
||||
# check space on nimprime
|
||||
my $sysbsize = 1800;
|
||||
# can't really predict how big it could be 1G, 6G ??
|
||||
# if (&chkFS($loc, $sysbsize, $nimprime, $sub_req, $callback) != 0) {
|
||||
# # error
|
||||
# my $rsp;
|
||||
# push @{$rsp->{data}}, "Insufficient space available for $loc on $nimprime.\n";
|
||||
# xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
# }
|
||||
|
||||
# xdsh to SN and xdcp to nimprime
|
||||
my $dcpcmd = "/opt/xcat/bin/xdcp $snode -P $location $loc";
|
||||
$output=xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $nimprime, $dcpcmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
push @{$rsp->{data}}, "$output\n";
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not copy $location from $snode to $nimprime.\n";
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
push @{$rsp->{data}}, "$output\n";
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return undef;
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return undef;
|
||||
}
|
||||
|
||||
# change the file name $mksysb_name._snode -> $mksysb_name
|
||||
my $newname = "$loc/$mksysb_name";
|
||||
my $oldname = "$loc/$mksysb_name._$snode";
|
||||
my $mvcmd = "/bin/mv $oldname $newname 2>&1";
|
||||
$output=xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $nimprime, $mvcmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not rename $oldname to $newname on $nimprime.\n";
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
push @{$rsp->{data}}, "$output\n";
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return undef;
|
||||
}
|
||||
|
||||
# now define it on the nimprime
|
||||
my $mkcmd;
|
||||
if ($::NFSv4)
|
||||
{
|
||||
$mkcmd = "/usr/sbin/nim -Fo define -t mksysb -a server=master -a nfs_vers=4 -a location=$location $mksysb_name 2>&1";
|
||||
}
|
||||
else
|
||||
{
|
||||
$mkcmd = "/usr/sbin/nim -Fo define -t mksysb -a server=master -a location=$location $mksysb_name 2>&1";
|
||||
}
|
||||
$output=xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $nimprime, $mkcmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not define mksysb resource named \'$mksysb_name\' on $nimprime.\n";
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
push @{$rsp->{data}}, "$output\n";
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($::SYSB)
|
||||
{
|
||||
# we have a mksysb file - so just define the NIM resource
|
||||
if ($::SYSB !~ /^\//)
|
||||
{ #relative path
|
||||
$::SYSB = xCAT::Utils->full_path($::SYSB, $::cwd);
|
||||
@@ -5790,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;
|
||||
@@ -5862,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;
|
||||
}
|
||||
|
||||
@@ -5916,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);
|
||||
}
|
||||
}
|
||||
@@ -6592,6 +6740,77 @@ sub chkFSspace
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head3 chkFS
|
||||
|
||||
See if there is enough space in file systems. If not try to increase
|
||||
the size. (Works for remote systems)
|
||||
|
||||
Arguments:
|
||||
Returns:
|
||||
0 - OK
|
||||
1 - error
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub chkFS
|
||||
{
|
||||
my $location = shift;
|
||||
my $size = shift;
|
||||
my $target = shift;
|
||||
my $sub_req = shift;
|
||||
my $callback = shift;
|
||||
|
||||
# get free space
|
||||
# ex. 1971.06 (Free MB)
|
||||
my $dfcmd = qq~/usr/bin/df -m $location | /usr/bin/awk '(NR==2){print \$3":"\$7}'~;
|
||||
|
||||
my $output = xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $target, $dfcmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not run: \'$dfcmd\' on $target.\n";
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
push @{$rsp->{data}}, "$output";
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# strip off target name if any
|
||||
$output =~ s/$target:\s+//;
|
||||
my ($free_space, $FSname) = split(':', $output);
|
||||
|
||||
#
|
||||
# see if we need to increase the size of the fs
|
||||
#
|
||||
my $space_needed;
|
||||
if ($size >= $free_space)
|
||||
{
|
||||
$space_needed = int($size - $free_space);
|
||||
my $addsize = $space_needed + 100;
|
||||
my $sizeattr = "-a size=+$addsize" . "M";
|
||||
my $chcmd = "/usr/sbin/chfs $sizeattr $FSname";
|
||||
|
||||
my $output;
|
||||
$output = xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $target, $chcmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not increase file system size for \'$FSname\' on $target. Additonal $addsize MB is needed.\n";
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
push @{$rsp->{data}}, "$output";
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head3 enoughspace
|
||||
|
||||
See if the NIM root resource has enough space to initialize
|
||||
@@ -10897,14 +11116,12 @@ sub mkdsklsnode
|
||||
#
|
||||
# See if we need to create a resolv_conf resource
|
||||
#
|
||||
my $RChash;
|
||||
$RChash = &chk_resolv_conf($callback, \%objhash, \@nodelist, \%nethash, \%imagehash, \%attrs, \%nodeosi, $subreq);
|
||||
if ( !$RChash ){
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not check NIM resolv_conf resource.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
my %resolv_conf_hash = &chk_resolv_conf($callback, \%objhash, \@nodelist, \%nethash, \%imagehash, \%attrs, \%nodeosi, $subreq);
|
||||
if ( !%resolv_conf_hash ){
|
||||
# my $rsp;
|
||||
# push @{$rsp->{data}}, "Could not check NIM resolv_conf resource.\n";
|
||||
# xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
}
|
||||
my %resolv_conf_hash = %{$RChash};
|
||||
|
||||
#
|
||||
# define and initialize the diskless/dataless nodes
|
||||
@@ -12590,14 +12807,13 @@ sub checkNIMnetworks
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return 1;
|
||||
}
|
||||
$ifone =~ s/$target:\s+//;
|
||||
chomp $ifone;
|
||||
|
||||
my $junk1;
|
||||
my $junk2;
|
||||
my $adapterhost;
|
||||
my @ifcontent = split('\n',$ifone);
|
||||
foreach my $line (@ifcontent) {
|
||||
$line =~ s/$target:\s+//;
|
||||
next if ($line =~ /^#/);
|
||||
($junk1, $junk2, $adapterhost) = split(':', $line);
|
||||
last;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -607,7 +607,10 @@ sub mknetboot
|
||||
} elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
|
||||
$useifname=1;
|
||||
$kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":";
|
||||
}
|
||||
}elsif($osver =~ /^rhels5/ and $arch=~/^ppc/){
|
||||
#for rhels5-ppc, is we specify installnic="mac",boot device cannot be found during netboot
|
||||
$useifname=1;
|
||||
}
|
||||
#else { #no, we autodetect and don't presume anything
|
||||
# $kcmdline .="eth0:";
|
||||
# print "eth0 is used as the default booting network devices...\n";
|
||||
|
||||
@@ -43,6 +43,7 @@ use Getopt::Long;
|
||||
use xCAT::SvrUtils;
|
||||
use xCAT::FSPUtils;
|
||||
my $indiscover=0;
|
||||
my $vitals_info = undef; #used by 'rvitals <node> all' to show lcds info for Firebird blade
|
||||
|
||||
sub handled_commands {
|
||||
return {
|
||||
@@ -54,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',
|
||||
@@ -399,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
|
||||
@@ -873,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/) {
|
||||
@@ -1482,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";
|
||||
|
||||
@@ -1562,10 +1575,23 @@ sub rscan {
|
||||
|
||||
my ($k3,$u3);
|
||||
$k3->{node} = $name;
|
||||
my $append;
|
||||
if ($type eq "ppcblade") {
|
||||
$u3->{groups} = "blade,all";
|
||||
$append = "blade";
|
||||
} else {
|
||||
$u3->{groups} = $type.",all";
|
||||
$append = $type;
|
||||
}
|
||||
$u3->{groups} = $append.",all";
|
||||
my $tmp_groups = $db{nodelist}->getNodeAttribs($name,['groups']);
|
||||
if (defined($tmp_groups) and defined($tmp_groups->{groups})) {
|
||||
$u3->{groups} = $tmp_groups->{groups};
|
||||
my @groups_array = split /,/,$tmp_groups->{groups};
|
||||
if (!grep(/^$append$/, @groups_array)) {
|
||||
$u3->{groups} .= ",$append";
|
||||
}
|
||||
if (!grep(/^all$/, @groups_array)) {
|
||||
$u3->{groups} .= ",all";
|
||||
}
|
||||
}
|
||||
$db{nodelist}->setAttribs($k3,$u3);
|
||||
$db{nodelist}{commit} = 1;
|
||||
@@ -1703,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++];
|
||||
@@ -2207,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",
|
||||
@@ -2225,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,
|
||||
@@ -2257,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,
|
||||
@@ -2273,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
|
||||
@@ -2311,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;
|
||||
@@ -2347,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.");
|
||||
@@ -2426,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";
|
||||
@@ -2442,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";
|
||||
@@ -2476,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") {
|
||||
@@ -2515,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";
|
||||
@@ -2579,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";
|
||||
@@ -2764,6 +3019,8 @@ sub renergy {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return (1, "$item is NOT a valid attribute..");
|
||||
}
|
||||
|
||||
push @output, "$item: Set operation succeeded.";
|
||||
@@ -3253,7 +3510,26 @@ sub bladecmd {
|
||||
} elsif ($command eq "rpower") {
|
||||
return power(@args);
|
||||
} elsif ($command eq "rvitals") {
|
||||
return vitals(@args);
|
||||
my ($rc, @result) = vitals(@args);
|
||||
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 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);
|
||||
if ($data =~ /1\|(\w[\w\s]*)/) {
|
||||
push @result, "Current LCD: $1";
|
||||
} else {
|
||||
push @result, "Current LCD: blank";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ($rc, @result);
|
||||
#return vitals(@args);
|
||||
} elsif ($command =~ /r[ms]preset/) {
|
||||
return resetmp(@args);
|
||||
} elsif ($command eq "rspconfig") {
|
||||
@@ -3601,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"});
|
||||
}
|
||||
@@ -3639,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"});
|
||||
}
|
||||
@@ -3678,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"]});
|
||||
@@ -3690,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";}
|
||||
}
|
||||
|
||||
@@ -3722,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;
|
||||
@@ -3819,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";}
|
||||
}
|
||||
|
||||
@@ -4144,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'};
|
||||
}
|
||||
@@ -4250,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; }
|
||||
@@ -4264,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;
|
||||
}
|
||||
@@ -4411,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)) {
|
||||
@@ -4433,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;
|
||||
}
|
||||
@@ -4514,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);
|
||||
@@ -4753,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)"]);
|
||||
@@ -4790,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);
|
||||
|
||||
@@ -5207,7 +5437,7 @@ sub dompa {
|
||||
}
|
||||
# Only telnet commands
|
||||
unless ( @$args ) {
|
||||
if($command ne "getmacs"){
|
||||
if(($command ne "getmacs")&& ($command ne "rbeacon")){
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -5304,7 +5534,11 @@ sub dompa {
|
||||
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($command eq "rvitals") {
|
||||
if ((scalar(@$args) ==1 and $args->[0] eq '') or grep (/all/,@$args)) {
|
||||
$vitals_info = &get_blades_for_mpa($mpa);
|
||||
}
|
||||
}
|
||||
|
||||
foreach $node (sort (keys %{$mpahash->{$mpa}->{nodes}})) {
|
||||
$curn = $node;
|
||||
|
||||
@@ -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
|
||||
##########################################################################
|
||||
|
||||
@@ -64,6 +64,7 @@ sub process_request {
|
||||
my $permission; #the permission works only for statelite mode currently
|
||||
my $krpmver;
|
||||
my $interactive;
|
||||
my $onlyinitrd;
|
||||
my $tempfile;
|
||||
|
||||
GetOptions(
|
||||
@@ -81,6 +82,7 @@ sub process_request {
|
||||
'kerneldir=s' => \$kerneldir,
|
||||
'permission=s' => \$permission,
|
||||
'interactive' => \$interactive,
|
||||
'onlyinitrd' => \$onlyinitrd,
|
||||
'tempfile=s' => \$tempfile,
|
||||
);
|
||||
|
||||
@@ -285,8 +287,9 @@ sub process_request {
|
||||
if ($mode) { $cmd .= " -m $mode";}
|
||||
if ($permission) { $cmd .= " --permission $permission"; }
|
||||
if ($kerneldir) { $cmd .= " --kerneldir $kerneldir"; }
|
||||
if ($interactive) { $cmd .= " --interactive" }
|
||||
|
||||
if ($interactive) { $cmd .= " --interactive"; }
|
||||
if ($onlyinitrd) { $cmd .= " --onlyinitrd"; }
|
||||
|
||||
if ($srcdir) { $cmd .= " --srcdir $srcdir";}
|
||||
if ($pkglist) { $cmd .= " --pkglist $pkglist";}
|
||||
if ($srcdir_otherpkgs) { $cmd .= " --otherpkgdir $srcdir_otherpkgs"; }
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -19,7 +19,7 @@ use xCAT::IPMI;
|
||||
my %needbladeinv;
|
||||
|
||||
use POSIX qw(ceil floor);
|
||||
use Storable qw(store_fd retrieve_fd thaw freeze);
|
||||
use Storable qw(nstore_fd retrieve_fd thaw freeze);
|
||||
use xCAT::Utils;
|
||||
use xCAT::SvrUtils;
|
||||
use xCAT::Usage;
|
||||
@@ -29,7 +29,7 @@ use HTTP::Request::Common;
|
||||
my $iem_support;
|
||||
my $vpdhash;
|
||||
my %allerrornodes=();
|
||||
my $immdetected=0;
|
||||
my $global_sessdata;
|
||||
|
||||
eval {
|
||||
require IBM::EnergyManager;
|
||||
@@ -92,7 +92,7 @@ my $cache_dir = "/var/cache/xcat";
|
||||
use xCAT::data::ibmleds;
|
||||
use xCAT::data::ipmigenericevents;
|
||||
use xCAT::data::ipmisensorevents;
|
||||
my $cache_version = 3;
|
||||
my $cache_version = 4;
|
||||
my %sdr_caches; #store sdr cachecs in memory indexed such that identical nodes do not hit the disk multiple times
|
||||
|
||||
#my $status_noop="XXXno-opXXX";
|
||||
@@ -327,6 +327,7 @@ struct SDR => {
|
||||
led_id => '$',
|
||||
fru_type => '$',
|
||||
fru_subtype => '$',
|
||||
fru_oem => '$',
|
||||
};
|
||||
|
||||
struct FRU => {
|
||||
@@ -354,6 +355,7 @@ sub decode_fru_locator { #Handle fru locator records
|
||||
$sdr->id_string(pack("C*",@locator[17..17+$idlen-1]));
|
||||
$sdr->fru_type($locator[11]);
|
||||
$sdr->fru_subtype($locator[12]);
|
||||
$sdr->fru_oem($locator[15]);
|
||||
|
||||
return $sdr;
|
||||
}
|
||||
@@ -1491,7 +1493,7 @@ sub inv {
|
||||
$subcommand = "all";
|
||||
}
|
||||
if($subcommand eq "all") {
|
||||
@types = qw(model serial deviceid mprom guid misc hw asset firmware mac);
|
||||
@types = qw(model serial deviceid mprom guid misc hw asset firmware mac wwn);
|
||||
}
|
||||
elsif($subcommand eq "asset") {
|
||||
$sessdata->{skipotherfru}=1;
|
||||
@@ -1568,6 +1570,7 @@ sub add_textual_fru {
|
||||
my $subcategory = shift;
|
||||
my $types = shift;
|
||||
my $sessdata = shift;
|
||||
my %args = @_;
|
||||
|
||||
if ($parsedfru->{$category} and $parsedfru->{$category}->{$subcategory}) {
|
||||
my $fru;
|
||||
@@ -1578,10 +1581,16 @@ sub add_textual_fru {
|
||||
} else {
|
||||
@subfrus = ($parsedfru->{$category}->{$subcategory})
|
||||
}
|
||||
my $index=0;
|
||||
foreach (@subfrus) {
|
||||
$index++;
|
||||
$fru = FRU->new();
|
||||
$fru->rec_type($types);
|
||||
if ($args{addnumber}) {
|
||||
$fru->desc($description." ".$index);
|
||||
} else {
|
||||
$fru->desc($description);
|
||||
}
|
||||
if (not ref $_) {
|
||||
$fru->value($_);
|
||||
} else {
|
||||
@@ -1608,7 +1617,10 @@ sub add_textual_frus {
|
||||
add_textual_fru($parsedfru,$desc." ".$categorydesc."Part Number",$category,"partnumber",$type,$sessdata);
|
||||
add_textual_fru($parsedfru,$desc." ".$categorydesc."Manufacturer",$category,"manufacturer",$type,$sessdata);
|
||||
add_textual_fru($parsedfru,$desc." ".$categorydesc."Serial Number",$category,"serialnumber",$type,$sessdata);
|
||||
add_textual_fru($parsedfru,$desc." ".$categorydesc."FRU Number",$category,"frunum",$type,$sessdata);
|
||||
add_textual_fru($parsedfru,$desc." ".$categorydesc."Version",$category,"version",$type,$sessdata);
|
||||
add_textual_fru($parsedfru,$desc." ".$categorydesc."MAC Address",$category,"macaddrs","mac",$sessdata,addnumber=>1);
|
||||
add_textual_fru($parsedfru,$desc." ".$categorydesc."WWN",$category,"wwns","wwn",$sessdata,addnumber=>1);
|
||||
add_textual_fru($parsedfru,$desc." ".$categorydesc."",$category,"name",$type,$sessdata);
|
||||
if ($parsedfru->{$category}->{builddate}) {
|
||||
add_textual_fru($parsedfru,$desc." ".$categorydesc."Manufacture Date",$category,"builddate",$type,$sessdata);
|
||||
@@ -1686,8 +1698,8 @@ sub got_bmc_fw_info {
|
||||
$sessdata->{fru_hash}->{mprom} = $fru;
|
||||
$sessdata->{isanimm}=$isanimm;
|
||||
if ($isanimm) {
|
||||
#$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0,0,0,0],callback=>\&get_uefi_version_with_fmapi,callback_args=>$sessdata);
|
||||
get_imm_property(property=>"/v2/bios/build_id",callback=>\&got_bios_buildid,sessdata=>$sessdata);
|
||||
#get_imm_property(property=>"/v2/bios/build_id",callback=>\&got_bios_buildid,sessdata=>$sessdata);
|
||||
check_for_ite(sessdata=>$sessdata);
|
||||
} else {
|
||||
initfru_with_mprom($sessdata);
|
||||
}
|
||||
@@ -1760,6 +1772,32 @@ sub got_fpga_date {
|
||||
}
|
||||
initfru_with_mprom($sessdata);
|
||||
}
|
||||
sub check_for_ite {
|
||||
my %args = @_;
|
||||
my @getpropertycommand;
|
||||
my $sessdata = $args{sessdata};
|
||||
$sessdata->{property_callback} = \&got_ite_check; #$args{callback};
|
||||
@getpropertycommand = unpack("C*","/v2/cmm/");
|
||||
my $length = 0b10000000 | (scalar @getpropertycommand);#use length to store tlv
|
||||
unshift @getpropertycommand,$length;
|
||||
#command also needs the overall length
|
||||
$length = (scalar @getpropertycommand);
|
||||
unshift @getpropertycommand,0; #do not recurse, though it's not going to matter anyway since we are just checking for the existence of the category
|
||||
unshift @getpropertycommand,$length&0xff;
|
||||
unshift @getpropertycommand,($length>>8)&0xff;
|
||||
unshift @getpropertycommand,2; #get all properties command,
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xc4,data=>\@getpropertycommand,callback=>\&got_imm_property,callback_args=>$sessdata);
|
||||
}
|
||||
sub got_ite_check {
|
||||
my %res = @_;
|
||||
my $sessdata = $res{sessdata};
|
||||
if ($res{ccode} == 9) { #success, end of tree means an ITE, remember this
|
||||
$sessdata->{isite}=1;
|
||||
} else {
|
||||
$sessdata->{isite}=0;
|
||||
}
|
||||
get_imm_property(property=>"/v2/bios/build_id",callback=>\&got_bios_buildid,sessdata=>$sessdata);
|
||||
}
|
||||
sub get_imm_property {
|
||||
my %args = @_;
|
||||
my @getpropertycommand;
|
||||
@@ -1774,7 +1812,6 @@ sub get_imm_property {
|
||||
unshift @getpropertycommand,($length>>8)&0xff;
|
||||
unshift @getpropertycommand,0; #the actual 'get proprety' command is 0.
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xc4,data=>\@getpropertycommand,callback=>\&got_imm_property,callback_args=>$sessdata);
|
||||
|
||||
}
|
||||
sub got_imm_property {
|
||||
if (check_rsp_errors(@_)) {
|
||||
@@ -1786,6 +1823,7 @@ sub got_imm_property {
|
||||
my $propval = shift @data;
|
||||
my %res;
|
||||
$res{sessdata}=$sessdata;
|
||||
$res{ccode}=$propval;
|
||||
if ($propval == 0) { #success
|
||||
shift @data; #discard payload size
|
||||
shift @data; #discard payload size
|
||||
@@ -1800,121 +1838,6 @@ sub got_imm_property {
|
||||
}
|
||||
$sessdata->{property_callback}->(%res);
|
||||
}
|
||||
sub get_uefi_version_with_fmapi {
|
||||
if (check_rsp_errors(@_)) {
|
||||
return;
|
||||
}
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
my @data = @{$rsp->{data}};
|
||||
unless ($data[2] == 0 and $data[3] = 3 and $data[4]==0x12 and $data[5]==2) { #we support this major version only
|
||||
initfru_with_mprom($sessdata);
|
||||
return;
|
||||
}
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[1,0,0,5,0x84,0x62,0x69,0x6f,0x73],callback=>\&get_uefi_version_with_xid,callback_args=>$sessdata);
|
||||
}
|
||||
|
||||
sub get_uefi_version_with_xid {
|
||||
if (check_rsp_errors(@_)) {
|
||||
return;
|
||||
}
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
my @data = @{$rsp->{data}};
|
||||
if ($data[2] != 0 or $data[3] != 5 or $data[4] != 0x44) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Error1 retrieving UEFI build version"],$callback,$sessdata->{node},%allerrornodes);
|
||||
return;
|
||||
}
|
||||
splice @data,0,5;
|
||||
$sessdata->{fmapixid} = \@data;
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[3,0,0,0xa,0x44,@{$sessdata->{fmapixid}},0x84,0x62,0x69,0x6f,0x73],callback=>\&waitfor_openxid,callback_args=>$sessdata);
|
||||
}
|
||||
|
||||
sub waitfor_openxid {
|
||||
if (check_rsp_errors(@_)) {
|
||||
return;
|
||||
}
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
my @data = @{$rsp->{data}};
|
||||
if ($data[2] != 0) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Error2 retrieving UEFI build version"],$callback,$sessdata->{node},%allerrornodes);
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0x4,0,0,0x05,0x44,@{$sessdata->{fmapixid}}],callback=>\&fmapi_xid_closed,callback_args=>$sessdata);
|
||||
return;
|
||||
}
|
||||
if ((scalar @data) > 4 and $data[5] == 0x40) { #ready to proceed
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0xa,0,0,0xf,0x44,@{$sessdata->{fmapixid}},0x87,0x62,0x75,0x69,0x6C,0x64,0x69,0x64,0x11,0x52],callback=>\&got_uefi_buildid,callback_args=>$sessdata);
|
||||
} else {
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0x9,0,0,0x5,0x44,@{$sessdata->{fmapixid}}],callback=>\&waitfor_openxid,callback_args=>$sessdata);
|
||||
}
|
||||
}
|
||||
sub got_uefi_buildid {
|
||||
if (check_rsp_errors(@_)) {
|
||||
return;
|
||||
}
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
my @data = @{$rsp->{data}};
|
||||
if ($data[2] != 0) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Error3 retrieving UEFI build version"],$callback,$sessdata->{node},%allerrornodes);
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0x4,0,0,0x05,0x44,@{$sessdata->{fmapixid}}],callback=>\&fmapi_xid_closed,callback_args=>$sessdata);
|
||||
return;
|
||||
}
|
||||
my $buildsize = $data[4]&0x7f;
|
||||
my @buildid = splice @data,5,$buildsize;
|
||||
$sessdata->{biosbuildid} = pack("C*",@buildid);
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0xa,0,0,0x14,0x44,@{$sessdata->{fmapixid}},0x8c,0x62,0x75,0x69,0x6C,0x64,0x76,0x65,0x72,0x73,0x69,0x6F,0x6E,0x11,0x52],callback=>\&got_uefi_buildversion,callback_args=>$sessdata);
|
||||
}
|
||||
sub got_uefi_buildversion {
|
||||
if (check_rsp_errors(@_)) {
|
||||
return;
|
||||
}
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
my @data = @{$rsp->{data}};
|
||||
if ($data[2] != 0) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Error4 retrieving UEFI build version"],$callback,$sessdata->{node},%allerrornodes);
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0x4,0,0,0x05,0x44,@{$sessdata->{fmapixid}}],callback=>\&fmapi_xid_closed,callback_args=>$sessdata);
|
||||
return;
|
||||
}
|
||||
my $buildsize = $data[4]&0x7f;
|
||||
my @buildid = splice @data,5,$buildsize;
|
||||
$sessdata->{biosbuildversion} = pack("C*",@buildid);
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0xa,0,0,0x11,0x44,@{$sessdata->{fmapixid}},0x89,0x62,0x75,0x69,0x6C,0x64,0x64,0x61,0x74,0x65,0x11,0x52],callback=>\&got_uefi_builddate,callback_args=>$sessdata);
|
||||
}
|
||||
sub got_uefi_builddate {
|
||||
if (check_rsp_errors(@_)) {
|
||||
return;
|
||||
}
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
my @data = @{$rsp->{data}};
|
||||
if ($data[2] != 0) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Error5 retrieving UEFI build version"],$callback,$sessdata->{node},%allerrornodes);
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0x4,0,0,0x05,0x44,@{$sessdata->{fmapixid}}],callback=>\&fmapi_xid_closed,callback_args=>$sessdata);
|
||||
return;
|
||||
}
|
||||
my $buildsize = $data[4]&0x7f;
|
||||
my @buildid = splice @data,5,$buildsize;
|
||||
$sessdata->{biosbuilddate} = pack("C*",@buildid);
|
||||
my $bver = $sessdata->{biosbuildversion}." (".$sessdata->{biosbuildid}." ".$sessdata->{biosbuilddate}.")";
|
||||
my $fru = FRU->new();
|
||||
$fru->rec_type("bios,uefi,firmware");
|
||||
$fru->desc("UEFI Version");
|
||||
$fru->value($bver);
|
||||
$sessdata->{fru_hash}->{uefi} = $fru;
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0x4,0,0,0x05,0x44,@{$sessdata->{fmapixid}}],callback=>\&fmapi_xid_closed,callback_args=>$sessdata);
|
||||
}
|
||||
sub fmapi_xid_closed {
|
||||
my $rsp = shift;
|
||||
my $sessdata=shift;
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0xf0,data=>[0x2,0,0,0x05,0x44,@{$sessdata->{fmapixid}}],callback=>\&fmapi_xid_destroyed,callback_args=>$sessdata);
|
||||
}
|
||||
sub fmapi_xid_destroyed {
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
initfru_with_mprom($sessdata);
|
||||
}
|
||||
|
||||
sub initfru_withguid {
|
||||
my $sessdata = shift;
|
||||
@@ -2136,6 +2059,17 @@ sub initfru_zero {
|
||||
$sessdata->{fru_hash}->{$frudex++} = $fru;
|
||||
}
|
||||
}
|
||||
if ($fruhash->{board}->{wwns}) {
|
||||
my $macindex=1;
|
||||
foreach my $mac (@{$fruhash->{board}->{wwns}}) {
|
||||
$fru = FRU->new();
|
||||
$fru->rec_type("wwn");
|
||||
$fru->desc("WWN $macindex");
|
||||
$macindex++;
|
||||
$fru->value($mac);
|
||||
$sessdata->{fru_hash}->{$frudex++} = $fru;
|
||||
}
|
||||
}
|
||||
if ($fruhash->{board}->{name}->{value}) {
|
||||
$fru = FRU->new();
|
||||
$fru->rec_type("misc");
|
||||
@@ -2447,9 +2381,9 @@ sub add_fruhash {
|
||||
$fruhash = decode_spd(@{$sessdata->{currfrudata}});
|
||||
} else {
|
||||
my $err;
|
||||
$immdetected=$sessdata->{isanimm}; #pass by global, evil, but practical this time
|
||||
$global_sessdata=$sessdata; #pass by global, evil, but practical this time
|
||||
($err,$fruhash) = parsefru($sessdata->{currfrudata});
|
||||
$immdetected=0; #revert state of global
|
||||
$global_sessdata=undef; #revert state of global
|
||||
if ($err) {
|
||||
my $fru = FRU->new();
|
||||
if ($sessdata->{currfrutype} and $sessdata->{currfrutype} eq 'dimm') {
|
||||
@@ -2520,7 +2454,22 @@ sub readcurrfrudevice {
|
||||
shift @data;
|
||||
push @{$sessdata->{currfrudata}},@data;
|
||||
if ($sessdata->{currfrudone}) {
|
||||
add_fruhash($sessdata);
|
||||
if ($sessdata->{isite}) {
|
||||
#IBM OEM command, d0,51,0 further qualifies the command name, we'll first take a stop at block 0, offset 2, one byte, to get VPD version number
|
||||
#command structured as:
|
||||
#d0,51,0 = command set identifier
|
||||
#lsb of offset
|
||||
#msb of offset
|
||||
#address type (1 for fru id)
|
||||
#address (fru id for our use)
|
||||
#1 - fixed value
|
||||
#lsb - size
|
||||
#msb - size
|
||||
#vpd_base_specivication_ver2.x
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,0x2,0x0,1,$sessdata->{currfruid},1,1,0],callback=>\&got_vpd_version,callback_args=>$sessdata);
|
||||
} else {
|
||||
add_fruhash($sessdata);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2537,6 +2486,94 @@ sub readcurrfrudevice {
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0xa,command=>0x11,data=>[$sessdata->{currfruid},$ls,$ms,$chunk],callback=>\&readcurrfrudevice,callback_args=>$sessdata);
|
||||
}
|
||||
|
||||
sub got_vpd_version {
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
unless ($rsp and not $rsp->{error} and $rsp->{code} == 0 and $rsp->{data}->[5] == 2) { #unless the query was successful and major vpd version was 2
|
||||
#short over to adding the fru hash as-is
|
||||
add_fruhash($sessdata);
|
||||
return;
|
||||
}
|
||||
#making it this far, we have affirmative confirmation of ibm oem vpd data, time to chase component mac, wwpn, and maybe mezz firmware
|
||||
#will need:
|
||||
# block 0, offset 0c8h use the offset to add to block 1 offsets (usually 400h), denoting as $blone
|
||||
# block 1, $blone+6 - 216 bytes: 6 sets of 36 byte version information (TODO)
|
||||
# block 1, $blone+0x1d0: port type first 4 bits protocol, last 3 bits addressing
|
||||
# block 1, $blone+0x240: 64 bytes, up to 8 sets of addresses, mac is left aligned
|
||||
# block 1, $blone+0x300: if mac+wwn, grab wwn
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,0xc8,0x0,1,$sessdata->{currfruid},1,2,0],callback=>\&got_vpd_block1,callback_args=>$sessdata);
|
||||
}
|
||||
sub got_vpd_block1 {
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
unless ($rsp and not $rsp->{error} and $rsp->{code} == 0) { # if this should go wonky, jump ahead
|
||||
add_fruhash($sessdata);
|
||||
return;
|
||||
}
|
||||
$sessdata->{vpdblock1offset}=$rsp->{data}->[5]<<8+$rsp->{data}->[6];
|
||||
my $ptoffset = $sessdata->{vpdblock1offset} + 0x1d0;
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,$ptoffset&0xff,$ptoffset>>8,1,$sessdata->{currfruid},1,1,0],callback=>\&got_portaddr_type,callback_args=>$sessdata);
|
||||
}
|
||||
sub got_portaddr_type {
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
unless ($rsp and not $rsp->{error} and $rsp->{code} == 0) { # if this should go wonky, jump ahead
|
||||
add_fruhash($sessdata);
|
||||
return;
|
||||
}
|
||||
my $addrtype = $rsp->{data}->[5] & 0b111;
|
||||
if ($addrtype == 0b101) {
|
||||
$sessdata->{needmultiaddr}=1;
|
||||
$sessdata->{curraddrtype}="mac";
|
||||
} elsif ($addrtype == 0b1) {
|
||||
$sessdata->{curraddrtype}="mac";
|
||||
} elsif ($addrtype == 0b10) {
|
||||
$sessdata->{curraddrtype}="wwn";
|
||||
} else { #for now, skip polling addresses I haven't examined directly
|
||||
add_fruhash($sessdata);
|
||||
return;
|
||||
}
|
||||
my $addroffset = $sessdata->{vpdblock1offset} + 0x240;
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,$addroffset&0xff,$addroffset>>8,1,$sessdata->{currfruid},1,64,0],callback=>\&got_vpd_addresses,callback_args=>$sessdata);
|
||||
|
||||
|
||||
}
|
||||
sub got_vpd_addresses {
|
||||
my $rsp = shift;
|
||||
my $sessdata = shift;
|
||||
unless ($rsp and not $rsp->{error} and $rsp->{code} == 0) { # if this should go wonky, jump ahead
|
||||
add_fruhash($sessdata);
|
||||
return;
|
||||
}
|
||||
my @addrdata = @{$rsp->{data}};
|
||||
splice @addrdata,0,5; # remove the header info
|
||||
my $macstring = "1";
|
||||
while ($macstring !~ /^00:00:00:00:00:00/) {
|
||||
my @currmac = splice @addrdata,0,8;
|
||||
unless ((scalar @currmac) == 8) {
|
||||
last;
|
||||
}
|
||||
$macstring = sprintf("%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",@currmac);
|
||||
if ($macstring =~ /^00:00:00:00:00:00:00:00/) {
|
||||
last;
|
||||
}
|
||||
if ($sessdata->{curraddrtype} eq "mac") {
|
||||
$macstring =~ s/:..:..$//;
|
||||
push @{$sessdata->{currmacs}},$macstring;
|
||||
} elsif ($sessdata->{curraddrtype} eq "wwn") {
|
||||
push @{$sessdata->{currwwns}},$macstring;
|
||||
}
|
||||
}
|
||||
if ($sessdata->{needmultiaddr}) {
|
||||
$sessdata->{needmultiaddr}=0;
|
||||
$sessdata->{curraddrtype}="wwn";
|
||||
my $addroffset = $sessdata->{vpdblock1offset} + 0x300;
|
||||
$sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,$addroffset&0xff,$addroffset>>8,1,$sessdata->{currfruid},1,64,0],callback=>\&got_vpd_addresses,callback_args=>$sessdata);
|
||||
return;
|
||||
}
|
||||
add_fruhash($sessdata);
|
||||
}
|
||||
|
||||
sub parsefru {
|
||||
my $bytes = shift;
|
||||
my $fruhash;
|
||||
@@ -2590,6 +2627,15 @@ sub parsefru {
|
||||
@currarea=@{$bytes}[$curridx..($curridx+$currsize-1)];
|
||||
$fruhash->{board} = parseboard(@currarea);
|
||||
}
|
||||
if (ref $global_sessdata->{currmacs}) {
|
||||
$fruhash->{board}->{macaddrs}=[];
|
||||
push @{$fruhash->{board}->{macaddrs}},@{$global_sessdata->{currmacs}};
|
||||
delete $global_sessdata->{currmacs}; # consume the accumulated mac addresses to avoid afflicting subsequent fru
|
||||
}
|
||||
if (ref $global_sessdata->{currwwns}) {
|
||||
push @{$fruhash->{board}->{wwns}},@{$global_sessdata->{currwwns}};
|
||||
delete $global_sessdata->{currwwns}; # consume wwns
|
||||
}
|
||||
if ($bytes->[4]) { #Product info area present, will probably be thoroughly modified
|
||||
$curridx=$bytes->[4]*8;
|
||||
unless ($bytes->[$curridx]==1) {
|
||||
@@ -2772,13 +2818,13 @@ sub parseboard {
|
||||
$idx+=$currsize;
|
||||
($currsize,$currdata,$encode)=extractfield(\@area,$idx);
|
||||
}
|
||||
if ($immdetected) { #we can understand more specifically some of the extra fields...
|
||||
if ($global_sessdata->{isanimm}) { #we can understand more specifically some of the extra fields...
|
||||
$boardinf{frunum}=$boardinf{extra}->[0]->{value};
|
||||
$boardinf{revision}=$boardinf{extra}->[4]->{value};
|
||||
#time to process the mac field...
|
||||
my $macdata = $boardinf{extra}->[6]->{value};
|
||||
my $macstring = "1";
|
||||
while ($macstring !~ /00:00:00:00:00:00/) {
|
||||
while ($macstring !~ /00:00:00:00:00:00/ and not ref $global_sessdata->{currmacs}) {
|
||||
my @currmac = splice @$macdata,0,6;
|
||||
unless ((scalar @currmac) == 6) {
|
||||
last;
|
||||
@@ -2789,7 +2835,7 @@ sub parseboard {
|
||||
}
|
||||
}
|
||||
delete $boardinf{extra};
|
||||
}
|
||||
}
|
||||
return \%boardinf;
|
||||
}
|
||||
sub parsechassis {
|
||||
@@ -4988,17 +5034,17 @@ sub initsdr_withrepinfo {
|
||||
my $fw_rev2=$sessdata->{firmware_rev2};
|
||||
#TODO: beware of dynamic SDR contents
|
||||
|
||||
my $cache_file = "$cache_dir/sdr_$mfg_id.$prod_id.$device_id.$dev_rev.$fw_rev1.$fw_rev2.$cache_version";
|
||||
my $cache_file = "$cache_dir/sdr_$mfg_id.$prod_id.$device_id.$dev_rev.$fw_rev1.$fw_rev2";
|
||||
$sessdata->{sdrcache_file} = $cache_file;
|
||||
if($enable_cache eq "yes") {
|
||||
if ($sdr_caches{"$mfg_id.$prod_id.$device_id.$dev_rev.$fw_rev1.$fw_rev2.$cache_version"}) {
|
||||
$sessdata->{sdr_hash} = $sdr_caches{"$mfg_id.$prod_id.$device_id.$dev_rev.$fw_rev1.$fw_rev2.$cache_version"};
|
||||
if ($sdr_caches{"$mfg_id.$prod_id.$device_id.$dev_rev.$fw_rev1.$fw_rev2"}) {
|
||||
$sessdata->{sdr_hash} = $sdr_caches{"$mfg_id.$prod_id.$device_id.$dev_rev.$fw_rev1.$fw_rev2"};
|
||||
on_bmc_connect("SUCCESS",$sessdata); #retry bmc_connect since sdr_cache is validated
|
||||
return; #don't proceed to slow load
|
||||
} else {
|
||||
my $rc = loadsdrcache($sessdata,$cache_file);
|
||||
if($rc == 0) {
|
||||
$sdr_caches{"$mfg_id.$prod_id.$device_id.$dev_rev.$fw_rev1.$fw_rev2.$cache_version"} = $sessdata->{sdr_hash};
|
||||
$sdr_caches{"$mfg_id.$prod_id.$device_id.$dev_rev.$fw_rev1.$fw_rev2"} = $sessdata->{sdr_hash};
|
||||
on_bmc_connect("SUCCESS",$sessdata); #retry bmc_connect since sdr_cache is validated
|
||||
return; #don't proceed to slow load
|
||||
}
|
||||
@@ -5092,7 +5138,7 @@ sub start_sdr_record {
|
||||
return;
|
||||
}
|
||||
|
||||
$sessdata->{sdr_data} = [0,0,0,$sdr_ver,$sdr_type,$sessdata->{curr_sdr_len}];
|
||||
$sessdata->{sdr_data} = [0,0,0,$sdr_ver,$sdr_type,$sessdata->{curr_sdr_len}]; #seems that an extra zero is prepended to allow other code to do 1 based counting out of laziness to match our index to the spec indicated index
|
||||
$sessdata->{sdr_offset} = 5;
|
||||
my $offset=5; #why duplicate? to make for shorter typing
|
||||
my $numbytes = 22;
|
||||
@@ -5656,9 +5702,12 @@ sub storsdrcache {
|
||||
|
||||
flock($fh,LOCK_EX) || return(1);
|
||||
|
||||
my $hdr;
|
||||
$hdr->{xcat_sdrcacheversion} = $cache_version;
|
||||
nstore_fd($hdr,$fh);
|
||||
foreach $key (keys %{$sessdata->{sdr_hash}}) {
|
||||
my $r = $sessdata->{sdr_hash}->{$key};
|
||||
store_fd($r,$fh);
|
||||
nstore_fd($r,$fh);
|
||||
}
|
||||
|
||||
close($fh);
|
||||
@@ -5676,6 +5725,9 @@ sub loadsdrcache {
|
||||
if(!open($fh,"<$file")) {
|
||||
return(1);
|
||||
}
|
||||
$r = retrieve_fd($fh);
|
||||
unless ($r) { close($fh); return 1; }
|
||||
unless ($r->{xcat_sdrcacheversion} and $r->{xcat_sdrcacheversion} == $cache_version) { close($fh); return 1; } #version mismatch
|
||||
|
||||
flock($fh,LOCK_SH) || return(1);
|
||||
|
||||
@@ -5748,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);
|
||||
|
||||
|
||||
@@ -792,6 +817,7 @@ sub read_from_table {
|
||||
$::OLD_DATA_CACHE{"cec*".$parent."*".$iid} = $node if (defined $parent and defined $id);
|
||||
}elsif ($type =~ /^fsp|bpa$/) {
|
||||
$::OLD_DATA_CACHE{$type."*".$mtm."*".$sn."*".$side} = $node if (defined $mtm and defined $sn);;
|
||||
$::OLD_DATA_CACHE{$type."*".$parent."*".$id."*".$side} = $node if (defined $parent and defined $id and defined $side);
|
||||
}elsif ($type =~ /hmc/) {
|
||||
$::OLD_DATA_CACHE{"hmc*".$ip} = $node if (defined $ip);
|
||||
}else {
|
||||
@@ -965,12 +991,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 +1022,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 +1053,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 +1232,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 +1254,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 +1262,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 +1271,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 +1279,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,9 +1305,31 @@ 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
|
||||
|
||||
|
||||
trace( $request, "\n\n\nBegin to find fsp/bpa's hostname by parent and id");
|
||||
foreach my $h ( keys %outhash ) {
|
||||
if(${$outhash{$h}}{type} eq TYPE_FSP or ${$outhash{$h}}{type} eq TYPE_BPA) {
|
||||
my $tp = ${$outhash{$h}}{parent};
|
||||
my $id;
|
||||
if (${$outhash{$h}}{type} eq TYPE_FSP) {
|
||||
#$tp = 'Server-'.${$outhash{$h}}{mtm}.'-SN'.${$outhash{$h}}{serial} ;
|
||||
$id = ${$outhash{$h}}{cid};
|
||||
} elsif (${$outhash{$h}}{type} eq TYPE_BPA) {
|
||||
#$tp = 'Server-'.${$outhash{$h}}{mtm}.'-SN'.${$outhash{$h}}{serial} ;
|
||||
$id = ${$outhash{$h}}{fid};
|
||||
}
|
||||
$newhostname = $::OLD_DATA_CACHE{${$outhash{$h}}{type}."*".$tp.'*'.$id.'*'.${$outhash{$h}}{side}};
|
||||
if ($newhostname){
|
||||
${$outhash{$h}}{hostname} = $newhostname ;
|
||||
trace( $request, "$h find hostname $newhostname");
|
||||
push @matchnode, $h;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##########################################################
|
||||
# If there is -n flag, skip the matched nodes
|
||||
@@ -1250,7 +1367,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 +1758,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");
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# role, for access permission
|
||||
# domain, for user/group management
|
||||
#TODO: handle the functions base on the version
|
||||
#TODO: handle the datacenter and cluster management
|
||||
#TODO: add the support of iscsi storage domain
|
||||
|
||||
|
||||
@@ -904,6 +903,7 @@ my $display = {
|
||||
'stateless' => ["stateless"],
|
||||
'placement_policy' => ["placement_policy/affinity"],
|
||||
'memory_guaranteed' => ["memory_policy/guaranteed"],
|
||||
'host' => ["host", "id", "hosts", "/host/name"],
|
||||
},
|
||||
'templates' => {
|
||||
'memory' => ["memory"],
|
||||
@@ -1996,7 +1996,7 @@ sub mkvm {
|
||||
if ($myvment->{cpus}) {
|
||||
my ($socketnum, $corenum) = split(':', $myvment->{cpus});
|
||||
unless ($corenum) {$corenum = 1;}
|
||||
$cpuele = "<cpu><topology cores=\"$socketnum\" sockets=\"$corenum\"/></cpu>";
|
||||
$cpuele = "<cpu><topology cores=\"$corenum\" sockets=\"$socketnum\"/></cpu>";
|
||||
} elsif (!$hastpl) {
|
||||
$cpuele = "<cpu><topology cores=\"1\" sockets=\"1\"/></cpu>"
|
||||
}
|
||||
@@ -2089,92 +2089,96 @@ sub mkvm {
|
||||
}
|
||||
|
||||
#Add the disk for the vm from storage domain
|
||||
#Get the storage domain by name
|
||||
my ($sdname, $disksize, $disktype) = split(':', $myvment->{storage});
|
||||
if ($sdname) {
|
||||
if (waitforcomplete($ref_rhevm, "/api/vms/$vmid", "/vm/status/state=down", 30)) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$node: failed to waiting the vm gets to \"down\" state.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
$success = 0;
|
||||
my $sdid;
|
||||
($rc, $sdid, $stat) = search_src($ref_rhevm, "storagedomains", $sdname);
|
||||
if ($rc) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not get the storage domain $sdname.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
|
||||
if ($sdid) {
|
||||
$api = "/api/vms/$vmid/disks";
|
||||
$method = "POST";
|
||||
|
||||
# generate the content
|
||||
if ($disktype) {
|
||||
$disktype_t->setData($disktype);
|
||||
if ($disktype eq "system") {
|
||||
$diskboot_t->setData("true");
|
||||
} else {
|
||||
$diskboot_t->setData("false");
|
||||
}
|
||||
} else {
|
||||
$disktype_t->setData("system");
|
||||
$diskboot_t->setData("true");
|
||||
}
|
||||
# set the size of disk
|
||||
if ($disksize) {
|
||||
$disksize =~ s/g/000000000/i;
|
||||
$disksize =~ s/m/000000/i;
|
||||
} else {
|
||||
$disksize = "5000000000"; #5G is default
|
||||
}
|
||||
$sdid_ele->setAttribute("id", $sdid);
|
||||
$sdsize_t->setData($disksize);
|
||||
|
||||
# set the interface type and format for disk
|
||||
if ($myvment->{storagemodel}) {
|
||||
my ($iftype,$iffmt) = split(':', $myvment->{storagemodel});
|
||||
$sdif_t->setData($iftype);
|
||||
$sdfm_t->setData($iffmt);
|
||||
} else {
|
||||
$sdif_t->setData("virtio");
|
||||
$sdfm_t->setData("cow");
|
||||
}
|
||||
|
||||
$request = genreq($ref_rhevm, $method, $api, $adds->toString());
|
||||
($rc, $response) = send_req($ref_rhevm, $request->as_string());
|
||||
if (!$rc) {
|
||||
my $parser = XML::LibXML->new();
|
||||
my $doc = $parser->parse_string($response);
|
||||
if (defined($doc->findnodes("/fault")->[0])) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$node: Add disk failed for virtual machine";
|
||||
if ($doc->findnodes("/fault/detail")->[0]) {
|
||||
push @{$rsp->{data}}, $doc->findnodes("/fault/detail")->[0]->textContent();
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
my $state;
|
||||
if (defined($doc->findnodes("/disk/creation_status/state")->[0])) {
|
||||
$state = $doc->findnodes("/disk/creation_status/state")->[0]->textContent();
|
||||
}
|
||||
if ($state =~ /fail/i) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$node: Add disk failed for virtual machine";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
$success = 1;
|
||||
} else {
|
||||
my @disklist = split ('\|', $myvment->{storage});
|
||||
foreach (@disklist) {
|
||||
my ($sdname, $disksize, $disktype) = split(':', $_);
|
||||
if ($sdname) {
|
||||
if (waitforcomplete($ref_rhevm, "/api/vms/$vmid", "/vm/status/state=down", 30)) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, $response;
|
||||
push @{$rsp->{data}}, "$node: failed to waiting the vm gets to \"down\" state.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
$success = 0;
|
||||
|
||||
#Get the storage domain by name
|
||||
my $sdid;
|
||||
($rc, $sdid, $stat) = search_src($ref_rhevm, "storagedomains", $sdname);
|
||||
if ($rc) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not get the storage domain $sdname.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
|
||||
if ($sdid) {
|
||||
$api = "/api/vms/$vmid/disks";
|
||||
$method = "POST";
|
||||
|
||||
# generate the content
|
||||
if ($disktype) {
|
||||
$disktype_t->setData($disktype);
|
||||
if ($disktype eq "system") {
|
||||
$diskboot_t->setData("true");
|
||||
} else {
|
||||
$diskboot_t->setData("false");
|
||||
}
|
||||
} else {
|
||||
$disktype_t->setData("system");
|
||||
$diskboot_t->setData("true");
|
||||
}
|
||||
# set the size of disk
|
||||
if ($disksize) {
|
||||
$disksize =~ s/g/000000000/i;
|
||||
$disksize =~ s/m/000000/i;
|
||||
} else {
|
||||
$disksize = "5000000000"; #5G is default
|
||||
}
|
||||
$sdid_ele->setAttribute("id", $sdid);
|
||||
$sdsize_t->setData($disksize);
|
||||
|
||||
# set the interface type and format for disk
|
||||
if ($myvment->{storagemodel}) {
|
||||
my ($iftype,$iffmt) = split(':', $myvment->{storagemodel});
|
||||
$sdif_t->setData($iftype);
|
||||
$sdfm_t->setData($iffmt);
|
||||
} else {
|
||||
$sdif_t->setData("virtio");
|
||||
$sdfm_t->setData("cow");
|
||||
}
|
||||
|
||||
$request = genreq($ref_rhevm, $method, $api, $adds->toString());
|
||||
($rc, $response) = send_req($ref_rhevm, $request->as_string());
|
||||
if (!$rc) {
|
||||
my $parser = XML::LibXML->new();
|
||||
my $doc = $parser->parse_string($response);
|
||||
if (defined($doc->findnodes("/fault")->[0])) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$node: Add disk failed for virtual machine";
|
||||
if ($doc->findnodes("/fault/detail")->[0]) {
|
||||
push @{$rsp->{data}}, $doc->findnodes("/fault/detail")->[0]->textContent();
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
my $state;
|
||||
if (defined($doc->findnodes("/disk/creation_status/state")->[0])) {
|
||||
$state = $doc->findnodes("/disk/creation_status/state")->[0]->textContent();
|
||||
}
|
||||
if ($state =~ /fail/i) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$node: Add disk failed for virtual machine";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
$success = 1;
|
||||
} else {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, $response;
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2485,7 +2489,7 @@ sub chvm {
|
||||
if ($myvment->{cpus}) {
|
||||
my ($socketnum, $corenum) = split(':', $myvment->{cpus});
|
||||
unless ($corenum) {$corenum = 1;}
|
||||
$cpuele = "<cpu><topology cores=\"$socketnum\" sockets=\"$corenum\"/></cpu>";
|
||||
$cpuele = "<cpu><topology cores=\"$corenum\" sockets=\"$socketnum\"/></cpu>";
|
||||
}
|
||||
|
||||
# configure bootorder
|
||||
@@ -2806,7 +2810,7 @@ sub rmigrate {
|
||||
my $api = "/api/vms/$vmid/migrate";
|
||||
my $method = "POST";
|
||||
|
||||
my $content = "<action><host id=\"$hostid\"/></action>";
|
||||
my $content = "<action><host id=\"$hostid\"/><force>true</force></action>";
|
||||
my $request = genreq($ref_rhevm, $method, $api, $content);
|
||||
my $response;
|
||||
($rc, $response) = send_req($ref_rhevm, $request->as_string());
|
||||
@@ -3044,7 +3048,11 @@ sub search_src {
|
||||
if ($type eq "vms") {
|
||||
$idstr = "/vms/vm";
|
||||
} elsif ($type eq "hosts") {
|
||||
$idstr = "/hosts/host";
|
||||
if ($individual) {
|
||||
$idstr = "/host";
|
||||
} else {
|
||||
$idstr = "/hosts/host";
|
||||
}
|
||||
} elsif ($type eq "templates") {
|
||||
$idstr = "/templates/template";
|
||||
} elsif ($type eq "storagedomains") {
|
||||
@@ -3839,12 +3847,7 @@ sub getrvidparms {
|
||||
$consparam{method} = 'kvm';
|
||||
|
||||
# get the attributes for vm
|
||||
my $api = "/api/vms?search=$node";
|
||||
my $method = "GET";
|
||||
my $content = "";
|
||||
|
||||
my $request = genreq($ref_rhevm, $method, $api, $content);
|
||||
my ($rc, $response) = send_req($ref_rhevm, $request->as_string());
|
||||
my ($rc, undef, undef, $response) = search_src($ref_rhevm, "vms", "$node");
|
||||
|
||||
my $vmid;
|
||||
my $rsp;
|
||||
@@ -3875,11 +3878,11 @@ sub getrvidparms {
|
||||
}
|
||||
|
||||
# get the password ticket for the external program to accesss the VNC
|
||||
$api = "/api/vms/$vmid/ticket";
|
||||
$method = "POST";
|
||||
$content = "<action><ticket><expiry>120</expiry></ticket></action>";
|
||||
my $api = "/api/vms/$vmid/ticket";
|
||||
my $method = "POST";
|
||||
my $content = "<action><ticket><expiry>120</expiry></ticket></action>";
|
||||
|
||||
$request = genreq($ref_rhevm, $method, $api, $content);
|
||||
my $request = genreq($ref_rhevm, $method, $api, $content);
|
||||
($rc, $response) = send_req($ref_rhevm, $request->as_string());
|
||||
|
||||
if ($rc) {
|
||||
|
||||
@@ -1056,7 +1056,7 @@ sub copycd
|
||||
close($content);
|
||||
foreach (@contents) {
|
||||
if (/^VERSION/) {
|
||||
my @verpair = split;
|
||||
my @verpair = split /\s+|-/;
|
||||
$detdistname = "sles".$verpair[1];
|
||||
unless ($distname) { $distname = $detdistname; }
|
||||
}
|
||||
|
||||
@@ -84,7 +84,11 @@ sub process_request {
|
||||
$callback = shift;
|
||||
$docmd = shift;
|
||||
%searchmacs=();
|
||||
my $srvtypes = [ qw/service:management-hardware.IBM:chassis-management-module service:management-hardware.IBM:management-module service:management-hardware.IBM:integrated-management-module2/ ];
|
||||
my $srvtypes = [ qw/service:management-hardware.IBM:chassis-management-module/ ];
|
||||
xCAT::SLP::dodiscover(SrvTypes=>$srvtypes,Callback=>\&handle_new_slp_entity);
|
||||
$srvtypes = [ qw/service:management-hardware.IBM:management-module/ ];
|
||||
xCAT::SLP::dodiscover(SrvTypes=>$srvtypes,Callback=>\&handle_new_slp_entity);
|
||||
$srvtypes = [ qw/service:management-hardware.IBM:integrated-management-module2/ ];
|
||||
xCAT::SLP::dodiscover(SrvTypes=>$srvtypes,Callback=>\&handle_new_slp_entity);
|
||||
|
||||
my $mpatab=xCAT::Table->new("mpa",-create=>0);
|
||||
@@ -346,7 +350,14 @@ sub do_blade_setup {
|
||||
sendmsg([1,"Failed to set up Management module due to Incorrect Password (You may try the environment variables XCAT_CURRENTUSER and/or XCAT_CURRENTPASS to try a different value)"],$callback,$nodename);
|
||||
return 0;
|
||||
}
|
||||
sendmsg([$result->[0],$result->[2]],$callback,$nodename);
|
||||
my $errors = $result->[2];
|
||||
if (ref $errors) {
|
||||
foreach my $error (@$errors) {
|
||||
sendmsg([$result->[0],$error],$callback,$nodename);
|
||||
}
|
||||
} else {
|
||||
sendmsg([$result->[0],$result->[2]],$callback,$nodename);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -267,18 +278,16 @@ sub process_servicenodes_xdcp
|
||||
my $synfiledir = shift;
|
||||
my @snodes = @$sn;
|
||||
my @snoderange = @$snrange;
|
||||
my $args;
|
||||
$::RUNCMD_RC = 0;
|
||||
my $cmd = $req->{command}->[0];
|
||||
|
||||
# if xdcp -F command (input $syncsnfile) and the original synclist need
|
||||
# to be rsync to the $synfiledir directory on the service nodes first
|
||||
# to be rsync to the $synfiledir directory on the service nodes first
|
||||
if ($::syncsnfile)
|
||||
{
|
||||
if (!-f $::syncsnfile)
|
||||
{ # syncfile does not exist, quit
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "File:$::syncsnfile does not exist.";
|
||||
$rsp->{error}->[0] = "File:$::syncsnfile does not exist.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
|
||||
return (1); # process no service nodes
|
||||
}
|
||||
@@ -287,45 +296,64 @@ sub process_servicenodes_xdcp
|
||||
# original synclist input on the -F flag to
|
||||
# the service node first to the site.SNsyncfiledir directory
|
||||
#change noderange to the service nodes
|
||||
# sync each one and check for error
|
||||
# if error do not add to good_SN array, add to bad_SN
|
||||
# sync and check for error
|
||||
|
||||
my @sn = ();
|
||||
#build the array of all service nodes
|
||||
foreach my $node (@snodes)
|
||||
{
|
||||
|
||||
# run the command to each servicenode
|
||||
# xdcp <sn> -s -F <syncfile>
|
||||
my @sn = ();
|
||||
# handle multiple servicenodes for one node
|
||||
my @sn_list = split ',', $node;
|
||||
foreach my $snode (@sn_list) {
|
||||
push @sn, $snode;
|
||||
}
|
||||
# don't use runxcmd, because can go straight to process_request,
|
||||
# these are all service nodes. Also servicenode is taken from
|
||||
# the noderes table and may not be the same name as in the nodelist
|
||||
# table, for example may be an ip address.
|
||||
# here on the MN
|
||||
my $addreq;
|
||||
$addreq->{'_xcatdest'} = $::mnname;
|
||||
$addreq->{node} = \@sn;
|
||||
$addreq->{noderange} = \@sn;
|
||||
$addreq->{arg}->[0] = "-s";
|
||||
$addreq->{arg}->[1] = "-F";
|
||||
$addreq->{arg}->[2] = $::syncsnfile;
|
||||
$addreq->{command}->[0] = $cmd;
|
||||
$addreq->{cwd}->[0] = $req->{cwd}->[0];
|
||||
$addreq->{env} = $req->{env};
|
||||
&process_request($addreq, $callback, $sub_req);
|
||||
}
|
||||
@::good_SN = @sn; # initialize all good
|
||||
|
||||
if ($::FAILED_NODES == 0)
|
||||
# run the command to the servicenodes
|
||||
# xdcp <sn> -s -F <syncfile>
|
||||
# don't use runxcmd, because can go straight to process_request,
|
||||
# these are all service nodes. Also servicenode is taken from
|
||||
# the noderes table and may not be the same name as in the nodelist
|
||||
# table, for example may be an ip address.
|
||||
# here on the MN
|
||||
my $addreq;
|
||||
$addreq->{'_xcatdest'} = $::mnname;
|
||||
$addreq->{node} = \@sn;
|
||||
$addreq->{noderange} = \@sn;
|
||||
# check input request for --nodestatus
|
||||
my $args=$req->{arg}; # argument
|
||||
if (grep(/^--nodestatus$/, @$args)) {
|
||||
push (@{$addreq->{arg}},"--nodestatus"); # return nodestatus
|
||||
}
|
||||
push (@{$addreq->{arg}},"-v");
|
||||
push (@{$addreq->{arg}},"-s");
|
||||
push (@{$addreq->{arg}},"-F");
|
||||
push (@{$addreq->{arg}},$::syncsnfile);
|
||||
$addreq->{command}->[0] = $cmd;
|
||||
$addreq->{cwd}->[0] = $req->{cwd}->[0];
|
||||
$addreq->{env} = $req->{env};
|
||||
&process_request($addreq, $callback, $sub_req);
|
||||
|
||||
if ($::FAILED_NODES == 0)
|
||||
{
|
||||
@::good_SN = @sn; # all servicenodes were sucessful
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@::bad_SN = @::DCP_NODES_FAILED;
|
||||
# remove all failing nodes from the good list
|
||||
my @tmpgoodnodes;
|
||||
foreach my $gnode (@::good_SN) {
|
||||
if (!grep(/$gnode/,@::bad_SN )) # if not a bad node
|
||||
{
|
||||
push @::good_SN, $node;
|
||||
push @tmpgoodnodes, $gnode;
|
||||
}
|
||||
else
|
||||
{
|
||||
push @::bad_SN, $node;
|
||||
}
|
||||
} # end foreach good servicenode
|
||||
}
|
||||
@::good_SN = @tmpgoodnodes;
|
||||
}
|
||||
|
||||
} # end xdcp -F
|
||||
else
|
||||
@@ -348,75 +376,86 @@ sub process_servicenodes_xdcp
|
||||
my $SNdir;
|
||||
$SNdir = dirname($::SNpath); # get directory
|
||||
|
||||
my @sn = ();
|
||||
# build list of servicenodes
|
||||
foreach my $node (@snodes)
|
||||
{
|
||||
my @sn = ();
|
||||
# handle multiple servicenodes for one node
|
||||
my @sn_list = split ',', $node;
|
||||
foreach my $snode (@sn_list) {
|
||||
push @sn, $snode;
|
||||
}
|
||||
|
||||
# run the command to each servicenode
|
||||
# to make the directory under the temporary
|
||||
# SNsyncfiledir to hold the files that will be
|
||||
# sent to the service nodes
|
||||
# xdsh <sn> mkdir -p <SNsyncfiledir>/$::SNpath
|
||||
my $addreq;
|
||||
$addreq->{'_xcatdest'} = $::mnname;
|
||||
$addreq->{node} = \@sn;
|
||||
$addreq->{noderange} = \@sn;
|
||||
$addreq->{arg}->[0] = "mkdir ";
|
||||
$addreq->{arg}->[1] = "-p ";
|
||||
$addreq->{arg}->[2] = $SNdir;
|
||||
$addreq->{command}->[0] = 'xdsh';
|
||||
$addreq->{cwd}->[0] = $req->{cwd}->[0];
|
||||
$addreq->{env} = $req->{env};
|
||||
&process_request($addreq, $callback, $sub_req);
|
||||
|
||||
if ($::FAILED_NODES == 0)
|
||||
}
|
||||
@::good_SN = @sn; # initialize all good
|
||||
# run the command to all servicenodes
|
||||
# to make the directory under the temporary
|
||||
# SNsyncfiledir to hold the files that will be
|
||||
# sent to the service nodes
|
||||
# xdsh <sn> mkdir -p <SNsyncfiledir>/$::SNpath
|
||||
my $addreq;
|
||||
$addreq->{'_xcatdest'} = $::mnname;
|
||||
$addreq->{node} = \@sn;
|
||||
$addreq->{noderange} = \@sn;
|
||||
$addreq->{arg}->[0] = "-v";
|
||||
$addreq->{arg}->[1] = "mkdir ";
|
||||
$addreq->{arg}->[2] = "-p ";
|
||||
$addreq->{arg}->[3] = $SNdir;
|
||||
$addreq->{command}->[0] = 'xdsh';
|
||||
$addreq->{cwd}->[0] = $req->{cwd}->[0];
|
||||
$addreq->{env} = $req->{env};
|
||||
&process_request($addreq, $callback, $sub_req);
|
||||
if ($::FAILED_NODES == 0)
|
||||
{
|
||||
@::good_SN = @sn;
|
||||
}
|
||||
else
|
||||
{
|
||||
@::bad_SN = @::DCP_NODES_FAILED;
|
||||
# remove all failing nodes from the good list
|
||||
my @tmpgoodnodes;
|
||||
foreach my $gnode (@::good_SN) {
|
||||
if (!grep(/$gnode/,@::bad_SN )) # if not a bad node
|
||||
{
|
||||
push @::good_SN, $node;
|
||||
push @tmpgoodnodes, $gnode;
|
||||
}
|
||||
else
|
||||
{
|
||||
push @::bad_SN, $node;
|
||||
}
|
||||
} # end foreach good servicenode
|
||||
}
|
||||
@::good_SN = @tmpgoodnodes;
|
||||
}
|
||||
|
||||
# now xdcp file to the service node to the new
|
||||
# tmp path
|
||||
|
||||
# for all the service nodes that are still good
|
||||
my @good_SN2 = @::good_SN;
|
||||
@::good_SN = ();
|
||||
foreach my $node (@good_SN2)
|
||||
my @sn = @::good_SN;
|
||||
|
||||
# copy the file to each good servicenode
|
||||
# xdcp <sn> <file> <SNsyncfiledir/../file>
|
||||
my $addreq = dclone($req); # get original request
|
||||
$addreq->{arg}->[-1] = $SNdir; # change to tmppath on servicenode
|
||||
$addreq->{'_xcatdest'} = $::mnname;
|
||||
$addreq->{node} = \@sn;
|
||||
$addreq->{noderange} = \@sn;
|
||||
&process_request($addreq, $callback, $sub_req);
|
||||
if ($::FAILED_NODES == 0)
|
||||
{
|
||||
my @sn;
|
||||
push @sn, $node;
|
||||
|
||||
# copy the file to each good servicenode
|
||||
# xdcp <sn> <file> <SNsyncfiledir/../file>
|
||||
my $addreq = dclone($req); # get original request
|
||||
$addreq->{arg}->[-1] = $SNdir; # change to tmppath on servicenode
|
||||
$addreq->{'_xcatdest'} = $::mnname;
|
||||
$addreq->{node} = \@sn;
|
||||
$addreq->{noderange} = \@sn;
|
||||
&process_request($addreq, $callback, $sub_req);
|
||||
|
||||
if ($::FAILED_NODES == 0)
|
||||
@::good_SN = @sn ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@::bad_SN = @::DCP_NODES_FAILED;
|
||||
# remove all failing nodes from the good list
|
||||
my @tmpgoodnodes;
|
||||
foreach my $gnode (@::good_SN) {
|
||||
if (!grep(/$gnode/,@::bad_SN )) # if not a bad node
|
||||
{
|
||||
push @::good_SN, $node;
|
||||
}
|
||||
else
|
||||
{
|
||||
push @::bad_SN, $node;
|
||||
push @tmpgoodnodes, $gnode;
|
||||
}
|
||||
}
|
||||
@::good_SN = @tmpgoodnodes;
|
||||
}
|
||||
|
||||
} # end foreach good service node
|
||||
}
|
||||
|
||||
# report bad service nodes]
|
||||
# report bad service nodes
|
||||
if (@::bad_SN)
|
||||
{
|
||||
my $rsp = {};
|
||||
@@ -433,6 +472,7 @@ sub process_servicenodes_xdcp
|
||||
xCAT::MsgUtils->message("D", $rsp, $callback);
|
||||
}
|
||||
return (0);
|
||||
|
||||
}
|
||||
#-------------------------------------------------------
|
||||
|
||||
|
||||
+1306
-336
File diff suppressed because it is too large
Load Diff
@@ -1036,7 +1036,7 @@ sub initDB
|
||||
$chtabcmds .=
|
||||
"$::XCATROOT/sbin/chtab key=xcatconfdir site.value=$confdir;";
|
||||
$chtabcmds .=
|
||||
"$::XCATROOT/sbin/chtab key=timezone site.value=$timezone;";
|
||||
"$::XCATROOT/sbin/chtab key=timezone site.value=\"$timezone\";";
|
||||
|
||||
$chtabcmds .= "$::XCATROOT/sbin/chtab key=useNmapfromMN site.value=no;";
|
||||
$chtabcmds .= "$::XCATROOT/sbin/chtab key=enableASMI site.value=no;";
|
||||
|
||||
+22
-30
@@ -227,7 +227,7 @@ my $socket;
|
||||
my $retry=1;
|
||||
$SIG{USR2} = sub {
|
||||
if ($socket) { #do not mess with pid file except when we still have the socket.
|
||||
unlink("/tmp/xcat/installservice.pid"); close($socket); $quit=1;
|
||||
unlink("/var/run/xcat/installservice.pid"); close($socket); $quit=1;
|
||||
xCAT::MsgUtils->message("S","xcatd install monitor $$ quiescing");
|
||||
}
|
||||
};
|
||||
@@ -242,7 +242,7 @@ my $socket;
|
||||
ReuseAddr => 1,
|
||||
Listen => 8192);
|
||||
}
|
||||
if (not $socket and open($installpidfile,"<","/tmp/xcat/installservice.pid")) { #if we couldn't get the socket, go to pid to figure out current owner
|
||||
if (not $socket and open($installpidfile,"<","/var/run/xcat/installservice.pid")) { #if we couldn't get the socket, go to pid to figure out current owner
|
||||
#TODO: lsof or similar may be a more accurate measure
|
||||
my $pid = <$installpidfile>;
|
||||
if ($pid) {
|
||||
@@ -273,7 +273,7 @@ sleep 0.05; #up to 50 ms outage possible
|
||||
die;
|
||||
}
|
||||
#we have the socket, now we claim the pid file as our own
|
||||
open($installpidfile,">","/tmp/xcat/installservice.pid"); #if here, everyone else has unlinked installservicepid or doesn't care
|
||||
open($installpidfile,">","/var/run/xcat/installservice.pid"); #if here, everyone else has unlinked installservicepid or doesn't care
|
||||
print $installpidfile $$;
|
||||
close($installpidfile);
|
||||
until ($quit) {
|
||||
@@ -432,10 +432,10 @@ if ($inet6support) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (open($installpidfile,"<","/tmp/xcat/installservice.pid")) {
|
||||
if (open($installpidfile,"<","/var/run/xcat/installservice.pid")) {
|
||||
my $pid = <$installpidfile>;
|
||||
if ($pid == $$) { #if our pid, unlink the file, otherwise, we managed to see the pid after someone else created it
|
||||
unlink("/tmp/xcat/installservice.pid");
|
||||
unlink("/var/run/xcat/installservice.pid");
|
||||
}
|
||||
close($installpidfile);
|
||||
}
|
||||
@@ -457,7 +457,7 @@ sub do_udp_service { #This function opens up a UDP port
|
||||
$SIG{USR2} = sub {
|
||||
if ($socket) {
|
||||
#only clear out pid file when we still have socket.
|
||||
unlink("/tmp/xcat/udpservice.pid"); close($socket); $quit=1; $socket=0;
|
||||
unlink("/var/run/xcat/udpservice.pid"); close($socket); $quit=1; $socket=0;
|
||||
xCAT::MsgUtils->message("S","xcatd udp service $$ quiescing");
|
||||
}
|
||||
};
|
||||
@@ -470,7 +470,7 @@ sub do_udp_service { #This function opens up a UDP port
|
||||
Proto => 'udp',
|
||||
Domain => AF_INET);
|
||||
}
|
||||
if (not $socket and open($udppidfile,"<","/tmp/xcat/udpservice.pid")) {
|
||||
if (not $socket and open($udppidfile,"<","/var/run/xcat/udpservice.pid")) {
|
||||
my $pid = <$udppidfile>;
|
||||
if ($pid) {
|
||||
$retry=100; #grace period for old instance to get out of the way, 5 seconds
|
||||
@@ -500,7 +500,7 @@ sleep 0.05;
|
||||
die "Unable to start UDP on $port";
|
||||
}
|
||||
#only take udp pid if we get the socket
|
||||
open($udppidfile,">","/tmp/xcat/udpservice.pid"); #if here, everyone else has unlinked udpservicepid or doesn't care
|
||||
open($udppidfile,">","/var/run/xcat/udpservice.pid"); #if here, everyone else has unlinked udpservicepid or doesn't care
|
||||
print $udppidfile $$;
|
||||
close($udppidfile);
|
||||
$select->add($socket);
|
||||
@@ -574,10 +574,10 @@ sleep 0.05;
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
if (open($udppidfile,"<","/tmp/xcat/udpservice.pid")) {
|
||||
if (open($udppidfile,"<","/var/run/xcat/udpservice.pid")) {
|
||||
my $pid = <$udppidfile>;
|
||||
if ($pid == $$) { #if our pid, unlink the file, otherwise, we managed to see the pid after someone else created it
|
||||
unlink("/tmp/xcat/udpservice.pid");
|
||||
unlink("/var/run/xcat/udpservice.pid");
|
||||
}
|
||||
close($udppidfile);
|
||||
}
|
||||
@@ -794,7 +794,7 @@ my $listener;
|
||||
my $mainpidfile;
|
||||
$SIG{USR2} = sub {
|
||||
if ($listener) {
|
||||
unlink("/tmp/xcat/mainservice.pid"); close($listener); $quit=1; $listener=0;
|
||||
unlink("/var/run/xcat/mainservice.pid"); close($listener); $quit=1; $listener=0;
|
||||
xCAT::MsgUtils->message("S","xcatd main service $$ quiescing");
|
||||
}
|
||||
};
|
||||
@@ -811,7 +811,7 @@ $SIG{USR2} = sub {
|
||||
Reuse => 1,
|
||||
);
|
||||
}
|
||||
if (not $listener and open($mainpidfile,"<","/tmp/xcat/mainservice.pid")) {
|
||||
if (not $listener and open($mainpidfile,"<","/var/run/xcat/mainservice.pid")) {
|
||||
my $pid = <$mainpidfile>;
|
||||
if ($pid) {
|
||||
$retry=100; #grace period for old instance to get out of the way, 5 seconds
|
||||
@@ -851,7 +851,7 @@ unless ($listener) {
|
||||
die "ERROR:Unable to start xCAT service on port $port.";
|
||||
}
|
||||
#only write to pid file if we have listener, listener ownership serves as lock to protect integrity
|
||||
open($mainpidfile,">","/tmp/xcat/mainservice.pid"); #if here, everyone else has unlinked mainservicepid or doesn't care
|
||||
open($mainpidfile,">","/var/run/xcat/mainservice.pid"); #if here, everyone else has unlinked mainservicepid or doesn't care
|
||||
print $mainpidfile $$;
|
||||
close($mainpidfile);
|
||||
closelog();
|
||||
@@ -954,10 +954,10 @@ if ($inet6support) {
|
||||
$sslclients++; #THROTTLE
|
||||
$cnnection->close();
|
||||
}
|
||||
if (open($mainpidfile,"<","/tmp/xcat/mainservice.pid")) {
|
||||
if (open($mainpidfile,"<","/var/run/xcat/mainservice.pid")) {
|
||||
my $pid = <$mainpidfile>;
|
||||
if ($pid == $$) { #if our pid, unlink the file, otherwise, we managed to see the pid after someone else created it
|
||||
unlink("/tmp/xcat/mainservice.pid");
|
||||
unlink("/var/run/xcat/mainservice.pid");
|
||||
}
|
||||
close($mainpidfile);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user