Compare commits

..

46 Commits

Author SHA1 Message Date
ligc 19a14d711d fix for bug 3947: add check for AIX and nmap existence 2014-01-08 23:26:09 +08:00
yinle 45d05d26f0 minor fix 2013-12-31 01:42:33 -08:00
yinle 3bb52d4109 minor fix 2013-12-31 01:41:03 -08:00
yinle 86d2a14472 Add man for lsslp unicast 2013-12-31 01:37:08 -08:00
yinle 9567b80174 Add help information for lsslp -u 2013-12-31 01:16:27 -08:00
wanghuaz cd660ad538 fixing bug 3943: give accureate pattern to match output from console 2013-12-27 15:24:42 +08:00
yinle 7d38486a08 Add support of lsslp unicast 2013-12-22 12:27:44 -08:00
yinle ebe0f60795 Add support of lsslp unicast 2013-12-22 07:15:05 -08:00
lissav d4c6c267e8 Merge branch '2.7' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.7 2013-12-06 13:23:54 -05:00
lissav 8235d4ac43 Put same improvement in for 2.7.8 2013-12-06 13:23:06 -05:00
ligc abdf84c60f fix for bug 3922, use getNodesAttribs instead of getNodeAttribs 2013-12-05 09:51:53 +08:00
sjing e4f555bd71 Fix for bug 3912
update net-snmp rpm version
2013-12-04 04:03:36 -05:00
xq2005 2f3e76593e bug 3919 : sync from master 2013-12-03 06:39:02 -08:00
xq2005 64a9d71a53 bug 3919 : sync from master 2013-12-03 06:04:22 -08:00
ligc 63b0515072 fix for bug 3922: backport 2.8 and 2.9 fix, do not use autocommit=0 when reading tables 2013-12-03 13:45:16 +08:00
ligc 0b639cb5c2 fix for bug 3922: do not use autocommit=1 when reading database 2013-12-03 13:14:23 +08:00
sjing 61ef293909 Fixed bug 3927
AIX bundle file can not recognize '#' in the middle of line.
2013-12-02 23:02:39 -05:00
wanghuaz a6590b61bc fixing the typo error in last commit for 2.7 2013-12-03 00:44:28 +08:00
lissav 7d0067c948 Defect 3926, rerun of mysqlsetup -i leaves xcatd stopped 2013-12-02 06:41:19 -05:00
Bruce Potter e4b2e44c1c xCATsn rpm incorrectly required nbroot rpms - bug 3924 2013-11-26 14:42:01 -05:00
wanghuaz af7a55499c fixing the problem that configing bond0 flushed the default gateway. 2013-11-21 10:12:01 +08:00
sjing a21b141bbd update perl-Net_SSLeay.pm to 1.55-3 for AIX7.1.3 and above 2013-11-12 09:32:13 -05:00
lissav 5c784e7b76 defect 3859 2013-10-25 08:27:32 -04:00
daniceexi d6cef63a03 roll back last change and only added the neccessary fix 2013-10-15 14:26:44 -04:00
immarvin a8c7dca997 fix defect #3644 PMR 65683:rinstall does not support provmethod=osimagename Edit 2013-10-11 00:53:59 -07:00
daniceexi 7d5f94dd29 remove a useless line 2013-10-11 02:00:13 -04:00
Bruce Potter f7896eab97 fix setversionvars command not found problem during promote 2013-10-09 20:14:56 -04:00
daniceexi 0e8eb99410 defect 3183: check the socket sending result so that do the retry for sending failed 2013-10-09 08:55:31 -04:00
Bruce Potter 6f8f7c3f52 specifying checksum so the repo will work on rhel5 2013-08-31 11:16:47 -04:00
Bruce Potter 7a27003c93 fix bld script change 2013-08-27 12:51:15 -04:00
Bruce Potter f92c9e52c2 change git cmd used to get current branch 2013-08-27 12:36:11 -04:00
lissav 80785946c3 fix for defect 3750 2013-08-20 09:55:49 -04:00
Bruce Potter f98eee4e27 fixed bld script in 2.7 to put rpms from diff branches in the correct place 2013-08-14 11:59:38 -04:00
Bruce Potter 2773b2cb0a Merge branch '2.7' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.7 2013-08-13 10:53:09 -04:00
Bruce Potter f9790ea536 backport build changes to 2.7 2013-08-02 16:28:18 -04:00
wanghuaz 25203ea1b5 fixes for snmp v3 monitoring
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@17016 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-07-24 07:40:56 +00:00
wanghuaz bd4d78da84 fixes for snmp v3 monitoring
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@17015 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-07-24 07:37:32 +00:00
jbjohnso ac3c7fe28c Fix problem where name resolution was used instead of certificate subject to identify 'trusted' peer
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@17002 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-07-19 13:24:31 +00:00
lissav ed88f05e47 fix defect 3652
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@16917 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-07-09 15:36:51 +00:00
zhaoertao fc7822f93e delete internal information for rspconfig <celogin1>
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@16785 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-06-27 03:18:27 +00:00
lissav 46ea594db7 defect 3637
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@16712 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-06-20 12:25:01 +00:00
lissav 43e89b90a2 change from service sshd start to service sshd restart to pick up configuration changes
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@16711 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-06-20 11:41:18 +00:00
wanghuaz 309bc5cc48 fixing bug 3179: adding a sleep and reorder the steps
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@16681 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-06-19 03:39:59 +00:00
zhaoertao 5311349afa fix bug 3583: mkhwconn -s cannnot work for firebird in rh mn
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@16385 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-05-22 06:12:03 +00:00
lissav 4a2fc2bc31 fix defect 3512
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@16360 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-05-18 11:12:09 +00:00
lissav e98678711b update version number
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@16351 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2013-05-17 12:00:08 +00:00
34 changed files with 918 additions and 259 deletions
+1 -1
View File
@@ -1 +1 @@
2.7.7
2.7.8
-1
View File
@@ -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
View File
@@ -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
-3
View File
@@ -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
View File
@@ -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
+1 -2
View File
@@ -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.
Regular → Executable
+2 -2
View File
@@ -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.";
@@ -616,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;
+12 -1
View File
@@ -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";
+53 -11
View 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";
@@ -2050,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();
@@ -2086,6 +2123,7 @@ sub multiple_open_dev {
}
],
);
return $rc;
}
###################################################################
@@ -2569,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 =>
@@ -2778,6 +2816,8 @@ sub lparnetbootexp
$done = 0;
$retry_count = 0;
$timeout = 10;
while (!$done) {
my @result = $rconsole->expect(
$timeout,
@@ -2885,6 +2925,7 @@ sub lparnetbootexp
}
}
##############################
# Call multiple_open_dev to
# circumvent firmware OPEN-DEV
@@ -2919,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
@@ -2972,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);
}
+3
View File
@@ -488,6 +488,9 @@ sub mkhwconn
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;
Regular → Executable
+156 -5
View File
@@ -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);
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();
@@ -192,11 +336,11 @@ sub dodiscover {
$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;
+1 -1
View File
@@ -262,7 +262,7 @@ my %usage = (
"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|IMM2|FSP]
[-t tries][--vpdtable][-C counts][-T timeout]",
[-u][--range IPranges][-t tries][--vpdtable][-C counts][-T timeout]",
"rflash" =>
"Usage:
rflash [ -h|--help|-v|--version]
+45 -1
View File
@@ -4049,7 +4049,7 @@ sub getSNList
$servicenodetab->close;
foreach my $node (@nodes)
{
if ($service eq "") # want all the service nodes
if (! defined ($service) || ($service eq "")) # want all the service nodes
{
push @servicenodes, $node->{node};
}
@@ -6558,4 +6558,48 @@ sub filter_nodes{
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;
+84 -12
View File
@@ -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.");
+159 -18
View File
@@ -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");
}
+11
View File
@@ -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
+1 -1
View File
@@ -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
+22 -16
View File
@@ -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>
+187 -25
View File
@@ -13,11 +13,20 @@ use xCAT::MsgUtils;
use xCAT::NodeRange;
use xCAT_monitoring::monitorctrl;
use Sys::Hostname;
use File::Path qw/mkpath/;
#print "xCAT_monitoring::snmpmon loaded\n";
1;
my $confdir;
if(xCAT::Utils->isAIX()){
$::snmpconfdir = "/opt/freeware/etc";
} else {
$::snmpconfdir = "/usr/share/snmp";
}
#-------------------------------------------------------------------------------
=head1 xCAT_monitoring:snmpmon
@@ -62,7 +71,11 @@ sub start {
`/bin/kill -9 $pid`;
}
# start it up again!
system("/usr/sbin/snmptrapd -m ALL");
if(xCAT::Utils->isAIX()){
system("/opt/freeware/sbin/snmptrapd -m ALL");
} else {
system("/usr/sbin/snmptrapd -m ALL");
}
# get the PID of the currently running snmpd if it is running.
# if it's running then we just leave. Otherwise, if we don't get A PID, then we
@@ -265,7 +278,7 @@ sub config {
}
return (1, "net-snmp is not installed")
} else {
my ($ret, $err)=configSNMP();
my ($ret, $err)=configSNMP(2, $noderef, $callback);
if ($ret != 0) { return ($ret, $err);}
}
@@ -323,19 +336,19 @@ sub deconfig {
my $callback=shift;
my $localhostname=hostname();
if (-f "/usr/share/snmp/snmptrapd.conf.orig"){
if (-f "$::snmpconfdir/snmptrapd.conf.orig"){
# copy back the old one
`mv -f /usr/share/snmp/snmptrapd.conf.orig /usr/share/snmp/snmptrapd.conf`;
`mv -f $::snmpconfdir/snmptrapd.conf.orig $::snmpconfdir/snmptrapd.conf`;
} else {
if (-f "/usr/share/snmp/snmptrapd.conf"){
if (-f "$::snmpconfdir/snmptrapd.conf"){
# if the file exists, delete all entries that have xcat_traphandler
my $cmd = "grep -v xcat_traphandler /usr/share/snmp/snmptrapd.conf ";
$cmd .= "> /usr/share/snmp/snmptrapd.conf.unconfig ";
my $cmd = "grep -v xcat_traphandler $::snmpconfdir/snmptrapd.conf ";
$cmd .= "> $::snmpconfdir/snmptrapd.conf.unconfig ";
`$cmd`;
# move it back to the snmptrapd.conf file.
`mv -f /usr/share/snmp/snmptrapd.conf.unconfig /usr/share/snmp/snmptrapd.conf`;
`mv -f $::snmpconfdir/snmptrapd.conf.unconfig $::snmpconfdir/snmptrapd.conf`;
}
}
@@ -837,45 +850,54 @@ sub configSwitch {
=cut
#--------------------------------------------------------------------------------
sub configSNMP {
my $action=shift;
my $noderef=shift;
my $callback=shift;
my $ret_val=0;
my $ret_text="";
print "configSNMP called \n";
my $isSN=xCAT::Utils->isServiceNode();
my $master=xCAT::Utils->get_site_Master();
my $cmd;
# now move /usr/share/snmp/snmptrapd.conf to /usr/share/snmp/snmptrapd.conf.orig
# now move $::snmpconfdir/snmptrapd.conf to $::snmpconfdir/snmptrapd.conf.orig
# if it exists.
if (-f "/usr/share/snmp/snmptrapd.conf"){
mkpath("$::snmpconfdir");
if (-f "$::snmpconfdir/snmptrapd.conf"){
# if the file exists and has references to xcat_traphandler in mn or 'forward' in sn
# then there is nothing that needs to be done.
if ($isSN) {
`/bin/grep "forward default $master" /usr/share/snmp/snmptrapd.conf > /dev/null`;
`/bin/grep "forward default $master" $::snmpconfdir/snmptrapd.conf > /dev/null`;
} else {
`/bin/grep xcat_traphandler /usr/share/snmp/snmptrapd.conf > /dev/null`;
`/bin/grep xcat_traphandler $::snmpconfdir/snmptrapd.conf > /dev/null`;
}
# if the return code is 1, then there is no xcat_traphandler, or 'forward'
# references and we need to put them in.
if($? >> 8){
# back up the original file.
`/bin/cp -f /usr/share/snmp/snmptrapd.conf /usr/share/snmp/snmptrapd.conf.orig`;
`/bin/cp -f $::snmpconfdir/snmptrapd.conf $::snmpconfdir/snmptrapd.conf.orig`;
# if the file exists and does not have "authCommunity execute,net public" then add it.
open(FILE1, "</usr/share/snmp/snmptrapd.conf");
open(FILE, ">/usr/share/snmp/snmptrapd.conf.tmp");
open(FILE1, "<$::snmpconfdir/snmptrapd.conf");
open(FILE, ">$::snmpconfdir/snmptrapd.conf.tmp");
my $found=0;
my $forward_handled=0;
while (readline(FILE1)) {
if (/\s*authCommunity.*public/) {
$found=1;
if (/\s*authCommunity.*public/) {
$found=1;
if (!/\s*authCommunity\s*.*execute.*public/) {
s/authCommunity\s*(.*)\s* public/authCommunity $1,execute public/; #modify it to have 'execute' if found
}
}
if (!/\s*authCommunity\s*.*net.*public/) {
s/authCommunity\s*(.*)\s* public/authCommunity $1,net public/; #modify it to have 'net' if found
}
}
} elsif (/\s*forward\s*default/) {
if (($isSN) && (!/$master/)) {
s/\s*forward/\#forward/; #comment out the old one
if (($isSN) && (!/$master/)) {
s/\s*forward/\#forward/; #comment out the old one
if (!$forward_handled) {
print FILE "forward default $master\n";
$forward_handled=1;
@@ -891,7 +913,7 @@ sub configSNMP {
if (!$found) { #add new one if not found
print FILE "authCommunity log,execute,net public\n";
}
# now add the new traphandle commands:
if (!$isSN) {
print FILE "traphandle default $::XCATROOT/sbin/xcat_traphandler\n";
@@ -899,13 +921,13 @@ sub configSNMP {
close(FILE1);
close(FILE);
`mv -f /usr/share/snmp/snmptrapd.conf.tmp /usr/share/snmp/snmptrapd.conf`;
`mv -f $::snmpconfdir/snmptrapd.conf.tmp $::snmpconfdir/snmptrapd.conf`;
}
}
else { # The snmptrapd.conf file does not exists
# create the file:
my $handle = new IO::File;
open($handle, ">/usr/share/snmp/snmptrapd.conf");
open($handle, ">$::snmpconfdir/snmptrapd.conf");
print $handle "authCommunity log,execute,net public\n";
if ($isSN) {
print $handle "forward default $master\n"; #forward the trap from sn to mn
@@ -915,6 +937,146 @@ sub configSNMP {
close($handle);
}
# Configure SNMPv3 on AIX
if(xCAT::Utils->isAIX()){
#the identification of this node
my @hostinfo=xCAT::Utils->determinehostname();
my $isSV=xCAT::Utils->isServiceNode();
my %iphash=();
foreach(@hostinfo) {$iphash{$_}=1;}
if (!$isSV) { $iphash{'noservicenode'}=1;}
my $all=0;
my %nodehash=();
if ((!$noderef) || (@$noderef==0)) {$all=1;}
else {
foreach(@$noderef) { $nodehash{$_}=1;}
}
my %mpa_hash=();
my %masterhash=();
my @node_a=();
my $table=xCAT::Table->new("mp");
if ($table) {
my @tmp1=$table->getAllNodeAttribs(['node','mpa']);
if (@tmp1 > 0) {
foreach(@tmp1) {
my $node=$_->{node};
my $mpa=$_->{mpa};
if ((!$all) && (!exists($nodehash{$node})) && (!exists($nodehash{$mpa}))) {next;}
if ($mpa_hash{$mpa}) { next;} #already handled
$mpa_hash{$mpa}=1;
my $pHash=xCAT_monitoring::monitorctrl->getNodeMonServerPair([$mpa], 0);
if (ref($pHash) eq 'ARRAY') {
if ($callback) {
my $rsp={};
if ($ret_val) {
$rsp->{data}->[0]=$pHash->[1];
}
$callback->($rsp);
} else {
xCAT::MsgUtils->message('S', "[mon]: " . $pHash->[1]);
}
return (0, "");
}
my $pairs=$pHash->{$mpa};
my @a_temp=split(':',$pairs);
my $monserver=$a_temp[0];
my $master=$a_temp[1];
if ($monserver) {
if (!$iphash{$monserver}) { next;} #skip if has sn but not localhost
} else {
if ($isSV) { next; } #skip if does not have sn but localhost is a sn
}
push(@node_a, $mpa);
# find the master node and add the node in the hash
if(exists($masterhash{$master})) {
my $ref=$masterhash{$master};
push(@$ref, $mpa);
} else { $masterhash{$master}=[$mpa]; }
} #foreach
}
$table->close();
}
if (@node_a==0){ return ($ret_val, $ret_text);} #nothing to handle
# Read username, password, and mac from DB.
foreach my $mpa ( @node_a ) {
my $mac;
my $user;
my $password;
my $mpatable=xCAT::Table->new("mpa");
if ($mpatable) {
my $mpa_a = $mpatable->getAttribs({mpa => $mpa}, 'username', 'password');
if ( $mpa_a and $mpa_a->{username} and $mpa_a->{password} ) {
$user = $mpa_a->{username};
$password = $mpa_a->{password};
} else {
xCAT::MsgUtils->message('E', "No username or password found for $mpa");
}
}
my $mactable=xCAT::Table->new("mac");
if ( $mactable ) {
my $mac_a = $mactable->getAttribs({node=> $mpa}, 'mac');
if ( $mac_a and $mac_a->{mac} ) {
$mac = $mac_a->{mac};
} else {
xCAT::MsgUtils->message('E', "No mac found for $mpa");
}
}
my $found1=0;
my $found2=0;
if ( $mac and $user and $password ) {
#write configuration file
open(FILE1, "<$::snmpconfdir/snmptrapd.conf");
open(FILE, ">$::snmpconfdir/snmptrapd.conf.tmp");
while (readline(FILE1)) {
if (/\s*authUser.*$user/) {
$found1=1;
if (!/\s*authUser\s*.*execute.*$user/) {
s/authUser\s*(.*)\s* $user/authUser $1,execute $user/; #modify it to have 'execute' if found
}
}
if (!/\s*authUser\s*.*net.*$user/) {
s/authUser\s*(.*)\s* $user/authUser $1,net $user/; #modify it to have 'net' if found
}
if (/\s*createUser.*$mac.*$user.*$password/) {
$found2=1;
}
print FILE $_;
}
}
if (!$found1) { #add new one if not found
print FILE "authUser log,execute,net $user\n";
}
if (!$found2) {
print FILE "createUser -e 0x8000045001$mac $user SHA $password DES\n";
}
close(FILE1);
close(FILE);
`mv -f $::snmpconfdir/snmptrapd.conf.tmp $::snmpconfdir/snmptrapd.conf`;
}
}
# TODO: put the mib files to /usr/share/snmp/mibs
return (0, "");
}
+5 -3
View File
@@ -1738,7 +1738,7 @@ sub rscan_stanza {
$objname =~ tr/A-Z/a-z/;
} else {
$objname = $data[1];
}
}
$result .= "$objname:\n\tobjtype=node\n";
foreach ( @rscan_attribs ) {
@@ -4471,7 +4471,7 @@ sub clicmds {
my $reset;
foreach (keys %handled) {
if (/^snmpcfg/) { $result = snmpcfg($t,$handled{$_},$user,$pass,$mm); }
if (/^snmpcfg/) { $result = snmpcfg($t,$handled{$_},$user,$pass,$mm,$node); }
elsif (/^sshcfg$/) { $result = sshcfg($t,$handled{$_},$user,$mm); }
elsif (/^network$/) { $result = network($t,$handled{$_},$mpa,$mm,$node,$nodeid); }
elsif (/^initnetwork$/) { $result = network($t,$handled{$_},$mpa,$mm,$node,$nodeid,1); $reset=1; }
@@ -4981,6 +4981,7 @@ sub snmpcfg {
my $uid = shift;
my $pass = shift;
my $mm = shift;
my $node = shift;
if ($value !~ /^enable|disable$/i) {
return([1,"Invalid argument '$value' (enable|disable)"]);
@@ -5018,10 +5019,11 @@ sub snmpcfg {
}
my $cmd;
my $ipfn = xCAT::Utils->my_ip_facing($node);
if ($mptype =~ /^[a]?mm$/) {
$cmd= "users -$id -ap sha -at write -ppw $pass -pp $pp -T system:$mm";
} elsif ($mptype eq "cmm"){
$cmd= "users -n $uid -ap sha -at set -ppw $pass -pp $pp -T system:$mm";
$cmd= "users -n $uid -ap sha -at set -ppw $pass -pp $pp -T system:$mm -i $ipfn";
}
@data = $t->cmd($cmd);
+1 -1
View File
@@ -236,7 +236,7 @@ sub setdestiny {
(my $portent) = $sitetab->getAttribs({key=>'xcatdport'},'value');
(my $mastent) = $sitetab->getAttribs({key=>'master'},'value');
my $enthash = $nodetype->getNodesAttribs(\@nodes,[qw(arch)]);
my $resents = $restab->getNodeAttribs(\@nodes,[qw(xcatmaster)]);
my $resents = $restab->getNodesAttribs(\@nodes,[qw(xcatmaster)]);
foreach (@nodes) {
my $ent = $enthash->{$_}->[0]; #$nodetype->getNodeAttribs($_,[qw(arch)]);
unless ($ent and $ent->{arch}) {
+1 -1
View File
@@ -2426,7 +2426,7 @@ sub process_request {
unless ($libvirtsupport) {
$libvirtsupport = eval {
require Sys::Virt;
if (Sys::Virt->VERSION < "0.2.0") {
if ( xCAT::Utils::version_cmp(Sys::Virt->VERSION, "0.2.0") < 0 ) {
die;
}
1;
+17 -1
View File
@@ -262,7 +262,7 @@ sub parse_args {
# Process command-line flags
#############################################
if (!GetOptions( \%opt,
qw(h|help V|Verbose v|version i=s x z w r s=s e=s t=s m c n C=s T=s I updatehosts makedhcp resetnet vpdtable))) {
qw(h|help V|Verbose v|version i=s x z w r s=s e=s t=s m c n C=s T=s I u range=s updatehosts makedhcp resetnet vpdtable))) {
return( usage() );
}
@@ -405,6 +405,18 @@ sub parse_args {
$globalopt{n} = 1;
}
if ( exists( $opt{u} )) {
$globalopt{u} = 1;
unless (exists( $opt{s} ) and exists ($opt{range})) {
return( usage( "-u should be used with -s and --range" ));
}
$globalopt{range} = $opt{range};
}
if (exists( $opt{range} )) {
unless (exists( $opt{u} )) {
return( usage( "range is used in unicast mode" ));
}
}
##############################################
# warn for no discovered nodes in database
##############################################
@@ -525,6 +537,10 @@ sub invoke_dodiscover {
$arg{Time} = $globalopt{T} if($globalopt{T});
$arg{nomsg} = 1 if($globalopt{z} or $globalopt{x});
$arg{reqcallback} = $request->{callback} if($request->{callback});
if ($globalopt{u}) {
$arg{unicast} = 1;
$arg{range} = $globalopt{range};
}
my ($searchmacsref,$sendcount,$rsp) = xCAT::SLP::dodiscover(%arg);
+6 -59
View File
@@ -477,65 +477,12 @@ sub preprocess_updatenode
}
if (scalar(@sns) && $::SECURITY) {
$::CALLBACK = $callback;
$::NODEOUT = ();
# setup the ssh keys
my $req_sshkey = {%$request};
$req_sshkey->{node} = \@sns;
$req_sshkey->{security}->[0] = "yes";
if ($::USER) {
$req_sshkey->{user}->[0] = $::USER;
}
if ($::DEVICETYPE) {
$req_sshkey->{devicetype}->[0] = $::DEVICETYPE;
}
updatenode($req_sshkey, \&updatenode_cb, $subreq);
# run the postscripts: remoteshell, servicenode
if ($postscripts eq "allkeys44444444security") {
my ($rc, $AIXnodes, $Linuxnodes) = xCAT::InstUtils->getOSnodes(\@sns);
my $req_rs = {%$request};
my $ps;
if (scalar(@{$AIXnodes})) {
$ps = "aixremoteshell,servicenode";
$req_rs->{rerunps}->[0] = "yes";
$req_rs->{rerunps4security}->[0] = "yes";
$req_rs->{node} = $AIXnodes;
$req_rs->{postscripts} = [$ps];
updatenode($req_rs, \&updatenode_cb, $subreq);
}
if (scalar(@{$Linuxnodes})) {
$ps = "remoteshell,servicenode";
$req_rs->{rerunps}->[0] = "yes";
$req_rs->{rerunps4security}->[0] = "yes";
$req_rs->{node} = $Linuxnodes;
$req_rs->{postscripts} = [$ps];
updatenode($req_rs, \&updatenode_cb, $subreq);
}
}
# parse the output of update security for sns
foreach my $sn (keys %{$::NODEOUT}) {
if (!grep /^$sn$/, @sns) {
next;
}
if ( (grep /ps ok/, @{$::NODEOUT->{$sn}})
&& (grep /ssh ok/, @{$::NODEOUT->{$sn}}) ) {
push @good_sns, $sn;
}
}
if ($::VERBOSE) {
my $rsp;
push @{$rsp->{data}}, "Update security for following service nodes: @sns.";
push @{$rsp->{data}}, " Following service nodes have been updated successfully: @good_sns";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
# cannot use updatenode -k to compute nodes, whose master is a service node
my $rsp;
push @{$rsp->{data}}, "updatenode -k is not supported to compute nodes in a hierarchical cluster.";
push @{$rsp->{data}}, " To update ssh keys on compute nodes , use xdsh -K";
xCAT::MsgUtils->message("E", $rsp, $callback,1);
return 1;
}
# build each request for each service node
+5 -3
View File
@@ -1516,7 +1516,7 @@ sub dispatch_request {
#flock($dlock,LOCK_UN);
if ($errstr) {
if ($numdests == 1) {
dispatch_callback({error=>["Unable to dispatch hierarchical sub-command to ".$ENV{XCATHOST}.". This service node may be down or its xcatd daemon may not be responding."],errorcode=>[1]});
dispatch_callback({error=>["Unable to dispatch hierarchical sub-command to ".$ENV{XCATHOST}.". Error: $errstr."],errorcode=>[1]});
xCAT::MsgUtils->message("S","Error dispatching request to ".$ENV{XCATHOST}.": ".$errstr);
} else {
xCAT::MsgUtils->message("S","Error dispatching request to ".$ENV{XCATHOST}.", trying other service nodes: ".$errstr);
@@ -1732,7 +1732,7 @@ sub service_connection {
my $bytesread;
do { $bytesread=sysread($sock,$line,65536,length($line)) } while ($bytesread);
if (length($line)==0) {
if (not defined $bytesread and $! == EAGAIN) { next; } #
if (not defined $bytesread and ($! == EAGAIN or $! == ECHILD)) { next; } # ECHILD makes no sense, but some platform does
last;
}
$flags=fcntl($sock,F_GETFL,0);
@@ -1885,7 +1885,9 @@ sub send_pending_responses {
$blocks += 1;
}
foreach (0..$blocks) {
do {
syswrite($sock,$resp,4096,$_*4096);
} while (($! == EAGAIN) or ($! == ECHILD));
}
};
}
@@ -1991,7 +1993,7 @@ sub validate {
# check to see if peerhost is trusted
foreach $rule (@$policies) {
if (($rule->{name} and (($rule->{name} eq $peerhost) || ($rule->{name} eq $peerhostorg))) && ($rule->{rule}=~ /trusted/i)) {
if (($rule->{name} and $rule->{name} eq $peername) && ($rule->{rule}=~ /trusted/i)) {
$peerstatus="Trusted";
last;
}
+17 -5
View File
@@ -39,10 +39,18 @@
# This command can only be run by a root user.
#
####################################################################
BEGIN
{
$::XCATROOT =
$ENV{'XCATROOT'} ? $ENV{'XCATROOT'}
: -d '/opt/xcat' ? '/opt/xcat'
: '/usr';
}
use lib "$::XCATROOT/lib/perl";
use File::Spec;
use Getopt::Long;
use strict;
require xCAT::MsgUtils;
my $OSname;
my @Commands_array;
my $Command_name;
@@ -94,7 +102,7 @@ sub run_cmd {
print "\n\tExecuting: $Command \n";
eval {
local $SIG{ALRM} = sub { die "Timeout\n" };
alarm 60;
alarm 600;
@output = `$Command`;
alarm 0;
};
@@ -193,7 +201,7 @@ sub snap_it {
@files_array = (
"/etc/xcat/*","$::ROOTHOME/.xcat/*", "$INSTALLDIR/autoinst/*",
"$INSTALLDIR/postscripts/*", "$INSTALLDIR/prescripts/*",
"$INSTALLDIR/postscripts/*", "$INSTALLDIR/prescripts/*", "$INSTALLDIR/custom/*",
"/tftpboot/*", "/var/log/consoles/*",
"/etc/*-release", "/etc/dhcpd.conf",
"/var/lib/dhcpd/dhcpd.leases", "/etc/hosts", "/etc/resolv.conf",
@@ -230,7 +238,7 @@ sub snap_it {
"ls $installdir","/usr/bin/crontab -l",
"find /tftpboot -size -32k","ls -lR $xcatroot",
"arp -a","ps -edlf","ps -aux","ulimit -a","df -k",
"cat /etc/issue","lsxcatd -a");
"cat /etc/issue","lsxcatd -a","cat /proc/meminfo", "cat /proc/cpuinfo");
}
foreach my $item (@Commands_array) {
$Command = $item;
@@ -332,7 +340,11 @@ if ($::HELP ) {
exit 0;
}
if ($::VERSION) {
print " xcatsnap tool version 1.0\n";
my $version = xCAT::Utils->Version();
$version .= "\n";
xCAT::MsgUtils->message("N", $version);
exit 0;
exit 0;
}
@@ -12,5 +12,8 @@ R:popt*
R:rsync*
# using Perl 5.10.1
R:perl-Net_SSLeay.pm-1.30-3*
# used for AIX 7.1.2 and older
#R:perl-Net_SSLeay.pm-1.30-3*
# used for AIX 7.1.3 and above
R:perl-Net_SSLeay.pm-1.55-3*
R:perl-IO-Socket-SSL*
@@ -32,7 +32,7 @@ R:expat*
R:fping*
R:libxml2*
R:net-snmp-5.4.2.1-2*
R:net-snmp-5.7.2-2*
R:net-snmp-devel*
R:net-snmp-perl*
R:openslp-xcat*
@@ -29,7 +29,7 @@ R:curl*
R:expat*
R:fping*
R:libxml2*
R:net-snmp-5.4.2.1-3*
R:net-snmp-5.7.2-3*
R:net-snmp-devel*
R:net-snmp-perl*
R:openslp-xcat*
@@ -47,7 +47,10 @@ R:perl-Net-DNS*
R:perl-Net-IP*
R:perl-Net-Telnet*
R:perl-version-0.82-2*
R:perl-Net_SSLeay.pm-1.30-3*
# used for AIX 7.1.2 and older
#R:perl-Net_SSLeay.pm-1.30-3*
# used for AIX 7.1.3 and above
R:perl-Net_SSLeay.pm-1.55-3*
R:perl-IO-Socket-SSL*
R:unixODBC*
+12 -8
View File
@@ -17,7 +17,6 @@ BEGIN
}
use lib "$::XCATROOT/lib/perl";
use xCAT::Utils;
use Getopt::Long;
use strict;
@@ -39,21 +38,25 @@ GetOptions( 'V|verbose' => \$::VERBOSE,
if ($help) {
print "DB2 Table Reorganization utility.\n";
print
"This script can be set as a cron job or run on the command line to reorg the xcatdb DB2 database tables.\n";
"This script can be set as a cron job or run on the command line to reorg the xcatdb DB2 database tables. It automatically added as a cron job, if you use the db2sqlsetup command to create your DB2 database setup for xCAT. \n";
print "Usage:\n";
print "\t--V - Verbose mode\n";
print "\t--h - usage\n";
print
"\t--t -comma delimitated list of tables.\n Without this flag it reorgs all tables in the xcatdb database .\n";
print "\n";
print "Author: Lissa Valletta\n";
exit 0;
}
require xCAT::Utils;
# check to see if running DB2
my $DBname = xCAT::Utils->get_DBName;
if ($DBname ne "DB2") {
print " Reorg of table only supported for DB2 database\n";
`logger -txcat " reorgtbls:Only supports DB2 database"` ;
`logger -p local4.err -t xcat " reorgtbls:Only supports DB2 database"` ;
exit 1;
}
@@ -64,7 +67,7 @@ if ($tablelist) { # input list of tables
@tablist = xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
`logger -txcat " reorgtbls:error in select tabname from syscat.tables"` ;
`logger -p local4.err -t xcat " reorgtbls:error in select tabname from syscat.tables"` ;
exit 1;
}
}
@@ -96,22 +99,23 @@ foreach my $table (@tablist) {
$table =~ tr/a-z/A-Z/; # convert to upper
if ($::VERBOSE) {
print " Reorg of table $table\n";
`logger -p local4.info -t xcat " Reorg of table $table."`;
}
$cmd="$::XCATROOT/sbin/runsqlcmd \"reorg indexes all for table $table allow write access;\"";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
`logger -txcat " reorgtbls:error $cmd"`;
`logger -p local4.warning -t xcat " reorgtbls:error $cmd"`;
} else {
`logger -txcat " reorgtbls:reorg indexes for $table"`;
`logger -p local4.info -t xcat " reorgtbls:reorg indexes for $table"`;
}
$cmd="$::XCATROOT/sbin/runsqlcmd \"reorg table $table inplace allow write access;\"";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{
`logger -txcat " reorgtbls:error $cmd"`;
`logger -p local4.warning -t xcat " reorgtbls:error $cmd"`;
} else {
`logger -txcat " reorgtbls:reorg $table inplace"`;
`logger -p local4.info -t xcat " reorgtbls:reorg $table inplace"`;
}
}
exit 0;
+23 -1
View File
@@ -96,18 +96,40 @@ ONBOOT=yes
" >/etc/sysconfig/network-scripts/ifcfg-bond0
fi
if [[ $NTYPE != service ]]
then
if echo $MASTER | egrep '^([0-9]+.){3}[0-9]+$'
then
XCATMASTER=`grep "$MASTER " /etc/hosts | grep -v "^#" | awk '{print $2}' | awk -F '.' '{print $1}' | sed 's/-hf.*//g'`
GATEWAY_IP=`ping -c 3 $XCATMASTER-bond0 -I hf0 2>/dev/null | grep "data" | sed 's/.* (\([0-9.]*\)).*/\1/' | uniq 2>&1`
elif [ -n "$MASTER" ]
then
XCATMASTER=`echo $MASTER | awk -F-hf '{print $1}'`
GATEWAY_IP=`ping -c 3 $XCATMASTER-bond0 -I hf0 2>/dev/null | grep "data" | sed 's/.* (\([0-9.]*\)).*/\1/' | uniq 2>&1`
fi
if [ -n "$GATEWAY_IP" ]
then
sed -i "/GATEWAY.*/d" /etc/sysconfig/network
echo "GATEWAY=$GATEWAY_IP" >> /etc/sysconfig/network
fi
fi
x=0
while [ $x -le $i ]; do
ip link set dev hf${x} down
sleep 2
echo +hf${x} > /sys/class/net/bond0/bonding/slaves
x=$((x+1))
done
bond-mld > m.out 2>&1 &
ip link set dev bond0 mtu 65536
ifdown bond0
ifup bond0
bond-mld > m.out 2>&1 &
else
# Configurartion for AIX
+1 -1
View File
@@ -160,7 +160,7 @@ then
service ssh restart
fi
else
service sshd start
service sshd restart
fi
kill -9 $CREDPID
+1 -1
View File
@@ -7,6 +7,6 @@ Standards-Version: 3.7.2
Package: xcatsn
Architecture: all
Depends: ${perl:Depends}, xcat-server (>= 2.5.0), perl-xcat (>= 2.5.0), xcat-client (>= 2.5.0), libdbd-sqlite3-perl, libxml-parser-perl, atftp-xcat, conserver, yaboot-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, fping, bind9, vsftpd, ipmitool (>=1.8.9), xnba-undi, syslinux-xcat, xcat-nbroot-oss-x86, xcat-nbroot-core-x86, xcat-nbkernel-x86, xcat-nbroot-oss-amd64, xcat-nbroot-core-amd64, xcat-nbkernel-amd64, xcat-nbroot-oss-ppc64, xcat-nbroot-core-ppc64, xcat-nbkernel-ppc64, syslinux
Depends: ${perl:Depends}, xcat-server (>= 2.5.0), perl-xcat (>= 2.5.0), xcat-client (>= 2.5.0), libdbd-sqlite3-perl, libxml-parser-perl, atftp-xcat, conserver, yaboot-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, fping, bind9, vsftpd, ipmitool (>=1.8.9), xnba-undi, syslinux-xcat, syslinux
Description: Metapackage for a common, default xCAT service node setup
xCATsn is a service node management package intended for at-scale management, including hardware management and software management.
+2 -3
View File
@@ -38,9 +38,8 @@ Requires: perl-IO-Stty
%endif
%ifarch i386 i586 i686 x86 x86_64
# All versions of the nb rpms are pulled in so an x86 MN can manage nodes of any arch.
# The nb rpms are used for dhcp-based discovery, and flashing, so for now we do not need them on a ppc MN.
Requires: xCAT-nbroot-oss-x86 xCAT-nbroot-core-x86 xCAT-nbkernel-x86 xCAT-nbroot-oss-x86_64 xCAT-nbroot-core-x86_64 xCAT-nbkernel-x86_64 xCAT-nbroot-oss-ppc64 xCAT-nbroot-core-ppc64 xCAT-nbkernel-ppc64 syslinux
# The xCAT-genesis-x86_64 rpm is used for dhcp-based discovery, and flashing, so for now we do not need it on a ppc MN.
Requires: syslinux xCAT-genesis-x86_64
Requires: ipmitool-xcat >= 1.8.9
Requires: xnba-undi syslinux-xcat
%endif