Compare commits
335 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 19a14d711d | |||
| 45d05d26f0 | |||
| 3bb52d4109 | |||
| 86d2a14472 | |||
| 9567b80174 | |||
| cd660ad538 | |||
| 7d38486a08 | |||
| ebe0f60795 | |||
| d4c6c267e8 | |||
| 8235d4ac43 | |||
| abdf84c60f | |||
| e4f555bd71 | |||
| 2f3e76593e | |||
| 64a9d71a53 | |||
| 63b0515072 | |||
| 0b639cb5c2 | |||
| 61ef293909 | |||
| a6590b61bc | |||
| 7d0067c948 | |||
| e4b2e44c1c | |||
| af7a55499c | |||
| a21b141bbd | |||
| 5c784e7b76 | |||
| d6cef63a03 | |||
| a8c7dca997 | |||
| 7d5f94dd29 | |||
| f7896eab97 | |||
| 0e8eb99410 | |||
| 6f8f7c3f52 | |||
| 7a27003c93 | |||
| f92c9e52c2 | |||
| 80785946c3 | |||
| f98eee4e27 | |||
| 2773b2cb0a | |||
| f9790ea536 | |||
| 25203ea1b5 | |||
| bd4d78da84 | |||
| ac3c7fe28c | |||
| ed88f05e47 | |||
| fc7822f93e | |||
| 46ea594db7 | |||
| 43e89b90a2 | |||
| 309bc5cc48 | |||
| 5311349afa | |||
| 4a2fc2bc31 | |||
| e98678711b | |||
| e0e6874bb5 | |||
| 8e3d1735a6 | |||
| a5362a40a0 | |||
| f8b6035f94 | |||
| 32b8f7363e | |||
| 9925cb7099 | |||
| 468d01294a | |||
| 380928afe2 | |||
| fbb5188133 | |||
| 796a855e9f | |||
| 318c8a95b5 | |||
| d366c51298 | |||
| ab402d90a0 | |||
| 44c9aea4e2 | |||
| 312aec61c5 | |||
| 6a11d0230f | |||
| eacf7bb705 | |||
| 66990705cf | |||
| e78a1a792a | |||
| a0348fa10b | |||
| 3593f5c5f6 | |||
| 0aa1bb69f8 | |||
| 24daaf4167 | |||
| e3e3950755 | |||
| 36bc7c7ef7 | |||
| eac2017ebe | |||
| ba6db26013 | |||
| be6c764c15 | |||
| afb39ee9f6 | |||
| 29af239759 | |||
| 1789b73dc7 | |||
| 7e88064d17 | |||
| 8745f3716a | |||
| 31f33bdc6e | |||
| 1800b644a4 | |||
| 83c7a6c518 | |||
| 136a29d4cc | |||
| 760f6bba6e | |||
| 4fd19c1cb3 | |||
| 2fc43ee369 | |||
| db9f372318 | |||
| 2579006170 | |||
| 2e08e93f6a | |||
| ef3f6264a1 | |||
| 4d822dc512 | |||
| 365e767cee | |||
| 6b85f59313 | |||
| d6ac310ac4 | |||
| 94790e7adb | |||
| db4608c4f4 | |||
| c8c259b87d | |||
| c52d9e4173 | |||
| d9f1cddbe2 | |||
| efc0943a60 | |||
| 08e280ab0d | |||
| e5f6a985ee | |||
| b09d4b62d0 | |||
| 3237dc7029 | |||
| 5ad03e3ea3 | |||
| 6ce7c4a5ed | |||
| 028c57b77f | |||
| e39dd3b483 | |||
| 50d9b30366 | |||
| d147b6fab4 | |||
| e55ac17bbf | |||
| 94feb79653 | |||
| d0d7d0fca7 | |||
| c07e084196 | |||
| f0e1f5fd21 | |||
| b1d7fe518d | |||
| aadf88afd8 | |||
| c0a425a610 | |||
| 64edcd07cd | |||
| db9d0474a1 | |||
| c88186c3b2 | |||
| 2679d81c3e | |||
| a72ebc81ed | |||
| cd82e2ed40 | |||
| 0124789e7c | |||
| d709219803 | |||
| 3c3612546a | |||
| 5baf467a50 | |||
| b1634bdf06 | |||
| 1a844bae71 | |||
| 253a919d38 | |||
| 3217183ffb | |||
| 46d9b6345c | |||
| 7ca468b29b | |||
| 0638e0cf77 | |||
| 80f583859f | |||
| a1e9904375 | |||
| 2732e1f90d | |||
| 7c624d9026 | |||
| 9aaae028f2 | |||
| 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 | |||
| 0b1751059b | |||
| 5d5bc70fe8 | |||
| 083154650c | |||
| 44060947cc | |||
| 731a2b9a9d | |||
| 544cabd915 | |||
| 9f8c5f7998 | |||
| 9f20565957 | |||
| bf91d7e939 | |||
| 3af54f8e00 | |||
| 82a094b753 | |||
| b6e445e1f6 | |||
| fb97c85957 | |||
| 4d5c361055 | |||
| f3fce3cbd7 | |||
| f9decc9b87 | |||
| c101ca6858 | |||
| fbd56c732b | |||
| 602f8beb52 | |||
| 734b00e875 | |||
| 2f2a72e90c | |||
| de82de8d87 | |||
| dd87d634e5 | |||
| a2a76f23c6 | |||
| 2f39a9182c | |||
| c94740deb4 | |||
| 5a7e50c1fe | |||
| dab3cf53b0 | |||
| 0857cb241a | |||
| 27085c3af0 | |||
| 1664ed82d8 | |||
| 6ee370cfbe | |||
| 4488357171 | |||
| b99460f24f | |||
| 7d9a0ad0ed | |||
| 3c84558504 | |||
| f891cc995b | |||
| 46c40ab353 | |||
| a2656b7645 | |||
| ba94317016 | |||
| f8f797bc57 | |||
| 08bfa000a6 | |||
| 980c22d787 | |||
| e83a221388 | |||
| 209b9202b7 | |||
| 7640137f02 | |||
| 11c7894e6f | |||
| 70cf9e5790 | |||
| b549c9b8e4 | |||
| e51af68867 | |||
| 254643a5c7 | |||
| 84b1fb6a79 | |||
| 68d2993a78 | |||
| 8b4c3c074b | |||
| 086c91877e | |||
| 259767a305 | |||
| c4331e85c6 | |||
| a585170667 | |||
| ba244e8841 | |||
| 1dac16d2ce | |||
| 2a241d4e64 | |||
| 5b3f372056 | |||
| 1dd54b108d | |||
| 94511e23c0 | |||
| 8947e743a1 | |||
| da0a0d9555 | |||
| 273bac6e72 | |||
| e680150395 | |||
| df3f6b7ffb | |||
| d7051e1bde | |||
| b44c562e4e | |||
| 4018deb485 | |||
| c4e78295ff | |||
| d37b7dd8f4 | |||
| 8f4cb07057 | |||
| 4ba6342bc7 | |||
| 451d63d075 | |||
| ba23720d6f | |||
| b733ed7993 | |||
| ab8527103f | |||
| 2c76dc1011 | |||
| d38374d1c2 | |||
| fd9e4f96ce | |||
| b8f5208ef0 | |||
| 108d40c7dc | |||
| ccf619ce12 | |||
| b390df9313 | |||
| ce8f2e5282 | |||
| ba38665c4e | |||
| b6629f4e61 | |||
| 2220d60168 | |||
| 2165956209 | |||
| 32a15b987a | |||
| 406346f2a6 | |||
| 7317419c92 | |||
| 98f2a6dd5b | |||
| a000d5f80b | |||
| 94e3862219 | |||
| 19b413af7f | |||
| c418b962ba | |||
| 20140c5c8f | |||
| 13016f8817 | |||
| a3476dd281 | |||
| a270d82762 | |||
| 63c773dd53 | |||
| 1254f86a45 | |||
| d8442c35e2 | |||
| 29e60c243e | |||
| 70c5242f77 | |||
| 71062b78d9 | |||
| 5a10afcb2d | |||
| 056f824b02 | |||
| 0d46150fcc | |||
| 664a1e0f74 | |||
| 405ad47b44 | |||
| a4119f52a2 | |||
| 9a014e31c3 | |||
| 88d34addd0 | |||
| ede6f9a65a | |||
| 901e60d507 | |||
| d14d92acf0 | |||
| c7dcb9160c |
@@ -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.
|
||||
|
||||
+29
-13
@@ -118,18 +118,22 @@ sub submit_request {
|
||||
unless ($certfile) { $certfile = $homedir."/.xcat/client-cred.pem"; }
|
||||
unless ($cafile) { $cafile = $homedir."/.xcat/ca.pem"; }
|
||||
$xCAT::Client::EXITCODE = 0; # clear out exit code before invoking the plugin
|
||||
$request->{clienttype}->[0] = "cli"; # setup clienttype for auditlog
|
||||
if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
$request->{clienttype}->[0] = "cli"; # setup clienttype for auditlog
|
||||
}
|
||||
# If XCATBYPASS is set, invoke the plugin process_request method directly
|
||||
# without going through the socket connection to the xcatd daemon
|
||||
if ($ENV{XCATBYPASS}) {
|
||||
#add current userid to the request
|
||||
if (!(defined($request->{username}))) {
|
||||
$request->{username}->[0] = getpwuid($>);
|
||||
}
|
||||
# only allow root to run
|
||||
unless ($request->{username}->[0] =~ /root/) {
|
||||
print ("WARNING: Only allow root to run XCATBYPASS mode, your current user ID is $request->{username}->[0].\n");
|
||||
return 0;
|
||||
if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
if (!(defined($request->{username}))) {
|
||||
$request->{username}->[0] = getpwuid($>);
|
||||
}
|
||||
# only allow root to run
|
||||
unless ($request->{username}->[0] =~ /root/) {
|
||||
print ("WARNING: Only allow root to run XCATBYPASS mode, your current user ID is $request->{username}->[0].\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
# Load plugins from either specified or default dir
|
||||
require xCAT::Table;
|
||||
@@ -211,7 +215,12 @@ $request->{clienttype}->[0] = "cli"; # setup clienttype for auditlog
|
||||
}
|
||||
}
|
||||
|
||||
my $msg=XMLout($request,RootName=>'xcatrequest',NoAttr=>1,KeyAttr=>[]);
|
||||
my $msg;
|
||||
if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
$msg=XMLout($request,RootName=>'xcatrequest',NoAttr=>1,KeyAttr=>[]);
|
||||
} else { #XML
|
||||
$msg=$request;
|
||||
}
|
||||
if ($ENV{XCATXMLTRACE}) { print $msg; }
|
||||
if($ENV{XCATXMLWARNING}) {
|
||||
validateXML($msg);
|
||||
@@ -374,6 +383,12 @@ sub plugin_command {
|
||||
require xCAT::Table;
|
||||
|
||||
$Main::resps={};
|
||||
my $xmlreq;
|
||||
if (ref($req) ne 'HASH') { # the request XML, get an array
|
||||
$xmlreq=$req; # save the original XML
|
||||
$req = XMLin($xmlreq,SuppressEmpty=>undef,ForceArray=>1) ;
|
||||
|
||||
}
|
||||
my @nodes;
|
||||
if ($req->{node}) {
|
||||
@nodes = @{$req->{node}};
|
||||
@@ -393,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;
|
||||
@@ -964,6 +975,11 @@ sub build_response {
|
||||
##########################################
|
||||
sub handle_response {
|
||||
my $rsp = shift;
|
||||
if ($ENV{'XCATSHOWXML'}) {
|
||||
my $xmlrec=XMLout($rsp,RootName=>'xcatresponse',NoAttr=>1,KeyAttr=>[]);
|
||||
print "$xmlrec\n";
|
||||
return;
|
||||
}
|
||||
#print "in handle_response\n";
|
||||
# Handle errors
|
||||
if ($rsp->{errorcode}) {
|
||||
|
||||
Regular → Executable
+48
-4
@@ -199,7 +199,7 @@ sub getobjattrs
|
||||
# list of object names
|
||||
foreach my $table (keys %tableattrs) {
|
||||
# open the table
|
||||
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 0);
|
||||
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 1);
|
||||
if (!$thistable) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "Could not open the \'$table\' table.";
|
||||
@@ -395,6 +395,44 @@ sub getobjdefs
|
||||
xCAT::MsgUtils->message("E", $rsp, $::callback);
|
||||
}
|
||||
}
|
||||
} elsif (($objtype eq 'auditlog') || ($objtype eq 'eventlog')) {
|
||||
# Special case for auditlog/eventlog
|
||||
# All the auditlog/eventlog attributes are in auditlog/eventlog table,
|
||||
# Do not need to read the table multiple times for each attribute.
|
||||
# The auditlog/eventlog is likely be very big over time,
|
||||
# performance is a big concern with the general logic
|
||||
my @TableRowArray = xCAT::DBobjUtils->getDBtable($objtype);
|
||||
foreach my $objname (sort @{$type_obj{$objtype}}) {
|
||||
if (@TableRowArray)
|
||||
{
|
||||
my $foundinfo = 0;
|
||||
foreach my $entry (@TableRowArray)
|
||||
{
|
||||
if ($entry->{recid} eq $objname)
|
||||
{
|
||||
foreach my $k (keys %{$entry})
|
||||
{
|
||||
# recid is the object name, do not need to be in the attributes list
|
||||
if ($k eq 'recid') { next; }
|
||||
if (defined($entry->{$k}) ) {
|
||||
$foundinfo++;
|
||||
if ($verbose == 1) {
|
||||
$objhash{$objname}{$k} = "$entry->{$k}\t(Table:$objtype - Key:$k)";
|
||||
} else {
|
||||
$objhash{$objname}{$k} = $entry->{$k};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($foundinfo)
|
||||
{
|
||||
$objhash{$objname}{'objtype'} = $objtype;
|
||||
}
|
||||
# There should not be multiple entries with the same recid
|
||||
last;
|
||||
} # end if($entry->
|
||||
} # end foreach my $entry
|
||||
} # end if(@TableTowArray
|
||||
} # end foreach my $objname
|
||||
} else {
|
||||
# get the object type decription from Schema.pm
|
||||
my $datatype = $xCAT::Schema::defspec{$objtype};
|
||||
@@ -578,7 +616,7 @@ sub getDBtable
|
||||
{
|
||||
|
||||
# need to get info from DB
|
||||
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 0);
|
||||
my $thistable = xCAT::Table->new($table, -create => 1);
|
||||
if (!$thistable)
|
||||
{
|
||||
return undef;
|
||||
@@ -2115,7 +2153,7 @@ sub getchildren
|
||||
$::RUNCMD_RC = 1;
|
||||
return undef;
|
||||
}
|
||||
my @ps = $ppctab->getAllNodeAttribs(['node','parent','nodetype']);
|
||||
my @ps = $ppctab->getAllNodeAttribs(['node','parent','nodetype','hcp']);
|
||||
foreach my $entry ( @ps ) {
|
||||
my $p = $entry->{parent};
|
||||
my $c = $entry->{node};
|
||||
@@ -2126,13 +2164,19 @@ sub getchildren
|
||||
# build hash of ppc.parent -> ppc.node
|
||||
push @{$PPCHASH{$p}}, $c;
|
||||
}
|
||||
elsif ($t eq 'blade') {
|
||||
push @{$PPCHASH{$c}}, $entry->{hcp};
|
||||
}
|
||||
} else { # go look in the nodetype table to find nodetype
|
||||
my $type = getnodetype($c);
|
||||
my $type = getnodetype($c, "ppc");
|
||||
if ( $type eq 'fsp' or $type eq 'bpa')
|
||||
{
|
||||
# build hash of ppc.parent -> ppc.node
|
||||
push @{$PPCHASH{$p}}, $c;
|
||||
}
|
||||
elsif ($type eq "blade") {
|
||||
push @{$PPCHASH{$c}}, $entry->{hcp};
|
||||
}
|
||||
}
|
||||
} # not $p and $c
|
||||
}
|
||||
|
||||
@@ -709,8 +709,19 @@ sub pping_hostnames
|
||||
my ($class, @hostnames) = @_;
|
||||
|
||||
my $hostname_list = join ",", @hostnames;
|
||||
# read site table, usefping attribute
|
||||
# if set then run pping -f to use fping
|
||||
# this fixes a broken nmap in Redhat 6.2 with ip alias (3512)
|
||||
my $cmd="$::XCATROOT/bin/pping $hostname_list"; # default
|
||||
my @usefping=xCAT::Utils->get_site_attribute("usefping");
|
||||
if ((defined($usefping[0])) && ($usefping[0] eq "1")) {
|
||||
$cmd = "$::XCATROOT/bin/pping -f $hostname_list";
|
||||
}
|
||||
#my $rsp={};
|
||||
#$rsp->{data}->[0] = "running command $cmd";
|
||||
#xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
my @output =
|
||||
xCAT::Utils->runcmd("$::XCATROOT/bin/pping $hostname_list", -1);
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC !=0) {
|
||||
my $rsp={};
|
||||
$rsp->{data}->[0] = "Error from pping";
|
||||
|
||||
@@ -69,7 +69,7 @@ sub getHcpAttribs
|
||||
}
|
||||
}
|
||||
|
||||
my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype']);
|
||||
my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype', 'hcp']);
|
||||
for my $entry ( @ps ) {
|
||||
my $tmp_parent = $entry->{parent};
|
||||
my $tmp_node = $entry->{node};
|
||||
@@ -78,6 +78,9 @@ sub getHcpAttribs
|
||||
push @{$ppchash{$tmp_parent}{children}}, $tmp_node;
|
||||
#push @{$ppchash{$tmp_parent}}, $tmp_node;
|
||||
}
|
||||
if (defined($tmp_node) && defined($tmp_type) && ($tmp_type eq "blade") && defined($entry->{hcp})) {
|
||||
push @{$ppchash{$tmp_node}{children}}, $entry->{hcp};
|
||||
}
|
||||
|
||||
#if(exists($ppchash{$tmp_node})) {
|
||||
# if( defined($tmp_type) ) {
|
||||
@@ -175,6 +178,8 @@ sub getIPaddress
|
||||
#the $nodetocheck is its' hcp. So set $nodetocheck to $parent variable.
|
||||
#And then get the FSPs IPs for the CEC.
|
||||
$parent = $nodetocheck;
|
||||
} elsif ($type eq "blade") {
|
||||
return $ppc->{$nodetocheck}->{children}->[0];
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ sub rnetboot {
|
||||
my $options = $request->{opt};
|
||||
my $hwtype = @$exp[2];
|
||||
my $result;
|
||||
my $name;
|
||||
my $name = $request->{node};
|
||||
my $callback = $request->{callback};
|
||||
#####################################
|
||||
# Get node data
|
||||
@@ -238,6 +238,13 @@ sub rnetboot {
|
||||
C => $o->{client},
|
||||
m => $o->{mac}
|
||||
);
|
||||
#####################################
|
||||
# Parse node range
|
||||
#####################################
|
||||
if ($name =~ /ARRAY/) {
|
||||
$name = join(',', @$name);
|
||||
}
|
||||
|
||||
#####################################
|
||||
# Strip colons from mac address
|
||||
#####################################
|
||||
|
||||
@@ -44,7 +44,11 @@ sub dpush {
|
||||
# Parse the command line for options and operands
|
||||
##########################################################################
|
||||
sub parse_args {
|
||||
xCAT::PPCrflash::parse_args(@_);
|
||||
my $req = shift;
|
||||
$req->{mgt} = __PACKAGE__;
|
||||
my $opt = xCAT::PPCrflash::parse_args($req);
|
||||
delete($req->{mgt});
|
||||
return $opt;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -69,21 +69,42 @@ sub enumerate_lcds {
|
||||
my $power_status_prefix = "Current Power Status:";
|
||||
my $Rc;
|
||||
my @refcode;
|
||||
my $c;
|
||||
my $c = 0;
|
||||
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($request, $name, $d, $action);
|
||||
$Rc = @$values[2];
|
||||
my $data = @$values[1];
|
||||
my $t_n = @$values[0];
|
||||
if( $Rc != 0 ) {
|
||||
my @names = split(/,/, $name);
|
||||
my @t_data = split(/\n\n/, $data);
|
||||
my @names = split(/,/, $t_n);
|
||||
my @t_data = split(/\n/, $data);
|
||||
foreach my $n (@names) {
|
||||
if( $data =~ /$n/ ) {
|
||||
chomp $t_data[$c];
|
||||
push @refcode,[$n, "$prefix $t_data[$c]", $Rc];
|
||||
if( $only_lcds == 0) {
|
||||
push @refcode,[$n, "$power_status_prefix $t_data[$c]", $Rc];
|
||||
}
|
||||
#push @refcode,[$n, "$prefix $t_data[$c]", $Rc];
|
||||
if($t_data[$c] =~ /Error/ ) {
|
||||
if( $only_lcds == 0) {
|
||||
push @refcode,[$n, "$power_status_prefix $t_data[$c]", $Rc];
|
||||
}
|
||||
push @refcode,[$n, "$prefix $t_data[$c]", $Rc];
|
||||
} else {
|
||||
if( $only_lcds == 0) {
|
||||
|
||||
# get power status
|
||||
if( $data =~ /1\|/) {
|
||||
push @refcode, [$n, "$power_status_prefix on", $Rc] ;
|
||||
} else {
|
||||
push @refcode, [$n, "$power_status_prefix off", $Rc];
|
||||
}
|
||||
}
|
||||
|
||||
# get lcd value
|
||||
if( $t_data[$c] =~ /1\|(\w[\w\s]*)/) {
|
||||
push @refcode, [$n, "$prefix $1", $Rc] ;
|
||||
} else {
|
||||
push @refcode, [$n, "$prefix blank", $Rc];
|
||||
}
|
||||
}
|
||||
$c++;
|
||||
} else {
|
||||
push @refcode, [$n, "$prefix $data", $Rc];
|
||||
@@ -95,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];
|
||||
@@ -408,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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
#!/usr/bin/perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT::MacMap;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
|
||||
require Exporter;
|
||||
our @ISA=qw/Exporter/;
|
||||
our @EXPORT_OK=qw/walkoid/;
|
||||
@@ -174,11 +181,19 @@ sub rvlan {
|
||||
#first order of business is to identify the target switches
|
||||
my $switchtab=xCAT::Table->new('switch',-create=>0);
|
||||
unless ($switchtab) { return; }
|
||||
my $switchents = $switchtab->getNodesAttribs($nodes,[qw/switch port/]);
|
||||
my $switchents = $switchtab->getNodesAttribs($nodes,[qw/switch port interface/]);
|
||||
my $node;
|
||||
foreach $node (keys %$switchents) {
|
||||
my $entry;
|
||||
foreach $entry (@{$switchents->{$node}}) {
|
||||
#skip the none primary interface.
|
||||
# The vlaue of the primary interface could be empty, primary or primary:ethx
|
||||
if (defined($entry->{interface})) {
|
||||
if ($entry->{interface} !~ /primary/) {
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
$self->{switches}->{$entry->{switch}}->{$entry->{port}} = $node;
|
||||
}
|
||||
}
|
||||
@@ -318,6 +333,7 @@ sub refresh_table {
|
||||
$self->{switches} = {};
|
||||
foreach my $entry (@entries) {
|
||||
if (defined($entry->{switch}) and $entry->{switch} ne "" and defined($entry->{port}) and $entry->{port} ne "") {
|
||||
|
||||
if ( !$self->{switches}->{$entry->{switch}}->{$entry->{port}})
|
||||
{
|
||||
$self->{switches}->{$entry->{switch}}->{$entry->{port}} = $entry->{node};
|
||||
|
||||
@@ -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}) ) {
|
||||
|
||||
+22
-13
@@ -157,10 +157,15 @@ sub parse_args {
|
||||
#--activate's value only can be concurrent and disruptive
|
||||
################################
|
||||
if(exists($opt{activate})) {
|
||||
if( ($opt{activate} ne "deferred") && ($opt{activate} ne "disruptive")) {
|
||||
return (usage("--activate's value can only be deferred or disruptive"));
|
||||
}
|
||||
|
||||
if (defined($request->{mgt}) && ($request->{mgt} =~ /xCAT::FSP/i)) {
|
||||
if (($opt{activate} ne "deferred") && ($opt{activate} ne "disruptive")) {
|
||||
return (usage("--activate's value can only be deferred or disruptive"));
|
||||
}
|
||||
} else {
|
||||
if( ($opt{activate} ne "concurrent") && ($opt{activate} ne "disruptive")) {
|
||||
return (usage("--activate's value can only be disruptive or concurrent"));
|
||||
}
|
||||
}
|
||||
if(!exists( $opt{d} )) {
|
||||
$opt{d} = "/tmp";
|
||||
}
|
||||
@@ -528,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|deferred)$/) {
|
||||
$msg = "Option --activate's value shouldn't be $activate, and it must be disruptive or deferred";
|
||||
$msg = $msg . "Upgrade $mtms!";
|
||||
if($activate ne "disruptive") {
|
||||
$msg = "Option --activate's value should be 'disruptive'";
|
||||
return ("", "","", $msg, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,8 +152,6 @@ sub remote_copy_command
|
||||
my @src_file =
|
||||
@{$$config{'destDir_srcFile'}{$dest_dir}{'same_dest_name'}};
|
||||
|
||||
#Remove a file from the list if it does not exist
|
||||
#@src_file = map { $_ if -e $_; } @src_file;
|
||||
my $src_file_list = join ' ', @src_file;
|
||||
if ($src_file_list)
|
||||
{
|
||||
@@ -164,7 +162,6 @@ sub remote_copy_command
|
||||
%{$$config{'destDir_srcFile'}{$dest_dir}{'diff_dest_name'}};
|
||||
foreach my $src_file_diff_dest (keys %diff_dest_hash)
|
||||
{
|
||||
next if !-e $src_file_diff_dest;
|
||||
my $diff_basename = $diff_dest_hash{$src_file_diff_dest};
|
||||
print RSCYCCMDFILE
|
||||
"$exec_path $sync_opt $src_file_diff_dest $dest_user_host:$dest_dir/$diff_basename\n";
|
||||
|
||||
+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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,11 +186,12 @@ vmmaster => {
|
||||
}
|
||||
},
|
||||
vm => {
|
||||
cols => [qw(node host migrationdest storage storagemodel cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter guestostype othersettings vidmodel vidproto vidpassword comments disable)],
|
||||
cols => [qw(node mgr host migrationdest storage storagemodel cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter cluster guestostype othersettings vidmodel vidproto vidpassword comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'Virtualization parameters',
|
||||
descriptions => {
|
||||
'node' => 'The node or static group name',
|
||||
'mgr' => 'The function manager for the virtual machine',
|
||||
'host' => 'The system that currently hosts the VM',
|
||||
'migrationdest' => 'A noderange representing candidate destinations for migration (i.e. similar systems, same SAN, or other criteria that xCAT can use',
|
||||
'storage' => 'A list of storage files or devices to be used. i.e. /cluster/vm/<nodename> or nfs://<server>/path/to/folder/',
|
||||
@@ -210,7 +211,8 @@ vm => {
|
||||
qcow2 is a sparse, copy-on-write capable format implemented at the virtualization layer rather than the filesystem level
|
||||
clonemethod=[qemu-img|reflink]
|
||||
qemu-img allows use of qcow2 to generate virtualization layer copy-on-write
|
||||
reflink uses a generic filesystem facility to clone the files on your behalf, but requires filesystem support such as btrfs ',
|
||||
reflink uses a generic filesystem facility to clone the files on your behalf, but requires filesystem support such as btrfs
|
||||
placement_affinity=[migratable|user_migratable|pinned]',
|
||||
'vncport' => 'Tracks the current VNC display port (currently not meant to be set',
|
||||
'textconsole' => 'Tracks the Psuedo-TTY that maps to the serial port or console of a VM',
|
||||
'powerstate' => "This flag is used by xCAT to track the last known power state of the VM.",
|
||||
@@ -218,19 +220,21 @@ vm => {
|
||||
'guestostype' => "This allows administrator to specify an identifier for OS to pass through to virtualization stack. Normally this should be ignored as xCAT will translate from nodetype.os rather than requiring this field be used\n",
|
||||
'beacon' => "This flag is used by xCAT to track the state of the identify LED with respect to the VM.",
|
||||
'datacenter' => "Optionally specify a datacenter for the VM to exist in (only applicable to VMWare)",
|
||||
'cluster' => 'Specify to the underlying virtualization infrastructure a cluster membership for the hypervisor.',
|
||||
'vidproto' => "Request a specific protocol for remote video access be set up. For example, spice in KVM.",
|
||||
'vidmodel' => "Model of video adapter to provide to guest. For example, qxl in KVM",
|
||||
'vidpassword' => "Password to use instead of temporary random tokens for VNC and SPICE access",
|
||||
}
|
||||
},
|
||||
hypervisor => {
|
||||
cols => [qw(node type mgr netmap defaultnet cluster datacenter preferdirect comments disable)],
|
||||
cols => [qw(node type mgr interface netmap defaultnet cluster datacenter preferdirect comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'Hypervisor parameters',
|
||||
descriptions => {
|
||||
'node' => 'The node or static group name',
|
||||
'type' => 'The plugin associated with hypervisor specific commands such as revacuate',
|
||||
mgr => 'The virtualization specific manager of this hypervisor when applicable',
|
||||
'mgr' => 'The virtualization specific manager of this hypervisor when applicable',
|
||||
'interface' => 'The defition of interfaces for the hypervisor. The format is [networkname:interfacename:bootprotocol:IP:netmask:gateway] that split with | for each interface',
|
||||
'netmap' => 'Optional mapping of useful names to relevant physical ports. For example, 10ge=vmnic_16.0&vmnic_16.1,ge=vmnic1 would be requesting two virtual switches to be created, one called 10ge with vmnic_16.0 and vmnic_16.1 bonded, and another simply connected to vmnic1. Use of this allows abstracting guests from network differences amongst hypervisors',
|
||||
'defaultnet' => 'Optionally specify a default network entity for guests to join to if they do not specify.',
|
||||
'cluster' => 'Specify to the underlying virtualization infrastructure a cluster membership for the hypervisor.',
|
||||
@@ -238,6 +242,20 @@ hypervisor => {
|
||||
'preferdirect' => 'If a mgr is declared for a hypervisor, xCAT will default to using the mgr for all operations. If this is field is set to yes or 1, xCAT will prefer to directly communicate with the hypervisor if possible'
|
||||
}
|
||||
},
|
||||
virtsd => {
|
||||
cols => [qw(node sdtype stype location host cluster datacenter comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'The parameters which used to create the Storage Domain',
|
||||
descriptions => {
|
||||
'node' => 'The name of the storage domain',
|
||||
'sdtype' => 'The type of storage domain. Valid values: data, iso, export',
|
||||
'stype' => 'The type of storge. Valid values: nfs, fcp, iscsi, localfs',
|
||||
'location' => 'The path of the storage',
|
||||
'host' => 'For rhev, a hypervisor host needs to be specified to manage the storage domain as SPM (Storage Pool Manager). But the SPM role will be failed over to another host when this host down.',
|
||||
'cluster' => 'A cluster of hosts',
|
||||
'datacenter' => 'A collection for all host, vm that will shared the same storages, networks.',
|
||||
}
|
||||
},
|
||||
websrv => {
|
||||
cols => [qw(node port username password comments disable)],
|
||||
keys => [qw(node)],
|
||||
@@ -830,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".
|
||||
@@ -916,6 +937,8 @@ site => {
|
||||
" mgmt node.\n\n".
|
||||
" timezone: (e.g. America/New_York)\n\n".
|
||||
" tftpdir: tftp directory path. Default is /tftpboot\n\n".
|
||||
" tftpflags: The flags that used to start tftpd. Default is \'-v -l -s /tftpboot \n".
|
||||
" -m /etc/tftpmapfile4xcat.conf\' if tftplfags is not set\n\n".
|
||||
" useNmapfromMN: When set to yes, nodestat command should obtain the node status\n".
|
||||
" using nmap (if available) from the management node instead of the\n".
|
||||
" service node. This will improve the performance in a flat network.\n\n".
|
||||
@@ -952,8 +975,8 @@ switch => {
|
||||
node => 'The node name or group name.',
|
||||
switch => 'The switch hostname.',
|
||||
port => 'The port number in the switch that this node is connected to. On a simple 1U switch, an administrator can generally enter the number as printed next to the ports, and xCAT will understand switch representation differences. On stacked switches or switches with line cards, administrators should usually use the CLI representation (i.e. 2/0/1 or 5/8). One notable exception is stacked SMC 8848M switches, in which you must add 56 for the proceeding switch, then the port number. For example, port 3 on the second switch in an SMC8848M stack would be 59',
|
||||
vlan => 'xCAT currently does not make use of this field, however it may do so in the future. For now, it can be used by administrators for their own purposes, but keep in mind some xCAT feature later may try to enforce this if set',
|
||||
interface => 'The interface name from the node perspective. This is not currently used by xCAT, but administrators may wish to use this for their own purposes',
|
||||
vlan => 'The ID for the tagged vlan that is created on this port using mkvlan and chvlan commands.',
|
||||
interface => 'The interface name from the node perspective. For example, eth0. For the primary nic, it can be empty, the word "primary" or "primary:ethx" where ethx is the interface name.',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
@@ -1750,6 +1773,12 @@ my @nodeattrs = (
|
||||
tabentry => 'mp.id',
|
||||
access_tabentry => 'mp.node=attr:node',
|
||||
},
|
||||
{attr_name => 'id',
|
||||
only_if => 'mgt=ipmi',
|
||||
tabentry => 'mp.id',
|
||||
access_tabentry => 'mp.node=attr:node',
|
||||
},
|
||||
|
||||
#################
|
||||
# mpa table #
|
||||
#################
|
||||
@@ -1790,6 +1819,10 @@ my @nodeattrs = (
|
||||
######################
|
||||
# vm table #
|
||||
######################
|
||||
{attr_name => 'vmmanager',
|
||||
tabentry => 'vm.mgr',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmhost',
|
||||
tabentry => 'vm.host',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
@@ -1834,6 +1867,10 @@ my @nodeattrs = (
|
||||
tabentry => 'vm.virtflags',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmmaster',
|
||||
tabentry => 'vm.master',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmvncport',
|
||||
tabentry => 'vm.vncport',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
@@ -1846,6 +1883,29 @@ my @nodeattrs = (
|
||||
tabentry => 'vm.beacon',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmcluster',
|
||||
tabentry => 'vm.cluster',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
######################
|
||||
# hypervisor table #
|
||||
######################
|
||||
{attr_name => 'hosttype',
|
||||
tabentry => 'hypervisor.type',
|
||||
access_tabentry => 'hypervisor.node=attr:node',
|
||||
},
|
||||
{attr_name => 'hostinterface',
|
||||
tabentry => 'hypervisor.interface',
|
||||
access_tabentry => 'hypervisor.node=attr:node',
|
||||
},
|
||||
{attr_name => 'hostmanager',
|
||||
tabentry => 'hypervisor.mgr',
|
||||
access_tabentry => 'hypervisor.node=attr:node',
|
||||
},
|
||||
{attr_name => 'hostcluster',
|
||||
tabentry => 'hypervisor.cluster',
|
||||
access_tabentry => 'hypervisor.node=attr:node',
|
||||
},
|
||||
######################
|
||||
# websrv table #
|
||||
######################
|
||||
@@ -2101,6 +2161,11 @@ push(@{$defspec{node}->{'attrs'}}, @nodeattrs);
|
||||
tabentry => 'linuximage.crashkernelsize',
|
||||
access_tabentry => 'linuximage.imagename=attr:imagename',
|
||||
},
|
||||
{attr_name => 'usercomment',
|
||||
only_if => 'imagetype=linux',
|
||||
tabentry => 'linuximage.comments',
|
||||
access_tabentry => 'linuximage.imagename=attr:imagename',
|
||||
},
|
||||
####################
|
||||
# nimimage table#
|
||||
####################
|
||||
|
||||
+16
-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
|
||||
@@ -2108,6 +2117,8 @@ sub _refresh_cache { #if cache exists, force a rebuild, leaving reference counts
|
||||
# (uses stale nodelist data and misses new nodes, the error)
|
||||
#1st noderange finishes
|
||||
#2nd noderange finishes
|
||||
} else { #even if a cache is not in use *right this second*, we need to mark any cached data that may exist as invalid, do so by suggesting the cache is from 1970
|
||||
if ($self->{_cachestamp}) { $self->{_cachestamp}=0; }
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2303,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} =~ /^\|.*\|.*\|$/)
|
||||
{
|
||||
@@ -3241,6 +3253,7 @@ sub delEntries
|
||||
$stmt->execute(@stargs);
|
||||
$stmt->finish;
|
||||
|
||||
$self->_refresh_cache(); #cache is invalid, refresh
|
||||
#notify the interested parties
|
||||
if ($notif == 1)
|
||||
{
|
||||
|
||||
+53
-9
@@ -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]
|
||||
@@ -390,6 +404,31 @@ Options:
|
||||
"Usage:
|
||||
rmflexnode [-h|--help|-v|--version]
|
||||
rmflexnode <noderange>",
|
||||
"lsve" =>
|
||||
"Usage:
|
||||
lsve [-t type] [-m manager] [-o object]
|
||||
-t: dc - 'Data Center', cl - 'Cluster', sd - 'Storage Domain', nw - 'Network', tpl -'Template'
|
||||
-m: FQDN (Fully Qualified Domain Name) of the rhev manager
|
||||
-o: Target object to display",
|
||||
"cfgve" =>
|
||||
"Usage:
|
||||
cfgve -t dc -m manager -o object [-c -k nfs|localfs | -r]
|
||||
cfgve -t cl -m manager -o object [-c -p cpu type | -r -f]
|
||||
cfgve -t sd -m manager -o object [-c | -g | -s | -a | -b | -r -f]
|
||||
-t: sd - 'Storage Domain', nw - 'Network', tpl -'Template'
|
||||
-m: FQDN (Fully Qualified Domain Name) of the rhev manager
|
||||
-o: Target object to configure
|
||||
cfgve -t nw -m manager -o object [-c -d data center -n vlan ID | -a -l cluster| -b | -r]
|
||||
cfgve -t tpl -m manager -o object [-r]",
|
||||
"chhypervisor" =>
|
||||
"Usage:
|
||||
chhypervisor noderange [-a | -n | -p | -e | -d | -h]",
|
||||
"rmhypervisor" =>
|
||||
"Usage:
|
||||
rmhypervisor noderange [-f | -h]",
|
||||
"clonevm" =>
|
||||
"Usage:
|
||||
clonevm noderange [-t createmaster -f | -b basemaster -d | -h]",
|
||||
);
|
||||
my $vers = xCAT::Utils->Version();
|
||||
my %version = (
|
||||
@@ -414,7 +453,12 @@ my %version = (
|
||||
"lsflexnode" => "$vers",
|
||||
"mkflexnode" => "$vers",
|
||||
"rmflexnode" => "$vers",
|
||||
"nodeset" => "$vers"
|
||||
"nodeset" => "$vers",
|
||||
"lsve" => "$vers",
|
||||
"cfgve" => "$vers",
|
||||
"chhypervisor" => "$vers",
|
||||
"rmhypervisor" => "$vers",
|
||||
"clonevm" => "$vers",
|
||||
);
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
+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;
|
||||
}
|
||||
@@ -22,24 +22,17 @@ I:xlsmp.rte
|
||||
# AIX bundle package list for PE
|
||||
|
||||
# POE
|
||||
I:ppe.poe
|
||||
I:ppe.pdb
|
||||
I:ppe.rte
|
||||
#I:ppe.man
|
||||
I:ppe.loc.license
|
||||
|
||||
# needed on login node
|
||||
#I:ppe.hpct
|
||||
#I:ppedev.hpct
|
||||
|
||||
# LAPI
|
||||
I:rsct.lapi
|
||||
#I:rsct.lapi
|
||||
#I:rsct.sci
|
||||
|
||||
# MetaCluster (checkpoint/restore)
|
||||
I:mcr.rte
|
||||
I:mdcr
|
||||
|
||||
|
||||
|
||||
# AIX bundle file for ESSL and PESSL packages
|
||||
|
||||
# ESSL
|
||||
@@ -53,11 +46,7 @@ I:essl.loc.license
|
||||
|
||||
# PESSL
|
||||
I:pessl.rte.up
|
||||
I:pessl.rte.smp
|
||||
I:pessl.rte.rs1
|
||||
I:pessl.rte.mp
|
||||
I:pessl.rte.hv
|
||||
I:pessl.rte.common
|
||||
I:pessl.rte
|
||||
I:pessl.msg.en_US
|
||||
#I:pessl.msg.En_US
|
||||
|
||||
Executable → Regular
+48
-17
@@ -1,4 +1,9 @@
|
||||
#!/bin/ksh
|
||||
#!/usr/bin/ksh
|
||||
|
||||
#
|
||||
# example postscript intended to reduce OS jitter
|
||||
#
|
||||
|
||||
trap "chmod 774 /etc/rc.tcpip" INT QUIT TERM EXIT
|
||||
|
||||
#NB: WANT TO ADD THIS BACK IN AT SOME POINT - SYSTEM HANG DETECTION DEAMON
|
||||
@@ -26,7 +31,6 @@ rmitab piobe > /dev/null 2>&1
|
||||
#qdaemon:23456789:wait:/usr/bin/startsrc -sqdaemon
|
||||
rmitab qdaemon > /dev/null 2>&1
|
||||
|
||||
#do we really need wpar support now?
|
||||
rcwpars:2:once:/etc/rc.wpars > /dev/console 2>&1 # Corrals autostart
|
||||
rmitab rcwpars > /dev/null 2>&1
|
||||
|
||||
@@ -85,15 +89,19 @@ rmitab ctrmc > /dev/null 2>&1
|
||||
#dscrset:2:once:/usr/sbin/dscrctl -n -s 30 >/dev/null 2>/dev/console
|
||||
|
||||
#to disable sendmail daemon, need to comment the line in /etc/rc.tcpip that begins: start /usr/lib/sendmail
|
||||
#As of 11/16/10 John L. re-enable sendmail as some subsystems want to use this for PERCS
|
||||
#Unless someone says we need it, it's back off - 4/18/11 John L.
|
||||
grep -q "^start /usr/lib/sendmail" /etc/rc.tcpip
|
||||
if [[ $? -eq 0 ]] then
|
||||
cat /etc/rc.tcpip | sed 's/^start \/usr\/lib\/sendmail/#start \/usr\/lib\/sendmail/' > /tmp/rc.tcpip.tmpfile.$$
|
||||
cp -p /etc/rc.tcpip /etc/rc.tcpip.prev
|
||||
mv /tmp/rc.tcpip.tmpfile.$$ /etc/rc.tcpip
|
||||
# Leave enabled on login nodes
|
||||
host `hostname` | grep -qE "l[0-9]+"
|
||||
if [[ $? -ne 0 ]]
|
||||
then
|
||||
|
||||
grep -q "^start /usr/lib/sendmail" /etc/rc.tcpip
|
||||
if [[ $? -eq 0 ]] then
|
||||
cat /etc/rc.tcpip | sed 's/^start \/usr\/lib\/sendmail/#start \/usr\/lib\/sendmail/' > /tmp/rc.tcpip.tmpfile.$$
|
||||
cp -p /etc/rc.tcpip /etc/rc.tcpip.prev
|
||||
mv /tmp/rc.tcpip.tmpfile.$$ /etc/rc.tcpip
|
||||
fi
|
||||
stopsrc -s sendmail > /dev/null 2>&1
|
||||
fi
|
||||
stopsrc -s sendmail > /dev/null 2>&1
|
||||
|
||||
|
||||
#to disable aixmibd daemon, need to comment the line in /etc/rc.tcpip that begins: start /usr/sbin/aixmibd
|
||||
@@ -123,20 +131,42 @@ if [[ $? -eq 0 ]] then
|
||||
fi
|
||||
stopsrc -s snmpmibd > /dev/null 2>&1
|
||||
|
||||
#disable the prngd daemon (the random daemon is more efficient)
|
||||
stopsrc -s prngd
|
||||
|
||||
chmod 774 /etc/rc.tcpip
|
||||
|
||||
#try to clean up some cron junk - we only touch the crontab file once (and save a backup)
|
||||
if [[ ! -f /var/spool/cron/crontabs/root.before.clean_jitter ]] then
|
||||
cp -p /var/spool/cron/crontabs/root /var/spool/cron/crontabs/root.before.clean_jitter
|
||||
|
||||
grep -v "bin\/pmcfg" /var/spool/cron/crontabs/root | grep -v "bin\/stcron" | grep -v "bin\/dumpctr" | \
|
||||
grep -v "ras\/dumpcheck" > /var/spool/cron/crontabs/root.after.clean_jitter
|
||||
|
||||
egrep -v "bin\/pmcfg|bin\/stcron|bin\/dumpctr|ras\/dumpcheck|bin\/errclear" /var/spool/cron/crontabs/root > /var/spool/cron/crontabs/root.after.clean_jitter
|
||||
|
||||
cp /var/spool/cron/crontabs/root.after.clean_jitter /var/spool/cron/crontabs/root
|
||||
fi
|
||||
|
||||
for i in $(ps -efk | grep "topasrec" | grep -v killproc | grep -v grep | awk ' {print $2} ') ; do
|
||||
kill $i
|
||||
done
|
||||
#for i in $(ps -efk | egrep "\/usr\/sbin\/cron|topasrec" | grep -v grep | awk ' { print $2} ') ; do
|
||||
# kill $i
|
||||
#done
|
||||
#
|
||||
#nohup /usr/sbin/cron > /dev/null 2>&1 &
|
||||
|
||||
CRON="/usr/sbin/cron"
|
||||
|
||||
# Find PID for cron process - check for exact pattern match on process name and it's parent PID is 1
|
||||
CRON_PID=$(ps -ef | grep ${CRON} | grep -v grep | awk '{ if ($NF = "${CRON}" && $3 == "1") { print $2 }}')
|
||||
|
||||
if [ -n "${CRON_PID}" ]
|
||||
then
|
||||
echo "Killing ${CRON} (${CRON_PID}) to re-read config file(s)"
|
||||
kill ${CRON_PID}
|
||||
fi
|
||||
|
||||
# Allow time to respawn from inittab
|
||||
sleep 1
|
||||
|
||||
# Print new cron PID
|
||||
CRON_PID=$(ps -ef | grep ${CRON} | grep -v grep | awk '{ if ($NF = "${CRON}" && $3 == "1") { print $2 }}')
|
||||
echo "New cron PID is ${CRON_PID}"
|
||||
|
||||
ls -l /etc/rc.tcpip
|
||||
telinit q
|
||||
@@ -150,6 +180,7 @@ if [[ $? -ne 0 ]] then
|
||||
echo '* cosched1 18 100 97 10' >> /etc/poe.priority
|
||||
echo '* cosched2 13 100 99.5 10' >> /etc/poe.priority
|
||||
echo '* cosched3 13 100 99 3' >> /etc/poe.priority
|
||||
echo '* cosched4 18 100 97 1' >> /etc/poe.priority
|
||||
chmod 644 /etc/poe.priority
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/ksh
|
||||
|
||||
# Cleanly reboots an AIX node
|
||||
|
||||
echo "Shutting and rebooting node NOW !!!"
|
||||
echo "shutdown -Fr" | at now
|
||||
|
||||
exit 0
|
||||
@@ -11,14 +11,18 @@ I:essl.loc.license
|
||||
|
||||
# PESSL
|
||||
I:pessl.rte.up
|
||||
I:pessl.rte.smp
|
||||
I:pessl.rte.rs1
|
||||
I:pessl.rte.mp
|
||||
# If you are using PESSL 4.1.0 or beyond, comment pessl.rte.hv out, it's not needed.
|
||||
I:pessl.rte.hv
|
||||
I:pessl.rte.common
|
||||
I:pessl.rte
|
||||
I:pessl.msg.en_US
|
||||
|
||||
# If you are using PESSL 4.1.0 or beyond, comment pessl.rte.hv out, it's not needed.
|
||||
#I:pessl.rte.hv
|
||||
|
||||
# If you are using PESSL 4.2.0 or beyond, comment pessl.rte.smp,pessl.rte.rs1,and pessl.rte.common, they have been built into pessl.rte.up and pessl.rte.mp
|
||||
#I:pessl.rte.common
|
||||
#I:pessl.rte.smp
|
||||
#I:pessl.rte.rs1
|
||||
|
||||
#I:pessl.msg.En_US
|
||||
#I:pessl.man.en_US
|
||||
I:pessl.loc.license
|
||||
|
||||
@@ -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,17 @@
|
||||
#!/usr/bin/ksh
|
||||
|
||||
#
|
||||
# example postscript to tune ml interface for improved stability and performance
|
||||
#
|
||||
|
||||
chdev -l mlt0 -a agg_killtime=-1 2>/dev/null # allow "agg_interval" and "agg_threshold" to default
|
||||
|
||||
# The effect of the above is that complete ml route entries last forever, incomplete entries time out
|
||||
# in 40 seconds, and there are no keepalive probes for complete entries (to reduce OS jitter).
|
||||
|
||||
# The following is also recommended to improve balance across hf interfaces (assuming sequential ml
|
||||
# addressing, at least within each drawer). Note that "agg_hash" must be set PRIOR to the ml interface
|
||||
# being configured.
|
||||
|
||||
chdev -l mlt0 -a agg_hash=2 2>/dev/null
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
# AIX bundle package list for PE
|
||||
|
||||
# POE
|
||||
I:ppe.poe
|
||||
I:ppe.pdb
|
||||
I:ppe.rte
|
||||
#I:ppe.man
|
||||
I:ppe.loc.license
|
||||
|
||||
# needed on login node
|
||||
#I:ppe.hpct
|
||||
#I:ppedev.hpct
|
||||
|
||||
# LAPI
|
||||
I:rsct.lapi
|
||||
#I:rsct.lapi
|
||||
#I:rsct.sci
|
||||
|
||||
# MetaCluster (checkpoint/restore)
|
||||
I:mcr.rte
|
||||
I:mdcr
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,25 @@
|
||||
|
||||
OS=`uname`
|
||||
|
||||
# On AIX, need to correctly configure LAPI kernel extensions on a
|
||||
# diskless node boot
|
||||
# (added for PE 1.2 and newer releases)
|
||||
if [ "$OS" == "AIX" ]; then
|
||||
if [ "$NODESETSTATE" = "netboot" -o \
|
||||
"$NODESETSTATE" = "statelite" -o \
|
||||
"$NODESETSTATE" = "diskless" -o \
|
||||
"$NODESETSTATE" = "dataless" ]; then
|
||||
# Unconfigure any existing LAPI kernel extension
|
||||
if [ -x /etc/methods/ucfgzcmem ] ; then
|
||||
/etc/methods/ucfgzcmem
|
||||
fi
|
||||
# Configure the LAPI kernel extension at the latest level
|
||||
if [ -x /etc/methods/cfgzcmem ] ; then
|
||||
/etc/methods/cfgzcmem
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Configure the PNSD.cfg to use a smaller log so it doesn't use so much memory
|
||||
# for a stateless image. Normally, pnsd creates this file if it does not
|
||||
# exist, but it will not fill it in if it does exist.
|
||||
@@ -92,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
|
||||
|
||||
@@ -45,6 +45,10 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/rsct
|
||||
|
||||
%ifos linux
|
||||
cp -a share/xcat/IBMhpc/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/
|
||||
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/ping-all/
|
||||
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/ml-tuning
|
||||
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/aix-clean-jitter
|
||||
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/aix-reboot
|
||||
chmod -R 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/*
|
||||
%else
|
||||
cp -hpR share/xcat/IBMhpc/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/IBMhpc/
|
||||
|
||||
@@ -347,7 +347,6 @@ legend {
|
||||
|
||||
.actionBar {
|
||||
display: inline-table;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.actionBar div {
|
||||
@@ -365,7 +364,6 @@ legend {
|
||||
|
||||
/*--- jQuery datatable ---*/
|
||||
.dataTables_wrapper {
|
||||
overflow: auto;
|
||||
width: auto;
|
||||
margin: 10px auto;
|
||||
-moz-border-radius: 3px;
|
||||
|
||||
@@ -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>');
|
||||
|
||||
+213
-144
@@ -1,3 +1,4 @@
|
||||
var iframeTimer;
|
||||
/**
|
||||
* Execute when the DOM is fully loaded
|
||||
*/
|
||||
@@ -21,19 +22,19 @@ var hmcPlugin = function() {
|
||||
*/
|
||||
hmcPlugin.prototype.getStep = function() {
|
||||
return [ 'Basic patterns', 'Supernode', 'More patterns',
|
||||
'Power on hardware', 'Discover frames', 'Management node',
|
||||
'Power on hardware', 'Discover frames', 'Discover hmcs', 'Management node',
|
||||
'Discover Rest of Hardware and Update Definitions', 'Create LPARs' ];
|
||||
};
|
||||
|
||||
hmcPlugin.prototype.getInitFunction = function() {
|
||||
return [ powerInitBasicPattern, powerInitSupernode, powerInitSiteTable,
|
||||
powerInitPoweronHardware, powerInitDiscoverFrames, powerInitConfig,
|
||||
powerInitPoweronHardware, powerInitDiscoverFrames, powerInitDiscoverHmc, powerInitConfig,
|
||||
powerInitUpdateDefinition, powerInitCreateLpar ];
|
||||
};
|
||||
|
||||
hmcPlugin.prototype.getNextFunction = function() {
|
||||
return [ checkBasicPattern, checkSupernode, checkSiteTable, undefined,
|
||||
checkFrameMtms, undefined, undefined, collectInputValue ];
|
||||
checkFrameMtms, checkHmcMtms, undefined, undefined, collectInputValue ];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -942,13 +943,31 @@ function showSiteArea() {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'ifconfig | grep -E "encap|Mask"'
|
||||
cmd : 'ifconfig | egrep "encap|Mask"'
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
$('#discoverContentDiv #siteTableStat div').html(
|
||||
'Current network interface configuration:<br/><pre>'
|
||||
+ data.rsp + '</pre>');
|
||||
var ipvlan1 = 'addr:' + getDiscoverEnv('vlan1ip') + '\.[0-9]+\.[0-9]+\.[0-9]+';
|
||||
var ipvlan2 = 'addr:' + getDiscoverEnv('vlan2ip') + '\.[0-9]+\.[0-9]+\.[0-9]+';
|
||||
var lines = data.rsp.split('\n');
|
||||
var iparray = new Array();
|
||||
var re1 = new RegExp(ipvlan1,"i");
|
||||
var re2 = new RegExp(ipvlan2,"i");
|
||||
for (var i in lines){
|
||||
var line = lines[i];
|
||||
if (line.match(ipvlan1)){
|
||||
var temp = re1.exec(line);
|
||||
iparray.push(temp[0].substr(5));
|
||||
}
|
||||
if (line.match(ipvlan2)){
|
||||
var temp = re2.exec(line);
|
||||
iparray.push(temp[0].substr(5));
|
||||
}
|
||||
}
|
||||
setDiscoverEnv('ipfordiscovery', iparray.join(','));
|
||||
}
|
||||
});
|
||||
createDiscoverButtons();
|
||||
@@ -1035,8 +1054,7 @@ function powerInitPoweronHardware() {
|
||||
function powerInitDiscoverFrames() {
|
||||
$('#discoverContentDiv').empty();
|
||||
$('.tooltip').remove();
|
||||
var showDiv = $('<div style="min-height:360px" id="discoverShow"><h2>'
|
||||
+ steps[currentStep] + '</h2>');
|
||||
var showDiv = '<h2>' + steps[currentStep] + '</h2></div><div style="min-height:360px" id="discoverShow">';
|
||||
$('#discoverContentDiv').append(showDiv);
|
||||
|
||||
//the discover button, use lsslp
|
||||
@@ -1044,7 +1062,7 @@ function powerInitDiscoverFrames() {
|
||||
discoverButton.bind('click', function(){
|
||||
$('#discoverShow').empty();
|
||||
$('#discoverContentDiv button').remove();
|
||||
$('#discoverShow').append(createStatusBar('framedisc'));
|
||||
$('#discoverShow').append(createStatusBar('discoverdisc'));
|
||||
$('#discoverShow').append('<center><table><tr><td id="frameTd">'
|
||||
+ '</td><td style="width:20px"></td><td id="mtmsTd"></td></tr></table></center>');
|
||||
discoverFrame();
|
||||
@@ -1056,8 +1074,8 @@ function powerInitDiscoverFrames() {
|
||||
importButton.bind('click', function(){
|
||||
$('#discoverShow').empty();
|
||||
$('#discoverContentDiv button').remove();
|
||||
$('#discoverShow').append(createStatusBar('framedisc'));
|
||||
$('#framedisc div').html('Use the mtms map file with the format <framename> <mtm> <serial>(frame1 78AC-100 9920032).');
|
||||
$('#discoverShow').append(createStatusBar('discoverdisc'));
|
||||
$('#discoverdisc div').html('Use the mtms map file with the format <framename> <mtm> <serial>(frame1 78AC-100 9920032).');
|
||||
$('#discoverShow').append('<center><form action="lib/upload.php" method="post" enctype="multipart/form-data">MTMS map file:'
|
||||
+ '<input type="file" name="file"></form></center>');
|
||||
$('#discoverShow form').append(createButton('Parse'));
|
||||
@@ -1071,7 +1089,7 @@ function powerInitDiscoverFrames() {
|
||||
var mapArray = getDiscoverEnv('framemtmsmap').split(';');
|
||||
for (var i in mapArray) {
|
||||
var tempArray = mapArray[i].split(',');
|
||||
showMap(tempArray[0], tempArray[1], 0);
|
||||
showMap(tempArray[0], tempArray[1], 0, 'Frame and MTMS map');
|
||||
}
|
||||
|
||||
createDiscoverButtons();
|
||||
@@ -1080,7 +1098,7 @@ function powerInitDiscoverFrames() {
|
||||
}
|
||||
|
||||
function discoverFrame(){
|
||||
$('#framedisc div').append('Discovering all Frames by lsslp.').append(createLoader());
|
||||
$('#discoverdisc div').append('Discovering all Frames by lsslp.').append(createLoader());
|
||||
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@@ -1095,7 +1113,7 @@ function discoverFrame(){
|
||||
success : function(data) {
|
||||
var tempInfo = data.rsp[0];
|
||||
if (-1 != tempInfo.indexOf('Error')) {
|
||||
$('#framedisc div').html(tempInfo);
|
||||
$('#discoverdisc div').html(tempInfo);
|
||||
createDiscoverButtons();
|
||||
return;
|
||||
}
|
||||
@@ -1105,7 +1123,7 @@ function discoverFrame(){
|
||||
|
||||
// Check the defined number and discovered number
|
||||
if (mtmsArray.length != frameArray.length) {
|
||||
$('#framedisc div').html(
|
||||
$('#discoverdisc div').html(
|
||||
'Error: Definded Number is ' + frameArray.length
|
||||
+ ', but lsslp discovered Number is '
|
||||
+ mtmsArray.length
|
||||
@@ -1114,20 +1132,20 @@ function discoverFrame(){
|
||||
return;
|
||||
}
|
||||
|
||||
$('#framedisc div').html(
|
||||
$('#discoverdisc div').html(
|
||||
'Mapping the frame name and mtms which discovered by lsslp.<br\>'
|
||||
+ 'Select the frame name, then select the mtms.');
|
||||
|
||||
for (var i in frameArray) {
|
||||
$('#frameTd').append(
|
||||
'<p><input name="frameradio" type="radio" onclick="createMap(this)"><span>'
|
||||
'<p><input name="frameradio" type="radio" onclick="createMap(this, \'Frame and MTMS map\')"><span>'
|
||||
+ frameArray[i] + '</span></p>');
|
||||
|
||||
}
|
||||
|
||||
for (var i in mtmsArray) {
|
||||
$('#mtmsTd').append(
|
||||
'<p><input name="mtmsradio" type="radio" onclick="createMap(this)"><span>'
|
||||
'<p><input name="mtmsradio" type="radio" onclick="createMap(this, \'Frame and MTMS map\')"><span>'
|
||||
+ mtmsArray[i] + '</span></p>');
|
||||
}
|
||||
|
||||
@@ -1137,8 +1155,20 @@ function discoverFrame(){
|
||||
}
|
||||
|
||||
function parseMtmsMap(responseText){
|
||||
var frameArray = expandNR(getDiscoverEnv('frameName'));
|
||||
var lines = responseText.split("\n");
|
||||
var typeflag;
|
||||
var nodeArray;
|
||||
if ($('#discoverContentDiv h2').text().toLocaleLowerCase().indexOf('hmc') >= 0){
|
||||
typeflag = 'hmc';
|
||||
nodeArray= expandNR(getDiscoverEnv('hmcName'));
|
||||
}
|
||||
else{
|
||||
typeflag = 'frame';
|
||||
nodeArray= expandNR(getDiscoverEnv('frameName'));
|
||||
}
|
||||
|
||||
//replace the \r\n for different os file eol format
|
||||
responseText = responseText.replace(/[\r\n]+/g, ";");
|
||||
var lines = responseText.split(";");
|
||||
var temphash = new Object();
|
||||
var nulldefine = '';
|
||||
|
||||
@@ -1150,33 +1180,33 @@ function parseMtmsMap(responseText){
|
||||
temphash[tempname] = tempmtm + '-' + tempserial;
|
||||
}
|
||||
|
||||
for (var i in frameArray){
|
||||
var tempname = frameArray[i];
|
||||
for (var i in nodeArray){
|
||||
var tempname = nodeArray[i];
|
||||
if (!temphash[tempname]){
|
||||
if (!nulldefine){
|
||||
nulldefine += 'tempname';
|
||||
nulldefine += tempname;
|
||||
}
|
||||
else{
|
||||
nulldefine += ', tempname';
|
||||
nulldefine += ',' + tempname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nulldefine){
|
||||
$('#framedisc div').html(
|
||||
$('#discoverdisc div').html(
|
||||
'Error: ' + nulldefine + ' was not defined in the map file, please check!');
|
||||
return;
|
||||
}
|
||||
else{
|
||||
for (var i in temphash){
|
||||
showMap(i, temphash[i], 0);
|
||||
showMap(i, temphash[i], 0, 'Frame and MTMS map');
|
||||
}
|
||||
}
|
||||
|
||||
createDiscoverButtons();
|
||||
}
|
||||
|
||||
function createMap(obj) {
|
||||
function createMap(obj, fieldtitle) {
|
||||
var fname = '';
|
||||
var mname = '';
|
||||
|
||||
@@ -1193,16 +1223,16 @@ function createMap(obj) {
|
||||
}
|
||||
|
||||
$('#discoverShow :checked').parent().remove();
|
||||
showMap(fname, mname, 1);
|
||||
showMap(fname, mname, 1, fieldtitle);
|
||||
}
|
||||
|
||||
function showMap(fname, mname, deleteflag) {
|
||||
function showMap(fname, mname, deleteflag, fieldtitle) {
|
||||
var rowClass = '';
|
||||
var deleteicon = '';
|
||||
if ($('#discoverShow fieldset').size() < 1) {
|
||||
$('#discoverShow')
|
||||
.append(
|
||||
'<fieldset><legend>Frame and MTMS map</legend><center><table></table></center></fieldset>');
|
||||
'<fieldset><legend>' + fieldtitle + '</legend><center><table></table></center></fieldset>');
|
||||
}
|
||||
|
||||
if (0 == $('#discoverShow fieldset tr').size() % 2) {
|
||||
@@ -1292,7 +1322,96 @@ function checkFrameMtms(operType) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 7: Create the xcatsetup configure file and run xcatsetup to define all
|
||||
* Step 7: define the hmc mtms map
|
||||
*/
|
||||
|
||||
function powerInitDiscoverHmc() {
|
||||
$('#discoverContentDiv').empty();
|
||||
$('.tooltip').remove();
|
||||
var showDiv = '<h2>' + steps[currentStep] + '</h2><div style="min-height:360px" id="discoverShow"></div>';
|
||||
$('#discoverContentDiv').append(showDiv);
|
||||
|
||||
//the discover button, use lsslp
|
||||
var discoverButton = createButton('Discovery by lsslp');
|
||||
discoverButton.bind('click', function(){
|
||||
|
||||
});
|
||||
|
||||
//the import button, use mtms map file
|
||||
var importButton = createButton('Import the mtms map file');
|
||||
importButton.bind('click', function(){
|
||||
$('#discoverShow').empty();
|
||||
$('#discoverContentDiv button').remove();
|
||||
$('#discoverShow').append(createStatusBar('discoverdisc'));
|
||||
$('#discoverdisc div').html('Use the mtms map file with the format <hmcname> <mtm> <serial>(hmc1 7042CR6 10689EC).');
|
||||
$('#discoverShow').append('<center><form action="lib/upload.php" method="post" enctype="multipart/form-data">MTMS map file:'
|
||||
+ '<input type="file" name="file"></form></center>');
|
||||
$('#discoverShow form').append(createButton('Parse'));
|
||||
$('#discoverShow form').ajaxForm({
|
||||
success : parseMtmsMap
|
||||
});
|
||||
});
|
||||
$('#discoverShow').append(importButton);
|
||||
|
||||
if (getDiscoverEnv('hmcmtmsmap')) {
|
||||
var mapArray = getDiscoverEnv('hmcmtmsmap').split(';');
|
||||
for (var i in mapArray) {
|
||||
var tempArray = mapArray[i].split(',');
|
||||
showMap(tempArray[0], tempArray[1], 0, 'HMC and MTMS map');
|
||||
}
|
||||
|
||||
createDiscoverButtons();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function checkHmcMtms(operType){
|
||||
// Check the number of radio button
|
||||
var vpdStr = '';
|
||||
$('#discoverShow .ui-state-error').remove();
|
||||
if (0 < $('#discoverShow :radio').size()) {
|
||||
var warnBar = createWarnBar('Map all of the hmc and mtms.');
|
||||
$('#discoverContentDiv #discoverShow').prepend(warnBar);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find out all maps
|
||||
var maps = '';
|
||||
$('#discoverShow fieldset tr').each(
|
||||
function() {
|
||||
var hmcname = $(this).children().eq(0).html();
|
||||
var mtms = $(this).children().eq(2).html();
|
||||
var pos = mtms.lastIndexOf('-');
|
||||
var startpos = mtms.indexOf(':');
|
||||
|
||||
maps += (hmcname + ',' + mtms + ';');
|
||||
vpdStr += hmcname + ',' + mtms.substring(startpos + 1, pos) + ',' + mtms.substring(pos + 1) + ':';
|
||||
});
|
||||
|
||||
maps = maps.substr(0, maps.length - 1);
|
||||
vpdStr = vpdStr.substr(0, vpdStr.length - 1);
|
||||
setDiscoverEnv('hmcmtmsmap', maps);
|
||||
|
||||
if ('back' == operType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Write the maps into vpd table
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'updatevpd;' + vpdStr,
|
||||
msg : ''
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Step 8: Create the xcatsetup configure file and run xcatsetup to define all
|
||||
* objects in xcat database.
|
||||
*/
|
||||
function powerInitConfig(operType) {
|
||||
@@ -1325,7 +1444,7 @@ function powerInitConfig(operType) {
|
||||
createSetupFile();
|
||||
}
|
||||
/**
|
||||
* Step 7: Create the xcat configure file
|
||||
* Step 8: Create the xcat configure file
|
||||
*/
|
||||
function createSetupFile() {
|
||||
var fileContent = '';
|
||||
@@ -1404,7 +1523,7 @@ function createSetupFile() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 7: Run the xcatsetup command
|
||||
* Step 8: Run the xcatsetup command
|
||||
*/
|
||||
function runSetup() {
|
||||
$('#setupLine').append(createLoader());
|
||||
@@ -1428,8 +1547,21 @@ function runSetup() {
|
||||
});
|
||||
}
|
||||
|
||||
function updateFrameHeight(){
|
||||
var frameArray = document.getElementsByTagName('iframe');
|
||||
for (var i = 0;i < frameArray.length; i++){
|
||||
var tempiframe = document.getElementsByTagName('iframe')[i];
|
||||
tempiframe.height = tempiframe.contentWindow.document.documentElement.scrollHeight;
|
||||
}
|
||||
|
||||
//scroll the status div to the bottom automaticlly
|
||||
var infodiv = document.getElementById('returninfo');
|
||||
infodiv.scrollTop = infodiv.scrollHeight;
|
||||
|
||||
iframeTimer = setTimeout(updateFrameHeight, 2000);
|
||||
}
|
||||
/**
|
||||
* Step 8: Discover all HMC and CEC in the cluster and update into xCAT database
|
||||
* Step 9: Discover all HMC and CEC in the cluster and update into xCAT database
|
||||
*/
|
||||
function powerInitUpdateDefinition(operType) {
|
||||
$('#discoverContentDiv').empty();
|
||||
@@ -1446,9 +1578,7 @@ function powerInitUpdateDefinition(operType) {
|
||||
showStr += '<div id="outputinfo"></div><ul>';
|
||||
|
||||
showStr += '<li id="hmcLine1"><span class="ui-icon ' + iconClass
|
||||
+ '"></span>Discover HMCs.</li>';
|
||||
showStr += '<li id="hmcLine2"><span class="ui-icon ' + iconClass
|
||||
+ '"></span>Update HMCs into xCAT database.</li>';
|
||||
+ '"></span>Discover and define HMCs into xCAT database..</li>';
|
||||
showStr += '<li id="frameLine1"><span class="ui-icon ' + iconClass
|
||||
+ '"></span>Update Frames into xCAT database.</li>';
|
||||
showStr += '<li id="frameLine2"><span class="ui-icon ' + iconClass
|
||||
@@ -1476,121 +1606,56 @@ function powerInitUpdateDefinition(operType) {
|
||||
return;
|
||||
}
|
||||
|
||||
iframeTimer = setTimeout(updateFrameHeight, 10000);
|
||||
lsslpWriteHMC();
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: Write all the lsslp HMC info into database
|
||||
* Step 9: Write all the lsslp HMC info into database
|
||||
*/
|
||||
function lsslpWriteHMC() {
|
||||
$('#hmcLine1').append(createLoader());
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-s;HMC&msg=&opts=flush';
|
||||
var hmciframe1 = $('<iframe id="hmciframe1"></iframe>').attr('src', cmdlink).css({
|
||||
|
||||
$('#returninfo div').append('<p>Discovere HMCs and define into xCAT database.</p>');
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-w;-s;HMC;-t;2;';
|
||||
if (getDiscoverEnv('ipfordiscovery')){
|
||||
cmdlink += '-i;' + getDiscoverEnv('ipfordiscovery') + ';';
|
||||
}
|
||||
cmdlink += '-C;' + expandNR(getDiscoverEnv('hmcName')).length;
|
||||
cmdlink += '&msg=&opts=flush';
|
||||
var hmciframe1 = $('<iframe id="hmciframe1" scrolling="no"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
'width': '100%'
|
||||
});
|
||||
|
||||
hmciframe1.load( function() {
|
||||
var mapstring = "Add map between hmc and frames into xCAT database<br/>";
|
||||
//extract the return information from the iframe hmciframe1
|
||||
var mtmsArray = new Array();
|
||||
var hmclines = $(document.getElementById('hmciframe1').contentWindow.document.body).text();
|
||||
var temparray = hmclines.split("\n");
|
||||
for (var i in temparray){
|
||||
var line = temparray[i].replace(/(^\s*)|(\s*$)/g, "");
|
||||
if (line.toLowerCase().indexOf('hmc') >= 0){
|
||||
line = line.replace(/\s+/g, " ");
|
||||
var attrs = line.split(" ");
|
||||
//attrs[1] is mtm, attrs[2] is serial number
|
||||
mtmsArray.push(attrs[1], attrs[2]);
|
||||
}
|
||||
}
|
||||
// modify the page elements
|
||||
$('#returninfo div').append(hmciframe1);
|
||||
|
||||
hmciframe1.load(function() {
|
||||
$('#hmcLine1 img').remove();
|
||||
var tempSpan = $('#hmcLine1').find('span');
|
||||
tempSpan.removeClass('ui-icon-gear');
|
||||
tempSpan.addClass('ui-icon-check');
|
||||
$('#hmcLine2').append(createLoader());
|
||||
|
||||
var hmcArray = expandNR(getDiscoverEnv('hmcName'));
|
||||
var tempPar = '';
|
||||
|
||||
if (hmcArray.length > (mtmsArray.length / 2)) {
|
||||
// Error info
|
||||
$('#hmcLine2 img').remove();
|
||||
var warnBar = createWarnBar('Error: Defined ' + hmcArray.length
|
||||
+ ' HMCs, but discovered ' + mtmsArray.length / 2
|
||||
+ ' HMCs. Please check the configuration.');
|
||||
$('#discoverContentDiv div').prepend(warnBar);
|
||||
createDiscoverButtons();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the HMC and MTMs pair string
|
||||
for (var i in hmcArray) {
|
||||
var j = 2 * i;
|
||||
if ('' == tempPar) {
|
||||
tempPar += hmcArray[i] + ',' + mtmsArray[j] + ',' + mtmsArray[j + 1];
|
||||
} else {
|
||||
tempPar += ':' + hmcArray[i] + ',' + mtmsArray[j] + ',' + mtmsArray[j + 1];
|
||||
}
|
||||
mapstring += hmcArray[i] + '<----->' + mtmsArray[j] + '-' + mtmsArray[j + 1] + '<br/>';
|
||||
}
|
||||
|
||||
$('#returninfo div').append('<p>' + mapstring + '</p>');
|
||||
|
||||
// Write MTMs and HMC name pair into vpd table
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'updatevpd;' + tempPar,
|
||||
msg : ''
|
||||
},
|
||||
success : function() {
|
||||
$('#returninfo div').append('<p>Add the discovered HMCs into xCAT database.</p>');
|
||||
var cmklink2 = 'lib/cmd.php?cmd=lsslp&tgt=&args=-w;-s;HMC&msg=&opts=flush';
|
||||
var hmciframe2 = $('<iframe id="hmciframe2"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
});
|
||||
$('#returninfo div').append(hmciframe2);
|
||||
|
||||
hmciframe2.load(function() {
|
||||
$('#hmcLine2 img').remove();
|
||||
var tempSpan = $('#hmcLine2').find('span');
|
||||
tempSpan.removeClass('ui-icon-gear');
|
||||
tempSpan.addClass('ui-icon-check');
|
||||
lsslpWriteFrame();
|
||||
});
|
||||
}
|
||||
});
|
||||
lsslpWriteFrame();
|
||||
});
|
||||
|
||||
$('#returninfo div').append(hmciframe1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: Write all lsslp frame info into the database
|
||||
* Step 9: Write all lsslp frame info into the database
|
||||
*/
|
||||
function lsslpWriteFrame() {
|
||||
$('#frameLine1').append(createLoader());
|
||||
$('#returninfo div').append('<p>Write the discovered FRAMES into xCAT Database.</p>');
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-w;-s;FRAME&msg=&opts=flush';;
|
||||
var frameiframe1 = $('<iframe id="frameiframe1"></iframe>').attr('src', cmdlink).css({
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-w;-s;FRAME;';
|
||||
if (getDiscoverEnv('ipfordiscovery')){
|
||||
cmdlink += '-i;' + getDiscoverEnv('ipfordiscovery');
|
||||
}
|
||||
cmdlink += '&msg=&opts=flush';
|
||||
var frameiframe1 = $('<iframe id="frameiframe1" scrolling="no"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
'width': '100%'
|
||||
});
|
||||
$('#returninfo div').append(frameiframe1);
|
||||
|
||||
@@ -1604,7 +1669,7 @@ function lsslpWriteFrame() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: config the frame dhcp and dns
|
||||
* Step 9: config the frame dhcp and dns
|
||||
*/
|
||||
function frameSetup() {
|
||||
$('#frameLine2').append(createLoader());
|
||||
@@ -1632,18 +1697,17 @@ function frameSetup() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: reset the networks for frames
|
||||
* Step 9: reset the networks for frames
|
||||
*/
|
||||
function frameReset(){
|
||||
$('#frameLine3').append(createLoader());
|
||||
$('#returninfo div').append('<p>Reset network on FRAMES to get persistent IP.</p>');
|
||||
var cmdlink = 'lib/cmd.php?cmd=rspconfig&tgt=frame&args=--resetnet&msg=&opts=flush';;
|
||||
var frameiframe2 = $('<iframe id="frameiframe2"></iframe>').attr('src', cmdlink).css({
|
||||
var cmdlink = 'lib/cmd.php?cmd=rspconfig&tgt=frame&args=--resetnet&msg=&opts=flush';
|
||||
var frameiframe2 = $('<iframe id="frameiframe2" scrolling="no"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
'width': '100%'
|
||||
});
|
||||
$('#returninfo div').append(frameiframe2);
|
||||
frameiframe2.load(function() {
|
||||
@@ -1656,7 +1720,7 @@ function frameReset(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: create hardware connection for frames
|
||||
* Step 9: create hardware connection for frames
|
||||
*/
|
||||
function frameHwconn(){
|
||||
$('#frameLine4').append(createLoader());
|
||||
@@ -1684,18 +1748,21 @@ function frameHwconn(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: Write all the lsslp cec info into database
|
||||
* Step 9: Write all the lsslp cec info into database
|
||||
*/
|
||||
function lsslpWriteCec() {
|
||||
$('#cecLine').append(createLoader());
|
||||
$('#returninfo div').append('<p>Discover and write CECs into xCAT Database.</p>');
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-s;CEC;-w&msg=&opts=flush';;
|
||||
var ceciframe1 = $('<iframe id="ceciframe1"></iframe>').attr('src', cmdlink).css({
|
||||
var cmdlink = 'lib/cmd.php?cmd=lsslp&tgt=&args=-s;CEC;-w;';
|
||||
if (getDiscoverEnv('ipfordiscovery')){
|
||||
cmdlink += '-i;' + getDiscoverEnv('ipfordiscovery');
|
||||
}
|
||||
cmdlink += '&msg=&opts=flush';
|
||||
var ceciframe1 = $('<iframe id="ceciframe1" scrolling="no"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
'width': '100%'
|
||||
});
|
||||
$('#returninfo div').append(ceciframe1);
|
||||
ceciframe1.load(function() {
|
||||
@@ -1708,7 +1775,7 @@ function lsslpWriteCec() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: config the cec dhcp and dns
|
||||
* Step 9: config the cec dhcp and dns
|
||||
*/
|
||||
function cecsetup(){
|
||||
$('#cecLine2').append(createLoader());
|
||||
@@ -1735,18 +1802,17 @@ function cecsetup(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: reset the networks for cecs
|
||||
* Step 9: reset the networks for cecs
|
||||
*/
|
||||
function cecReset(){
|
||||
$('#cecLine3').append(createLoader());
|
||||
$('#returninfo div').append('<p>Reset network on CECs to get persistent IP.</p>');
|
||||
var cmdlink = 'lib/cmd.php?cmd=rspconfig&tgt=cec&args=--resetnet&msg=&opts=flush';;
|
||||
var ceciframe2 = $('<iframe id="ceciframe2"></iframe>').attr('src', cmdlink).css({
|
||||
var cmdlink = 'lib/cmd.php?cmd=rspconfig&tgt=cec&args=--resetnet&msg=&opts=flush';
|
||||
var ceciframe2 = $('<iframe id="ceciframe2" scrolling="no"></iframe>').attr('src', cmdlink).css({
|
||||
'display': 'block',
|
||||
'border': '0px',
|
||||
'margin': '10px',
|
||||
'width': '100%',
|
||||
'overflow': 'visible'
|
||||
'width': '100%'
|
||||
});
|
||||
$('#returninfo div').append(ceciframe2);
|
||||
ceciframe2.load(function() {
|
||||
@@ -1759,7 +1825,7 @@ function cecReset(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 8: config the cec
|
||||
* Step 9: config the cec
|
||||
*/
|
||||
function cecHwconn(){
|
||||
$('#cecLine4').append(createLoader());
|
||||
@@ -1780,13 +1846,15 @@ function cecHwconn(){
|
||||
tempSpan.removeClass('ui-icon-gear');
|
||||
tempSpan.addClass('ui-icon-check');
|
||||
$('#returninfo div').append('<p><pre>' + data.rsp.join("\n") + '</pre></p>');
|
||||
clearTimeout(iframeTimer);
|
||||
updateFrameHeight();
|
||||
createDiscoverButtons();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 9: Create LPARs
|
||||
* Step 10: Create LPARs
|
||||
*/
|
||||
function powerInitCreateLpar() {
|
||||
$('#discoverContentDiv').empty();
|
||||
@@ -1810,6 +1878,7 @@ function powerInitCreateLpar() {
|
||||
|
||||
function ihCreateLpar(parentDiv) {
|
||||
var showStr = 'Partition Rule:<br/>'
|
||||
+ 'By default, 1 partition is already created in each octant of each CEC, with all of the octant\'s CPUs and memory assigned to it. If this is the configuration you want, click Next. To customize the partition configuration, use one of the rules below.<br/>'
|
||||
+ 'If all the octants configuration value are same in one CEC, it will be " -r 0-7:value".<br/>'
|
||||
+ 'If the octants use the different configuration value in one cec, it will be "-r 0:value1,1:value2,...7:value7", or "-r 0:value1,1-7:value2".<br/>'
|
||||
+ 'The octants configuration value for one Octant could be 1, 2, 3, 4, 5 . The meanings of the octants configuration value are as following:<br/>'
|
||||
|
||||
+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";
|
||||
|
||||
+23
-8
@@ -307,11 +307,11 @@ DataTable.prototype.add = function(rowCont) {
|
||||
* @param barId Status bar ID
|
||||
*/
|
||||
function createStatusBar(barId) {
|
||||
var statusBar = $('<div class="ui-corner-all" id="' + barId + '"></div>').css({
|
||||
// Do not change the background color or color! This is handled by the theme
|
||||
// the user selects.
|
||||
var statusBar = $('<div class="ui-state-highlight ui-corner-all" id="' + barId + '"></div>').css({
|
||||
'margin-bottom': '5px',
|
||||
'min-height': '30px',
|
||||
'background-color':'#7BBEDE',
|
||||
'color': '#FFFFFF',
|
||||
'max-height': '150px',
|
||||
'overflow': 'auto'
|
||||
});
|
||||
@@ -354,10 +354,10 @@ function createStatusBar(barId) {
|
||||
* @return Info bar
|
||||
*/
|
||||
function createInfoBar(msg) {
|
||||
var infoBar = $('<div class="ui-corner-all"></div>').css({
|
||||
'margin': '5px 0px',
|
||||
'background-color':'#7BBEDE',
|
||||
'color': '#FFFFFF'
|
||||
// Do not change the background color or color! This is handled by the theme
|
||||
// the user selects.
|
||||
var infoBar = $('<div class="ui-state-highlight ui-corner-all"></div>').css({
|
||||
'margin': '5px 0px'
|
||||
});
|
||||
var icon = $('<span class="ui-icon ui-icon-info"></span>').css({
|
||||
'display': 'inline-block',
|
||||
@@ -1055,4 +1055,19 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
+146
-141
@@ -12,126 +12,131 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// File contents in case of file write
|
||||
if (isset($_GET["cont"])) {
|
||||
$cont = $_GET["cont"];
|
||||
}
|
||||
// File contents in case of file write
|
||||
if (isset($_GET["cont"])) {
|
||||
$cont = $_GET["cont"];
|
||||
}
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $args are given, set $args_array to NULL
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
// If no $args are given, set $args_array to NULL
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
|
||||
// Time needed to update /etc/hosts
|
||||
if (strncasecmp($cmd, "makehosts", 9) == 0) {
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if(strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if(strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if(strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Write contents to file
|
||||
else if(strncasecmp($cmd, "write", 4) == 0) {
|
||||
// Directory should be /var/opt/xcat/profiles
|
||||
// You can write anything to that directory
|
||||
$file = "$tgt";
|
||||
$handle = fopen($file, 'w') or die("Cannot open $file");
|
||||
fwrite($handle, $cont);
|
||||
fclose($handle);
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if (strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if (strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if (strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Write contents to file
|
||||
else if (strncasecmp($cmd, "write", 4) == 0) {
|
||||
// Directory should be /var/opt/xcat/profiles
|
||||
// You can write anything to that directory
|
||||
$file = "$tgt";
|
||||
$handle = fopen($file, 'w') or die("Cannot open $file");
|
||||
fwrite($handle, $cont);
|
||||
fclose($handle);
|
||||
|
||||
$rsp = "Directory entry written to $file";
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
$rsp = "Directory entry written to $file";
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
if ($data->data->contents) {
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
if ($data->data->contents) {
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
if ($data->data->desc) {
|
||||
$cont = $data->data->desc . ": " . $cont;
|
||||
}
|
||||
if ($data->data->desc) {
|
||||
$cont = $data->data->desc . ": " . $cont;
|
||||
}
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,26 +146,26 @@ if (isset($_GET["cmd"])) {
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,26 +175,26 @@ function extractWebrun($xml) {
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,13 +204,13 @@ function extractNodels($xml) {
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
$rsp = array();
|
||||
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
?>
|
||||
+239
-228
@@ -5,7 +5,7 @@
|
||||
|
||||
// Retain session variables across page requests
|
||||
session_start();
|
||||
session_write_close(); // Do not block other HTTP requests
|
||||
session_write_close(); // Do not block other HTTP requests
|
||||
|
||||
// The settings below display error on the screen, instead of giving blank pages.
|
||||
error_reporting(E_ALL);
|
||||
@@ -22,33 +22,33 @@ ini_set('display_errors', true);
|
||||
* See perl-xCAT/xCAT/Client.pm for the format
|
||||
*/
|
||||
function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
// If we are not logged in,
|
||||
// do not try to communicate with xcatd
|
||||
if (!is_logged()) {
|
||||
echo "<p>You are not logged in! Failed to run command.</p>";
|
||||
return simplexml_load_string('<xcat></xcat>', 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
// If we are not logged in,
|
||||
// do not try to communicate with xcatd
|
||||
if (!is_logged()) {
|
||||
echo "<p>You are not logged in! Failed to run command.</p>";
|
||||
return simplexml_load_string('<xcat></xcat>', 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
|
||||
// Create xCAT request
|
||||
// Add command, node range, and arguments to request
|
||||
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', $cmd);
|
||||
if (!empty($nr)) {
|
||||
$request->addChild('noderange', $nr);
|
||||
}
|
||||
if (!empty($args_array)) {
|
||||
foreach ($args_array as $a) {
|
||||
$request->addChild('arg',$a);
|
||||
}
|
||||
}
|
||||
// Create xCAT request
|
||||
// Add command, node range, and arguments to request
|
||||
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', $cmd);
|
||||
if (!empty($nr)) {
|
||||
$request->addChild('noderange', $nr);
|
||||
}
|
||||
if (!empty($args_array)) {
|
||||
foreach ($args_array as $a) {
|
||||
$request->addChild('arg',$a);
|
||||
}
|
||||
}
|
||||
|
||||
// Add user and password to request
|
||||
$usernode=$request->addChild('becomeuser');
|
||||
$usernode->addChild('username',$_SESSION["username"]);
|
||||
$usernode->addChild('password',getpassword());
|
||||
// Add user and password to request
|
||||
$usernode=$request->addChild('becomeuser');
|
||||
$usernode->addChild('username',$_SESSION["username"]);
|
||||
$usernode->addChild('password',getpassword());
|
||||
|
||||
$xml = submit_request($request, 0, $opts_array);
|
||||
return $xml;
|
||||
$xml = submit_request($request, 0, $opts_array);
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,146 +59,157 @@ function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
* @return A tree of SimpleXML objects
|
||||
*/
|
||||
function submit_request($req, $skipVerify, $opts_array){
|
||||
$xcathost = "localhost";
|
||||
$port = "3001";
|
||||
$rsp = FALSE;
|
||||
$response = '';
|
||||
$cleanexit = 0;
|
||||
$xcathost = "localhost";
|
||||
$port = "3001";
|
||||
$rsp = FALSE;
|
||||
$response = '';
|
||||
$cleanexit = 0;
|
||||
$flushtail = '';
|
||||
|
||||
// Determine whether to flush output or not
|
||||
$flush = false;
|
||||
if ($opts_array && in_array("flush", $opts_array)) {
|
||||
$flush = true;
|
||||
}
|
||||
// Determine whether to flush output or not
|
||||
$flush = false;
|
||||
if ($opts_array && in_array("flush", $opts_array)) {
|
||||
$flush = true;
|
||||
}
|
||||
|
||||
// Determine how to handle the flush output
|
||||
// You can specify a function name, in place of TBD, to handle the flush output
|
||||
$flush_format = "";
|
||||
if ($opts_array && in_array("flush-format=TBD", $opts_array)) {
|
||||
$flush_format = "TBD";
|
||||
}
|
||||
// Determine how to handle the flush output
|
||||
// You can specify a function name, in place of TBD, to handle the flush output
|
||||
$flush_format = "";
|
||||
if ($opts_array && in_array("flush-format=TBD", $opts_array)) {
|
||||
$flush_format = "TBD";
|
||||
}
|
||||
|
||||
// Open syslog, include the process ID and also send the log to standard error,
|
||||
// and use a user defined logging mechanism
|
||||
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
// Open syslog, include the process ID and also send the log to standard error,
|
||||
// and use a user defined logging mechanism
|
||||
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
|
||||
// Open a socket to xcatd
|
||||
syslog(LOG_INFO, "Opening socket to xcatd...");
|
||||
if ($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
$reqXML = $req->asXML();
|
||||
$nr = $req->noderange;
|
||||
$cmd = $req->command;
|
||||
// Open a socket to xcatd
|
||||
syslog(LOG_INFO, "Opening socket to xcatd...");
|
||||
if ($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
$reqXML = $req->asXML();
|
||||
$nr = $req->noderange;
|
||||
$cmd = $req->command;
|
||||
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
if ($flush){
|
||||
echo str_pad('',1024)."\n";
|
||||
}
|
||||
|
||||
while (!feof($fp)) {
|
||||
// Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
$str = fread($fp, 8192);
|
||||
if ($str) {
|
||||
$response .= preg_replace('/>\n\s*</', '><', $str);
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
if ($flush){
|
||||
echo str_pad('',1024)."\n";
|
||||
}
|
||||
|
||||
while (!feof($fp)) {
|
||||
// Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
$str = fread($fp, 8192);
|
||||
if ($str) {
|
||||
$response .= preg_replace('/>\n\s*</', '><', $str);
|
||||
|
||||
// Flush output to browser
|
||||
if ($flush) {
|
||||
// Strip HTML tags from output
|
||||
$str = preg_replace('/<errorcode>.*<\/errorcode>/', '', $str);
|
||||
if ($tmp = trim(strip_tags($str))) {
|
||||
// Format the output based on what was given for $flush_format
|
||||
if ($flush_format == "TDB") {
|
||||
format_TBD($tmp);
|
||||
} else {
|
||||
$tmp = preg_replace('/\n\s*/', "\n", $tmp);
|
||||
// Print out output by default
|
||||
echo '<pre style="font-size: 10px;">' . $tmp . '</pre>';
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Flush output to browser
|
||||
if ($flush) {
|
||||
$str = $flushtail . $str;
|
||||
if (preg_match('/[^>]+$/', $str, $matches)){
|
||||
$flushtail = $matches[0];
|
||||
$str = preg_replace('/[^>]+$/', '', $str);
|
||||
} else {
|
||||
$flushtail = '';
|
||||
}
|
||||
|
||||
$str = preg_replace('/<errorcode>.*<\/errorcode>/', '', $str);
|
||||
// Strip HTML tags from output
|
||||
if ($tmp = trim(strip_tags($str))) {
|
||||
// Format the output based on what was given for $flush_format
|
||||
if ($flush_format == "TDB") {
|
||||
format_TBD($tmp);
|
||||
} else {
|
||||
$tmp = preg_replace('/\n\s*/', "\n", $tmp);
|
||||
|
||||
// Print out output by default
|
||||
echo '<pre style="font-size: 10px;">' . $tmp . '</pre>';
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Look for serverdone response
|
||||
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
|
||||
$mixedpattern = '/<serverdone>\s*<\/serverdone>.*<\/xcatresponse>/';
|
||||
$recentpattern = '/<\/xcatresponse>/';
|
||||
if (preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done, package up XML and return it
|
||||
// Remove the serverdone response and put an xcat tag around the rest
|
||||
$count = 0;
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) {
|
||||
$response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/';
|
||||
}
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$response = preg_replace('/>\n\s*</', '><', $response);
|
||||
$response = preg_replace('/\n/', ':|:', $response);
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$cleanexit = 1;
|
||||
break;
|
||||
}
|
||||
} // End of while(!feof($fp))
|
||||
// Look for serverdone response
|
||||
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
|
||||
$mixedpattern = '/<serverdone>\s*<\/serverdone>.*<\/xcatresponse>/';
|
||||
$recentpattern = '/<\/xcatresponse>/';
|
||||
if (preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done, package up XML and return it
|
||||
// Remove the serverdone response and put an xcat tag around the rest
|
||||
$count = 0;
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) {
|
||||
$response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/';
|
||||
}
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$response = preg_replace('/>\n\s*</', '><', $response);
|
||||
$response = preg_replace('/\n/', ':|:', $response);
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$cleanexit = 1;
|
||||
break;
|
||||
}
|
||||
} // End of while(!feof($fp))
|
||||
|
||||
syslog(LOG_INFO, "($cmd $nr) Sending response");
|
||||
fclose($fp);
|
||||
} else {
|
||||
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
|
||||
}
|
||||
syslog(LOG_INFO, "($cmd $nr) Sending response");
|
||||
fclose($fp);
|
||||
} else {
|
||||
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
|
||||
}
|
||||
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
|
||||
// Close syslog
|
||||
closelog();
|
||||
// Close syslog
|
||||
closelog();
|
||||
|
||||
if(! $cleanexit) {
|
||||
if (preg_match('/^\s*<xcatresponse>.*<\/xcatresponse>\s*$/',$response)) {
|
||||
// Probably an error message
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
} else if(!$skipVerify) {
|
||||
echo "<p>(Error) xCAT response ended prematurely: ", htmlentities($response), "</p>";
|
||||
$rsp = FALSE;
|
||||
}
|
||||
}
|
||||
return $rsp;
|
||||
if (!$cleanexit) {
|
||||
if (preg_match('/^\s*<xcatresponse>.*<\/xcatresponse>\s*$/',$response)) {
|
||||
// Probably an error message
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
} else if (!$skipVerify) {
|
||||
echo "<p>(Error) xCAT response ended prematurely: ", htmlentities($response), "</p>";
|
||||
$rsp = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable password storage to split between cookie and session variable
|
||||
*/
|
||||
function xorcrypt($data, $key) {
|
||||
$datalen = strlen($data);
|
||||
$keylen = strlen($key);
|
||||
for ($i=0;$i<$datalen;$i++) {
|
||||
$data[$i] = chr(ord($data[$i])^ord($key[$i]));
|
||||
}
|
||||
$datalen = strlen($data);
|
||||
$keylen = strlen($key);
|
||||
for ($i=0;$i<$datalen;$i++) {
|
||||
$data[$i] = chr(ord($data[$i])^ord($key[$i]));
|
||||
}
|
||||
|
||||
return $data;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password
|
||||
*/
|
||||
function getpassword() {
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
$cryptext = $GLOBALS['xcatauthsecret'];
|
||||
} else if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
$cryptext = $_COOKIE["xcatauthsecret"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
$cryptext = $GLOBALS['xcatauthsecret'];
|
||||
} else if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
$cryptext = $_COOKIE["xcatauthsecret"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return xorcrypt($_SESSION["secretkey"], base64_decode($cryptext));
|
||||
return xorcrypt($_SESSION["secretkey"], base64_decode($cryptext));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,15 +220,15 @@ function getpassword() {
|
||||
* @param $password Password
|
||||
*/
|
||||
function setpassword($password) {
|
||||
$randlen = strlen($password);
|
||||
$key = getrandchars($randlen);
|
||||
$cryptext = xorcrypt($password,$key);
|
||||
$randlen = strlen($password);
|
||||
$key = getrandchars($randlen);
|
||||
$cryptext = xorcrypt($password,$key);
|
||||
|
||||
// Non-ascii characters, encode it in base64
|
||||
$cryptext = base64_encode($cryptext);
|
||||
setcookie("xcatauthsecret",$cryptext,0,'/');
|
||||
$GLOBALS["xcatauthsecret"] = $cryptext;
|
||||
$_SESSION["secretkey"] = $key;
|
||||
// Non-ascii characters, encode it in base64
|
||||
$cryptext = base64_encode($cryptext);
|
||||
setcookie("xcatauthsecret",$cryptext,0,'/');
|
||||
$GLOBALS["xcatauthsecret"] = $cryptext;
|
||||
$_SESSION["secretkey"] = $key;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,16 +238,16 @@ function setpassword($password) {
|
||||
* @return RAND characters
|
||||
*/
|
||||
function getrandchars($length) {
|
||||
$charset = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*';
|
||||
$charsize = strlen($charset);
|
||||
srand();
|
||||
$chars = '';
|
||||
for ($i=0;$i<$length;$i++) {
|
||||
$num=rand()%$charsize;
|
||||
$chars=$chars.substr($charset,$num,1);
|
||||
}
|
||||
$charset = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*';
|
||||
$charsize = strlen($charset);
|
||||
srand();
|
||||
$chars = '';
|
||||
for ($i=0;$i<$length;$i++) {
|
||||
$num=rand()%$charsize;
|
||||
$chars=$chars.substr($charset,$num,1);
|
||||
}
|
||||
|
||||
return $chars;
|
||||
return $chars;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,11 +256,11 @@ function getrandchars($length) {
|
||||
* @return True if user has a session, false otherwise
|
||||
*/
|
||||
function is_logged() {
|
||||
if (isset($_SESSION["username"]) and !is_bool(getpassword())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SESSION["username"]) and !is_bool(getpassword())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,27 +269,27 @@ function is_logged() {
|
||||
* @return True if the user is currently logged in successfully, false otherwise
|
||||
*/
|
||||
function isAuthenticated() {
|
||||
if (is_logged()) {
|
||||
if ($_SESSION["xcatpassvalid"] != 1) {
|
||||
$testcred = docmd("authcheck", "", NULL, NULL);
|
||||
if (isset($testcred->{'xcatresponse'}->{'data'})) {
|
||||
$result = "".$testcred->{'xcatresponse'}->{'data'};
|
||||
if (is_numeric(strpos("Authenticated",$result))) {
|
||||
// Logged in successfully
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
} else {
|
||||
// Not logged in
|
||||
$_SESSION["xcatpassvalid"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_logged()) {
|
||||
if ($_SESSION["xcatpassvalid"] != 1) {
|
||||
$testcred = docmd("authcheck", "", NULL, NULL);
|
||||
if (isset($testcred->{'xcatresponse'}->{'data'})) {
|
||||
$result = "".$testcred->{'xcatresponse'}->{'data'};
|
||||
if (is_numeric(strpos("Authenticated",$result))) {
|
||||
// Logged in successfully
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
} else {
|
||||
// Not logged in
|
||||
$_SESSION["xcatpassvalid"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION["xcatpassvalid"]) and $_SESSION["xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SESSION["xcatpassvalid"]) and $_SESSION["xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,70 +298,70 @@ function isAuthenticated() {
|
||||
* @return True if the user has root access, false otherwise
|
||||
*/
|
||||
function isRootAcess() {
|
||||
if (is_logged() && $_SESSION["xcatpassvalid"]) {
|
||||
$testacc = docmd('tabdump', '', array('policy', '-w', "name==" . $_SESSION["username"]), array());
|
||||
if (isset($testacc->{'xcatresponse'}->{'data'}->{1})) {
|
||||
$result = $testacc->{'xcatresponse'}->{'data'}->{1};
|
||||
$result = str_replace('"', '', $result);
|
||||
$args = array();
|
||||
$args = explode(",", $result);
|
||||
if (is_logged() && $_SESSION["xcatpassvalid"]) {
|
||||
$testacc = docmd('tabdump', '', array('policy', '-w', "name==" . $_SESSION["username"]), array());
|
||||
if (isset($testacc->{'xcatresponse'}->{'data'}->{1})) {
|
||||
$result = $testacc->{'xcatresponse'}->{'data'}->{1};
|
||||
$result = str_replace('"', '', $result);
|
||||
$args = array();
|
||||
$args = explode(",", $result);
|
||||
|
||||
// Get the comments which contains the privilege
|
||||
$comments = $args[8];
|
||||
$args = explode(";", $comments);
|
||||
// Default privilege is guest
|
||||
$privilege = 'guest';
|
||||
$_SESSION["xcatpassvalid"] = 0;
|
||||
foreach ($args as $arg) {
|
||||
// Get user privilege
|
||||
if ($arg && is_numeric(strpos($arg, "privilege"))) {
|
||||
if (is_numeric(strpos($arg, "root"))) {
|
||||
// Set privilege to root
|
||||
$privilege = 'root';
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
// Get the comments which contains the privilege
|
||||
$comments = $args[8];
|
||||
$args = explode(";", $comments);
|
||||
// Default privilege is guest
|
||||
$privilege = 'guest';
|
||||
$_SESSION["xcatpassvalid"] = 0;
|
||||
foreach ($args as $arg) {
|
||||
// Get user privilege
|
||||
if ($arg && is_numeric(strpos($arg, "privilege"))) {
|
||||
if (is_numeric(strpos($arg, "root"))) {
|
||||
// Set privilege to root
|
||||
$privilege = 'root';
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp($_SESSION["username"], 'root') == 0) {
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
if (strcmp($_SESSION["username"], 'root') == 0) {
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
|
||||
if (isset($_SESSION["xcatpassvalid"]) and $_SESSION["xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SESSION["xcatpassvalid"]) and $_SESSION["xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out of current user session
|
||||
*/
|
||||
function logout() {
|
||||
// Clear the secret cookie from browser
|
||||
if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
setcookie("xcatauthsecret",'',time()-86400*7,'/');
|
||||
}
|
||||
// Clear the secret cookie from browser
|
||||
if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
setcookie("xcatauthsecret",'',time()-86400*7,'/');
|
||||
}
|
||||
|
||||
// Expire session cookie
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(),"",time()-86400*7,"/");
|
||||
}
|
||||
// Expire session cookie
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(),"",time()-86400*7,"/");
|
||||
}
|
||||
|
||||
// Clear server store of data
|
||||
$_SESSION=array();
|
||||
// Clear server store of data
|
||||
$_SESSION=array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a given string and echo it back to the browser
|
||||
*/
|
||||
function format_TBD($str) {
|
||||
// Format a given string however you want it
|
||||
echo $tmp . '<br/>';
|
||||
flush();
|
||||
// Format a given string however you want it
|
||||
echo $tmp . '<br/>';
|
||||
flush();
|
||||
}
|
||||
?>
|
||||
|
||||
+12
-12
@@ -11,29 +11,29 @@ header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
if (isset($_REQUEST["password"])) {
|
||||
// Clear data from session
|
||||
$_SESSION = array();
|
||||
// Clear data from session
|
||||
$_SESSION = array();
|
||||
|
||||
// Zap existing session entirely
|
||||
session_regenerate_id(true);
|
||||
setpassword($_REQUEST["password"]);
|
||||
// Zap existing session entirely
|
||||
session_regenerate_id(true);
|
||||
setpassword($_REQUEST["password"]);
|
||||
|
||||
// Invalid password
|
||||
$_SESSION["xcatpassvalid"] = -1;
|
||||
// Invalid password
|
||||
$_SESSION["xcatpassvalid"] = -1;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST["username"])) {
|
||||
$_SESSION["username"] = $_REQUEST["username"];
|
||||
$_SESSION["username"] = $_REQUEST["username"];
|
||||
|
||||
// Invalid user name
|
||||
$_SESSION["xcatpassvalid"]=-1;
|
||||
// Invalid user name
|
||||
$_SESSION["xcatpassvalid"]=-1;
|
||||
}
|
||||
|
||||
$jdata = array();
|
||||
if (isAuthenticated() && isRootAcess()) {
|
||||
$jdata["authenticated"]="yes";
|
||||
$jdata["authenticated"]="yes";
|
||||
} else {
|
||||
$jdata["authenticated"]="no";
|
||||
$jdata["authenticated"]="no";
|
||||
}
|
||||
|
||||
echo json_encode($jdata);
|
||||
|
||||
+59
-59
@@ -7,90 +7,90 @@ $output = '';
|
||||
$temp = '';
|
||||
$pythonProcess = '';
|
||||
if (!isAuthenticated()) {
|
||||
echo ("Please login before continuing!");
|
||||
echo ("Please login before continuing!");
|
||||
}
|
||||
|
||||
$query = 's=' . $_POST['s'] . '&w=' . $_POST['w'] . '&h=' . $_POST['h'];
|
||||
if (isset($_POST['q'])) {
|
||||
$query .= '&q=1';
|
||||
$query .= '&q=1';
|
||||
} else {
|
||||
$query .= '&q=0';
|
||||
$query .= '&q=0';
|
||||
}
|
||||
|
||||
if (isset($_POST['f'])) {
|
||||
$pythonProcess = exec('ps -aef | grep -v grep | grep ajaxterm.py');
|
||||
if ('' == $pythonProcess) {
|
||||
exec('nohup ' . dirname(__FILE__) . '/ajaxterm/ajaxterm.py >/dev/null 2>&1 &');
|
||||
}
|
||||
sleep(1);
|
||||
$pythonProcess = exec('ps -aef | grep -v grep | grep ajaxterm.py');
|
||||
if ('' == $pythonProcess) {
|
||||
exec('nohup ' . dirname(__FILE__) . '/ajaxterm/ajaxterm.py >/dev/null 2>&1 &');
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
$temp = $query . '&k=' . urlencode($_SESSION["username"] . "\r");
|
||||
$output = rconsSynchronise($temp);
|
||||
if (0 < substr_count($output, 'error')) {
|
||||
echo json_encode(array('err'=>$output));
|
||||
exit;
|
||||
}
|
||||
sleep(1);
|
||||
$temp = $query . '&k=' . urlencode($_SESSION["username"] . "\r");
|
||||
$output = rconsSynchronise($temp);
|
||||
if (0 < substr_count($output, 'error')) {
|
||||
echo json_encode(array('err'=>$output));
|
||||
exit;
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
$temp = $query . '&k=' . urlencode(getpassword() . "\r");
|
||||
$output = rconsSynchronise($temp);
|
||||
if (0 < substr_count($output, 'error')) {
|
||||
echo json_encode(array('err'=>$output));
|
||||
exit;
|
||||
}
|
||||
sleep(1);
|
||||
$temp = $query . '&k=' . urlencode(getpassword() . "\r");
|
||||
$output = rconsSynchronise($temp);
|
||||
if (0 < substr_count($output, 'error')) {
|
||||
echo json_encode(array('err'=>$output));
|
||||
exit;
|
||||
}
|
||||
sleep(1);
|
||||
|
||||
$temp = $query . '&c=1&k=' . urlencode('rcons ' . $_POST['s'] . "\r");
|
||||
$temp = $query . '&c=1&k=' . urlencode('rcons ' . $_POST['s'] . "\r");
|
||||
} else {
|
||||
$temp = $query . '&c=1&k=' . urlencode($_POST['k']);
|
||||
$temp = $query . '&c=1&k=' . urlencode($_POST['k']);
|
||||
}
|
||||
|
||||
$output = rconsSynchronise($temp);
|
||||
if (0 < substr_count($output, 'error')) {
|
||||
echo (array('err'=>$output));
|
||||
echo (array('err'=>$output));
|
||||
} else {
|
||||
$xml = simplexml_load_string($output);
|
||||
if ('pre' == $xml->getName()) {
|
||||
$output = $xml->asXML();
|
||||
$output = preg_replace('/'. chr(160) . '/', ' ', $output);
|
||||
$xml = simplexml_load_string($output);
|
||||
if ('pre' == $xml->getName()) {
|
||||
$output = $xml->asXML();
|
||||
$output = preg_replace('/'. chr(160) . '/', ' ', $output);
|
||||
|
||||
echo json_encode(array('term'=>$output));
|
||||
} else {
|
||||
echo json_encode(array('nc'=>'nc'));
|
||||
}
|
||||
echo json_encode(array('term'=>$output));
|
||||
} else {
|
||||
echo json_encode(array('nc'=>'nc'));
|
||||
}
|
||||
}
|
||||
|
||||
function rconsSynchronise($parameter) {
|
||||
$flag = false;
|
||||
$return = "";
|
||||
$out = "";
|
||||
$fp = fsockopen("127.0.0.1", 8022, $errno, $errstr, 30);
|
||||
if (!$fp) {
|
||||
return "<error>$errstr($errno)</error>";
|
||||
}
|
||||
$flag = false;
|
||||
$return = "";
|
||||
$out = "";
|
||||
$fp = fsockopen("127.0.0.1", 8022, $errno, $errstr, 30);
|
||||
if (!$fp) {
|
||||
return "<error>$errstr($errno)</error>";
|
||||
}
|
||||
|
||||
$out = "GET /u?$parameter HTTP/1.1\r\nHost: 127.0.0.1:8022\r\nConnection: Close\r\n\r\n";
|
||||
$out = "GET /u?$parameter HTTP/1.1\r\nHost: 127.0.0.1:8022\r\nConnection: Close\r\n\r\n";
|
||||
|
||||
fwrite($fp, $out);
|
||||
while (!feof($fp)) {
|
||||
$line = fgets($fp,1024);
|
||||
if (0 == strlen($line)) {
|
||||
continue;
|
||||
}
|
||||
fwrite($fp, $out);
|
||||
while (!feof($fp)) {
|
||||
$line = fgets($fp,1024);
|
||||
if (0 == strlen($line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ('<' == substr($line, 0, 1)) {
|
||||
$flag = true;
|
||||
$return .= $line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ('<' == substr($line, 0, 1)) {
|
||||
$flag = true;
|
||||
$return .= $line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($flag) {
|
||||
while (!feof($fp)) {
|
||||
$return .= fgets($fp, 1024);
|
||||
}
|
||||
}
|
||||
if ($flag) {
|
||||
while (!feof($fp)) {
|
||||
$return .= fgets($fp, 1024);
|
||||
}
|
||||
}
|
||||
|
||||
return ($return);
|
||||
return ($return);
|
||||
}
|
||||
?>
|
||||
+123
-123
@@ -15,102 +15,102 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $args are given, set $args_array to NULL
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
// If no $args are given, set $args_array to NULL
|
||||
$args_array = array();
|
||||
if ($args) {
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$args_array = array();
|
||||
$args_array = explode(";", $args);
|
||||
} else {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
$opts_array = array();
|
||||
$opts_array = explode(";", $opts);
|
||||
} else {
|
||||
$opts_array = array($opts);
|
||||
}
|
||||
}
|
||||
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
// Submit request and get response
|
||||
$xml = docmd($cmd, $tgt, $args_array, $opts_array);
|
||||
// If the output is flushed, do not return output in JSON
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if(strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if(strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if(strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
if(strncasecmp($cmd, "webrun", 6) == 0 && (stristr($args, "pping") || stristr($args, "gangliastatus") || stristr($args, "chtab"))) {
|
||||
$rsp = extractWebrun($xml);
|
||||
}
|
||||
// nodels output needs special handling
|
||||
else if(strncasecmp($cmd, "nodels", 6) == 0) {
|
||||
// Handle the output the same way as webrun
|
||||
$rsp = extractNodels($xml);
|
||||
}
|
||||
// extnoderange output needs special handling
|
||||
// This command gets the nodes and groups
|
||||
else if(strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
if($data->data->contents){
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
if($data->data->contents){
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,26 +120,26 @@ if (isset($_GET["cmd"])) {
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,26 +149,26 @@ function extractWebrun($xml) {
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
$rsp = array();
|
||||
$i = 0;
|
||||
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
// Extract data returned
|
||||
foreach($xml->children() as $nodes){
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
// Get the content
|
||||
$status = $node->data->contents;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$description = $node->data->desc;
|
||||
// Add to return array
|
||||
$rsp[$i] = array("$name", "$status", "$description");
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,13 +178,13 @@ function extractNodels($xml) {
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
$rsp = array();
|
||||
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
// Extract data returned
|
||||
foreach ($xml->xcatresponse->intersectinggroups as $group) {
|
||||
array_push($rsp, "$group");
|
||||
}
|
||||
|
||||
return $rsp;
|
||||
return $rsp;
|
||||
}
|
||||
?>
|
||||
+39
-39
@@ -12,9 +12,9 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_POST["table"])) {
|
||||
// HTTP POST requests
|
||||
$tab = $_POST["table"];
|
||||
$cont = $_POST["cont"];
|
||||
// HTTP POST requests
|
||||
$tab = $_POST["table"];
|
||||
$cont = $_POST["cont"];
|
||||
}
|
||||
|
||||
// Create xCAT request
|
||||
@@ -31,46 +31,46 @@ $usernode->addChild('password', getpassword());
|
||||
// Go through each table row
|
||||
$first = 0;
|
||||
foreach($cont as $line){
|
||||
if($first == 0){
|
||||
// The 1st line is the table header
|
||||
// It does not need special processing
|
||||
// Create string containing all array elements
|
||||
$str = implode(",", $line);
|
||||
$request->addChild('data', $str);
|
||||
if($first == 0){
|
||||
// The 1st line is the table header
|
||||
// It does not need special processing
|
||||
// Create string containing all array elements
|
||||
$str = implode(",", $line);
|
||||
$request->addChild('data', $str);
|
||||
|
||||
$first = 1;
|
||||
continue;
|
||||
}
|
||||
$first = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Go through each column
|
||||
foreach ($line as &$col){
|
||||
// If the column does begins and end with a quote
|
||||
// Change quotes to "
|
||||
if(!empty($col) && !preg_match('/^".*"$/', $col)) {
|
||||
$col = '"' . $col . '"';
|
||||
}
|
||||
}
|
||||
// Go through each column
|
||||
foreach ($line as &$col){
|
||||
// If the column does begins and end with a quote
|
||||
// Change quotes to "
|
||||
if(!empty($col) && !preg_match('/^".*"$/', $col)) {
|
||||
$col = '"' . $col . '"';
|
||||
}
|
||||
}
|
||||
|
||||
// Sort line
|
||||
ksort($line, SORT_NUMERIC);
|
||||
$keys = array_keys($line);
|
||||
$max = count($line) - 1;
|
||||
if ($keys[$max] != $max){
|
||||
for ($i = 0; $i <= $keys[$max]; $i++) {
|
||||
if (!isset($line[$i])) {
|
||||
$line[$i]='';
|
||||
}
|
||||
}
|
||||
ksort($line, SORT_NUMERIC);
|
||||
}
|
||||
// Sort line
|
||||
ksort($line, SORT_NUMERIC);
|
||||
$keys = array_keys($line);
|
||||
$max = count($line) - 1;
|
||||
if ($keys[$max] != $max){
|
||||
for ($i = 0; $i <= $keys[$max]; $i++) {
|
||||
if (!isset($line[$i])) {
|
||||
$line[$i]='';
|
||||
}
|
||||
}
|
||||
ksort($line, SORT_NUMERIC);
|
||||
}
|
||||
|
||||
// Create string containing all array elements
|
||||
$str = implode(",", $line);
|
||||
// Replace " with "
|
||||
$str = str_replace('"', '"', $str);
|
||||
// Replace ' with '
|
||||
$str = str_replace("'", ''', $str);
|
||||
$request->addChild('data', $str);
|
||||
// Create string containing all array elements
|
||||
$str = implode(",", $line);
|
||||
// Replace " with "
|
||||
$str = str_replace('"', '"', $str);
|
||||
// Replace ' with '
|
||||
$str = str_replace("'", ''', $str);
|
||||
$request->addChild('data', $str);
|
||||
}
|
||||
|
||||
// Run command
|
||||
|
||||
+102
-102
@@ -13,125 +13,125 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
// Attachments are put here
|
||||
$att = $_GET["att"];
|
||||
// Attachments are put here
|
||||
$att = $_GET["att"];
|
||||
|
||||
// Special messages put here
|
||||
$msg = $_GET["msg"];
|
||||
// Special messages put here
|
||||
$msg = $_GET["msg"];
|
||||
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
// If no $tgt is given, set $tgt to NULL
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
// If no $args is given, set $args to NULL
|
||||
if (!$args) {
|
||||
$args = NULL;
|
||||
}
|
||||
// If no $args is given, set $args to NULL
|
||||
if (!$args) {
|
||||
$args = NULL;
|
||||
}
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
}
|
||||
|
||||
// If no $att is given, set $att to NULL
|
||||
if (!$att) {
|
||||
$att = NULL;
|
||||
}
|
||||
// If no $att is given, set $att to NULL
|
||||
if (!$att) {
|
||||
$att = NULL;
|
||||
}
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$arr = array();
|
||||
$arr = explode(";", $args);
|
||||
} else {
|
||||
$arr = array($args);
|
||||
}
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($args,";")) {
|
||||
// Split the arguments into an array
|
||||
$arr = array();
|
||||
$arr = explode(";", $args);
|
||||
} else {
|
||||
$arr = array($args);
|
||||
}
|
||||
|
||||
$rsp = array();
|
||||
$rsp = array();
|
||||
|
||||
// Replace user entry
|
||||
if (strncasecmp($cmd, "chvm", 4) == 0 && strncasecmp($arr[0], "--replacevs", 11) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
// Replace user entry
|
||||
if (strncasecmp($cmd, "chvm", 4) == 0 && strncasecmp($arr[0], "--replacevs", 11) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// CLI command: chvm gpok249 --replacevs /tmp/dirEntry.txt
|
||||
// Replace user entry
|
||||
array_push($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
// CLI command: chvm gpok249 --replacevs /tmp/dirEntry.txt
|
||||
// Replace user entry
|
||||
array_push($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create virtual server
|
||||
else if (strncasecmp($cmd, "mkvm", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
// Create virtual server
|
||||
else if (strncasecmp($cmd, "mkvm", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
$handle = fopen($userEntry, 'w') or die("Cannot open $userEntry");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// CLI command: mkvm gpok3 /tmp/gpok3.txt
|
||||
// Create user entry
|
||||
array_unshift($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
// CLI command: mkvm gpok3 /tmp/gpok3.txt
|
||||
// Create user entry
|
||||
array_unshift($arr, $userEntry);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run shell script
|
||||
// This is a typical command used by all platforms. It is put here because
|
||||
// most of the code needed are already here
|
||||
else if (strncasecmp($cmd, "xdsh", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$msgArgs = explode(";", $msg);
|
||||
$inst = str_replace("out=scriptStatusBar", "", $msgArgs[0]);
|
||||
$script = "/var/tmp/script$inst.sh";
|
||||
// Run shell script
|
||||
// This is a typical command used by all platforms. It is put here because
|
||||
// most of the code needed are already here
|
||||
else if (strncasecmp($cmd, "xdsh", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$msgArgs = explode(";", $msg);
|
||||
$inst = str_replace("out=scriptStatusBar", "", $msgArgs[0]);
|
||||
$script = "/var/tmp/script$inst.sh";
|
||||
|
||||
// Write to file
|
||||
$handle = fopen($script, 'w') or die("Cannot open $script");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
// Write to file
|
||||
$handle = fopen($script, 'w') or die("Cannot open $script");
|
||||
fwrite($handle, $att);
|
||||
fclose($handle);
|
||||
|
||||
// Change it to executable
|
||||
chmod($script, 0777);
|
||||
// Change it to executable
|
||||
chmod($script, 0777);
|
||||
|
||||
// CLI command: xdsh gpok3 -e /var/tmp/gpok3.sh
|
||||
// Create user entry
|
||||
array_push($arr, $script);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
// CLI command: xdsh gpok3 -e /var/tmp/gpok3.sh
|
||||
// Create user entry
|
||||
array_push($arr, $script);
|
||||
$xml = docmd($cmd, $tgt, $arr, NULL);
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
}
|
||||
|
||||
// Remove this file
|
||||
unlink($script);
|
||||
}
|
||||
// Remove this file
|
||||
unlink($script);
|
||||
}
|
||||
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
// Reply in the form of JSON
|
||||
$rtn = array("rsp" => $rsp, "msg" => $msg);
|
||||
echo json_encode($rtn);
|
||||
}
|
||||
?>
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -260,19 +260,7 @@ else
|
||||
then
|
||||
echo "Running command: ${chroot} /usr/xcatchrootscript\n"
|
||||
fi
|
||||
msg=`${chroot} /usr/xcatchrootscript`
|
||||
|
||||
rc=$?
|
||||
|
||||
echo "\n\n$msg\n\n"
|
||||
|
||||
#if [ ${rc} -ne 0 ]
|
||||
#then
|
||||
# error=1
|
||||
# echo "\nError: The chroot command failed for '$cmd_string'."
|
||||
# echo "Error: The return code from chroot was '${rc}'\n"
|
||||
#fi
|
||||
|
||||
${chroot} /usr/xcatchrootscript
|
||||
|
||||
# sensitive process has completed
|
||||
${M_CHATTR} -a Rstate=available $spotObj
|
||||
|
||||
@@ -188,6 +188,12 @@ if ($ENV{'DSHEXECUTE'})
|
||||
{
|
||||
push(@{$cmdref->{env}}, "DSHEXECUTE=$ENV{'DSHEXECUTE'}");
|
||||
}
|
||||
if ($ENV{'DSH_ENVIRONMENT'})
|
||||
{
|
||||
push(@{$cmdref->{env}}, "DSH_ENVIRONMENT=$ENV{'DSH_ENVIRONMENT'}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
xCAT::Client::submit_request($cmdref, \&xCAT::Client::handle_response);
|
||||
exit $xCAT::Client::EXITCODE;
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
=head1 NAME
|
||||
|
||||
B<cfgve> - Configure the elements for a virtual environment.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<cfgve> B<-t> dc B<-m> manager B<-o> object [B<-c> B<-k> nfs|localfs | B<-r>]
|
||||
|
||||
B<cfgve> B<-t> cl B<-m> manager B<-o> object [B<-c> B<-p> cpu type| B<-r> B<-f>]
|
||||
|
||||
B<cfgve> B<-t> sd B<-m> manager B<-o> object [B<-c> | B<-g> | B<-s>
|
||||
| B<-a> | B<-b> | B<-r> B<-f>]
|
||||
|
||||
B<cfgve> B<-t> nw B<-m> manager B<-o> object [B<-c> B<-d> data center B<-n>
|
||||
vlan ID | B<-a> B<-l> cluster | B<-b> | B<-r>]
|
||||
|
||||
B<cfgve> B<-t> tpl B<-m> manager B<-o> object [B<-r>]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<cfgve> command can be used to configure a virtual environment for
|
||||
'Storage Domain', 'Network' and 'Template' objects.
|
||||
|
||||
The mandatory parameter B<-m manager> is used to specify the address of the
|
||||
manager of virtual environment. xCAT needs it to access the RHEV manager.
|
||||
|
||||
The mandatory parameter B<-t type> is used to specify the type of the target
|
||||
object.
|
||||
|
||||
Basically, B<cfgve> command supports five types of object: B<dc>, B<cl>,
|
||||
B<sd>, B<nw> and B<tpl>.
|
||||
|
||||
=over 3
|
||||
|
||||
B<dc> - The B<create> and B<remove> operations are supported.
|
||||
|
||||
B<cl> - The B<create> and B<remove> operations are supported.
|
||||
|
||||
B<sd> - The B<create>, B<attach>, B<detach>, B<activate>,
|
||||
B<deactivate> and B<remove> operations are supported.
|
||||
|
||||
B<nw> - The B<create>, B<attach>, B<detach> and B<remove> operations are supported.
|
||||
|
||||
B<tpl> - The B<remove> operation is supported.
|
||||
|
||||
=back
|
||||
|
||||
The mandatory parameter B<-o object> is used to specify which object to configure.
|
||||
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<-a>
|
||||
To attach the target object.
|
||||
|
||||
=item B<-b>
|
||||
To detach the target object.
|
||||
|
||||
=item B<-c>
|
||||
To create the target object.
|
||||
|
||||
For creating of B<Storage Domain>, the target storage domain will be created
|
||||
first, then attached to data center and activated.
|
||||
|
||||
The parameters that used to create the storage domain are gotten
|
||||
from 'virtsd' table. The detail parameters in the virtsd table:
|
||||
|
||||
=over 3
|
||||
|
||||
B<virtsd.node> - The name of the storage domain.
|
||||
|
||||
B<virtsd.sdtype> - The type of storage domain. Valid value: data, iso, export.
|
||||
Default value is 'data'.
|
||||
|
||||
B<virtsd.stype> - The storage type. "nfs" or "localfs".
|
||||
|
||||
B<virtsd.location> - The location of the storage.
|
||||
B<nfs>: Format: [nfsserver:nfspath].
|
||||
The NFS export directory must be configured for read write access and must
|
||||
be owned by vdsm:kvm.
|
||||
B<localfs>: "/data/images/rhev" is set by default.
|
||||
|
||||
B<virtsd.host> - A host must be specified for a storage doamin as SPM
|
||||
(Storage Pool Manager) when initialize the storage domain. The role of SPM
|
||||
may be migrated to other host by rhev-m during the running of the datacenter
|
||||
(For example, when the current SPM encountered issue or going to maintenance
|
||||
status.
|
||||
|
||||
B<virtsd.datacenter> - The storage will be attached to. 'Default' data center
|
||||
is the default value.
|
||||
|
||||
=back
|
||||
|
||||
=item B<-d> I<data center>
|
||||
|
||||
The name of data center.
|
||||
|
||||
Specify the 'Data Center' that will be used for the object to be attached to.
|
||||
It is used by <nw> type.
|
||||
|
||||
=item B<-f>
|
||||
It can be used with B<-r> to remove the target object by force.
|
||||
|
||||
For removing of B<Storage Domain>, if B<-f> is specified, the storage domain will be deactivated and detached from data center before the removing.
|
||||
|
||||
=item B<-g>
|
||||
To activate the target object.
|
||||
|
||||
=item B<-h>
|
||||
Display usage message.
|
||||
|
||||
=item B<-k> I<storage type>
|
||||
|
||||
To specify the type of the storage type when creating the data center.
|
||||
|
||||
Supported type: nfs; localfs.
|
||||
|
||||
=item B<-l> I<cluster>
|
||||
|
||||
Specify the cluster for the network to attach to.
|
||||
|
||||
=item B<-m> I<manager>
|
||||
|
||||
Specify the manager of the virtual environment.
|
||||
|
||||
For RHEV, the FQDN (Fully Qualified Domain Name) of the rhev manager have
|
||||
to be specified.
|
||||
|
||||
=item B<-n> I<vlan ID>
|
||||
|
||||
To specify the vlan number when creating a network.
|
||||
|
||||
=item B<-o> I<object>
|
||||
|
||||
The name of the target object.
|
||||
|
||||
=item B<-p> I<cpu type>
|
||||
|
||||
To specify the cpu type when creating the cluster.
|
||||
B<Intel Penryn Family> is default type.
|
||||
|
||||
Supported type: B<Intel Conroe Family>, B<Intel Penryn Family>,
|
||||
B<Intel Nehalem Family>, B<Intel Westmere Family>, B<AMD Opteron G1>,
|
||||
B<AMD Opteron G2>, B<AMD Opteron G3>
|
||||
|
||||
=item B<-r>
|
||||
To remove the target object.
|
||||
|
||||
For removing of B<Storage Domain>, the storage space will be formatted after removing.
|
||||
|
||||
=item B<-s>
|
||||
To deactivate the target object.
|
||||
|
||||
=item B<-t> I<type>
|
||||
|
||||
Specify the B<type> of the target object.
|
||||
|
||||
Supported types:
|
||||
B<dc> - Data Center
|
||||
B<cl> - Cluster
|
||||
B<sd> - Storage Domain
|
||||
B<nw> - Network
|
||||
B<tpl> - Template
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 2
|
||||
|
||||
=item 1.
|
||||
To create the Storage Domain 'sd1', enter:
|
||||
|
||||
cfgve -t sd -m <FQDN of rhev manager> -o sd1 -c
|
||||
|
||||
=item 2.
|
||||
To deactivate the Storage Domain 'sd1' from data center, enter:
|
||||
|
||||
cfgve -t sd -m <FQDN of rhev manager> -o sd1 -s
|
||||
|
||||
=item 3.
|
||||
To remove the Storage Domain 'sd1', enter:
|
||||
|
||||
cfgve -t sd -m <FQDN of rhev manager> -o sd1 -r
|
||||
|
||||
=item 4.
|
||||
To create the network 'nw1', enter:
|
||||
|
||||
cfgve -t nw -m <FQDN of rhev manager> -o nw1 -c
|
||||
|
||||
=item 5.
|
||||
To remove the template 'tpl01', enter:
|
||||
|
||||
cfgve -t tpl -m <FQDN of rhev manager> -o tpl01 -r
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/cfgve
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<lsve(1)|lsve.1>
|
||||
@@ -0,0 +1,338 @@
|
||||
=head1 NAME
|
||||
|
||||
B<chhypervisor> - Configure the virtualization hosts.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<RHEV specific :>
|
||||
|
||||
=over 2
|
||||
|
||||
B<chhypervisor> I<noderange> [B<-a>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<-n>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<-p>]
|
||||
|
||||
B<chhypervisor> I<noderange> [B<-e>]
|
||||
|
||||
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.
|
||||
|
||||
The rhev-h host will register to the rhev-m automatically, but admin needs to
|
||||
approve the host can be added to the 'cluster' with B<-a> flag .
|
||||
|
||||
After registering, the network interfaces of host need to be added to the 'network' of
|
||||
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 or zVM host name.
|
||||
|
||||
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.
|
||||
|
||||
B<hypervisor.interface> - The configuration for the nics. Refer to B<-n>.
|
||||
|
||||
B<hypervisor.cluster> - The cluster that the host will be added to. The
|
||||
default is 'Default' cluster if not specified.
|
||||
|
||||
=back
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=head2 RHEV specific :
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<-a>
|
||||
Approve the host that to be added to cluster.
|
||||
|
||||
Before approve, the status of the host must be 'pending_approval'.
|
||||
|
||||
=item B<-n>
|
||||
Configure the network interfaces for the host.
|
||||
|
||||
Note: This operation only can be run when host is in 'maintenance mode'.
|
||||
Use B<-d> to switch the host to 'maintenance' mode.
|
||||
|
||||
The interfaces which configured in hypervisor.interface will be added
|
||||
to the network of RHEV.
|
||||
|
||||
The format of hypervisor.interface is multiple [network:interfacename:
|
||||
protocol:IP:netmask:gateway] sections separated with '|'. For example:
|
||||
[rhevm2:eth0:static:10.1.0.236:255.255.255.0:0.0.0.0].
|
||||
|
||||
=over 2
|
||||
|
||||
B<network> - The logic network which has been created by 'cfgve -t nw'
|
||||
or the default management network 'rhevm'.
|
||||
|
||||
B<interfacename> - Physical network name: 'eth0','eth1'...
|
||||
|
||||
B<protocol> - To identify which boot protocol to use for the interface: dhcp
|
||||
or static.
|
||||
|
||||
B<IP> - The IP address for the interface.
|
||||
|
||||
B<netmask> - The network mask for the interface.
|
||||
|
||||
B<gateway> - The gateay for the interface. This field only can be set when
|
||||
the interface is added to 'rhevm' network.
|
||||
|
||||
=back
|
||||
|
||||
=item B<-p>
|
||||
Configure the power management for the host.
|
||||
|
||||
The power management must be configured for the rhev-h host to make the
|
||||
rhev-m to monitor the power status of the host, so that when certain host
|
||||
failed to function, rhev-m will fail over certain role like SPM to other active host.
|
||||
|
||||
For rack mounted server, the bmc IP and user:password need to be set for the
|
||||
power management (These parameters are gotten from ipmi table). rhev-m uses the
|
||||
ipmi protocol to get the power status of the host.
|
||||
|
||||
=item B<-e>
|
||||
To activate the host.
|
||||
|
||||
=item B<-d>
|
||||
To deactivate the host to maintenance mode.
|
||||
|
||||
=item B<-h>
|
||||
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.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=head2 RHEV specific :
|
||||
|
||||
=over 2
|
||||
|
||||
=item 1.
|
||||
To approve the host 'host1', enter:
|
||||
|
||||
chhypervisor host1 -a
|
||||
|
||||
=item 2.
|
||||
To configure the network interface for the host 'host1', enter:
|
||||
|
||||
chhypervisor host1 -n
|
||||
|
||||
=item 3.
|
||||
To configure the power management for the host 'host1', enter:
|
||||
|
||||
chhypervisor host1 -p
|
||||
|
||||
=item 4.
|
||||
To activate the host 'host1', enter:
|
||||
|
||||
chhypervisor host1 -e
|
||||
|
||||
=item 5.
|
||||
To deactivate the host 'host1', enter:
|
||||
|
||||
chhypervisor host1 -d
|
||||
|
||||
=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,183 @@
|
||||
=head1 NAME
|
||||
|
||||
B<lsve> - Lists detail attributes for a virtual environment.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<lsve> [B<-t> type] [B<-m> manager] [B<-o> object]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<lsve> command can be used to list a virtual environment for
|
||||
'Data Center', 'Cluster', 'Storage Domain', 'Network' and 'Template' objects.
|
||||
|
||||
The mandatory parameter B<-m manager> is used to specify the address of the
|
||||
manager of virtual environment. xCAT needs it to access the RHEV manager.
|
||||
|
||||
The mandatory parameter B<-t type> is used to specify the type of the target
|
||||
object.
|
||||
|
||||
Basically, B<lsve> command supports three types of object: B<dc>, B<cl>, B<sd>, B<nw>
|
||||
and B<tpl>.
|
||||
|
||||
The parameter B<-o object> is used to specify which object to list. If no B<-o> is specified,
|
||||
all the objects with the B<-t> type will be displayed.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<-h>
|
||||
Display usage message.
|
||||
|
||||
=item B<-m>
|
||||
Specify the manager of the virtual environment.
|
||||
|
||||
For RHEV, the FQDN (Fully Qualified Domain Name) of the rhev manager have to be specified.
|
||||
|
||||
=item B<-o>
|
||||
The target object to display.
|
||||
|
||||
=item B<-t>
|
||||
Specify the B<type> of the target object.
|
||||
|
||||
Supported types:
|
||||
B<dc> - Data Center (For type of 'dc', all the elements belongs to the data
|
||||
center will be listed.)
|
||||
B<cl> - Cluster
|
||||
B<sd> - Storage Domain (To get the status of Storage Doamin, show it from
|
||||
I<data center> it attached to.
|
||||
B<nw> - Network
|
||||
B<tpl> - Template
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 2
|
||||
|
||||
=item 1.
|
||||
To list the data center 'Default', enter:
|
||||
|
||||
lsve -t B<dc> -m <FQDN of rhev manager> -o Default
|
||||
|
||||
Output is similar to:
|
||||
|
||||
datacenters: [Default]
|
||||
description: The default Data Center
|
||||
state: up
|
||||
storageformat: v1
|
||||
storagetype: nfs
|
||||
clusters: [Default]
|
||||
cpu: Intel Westmere Family
|
||||
description: The default server cluster
|
||||
memory_hugepage: true
|
||||
memory_overcommit: 100
|
||||
storagedomains: [image]
|
||||
available: 55834574848
|
||||
committed: 13958643712
|
||||
ismaster: true
|
||||
status: active
|
||||
storage_add: <Address of storage domain>
|
||||
storage_format: v1
|
||||
storage_path: /vfsimg
|
||||
storage_type: nfs
|
||||
type: data
|
||||
used: 9663676416
|
||||
networks: [rhevm2]
|
||||
description:
|
||||
state: operational
|
||||
stp: false
|
||||
networks: [rhevm]
|
||||
description: Management Network
|
||||
state: operational
|
||||
stp: false
|
||||
templates: [Blank]
|
||||
bootorder: hd
|
||||
cpucore: 1
|
||||
cpusocket: 1
|
||||
creation_time: 2008-04-01T00:00:00.000-04:00
|
||||
display: spice
|
||||
memory: 536870912
|
||||
state: ok
|
||||
stateless: false
|
||||
type: desktop
|
||||
|
||||
|
||||
=item 2.
|
||||
To list the cluster 'Default', enter:
|
||||
|
||||
lsve -t B<cl> -m <FQDN of rhev manager> -o Default
|
||||
|
||||
Output is similar to:
|
||||
|
||||
cpu: Intel Westmere Family
|
||||
description: The default server cluster
|
||||
memory_hugepage: true
|
||||
memory_overcommit: 10
|
||||
|
||||
|
||||
=item 3.
|
||||
To list the Storage Domain 'image', enter:
|
||||
|
||||
lsve -t B<sd> -m <FQDN of rhev manager> -o image
|
||||
|
||||
Output is similar to:
|
||||
storagedomains: [image]
|
||||
available: 55834574848
|
||||
committed: 13958643712
|
||||
ismaster: true
|
||||
status:
|
||||
storage_add: <Address of storage domain>
|
||||
storage_format: v1
|
||||
storage_path: /vfsimg
|
||||
storage_type: nfs
|
||||
type: data
|
||||
used: 9663676416
|
||||
|
||||
=item 4.
|
||||
To list the network 'rhevm', enter:
|
||||
|
||||
lsve -t B<nw> -m <FQDN of rhev manager> -o rhevm
|
||||
|
||||
Output is similar to:
|
||||
|
||||
networks: [rhevm]
|
||||
description: Management Network
|
||||
state: operational
|
||||
stp: false
|
||||
|
||||
=item 5.
|
||||
To list the template 'tpl01', enter:
|
||||
|
||||
lsve -t tpl -m <FQDN of rhev manager> -o tpl01
|
||||
|
||||
Output is similar to:
|
||||
|
||||
templates: [tpl01]
|
||||
bootorder: network
|
||||
cpucore: 2
|
||||
cpusocket: 2
|
||||
creation_time: 2012-08-22T23:52:35.953-04:00
|
||||
display: vnc
|
||||
memory: 1999634432
|
||||
state: ok
|
||||
stateless: false
|
||||
type: server
|
||||
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/lsve
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<cfgve(1)|cfgve.1>
|
||||
@@ -6,7 +6,7 @@ B<mkdsklsnode> - Use this xCAT command to define and initialize AIX/NIM diskless
|
||||
|
||||
B<mkdsklsnode [-h|--help ]>
|
||||
|
||||
B<mkdsklsnode [-V|--verbose] [-f|--force] [-n|--newname] [-i osimage_name] [-l location] [-u|--updateSN] [-k|--skipsync] [-p|--primarySN] [-b|--backupSN] [-S|--setuphanfs] noderange [attr=val [attr=val ...]]>
|
||||
B<mkdsklsnode [-V|--verbose] [-f|--force] [-n|--newname] [-i osimage_name] [-l location] [-u|--updateSN] [-k|--skipsync] [-p|--primarySN] [-b|--backupSN] [-S|--setuphanfs] [-r|--resonly] noderange [attr=val [attr=val ...]]>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -123,6 +123,10 @@ Create a new NIM machine object name for the xCAT node. Use the naming conventio
|
||||
|
||||
When using backup service nodes only update the primary. The default is to update both the primary and backup service nodes.
|
||||
|
||||
=item B<-r|--resonly>
|
||||
|
||||
Use this option if you wish to copy osimages to the service nodes and define the local resources BUT do not wish to define the local NIM client definitions. This option is only valid when the xCAT "site" definition attribute "sharedinstall" is set to "sns" (using xCAT HASN support). You run the mkdslsnode command as you normally would but include the "-r" option. You can run the same command without the "-r" option to define the NIM clients on the service nodes.
|
||||
|
||||
=item B<-S|--setuphanfs>
|
||||
|
||||
Setup NFSv4 replication between the primary service nodes and backup service nodes to provide high availability NFS for the compute nodes. This option only exports the /install directory with NFSv4 replication settings, the data synchronization between the primary service nodes and backup service nodes needs to be taken care of through some mechanism.
|
||||
@@ -183,6 +187,12 @@ Initialize an xCAT node called "node02" as an AIX diskless node. Create a new N
|
||||
|
||||
B<mkdsklsnode -n -i 61spot node02>
|
||||
|
||||
=item 5
|
||||
|
||||
In an HASN environment, replicate NIM resources listed in an osimage definiton on remote service nodes without creating NIM client definitions.
|
||||
|
||||
B<mkdsklsnode -S -r -b compute>
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
=head1 NAME
|
||||
|
||||
B<rmhypervisor> - Remove the virtualization hosts.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<RHEV specific :>
|
||||
|
||||
=over 2
|
||||
|
||||
B<rmhypervisor> I<noderange> [B<-f>]
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<rmhypervisor> command can be used to remove the virtualization host.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<-f>
|
||||
|
||||
If B<-f> is specified, the host will be deactivated to maintenance before the removing.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 2
|
||||
|
||||
=item 1.
|
||||
To remove the host 'host1', enter:
|
||||
|
||||
rmhypervisor host1
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/rmhypervisor
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -98,6 +98,8 @@ DSH_PATH=$PATH
|
||||
The B<-E> flag exports a local environment definition file to each remote
|
||||
target. Environment variables specified in this file are defined in the
|
||||
remote shell environment before the I<command_list> is executed.
|
||||
This is not supported when running xdsh to nodes that are serviced
|
||||
by Service Nodes (hierarchy).
|
||||
|
||||
B<COMMAND> B<EXECUTION>:
|
||||
|
||||
@@ -230,7 +232,7 @@ for valid names.
|
||||
xdsh will chroot (xcatchroot for AIX) to this path and run the xdsh command against the
|
||||
install image. No other xdsh flags, environment variables apply with
|
||||
this input. A noderange is not accepted. Only runs on the local host,
|
||||
normally the Management Node.
|
||||
normally the Management Node. The command you run must not prompt for input, the prompt will not be returned to you and it will appear that xdsh hangs.
|
||||
|
||||
=item B<-K>|B<--ssh-setup>
|
||||
|
||||
@@ -382,6 +384,8 @@ Specify a user-defined device type. See B<--devicetype> flag.
|
||||
Specifies a file that contains environment variable
|
||||
definitions to export to the target before executing the remote
|
||||
command. This variable is overridden by the B<-E> flag.
|
||||
This is not supported when running xdsh to nodes that are serviced
|
||||
by Service Nodes (hierarchy).
|
||||
|
||||
=item B<DSH_FANOUT>
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
B<copycds> - Copies Linux distributions and service levels from CDs/DVDs to install directory.
|
||||
B<copycds> - Copies Linux distributions and service levels from DVDs/ISOs to the xCAT /install directory.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@@ -9,15 +8,11 @@ B<copycds> [{B<-n|--name|--osver>}=I<distroname>] [{B<-a|--arch>}=I<architecture
|
||||
|
||||
B<copycds> [B<-h>|B<--help>]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<copycds> command copies all contents of Distribution CDs/DVDs or Service Pack CDs/DVDs to the install directory as
|
||||
designated in the B<site> table attribute: B<installdir>. The B<copycds> command can copy from one or more ISO files,
|
||||
or from the CD/DVD device path. If xCAT doesn't recognize the signature of the CD/DVD (e.g. in the .discinfo
|
||||
file), you must specify the -n and -a options. This is sometimes the case for distros that have very
|
||||
recently been released, and the xCAT code hasn't been updated for it yet.
|
||||
The B<copycds> command copies all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory. The destination directory will be formed from the B<installdir> site attribute and the distro name and architecture, for example: /install/rhels6.3/x86_64. The B<copycds> command can copy from one or more ISO files, or the CD/DVD device path.
|
||||
|
||||
You can get xCAT to recognize new DVDs/ISOs by adding them to /opt/xcat/lib/perl/xCAT/data/discinfo.pm and reloading xcatd (service xcatd reload).
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
@@ -25,40 +20,38 @@ recently been released, and the xCAT code hasn't been updated for it yet.
|
||||
|
||||
=item {B<-n|--name|--osver>}=I<distroname>
|
||||
|
||||
The linux distro name and version that the ISO/DVD contains. Examples: rhels5.3, centos5.1, fedora9.
|
||||
The linux distro name and version that the ISO/DVD contains. Examples: rhels6.3, sles11.2, fedora9. Note the 's' in rhels6.3 which denotes the Server version of RHEL, which is typically used.
|
||||
|
||||
=item {B<-a|--arch>}=I<architecture>]
|
||||
|
||||
The architecture of the linux distro on the ISO/DVD. Examples: x86, x86_64, ppc64.
|
||||
The architecture of the linux distro on the ISO/DVD. Examples: x86, x86_64, ppc64, s390x.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 2
|
||||
|
||||
=item *
|
||||
|
||||
To copy the RPMs from a set of ISOs that represent the CDs of a distro:
|
||||
To copy the RPMs from a set of ISOs that represent the DVDs of a distro:
|
||||
|
||||
B<copycds cd1.iso cd2.iso cd3.iso>
|
||||
copycds dvd1.iso dvd2.iso
|
||||
|
||||
=item *
|
||||
|
||||
To copy the RPMs from a physical DVD:
|
||||
|
||||
B<copycds /dev/dvd>
|
||||
copycds /dev/dvd
|
||||
|
||||
=item *
|
||||
|
||||
To copy the RPMs from a DVD ISO of a very recently released distro:
|
||||
|
||||
B<copycds -n rhels5.3 -a x86_64 dvd.iso>
|
||||
copycds -n rhels5.3 -a x86_64 dvd.iso
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<nodeset(8)|nodeset.8>, L<site(5)|site.5>, L<nodetype(5)|nodetype.5>
|
||||
|
||||
@@ -4,38 +4,46 @@ B<makedhcp> - Creates and updates DHCP configuration files.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<makedhcp> B<-n>
|
||||
B<makedhcp> B<-n> [B<-l>|B<--localonly>]
|
||||
|
||||
B<makedhcp> B<-a>
|
||||
B<makedhcp> B<-a> [B<-l>|B<--localonly>]
|
||||
|
||||
B<makedhcp> B<-a -d>
|
||||
B<makedhcp> B<-a -d> [B<-l>|B<--localonly>]
|
||||
|
||||
B<makedhcp> B<-d> I<noderange>
|
||||
B<makedhcp> B<-d> I<noderange> [B<-l>|B<--localonly>]
|
||||
|
||||
B<makedhcp> I<noderange> [B<-s> I<statements>]
|
||||
B<makedhcp> I<noderange> [B<-s> I<statements>] [B<-l>|B<--localonly>]
|
||||
|
||||
B<makedhcp> [I<-h|--help>]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<makedhcp> command creates and updates the DHCP configuration file on the local system.
|
||||
|
||||
The B<makedhcp> command creates and updates the DHCP configuration on the management node and service nodes.
|
||||
The B<makedhcp> command is supported for both Linux and AIX clusters.
|
||||
|
||||
With the B<-n> option, B<makedhcp> will create a new dhcp configuration file. For Linux systems the file will include network entries as well as certain general parameters such as a dynamic range and omapi configuration. For AIX systems the file will include network entries.
|
||||
=over 3
|
||||
|
||||
If a configuration file already exist the B<makedhcp> command will create a backup before creating a new one.
|
||||
=item 1.
|
||||
|
||||
On AIX systems, if there are any non-xCAT entries in the configuration file they will be preserved and added to the end of the new configuration file.
|
||||
Start by filling out the L<networks(5)|networks.5> table properly.
|
||||
|
||||
With a noderange or the B<-a> option, B<makedhcp> will inject configuration data pertinent to the specified nodes that immediately takes effect without a restart of DHCP.
|
||||
=item 2.
|
||||
|
||||
On AIX systems B<makedhcp> will not add entries for cluster nodes that will be installed using NIM. The entries for these nodes will be managed by NIM.
|
||||
Then use the B<makedhcp -n> option to create a new dhcp configuration file.
|
||||
|
||||
If the B<-d> flag is used with the B<-a> flag then B<makedhcp> will delete all the node entries created by xCAT. The B<-d> flag followed by a I<noderange> will delete the dhcp host definitons for the noderange.
|
||||
=item 3.
|
||||
|
||||
Any entries created by NIM will not be removed.
|
||||
Next, get the node IP addresses and MACs defined in the xCAT database.
|
||||
Also, get the hostnames and IP addresses pushed to /etc/hosts (using L<makehosts(8)|makehosts.8>) and to DNS (using L<makedns(8)|makedns.8>).
|
||||
|
||||
=item 4.
|
||||
|
||||
Then run B<makedhcp> with a noderange or the B<-a> option. This will inject into dhcpd configuration data pertinent to the specified nodes.
|
||||
On linux, the configuration information immediately takes effect without a restart of DHCP.
|
||||
|
||||
=back
|
||||
|
||||
If you need to delete node entries from the DHCP configuration, use the B<-d> flag.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
@@ -43,42 +51,53 @@ Any entries created by NIM will not be removed.
|
||||
|
||||
=item B<-n>
|
||||
|
||||
Create a new dhcp configuration file with a network statement for each network the dhcp daemon should listen on. The B<makedhcp> command will automatically restart the dhcp daemon after this operation. This option will replace any existing configuration file!
|
||||
Create a new dhcp configuration file with a network statement for each network the dhcp daemon should listen on.
|
||||
(Which networks dhcpd should listen on can be controlled by the dhcpinterfaces attribute in the L<site(5)|site.5> table.)
|
||||
The B<makedhcp> command will automatically restart the dhcp daemon after this operation.
|
||||
This option will replace any existing configuration file (making a backup of it first).
|
||||
For Linux systems the file will include network entries as well as certain general parameters such as a dynamic range and omapi configuration.
|
||||
For AIX systems the file will include network entries.
|
||||
On AIX systems, if there are any non-xCAT entries in the existing configuration file they will be preserved and added to the end of the new configuration file.
|
||||
|
||||
=item B<-a>
|
||||
|
||||
Define all nodes to the DHCP server. (Will only add nodes that can be reached, network-wise, by this DHCP server.) The dhcp daemon does not have to be restarted after this.
|
||||
Define all nodes to the DHCP server. (Will only add nodes that can be reached, network-wise, by this DHCP server.)
|
||||
The dhcp daemon does not have to be restarted after this.
|
||||
On AIX systems B<makedhcp> will not add entries for cluster nodes that will be installed using NIM. The entries for these nodes will be managed by NIM.
|
||||
|
||||
=item I<noderange>
|
||||
|
||||
Add the specified nodes to the DHCP server configuration.
|
||||
|
||||
=item [B<-s> I<statements>]
|
||||
=item B<-s> I<statements>
|
||||
|
||||
For the input noderange, the argument will be interpreted like dhcp configuration file text.
|
||||
|
||||
=item B<-a -d>
|
||||
|
||||
Delete all node entries added by xCAT from the DHCP server configuration.
|
||||
|
||||
=item B<-d> I<noderange>
|
||||
|
||||
Delete all node entries, added by xCAT, in the noderange from the DHCP server configuration.
|
||||
Delete node entries from the DHCP server configuration. On AIX, any entries created by NIM will not be removed.
|
||||
|
||||
=item B<-h>
|
||||
=item B<-a -d>
|
||||
|
||||
Delete all node entries, that were added by xCAT, from the DHCP server configuration.
|
||||
|
||||
=item B<-l>|B<--localonly>
|
||||
|
||||
Configure dhcpd on the local machine only. Without this option, makedhcp will also send this
|
||||
operation to any service nodes that service the nodes in the noderange.
|
||||
|
||||
=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
|
||||
@@ -107,7 +126,7 @@ Will cause dhcp on the next request to set root-path appropriately for only node
|
||||
|
||||
=head1 FILES
|
||||
|
||||
DHCP configuration files.
|
||||
DHCP configuration files:
|
||||
|
||||
[AIX] /etc/dhcpsd.cnf
|
||||
|
||||
|
||||
@@ -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 @@
|
||||
=head1 NAME
|
||||
|
||||
B<xcatdebug> - Enable or disable the trace facilities for xCAT.
|
||||
B<xcatdebug> - Enable or disable the trace facilities for xCAT. (Only supports Linux Operating System)
|
||||
|
||||
B<xcatdebug> { [B<-f enable|disable> [B<-c configuration file | subroutine list>]] | [ B<-d enable |disable>]}
|
||||
|
||||
|
||||
@@ -200,6 +200,9 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/sbin/snmove
|
||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lsxcatd
|
||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/postage
|
||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/slpdiscover
|
||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/cfghost
|
||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/cfgve
|
||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lsve
|
||||
|
||||
|
||||
%clean
|
||||
|
||||
@@ -57,6 +57,8 @@ if [ "$IPMIMFG" == 2 ]; then #IBM
|
||||
let idev=idev-1
|
||||
done
|
||||
fi
|
||||
elif [ "$XPROD" == "291" ]; then
|
||||
LOCKEDUSERS=1
|
||||
else
|
||||
IBMFAM=`ipmitool raw 0x3a 0x50 |head -n 1| awk '{print $1 $2 $3 $4}'`
|
||||
if [ "$IBMFAM" == "59554f4f" ]; then
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -76,7 +76,8 @@ restart)
|
||||
fi
|
||||
$STATUS > /dev/null 2>&1
|
||||
if [ "$?" = "0" ]; then
|
||||
if ! nodels --version |grep -q 'Version 2.6'; then #upgrade or downgrade from another major release, stop it just in case
|
||||
ver=`nodels --version`
|
||||
if [[ $ver < "Version 2.6" ]]; then # force to stop xcatd first when update from version earlier than 2.6
|
||||
$0 stop
|
||||
fi
|
||||
fi
|
||||
@@ -89,7 +90,8 @@ reload)
|
||||
fi
|
||||
$STATUS > /dev/null 2>&1
|
||||
if [ "$?" = "0" ]; then
|
||||
if ! nodels --version |grep -q 'Version 2.6'; then #upgrade or downgrade from another major release, stop it just in case
|
||||
ver=`nodels --version`
|
||||
if [[ $ver < "Version 2.6" ]]; then # force to stop xcatd first when update from version earlier than 2.6
|
||||
$0 stop
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -16,7 +16,23 @@ use warnings "all";
|
||||
use Time::HiRes qw/time/;
|
||||
|
||||
use IO::Socket::INET qw/!AF_INET6 !PF_INET6/;
|
||||
my $initialtimeout=0.100;
|
||||
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 {
|
||||
# return;
|
||||
# my $self = shift;
|
||||
# foreach (@_) {
|
||||
# foreach (split /\n/,$_) {
|
||||
# print $ipmidbg $self->{bmc}.": ".$_."\n";
|
||||
# }
|
||||
# }
|
||||
#}
|
||||
|
||||
my $doipv6=eval {
|
||||
require Socket6;
|
||||
@@ -28,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;
|
||||
@@ -155,9 +172,15 @@ sub logout {
|
||||
if ( $self->{onlogout}) { $self->{onlogout}->("SUCCESS",$self->{onlogout_args}); }
|
||||
return;
|
||||
}
|
||||
$self->{noretry}=1;
|
||||
$self->subcmd(netfn=>0x6,command=>0x3c,data=>$self->{sessionid},callback=>\&logged_out,callback_args=>$self);
|
||||
$self->{logged}=0; #seeing as how we are going to take it on faith the logout happened, do the callback now
|
||||
if ( $self->{onlogout}) {
|
||||
$self->{onlogout}->("SUCCESS",$self->{onlogout_args});
|
||||
}
|
||||
}
|
||||
sub logged_out {
|
||||
return;
|
||||
my $rsp = shift;
|
||||
my $self = shift;
|
||||
if (defined $rsp->{code} and $rsp->{code} == 0) {
|
||||
@@ -315,11 +338,16 @@ sub got_channel_auth_cap {
|
||||
sub open_rmcpplus_request {
|
||||
my $self = shift;
|
||||
$self->{'authtype'}=6;
|
||||
$self->{sidm} = [0x15,0x58,0x25,0x7a];
|
||||
my @payload = (0x1f,#message tag, TODO: could be random
|
||||
unless ($self->{localsid}) { $self->{localsid}=358098297; } #this is an arbitrary number of no significance
|
||||
$self->{localsid}+=1; #new session ID if we are relogging
|
||||
my @sidbytes = unpack("C4",pack("N",$self->{localsid}));
|
||||
$self->{sidm} = \@sidbytes;
|
||||
unless ($self->{rmcptag}) { $self->{rmcptag} = 1; }
|
||||
$self->{rmcptag}+=1;
|
||||
my @payload = ($self->{rmcptag},#message tag,
|
||||
0, #requested privilege role, 0 is highest allowed
|
||||
0,0, #reserved
|
||||
0x15,0x58,0x25,0x7a, #we only have to sweat one session, so no need to generate
|
||||
@sidbytes,
|
||||
0,0,0,8,1,0,0,0, #table 13-17, request sha
|
||||
1,0,0,8,1,0,0,0); #sha integrity
|
||||
if ($aessupport) {
|
||||
@@ -327,7 +355,7 @@ sub open_rmcpplus_request {
|
||||
} else {
|
||||
push @payload,(2,0,0,8,0,0,0,0);
|
||||
}
|
||||
$self->{sessionestablishmentcontext} = 'opensession';
|
||||
$self->{sessionestablishmentcontext} = STATE_OPENSESSION;
|
||||
$self->sendpayload(payload=>\@payload,type=>$payload_types{'rmcpplusopenreq'});
|
||||
}
|
||||
|
||||
@@ -344,13 +372,19 @@ sub checksum {
|
||||
sub subcmd {
|
||||
my $self = shift;
|
||||
my %args = @_;
|
||||
my $rqaddr=0x81; #see section 5.5 of ipmi2 spec, rqsa by old code
|
||||
$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 = ($rqaddr,$self->{seqlun},$args{command},@{$args{data}});
|
||||
my @rest = ($self->{rqaddr},$self->{seqlun},$args{command},@{$args{data}});
|
||||
my @payload=(@rnl,$self->checksum(@rnl),@rest,$self->checksum(@rest));
|
||||
$self->{seqlun} += 4; #increment by 1<<2
|
||||
$self->{seqlun} &= 0xff; #keep it one byte
|
||||
$self->{ipmicallback} = $args{callback};
|
||||
$self->{ipmicallback_args} = $args{callback_args};
|
||||
my $type = $payload_types{'ipmi'};
|
||||
@@ -423,15 +457,35 @@ sub waitforrsp {
|
||||
|
||||
sub timedout {
|
||||
my $self = shift;
|
||||
$self->{timeout} = $self->{timeout}*2;
|
||||
if ($self->{timeout} > 7) { #giveup, really
|
||||
$self->{timeout}=$initialtimeout;
|
||||
unless (ref $self->{pendingargs}) {
|
||||
return;
|
||||
}
|
||||
$self->{nowait}=1;
|
||||
$self->{timeout} += 1; #$self->{timeout}*2;
|
||||
if ($self->{noretry}) { return; }
|
||||
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;
|
||||
}
|
||||
$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
|
||||
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();
|
||||
#experimintation has showed rakp1 and 3 are best done with a straightforward retry, not something fancy...
|
||||
#stale rakp3 in a ipmi2 implementation that can't handle it will be detected through rmcp status code rather than assuming we must start over.
|
||||
} elsif ($self->{sessionestablishmentcontext} == STATE_EXPECTINGRAKP2) { #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();
|
||||
} 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;
|
||||
}
|
||||
sub route_ipmiresponse {
|
||||
my $sockaddr=shift;
|
||||
@@ -521,10 +575,8 @@ sub handle_ipmi_packet {
|
||||
return 3; #authcode bad, pretend it never existed
|
||||
}
|
||||
}
|
||||
unless ($rsp[2] == 0x15 and
|
||||
$rsp[3] == 0x58 and
|
||||
$rsp[4] == 0x25 and
|
||||
$rsp[5] == 0x7a) {
|
||||
my $thissid = unpack("N",pack("C*",$rsp[2],$rsp[3],$rsp[4],$rsp[5]));
|
||||
unless ($thissid==$self->{localsid}) {
|
||||
return 1; #this response does not match our current session id, ignore it
|
||||
}
|
||||
my $remsequencenumber=$rsp[6]+$rsp[7]>>8+$rsp[8]>>16+$rsp[9]>>24;
|
||||
@@ -576,10 +628,11 @@ sub got_rmcp_response {
|
||||
my $self = shift;
|
||||
my @data = @_;
|
||||
my $byte = shift @data;
|
||||
unless ($self->{sessionestablishmentcontext} eq 'opensession') {
|
||||
unless ($self->{sessionestablishmentcontext} and $self->{sessionestablishmentcontext} != STATE_ESTABLISHED) {
|
||||
#we would ignore an RMCP+ open session response if we are not in an IPMI2 negotiation, so we have to have *some* state that isn't established for this to be kosher
|
||||
return 9; #now's not the time for this response, ignore it
|
||||
}
|
||||
unless ($byte == 0x1f) {
|
||||
unless ($byte == $self->{rmcptag}) { #make sure this rmcp response is specifically the last one we sent.... we don't want to happily proceed with the risk a retry request blew up our temp session id without letting us know
|
||||
return 9;
|
||||
}
|
||||
$byte = shift @data;
|
||||
@@ -594,14 +647,17 @@ sub got_rmcp_response {
|
||||
}
|
||||
splice @data,0,5;
|
||||
$self->{pendingsessionid} = [splice @data,0,4];
|
||||
$self->{sessionestablishmentcontext} = 'rakp2';
|
||||
#TODO: if we retried, and the first answer comes back but the second answer is dropped, log in will fail as we do not know our correct session id
|
||||
#basically, we would have to retry open session requested until RAKP2 *confirmed* good
|
||||
$self->send_rakp1();
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub send_rakp3 {
|
||||
#TODO: this is the point where OPEN RMCP SESSION REQUEST should have retry stopped, not send_rakp1
|
||||
my $self = shift;
|
||||
my @payload = (0x1f,0,0,0,@{$self->{pendingsessionid}});
|
||||
$self->{rmcptag}+=1;
|
||||
my @payload = ($self->{rmcptag},0,0,0,@{$self->{pendingsessionid}});
|
||||
my @user = unpack("C*",$self->{userid});
|
||||
push @payload,unpack("C*",hmac_sha1(pack("C*",@{$self->{remoterandomnumber}},@{$self->{sidm}},4,scalar @user,@user),$self->{password}));
|
||||
$self->sendpayload(payload=>\@payload,type=>$payload_types{'rakp3'});
|
||||
@@ -609,7 +665,8 @@ sub send_rakp3 {
|
||||
|
||||
sub send_rakp1 {
|
||||
my $self = shift;
|
||||
my @payload = (0x1f,0,0,0,@{$self->{pendingsessionid}});
|
||||
$self->{rmcptag}+=1;
|
||||
my @payload = ($self->{rmcptag},0,0,0,@{$self->{pendingsessionid}});
|
||||
$self->{randomnumber}=[];
|
||||
foreach (1..16) {
|
||||
my $randomnumber = int(rand(255));
|
||||
@@ -620,17 +677,29 @@ sub send_rakp1 {
|
||||
my @user = unpack("C*",$self->{userid});
|
||||
push @payload,scalar @user;
|
||||
push @payload,@user;
|
||||
$self->{sessionestablishmentcontext} = STATE_EXPECTINGRAKP2;
|
||||
$self->sendpayload(payload=>\@payload,type=>$payload_types{'rakp1'});
|
||||
}
|
||||
sub init {
|
||||
my $self = shift;
|
||||
$self->{sessionestablishmentcontext} = 0;
|
||||
$self->{'sequencenumber'} = 0; #init sequence number
|
||||
$self->{'sequencenumberbytes'} = [0,0,0,0]; #init sequence number
|
||||
$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
|
||||
#for example, if 'get firmware information' command is retried, and happens to have sequence number 4,
|
||||
#64 transactions later a reply to the retry comes up, the data is passed into the callback function because of ambiguity introduced by the
|
||||
#overflowed sequence number
|
||||
#to mitigate this, we will iterate rqaddr every time the seqlun counter overflows
|
||||
#of course, this still means that rqaddr will, itself, overflow, but it mitigates things because:
|
||||
#448 instead of 64 transactions are now required before ambiguity is possible
|
||||
#A stale reply has to come in after the conversation has advanced at least 448 transactions, meaning longer delay on extraneous reply before this is a problem
|
||||
#even if a stale reply comes in at *about* the right time, it has to match an exact multiple of 448 instead of 64, which is significantly less likely.
|
||||
$self->{'logged'}=0;
|
||||
}
|
||||
sub relog {
|
||||
@@ -644,16 +713,28 @@ sub got_rakp4 {
|
||||
my $self = shift;
|
||||
my @data = @_;
|
||||
my $byte = shift @data;
|
||||
unless ($self->{sessionestablishmentcontext} eq 'rakp4') {
|
||||
unless ($self->{sessionestablishmentcontext} == STATE_EXPECTINGRAKP4) { #ignore rakp4 unless we are explicitly expecting RAKP4
|
||||
return 9; #now's not the time for this response, ignore it
|
||||
}
|
||||
unless ($byte == 0x1f) {
|
||||
unless ($byte == $self->{rmcptag}) { #make sure this rmcp response is specifically the last one we sent.... we don't want to happily proceed with the risk a retry request blew up our temp session id without letting us know
|
||||
return 9;
|
||||
}
|
||||
$byte = shift @data;
|
||||
unless ($byte == 0x00) {
|
||||
if (($byte == 0x02 or $byte == 15) and $self->{logontries}) { # 0x02 is 'invalid session id', seems that some ipmi implementations sometimes expire a temporary id before I can respond, start over in such a case
|
||||
if (($byte == 0x02) and $self->{logontries}) {
|
||||
#ok, turns out an IPMI2 device may optimistically assume that since it has transmitted RAKP4, it's done with this whole RAKP exchange, thus
|
||||
#code 2 can happen.... To workaround this, code 2 is taken as a cue to start over if we haven't got an rakp2 yet
|
||||
$self->relog();
|
||||
}
|
||||
if (($byte == 0x02 or $byte == 15) and $self->{logontries}) { # most likely scenario is that a retry earlier in the process invalided the flow this packet came in on, ignore it and hope the retries all sort out
|
||||
#UPDATE: turns out open rmcp session request shenanigans were to blame, rakp2 straight retransmits seems safe
|
||||
#the biggest risk: that we did not receive the correct rakp2, so the prudent thing to be doing in this time interval would be retrying RAKP1...
|
||||
#ipmi2 session negotiation is a bit weird in how retries can corrupt state and we effectively should be rewinding a bit...
|
||||
#TODO: think about retry logic hard to decide how many packets we can retry
|
||||
#thought: can we match a failed RAKP2 to the last RAKP1 we transmitted? If we can, and we see the last RAKP1 was in fact the one this response is for, that
|
||||
#would definitely mean we should rewinnd to open session rquest..
|
||||
#ditto for rakp4, if we can confirm rakp is for the last transmitted rakp3, then we need to rewind to send_rakp1...
|
||||
#$self->relog();
|
||||
return;
|
||||
}
|
||||
$self->{onlogon}->("ERROR: $byte code on opening RMCP+ session",$self->{onlogon_args}); #TODO: errors
|
||||
@@ -663,7 +744,8 @@ sub got_rakp4 {
|
||||
my @expectauthcode = unpack("C*",hmac_sha1(pack("C*",@{$self->{randomnumber}},@{$self->{pendingsessionid}},@{$self->{remoteguid}}),$self->{sik}));
|
||||
foreach (@expectauthcode[0..11]) {
|
||||
unless ($_ == (shift @data)) {
|
||||
$self->{onlogon}->("ERROR: failure in final rakp exchange message",$self->{onlogon_args});
|
||||
#we'll just ignore this transgression...... *this time*
|
||||
#$self->{onlogon}->("ERROR: failure in final rakp exchange message",$self->{onlogon_args});
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
@@ -674,7 +756,7 @@ sub got_rakp4 {
|
||||
}
|
||||
$self->{sequencenumber}=1;
|
||||
$self->{sequencenumberbytes}=[1,0,0,0];
|
||||
$self->{sessionestablishmentcontext} = 'done'; #will move on to relying upon session sequence number
|
||||
$self->{sessionestablishmentcontext} = STATE_ESTABLISHED; #will move on to relying upon session sequence number
|
||||
$self->set_admin_level();
|
||||
return 0;
|
||||
}
|
||||
@@ -684,16 +766,19 @@ sub got_rakp2 {
|
||||
my $self=shift;
|
||||
my @data = @_;
|
||||
my $byte = shift @data;
|
||||
unless ($self->{sessionestablishmentcontext} eq 'rakp2') {
|
||||
unless ($self->{sessionestablishmentcontext} >= STATE_EXPECTINGRAKP2 and $self->{sessionestablishmentcontext} != STATE_ESTABLISHED) {
|
||||
#we will bail out unless the state is either EXPECTINGRAKP2 or EXPECTINGRAKP4.
|
||||
#the reason being that if an old rakp1 retry actually made it and we were just too aggressive, then a previous rakp2 is invalidated and invalid session id or the integrity check value is bad
|
||||
return 9; #now's not the time for this response, ignore it
|
||||
}
|
||||
unless ($byte == 0x1f) {
|
||||
unless ($byte == $self->{rmcptag}) { #make sure this rmcp response is specifically the last one we sent.... we don't want to happily proceed with the risk a retry request blew up our temp session id without letting us know
|
||||
return 9;
|
||||
}
|
||||
$byte = shift @data;
|
||||
unless ($byte == 0x00) {
|
||||
if (($byte == 0x02 or $byte == 15) and $self->{logontries}) { # 0x02 is 'invalid session id', seems that some ipmi implementations sometimes expire a temporary id before I can respond, start over in such a case
|
||||
$self->relog();
|
||||
if ($byte == 0x02) { #invalid session id is almost certainly because a retry on rmcp+ open session response rendered our session id invalid, ignore this in the hope that we'll get an answer for our retry that invalidated us..
|
||||
#$self->relog();
|
||||
#TODO: probably should disable RAKP1 retry here... high likelihood that we'll just spew a bad RAKP1 and Open Session Request retry would be more appropriate to try to discern a valid session id
|
||||
return;
|
||||
}
|
||||
$self->{onlogon}->("ERROR: $byte code on opening RMCP+ session",$self->{onlogon_args}); #TODO: errors
|
||||
@@ -711,10 +796,11 @@ sub got_rakp2 {
|
||||
#Data now represents authcode.. sha1 only..
|
||||
my @user = unpack("C*",$self->{userid});
|
||||
my $ulength = scalar @user;
|
||||
my $hmacdata = pack("C*",(0x15,0x58,0x25,0x7a,@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},4,$ulength,@user));
|
||||
my $hmacdata = pack("C*",(@{$self->{sidm}},@{$self->{pendingsessionid}},@{$self->{randomnumber}},@{$self->{remoterandomnumber}},@{$self->{remoteguid}},4,$ulength,@user));
|
||||
my @expectedhash = (unpack("C*",hmac_sha1($hmacdata,$self->{password})));
|
||||
foreach (0..(scalar(@expectedhash)-1)) {
|
||||
if ($expectedhash[$_] != $data[$_]) {
|
||||
$self->{sessionestablishmentcontext}=STATE_FAILED;
|
||||
$self->{onlogon}->("ERROR: Incorrect password provided",$self->{onlogon_args});
|
||||
return 9;
|
||||
}
|
||||
@@ -726,7 +812,7 @@ sub got_rakp2 {
|
||||
my @aeskey = unpack("C*",$self->{k2});
|
||||
$self->{aeskey} = pack("C*",(splice @aeskey,0,16));
|
||||
}
|
||||
$self->{sessionestablishmentcontext} = 'rakp4';
|
||||
$self->{sessionestablishmentcontext} = STATE_EXPECTINGRAKP4;
|
||||
$self->send_rakp3();
|
||||
return 0;
|
||||
}
|
||||
@@ -736,19 +822,38 @@ 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} ? $self->{seqlun}-4 : 252)) {
|
||||
print "Successfully didn't get confused by stale response ".$payload[4]." and ".($self->{seqlun}-4)."\n";
|
||||
hexdump(@payload);
|
||||
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...
|
||||
# if ($self->{rqaddr} == 0x8d) { #rqaddr itself is forced to overflow
|
||||
# $self->{rqaddr}=0x81;
|
||||
# } else {
|
||||
# $self->{rqaddr}+=2; #table 5-4 demands rqaddr be odd for software ids, so we must increment by 2
|
||||
#}
|
||||
$self->{seqlun} &= 0xff; #keep it one byte
|
||||
}
|
||||
delete $sessions_waiting{$self}; #deregister self as satisfied, callback will reregister if appropriate
|
||||
delete $self->{pendingargs};
|
||||
splice @payload,0,5; #remove rsaddr/netfs/lun/checksum/rq/seq/lun
|
||||
pop @payload; #remove checksum
|
||||
my $rsp;
|
||||
$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;
|
||||
}
|
||||
@@ -848,7 +953,7 @@ sub sendpayload {
|
||||
#push integrity data
|
||||
}
|
||||
}
|
||||
unless ($args{nowait}) { #if nowait indicated, the packet will be sent regardless of maxpending
|
||||
unless ($args{nowait} or $self->{nowait}) { #if nowait indicated, the packet will be sent regardless of maxpending
|
||||
#primary use case would be retries that should represent no delta to pending sessions in aggregate and therefore couldn't exceed maxpending anywy
|
||||
#if we did do this on timedout, waitforrsp may recurse, which is a complicated issue. Theoretically, if waitforrsp protected itself, it
|
||||
#would act the same, but best be explicit about nowait if practice does not match theory
|
||||
@@ -864,7 +969,7 @@ sub sendpayload {
|
||||
$sessions_waiting{$self}->{ipmisession}=$self;
|
||||
if ($args{delayxmit}) {
|
||||
$sessions_waiting{$self}->{timeout}=time()+$args{delayxmit};
|
||||
$self->{timeout}=$initialtimeout/2; #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)
|
||||
{
|
||||
|
||||
@@ -372,77 +372,17 @@ sub makescript
|
||||
}
|
||||
|
||||
#get vlan related items
|
||||
my $vlan;
|
||||
my $swtab = xCAT::Table->new("switch", -create => 0);
|
||||
if ($swtab) {
|
||||
my $tmp = $swtab->getNodeAttribs($node, ['vlan'],prefetchcache=>1);
|
||||
if (defined($tmp) && ($tmp) && $tmp->{vlan})
|
||||
{
|
||||
$vlan = $tmp->{vlan};
|
||||
push @scriptd, "VLANID='" . $vlan . "'\n";
|
||||
push @scriptd, "export VLANID\n";
|
||||
} else {
|
||||
my $vmtab = xCAT::Table->new("vm", -create => 0);
|
||||
if ($vmtab) {
|
||||
my $tmp1 = $vmtab->getNodeAttribs($node, ['nics'],prefetchcache=>1);
|
||||
if (defined($tmp1) && ($tmp1) && $tmp1->{nics})
|
||||
{
|
||||
push @scriptd, "VMNODE='YES'\n";
|
||||
push @scriptd, "export VMNODE\n";
|
||||
|
||||
my @nics=split(',', $tmp1->{nics});
|
||||
foreach my $nic (@nics) {
|
||||
if ($nic =~ /^vl([\d]+)$/) {
|
||||
$vlan = $1;
|
||||
push @scriptd, "VLANID='" . $vlan . "'\n";
|
||||
push @scriptd, "export VLANID\n";
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
my $module_name="xCAT_plugin::vlan";
|
||||
eval("use $module_name;");
|
||||
if (!$@) {
|
||||
no strict "refs";
|
||||
if (defined(${$module_name."::"}{getNodeVlanConfData})) {
|
||||
my @tmp_scriptd=${$module_name."::"}{getNodeVlanConfData}->($node);
|
||||
#print Dumper(@tmp_scriptd);
|
||||
if (@tmp_scriptd > 0) {
|
||||
@scriptd=(@scriptd,@tmp_scriptd);
|
||||
}
|
||||
}
|
||||
|
||||
if ($vlan) {
|
||||
my $nwtab=xCAT::Table->new("networks", -create =>0);
|
||||
if ($nwtab) {
|
||||
my $sent = $nwtab->getAttribs({vlanid=>"$vlan"},'net','mask');
|
||||
my $subnet;
|
||||
my $netmask;
|
||||
if ($sent and ($sent->{net})) {
|
||||
$subnet=$sent->{net};
|
||||
$netmask=$sent->{mask};
|
||||
}
|
||||
if (($subnet) && ($netmask)) {
|
||||
my $hoststab = xCAT::Table->new("hosts", -create => 0);
|
||||
if ($hoststab) {
|
||||
my $tmp = $hoststab->getNodeAttribs($node, ['otherinterfaces'],prefetchcache=>1);
|
||||
if (defined($tmp) && ($tmp) && $tmp->{otherinterfaces})
|
||||
{
|
||||
my $otherinterfaces = $tmp->{otherinterfaces};
|
||||
my @itf_pairs=split(/,/, $otherinterfaces);
|
||||
foreach (@itf_pairs) {
|
||||
my ($name,$ip)=split(/:/, $_);
|
||||
if(xCAT::NetworkUtils->ishostinsubnet($ip, $netmask, $subnet)) {
|
||||
if ($name =~ /^-/ ) {
|
||||
$name = $node.$name;
|
||||
}
|
||||
push @scriptd, "VLANHOSTNAME='" . $name . "'\n";
|
||||
push @scriptd, "export VLANHOSTNAME\n";
|
||||
push @scriptd, "VLANIP='" . $ip . "'\n";
|
||||
push @scriptd, "export VLANIP\n";
|
||||
push @scriptd, "VLANSUBNET='" . $subnet . "'\n";
|
||||
push @scriptd, "export VLANSUBNET\n";
|
||||
push @scriptd, "VLANNETMASK='" . $netmask . "'\n";
|
||||
push @scriptd, "export VLANNETMASK\n";
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -716,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}))
|
||||
@@ -734,6 +673,7 @@ sub makescript
|
||||
push @scriptd, $n . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# get postscripts for node specific
|
||||
@@ -784,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}))
|
||||
@@ -795,6 +736,7 @@ sub makescript
|
||||
push @scriptd, $n . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user