diff --git a/Version b/Version index ec1cf33c3..338a5b5d8 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.6.3 +2.6.6 diff --git a/buildcore.sh b/buildcore.sh index c95a079d9..c10422864 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -399,7 +399,7 @@ if [ "$OSNAME" != "AIX" -a "$REL" = "devel" -a "$PROMOTE" != 1 ]; then rpm2cpio ../$XCATCORE/xCAT-client-*.$NOARCH.rpm | cpio -id '*.html' rpm2cpio ../$XCATCORE/perl-xCAT-*.$NOARCH.rpm | cpio -id '*.html' rpm2cpio ../$XCATCORE/xCAT-test-*.$NOARCH.rpm | cpio -id '*.html' - while ! rsync -rv opt/xcat/share/doc/man1 opt/xcat/share/doc/man3 opt/xcat/share/doc/man5 opt/xcat/share/doc/man8 $UPLOADUSER,xcat@web.sourceforge.net:htdocs/ + while ! rsync -rv opt/xcat/share/doc/man1 opt/xcat/share/doc/man3 opt/xcat/share/doc/man5 opt/xcat/share/doc/man7 opt/xcat/share/doc/man8 $UPLOADUSER,xcat@web.sourceforge.net:htdocs/ do : ; done cd .. fi diff --git a/builddep.sh b/builddep.sh index 25a432843..ea50d2657 100755 --- a/builddep.sh +++ b/builddep.sh @@ -112,7 +112,7 @@ cd $OSVER # pyodbc is dependent on unixODBC rpm -Uvh unixODBC* -for i in `ls *.rpm|grep -v -E '^tcl-|^tk-|^expect-|^unixODBC-'`; do +for i in `ls *.rpm|grep -v -E '^tcl-|^tk-|^expect-|^unixODBC-|^xCAT-UI-deps'`; do if [ "$i" == "perl-Net-DNS-0.66-1.aix5.3.ppc.rpm" ]; then opts="--nodeps" else diff --git a/makeclientrpm b/makeclientrpm index fab72e0ea..e6223cd61 100755 --- a/makeclientrpm +++ b/makeclientrpm @@ -24,15 +24,22 @@ then rpm -ba xCAT-client/xCAT-client.spec #rpm -ta $source/SOURCES/xCAT-client-$VER.tar.gz else - if [ -f /etc/redhat-release ] + rpmbuild --version > /dev/null + if [ $? -gt 0 ] then - pkg="redhat" - else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi + RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` + if [ $? -gt 0 ] + then + echo "Could not determine rpmbuild's root" + exit 1 + fi + echo "The location for rpm building is ${RPMROOT}" set -x - tar --exclude=.svn -czhf /usr/src/$pkg/SOURCES/xCAT-client-$VER.tar.gz xCAT-client - rm -f /usr/src/$pkg/SRPMS/xCAT-client-$VER*rpm /usr/src/$pkg/RPMS/noarch/xCAT-client-$VER*rpm - rpmbuild -ta /usr/src/$pkg/SOURCES/xCAT-client-$VER.tar.gz + tar --exclude=.svn -czhf $RPMROOT/SOURCES/xCAT-client-$VER.tar.gz xCAT-client + rm -f $RPMROOT/SRPMS/xCAT-client-$VER*rpm $RPMROOT/RPMS/noarch/xCAT-client-$VER*rpm + rpmbuild -ta $RPMROOT/SOURCES/xCAT-client-$VER.tar.gz fi diff --git a/makenbrootrpm b/makenbrootrpm index a4e7bdcb2..e86153e74 100755 --- a/makenbrootrpm +++ b/makenbrootrpm @@ -1,16 +1,23 @@ #!/bin/sh VER=`cat Version` -if [ -f /etc/redhat-release ] +rpmbuild --version > /dev/null +if [ $? -gt 0 ] then - pkg="redhat" -else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi +RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` +if [ $? -gt 0 ] +then + echo "Could not determine rpmbuild's root" + exit 1 +fi +echo "The location for rpm building is ${RPMROOT}" cd `dirname $0`/xCAT-nbroot -tar --exclude .svn -czvf /usr/src/$pkg/SOURCES/xcat-nbrootoverlay.tar.gz -C overlay/ . -#mv -f *.gz /usr/src/$pkg/SOURCES -cp LICENSE.html /usr/src/$pkg/BUILD -cp xcat-core-nbroot.spec /usr/src/$pkg/SOURCES +tar --exclude .svn -czvf $RPMROOT/SOURCES/xcat-nbrootoverlay.tar.gz -C overlay/ . +#mv -f *.gz $RPMROOT/SOURCES +cp LICENSE.html $RPMROOT/BUILD +cp xcat-core-nbroot.spec $RPMROOT/SOURCES cd - -rm -f /usr/src/$pkg/SRPMS/xCAT-nbroot-$VER*rpm /usr/src/$pkg/RPMS/*/xCAT-nbroot-$VER*rpm +rm -f $RPMROOT/SRPMS/xCAT-nbroot-$VER*rpm $RPMROOT/RPMS/*/xCAT-nbroot-$VER*rpm rpmbuild -ba xCAT-nbroot/xcat-core-nbroot.spec --target $1 diff --git a/makeperlxcatrpm b/makeperlxcatrpm index 59a8f48d9..83956b812 100755 --- a/makeperlxcatrpm +++ b/makeperlxcatrpm @@ -26,19 +26,27 @@ then rpm -ba perl-xCAT/perl-xCAT.spec #rpm -ta $source/SOURCES/perl-xCAT-$VER.tar.gz else - if [ -f /etc/redhat-release ] + + rpmbuild --version > /dev/null + if [ $? -gt 0 ] then - pkg="redhat" - else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi + RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` + if [ $? -gt 0 ] + then + echo "Could not determine rpmbuild's root" + exit 1 + fi + echo "The location for rpm building is ${RPMROOT}" set -x - svn info > perl-xCAT/.svninfo - tar --exclude .svn -czhf /usr/src/$pkg/SOURCES/perl-xCAT-$VER.tar.gz perl-xCAT; - rm perl-xCAT/.svninfo - rm -f /usr/src/$pkg/SRPMS/perl-xCAT-$VER*rpm /usr/src/$pkg/RPMS/noarch/perl-xCAT-$VER*rpm - rpmbuild -ta /usr/src/$pkg/SOURCES/perl-xCAT-$VER.tar.gz + svn info > perl-xCAT/.svninfo + tar --exclude .svn -czhf $RPMROOT/SOURCES/perl-xCAT-$VER.tar.gz perl-xCAT; + rm perl-xCAT/.svninfo + rm -f $RPMROOT/SRPMS/perl-xCAT-$VER*rpm $RPMROOT/RPMS/noarch/perl-xCAT-$VER*rpm + rpmbuild -ta $RPMROOT/SOURCES/perl-xCAT-$VER.tar.gz fi diff --git a/makeserverrpm b/makeserverrpm index 6f8a529dd..3a295f0a5 100755 --- a/makeserverrpm +++ b/makeserverrpm @@ -7,32 +7,40 @@ if [ "$OSNAME" = "AIX" ] then #echo '.svn' > /tmp/xcat-excludes - #tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/xCAT-server-$VER.tar xCAT-server - #gzip -f /opt/freeware/src/packages/SOURCES/xCAT-server-$VER.tar - #cd ./xCAT-server - #rm -f /opt/freeware/src/packages/SRPMS/xCAT-server-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER*rpm - #rpm -ba xCAT-server.spec - #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER*rpm + #tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/xCAT-server-$VER.tar xCAT-server + #gzip -f /opt/freeware/src/packages/SOURCES/xCAT-server-$VER.tar + #cd ./xCAT-server + #rm -f /opt/freeware/src/packages/SRPMS/xCAT-server-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER*rpm + #rpm -ba xCAT-server.spec + #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER*rpm - source=/opt/freeware/src/packages + source=/opt/freeware/src/packages echo '.svn' > /tmp/xcat-excludes - tar -X /tmp/xcat-excludes -cf $source/SOURCES/xCAT-server-$VER.tar xCAT-server - gzip -f $source/SOURCES/xCAT-server-$VER.tar - rm -f $source/SRPMS/xCAT-server-$VER*rpm $source/RPMS/ppc/xCAT-server-$VER*rpm - rpm -ba xCAT-server/xCAT-server.spec - #rpm -ta $source/SOURCES/xCAT-server-$VER.tar.gz + tar -X /tmp/xcat-excludes -cf $source/SOURCES/xCAT-server-$VER.tar xCAT-server + gzip -f $source/SOURCES/xCAT-server-$VER.tar + rm -f $source/SRPMS/xCAT-server-$VER*rpm $source/RPMS/ppc/xCAT-server-$VER*rpm + rpm -ba xCAT-server/xCAT-server.spec + #rpm -ta $source/SOURCES/xCAT-server-$VER.tar.gz else - if [ -f /etc/redhat-release ] + rpmbuild --version > /dev/null + if [ $? -gt 0 ] then - pkg="redhat" - else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi + RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` + if [ $? -gt 0 ] + then + echo "Could not determine rpmbuild's root" + exit 1 + fi + echo "The location for rpm building is ${RPMROOT}" + + tar --exclude .svn -czf $RPMROOT/SOURCES/xCAT-server-$VER.tar.gz xCAT-server + rm -f $RPMROOT/SRPMS/xCAT-server-$VER*rpm $RPMROOT/RPMS/noarch/xCAT-server-$VER*rpm + rpmbuild -ta $RPMROOT/SOURCES/xCAT-server-$VER.tar.gz + #rpm -Uvh $RPMROOT/RPMS/noarch/xCAT-server-$VER*rpm - tar --exclude .svn -czf /usr/src/$pkg/SOURCES/xCAT-server-$VER.tar.gz xCAT-server - rm -f /usr/src/$pkg/SRPMS/xCAT-server-$VER*rpm /usr/src/$pkg/RPMS/noarch/xCAT-server-$VER*rpm - rpmbuild -ta /usr/src/$pkg/SOURCES/xCAT-server-$VER.tar.gz - #rpm -Uvh /usr/src/$pkg/RPMS/noarch/xCAT-server-$VER*rpm fi diff --git a/makexcatrpm b/makexcatrpm index 2692a06c8..8220fa2fd 100755 --- a/makexcatrpm +++ b/makexcatrpm @@ -6,45 +6,53 @@ VER=`cat Version` if [ "$OSNAME" = "AIX" ] then - cd `dirname $0`/xCAT - echo '.svn' > /tmp/xcat-excludes - echo 'upflag' >> /tmp/xcat-excludes + cd `dirname $0`/xCAT + echo '.svn' > /tmp/xcat-excludes + echo 'upflag' >> /tmp/xcat-excludes - tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/postscripts.tar postscripts LICENSE.html - gzip -f /opt/freeware/src/packages/SOURCES/postscripts.tar + tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/postscripts.tar postscripts LICENSE.html + gzip -f /opt/freeware/src/packages/SOURCES/postscripts.tar - tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/templates.tar templates - gzip -f /opt/freeware/src/packages/SOURCES/templates.tar + tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/templates.tar templates + gzip -f /opt/freeware/src/packages/SOURCES/templates.tar - cp xcat.conf /opt/freeware/src/packages/SOURCES - cp xCATMN /opt/freeware/src/packages/SOURCES + cp xcat.conf /opt/freeware/src/packages/SOURCES + cp xCATMN /opt/freeware/src/packages/SOURCES - rm -f /opt/freeware/src/packages/SRPMS/xCAT-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER*rpm - cd - + rm -f /opt/freeware/src/packages/SRPMS/xCAT-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER*rpm + cd - - rpm -ba xCAT/xCAT.spec - #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER*rpm + rpm -ba xCAT/xCAT.spec + #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER*rpm else - if [ -f /etc/redhat-release ] + rpmbuild --version > /dev/null + if [ $? -gt 0 ] then - pkg="redhat" - else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi + RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` + if [ $? -gt 0 ] + then + echo "Could not determine rpmbuild's root" + exit 1 + fi + echo "The location for rpm building is ${RPMROOT}" cd `dirname $0`/xCAT - tar --exclude .svn -czf /usr/src/$pkg/SOURCES/postscripts.tar.gz postscripts LICENSE.html - tar --exclude .svn -czf /usr/src/$pkg/SOURCES/prescripts.tar.gz prescripts - tar --exclude .svn -czf /usr/src/$pkg/SOURCES/templates.tar.gz templates - cp xcat.conf /usr/src/$pkg/SOURCES - cp xCATMN /usr/src/$pkg/SOURCES + tar --exclude .svn -czf $RPMROOT/SOURCES/postscripts.tar.gz postscripts LICENSE.html + tar --exclude .svn -czf $RPMROOT/SOURCES/prescripts.tar.gz prescripts + tar --exclude .svn -czf $RPMROOT/SOURCES/templates.tar.gz templates + cp xcat.conf $RPMROOT/SOURCES + cp xCATMN $RPMROOT/SOURCES cd - - rm -f /usr/src/$pkg/SRPMS/xCAT-$VER*rpm /usr/src/$pkg/RPMS/*/xCAT-$VER*rpm - if [ ! -z "$1" ]; then - rpmbuild -ba xCAT/xCAT.spec --target $1 - else - rpmbuild -ba xCAT/xCAT.spec - fi + rm -f $RPMROOT/SRPMS/xCAT-$VER*rpm $RPMROOT/RPMS/*/xCAT-$VER*rpm + if [ ! -z "$1" ]; then + rpmbuild -ba xCAT/xCAT.spec --target $1 + else + rpmbuild -ba xCAT/xCAT.spec + fi + fi diff --git a/makexcatsnrpm b/makexcatsnrpm index c75886d53..50341f04f 100755 --- a/makexcatsnrpm +++ b/makexcatsnrpm @@ -5,41 +5,50 @@ VER=`cat Version` if [ "$OSNAME" = "AIX" ] then - cd `dirname $0`/xCATsn - echo '.svn' > /tmp/xcat-excludes + + cd `dirname $0`/xCATsn + echo '.svn' > /tmp/xcat-excludes echo 'upflag' >> /tmp/xcat-excludes - tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/license.tar LICENSE.html - gzip -f /opt/freeware/src/packages/SOURCES/license.tar + tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/license.tar LICENSE.html + gzip -f /opt/freeware/src/packages/SOURCES/license.tar -# cp xcat.conf /opt/freeware/src/packages/SOURCES -# cp xCATSN /usr/src/$pkg/SOURCES + #cp xcat.conf /opt/freeware/src/packages/SOURCES + #cp xCATSN /usr/src/$pkg/SOURCES cp xCATSN /opt/freeware/src/packages/SOURCES - rm -f /opt/freeware/src/packages/SRPMS/xCATsn-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER*rpm - cd - + rm -f /opt/freeware/src/packages/SRPMS/xCATsn-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER*rpm + cd - - rpm -ba xCATsn/xCATsn.spec - #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER*rpm + rpm -ba xCATsn/xCATsn.spec + #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER*rpm else - if [ -f /etc/redhat-release ] + rpmbuild --version > /dev/null + if [ $? -gt 0 ] then - pkg="redhat" - else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi + RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` + if [ $? -gt 0 ] + then + echo "Could not determine rpmbuild's root" + exit 1 + fi + echo "The location for rpm building is ${RPMROOT}" cd `dirname $0`/xCATsn - tar --exclude .svn -czf /usr/src/$pkg/SOURCES/license.tar.gz LICENSE.html - cp xcat.conf /usr/src/$pkg/SOURCES - cp xCATSN /usr/src/$pkg/SOURCES - rm -f /usr/src/$pkg/SRPMS/xCATsn-$VER*rpm /usr/src/$pkg/RPMS/*/xCATsn-$VER*rpm + tar --exclude .svn -czf $RPMROOT/SOURCES/license.tar.gz LICENSE.html + cp xcat.conf $RPMROOT/SOURCES + cp xCATSN $RPMROOT/SOURCES + rm -f $RPMROOT/SRPMS/xCATsn-$VER*rpm $RPMROOT/RPMS/*/xCATsn-$VER*rpm cd - - if [ ! -z "$1" ]; then - rpmbuild -ba xCATsn/xCATsn.spec --target $1 - else - rpmbuild -ba xCATsn/xCATsn.spec - fi + if [ ! -z "$1" ]; then + rpmbuild -ba xCATsn/xCATsn.spec --target $1 + else + rpmbuild -ba xCATsn/xCATsn.spec + fi + fi diff --git a/perl-xCAT/db2man b/perl-xCAT/db2man index 1c665e1ec..e1d9049bd 100755 --- a/perl-xCAT/db2man +++ b/perl-xCAT/db2man @@ -20,6 +20,8 @@ my $poddir = 'pods'; my $mandir = 'share/man'; my $htmldir = 'share/doc'; my $cachedir = '/tmp'; +my $isaix = ($^O =~ /^aix/i); +my $skiponaix = 'route|group'; my $poddir5 = 'pods/man5'; my $poddir7 = 'pods/man7'; @@ -30,7 +32,7 @@ if (system("mkdir -p $poddir7")) { die "Error: could not create $poddir7.\n"; } print "Building PODs pages for the database tables...\n"; writesummarypage("$poddir5/xcatdb.5.pod", xCAT::Table->getDescriptions(), \%{xCAT::Schema::defspec}); -# Build the pad man page for each object definition +# Build the pod man page for each object definition my $defspecref = \%{xCAT::Schema::defspec}; foreach my $defkey (keys %$defspecref) { my $def = $defspecref->{$defkey}; @@ -55,6 +57,7 @@ my @pods = getPodList($poddir); #mkdir($mandir) or die "Error: could not create $mandir.\n"; print "Converting PODs to man pages...\n"; foreach my $podfile (@pods) { + if ($isaix && grep(/\/($skiponaix)\.\d\.pod$/, $podfile)) { print "Skipping $podfile\n"; next; } my $manfile = $podfile; $manfile =~ s/^$poddir/$mandir/; # change the beginning of the path $manfile =~ s/\.pod$//; # change the ending diff --git a/perl-xCAT/debian/changelog b/perl-xCAT/debian/changelog index 57876297f..62b6c3c4d 100644 --- a/perl-xCAT/debian/changelog +++ b/perl-xCAT/debian/changelog @@ -1,12 +1,11 @@ -perl-xcat (2.0-2) testing; urgency=low +perl-xcat (2.5.0-2) stable; urgency=low - * post-release snap + * Initial Debian build - -- Isaac Freeman Mon, 16 Jun 2008 15:35:15 -0400 + -- Mark Hamzy Fri, 29 Apr 2011 14:40:34 -0500 -perl-xcat (2.0-1) lenny; urgency=low +perl-xcat (2.5.0-1) stable; urgency=low - * Initial release - - -- Isaac Freeman Thu, 08 May 2008 13:14:33 -0400 + * Initial Release + -- OCF xCAT Mon, 25 oct 2010 09:00:00 -0000 diff --git a/perl-xCAT/debian/control b/perl-xCAT/debian/control index 76fecfb69..d7ed0679c 100644 --- a/perl-xCAT/debian/control +++ b/perl-xCAT/debian/control @@ -1,13 +1,13 @@ Source: perl-xcat Section: libs Priority: extra -Maintainer: Isaac Freeman -Build-Depends: debhelper (>= 5), libdbi-perl +Maintainer: Arif Ali +Build-Depends: debhelper (>= 5), libsoap-lite-perl Standards-Version: 3.7.2 Package: perl-xcat -Architecture: any -Depends: ${perl:Depends}, libio-socket-ssl-perl, libxml-simple-perl, libstorable-perl, libsys-syslog-perl, libsnmp-perl, libdbi-perl +Architecture: all +Depends: ${perl:Depends} Description: xCAT perl libraries Provides perl xCAT libraries for core functionality. Required for all xCAT installations. Includes xCAT::Table, xCAT::NodeRange, among others. diff --git a/perl-xCAT/debian/dirs b/perl-xCAT/debian/dirs index 466d92d42..4e50e497f 100644 --- a/perl-xCAT/debian/dirs +++ b/perl-xCAT/debian/dirs @@ -1,2 +1,7 @@ -usr/lib/perl5/xCAT -usr/lib/perl5/xCAT/data +opt/xcat/lib/perl/xCAT +opt/xcat/lib/perl/xCAT/data +opt/xcat/share/doc/packages/perl-xCAT +opt/xcat/share/man/man5 +opt/xcat/share/doc/man5 +opt/xcat/share/man/man7 +opt/xcat/share/doc/man7 diff --git a/perl-xCAT/debian/rules b/perl-xCAT/debian/rules index 269bed876..6101f8b63 100755 --- a/perl-xCAT/debian/rules +++ b/perl-xCAT/debian/rules @@ -14,6 +14,7 @@ export DH_COMPAT=5 build: dh_testdir + ./modifyUtils 2.5.0 ./db2man clean: diff --git a/perl-xCAT/modifyUtils b/perl-xCAT/modifyUtils index f750d8e0e..8fbd74fb5 100755 --- a/perl-xCAT/modifyUtils +++ b/perl-xCAT/modifyUtils @@ -1,9 +1,9 @@ #!/bin/sh -# Put the version, svn revision #, and build date into the Version function in Utils.pm +# Put the version, svn revision #, and build date into the Version function in Version.pm if [ -z "$1" ] then - echo "modifyUtils: Error: must specify the xCAT version as an argument!" + echo "modifyVersion: Error: must specify the xCAT version as an argument!" exit fi VER=$1 @@ -24,8 +24,8 @@ BUILDDATE=`date` if [ "$(uname)" = "AIX" ] then - sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}built $BUILDDATE)'"/ xCAT/Utils.pm >xCAT/Utils.pm.new - mv xCAT/Utils.pm.new xCAT/Utils.pm + sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}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/Utils.pm + sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}built $BUILDDATE)'"/ xCAT/Version.pm fi diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 5c8117852..b50920ae2 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -20,6 +20,7 @@ use strict; # IPv6 not yet implemented - need Socket6 use Socket; +my @tabletype = qw(ppc zvm); #---------------------------------------------------------------------------- @@ -2106,8 +2107,10 @@ sub getchildren my $p = $entry->{parent}; my $c = $entry->{node}; if ( $p and $c) { - my $type = $ppctab->getNodeAttribs($c, ["nodetype"]); - if ( $type and ($type->{nodetype} eq 'fsp') or ($type->{nodetype} eq 'bpa')) + #my $type = $ppctab->getNodeAttribs($c, ["nodetype"]); + my $type = getnodetype($c); + #if ( $type and ($type->{nodetype} eq 'fsp') or ($type->{nodetype} eq 'bpa')) + if ( $type eq 'fsp' or $type eq 'bpa') { push @{$::PARENT_CHILDREN{$p}}, $c; } @@ -2176,65 +2179,94 @@ sub getnodetype { $nodes = shift; } + my $rsp; - my $ppctab = xCAT::Table->new( 'ppc' ); - if ( !$ppctab ) { - my $rsp; - $rsp->{data}->[0] = "Could not open the ppc table."; - xCAT::MsgUtils->message("E", $rsp, $::callback); - } my $nodetypetab = xCAT::Table->new( 'nodetype' ); if ( !$nodetypetab ) { - my $rsp; $rsp->{data}->[0] = "Could not open the nodetype table."; xCAT::MsgUtils->message("E", $rsp, $::callback); - if ( !$ppctab ) { - return undef; - } + } my @types = (); my $typep; my $type; + my %typehash; if ( $nodes =~ /^ARRAY/) { - foreach ( @$nodes ) { - if ( $ppctab ) { - $typep = $ppctab->getNodeAttribs($_, ["nodetype"]); - if ($typep and $typep->{nodetype}) { - $type = $typep->{nodetype}; - push (@types, $type); - next; + my @nodetypes = $nodetypetab->getAllAttribs('node','nodetype'); + for my $tn( @nodetypes ) { + $typehash{ $tn->{'node'} } = $tn->{'nodetype'}; + } + for my $nn (@$nodes) { + $type = $typehash{$nn}; + if ($type) { + my $flag = 0; + my @tablename; + for my $tt ( split /,/, $type ) { + if ( grep(/$tt/, @tabletype)) { + @tablename = grep(/$tt/, @tabletype); + $flag = 1; + next; + } } - } - if ( $nodetypetab ) { - $typep = $nodetypetab->getNodeAttribs($_, ["nodetype"]); - if ($typep and $typep->{nodetype}) { - $type = $typep->{nodetype}; + unless ($flag) { # find type in nodetype table push (@types, $type); + } else { + my $tablehandler = xCAT::Table->new( $tablename[0] ); + if ( !$tablehandler ) { + $rsp->{data}->[0] = "Could not open the $tablename[0] table."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + push (@types, undef); next; - } - } - push (@types, undef); + } + $typep = $tablehandler->getNodeAttribs($nn, ["nodetype"]); # find type in ppc table + if ($typep and $typep->{nodetype}) { + $type = $typep->{nodetype}; + push (@types, $type); + } else { + push (@types, undef); + } + } + } else { + push (@types, undef); + } } return \@types; } else { - if ( $ppctab ) { - $typep = $ppctab->getNodeAttribs($nodes, ["nodetype"]); - if ( $typep and $typep->{nodetype} ) { - $type = $typep->{nodetype}; - return $type; + $typep = $nodetypetab->getNodeAttribs($nodes, ["nodetype"]); + if ( $typep and $typep->{nodetype} ) { + $type = $typep->{nodetype}; + my $flag = 0; + my @tablename; + for my $tt ( split /,/, $type ) { + if ( grep(/$tt/, @tabletype)) { + @tablename = grep(/$tt/, @tabletype); + $flag = 1; + next; + } } - } - if ( $nodetypetab ) { - $typep = $nodetypetab->getNodeAttribs($nodes, ["nodetype"]); - if ( $typep and $typep->{nodetype} ) { - $type = $typep->{nodetype}; + unless ($flag) { # find type in nodetype table return $type; + } else { # find type in ppc table + my $tablehandler = xCAT::Table->new( $tablename[0] ); + if ( !$tablehandler ) { + $rsp->{data}->[0] = "Could not open the $tablename[0] table."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + return undef; + } + $typep = $tablehandler->getNodeAttribs($nodes, ["nodetype"]); + if ( $typep and $typep->{nodetype} ) { + $type = $typep->{nodetype}; + return $type; + } else { + return undef; + } } - } + } else { + return undef; + } } - return undef; } #------------------------------------------------------------------------------- @@ -2272,8 +2304,9 @@ sub getcecchildren my $p = $entry->{parent}; my $c = $entry->{node}; if ( $p and $c) { - my $type = $ppctab->getNodeAttribs($c, ["nodetype"]); - if ( $type and ($type->{nodetype} eq 'cec')) { + #my $type = $ppctab->getNodeAttribs($c, ["nodetype"]); + my $type = getnodetype($c); + if ( $type eq 'cec') { push @{$::PARENT_CHILDREN_CEC{$p}}, $c; } } diff --git a/perl-xCAT/xCAT/ExtTab.pm b/perl-xCAT/xCAT/ExtTab.pm index 259d5f1b3..d24ef3059 100644 --- a/perl-xCAT/xCAT/ExtTab.pm +++ b/perl-xCAT/xCAT/ExtTab.pm @@ -30,7 +30,7 @@ foreach (@extSchema) { my $modname = $1; no strict 'refs'; my $warning; - `logger -t xCAT processing $_`; + # `logger -t xCAT processing $_`; eval {require($_)}; if ($@) { $warning ="Warning: The user defined database table schema file $file cannot be located or has compiling errors.\n"; diff --git a/perl-xCAT/xCAT/FSPUtils.pm b/perl-xCAT/xCAT/FSPUtils.pm index 9fd0ac870..afc47c99a 100644 --- a/perl-xCAT/xCAT/FSPUtils.pm +++ b/perl-xCAT/xCAT/FSPUtils.pm @@ -80,7 +80,6 @@ sub fsp_api_action { if( !defined($tooltype) ) { $tooltype = 0; } - $id = $$attrs[0]; $fsp_name = $$attrs[3]; @@ -149,9 +148,15 @@ sub fsp_api_action { $cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name: -d $install_dir/packages_fw/"; } elsif($action =~ /^add_connection$/) { $cmd = "$fsp_api -a $action -u $user -p $password -T $tooltype -t $type:$fsp_ip:$id:$node_name:"; + } elsif ($action =~ /^set_frame_number$/) { + $cmd = "$fsp_api -a $action -T $tooltype -f $parameter -t $type:$fsp_ip:$id:$node_name:"; } else { if( defined($parameter) ) { - $cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:$parameter"; + if ($action =~ /^set_(frame|cec|lpar)_name$/) { + $cmd = "$fsp_api -a $action -n $parameter -T $tooltype -t $type:$fsp_ip:$id:$node_name:"; + } else { + $cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:$parameter"; + } } else { $cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:"; } diff --git a/perl-xCAT/xCAT/FSPboot.pm b/perl-xCAT/xCAT/FSPboot.pm index 977268805..190a1d4db 100644 --- a/perl-xCAT/xCAT/FSPboot.pm +++ b/perl-xCAT/xCAT/FSPboot.pm @@ -97,10 +97,11 @@ sub do_rnetboot { } } + my $mac = lc($opt->{m}); ####################################### # Network specified ####################################### - $cmd.= " -s auto -d auto -m $opt->{m} -S $opt->{S} -G $opt->{G} -C $opt->{C}"; + $cmd.= " -s auto -d auto -m \"$mac\" -S $opt->{S} -G $opt->{G} -C $opt->{C}"; if ( exists( $opt->{o} )) { $cmd.= " -o"; } diff --git a/perl-xCAT/xCAT/FSPcfg.pm b/perl-xCAT/xCAT/FSPcfg.pm index 109f24ea6..067b10fd8 100644 --- a/perl-xCAT/xCAT/FSPcfg.pm +++ b/perl-xCAT/xCAT/FSPcfg.pm @@ -4,6 +4,8 @@ package xCAT::FSPcfg; use strict; use Getopt::Long; use xCAT::Usage; +use xCAT::Utils; +use xCAT::PPCcfg; #use Data::Dumper; #use xCAT::PPCcli; @@ -11,8 +13,16 @@ use xCAT::Usage; ########################################## # Globals ########################################## +my %rspconfig = ( + frame => \&frame, + cec_off_policy => \&cec_off_policy, +); - +my %default_passwd = ( + HMC => "", + admin => "admin", + general => "general", +); ########################################################################## # Parse the command line for options and operands @@ -28,25 +38,36 @@ sub parse_args { "HMC_passwd", "admin_passwd", "general_passwd", - "*_passwd" + "*_passwd", + "resetnet", ); my @bpa = ( + "frame", "HMC_passwd", "admin_passwd", "general_passwd", - "*_passwd" + "*_passwd", + "resetnet" ); my @cec = ( "HMC_passwd", "admin_passwd", "general_passwd", - "*_passwd" + "*_passwd", + "cec_off_policy", + "resetnet", + "sysname", + "pending_power_on_side" ); my @frame = ( + "frame", "HMC_passwd", "admin_passwd", "general_passwd", - "*_passwd" + "*_passwd", + "resetnet", + "sysname", + "pending_power_on_side" ); @@ -59,18 +80,24 @@ sub parse_args { ############################################# # Get support command list ############################################# - my $sitetab = xCAT::Table->new( 'nodetype' ); + #my $typetab = xCAT::Table->new( 'nodetype' ); + #my $nodes = $request->{node}; + #foreach (@$nodes) { + # if ( defined( $typetab )) { + # my ($ent) = $typetab->getAttribs({ node=>$_},'nodetype'); + # if ( defined($ent) ) { + # $request->{hwtype} = $ent->{nodetype}; + # last; + # } + # + # } + # + #} + my $nodes = $request->{node}; - foreach (@$nodes) { - if ( defined( $sitetab )) { - my ($ent) = $sitetab->getAttribs({ node=>$_},'nodetype'); - if ( defined($ent) ) { - $request->{hwtype} = $ent->{nodetype}; - last; - } - - } - + foreach my $nn (@$nodes) { + $request->{hwtype} = xCAT::DBobjUtils->getnodetype($nn); + last if ($request->{hwtype}); } my $supported = $rsp{$request->{hwtype}}; @@ -98,7 +125,7 @@ sub parse_args { Getopt::Long::Configure( "bundling" ); $request->{method} = undef; - if ( !GetOptions( \%opt, qw(V|Verbose) )) { + if ( !GetOptions( \%opt, qw(V|Verbose resetnet))) { return( usage() ); } #################################### @@ -118,8 +145,17 @@ sub parse_args { #################################### foreach my $arg ( @ARGV ) { my ($command,$value) = split( /=/, $arg ); - if ( !grep( /^$command$/, @$supported )) { - return(usage( "Invalid command: $arg" )); + if ( !grep( /^$command$/, @$supported) and !$opt{resetnet}) { + my @enableASMI = xCAT::Utils->get_site_attribute("enableASMI"); + if (defined($enableASMI[0])) { + $enableASMI[0] =~ tr/a-z/A-Z/; # convert to upper + if (($enableASMI[0] eq "1") || ($enableASMI[0] eq "YES")) + { + $request->{enableASMI} = 1; + return xCAT::PPCcfg::parse_args($request, @_); + } + } + return(usage( "Invalid command for $request->{hwtype} : $arg" )); } if ( exists( $cmds{$command} )) { return(usage( "Command multiple times: $command" )); @@ -148,12 +184,25 @@ sub parse_args { #################################### # Return method to invoke #################################### - #if ( exists($cmds{frame}) ) { - # $request->{hcp} = "hmc"; - # $request->{method} = "cfg"; - # return( \%opt ); - #} -# + if ( exists($cmds{frame}) or exists($cmds{cec_off_policy})) { + $request->{hcp} = (exists($cmds{frame})) ? "bpa" : "fsp"; + $request->{method} = "cfg"; + return( \%opt ); + } + + #################################### + # Return method to invoke + #################################### + if ( $opt{resetnet} ) { + $request->{hcp} = "fsp"; + $request->{method} = "resetnet"; + return( \%opt ); + } + if(exists($cmds{sysname}) or exists($cmds{pending_power_on_side})) { + $request->{hcp} = $request->{hwtype} eq 'frame' ? "bpa":"fsp"; + $request->{method} = "do_fspapi_function"; + return (\%opt); + } #################################### # Return method to invoke #################################### @@ -181,22 +230,200 @@ sub parse_option { #################################### # Password #################################### - if ( $command eq 'admin_passwd' or $command eq 'general_passwd' or $command eq "*_passwd"){ + #if ( $command eq 'admin_passwd' or $command eq 'general_passwd' or $command eq "*_passwd"){ + # my ($passwd,$newpasswd) = split /,/, $value; + # if ( !$passwd or !$newpasswd) { + # return( "Current password and new password couldn't be empty for user 'admin' and 'general'" ); + # } + #} + + if ( $command eq 'HMC_passwd' or $command eq 'admin_passwd' or $command eq 'general_passwd' or $command eq "*_passwd" ) { my ($passwd,$newpasswd) = split /,/, $value; - if ( !$passwd or !$newpasswd) { - return( "Current password and new password couldn't be empty for user 'admin' and 'general'" ); + if ( !$newpasswd ) { + return( "New password couldn't be empty for user 'HMC', 'admin' or 'general'" ); } } - if ( $command eq 'HMC_passwd' ) { - my ($passwd,$newpasswd) = split /,/, $value; - if ( !$newpasswd ) { - return( "New password couldn't be empty for user 'HMC'" ); + if ( $command eq 'frame' ){ + if ( $value !~ /^\d+$/i && $value ne '*' ) { + return( "Invalid frame number '$value'" ); + } + } + + if ( $command eq 'cec_off_policy' ){ + if ( $value !~ /^poweroff$/i && $value !~ /^stayon$/i ) { + return( "Invalid cec_off_policy '$value'" ); + } + } + if ($command eq 'sysname') { + if ($value ne '*') { + if ($value !~ /^[a-zA-Z0-9-_]+$/) { + return( "Invalid sysname param '$value'" ); + } elsif (scalar(@{$request->{node}}) gt '1') { + return( "Invalid sysname param '$value'" ); + } + my $len = rindex $value."\$", "\$"; + if ($len > '31') { + return ("Invalid sysname param '$value', name is too long, max 31 characters"); + } + } + } + if ($command eq 'pending_power_on_side') { + if ($value !~ /^(temp|perm)$/) { + return ("Invalid pending_power_on_side param '$value'"); } } return undef; } +sub check_node_info { + my $hash = shift; + my $invalid_node = undef; + while (my ($mtsm, $h) = each (%$hash)) { + while (my ($name, $d) = each(%$h)) { + if (@$d[4] !~ /^(cec|frame)$/) { + $invalid_node = $name; + last; + } + } + } + return $invalid_node; +} +my %fspapi_action = ( + sysname => { + query => { + cec => "get_cec_name", + frame => "get_frame_name" + }, + set => { + cec => "set_cec_name", + frame => "set_frame_name" + } + }, + pending_power_on_side => { + query => { + cec => "list_firmware_level", + frame => "list_firmware_level" + }, + set => { + cec => "set_ipl_param", + frame => "set_ipl_param" + } + } +); +sub do_process_query_res { + my $name = shift; + my $cmd = shift; + my $result = shift; + my $res = shift; + if ($cmd =~ /^sysname$/) { + push @$result, $res; + if (@$res[2] != 0) { + return "Error"; + } + } elsif($cmd =~ /^pending_power_on_side$/) { + if (@$res[2] != 0) { + push @$result, $res; + return "Error"; + } else { + my @values = split(/\n/, @$res[1]); + foreach my $v (@values) { + if ($v =~ /pend_power_on_side_(\w+)=(temp|perm),/) { + push @$result, [$name, "Pending Power On Side \L\u$1: $2", '0']; + } else { + push @$result, [$name, $v, '1']; + return "Error"; + } + } + } + } + return undef; +} +sub do_query { + my $request = shift; + my $hash = shift; + my $cmd = shift; + my @result = (); + while (my ($mtms, $h) = each(%$hash)) { + while (my($name, $d) = each(%$h)) { + my $action = $fspapi_action{$cmd}{query}{@$d[4]}; + my $values = xCAT::FSPUtils::fsp_api_action($name, $d, $action); + my $res = &do_process_query_res($name, $cmd, \@result, $values); + if (defined($res)) { + last; + } + } + } + return (\@result); +} +sub do_set_get_para { + my $node_name = shift; + my $cmd = shift; + my $value = shift; + if ($cmd =~ /^sysname$/) { + return (($value eq '*') ? $node_name : $value); + } elsif ($cmd =~ /^pending_power_on_side$/){ + return ($value =~ /^perm$/) ? '0' : '1'; + } +} + +sub do_process_set_res { + my $name = shift; + my $cmd = shift; + my $result = shift; + my $res = shift; + if (@$res[1] && @$res[1] !~ /success/i) { + push @$result, $res; + return "Error"; + } else { + push @$result, [$name, "Success", 0]; + } +} +sub do_set { + my $request = shift; + my $hash = shift; + my $cmd = shift; + my $value = shift; + my @result = (); + while (my ($mtms, $h) = each(%$hash)) { + while (my($name, $d) = each(%$h)) { + my $action = $fspapi_action{$cmd}{set}{@$d[4]}; + my $para = &do_set_get_para($name, $cmd, $value); + my $values = xCAT::FSPUtils::fsp_api_action($name, $d, $action, 0, $para); +# print Dumper($values); + my $res = &do_process_set_res($name, $cmd, \@result, $values); + if (defined($res)) { + last; + } + } + } + return (\@result); +} +sub do_fspapi_function { + my $request = shift; + my $hash = shift; + my $exp = shift; + my @ret = (); + my $res; + my $args = $request->{arg}; + my $invalid_node = &check_node_info($hash); + if (defined($invalid_node)) { + return ([[$invalid_node, "Node must be CEC or Frame", '1']]); + } + foreach my $arg (@$args) { + my ($cmd, $value) = split /=/, $arg; + if ($cmd !~ /^(sysname|pending_power_on_side)$/) { + return ([["Error", "'$cmd' can not execute with 'sysname' or 'pending_power_on_side'", '1']]); + } + if ($value) { + $res = &do_set($request, $hash, $cmd, $value) + } else { + $res = &do_query($request, $hash, $cmd); + } + push @ret, @$res; + } + return \@ret; +} ########################################################################## # Update passwords for different users on FSP/BPA ########################################################################## @@ -209,13 +436,21 @@ sub passwd { my $user = (); my $users = (); my @output = (); + my $default; foreach my $arg ( @$args ) { my ($user,$value) = split /=/, $arg; + if ($user !~ /_passwd$/) { + return ([["Error", "'$user' can not execute with '*_passwd' commands", '1']]); + } my ($passwd,$newpasswd) = split /,/, $value; $user =~ s/_passwd$//; #$user =~ s/^HMC$/access/g; - + + if( !$passwd) { + $default = 1; + } + if ( $user eq "*" ) { push @$users, "HMC"; push @$users, "admin"; @@ -225,7 +460,10 @@ sub passwd { } foreach my $usr ( @$users ) { - + if( $default == 1 ) { + $passwd = $default_passwd{$usr}; + } + while ( my ($cec,$h) = each(%$hash) ) { while ( my ($node,$d) = each(%$h) ) { my $type = @$d[4]; @@ -252,6 +490,215 @@ sub passwd { return( \@output ); } +########################################################################## +# Handles all PPC rspconfig commands +########################################################################## +sub cfg { + + my $request = shift; + my $hash = shift; + my $exp = shift; + my $args = $request->{arg}; + my $result; + + foreach ( @$args ) { + ################################## + # Ignore switches in command-line + ################################## + unless ( /^-/ ) { + my ($cmd,$value) = split /=/; + if ($cmd !~ /(frame|cec_off_policy)/) { + return ([["Error", "'$cmd' can not execute with 'frame' or 'cec_off_policy'", '1']]); + } + + no strict 'refs'; + $result = $rspconfig{$cmd}( $request, $value, $hash ); + use strict; + } + } + return( $result ); +} + +sub frame { + my $request = shift; + my $value = shift; + my $hash = shift; + my $arg = $request->{arg}; + + foreach ( @$arg ) { + my $result; + my $Rc; + my $data; + + my ($cmd, $value) = split /=/, $_; + if ( $cmd ne "frame" ) { + return( [["Error","Multiple option $cmd and frame is not accepted", -1]] ); + } + + ################################# + # Open xCAT database to sync with + # the frame number between hcp + # and database + ################################# + my $tab = xCAT::Table->new( "ppc" ); + + while ( my ($cec,$h) = each(%$hash) ) { + while ( my ($node,$d) = each(%$h) ) { + if ( !defined($value) ) { + + ################################# + # Get frame number + ################################# + #$data = xCAT::PPCcli::lssyscfg( $exp, @$d[4], @$d[2], 'frame_num' ); + $data = xCAT::FSPUtils::fsp_api_action( $node, $d, "get_frame_number"); + $Rc = pop(@$data); + + ################################# + # Return error + ################################# + if ( $Rc != 0 ) { + return( [[$node,@$data[1],$Rc]] ); + } + + push @$result, [$node,@$data[1], 0]; + + ################################# + # Set frame number to database + ################################# + $tab->setNodeAttribs( $node, { id=>@$data[1] } ); + + } elsif ( $value eq '*' ) { + ################################# + # Set frame number + # Read the settings from database + ################################# + my $ent=$tab->getNodeAttribs( $node,['id'] ); + + ################################# + # Return error + ################################# + if ( !defined($ent) or !defined($ent->{id}) ) { + return( [[$node,"Cannot find frame num in database", -1]] ); + } + #$data = xCAT::PPCcli::chsyscfg( $exp, "bpa", $d, "frame_num=".$ent->{id} ); + $data = xCAT::FSPUtils::fsp_api_action( $node, $d, "set_frame_number", 0, $ent->{id}); + $Rc = pop(@$data); + + ################################# + # Return error + ################################# + if ( $Rc != 0 ) { + return( [[$node,@$data[1],$Rc]] ); + } + + push @$result, [$node,@$data[1], 0]; + push @$result, [$node,"It will take several minutes to complete. So please wait for several minutes, then the other operations could be done. Otherwise, the other operation will fail.", 0]; + + } else { + ################################# + # Set frame number + # Read the frame number from opt + ################################# + #$data = xCAT::PPCcli::chsyscfg( $exp, "bpa", $d, "frame_num=$value" ); + $data = xCAT::FSPUtils::fsp_api_action( $node, $d, "set_frame_number", 0, $value); + $Rc = pop(@$data); + + ################################# + # Return error + ################################# + if ( $Rc != 0 ) { + return( [[$node,@$data[1],$Rc]] ); + } + + push @$result, [$node,@$data[1],0]; + push @$result, [$node,"It will take several minutes to complete. So please wait for several minutes, then the other operations could be done. Otherwise, the other operation will fail.", 0]; + + ################################# + # Set frame number to database + ################################# + $tab->setNodeAttribs( $node, { id=>$value } ); + } + } + + return( [@$result] ); + } + } +} + +sub cec_off_policy { + my $request = shift; + my $value = shift; + my $hash = shift; + my $arg = $request->{arg}; + + foreach ( @$arg ) { + my $result; + my $Rc; + my $data; + + my ($cmd, $value) = split /=/, $_; + if ( $cmd ne "cec_off_policy" ) { + return( [["Error","Multiple option $cmd and cec is not accepted", -1]] ); + } + + while ( my ($cec,$h) = each(%$hash) ) { + while ( my ($node,$d) = each(%$h) ) { + if ( !defined($value) ) { + + ################################# + # Get platform IPL parameters + ################################# + $data = xCAT::FSPUtils::fsp_api_action( $node, $d, "get_phyp_cfg_power_off_policy"); + $Rc = pop(@$data); + + ################################# + # Return error + ################################# + if ( $Rc != 0 ) { + return( [[$node,@$data[1],$Rc]] ); + } + + @$data[1] =~ /cec_off_policy=(\w*);/; + + push @$result, [$node, $1, 0]; + + + } else { + ################################# + # Set cec off policy + ################################# + if( $value eq "poweroff") { + $value = "cec_off_policy_poweroff"; + } else { + $value = "cec_off_policy_stayon"; + } + $data = xCAT::FSPUtils::fsp_api_action( $node, $d, $value); + $Rc = pop(@$data); + + ################################# + # Return error + ################################# + if ( $Rc != 0 ) { + return( [[$node,@$data[1],$Rc]] ); + } + + push @$result, [$node,"Success",0]; + + } + } + + return( [@$result] ); + } + } +} + + + + + + + + ########################################################################## # Invoke fsp_api to change the passwords and store updated passwd in db @@ -278,7 +725,7 @@ sub fsp_api_passwd { ############################ # Set type for FSP or BPA ############################ - if($$attrs[4] =~ /^fsp$/ || $$attrs[4] =~ /^lpar$/ || $$attrs[4] =~ /^cec$/) { + if($$attrs[4] =~ /^fsp$/ || $$attrs[4] =~ /^lpar$/ || $$attrs[4] =~ /^cec$/) { $type = 0; } else { $type = 1; @@ -321,5 +768,20 @@ sub fsp_api_passwd { } + +########################################################################## +# Do resetnet +########################################################################## +sub resetnet { + my $request = shift; + my $hash = shift; + my %nodehash; + foreach ( @{$request->{noderange}}) { + $nodehash{$_} = 1; + } + # go to use lsslp do_resetnet + my $result = xCAT_plugin::lsslp::do_resetnet($request, \%nodehash); + return [$result]; +} 1; diff --git a/perl-xCAT/xCAT/FSPconn.pm b/perl-xCAT/xCAT/FSPconn.pm index ba80c5448..53e67b64a 100644 --- a/perl-xCAT/xCAT/FSPconn.pm +++ b/perl-xCAT/xCAT/FSPconn.pm @@ -56,25 +56,29 @@ sub mkhwconn_parse_args $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose h|help t T=s p=s P=s port=s) )) { + if ( !GetOptions( \%opt, qw(V|verbose h|help t s:s T=s p=s P=s port=s ) )) { return( usage() ); } if ( exists $opt{s} ) { - my $opttmp = xCAT::PPCconn::mkhwconn_parse_args($request, $args); - return $opttmp; + my $opttmp = xCAT::PPCconn::mkhwconn_parse_args($request, $args); + return $opttmp; } return usage() if ( exists $opt{h}); + if ( !exists $opt{t} and !exists $opt{p}) { + return ( usage('Flag -t or -p must be used.')); + } + if ( exists $opt{t} and exists $opt{p}) { return( usage('Flags -t and -p cannot be used together.')); } - if ( exists $opt{P} and ! exists $opt{p}) + if ( (exists $opt{P} or grep(/^(-P)$/, @$args)) and !exists $opt{p}) { return( usage('Flags -P can only be used when flag -p is specified.')); } @@ -84,7 +88,7 @@ sub mkhwconn_parse_args ########################################## my $nodes = $request->{node}; my $ppctab = xCAT::Table->new( 'ppc' ); - my $nodetypetab = xCAT::Table->new( 'nodetype'); + #my $nodetypetab = xCAT::Table->new( 'nodetype'); my $vpdtab = xCAT::Table->new( 'vpd'); my @bpa_ctrled_nodes = (); my @no_type_nodes = (); @@ -95,8 +99,9 @@ sub mkhwconn_parse_args ########################################## if ( exists $opt{p} ) { - my $nodetype_hash = $nodetypetab->getNodeAttribs( $opt{p},[qw(nodetype)]); - my $nodetype = $nodetype_hash->{nodetype}; + #my $nodetype_hash = $nodetypetab->getNodeAttribs( $opt{p},[qw(nodetype)]); + #my $nodetype = $nodetype_hash->{nodetype}; + my $nodetype = xCAT::DBobjUtils->getnodetype($opt{p}); if( !defined($nodetype) ) { return(usage("Something wrong with the specified HMC (-p Option). The HMC type doesn't exist.")); } @@ -114,15 +119,16 @@ sub mkhwconn_parse_args my $node_parent = undef; my $nodetype = undef; my $node_hcp_nodetype = undef; - my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]); + #my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]); my $node_parent_hash = $ppctab->getNodeAttribs( $node,[qw(parent)]); if ( exists $opt{t} ) { my $node_hcp_hash = $ppctab->getNodeAttribs( $node,[qw(hcp)]); if ( $node_hcp_hash->{hcp} ) { - my $node_hcp_nodetype_hash = $nodetypetab->getNodeAttribs($node_hcp_hash->{hcp},[qw(nodetype)]); - $node_hcp_nodetype = $node_hcp_nodetype_hash->{nodetype}; + #my $node_hcp_nodetype_hash = $nodetypetab->getNodeAttribs($node_hcp_hash->{hcp},[qw(nodetype)]); + #$node_hcp_nodetype = $node_hcp_nodetype_hash->{nodetype}; + $node_hcp_nodetype = xCAT::DBobjUtils->getnodetype($node_hcp_hash->{hcp}); } if ( defined $hcp_nodetype ) { @@ -141,7 +147,8 @@ sub mkhwconn_parse_args } } - $nodetype = $nodetype_hash->{nodetype}; + #$nodetype = $nodetype_hash->{nodetype}; + $nodetype = xCAT::DBobjUtils->getnodetype($node); $node_parent = $node_parent_hash->{parent}; if ( !$nodetype ) { @@ -170,7 +177,7 @@ sub mkhwconn_parse_args if ( $nodetype eq 'frame') { my $my_frame_bpa_cec = xCAT::DBobjUtils::getcecchildren( $node) ; - push @frame_members, @$my_frame_bpa_cec; + push @frame_members, @$my_frame_bpa_cec if($my_frame_bpa_cec); push @frame_members, $node; } @@ -223,7 +230,7 @@ sub mkhwconn_parse_args } $ppctab->close(); - $nodetypetab->close(); + #$nodetypetab->close(); $vpdtab->close(); $request->{method} = 'mkhwconn'; @@ -296,7 +303,13 @@ sub lshwconn_parse_args $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose h|help T=s) )) { + if ( exists $opt{s} ) + { + my $opttmp = xCAT::PPCconn::lshwconn_parse_args($request, $args); + return $opttmp; + } + + if ( !GetOptions( \%opt, qw(V|verbose h|help T=s s) )) { return( usage() ); } return usage() if ( exists $opt{h}); @@ -322,49 +335,50 @@ sub lshwconn_parse_args if ( scalar( @ARGV)) { return(usage( "No additional flag is support by this command" )); } - my $nodetypetab = xCAT::Table->new('nodetype'); - if (! $nodetypetab) - { - return( ["Failed to open table 'nodetype'.\n"]); - } + #my $nodetypetab = xCAT::Table->new('nodetype'); + #if (! $nodetypetab) + #{ + # return( ["Failed to open table 'nodetype'.\n"]); + #} my $nodehmtab = xCAT::Table->new('nodehm'); if (! $nodehmtab) { return( ["Failed to open table 'nodehm'.\n"]); } - + my $nodetype; for my $node ( @{$request->{node}}) { - my $ent = $nodetypetab->getNodeAttribs( $node, [qw(nodetype)]); + #my $ent = $nodetypetab->getNodeAttribs( $node, [qw(nodetype)]); my $nodehm = $nodehmtab->getNodeAttribs( $node, [qw(mgt)]); - if ( ! $ent) - { - return( ["Failed to get node type for node $node.\n"]); - } - if ( ! $nodehm) + #if ( ! $ent) + #{ + # return( ["Failed to get node type for node $node.\n"]); + #} + my $ttype = xCAT::DBobjUtils->getnodetype($node); + if ( ! $ttype) { return( ["Failed to get nodehm.mgt value for node $node.\n"]); } - if ( $ent->{nodetype} ne 'fsp' and $ent->{nodetype} ne 'cec' - and $ent->{nodetype} ne 'bpa' and $ent->{nodetype} ne 'frame') + if ( $ttype ne 'fsp' and $ttype ne 'cec' + and $ttype ne 'bpa' and $ttype ne 'frame') { - return( ["Node type $ent->{nodetype} is not supported for this command in FSPAPI\n"]); + return( ["Node type $ttype is not supported for this command in FSPAPI\n"]); } if ( ! $nodetype) { - $nodetype = $ent->{nodetype}; + $nodetype = $ttype; #$ent->{nodetype}; } else { - if ( $nodetype ne $ent->{nodetype}) + if ( $nodetype ne $ttype) #$ent->{nodetype}) { return( ["Cannot support multiple node types in this command line.\n"]); } } } - $nodetypetab->close(); + #$nodetypetab->close(); $nodehmtab->close(); $request->{nodetype} = $nodetype; @@ -393,11 +407,17 @@ sub rmhwconn_parse_args $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose h|help T=s) )) { + if ( !GetOptions( \%opt, qw(V|verbose h|help T=s s) )) { return( usage() ); } return usage() if ( exists $opt{h}); - + + if ( $opt{s} ) + { + my $opttmp = xCAT::PPCconn::rmhwconn_parse_args($request, $args); + return $opttmp; + } + if( ! exists $opt{T} ) { $opt{T} = "lpar"; #defaut value is lpar. @@ -425,8 +445,8 @@ sub rmhwconn_parse_args my $nodes = $request->{node}; my $ppctab = xCAT::Table->new( 'ppc' ); return( ["Failed to open table 'ppc'.\n"]) if ( ! $ppctab); - my $nodetypetab = xCAT::Table->new( 'nodetype'); - return( ["Failed to open table 'nodetype'.\n"]) if ( ! $nodetypetab); + #my $nodetypetab = xCAT::Table->new( 'nodetype'); + #return( ["Failed to open table 'nodetype'.\n"]) if ( ! $nodetypetab); my $vpdtab = xCAT::Table->new( 'vpd'); return( ["Failed to open table 'vpd'.\n"]) if ( ! $vpdtab); my $nodehmtab = xCAT::Table->new('nodehm'); @@ -444,9 +464,10 @@ sub rmhwconn_parse_args my $node_parent = undef; my $nodetype = undef; - my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]); + #my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]); my $node_parent_hash = $ppctab->getNodeAttribs( $node,[qw(parent)]); - $nodetype = $nodetype_hash->{nodetype}; + #$nodetype = $nodetype_hash->{nodetype}; + $nodetype = xCAT::DBobjUtils->getnodetype($node); $node_parent = $node_parent_hash->{parent}; if ( !$nodetype) { @@ -481,7 +502,7 @@ sub rmhwconn_parse_args } $ppctab->close(); - $nodetypetab->close(); + #$nodetypetab->close(); $vpdtab->close(); $nodehmtab->close(); @@ -576,54 +597,39 @@ sub lshwconn #print "in lshwconn:\n"; #print Dumper($res); my $Rc = @$res[2]; - my $data = @$res[1]; + my $values = @$res[1]; ############################################ # If lssysconn failed, put error into all # nodes' return values ############################################ - if ( $Rc ) - { - push @value, [$node_name, $data, $Rc]; - next; - } - - my $node_ip = xCAT::Utils::getNodeIPaddress( $node_name ); - if(!defined($node_ip)) { - $data = "Failed to get the $node_name\'s ip"; - push @value, [$node_name, $data, -1]; - next; - } - if( $data =~ /state/) { - $data =~ /state=([\w\s]+), type=([\w-]+), MTMS=([\w-\*]+), ([\w=]+), slot=([\w]+), ipadd=([\w.]+), alt_ipadd=([\w.]+)/ ; - #$data =~ /state=([\w\s]+),\(type=([\w-]+)\),\(serial-number=([\w]+)\),\(machinetype-model=([\w-]+)\),sp=([\w]+),\(ip-address=([\w.]+),([\w.]+)\)/ ; - print "parsing: $1,$2,$3,$4,$5,$6,$7\n"; - my $state = $1; - my $type = $2; - my $mtms = $3; - my $sp = $4; - my $slot = $5; - my $ipadd = $6; - my $alt_ipaddr = $7; - #if($ipadd ne $node_ip) { - # $ipadd=$7; - # $alt_ipaddr = $6; - #} - #$data = "$sp,ipadd=$node_ip,alt_ipadd=$alt_ipaddr,state=$state"; - $data = "$sp,ipadd=$ipadd,alt_ipadd=$alt_ipaddr,state=$state"; - #my $s; - #foreach my $val ( @infomap ) { - # if ( $data =~ /@$val[0]=([\w.\-\s]+)/ ) { - # print "$1\n"; - # $s = $s + "@$val[1]=$1"; - # } - #} - #$data = $s; - } - push @value, [$node_name, $data, $Rc]; - - } - } + #if ( $Rc ) + # { + # push @value, [$node_name, $values, $Rc]; + # next; + # } + + my @data_a = split("\n", $values); + foreach my $data(@data_a) { + if( $data =~ /state/) { + $data =~ /state=([\w\s\,]+), type=([\w-]+), MTMS=([\w-\*]+), ([\w=]+), slot=([\w]+), ipadd=([\w.]+), alt_ipadd=([\w.]+)/ ; + #$data =~ /state=([\w\s]+),\(type=([\w-]+)\),\(serial-number=([\w]+)\),\(machinetype-model=([\w-]+)\),sp=([\w]+),\(ip-address=([\w.]+),([\w.]+)\)/ ; + print "parsing: $1,$2,$3,$4,$5,$6,$7\n"; + my $state = $1; + my $type = $2; + my $mtms = $3; + my $sp = $4; + my $slot = $5; + my $ipadd = $6; + my $alt_ipaddr = $7; + $data = "$ipadd: $sp,ipadd=$ipadd,alt_ipadd=$alt_ipaddr,state=$state"; + } + push @value, [$node_name, $data, $Rc]; + } + } + } + + return \@value; diff --git a/perl-xCAT/xCAT/FSPinv.pm b/perl-xCAT/xCAT/FSPinv.pm index 06cd869d9..ab50575b1 100644 --- a/perl-xCAT/xCAT/FSPinv.pm +++ b/perl-xCAT/xCAT/FSPinv.pm @@ -20,12 +20,16 @@ my @licmap = ( ["accepted_level", "Accepted Level "], ["curr_ecnumber_a", "Release Level A"], ["curr_level_a", "Level A "], + ["curr_power_on_side_a", "Current Power on side A"], ["curr_ecnumber_b", "Release Level B"], ["curr_level_b", "Level B "], + ["curr_power_on_side_b", "Current Power on side B"], ["curr_ecnumber_primary", "Release Level Primary"], ["curr_level_primary", "Level Primary "], + ["curr_power_on_side_primary", "Current Power on side Primary"], ["curr_ecnumber_secondary","Release Level Secondary"], - ["curr_level_secondary", "Level Secondary"] + ["curr_level_secondary", "Level Secondary"], + ["curr_power_on_side_secondary","Current Power on side Secondary"] ); ########################################################################## @@ -254,14 +258,25 @@ sub deconfig { next; } + ##################################### # Format fsp-api results ##################################### - my $decfg = XMLin($data); + #my $decfg = XMLin($data); + my $decfg; + eval { + $decfg = XMLin($data); + }; + if( $@ ) { + push @result,[$name, "Error: there are some unreadable XML data from the firmware. Please check with the data provider.", -1]; + return (\@result); + } + my $node = $decfg->{NODE}; - if( $node ) { + if( defined($node) && exists($node->{Location_code}) ) { push @result,[$name,"Deconfigured resources", 0]; - push @result,[$name,$node->{Location_code}.",".$node->{RID}, 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}}) { my $Call_Out_Hardware_State = $unit->{GARDUNIT}->{Call_Out_Hardware_State}; my $Call_Out_Method = $unit->{GARDUNIT}->{Call_Out_Method}; @@ -269,7 +284,7 @@ sub deconfig { my $RID = $unit->{GARDUNIT}->{RID}; my $TYPE = $unit->{GARDUNIT}->{TYPE}; - push @result,[$name,"$Location_code,$RID,$Call_Out_Method,$Call_Out_Hardware_State,$TYPE",0]; + push @result,[$name,"$Location_code $RID $Call_Out_Method $Call_Out_Hardware_State $TYPE",0]; } } else { diff --git a/perl-xCAT/xCAT/FSPpower.pm b/perl-xCAT/xCAT/FSPpower.pm index e24898833..d19076c2c 100644 --- a/perl-xCAT/xCAT/FSPpower.pm +++ b/perl-xCAT/xCAT/FSPpower.pm @@ -191,8 +191,9 @@ sub powercmd { } elsif ($$d[4] =~ /^(fsp|cec)$/) { if($action =~ /^on$/) { $action = "cec_on_autostart"; } if($action =~ /^off$/) { $action = "cec_off"; } + if($action =~ /^resetsp$/) { $action = "reboot_service_processor"; } if($action =~ /^lowpower$/) { $action = "cec_on_low_power"; } - if($action =~ /^of$/ ) { + if($action !~ /^cec_on_autostart$/ && $action !~ /^cec_off$/ && $action !~ /^cec_on_low_power$/ && $action !~ /^onstandby$/ && $action !~ /^reboot_service_processor$/ ) { push @output, [$node_name, "\'$action\' command not supported for CEC", -1 ]; #return (\@output); next; diff --git a/perl-xCAT/xCAT/FSPscan.pm b/perl-xCAT/xCAT/FSPscan.pm index 0d164f0c5..0e5c4dcaa 100644 --- a/perl-xCAT/xCAT/FSPscan.pm +++ b/perl-xCAT/xCAT/FSPscan.pm @@ -27,11 +27,20 @@ my @header = ( ["side", "%-8s" ], ["address", "%-20s\n" ]); -my @attribs = qw(nodetype node id mtm serial side hcp pprofile parent groups mgt cons); -my %nodetype = ( +my @attribs = qw(nodetype node id mtm serial side hcp pprofile parent groups mgt cons hwtype); +my %globalnodetype = ( + fsp => $::NODETYPE_PPC, + bpa => $::NODETYPE_PPC, + cec => $::NODETYPE_PPC, + frame=> $::NODETYPE_PPC, + lpar =>"$::NODETYPE_PPC,$::NODETYPE_OSI" +); +my %globalhwtype = ( fsp => $::NODETYPE_FSP, bpa => $::NODETYPE_BPA, - lpar =>"$::NODETYPE_LPAR,$::NODETYPE_OSI" + lpar => $::NODETYPE_LPAR, + cec => $::NODETYPE_CEC, + frame=> $::NODETYPE_FRAME, ); @@ -75,7 +84,7 @@ sub enumerate { my $hash = shift; my $exp = shift; my $hwtype = (); - my $server = (); + my $server ; my @values = (); my $cageid; my $server; @@ -87,6 +96,13 @@ sub enumerate { my $filter; my $data; my @output; + my $ips; + my $fsp; + my $model ; + my $serial; + my $side; + my $ips; + my $line; foreach my $cec_bpa ( keys %$hash) { @@ -104,7 +120,7 @@ sub enumerate { my $stat = xCAT::FSPUtils::fsp_api_action ($node_name, $d, "query_connection"); my $Rc = @$stat[2]; my $data = @$stat[1]; - + ################################## # Output error ################################## @@ -113,32 +129,51 @@ sub enumerate { push @values, $data; next; } - if($data !~ "Connected" && $data !~ "LINE UP" ) { - $data = "please check if the $node_name is coneected to the hardware server"; - #push @output, [$node_name,$data,$Rc]; - push @values, $data; - next; - } + my @data_a = split("\n", $data); + foreach $line(@data_a) { + if($line !~ "Connected" && $line !~ "LINE UP" ) { + next; + } - ######################################### - # GET CEC's information - ######################################### - #$data =~ /state=([\w\s]+),\(type=([\w-]+)\),\(serial-number=([\w]+)\),\(machinetype-model=([\w-]+)\),sp=([\w]+),\(ip-address=([\w.]+),([\w.]+)\)/ ; - $data =~ /state=([\w\s]+), type=([\w-]+), MTMS=([\w-]+)\*([\w-]+), ([\w=]+), slot=([\w]+), ipadd=([\w.]+), alt_ipadd=([\w.]+)/ ; - print "parsing: $1,$2,$3,$4,$5,$6,$7,$8\n"; + ######################################### + # GET CEC's information + ######################################### + #$data =~ /state=([\w\s]+),\(type=([\w-]+)\),\(serial-number=([\w]+)\),\(machinetype-model=([\w-]+)\),sp=([\w]+),\(ip-address=([\w.]+),([\w.]+)\)/ ; + $line =~ /state=([\w\s]+), type=([\w-]+), MTMS=([\w-]+)\*([\w-]+), sp=([\w=]+), slot=([\w]+), ipadd=([\w.]+), alt_ipadd=([\w.]+)/ ; + #print "parsing: $1,$2,$3,$4,$5,$6,$7,$8\n"; - my $fsp=$node_name; - my $model = $3; - my $serial = $4; - my $side = $6; - $server = $fsp; - $fname = $fsp; - my $ips ="$7,$8"; + $fsp=$node_name; + $model = $3; + $serial = $4; + $side = $6; + $server = $fsp; + $fname = $fsp; + my $ip = $7; + my $ip_s = $8; + if(! defined( $ips)) { + if( $ip_s =~ /unavailable/ ) { + $ips ="$ip;"; + } else { + $ips ="$ip;$ip_s;"; + } + } else { + if( $ip_s =~ /unavailable/ ) { + $ips .="$ip"; + } else { + $ips .="$ip;$ip_s"; + } + } + } + if(!defined($fsp)) { + my $msg = "please check if the $node_name is coneected to the hardware server"; + push @values, $msg; + next; + } if($$d[4] =~ /^cec$/) { $side=""; } push @values, join( ",", - $$d[4],$node_name,$cageid,$model,$serial,$side, $server,$prof,$fname, $ips); + $$d[4],$node_name,$cageid,$model,$serial,$side, $server,$prof,$fname, $ips, $$d[4]); # $$d[4],$node_name,$cageid,$model,$serial,$side, $server,$prof,$fname, $7); # "fsp",$node_name,$cageid,$model,$serial,$side, $server,$prof,$fname, $7); #"fsp",$fsp,$cageid,$model,$serial,$side,$server,$prof,$fname,$ips ); @@ -165,7 +200,7 @@ sub enumerate { $lpar =~ /lparname:\s+([\w\-]+),\s+lparid:\s+(\d+),\s+state:/; my $name = $1; my $lparid = $2; - my $prof = ""; # No profile for P7 IH + my $prof = ""; # No profile for Power 775 my $server = $fsp; my $ips = ""; my $port = ""; @@ -176,7 +211,7 @@ sub enumerate { # Save LPAR information ##################################### push @values, join( ",", - "lpar",$name,$lparid,$model,$serial,$port,$server,$prof,$fsp,$ips ); + "lpar",$name,$lparid,$model,$serial,$port,$server,$prof,$fsp,$ips,"lpar" ); } @@ -358,7 +393,9 @@ sub format_stanza { if ( /^node$/ ) { next; } elsif ( /^nodetype$/ ) { - $d = $nodetype{$d}; + $d = $globalnodetype{$type}; + } elsif ( /^hwtype$/ ) { + $d = $globalhwtype{$type}; } elsif ( /^groups$/ ) { $d = "$type,all"; } elsif ( /^mgt$/ ) { @@ -374,6 +411,10 @@ sub format_stanza { if ( $type eq "lpar" ) { $d = undef; } + } elsif (/^side$/) { + unless ( $type =~ /^fsp|bpa$/ ) { + next; + } } $result .= "\t$_=$d\n"; } @@ -423,7 +464,9 @@ sub format_xml { my $d = $data[$i++]; if ( /^nodetype$/ ) { - $d = $nodetype{$d}; + $d = $globalnodetype{$type}; + } elsif ( /^hwtype$/ ) { + $d = $globalhwtype{$type}; } elsif ( /^groups$/ ) { $d = "$type,all"; } elsif ( /^mgt$/ ) { @@ -438,6 +481,10 @@ sub format_xml { if ( $type eq "lpar" ) { $d = undef; } + } elsif (/^side$/) { + unless ( $type =~ /^fsp|bpa$/ ) { + next; + } } $href->{Node}->{$_} = $d; } diff --git a/perl-xCAT/xCAT/FSPvitals.pm b/perl-xCAT/xCAT/FSPvitals.pm index 2a2ee62ea..13c06e8c0 100644 --- a/perl-xCAT/xCAT/FSPvitals.pm +++ b/perl-xCAT/xCAT/FSPvitals.pm @@ -315,7 +315,8 @@ sub rackenv { foreach my $td ( @t ) { push @result, [$name,$td, $Rc]; if ( !exists($request->{verbose}) ) { - if( $td =~ /^Rack altitude in meters/ ) { + #if( $td =~ /^Rack altitude in meters/ ) { + if( $td =~ /^BPA-B total output in watts/ ) { last; } } diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index d4f5af677..7f7e54486 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -47,6 +47,26 @@ sub parse_args { ########################################################################## # Parse the chvm command line for options and operands ########################################################################## +sub chvm_parse_lparname { + my $args = shift; + my $opt = shift; + if ((ref($args) ne 'ARRAY') || + (scalar(@$args) > '1')){ + return "@$args"; + } + my ($cmd, $value) = split(/\=/, $args->[0]); + if ($cmd !~ /^lparname$/) { + return "'$cmd' not support"; + } + if (!defined($value)) { + return "value not specified"; + } + $opt->{$cmd} = $value; + if ($value && $value ne '*' && $value !~ /^[a-zA-Z0-9-_]+$/) { + return "'$value' invalid"; + } + return undef; +} sub chvm_parse_args { my $request = shift; @@ -87,12 +107,6 @@ sub chvm_parse_args { return(usage( "Missing option: -" )); } #################################### - # Check for an extra argument - #################################### - if ( defined( $ARGV[0] )) { - return(usage( "Invalid argument: $ARGV[0]" )); - } - #################################### # Configuration file required #################################### #if ( !exists( $opt{p}) ) { @@ -159,16 +173,16 @@ sub chvm_parse_args { my @id = (1, 5, 9, 13, 17, 21, 25, 29); my @found = grep(/^$opt{i}$/, @id ); if ( @found != 1) { - return(usage( "Invalid entry: $opt{i}.\n For P7 IH, starting numeric id of the newly created partitions only could be 1, 5, 9, 13, 17, 21, 25 and 29." )); + return(usage( "Invalid entry: $opt{i}.\n For Power 775, starting numeric id of the newly created partitions only could be 1, 5, 9, 13, 17, 21, 25 and 29." )); } #if ( !exists($opt{o}) ) { - # return(usage("For P7 IH, -i should be used with -o")); + # return(usage("For Power 775, -i should be used with -o")); #} #my @value = (1, 2, 3, 4, 5); #if ( grep(/^$opt{i}$/, @id ) != 1) { - # return(usage( "Invalid entry: $opt{o}.\n For P7 IH, octant configuration values only could be 1, 2, 3, 4, 5. Please see the details in manpage of mkvm." )); + # return(usage( "Invalid entry: $opt{o}.\n For Power 775, octant configuration values only could be 1, 2, 3, 4, 5. Please see the details in manpage of mkvm." )); #} @@ -184,7 +198,7 @@ sub chvm_parse_args { } elsif( $opt{m} =~ /^non-interleaved$/ || $opt{m} =~ /^2$/ ) { $opt{m} = 2; } else { - return(usage( "Invalid entry: $opt{m}.\n For P7 IH, the pending memory interleaving mode only could be interleaved(or 1), or non-interleaved(or 2)." )); + return(usage( "Invalid entry: $opt{m}.\n For Power 775, the pending memory interleaving mode only could be interleaved(or 1), or non-interleaved(or 2)." )); } } else { $opt{m} = 2 ;# non-interleaved, which is the default @@ -201,13 +215,16 @@ sub chvm_parse_args { my @elems = split(/\,/,$opt{r}); my $range=""; while (my $elem = shift @elems) { + if ($elem !~ /\:/) { + return (usage("Invalid argument $elem.\n The input format for 'r' should be like this: \"-r Octant_id:Value\".")) + } if($elem !~ /\-/) { my @subelems = split(/\:/, $elem); if( $subelems[0] < 0 || $subelems[0] > 7) { return(usage("Octant ID only could be 0 to 7 in the octant configuration value $elem")); } if( grep(/^$subelems[1]$/, @ratio ) != 1) { - return(usage( "Invalid octant configuration value in $elem.\n For P7 IH, octant configuration values only could be 1, 2, 3, 4, 5. Please see the details in manpage of mkvm." )); + 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( 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!")); @@ -222,7 +239,7 @@ sub chvm_parse_args { } if($left == $right) { if( grep(/^$subelems[1]$/, @ratio ) != 1) { - return(usage( "Invalid octant configuration value in $elem.\n For P7 IH, octant configuration values only could be 1, 2, 3, 4, 5. Please see the details in manpage of mkvm." )); + 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( exists($octant_cfg{$left}) || $octant_cfg{$left} == $subelems[1] ) { return(usage("In the octant configuration rule, same octant with different octant configuration value. Error!")); @@ -267,12 +284,32 @@ sub chvm_parse_args { $other_p = $p; } if ($other_p ne $p) { - return(usage("For P7 IH, please make sure the noderange are in one CEC ")); + return(usage("For Power 775, please make sure the noderange are in one CEC ")); } } $request->{node} = [$other_p]; $request->{noderange} = $other_p; } + #################################### + # Check for an extra argument + #################################### + if ( defined( $ARGV[0] )) { + my $check_chvm_lpar_arg = chvm_parse_lparname(\@ARGV, \%opt); + if (defined($check_chvm_lpar_arg)) { + return (usage("Invalid argument: $check_chvm_lpar_arg")); + } elsif (($opt{lparname} ne '*') && (scalar(@{$request->{node}}) > '1')){ + return(usage( "Invalid argument: must specify '*' for more than one node" )); + } else { + my $len = rindex $opt{lparname}."\$", "\$"; + if ($len > '47') { + return (usage("Invalid lparname '$opt{lparname}', name is too long, max 47 characters")); + } + } + if (exists($opt{lparname}) && + (exists($opt{p}) || exists($opt{i}) || exists($opt{m}) || exists($opt{r}))) { + return (usage("lparname should NOT be used with -p, -i, -m or -r.")); + } + } #################################### # No operands - add command name @@ -337,16 +374,16 @@ sub mkvm_parse_args { my @id = (1, 5, 9, 13, 17, 21, 25, 29); my @found = grep(/^$opt{i}$/, @id ); if ( @found != 1) { - return(usage( "Invalid entry: $opt{i}.\n For P7 IH, starting numeric id of the newly created partitions only could be 1, 5, 9, 13, 17, 21, 25 and 29." )); + return(usage( "Invalid entry: $opt{i}.\n For Power 775, starting numeric id of the newly created partitions only could be 1, 5, 9, 13, 17, 21, 25 and 29." )); } #if ( !exists($opt{o}) ) { - # return(usage("For P7 IH, -i should be used with -o")); + # return(usage("For Power 775, -i should be used with -o")); #} #my @value = (1, 2, 3, 4, 5); #if ( grep(/^$opt{i}$/, @id ) != 1) { - # return(usage( "Invalid entry: $opt{o}.\n For P7 IH, octant configuration values only could be 1, 2, 3, 4, 5. Please see the details in manpage of mkvm." )); + # return(usage( "Invalid entry: $opt{o}.\n For Power 775, octant configuration values only could be 1, 2, 3, 4, 5. Please see the details in manpage of mkvm." )); #} @@ -362,7 +399,7 @@ sub mkvm_parse_args { } elsif( $opt{m} =~ /^non-interleaved$/ || $opt{m} =~ /^2$/ ) { $opt{m} = 2; } else { - return(usage( "Invalid entry: $opt{m}.\n For P7 IH, the pending memory interleaving mode only could be interleaved(or 1), or non-interleaved(or 2)." )); + return(usage( "Invalid entry: $opt{m}.\n For Power 775, the pending memory interleaving mode only could be interleaved(or 1), or non-interleaved(or 2)." )); } } else { $opt{m} = 2 ;# non-interleaved, which is the default @@ -380,7 +417,7 @@ sub mkvm_parse_args { return(usage("Octant ID only could be 0 to 7 in the octant configuration value $elem")); } if( grep(/^$subelems[1]$/, @ratio ) != 1) { - return(usage( "Invalid octant configuration value in $elem.\n For P7 IH, octant configuration values only could be 1, 2, 3, 4, 5. Please see the details in manpage of mkvm." )); + 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 mkvm." )); } 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!")); @@ -395,7 +432,7 @@ sub mkvm_parse_args { } if($left == $right) { if( grep(/^$subelems[1]$/, @ratio ) != 1) { - return(usage( "Invalid octant configuration value in $elem.\n For P7 IH, octant configuration values only could be 1, 2, 3, 4, 5. Please see the details in manpage of mkvm." )); + 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 mkvm." )); } if( exists($octant_cfg{$left}) || $octant_cfg{$left} == $subelems[1] ) { return(usage("In the octant configuration rule, same octant with different octant configuration value. Error!")); @@ -443,7 +480,7 @@ sub mkvm_parse_args { $other_p = $p; } if ($other_p ne $p) { - return(usage("For P7 IH, please make sure the noderange are in one CEC ")); + return(usage("For Power 775, please make sure the noderange are in one CEC ")); } } $request->{node} = [$other_p]; @@ -494,7 +531,7 @@ sub rmvm_parse_args { if ( !GetOptions( \%opt, qw(V|verbose service r) )) { return( usage() ); } - return(usage( "rmvm doesn't support for P7 IH." )); + return(usage( "rmvm doesn't support for Power 775." )); #################################### # Check for "-" with no option #################################### @@ -548,7 +585,7 @@ sub lsvm_parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose ) )) { + if ( !GetOptions( \%opt, qw(V|verbose l|long) )) { return( usage() ); } #################################### @@ -577,8 +614,54 @@ sub lsvm_parse_args { sub modify { my $request = shift; my $hash = shift; - return modify_by_prof( $request, $hash) if ( $request->{opt}->{p}); + my $usage_string = xCAT::Usage->getUsage($request->{command}); + return modify_by_prof( $request, $hash) if ( $request->{opt}->{p} || $request->{stdin}); return create( $request, $hash) if ( $request->{opt}->{i}); + return op_lparname ($request, $hash) if ($request->{opt}->{lparname}); + return ([["Error", "Miss argument\n".$usage_string, 1]]); +} +sub do_set_lparname { + my $request = shift; + my $hash = shift; + my @values = (); + my $lparname_para = $request->{opt}->{lparname}; + while (my ($mtms, $h) = each(%$hash)) { + while (my($name, $d) = each(%$h)) { + my $lparname = ($lparname_para eq '*') ? $name : $lparname_para; + my $values = xCAT::FSPUtils::fsp_api_action($name, $d, "set_lpar_name", 0, $lparname); + if (@$values[1] && ((@$values[1] =~ /Error/i) && (@$values[2] ne '0'))) { + return ([[$name, @$values[1], '1']]) ; + } else { + push @values, [$name, "Success", '0']; + } + } + } + return \@values; +} +sub check_node_info { + my $hash = shift; + my $not_lpar = undef; + while (my ($mtms, $h) = each(%$hash)) { + while (my($name, $d) = each(%$h)) { + my $node_type = @$d[4]; + if ($node_type !~ /^lpar$/) { + $not_lpar = $name; + last; + } + } + } + return $not_lpar; +} + +sub op_lparname { + my $request = shift; + my $hash = shift; + my $node = $request->{node}; + my $lpar_flag = &check_node_info($hash); + if (defined($lpar_flag)) { + return ([[$lpar_flag,"Node must be LPAR", 1]]); + } + return &do_set_lparname($request, $hash); } @@ -623,12 +706,12 @@ sub modify_by_prof { #get the current I/O slot information my $action = "get_io_slot_info"; my $values = xCAT::FSPUtils::fsp_api_action ($cec_name, $td, $action); - my $Rc = shift(@$values); + my $Rc = $$values[2]; if ( $Rc != 0 ) { - push @result, [$cec_name, $$values[0], $Rc]; + push @result, [$cec_name, $$values[1], $Rc]; return (\@result); } - my @data = split(/\n/, $$values[0]); + my @data = split(/\n/, $$values[1]); foreach my $v (@data) { my ($lparid, $busid, $location, $drc_index, $owner_type, $owner, $descr) = split(/,/, $v); $io{$drc_index}{lparid} = $lparid; @@ -704,12 +787,13 @@ sub enumerate { $td[4]="fsp"; my $action = "get_io_slot_info"; my $values = xCAT::FSPUtils::fsp_api_action ($cec, \@td, $action); - my $Rc = shift(@$values); + #my $Rc = shift(@$values); + my $Rc = $$values[2]; if ( $Rc != 0 ) { - return( [$Rc,@$values[0]] ); - } - - $outhash{ 0 } = $$values[0]; + $outhash{ 1 } = "The LPARs' I/O slots information could NOT be listed because the cec is in power off state"; + } else { + $outhash{ 0 } = $$values[1]; + } #my @t; #foreach my $value ( @$values ) { # my ($lparid, $busid, $slot_location_code, $drc_index,@t ) = split (/,/, $value); @@ -719,20 +803,20 @@ sub enumerate { if( $type =~ /^(fsp|cec)$/ ) { $action = "query_octant_cfg"; my $values = xCAT::FSPUtils::fsp_api_action ($cec, \@td, $action); - my $Rc = shift(@$values); + my $Rc = pop(@$values); if ( $Rc != 0 ) { - return( [$Rc,@$values[0]] ); + return( [$Rc,$$values[1]] ); } #$outhash{ $cec } = @$values[0]; - my $data = @$values[0]; + my $data = $$values[1]; my @value = split(/:/, $data); my $pendingpumpmode = $value[0]; my $currentpumpMode = $value[1]; my $octantcount = $value[2]; my $j = 3; - my $res = "PendingPumpMode=$pendingpumpmode,CurrentPumpMode=$currentpumpMode,OctantCount=$octantcount:"; + my $res = "PendingPumpMode=$pendingpumpmode,CurrentPumpMode=$currentpumpMode,OctantCount=$octantcount:\n"; for(my $i=0; $i < $octantcount; $i++) { - $res = $res."OctantID=".$value[$j++].",PendingOctCfg=".$value[$j++].",CurrentOctCfg=".$value[$j++].",PendingMemoryInterleaveMode=".$value[$j++].",CurrentMemoryInterleaveMode=".$value[$j++].";"; + $res = $res."OctantID=".$value[$j++].",PendingOctCfg=".$value[$j++].",CurrentOctCfg=".$value[$j++].",PendingMemoryInterleaveMode=".$value[$j++].",CurrentMemoryInterleaveMode=".$value[$j++].";\n"; } $outhash{ $cec } = $res; } @@ -740,6 +824,43 @@ sub enumerate { return( [0,\%outhash] ); } +sub get_cec_lpar_info { + my $name = shift; + my $attr = shift; + my $lparid = shift; + my $values = xCAT::FSPUtils::fsp_api_action($name, $attr, "get_lpar_info"); + if (@$values[1] && ((@$values[1] =~ /Error/i) && @$values[2] ne '0')) { + return ([[$name, @$values[1], '1']]); + } + return @$values[1]; +} +sub get_cec_lpar_name { + my $name = shift; + my $lpar_info = shift; + my $lparid = shift; + my @value = split(/\n/, $lpar_info); + foreach my $v (@value) { + if($v =~ /lparname:\s*([^\,]*),\s*lparid:\s*([\d]+),/) { + if($2 == $lparid) { + return $1; + } + } + } + return ([[$name, "can not get lparname for lpar id $lparid", '1']]); + +} +sub get_lpar_lpar_name { + my $name = shift; + my $attr = shift; + my $values = xCAT::FSPUtils::fsp_api_action($name, $attr, "get_lpar_name"); + if (@$values[1] && ((@$values[1] =~ /Error/i) && (@$values[2] ne '0'))) { + my @result = (); + push @result, $values; + return \@result; + } + return @$values[1]; +} + ########################################################################## # Lists logical partitions ########################################################################## @@ -753,13 +874,12 @@ sub list { my $node_name; my $d; my @result; - + my $lpar_infos; #print Dumper($hash); while (my ($mtms,$h) = each(%$hash) ) { my $info = enumerate( $h, $mtms ); my $Rc = shift(@$info); my $data = @$info[0]; - my $values = $data->{0}; while (($node_name,$d) = each(%$h) ) { my $cec = @$d[3]; @@ -771,23 +891,50 @@ sub list { push @result, [$node_name, $data,$Rc]; next; } + my $values = $data->{0}; + my $msg = $data->{1}; # if ( !exists( $data->{$id} )) { # push @result, [$node_name, "Node not found",1]; # next; # } - # get the I/O slot information - my $v; - my @t; - my @value = split(/\n/, $values); - foreach my $v (@value) { - my ($lparid, @t ) = split (/,/, $v); - if ($type=~/^(fsp|cec)$/) { - push @result,[$lparid, join('/', @t), $Rc]; - } else { - if( $lparid eq $id) { - push @result,[$lparid, join('/', @t), $Rc]; + if( defined($msg)) { + push @result,[$node_name, $msg, 0]; + } else { + # get the I/O slot information + if($request->{opt}->{l} and $type =~ /^(fsp|cec)$/) { + $lpar_infos = get_cec_lpar_info($node_name, $d); + if (ref($lpar_infos) eq 'ARRAY') { + return $lpar_infos; + } + } + my $v; + my @t; + my @value = split(/\n/, $values); + foreach my $v (@value) { + my ($lparid, @t ) = split (/,/, $v); + my $lparname = undef; + if ($request->{opt}->{l}) { + if ($type =~ /^(fsp|cec)$/) { + $lparname = get_cec_lpar_name($node_name, $lpar_infos, $lparid); + } else { + $lparname = get_lpar_lpar_name($node_name, $d); + } + if (ref($lparname) eq 'ARRAY') { + return $lparname; + } else { + $lparname = "$lparname: $lparid"; + } + } else { + $lparname = $lparid; + } + if ($type=~/^(fsp|cec)$/) { + push @result,[$lparname, join('/', @t), $Rc]; + } else { + if( $lparid eq $id) { + push @result,[$lparname, join('/', @t), $Rc]; + } } } } @@ -918,7 +1065,7 @@ sub create { if ( $Rc != 0 ) { return( [[$cec_name,$$values[0],$Rc]] ); } - my @v = split(/:/, @$values[0]); + my @v = split(/:/, $$values[0]); $octant_cfg->{pendingpumpmode} = $v[0]; @@ -991,8 +1138,8 @@ sub create { #$values = xCAT::FSPUtils::fsp_api_create_parttion( $starting_lpar_id, $octant_cfg, $node_number, $d, "set_octant_cfg"); $values = xCAT::FSPUtils::fsp_api_action ($cec_name, $d, "set_octant_cfg", 0, $parameters); - my $Rc = @$values[2]; - my $data = @$values[1]; + my $Rc = $$values[2]; + my $data = $$values[1]; if ( $Rc != SUCCESS ) { push @result, [$cec_name,$data,$Rc]; } else { @@ -1137,7 +1284,7 @@ sub chvm { ########################################################################## -# No rmvm for P7 IH +# No rmvm for Power 775 ########################################################################## #sub rmvm { # return( remove(@_) ); diff --git a/perl-xCAT/xCAT/GlobalDef.pm b/perl-xCAT/xCAT/GlobalDef.pm index 36951a109..34015e3f5 100644 --- a/perl-xCAT/xCAT/GlobalDef.pm +++ b/perl-xCAT/xCAT/GlobalDef.pm @@ -16,8 +16,7 @@ This module contains all the global info for xCAT. #-------------------------------------------------------------------------------- -# valid values for nodelist.nodetype column -$::NODETYPE_OSI="osi"; +# valid values for nodelist.hwtype column $::NODETYPE_LPAR="lpar"; $::NODETYPE_BPA="bpa"; $::NODETYPE_FSP="fsp"; @@ -26,6 +25,11 @@ $::NODETYPE_IVM="ivm"; $::NODETYPE_FRAME="frame"; $::NODETYPE_CEC="cec"; +# valid values for nodelist.nodetype column +$::NODETYPE_OSI="osi"; +$::NODETYPE_PPC="ppc"; +$::NODETYPE_ZVM="zvm"; + # valid values for nodelist.status columns or other status $::STATUS_ACTIVE="alive"; $::STATUS_INACTIVE="unreachable"; diff --git a/perl-xCAT/xCAT/InstUtils.pm b/perl-xCAT/xCAT/InstUtils.pm index 3063e1069..18906d34c 100644 --- a/perl-xCAT/xCAT/InstUtils.pm +++ b/perl-xCAT/xCAT/InstUtils.pm @@ -202,6 +202,10 @@ sub is_me my $nameIP = xCAT::NetworkUtils->getipaddr($name); chomp $nameIP; + # shut off verbose - just for this routine + my $verb = $::VERBOSE; + $::VERBOSE = 0; + # split into octets #my ($b1, $b2, $b3, $b4) = split /\./, $nameIP; @@ -213,6 +217,7 @@ sub is_me my $rsp; # push @{$rsp->{data}}, "Could not run $ifcmd.\n"; # xCAT::MsgUtils->message("E", $rsp, $callback); + $::VERBOSE = $verb; return 0; } @@ -225,9 +230,11 @@ sub is_me if ($myIP eq $nameIP) { + $::VERBOSE = $verb; return 1; } } + $::VERBOSE = $verb; return 0; } @@ -355,9 +362,11 @@ sub get_nim_attr_val xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $target, $cmd, 0); if ($::RUNCMD_RC != 0) { - my $rsp; - push @{$rsp->{data}}, "Could not run lsnim command: \'$cmd\'.\n"; - xCAT::MsgUtils->message("E", $rsp, $callback); + if ($::VERBOSE) { + my $rsp; + push @{$rsp->{data}}, "Could not run lsnim command: \'$cmd\'.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + } return undef; } @@ -785,6 +794,10 @@ sub dolitesetup %imghash = %$imagehash; } + # get name as known by xCAT + my $Sname = xCAT::InstUtils->myxCATname(); + chomp $Sname; + my @nodelist; my @nodel; my @nl; @@ -833,7 +846,7 @@ sub dolitesetup } # get spot inst_root loc - my $spotloc = xCAT::InstUtils->get_nim_attr_val($imghash{$imagename}{spot}, 'location', $callback, "", $subreq); + my $spotloc = xCAT::InstUtils->get_nim_attr_val($imghash{$imagename}{spot}, 'location', $callback, $Sname, $subreq); my $instrootloc = $spotloc . "/lpp/bos/inst_root"; @@ -1277,7 +1290,7 @@ sub dolitesetup my $nimprime = xCAT::InstUtils->getnimprime(); chomp $nimprime; # get the location of the shared_root directory - my $SRloc = xCAT::InstUtils->get_nim_attr_val($imghash{$imagename}{shared_root}, 'location', $callback, $nimprime, $subreq); + my $SRloc = xCAT::InstUtils->get_nim_attr_val($imghash{$imagename}{shared_root}, 'location', $callback, $Sname, $subreq); # copy the statelite table file to the shared root location # this will not effect any running nodes that are using @@ -1329,5 +1342,23 @@ sub dolitesetup return 0; } +#---------------------------------------------------------------------------- + +=head3 convert_xcatmaster + + Convert the keyword of nameservers attr in site/networks table to IP address. + (Either the management node or a service node) + +=cut + +#----------------------------------------------------------------------------- + +sub convert_xcatmaster +{ + my $shorthost = xCAT::InstUtils->myxCATname(); + my $selfip = xCAT::NetworkUtils->getipaddr($shorthost); + + return $selfip; +} 1; diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index 28d424076..1464c8e36 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -1,6 +1,9 @@ #!/usr/bin/perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html package xCAT::MacMap; +require Exporter; +our @ISA=qw/Exporter/; +our @EXPORT_OK=qw/walkoid/; use strict; use xCAT::Table; use xCAT::Utils; diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 0626d6a98..975aab41b 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -260,6 +260,9 @@ sub getipaddr { #return inet_ntoa(inet_aton($iporhost)) #TODO, what if no scoket6 support, but passing in a IPv6 hostname? + if ($iporhost =~ /:/) { #ipv6 + die "Attempt to process IPv6 address, but system does not have requisite IPv6 perl support"; + } my $packed_ip; $iporhost and $packed_ip = inet_aton($iporhost); if (!$packed_ip) diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index b36d5a5e3..dd17c1dfe 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -39,6 +39,7 @@ my %allgrphash; my $retaincache=0; my $recurselevel=0; +my @cachedcolumns; #TODO: With a very large nodelist (i.e. 65k or so), deriving the members # of a group is a little sluggish. We may want to put in a mechanism to # maintain a two-way hash anytime nodelist or nodegroup changes, allowing @@ -133,6 +134,22 @@ sub nodesbycriteria { foreach (@{$tables{$tab}}) { push @cols, $_->[0]; } + if ($tab eq "nodelist") { #fun caching interaction + my $neednewcache=0; + my $nlcol; + foreach $nlcol (@cols) { + unless (grep /^$nlcol\z/,@cachedcolumns) { + $neednewcache=1; + push @cachedcolumns,$nlcol; + } + } + if ($neednewcache) { + if ($nodelist) { + $nodelist->_clear_cache(); + $nodelist->_build_cache(\@cachedcolumns); + } + } + } my $rechash = $tabh->getNodesAttribs($nodes,\@cols); #TODO: if not defined nodes, getAllNodesAttribs may be faster actually... foreach my $node (@$nodes) { my $recs = $rechash->{$node}; @@ -518,7 +535,8 @@ sub noderange { unless ($nodelist) { $nodelist =xCAT::Table->new('nodelist',-create =>1); $nodelist->_set_use_cache(0); #TODO: a more proper external solution - $nodelist->_build_cache(['node','groups']); + @cachedcolumns = ('node','groups'); + $nodelist->_build_cache(\@cachedcolumns); $nodelist->_set_use_cache(1); #TODO: a more proper external solution } my %nodes = (); diff --git a/perl-xCAT/xCAT/PPCboot.pm b/perl-xCAT/xCAT/PPCboot.pm index f2319477c..cd2f3df64 100644 --- a/perl-xCAT/xCAT/PPCboot.pm +++ b/perl-xCAT/xCAT/PPCboot.pm @@ -187,7 +187,8 @@ sub do_rnetboot { ####################################### # Network specified ####################################### - $cmd.= " -s auto -d auto -m $mac -S $opt->{S} -C $opt->{C} -N $opt->{N}"; + my $mac_a = lc($mac); + $cmd.= " -s auto -d auto -m $mac_a -S $opt->{S} -C $opt->{C} -N $opt->{N}"; if (defined($opt->{G})) { $cmd.= " -G $opt->{G}"; diff --git a/perl-xCAT/xCAT/PPCcfg.pm b/perl-xCAT/xCAT/PPCcfg.pm index 45870141d..33eabb85c 100644 --- a/perl-xCAT/xCAT/PPCcfg.pm +++ b/perl-xCAT/xCAT/PPCcfg.pm @@ -43,7 +43,10 @@ sub parse_args { "admin_passwd", "general_passwd", "*_passwd", - "hostname" + "hostname", + "resetnet", + "dev", + "celogin1" ); my @bpa = ( "frame", @@ -53,7 +56,10 @@ sub parse_args { "admin_passwd", "general_passwd", "*_passwd", - "hostname" + "hostname", + "resetnet", + "dev", + "celogin1" ); my @ppc = ( "sshcfg" @@ -69,18 +75,24 @@ sub parse_args { ############################################# # Get support command list ############################################# - my $sitetab = xCAT::Table->new( 'nodetype' ); + #my $typetab = xCAT::Table->new( 'nodetype' ); + #my $nodes = $request->{node}; + #foreach (@$nodes) { + # if ( defined( $typetab )) { + # my ($ent) = $typetab->getAttribs({ node=>$_},'nodetype'); + # if ( defined($ent) ) { + # $request->{hwtype} = $ent->{nodetype}; + # last; + # } + # + # } + # + #} + my $nodes = $request->{node}; - foreach (@$nodes) { - if ( defined( $sitetab )) { - my ($ent) = $sitetab->getAttribs({ node=>$_},'nodetype'); - if ( defined($ent) ) { - $request->{hwtype} = $ent->{nodetype}; - last; - } - - } - + foreach my $nn (@$nodes) { + $request->{hwtype} = xCAT::DBobjUtils->getnodetype($nn); + last if ($request->{hwtype}); } my $supported = $rsp{$request->{hwtype}}; @@ -108,7 +120,7 @@ sub parse_args { Getopt::Long::Configure( "bundling" ); $request->{method} = undef; - if ( !GetOptions( \%opt, qw(V|Verbose) )) { + if ( !GetOptions( \%opt, qw(V|Verbose resetnet))) { return( usage() ); } #################################### @@ -128,7 +140,7 @@ sub parse_args { #################################### foreach my $arg ( @ARGV ) { my ($command,$value) = split( /=/, $arg ); - if ( !grep( /^$command$/, @$supported )) { + if ( !grep( /^$command$/, @$supported) and !$opt{resetnet}) { return(usage( "Invalid command: $arg" )); } if ( exists( $cmds{$command} )) { @@ -148,6 +160,12 @@ sub parse_args { } } } + { + my $result = parse_dev_option( $request, \%cmds); + if ($result) { + return ( usage($result)); + } + } #################################### # Return method to invoke #################################### @@ -163,6 +181,14 @@ sub parse_args { $request->{method} = "cfg"; return( \%opt ); } + #################################### + # Return method to invoke + #################################### + if ( $opt{resetnet} ) { + $request->{hcp} = "hmc"; + $request->{method} = "resetnet"; + return( \%opt ); + } #################################### # Return method to invoke @@ -178,6 +204,24 @@ sub parse_args { } +sub parse_dev_option{ + my $req = shift; + my $cmds = shift; + foreach my $cmd (keys %$cmds) { + if ( $cmd =~ /^(dev|celogin1)$/ ) { + if ($cmds->{$cmd} and ($cmds->{$cmd} !~ /^(enable|disable)$/i) ) { + return( "Invalid argument ".$cmds->{$cmd}." for ".$cmd ); + } + $req->{dev} = 1; + } else { + $req->{other} = 1; + } + } + if ($req->{dev} eq '1' && $req->{other} eq '1') { + return ("Invalid command arrays"); + } + return undef; +} ########################################################################## # Parse the command line optional arguments ########################################################################## @@ -392,7 +436,7 @@ sub sshcfg { # Find logon in key file ################################# foreach ( @$result ) { - if ( /= $logon$/ ) { + if ( /$logon$/ ) { return( [[$server,"enabled",SUCCESS]] ); } } @@ -580,6 +624,20 @@ sub hostname { return( [@$result] ); } +########################################################################## +# Do resetnet +########################################################################## +sub resetnet { + my $request = shift; + my $hash = shift; + my %nodehash; + foreach ( @{$request->{noderange}}) { + $nodehash{$_} = 1; + } + # go to use lsslp do_resetnet + my $result = xCAT_plugin::lsslp::do_resetnet($request, \%nodehash); + return [$result]; +} 1; diff --git a/perl-xCAT/xCAT/PPCcli.pm b/perl-xCAT/xCAT/PPCcli.pm index 15de06f6c..609229d51 100644 --- a/perl-xCAT/xCAT/PPCcli.pm +++ b/perl-xCAT/xCAT/PPCcli.pm @@ -33,6 +33,7 @@ my %lssyscfg = ( fsps =>"lssyscfg -r sys -F %s", node =>"lssyscfg -r lpar -m %s -F %s --filter lpar_ids=%s", lpar =>"lssyscfg -r lpar -m %s -F %s", + lpar2 =>"lssyscfg -r lpar -m %s --filter %s", bpa =>"lssyscfg -r frame -e %s -F %s", frame =>"lssyscfg -r frame -e %s -F %s", bpas =>"lssyscfg -r frame -F %s", @@ -44,7 +45,9 @@ my %lssyscfg = ( my %chsyscfg = ( prof =>"chsyscfg -r prof -m %s -i %s", bpa =>"chsyscfg -r frame -e %s -i %s", - fsp =>"chsyscfg -r sys -m %s -i %s" + fsp =>"chsyscfg -r sys -m %s -i %s", + frame =>"chsyscfg -r frame -e %s -i %s", + cec =>"chsyscfg -r sys -m %s -i %s", ); ############################################## @@ -966,7 +969,7 @@ sub mkauthkeys { # When adding, remove old keys first ##################################### foreach ( @$result ) { - unless ( /= $logon$/ ) { + unless ( /$logon$/ ) { push @authkey, $_; } } @@ -1322,21 +1325,28 @@ sub getHMCcontrolIP } my $serial = $ent->{'serial'}; my $mtm = $ent->{'mtm'}; - my $mtms = $mtm . '*' . $serial; - my $nodes_found = lssyscfg( $exp, "$type", "$mtms"); + #my $mtms = $mtm . '*' . $serial; + #my $nodes_found = lssyscfg( $exp, "$type", "$mtms"); + my $nodes_found = lssysconn ($exp, "all"); my @ips; my $ip_result; if ( @$nodes_found[0] eq SUCCESS ) { my $Rc = shift(@$nodes_found); - #foreach my $mtms ( @$nodes_found ) { - my @newnodes = split(/,/, $nodes_found->[0]); - $Rc = shift(@newnodes); - for my $entry (@newnodes) { - if(xCAT::Utils->isIpaddr($entry)) { - push @ips,$entry; - } - $ip_result = join( ",", @ips ); - } + #my @newnodes = split(/,/, $nodes_found->[0]); + #$Rc = shift(@newnodes); + #for my $entry (@newnodes) { + # if(xCAT::Utils->isIpaddr($entry)) { + # push @ips,$entry; + # } + # $ip_result = join( ",", @ips ); + #} + foreach my $entry ( @$nodes_found ) { + if ( $entry =~ /$mtm\*$serial/) { + $entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/; + push @ips, $1; + } + } + $ip_result = join( ",", @ips ); } return $ip_result; } diff --git a/perl-xCAT/xCAT/PPCconn.pm b/perl-xCAT/xCAT/PPCconn.pm index e90c3c795..c4826aa30 100644 --- a/perl-xCAT/xCAT/PPCconn.pm +++ b/perl-xCAT/xCAT/PPCconn.pm @@ -55,32 +55,35 @@ sub mkhwconn_parse_args $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose h|help t p=s P=s port=s s) )) { + if ( !GetOptions( \%opt, qw(V|verbose h|help t p=s P=s port=s s:s) )) { return( usage() ); } return usage() if ( exists $opt{h}); - #if ( exists $opt{s} ) - #{ - # return( usage('Flags -s is just used in direct-attach enviroment.')); - #} - - if ( exists $opt{t} and exists $opt{p}) + if ( !exists $opt{t} and !exists $opt{p} and !exists $opt{s}) { + return ( usage('Flag -t or -p or -s must be used.')); + } + + if (( exists $opt{t} and exists $opt{p}) or (exists $opt{s} and exists $opt{p}) or (exists $opt{t} and exists $opt{p})) { return( usage('Flags -t and -p cannot be used together.')); } - if ( exists $opt{P} and ! exists $opt{p}) + if ( exists $opt{P} and (!exists $opt{p} and !exists $opt{s})) { return( usage('Flags -P can only be used when flag -p is specified.')); } + ########################################## + # Find the sfp for the mkhwconn -s + ########################################## + $request->{sfp} = $opt{s}; ########################################## # Check if CECs are controlled by a frame ########################################## my $nodes = $request->{node}; my $ppctab = xCAT::Table->new( 'ppc' ); - my $nodetypetab = xCAT::Table->new( 'nodetype'); + #my $nodetypetab = xCAT::Table->new( 'nodetype'); my $vpdtab = xCAT::Table->new( 'vpd'); my @bpa_ctrled_nodes = (); my @no_type_nodes = (); @@ -91,9 +94,10 @@ sub mkhwconn_parse_args { my $node_parent = undef; my $nodetype = undef; - my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]); + #my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]); my $node_parent_hash = $ppctab->getNodeAttribs( $node,[qw(parent)]); - $nodetype = $nodetype_hash->{nodetype}; + #$nodetype = $nodetype_hash->{nodetype}; + $nodetype = xCAT::DBobjUtils->getnodetype($node); $node_parent = $node_parent_hash->{parent}; if ( !$nodetype ) { @@ -147,7 +151,7 @@ sub mkhwconn_parse_args if ( $nodetype eq 'frame') { my $my_frame_bpa_cec = xCAT::DBobjUtils::getcecchildren( $node) ; - push @frame_members, @$my_frame_bpa_cec; + push @frame_members, @$my_frame_bpa_cec if($my_frame_bpa_cec); push @frame_members, $node; } } @@ -164,7 +168,7 @@ sub mkhwconn_parse_args my $tmp_nodelist = join ',', @bpa_ctrled_nodes; return ( usage("Node(s) $tmp_nodelist is(are) controlled by BPA.")); } - + if ( scalar( @frame_members)) { my @all_nodes = xCAT::Utils::get_unique_members( @$nodes, @frame_members); @@ -252,7 +256,7 @@ sub lshwconn_parse_args $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose h|help) )) { + if ( !GetOptions( \%opt, qw(V|verbose h|help s) )) { return( usage() ); } return usage() if ( exists $opt{h}); @@ -261,13 +265,15 @@ sub lshwconn_parse_args # Process command-line arguments ############################################# if ( scalar( @ARGV)) { + unless( $opt{s}) { return(usage( "No additional flag is support by this command" )); + } } - my $nodetypetab = xCAT::Table->new('nodetype'); - if (! $nodetypetab) - { - return( ["Failed to open table 'nodetype'.\n"]); - } + #my $nodetypetab = xCAT::Table->new('nodetype'); + #if (! $nodetypetab) + #{ + # return( ["Failed to open table 'nodetype'.\n"]); + #} my $nodehmtab = xCAT::Table->new('nodehm'); if (! $nodehmtab) { @@ -277,9 +283,10 @@ sub lshwconn_parse_args my $nodetype; for my $node ( @{$request->{node}}) { - my $ent = $nodetypetab->getNodeAttribs( $node, [qw(nodetype)]); + #my $ent = $nodetypetab->getNodeAttribs( $node, [qw(nodetype)]); + my $ttype = xCAT::DBobjUtils->getnodetype($node); my $nodehm = $nodehmtab->getNodeAttribs( $node, [qw(mgt)]); - if ( ! $ent) + if ( ! $ttype) { return( ["Failed to get node type for node $node.\n"]); } @@ -291,19 +298,19 @@ sub lshwconn_parse_args { return( ["lshwconn can only support HMC nodes, or nodes managed by HMC, i.e. nodehm.mgt should be 'hmc'. Please make sure node $node has correect nodehm.mgt and ppc.hcp value.\n"]); } - if ( $ent->{nodetype} ne 'hmc' - and $ent->{nodetype} ne 'fsp' and $ent->{nodetype} ne 'cec' - and $ent->{nodetype} ne 'bpa' and $ent->{nodetype} ne 'frame') + if ( $ttype ne 'hmc' + and $ttype ne 'fsp' and $ttype ne 'cec' + and $ttype ne 'bpa' and $ttype ne 'frame') { - return( ["Node type $ent->{nodetype} is not supported for this command.\n"]); + return( ["Node type $ttype is not supported for this command.\n"]); } if ( ! $nodetype) { - $nodetype = $ent->{nodetype}; + $nodetype = $ttype; } else { - if ( $nodetype ne $ent->{nodetype}) + if ( $nodetype ne $ttype) { return( ["Cannot support multiple node types in this command line.\n"]); } @@ -336,7 +343,7 @@ sub rmhwconn_parse_args $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose h|help) )) { + if ( !GetOptions( \%opt, qw(V|verbose h|help s) )) { return( usage() ); } return usage() if ( exists $opt{h}); @@ -345,7 +352,9 @@ sub rmhwconn_parse_args # Process command-line arguments ############################################# if ( scalar (@ARGV)) { + unless( $opt{s}) { return(usage( "No additional flag is support by this command" )); + } } ########################################## # Check if CECs are controlled by a frame @@ -417,7 +426,7 @@ sub rmhwconn_parse_args my $tmp_nodelist = join ',', @bpa_ctrled_nodes; return ( usage("Node(s) $tmp_nodelist is(are) controlled by BPA.")); } - + if ( scalar( @frame_members)) { my @all_nodes = xCAT::Utils::get_unique_members( @$nodes, @frame_members); @@ -500,7 +509,7 @@ sub mkhwconn my $res = xCAT::PPCcli::mksysconn( $exp, $node_ip, $type, $passwd); $Rc = shift @$res; push @value, [$node_name, @$res[0], $Rc]; - if ( !$Rc and !$opt->{s}) + if ( !$Rc and !(exists $opt->{s})) { sethmcmgt( $node_name, $exp->[3]); } @@ -677,7 +686,7 @@ sub rmhwconn my $res = xCAT::PPCcli::rmsysconn( $exp, $type, $nn); $Rc = shift @$res; push @value, [$node_name, @$res[0], $Rc]; - if ( !$Rc) + if ( !$Rc and !$opt->{s}) { rmhmcmgt( $node_name, $type); } diff --git a/perl-xCAT/xCAT/PPCdb.pm b/perl-xCAT/xCAT/PPCdb.pm index 4162aea47..da0eb081e 100644 --- a/perl-xCAT/xCAT/PPCdb.pm +++ b/perl-xCAT/xCAT/PPCdb.pm @@ -43,7 +43,25 @@ my %defaultgrp = ( cec => "cec", ); +my %globlehwtype = ( + fsp => $::NODETYPE_FSP, + bpa => $::NODETYPE_BPA, + lpar => $::NODETYPE_LPAR, + hmc => $::NODETYPE_HMC, + ivm => $::NODETYPE_IVM, + frame => $::NODETYPE_FRAME, + cec => $::NODETYPE_CEC, +); +my %globalnodetype = ( + fsp => $::NODETYPE_PPC, + bpa => $::NODETYPE_PPC, + cec => $::NODETYPE_PPC, + frame=> $::NODETYPE_PPC, + hmc => $::NODETYPE_PPC, + ivm => $::NODETYPE_PPC, + lpar =>"$::NODETYPE_PPC,$::NODETYPE_OSI" +); ########################################################################## # Adds a node to the xCAT databases @@ -56,16 +74,6 @@ sub add_ppc { my $otherinterfaces = shift; my @tabs = qw(ppc vpd nodehm nodelist nodetype hosts mac); my %db = (); - my %nodetype = ( - fsp => $::NODETYPE_FSP, - bpa => $::NODETYPE_BPA, - lpar =>"$::NODETYPE_LPAR,$::NODETYPE_OSI", - hmc => $::NODETYPE_HMC, - ivm => $::NODETYPE_IVM, - frame => $::NODETYPE_FRAME, - cec => $::NODETYPE_CEC, - ); - ################################### # Open database needed ################################### @@ -94,8 +102,11 @@ sub add_ppc { ############################### # Update nodetype table ############################### - if ( $type =~ /^(fsp|bpa|lpar|hmc|ivm|frame|cec)$/ ) { - $db{nodetype}->setNodeAttribs( $name,{nodetype=>$nodetype{$type}} ); + if ( $type =~ /^(fsp|bpa|hmc|ivm|frame|cec)$/ ) { + $db{nodetype}->setNodeAttribs( $name,{nodetype=>'ppc'} ); + $db{nodetype}{commit} = 1; + } elsif ($type =~ /^lpar$/) { + $db{nodetype}->setNodeAttribs( $name,{nodetype=>'ppc,osi'} ); $db{nodetype}{commit} = 1; } ############################### @@ -147,7 +158,7 @@ sub add_ppc { id=>$id, pprofile=>$pprofile, parent=>$parent, - nodetype=>$nodetype{$type}, + nodetype=>$globlehwtype{$type}, }); $db{ppc}{commit} = 1; @@ -176,14 +187,20 @@ sub add_ppc { ############################### # Update vpd table ############################### - if ( $type =~ /^(fsp|bpa|frame|cec)$/ ) { + if ( $type =~ /^(fsp|bpa)$/ ) { $db{vpd}->setNodeAttribs( $name, { mtm=>$model, serial=>$serial, side=>$side }); - $db{vpd}{commit} = 1; + } + if ( $type =~ /^(frame|cec)$/ ) { + $db{vpd}->setNodeAttribs( $name, + { mtm=>$model, + serial=>$serial, + }); } + $db{vpd}{commit} = 1; ############################### # Update hosts table @@ -228,15 +245,7 @@ sub update_ppc { my $not_overwrite = shift; my @tabs = qw(ppc vpd nodehm nodelist nodetype ppcdirect hosts mac); my %db = (); - my %nodetype = ( - fsp => $::NODETYPE_FSP, - bpa => $::NODETYPE_BPA, - lpar =>"$::NODETYPE_LPAR,$::NODETYPE_OSI", - hmc => $::NODETYPE_HMC, - ivm => $::NODETYPE_IVM, - ); my @update_list = (); - my @create_list = (); ################################### # Open database needed @@ -253,58 +262,6 @@ sub update_ppc { 'pprofile','parent','supernode', 'comments', 'disable']); my @maclist = $db{mac}->getAllNodeAttribs(['node','mac']); - - ################################### - # By pass the CEC/Frame with same - # mtms and node name - ################################### - my %cec_frame_hash = (); - foreach my $value ( @$values ) { - my ($ttype, - $tname, - $tid, - $tmtm, - $tsn, - $tside, - $server, - $pprofile, - $parent, - $ips ) = split /,/, $value; - - if ( $ttype ne 'cec' && $ttype ne 'frame' ) - { - next; - } - - foreach my $vpdent (@vpdlist) { - my $type = xCAT::DBobjUtils::getnodetype($vpdent->{node}); - if ( $vpdent->{mtm} eq $tmtm && $vpdent->{serial} eq $tsn && $type eq $ttype) { - $cec_frame_hash{$tmtm*$tsn} = $tname; - } - } - - foreach my $vpdent (@vpdlist) { - my $type = xCAT::DBobjUtils::getnodetype($vpdent->{node}); - if ( $vpdent->{mtm} eq $tmtm && $vpdent->{serial} eq $tsn ) { - if ( $type eq $ttype ) { - if ( $vpdent->{node} ne $tname ) { - if ( update_node_attribs($hwtype, $ttype, $tname, $tid, $tmtm, $tsn, $tside, - $server, $pprofile, $parent, $ips, \%db, $vpdent->{node}, \@ppclist)) - { - push @update_list, $value; - } - } - } else { - if ( !$cec_frame_hash{$tmtm*$tsn} ) { - push @create_list, $value; - } - } - $cec_frame_hash{$tmtm*$tsn} = $tname; - } - } - } - - ################################### # Need to do database migration first ################################### @@ -322,127 +279,111 @@ sub update_ppc { if ( $ttype eq 'cec' ) { - foreach my $vpdent (@vpdlist) { - my $type = xCAT::DBobjUtils::getnodetype($vpdent->{node}); - if ( $vpdent->{mtm} eq $tmtm && $vpdent->{serial} eq $tsn && $type eq 'fsp' ) { - my $newname = $vpdent->{node}; - if ( $vpdent->{node} eq $tname ) { - if ( $vpdent->{side} =~ /^(A|B)$/ ) { - $newname = $tname . "-" . $vpdent->{side}; - } - } - - my $pparent = $cec_frame_hash{$tmtm*$tsn}; - if ( update_node_attribs($hwtype, $type, $newname, $tid, $tmtm, $tsn, $tside, - $server, $pprofile, $pparent, $ips, \%db, $vpdent->{node}, 1, \@ppclist)) - { - push @update_list, $value; - } + my $hostname = xCAT_plugin::lsslp::gethost_from_url_or_old($tname, "FSP", $tmtm, $tsn, "", "", $tid, "",""); + if ($hostname ne $tname) + { + $hostname =~ /\-(\w)$/; + if ($1 =~ /^(A|B)$/) + { + $tside = $1; + } + if ( update_node_attribs($hwtype, $ttype, $hostname, $tid, $tmtm, $tsn, $tside, + $server, $pprofile, $parent, $ips, \%db, $tname, \@ppclist)) + { + push @update_list, $value; } } } elsif ( $ttype eq 'frame' ) { - foreach my $vpdent (@vpdlist) { - my $type = xCAT::DBobjUtils::getnodetype($vpdent->{node}); - if ( $vpdent->{mtm} eq $tmtm && $vpdent->{serial} eq $tsn && $type eq 'bpa' ) { - my $newname = $vpdent->{node}; - if ( $vpdent->{node} eq $tname ) { - if ( $vpdent->{side} =~ /^(A|B)$/ ) { - $newname = $tname . "-" . $vpdent->{side}; - } - } - - my $pparent = $cec_frame_hash{$tmtm*$tsn}; - if ( update_node_attribs($hwtype, $type, $newname, $tid, $tmtm, $tsn, $tside, - $server, $pprofile, $pparent, $ips, \%db, $vpdent->{node}, 1, \@ppclist)) - { - push @update_list, $value; - } + my $hostname = xCAT_plugin::lsslp::gethost_from_url_or_old($tname, "BPA", $tmtm, $tsn, "", "", $tid, "",""); + if ($hostname ne $tname) + { + $hostname =~ /\-(\w)$/; + if ($1 =~ /^(A|B)$/) + { + $tside = $1; } - } - } + if ( update_node_attribs($hwtype, $ttype, $hostname, $tid, $tmtm, $tsn, $tside, + $server, $pprofile, $parent, $ips, \%db, $tname, \@ppclist)) + { + push @update_list, $value; + } + } + } } ################################### - # Add the CEC/Frame object if they - # are not existing. + # Update CEC in tables ################################### - add_ppc($hwtype, \@create_list); + foreach my $value ( @$values ) { + my ($type, + $name, + $id, + $model, + $serial, + $side, + $server, + $pprofile, + $parent, + $ips ) = split /,/, $value; + + next if ( $type ne 'cec' ); + my $predefined_node = undef; + foreach my $vpdent (@vpdlist) + { + if ( $vpdent->{mtm} eq $model && $vpdent->{serial} eq $serial ) + { + $predefined_node = $vpdent->{node}; + if ( update_node_attribs($hwtype, $type, $name, $id, $model, $serial, $side, + $server, $pprofile, $parent, $ips, + \%db, $predefined_node, \@ppclist)) + { + push @update_list, $value; + } + } + } + } - # ################################### - # # Update CEC in tables - # ################################### - # foreach my $value ( @$values ) { - # my ($type, - # $name, - # $id, - # $model, - # $serial, - # $side, - # $server, - # $pprofile, - # $parent, - # $ips ) = split /,/, $value; - # - # next if ( $type ne 'cec' ); + my @newppclist = $db{ppc}->getAllNodeAttribs(['node','hcp','id', + 'pprofile','parent','supernode', + 'comments', 'disable']); + ################################### + # Update FRAME in tables + ################################### + foreach my $value ( @$values ) { + my ($type, + $name, + $id, + $model, + $serial, + $side, + $server, + $pprofile, + $parent, + $ips ) = split /,/, $value; + + next if ( $type ne 'frame'); - # my $predefined_node = undef; - # foreach my $vpdent (@vpdlist) - # { - # if ( $vpdent->{mtm} eq $model && $vpdent->{serial} eq $serial ) - # { - # $predefined_node = $vpdent->{node}; - # if ( update_node_attribs($hwtype, $type, $name, $id, $model, $serial, $side, - # $server, $pprofile, $parent, $ips, - # \%db, $predefined_node, 0, \@ppclist)) - # { - # push @update_list, $value; - # } - # } - # } - - # } - -# my @newppclist = $db{ppc}->getAllNodeAttribs(['node','hcp','id', -# 'pprofile','parent','supernode', - # 'comments', 'disable']); - # ################################### - # # Update FRAME in tables - # ################################### - # foreach my $value ( @$values ) { - # my ($type, - # $name, - # $id, - # $model, - # $serial, - # $side, - # $server, - # $pprofile, - # $parent, - # $ips ) = split /,/, $value; - # - # next if ( $type ne 'frame'); - - # my $predefined_node = undef; - # foreach my $vpdent (@vpdlist) - # { - # if ( $vpdent->{mtm} eq $model && $vpdent->{serial} eq $serial && $vpdent->{side} eq $side ) - # { - # $predefined_node = $vpdent->{node}; + my $predefined_node = undef; + foreach my $vpdent (@vpdlist) + { + if ( $vpdent->{mtm} eq $model && $vpdent->{serial} eq $serial && $vpdent->{side} eq $side ) + { + $predefined_node = $vpdent->{node}; - # if (update_node_attribs($hwtype, $type, $name, $id, $model, $serial, $side, - # $server, $pprofile, $parent, $ips, - # \%db, $predefined_node, 0, \@newppclist)) - # { - # push @update_list, $value; - # } - # } - # } + if (update_node_attribs($hwtype, $type, $name, $id, $model, $serial, $side, + $server, $pprofile, $parent, $ips, + \%db, $predefined_node, \@newppclist)) + { + push @update_list, $value; + } + } + } - # } + } ################################### # Commit changes @@ -473,7 +414,6 @@ sub update_node_attribs my $ips = shift; my $db = shift; my $predefined_node = shift; - my $hidden = shift; my $ppclist = shift; my $updated = undef; @@ -483,12 +423,9 @@ sub update_node_attribs ############################# # update vpd table ############################# - my $vpdhash = $db->{vpd}->getNodeAttribs( $predefined_node, [qw(mtm serial side)]); + my $vpdhash = $db->{vpd}->getNodeAttribs( $predefined_node, [qw(mtm serial)]); if ( $model ne $vpdhash->{mtm} or $serial ne $vpdhash->{serial} or $namediff) { - if ( !$side ) { - $side = $vpdhash->{side}; - } $db->{vpd}->delEntries( $key_col) if ( $namediff); $db->{vpd}->setNodeAttribs( $name, { mtm=>$model, serial=>$serial, side=>$side}); $db->{vpd}->{commit} = 1; @@ -519,17 +456,17 @@ sub update_node_attribs ############################# # update ppc table ############################# - my $ppchash = $db->{ppc}->getNodeAttribs( $predefined_node, [qw(hcp id pprofile parent nodetype)]); + my $ppchash = $db->{ppc}->getNodeAttribs( $predefined_node, [qw(hcp id pprofile parent)]); + if ( $ppchash->{parent} ne $predefined_node ) + { + $parent = $ppchash->{parent}; + } -# if ( $ppchash->{parent} ne $predefined_node ) -# { -# $parent = $ppchash->{parent}; -# } -# if ( $server ne $ppchash->{hcp} or $id ne $ppchash->{id} or $pprofile ne $ppchash->{pprofile} or $parent ne $ppchash->{parent} or + $type ne $ppchash->{nodetype} or $namediff) { $db->{ppc}->delEntries( $key_col) if ( $namediff); @@ -538,6 +475,7 @@ sub update_node_attribs id=>$id, pprofile=>$pprofile, parent=>$parent, + nodetype=>$globlehwtype{$type}, }); if ( $namediff) { @@ -546,12 +484,7 @@ sub update_node_attribs next if ($ppcent->{node} eq $predefined_node); if ($ppcent->{parent} eq $predefined_node) { - my $type = xCAT::DBobjUtils->getnodetype($predefined_node); - if ($type eq 'fsp' or $type eq 'bpa') { - $db->{ppc}->setNodeAttribs( $ppcent->{node}, {parent=>$parent}); - } else { - $db->{ppc}->setNodeAttribs( $ppcent->{node}, {parent=>$name}); - } + $db->{ppc}->setNodeAttribs( $ppcent->{node}, {parent=>$name}); } } } @@ -578,7 +511,7 @@ sub update_node_attribs if ( $type ne $nodetypehash->{nodetype} or $namediff) { $db->{nodetype}->delEntries( $key_col) if ( $namediff); - $db->{nodetype}->setNodeAttribs( $name,{nodetype=>$type} ); + $db->{nodetype}->setNodeAttribs( $name,{nodetype=>$globalnodetype{$type}} ); $db->{nodetype}->{commit} = 1; $updated = 1; } @@ -586,7 +519,7 @@ sub update_node_attribs ########################### # Update nodelist table ########################### - my $nodelisthash = $db->{nodelist}->getNodeAttribs( $predefined_node, [qw(groups status appstatus primarysn hidden comments disable)]); + my $nodelisthash = $db->{nodelist}->getNodeAttribs( $predefined_node, [qw(groups status appstatus primarysn comments disable)]); if ( $namediff) { updategroups( $name, $db->{nodelist}, $type ); @@ -594,18 +527,11 @@ sub update_node_attribs appstatus=>$nodelisthash->{appstatus}, primarysn=>$nodelisthash->{primarysn}, comments=>$nodelisthash->{comments}, - hidden=>$nodelisthash->{hidden}, disable=>$nodelisthash->{disable} }); $db->{nodelist}->delEntries( $key_col); $db->{nodelist}->{commit} = 1; $updated = 1; - } - if ( $hidden ne $nodelisthash->{hidden} ) - { - $db->{nodelist}->setNodeAttribs( $name, {hidden=>$hidden}); - $db->{nodelist}->{commit} = 1; - $updated = 1; } ########################### @@ -614,7 +540,6 @@ sub update_node_attribs my $hostslisthash = $db->{hosts}->getNodeAttribs( $predefined_node, [qw(ip otherinterfaces)]); if ( $namediff ) { - $ips = $hostslisthash->{ip} if (!$ips); $db->{hosts}->delEntries( $key_col); $db->{hosts}->setNodeAttribs( $name,{ip=>$ips, otherinterfaces=>$hostslisthash->{otherinterfaces} @@ -677,7 +602,7 @@ sub add_ppchcp { my $hwtype = shift; my $values = shift; - my @tabs = qw(ppchcp nodehm nodelist nodetype mac); + my @tabs = qw(ppchcp nodehm nodelist nodetype mac ppc); my %db = (); my ($name, $mac) = split ',', $values; @@ -709,7 +634,8 @@ sub add_ppchcp { ################################### # Update nodetype table ################################### - $db{nodetype}->setNodeAttribs( $name, {nodetype=>lc($hwtype)}); + $db{nodetype}->setNodeAttribs( $name, {nodetype=>$globalnodetype{$hwtype}}); + $db{ppc}->setNodeAttribs( $name, {nodetype=>$globlehwtype{$hwtype}}); ################################### # Update mac table diff --git a/perl-xCAT/xCAT/PPCenergy.pm b/perl-xCAT/xCAT/PPCenergy.pm index f333dbabf..f357083d1 100644 --- a/perl-xCAT/xCAT/PPCenergy.pm +++ b/perl-xCAT/xCAT/PPCenergy.pm @@ -22,6 +22,13 @@ use xCAT::DBobjUtils; 'CPUspeed' => 1, 'syssbpower' => 1, 'sysIPLtime' => 1, +# for FFO, only supported when communicating to fsp directly +'ffoMin' => 1, +'ffoVmin' => 1, +'ffoTurbo' => 1, +'ffoNorm' => 1, +'fsavingstatus' => 1, +'ffovalue' => 1, ); %::SET_ATTRS = ( @@ -30,6 +37,9 @@ use xCAT::DBobjUtils; 'cappingstatus' => 1, 'cappingwatt' => 1, 'cappingperc' => 1, +# for FFO +'fsavingstatus' => 1, +'ffovalue' => 1, ); $::CIM_CLIENT_PATH = "$::XCATROOT/sbin/xCAT_cim_client"; @@ -84,7 +94,7 @@ sub parse_args { return (&usage()); } - if ($set_attr eq "savingstatus" + if (($set_attr eq "savingstatus" || $set_attr eq "fsavingstatus") && ($set_value ne "on" && $set_value ne "off")) { return (&usage()); } elsif ($set_attr eq "dsavingstatus" @@ -95,7 +105,7 @@ sub parse_args { && ($set_value ne "on" && $set_value ne "off")) { return (&usage()); } elsif ( ($set_attr eq "cappingwatt" - || $set_attr eq "cappingperc") + || $set_attr eq "cappingperc" || $set_attr eq "ffovalue") && $set_value =~ /\D/) { return (&usage()); } @@ -160,19 +170,22 @@ sub parse_args { } # Check whether the hardware type of nodes are fsp or cec - my $nodetype_tb = xCAT::Table->new('nodetype'); - unless ($nodetype_tb) { - return ([undef, "Error: Cannot open the nodetype table"]); - } + #my $nodetype_tb = xCAT::Table->new('nodetype'); + #unless ($nodetype_tb) { + # return ([undef, "Error: Cannot open the nodetype table"]); + #} - my $nodetype_v = $nodetype_tb->getNodesAttribs($nodes, ['nodetype']); + #my $nodetype_v = $nodetype_tb->getNodesAttribs($nodes, ['nodetype']); + my $nodetyperef = xCAT::DBobjUtils->getnodetype($nodes); + my $i = 0; foreach my $node (@{$nodes}) { - if ($nodetype_v->{$node}->[0]->{'nodetype'} ne 'fsp' && - $nodetype_v->{$node}->[0]->{'nodetype'} ne 'cec') { + if (@$nodetyperef[$i] ne 'fsp' && + @$nodetyperef[$i] ne 'cec') { push @notfspnodes, $node; } + $i++; } - $nodetype_tb->close(); + #$nodetype_tb->close(); if (@notfspnodes) { return ([undef, "Error: The hardware type of following nodes are not fsp or cec: ".join(',', @notfspnodes)]); diff --git a/perl-xCAT/xCAT/PPCfsp.pm b/perl-xCAT/xCAT/PPCfsp.pm index 86e920d2b..d1cbbbc8d 100644 --- a/perl-xCAT/xCAT/PPCfsp.pm +++ b/perl-xCAT/xCAT/PPCfsp.pm @@ -9,6 +9,7 @@ use HTML::Form; use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR); use xCAT::Usage; use Socket; +use xCAT::PPCdb; ########################################## @@ -35,7 +36,9 @@ my %cmds = ( autopower => ["Auto Power Restart", \&autopower], sysdump => ["System Dump", \&sysdump], spdump => ["Service Processor Dump", \&spdump], - network => ["Network Configuration", \&netcfg]}, + network => ["Network Configuration", \&netcfg], + dev => ["Service Processor Command Line", \&devenable], + celogin1 => ["Service Processor Command Line", \&ce1enable]}, ); @@ -62,8 +65,9 @@ sub handler { foreach ( @$result ) { my %output; - $output{node}->[0]->{name}->[0] = $server; - $output{node}->[0]->{data}->[0]->{contents}->[0] = @$_[1]; + $output{node}->[0]->{name}->[0] = $request->{host}; + $output{node}->[0]->{data}->[0]->{contents}->[0] = $server. ": ".@$_[1]; + $output{node}->[0]->{cmd}->[0] = @$_[2]; $output{errorcode} = @$_[0]; push @outhash, \%output; } @@ -96,8 +100,13 @@ sub connect { ################################## # Get userid/password ################################## - my $cred = $req->{$server}{cred}; - + my $cred = undef; + if (($req->{dev} eq '1') or ($req->{command} eq 'rpower')) { + my @cred_array = xCAT::PPCdb::credentials($server, $req->{hwtype}, "celogin"); + $cred = \@cred_array; + } else { + $cred = $req->{$server}{cred}; + } ################################## # Redirect STDERR to variable ################################## @@ -132,7 +141,7 @@ sub connect { ################################## my $hosttab = xCAT::Table->new( 'hosts' ); if ( $hosttab) { - my $hostshash = $hosttab->getNodeAttribs( $server, [qw(otherinterfaces)]); + my $hostshash = $hosttab->getNodeAttribs( $server, [qw(ip otherinterfaces)]); if ( $hostshash ) { $server = $hostshash->{ip}; } @@ -196,11 +205,116 @@ sub connect { return( $lwp_log."Logon failure" ); } +sub ce1enable { + return &loginenable($_[0], $_[1], $_[2], "celogin1"); +} +sub devenable { + return &loginenable($_[0], $_[1], $_[2], "dev"); +} +my %cmdline_for_log = ( + dev => { + enable => "registry -Hw nets/DevEnabled 1", + disable => "registry -Hw nets/DevEnabled 0", + check_pwd => "registry -l DevPwdFile", + create_pwd => "netsDynPwdTool --create dev FipSdev", + password => "FipSdev" + }, + celogin1 => { + enable => "registry -Hw nets/CE1Enabled 1", + disable => "registry -Hw nets/CE1Enabled 0", + check_pwd => "registry -l Ce1PwdFile", + create_pwd => "netsDynPwdTool --create celogin1 FipSce1", + password => "FipSce1" + }, + ); +sub send_command { + my $ua = shift; + my $server = shift; + my $id = shift; + my $log_name = shift; + my $cmd = shift; + my $cmd_line = $cmdline_for_log{$log_name}{$cmd}; + if (!defined($cmd_line)) { + return undef; + } + my $res = $ua->post( "https://$server/cgi-bin/cgi", + [ form => $id, + cmd => $cmd_line, + submit => "Execute" ] + ); -########################################################################## -# Logoff through remote FSP HTTP-interface -########################################################################## + if ( !$res->is_success() ) { + return undef; + } + if ( $res->content =~ /(not allowed.*\.|Invalid entry)/ ) { + return undef; + } + return $res->content; +} +sub loginstate { + my $ua = shift; + my $server = shift; + my $log_name = shift; + my $url = "https://$server/cgi-bin/cgi?form=4"; + my $res = $ua->get($url); + if (!$res->is_success()) { + return ([RC_ERROR, $res->status_line]); + } + if ($res->content =~ m#[\d\D]+Status[\d\D]+$log_name]*>(\w+)#) { + my $out = sprintf("%9s: %8s", $log_name, $1); + return ( [SUCCESS, $out]); + } else { + return ( [RC_ERROR, "not found status for $log_name"]); + } +} + +sub loginenable { + my $exp = shift; + my $request = shift; + my $id = shift; + my $log_name = shift; + my $ua = @$exp[0]; + my $server = @$exp[1]; + + my $value = $request->{method}{$log_name}; + if (!defined($value)) { + return &loginstate($ua, $server, $log_name); + } + my $url = "https://$server/cgi-bin/cgi?form=$id"; + my $res = $ua->get( $url ); + if (!$res->is_success()) { + return( [RC_ERROR,$res->status_line] ); + } + + $res = &send_command($ua, $server, $id, $log_name, $value); + if (!defined($res)) { + return ([RC_ERROR, "Send command Failed"]); + } + if ( $value =~ m/^disable$/ ) { + my $out = sprintf("%9s: Disabled", $log_name); + return( [SUCCESS, $out] ); + } +#check password# + $res = &send_command($ua, $server, $id, $log_name, "check_pwd"); + if (!defined($res)) { + return ([RC_ERROR, "Send command Failed"]); + } + my $password = undef; + if ($res =~ m/\[\d+([a-zA-Z]+)\d+\]/) { + $password = $1; + } else { +# create password # + $res = &send_command($ua, $server, $id, $log_name, "create_pwd"); + if (!defined($res)) { + return ([RC_ERROR, "Send command Failed"]); + } + $password = $cmdline_for_log{$log_name}{password}; + print "create password for $log_name is '$cmdline_for_log{$log_name}{password}'\n"; + } + my $out = sprintf("%9s: Enabled, password: $password", $log_name); + return( [SUCCESS, $out] ); +} sub disconnect { my $exp = shift; @@ -276,6 +390,7 @@ sub process_cmd { # Run command ################################## my $res = $cmds{$command}{$_}[1]($exp, $request, $form, \%menu); + push @$res, $_; push @result, $res; } return( \@result ); @@ -1873,7 +1988,7 @@ sub set_netcfg } #Go to the confirm page - if ( $res->content !~ /\Qcontent !~ /content; my @lines_to_print; diff --git a/perl-xCAT/xCAT/PPCmac.pm b/perl-xCAT/xCAT/PPCmac.pm index f554d0732..9591e14e9 100644 --- a/perl-xCAT/xCAT/PPCmac.pm +++ b/perl-xCAT/xCAT/PPCmac.pm @@ -142,7 +142,8 @@ sub parse_args { $client_nethash{@$node[0]} = $client_nethash{$tmpll}; } } else { - return( [RC_ERROR,"Cannot get network information for node"] ); + my $nodes = join( ",", @$node); + return( [RC_ERROR,"Cannot get network information for $nodes, check networks table and IP address for this node to make sure there is correct network in networks table"] ); } } diff --git a/perl-xCAT/xCAT/PPCpower.pm b/perl-xCAT/xCAT/PPCpower.pm index 201c6b132..5a4184750 100644 --- a/perl-xCAT/xCAT/PPCpower.pm +++ b/perl-xCAT/xCAT/PPCpower.pm @@ -16,7 +16,7 @@ sub parse_args { my $command = $request->{command}; my $args = $request->{arg}; my %opt = (); - my @rpower = qw(on onstandby off softoff stat state reset boot of sms rackstandby exit_rackstandby lowpower); + my @rpower = qw(on onstandby off softoff stat state reset boot of sms rackstandby exit_rackstandby lowpower resetsp); ############################################# # Responds with usage statement diff --git a/perl-xCAT/xCAT/PPCrflash.pm b/perl-xCAT/xCAT/PPCrflash.pm index b663a2ee2..3e0dcde3a 100644 --- a/perl-xCAT/xCAT/PPCrflash.pm +++ b/perl-xCAT/xCAT/PPCrflash.pm @@ -256,13 +256,14 @@ sub noderange_validate { ########################################### foreach my $node ( @$noderange ) { my $type = undef; - my $sitetab = xCAT::Table->new( 'nodetype' ); - if ( defined( $sitetab )) { - my ($ent) = $sitetab->getAttribs({ node=>$node},'nodetype'); - if ( defined($ent) ) { - $type = $ent->{nodetype}; - } - } + #my $sitetab = xCAT::Table->new( 'nodetype' ); + #if ( defined( $sitetab )) { + # my ($ent) = $sitetab->getAttribs({ node=>$node},'nodetype'); + # if ( defined($ent) ) { + # $type = $ent->{nodetype}; + # } + #} + $type = xCAT::DBobjUtils->getnodetype($node); #print "type:$type\n"; if( $type =~/(fsp|lpar|cec)/) { $f1 = 1; @@ -271,11 +272,11 @@ sub noderange_validate { my $exargs=$request->{arg}; #my $t = print_var($exargs, "exargs"); #print $t; - if ( grep(/commit/,@$exargs) != 0 || grep(/recover/,@$exargs) != 0) { - send_msg( $request, 1, "When run \"rflash\" with the \"commit\" or \"recover\" operation, the noderange cannot be BPA and can only be CEC or LPAR."); - send_msg( $request, 1, "And then, it will do the operation for both managed systems and power subsystems."); - return -1; - } + #if ( grep(/commit/,@$exargs) != 0 || grep(/recover/,@$exargs) != 0) { + # send_msg( $request, 1, "When run \"rflash\" with the \"commit\" or \"recover\" operation, the noderange cannot be BPA and can only be CEC or LPAR."); + # send_msg( $request, 1, "And then, it will do the operation for both managed systems and power subsystems."); + # return -1; + # } } } @@ -634,7 +635,7 @@ sub rflash { } else { while(my ($name, $d) = each(%$h)) { if ( @$d[4] !~ /^(fsp|bpa|lpar|cec|frame)$/ ) { - push @value, [$name,"Information only available for LPAR/CEC/BPA",RC_ERROR]; + push @value, [$name,"Information only available for LPAR/CEC/BPA/Frame",RC_ERROR]; next; } diff --git a/perl-xCAT/xCAT/PPCscan.pm b/perl-xCAT/xCAT/PPCscan.pm index 38f45faa6..1284e84a6 100644 --- a/perl-xCAT/xCAT/PPCscan.pm +++ b/perl-xCAT/xCAT/PPCscan.pm @@ -24,11 +24,20 @@ my @header = ( ["serial-number", "%-15s" ], ["side", "%-6s\n" ]); -my @attribs = qw(nodetype node id mtm serial side hcp pprofile parent groups mgt cons); -my %nodetype = ( +my @attribs = qw(nodetype node id mtm serial side hcp pprofile parent groups mgt cons hwtype); +my %globalnodetype = ( + fsp => $::NODETYPE_PPC, + bpa => $::NODETYPE_PPC, + cec => $::NODETYPE_PPC, + frame=> $::NODETYPE_PPC, + lpar =>"$::NODETYPE_PPC,$::NODETYPE_OSI" +); +my %globalhwtype = ( fsp => $::NODETYPE_FSP, bpa => $::NODETYPE_BPA, - lpar =>"$::NODETYPE_LPAR,$::NODETYPE_OSI" + lpar => $::NODETYPE_LPAR, + cec => $::NODETYPE_CEC, + frame=> $::NODETYPE_FRAME, ); @@ -538,7 +547,9 @@ sub format_stanza { if ( /^node$/ ) { next; } elsif ( /^nodetype$/ ) { - $d = $type; + $d = $globalnodetype{$type}; + } elsif ( /^hwtype$/ ) { + $d = $globalhwtype{$type}; } elsif ( /^groups$/ ) { $d = "$type,all"; } elsif ( /^mgt$/ ) { @@ -554,6 +565,10 @@ sub format_stanza { if ( $type eq "lpar" ) { $d = undef; } + } elsif (/^side$/) { + unless ( $type =~ /^fsp|bpa$/ ) { + next; + } } $result .= "\t$_=$d\n"; } @@ -608,7 +623,9 @@ sub format_xml { my $d = $data[$i++]; if ( /^nodetype$/ ) { - $d = $nodetype{$d}; + $d = $globalnodetype{$type}; + } elsif ( /^hwtype$/ ) { + $d = $globalhwtype{$type}; } elsif ( /^groups$/ ) { $d = "$type,all"; } elsif ( /^mgt$/ ) { @@ -623,6 +640,10 @@ sub format_xml { if ( $type eq "lpar" ) { $d = undef; } + } elsif (/^side$/) { + unless ( $type =~ /^fsp|bpa$/ ) { + next; + } } $href->{Node}->{$_} = $d; } diff --git a/perl-xCAT/xCAT/PPCvitals.pm b/perl-xCAT/xCAT/PPCvitals.pm index 3ea820b45..3d1786099 100644 --- a/perl-xCAT/xCAT/PPCvitals.pm +++ b/perl-xCAT/xCAT/PPCvitals.pm @@ -56,6 +56,13 @@ sub parse_args { if ( !defined( $cmd )) { return(usage( "Invalid command: $ARGV[0]" )); } + + if($ARGV[0] =~ /^rackenv$/) { + if($request->{hwtype} =~ /^hmc$/) { + return(usage( "Command $ARGV[0] is not valid when the nodes' hcp is hmc" )); + } + } + #################################### # Check for an extra argument #################################### diff --git a/perl-xCAT/xCAT/PPCvm.pm b/perl-xCAT/xCAT/PPCvm.pm index db3a85e79..ae3e0f225 100644 --- a/perl-xCAT/xCAT/PPCvm.pm +++ b/perl-xCAT/xCAT/PPCvm.pm @@ -7,6 +7,7 @@ use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR); use xCAT::PPCdb; use xCAT::Usage; use xCAT::NodeRange; +use Data::Dumper; ############################################## @@ -56,7 +57,7 @@ sub chvm_parse_args { ############################################# # Process command-line arguments ############################################# - if ( !defined( $args )) { + if ( !defined( $args ) && !defined( $request->{stdin} ) ) { $request->{method} = $cmd; return( usage() ); } @@ -65,7 +66,8 @@ sub chvm_parse_args { # to be grouped (e.g. -vx), and terminates # at the first unrecognized option. ############################################# - @ARGV = @$args; + if ($args) { @ARGV = @$args; } + else { @ARGV = (); } $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); @@ -663,7 +665,7 @@ sub remove { # Remove the LPARs #################################### foreach ( @lpars ) { - my $lparinfo = shift(@lpars); + my $lparinfo = $_; # shift(@lpars); my ($name,$id) = split /,/, $lparinfo; my $mtms = @$d[2]; @@ -708,7 +710,7 @@ sub remove { # Remove LPAR from database ################################ if ( $Rc == SUCCESS and !exists( $opt->{r} ) ) { - my $err = xCATdB( "rmvm", $name ); + my $err = xCATdB( "rmvm", $name,"", $id,"", $type,"" , $lpar ); if ( defined( $err )) { push @values, [$lpar,$err,RC_ERROR]; next; @@ -1215,7 +1217,24 @@ sub list { $count++; } } else { - $pprofile .= "@$prof[0]\n\n"; + #$pprofile .= "@$prof[0]\n\n"; + my $lparprof = xCAT::PPCcli::lssyscfg( + $exp, + "lpar2", + $mtms, + "lpar_ids=$id" ); + my $Rc = shift(@$lparprof); + if ( $Rc != SUCCESS ) { + $pprofile .= "@$lparprof[0]\n\n"; + } else { + @$lparprof[0] =~ /curr_profile=(\w+)/; + my $pname = $1; + foreach my $pr (@$prof) { + if ($pr =~ /name=$pname/) { + $pprofile .= "$pr\n\n"; + } + } + } } } $values->{$lpar} = [$lpar, $pprofile, SUCCESS]; @@ -1780,7 +1799,20 @@ sub xCATdB { # Remove entry ####################################### if ( $cmd eq "rmvm" ) { - return( xCAT::PPCdb::rm_ppc( $name )); + + my $ppctab = xCAT::Table->new('ppc'); + unless ($ppctab) { # no ppc table + return( "Error opening 'ppc' database" ); + } + + my @nodes = $ppctab->getAllNodeAttribs(['node','id','parent']); + + foreach my $node (@nodes) { + my $type = xCAT::DBobjUtils->getnodetype($node->{node}); + if ( $type =~ /lpar/ and $lparid eq $node->{id} and $parent eq $node->{parent} ) { + return( xCAT::PPCdb::rm_ppc( $node->{node} )); + } + } } ####################################### # Change entry diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 8934aa00b..264b83ab0 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -167,7 +167,7 @@ vmmaster => { #storagemodel to allow chvm on a clone to be consistent with the master by default #nics to track the network mapping that may not be preserved by the respective plugin's specific cfg info #nicmodel same as storagemodel, except omitting for now until chvm actually does nics... - cols => [qw(name os arch profile storage storagemodel nics vintage originator comments disable)], + cols => [qw(name os arch profile storage storagemodel nics vintage originator virttype comments disable)], keys => [qw(name)], nodecol => 'name', #well what do you know, I used it... table_desc => 'Inventory of virtualization images for use with clonevm. Manual intervention in this table is not intended.', @@ -265,6 +265,7 @@ boottarget => { bootparams => { cols => [qw(node kernel initrd kcmdline addkcmdline dhcpstatements adddhcpstatements comments disable)], keys => [qw(node)], + tablespace =>'XCATTBS16K', table_desc => 'Current boot settings to be sent to systems attempting network boot for deployment, stateless, or other reasons. Mostly automatically manipulated by xCAT.', descriptions => { 'node' => 'The node or group name', @@ -348,6 +349,7 @@ ipmi => { iscsi => { cols => [qw(node server target lun iname file userid passwd kernel kcmdline initrd comments disable)], keys => [qw(node)], + tablespace =>'XCATTBS16K', table_desc => 'Contains settings that control how to boot a node from an iSCSI target', descriptions => { node => 'The node name or group name.', @@ -368,6 +370,7 @@ iscsi => { mac => { cols => [qw(node interface mac comments disable)], keys => [qw(node)], + tablespace =>'XCATTBS16K', table_desc => "The MAC address of the node's install adapter. Normally this table is populated by getmacs or node discovery, but you can also add entries to it manually.", descriptions => { node => 'The node name or group name.', @@ -428,7 +431,7 @@ mpa => { }, }, networks => { - cols => [qw(netname net mask mgtifname gateway dhcpserver tftpserver nameservers ntpservers logservers dynamicrange nodehostname ddnsdomain vlanid comments disable)], + cols => [qw(netname net mask mgtifname gateway dhcpserver tftpserver nameservers ntpservers logservers dynamicrange nodehostname ddnsdomain vlanid domain comments disable)], keys => [qw(net mask)], table_desc => 'Describes the networks in the cluster and info necessary to set up nodes on that network.', descriptions => { @@ -439,13 +442,14 @@ networks => { gateway => 'The network gateway. It can be set to an ip address or the keyword , the keyword indicates the cluster-facing ip address configured on this management node or service node. Leaving this field blank means that there is no gateway for this network.', dhcpserver => 'The DHCP server that is servicing this network. Required to be explicitly set for pooled service node operation.', tftpserver => 'The TFTP server that is servicing this network. If not set, the DHCP server is assumed.', - nameservers => 'The nameservers for this network. Used in creating the DHCP network definition, and DNS configuration.', + nameservers => 'A comma delimited list of DNS servers that each node in this network should use. This value will end up in the nameserver settings of the /etc/resolv.conf on each node in this network. If this attribute value is set to the IP address of an xCAT node, make sure DNS is running on it. In a hierarchical cluster, you can also set this attribute to "" to mean the DNS server for each node in this network should be the node that is managing it (either its service node or the management node). Used in creating the DHCP network definition, and DNS configuration.', ntpservers => 'The ntp servers for this network. Used in creating the DHCP network definition. Assumed to be the DHCP server if not set.', logservers => 'The log servers for this network. Used in creating the DHCP network definition. Assumed to be the DHCP server if not set.', dynamicrange => 'The IP address range used by DHCP to assign dynamic IP addresses for requests on this network. This should not overlap with entities expected to be configured with static host declarations, i.e. anything ever expected to be a node with an address registered in the mac table.', nodehostname => 'A regular expression used to specify node name to network-specific hostname. i.e. "/\z/-secondary/" would mean that the hostname of "n1" would be n1-secondary on this network. By default, the nodename is assumed to equal the hostname, followed by nodename-interfacename.', ddnsdomain => 'A domain to be combined with nodename to construct FQDN for DDNS updates induced by DHCP. This is not passed down to the client as "domain"', vlanid => 'The vlan ID if this network is within a vlan.', + domain => 'The DNS domain name (ex. cluster.com).', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, @@ -466,6 +470,7 @@ nodegroup => { nodehm => { cols => [qw(node power mgt cons termserver termport conserver serialport serialspeed serialflow getmac comments disable)], keys => [qw(node)], + tablespace =>'XCATTBS16K', table_desc => "Settings that control how each node's hardware is managed. Typically, an additional table that is specific to the hardware type of the node contains additional info. E.g. the ipmi, mp, and ppc tables.", descriptions => { node => 'The node name or group name.', @@ -486,6 +491,7 @@ nodehm => { nodelist => { cols => [qw(node groups status statustime appstatus appstatustime primarysn hidden comments disable)], keys => [qw(node)], + tablespace =>'XCATTBS16K', table_desc => "The list of all the nodes in the cluster, including each node's current status and what groups it is in.", descriptions => { node => 'The hostname of a node in the cluster.', @@ -503,6 +509,7 @@ nodelist => { nodepos => { cols => [qw(node rack u chassis slot room comments disable)], keys => [qw(node)], + tablespace =>'XCATTBS16K', table_desc => 'Contains info about the physical location of each node. Currently, this info is not used by xCAT, and therefore can be in whatevery format you want. It will likely be used in xCAT in the future.', descriptions => { node => 'The node name or group name.', @@ -518,6 +525,7 @@ nodepos => { noderes => { cols => [qw(node servicenode netboot tftpserver nfsserver monserver nfsdir installnic primarynic discoverynics cmdinterface xcatmaster current_osimage next_osimage nimserver routenames comments disable)], keys => [qw(node)], + tablespace =>'XCATTBS16K', table_desc => 'Resources and settings to use when installing nodes.', descriptions => { node => 'The node name or group name.', @@ -559,15 +567,16 @@ noderes => { nodetype => { cols => [qw(node os arch profile provmethod supportedarchs nodetype comments disable)], keys => [qw(node)], + tablespace =>'XCATTBS16K', table_desc => 'A few hardware and software characteristics of the nodes.', descriptions => { node => 'The node name or group name.', - os => 'The operating system deployed on this node. Valid values: AIX, rh*, centos*, SL*, fedora*, sles* (where * is the version #). As a special case, if this is set to "boottarget", then it will use the initrd/kernel/parameters specified in the row in the boottarget table in which boottarget.bprofile equals nodetype.profile.', + os => 'The operating system deployed on this node. Valid values: AIX, rhels*,rhelc*, rhas*,centos*,SL*, fedora*, sles* (where * is the version #). As a special case, if this is set to "boottarget", then it will use the initrd/kernel/parameters specified in the row in the boottarget table in which boottarget.bprofile equals nodetype.profile.', arch => 'The hardware architecture of this node. Valid values: x86_64, ppc64, x86, ia64.', profile => 'The string to use to locate a kickstart or autoyast template to use for OS deployment of this node. If the provmethod attribute is set to an osimage name, that takes precendence. Otherwise, the os, profile, and arch are used to search for the files in /install/custom first, and then in /opt/xcat/share/xcat.', provmethod => 'The provisioning method for node deployment. The valid values are install, netboot, statelite or an os image name from the osimage table. If an image name is specified, the osimage definition stored in the osimage table and the linuximage table (for Linux) or nimimage table (for AIX) are used to locate the files for templates, pkglists, syncfiles, etc. On Linux, if install, netboot or statelite is specified, the os, profile, and arch are used to search for the files in /install/custom first, and then in /opt/xcat/share/xcat.', supportedarchs => 'Comma delimited list of architectures this node can execute.', - nodetype => 'A comma-delimited list of characteristics of this node. Valid values: blade, vm (virtual machine), lpar, osi (OS image), hmc, fsp, ivm, bpa, mm, rsa, switch.', + nodetype => 'A comma-delimited list of characteristics of this node. Valid values: blade, vm (virtual machine), osi (OS image), mm, rsa, switch.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, @@ -585,20 +594,20 @@ notification => { disable => "Set to 'yes' or '1' to comment out this row.", }, }, -osimage => { +osimage => { cols => [qw(imagename profile imagetype provmethod rootfstype osname osvers osdistro osarch synclists postscripts postbootscripts comments disable)], keys => [qw(imagename)], table_desc => 'Basic information about an operating system image that can be used to deploy cluster nodes.', descriptions => { imagename => 'The name of this xCAT OS image definition.', - imagetype => 'The type of operating system image this definition represents.', + imagetype => 'The type of operating system image this definition represents (linux,AIX).', provmethod => 'The provisioning method for node deployment. The valid values are install, netboot or statelite. It is not used by AIX.', rootfstype => 'The filesystem type for the rootfs is used when the provmethod is statelite. The valid values are nfs or ramdisk. The default value is nfs', profile => 'The node usage category. For example compute, service.', osname => 'Operating system name- AIX or Linux.', - osvers => 'Not used.', + osvers => 'The Linux operating system deployed on this node. Valid values: rhels*,rhelc*, rhas*,centos*,SL*, fedora*, sles* (where * is the version #).', osdistro => 'Not used.', - osarch => 'Not used.', + osarch => 'The hardware architecture of this node. Valid values: x86_64, ppc64, x86, ia64.', synclists => 'The fully qualified name of a file containing a list of files to synchronize on the nodes.', postscripts => 'Comma separated list of scripts that should be run on this image after diskfull installation or diskless boot. For installation of RedHat, CentOS, Fedora, the scripts will be run before the reboot. For installation of SLES, the scripts will be run after the reboot but before the init.d process. For diskless deployment, the scripts will be run at the init.d time, and xCAT will automatically add the list of scripts from the postbootscripts attribute to run after postscripts list. For installation of AIX, the scripts will run after the reboot and acts the same as the postbootscripts attribute. For AIX, use the postbootscripts attribute. Support will be added in the future for the postscripts attribute to run the scripts before the reboot in AIX. ', postbootscripts => 'Comma separated list of scripts that should be run on this after diskfull installation or diskless boot. On AIX these scripts are run during the processing of /etc/inittab. On Linux they are run at the init.d time. xCAT automatically adds the scripts in the xcatdefaults.postbootscripts attri bute to run first in the list.', @@ -607,7 +616,7 @@ osimage => { }, }, linuximage => { - cols => [qw(imagename template pkglist pkgdir otherpkglist otherpkgdir exlist postinstall rootimgdir kerneldir nodebootif otherifce netdrivers kernelver permission dump comments disable)], + cols => [qw(imagename template pkglist pkgdir otherpkglist otherpkgdir exlist postinstall rootimgdir kerneldir nodebootif otherifce netdrivers kernelver krpmver permission dump crashkernelsize comments disable)], keys => [qw(imagename)], table_desc => 'Information about a Linux operating system image that can be used to deploy cluster nodes.', descriptions => { @@ -623,10 +632,12 @@ linuximage => { kerneldir => 'The directory name where the 3rd-party kernel is stored. It is used for diskless image only.', nodebootif => 'The network interface the stateless/statelite node will boot over (e.g. eth0)', otherifce => 'Other network interfaces (e.g. eth1) in the image that should be configured via DHCP', - netdrivers => 'the ethernet device drivers of the nodes which will use this linux image, at least the device driver for the nodes\' installnic should be included', - kernelver => 'the version of linux kernel used in the linux image. If the kernel version is not set, the default kernel in rootimgdir will be used', - permission => 'the mount permission of /.statelite directory is used, its default value is 755', + netdrivers => 'The ethernet device drivers of the nodes which will use this linux image, at least the device driver for the nodes\' installnic should be included', + kernelver => 'The version of linux kernel used in the linux image. If the kernel version is not set, the default kernel in rootimgdir will be used', + krpmver => 'The rpm version of kernel packages (for SLES only). If it is not set, the default rpm version of kernel packages will be used.', + permission => 'The mount permission of /.statelite directory is used, its default value is 755', dump => qq{The NFS directory to hold the Linux kernel dump file (vmcore) when the node with this image crashes, its format is "nfs:///". If you want to use the node's "xcatmaster" (its SN or MN), can be left blank. For example, "nfs:///" means the NFS directory to hold the kernel dump file is on the node's SN, or MN if there's no SN.}, + crashkernelsize => 'the size that assigned to the kdump kernel. If the kernel size is not set, 256M will be the default value.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, @@ -636,7 +647,7 @@ passwd => { keys => [qw(key username)], table_desc => 'Contains default userids and passwords for xCAT to access cluster components. In most cases, xCAT will also actually set the userid/password in the relevant component when it is being configured or installed. Userids/passwords for specific cluster components can be overidden in other tables, e.g. mpa, ipmi, ppchcp, etc.', descriptions => { - key => 'The type of component this user/pw is for. Valid values: blade (management module), ipmi (BMC), system (nodes), omapi (DHCP), hmc, ivm, fsp, bpa.', + key => 'The type of component this user/pw is for. Valid values: blade (management module), ipmi (BMC), system (nodes), omapi (DHCP), hmc, ivm, cec, frame.', username => 'The default userid for this type of component', password => 'The default password for this type of component', cryptmethod => 'Indicates the method that was used to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the passwword attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryyptmethod is not supported however the code attempts to auto-discover MD5 encrypted passowrds.', @@ -655,7 +666,7 @@ policy => { commands => 'The list of commands that this rule applies to. Default is "*" (all commands).', noderange => 'The Noderange that this rule applies to. Default is "*" (all nodes).', parameters => 'A regular expression that matches the command parameters (everything except the noderange) that this rule applies to. Default is "*" (all parameters).', - time => 'Time ranges that this command may be executed in. Default is any time.', + time => 'Time ranges that this command may be executed in. This is not supported.', rule => 'Specifies how this rule should be applied. Valid values are: allow, accept, trusted. Allow or accept will allow the user to run the commands. Any other value will deny the user access to the commands. Trusted means that once this client has been authenticated via the certificate, all other information that is sent (e.g. the username) is believed without question. This authorization should only be given to the xcatd on the management node at this time.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", @@ -664,6 +675,7 @@ policy => { postscripts => { cols => [qw(node postscripts postbootscripts comments disable)], keys => [qw(node)], + tablespace =>'XCATTBS16K', table_desc => ' The scripts that should be run on each node after installation or diskless boot.', descriptions => { node => 'The node name or group name.', @@ -676,16 +688,17 @@ postscripts => { ppc => { cols => [qw(node hcp id pprofile parent nodetype supernode sfp comments disable)], keys => [qw(node)], - table_desc => 'List of system p hardware: HMCs, IVMs, FSPs, BPCs.', + tablespace =>'XCATTBS16K', + table_desc => 'List of system p hardware: HMCs, IVMs, FSPs, BPCs, CECs, Frames.', descriptions => { node => 'The node name or group name.', - hcp => 'The hardware control point for this node (HMC or IVM).', - id => 'For LPARs: the LPAR numeric id; for FSPs: the cage number; for BPAs: the frame number.', - pprofile => 'The LPAR profile that will be used the next time the LPAR is powered on with rpower.', - parent => 'For LPARs: the FSP/CEC; for FSPs: the BPA (if one exists); for BPAs: the building block (BB) which consists 1 or more service nodes and compute/storage nodes that are serviced by them.', - nodetype => 'The hardware type of the node. Only can be one of fsp, bpa, cec, frame, hmc and lpar', - supernode => 'Comma separated list of 2 ids. The first one is the id of the supernode the FSP resides in. The second one is the logic location number (0-3) within the supernode for the FSP.', - sfp => ' The Service Focal Point of the Frame. It should be the name of HMC.', + hcp => 'The hardware control point for this node (HMC, IVM, Frame or CEC). Do not need to set for BPAs and FSPs.', + id => 'For LPARs: the LPAR numeric id; for CECs: the cage number; for Frames: the frame number.', + pprofile => 'The LPAR profile that will be used the next time the LPAR is powered on with rpower. For DFM, the pprofile attribute should be set to blank ', + parent => 'For LPARs: the CEC; for FSPs: the CEC; for CEC: the frame (if one exists); for BPA: the frame; for frame: the building block number (which consists 1 or more service nodes and compute/storage nodes that are serviced by them - optional).', + nodetype => 'The hardware type of the node. Only can be one of fsp, bpa, cec, frame, ivm, hmc and lpar', + supernode => 'Indicates the connectivity of this CEC in the HFI network. A comma separated list of 2 ids. The first one is the supernode number the CEC is part of. The second one is the logical location number (0-3) of this CEC within the supernode.', + sfp => 'The Service Focal Point of this Frame. This is the name of the HMC that is responsible for collecting hardware service events for this frame and all of the CECs within this frame.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, @@ -694,11 +707,11 @@ ppcdirect => { cols => [qw(hcp username password comments disable)], keys => [qw(hcp username)], nodecol => "hcp", - table_desc => 'Info necessary to use FSPs to control system p CECs.', + table_desc => 'Info necessary to use FSPs/BPAs to control system p CECs/Frames.', descriptions => { - hcp => 'Hostname of the FSP.', - username => 'Userid of the FSP. If not filled in, xCAT will look in the passwd table for key=fsp. If not in the passwd table, the default used is admin.', - password => 'Password of the FSP. If not filled in, xCAT will look in the passwd table for key=fsp. If not in the passwd table, the default used is admin.', + hcp => 'Hostname of the FSPs/BPAs(for ASMI) and CECs/Frames(for DFM).', + username => 'Userid of the FSP/BPA(for ASMI) and CEC/Frame(for DFM). If not filled in, xCAT will look in the passwd table for key=fsp. If not in the passwd table, the default used is admin.', + password => 'Password of the FSP/BPA(for ASMI) and CEC/Frame(for DFM). If not filled in, xCAT will look in the passwd table for key=fsp. If not in the passwd table, the default used is admin.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, @@ -722,17 +735,17 @@ servicenode => { table_desc => 'List of all Service Nodes and services that will be set up on the Service Node.', descriptions => { node => 'The hostname of the service node as known by the Management Node.', - nameserver => 'Do we set up DNS on this service node? Valid values:yes or 1, no or 0.', - dhcpserver => 'Do we set up DHCP on this service node? Valid values:yes or 1, no or 0.', - tftpserver => 'Do we set up TFTP on this service node? Valid values:yes or 1, no or 0.', - nfsserver => 'Do we set up file services (HTTP,FTP,or NFS) on this service node? Valid values:yes or 1, no or 0.', - conserver => 'Do we set up Conserver on this service node? Valid values:yes or 1, no or 0.', - monserver => 'Is this a monitoring event collection point? Valid values:yes or 1, no or 0.', - ldapserver => 'Do we set up ldap caching proxy on this service node? Valid values:yes or 1, no or 0.', - ntpserver => 'Not used presently. Do we set up a ntp server on this service node? Valid values:yes or 1, no or 0.', - ftpserver => 'Do we set up a ftp server on this service node? Valid values:yes or 1, no or 0.', - nimserver => 'Do we set up a NIM server on this service node? Valid values:yes or 1, no or 0.', - ipforward => 'Do we set up ip forwarding on this service node? Valid values:yes or 1, no or 0.', + nameserver => 'Do we set up DNS on this service node? Valid values:yes or 1, no or 0. If yes, creates named.conf file with forwarding to the management node and starts named. If no or 0, it does not change the current state of the service. ', + dhcpserver => 'Do we set up DHCP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, runs makedhcp -n. If no or 0, it does not change the current state of the service. ', + tftpserver => 'Do we set up TFTP on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If yes, configures and starts atftp. If no or 0, it does not change the current state of the service. ', + nfsserver => 'Do we set up file services (HTTP,FTP,or NFS) on this service node? For AIX will only setup NFS, not HTTP or FTP. Valid values:yes or 1, no or 0.If no or 0, it does not change the current state of the service. ', + conserver => 'Do we set up Conserver on this service node? Valid values:yes or 1, no or 0. If yes, configures and starts conserver daemon. If no or 0, it does not change the current state of the service.', + monserver => 'Is this a monitoring event collection point? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.', + ldapserver => 'Do we set up ldap caching proxy on this service node? Not supported on AIX. Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.', + ntpserver => 'Not used. Use setupntp postscript to setup a ntp server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.', + ftpserver => 'Do we set up a ftp server on this service node? Not supported on AIX Valid values:yes or 1, no or 0. If yes, configure and start vsftpd. If no or 0, it does not change the current state of the service.', + nimserver => 'Not used. Do we set up a NIM server on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.', + ipforward => 'Do we set up ip forwarding on this service node? Valid values:yes or 1, no or 0. If no or 0, it does not change the current state of the service.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", @@ -752,6 +765,9 @@ site => { " For example: tabdump,nodels,lsdef will not log those cmds.\n". " ALL will not log any cmds.\n\n". " blademaxp: The maximum number of processes for blade hardware control.\n\n". + " cleanupxcatpost: (yes/1 or no/0). Set to 'yes' or '1' to clean up the /xcatpost directory\n". + " on the stateless and statelite nodes after the postscripts are run.\n". + " Default is no.\n\n". " consoleondemand: When set to 'yes', conserver connects and creates the console\n". " output only when the user opens the console. Default is no on\n". " Linux, yes on AIX.\n\n". @@ -768,6 +784,7 @@ site => { " mn|eth1,eth2;service|bond0.\n\n". " dhcpsetup: If set to 'n', it will skip the dhcp setup process in the nodeset cmd.\n\n". " disjointdhcps: If set to '1', the .leases file on a service node only contains\n". + " dnshandler: Name of plugin that handles DNS setup for makedns.\n". " the nodes it manages. The default value is '0'.\n\n". " domain: The DNS domain name used for the cluster.\n\n". " ea_primary_hmc: The hostname of the HMC that the Integrated Switch Network\n". @@ -783,8 +800,10 @@ site => { " failed nodes for any xCAT commands. See the 'noderange' manpage for\n". " details on supported formats.\n\n". " forwarders: The DNS servers at your site that can provide names outside of the\n". - " cluster. The DNS on the management node will forward requests it\n". - " does not know to these servers.\n\n". + " cluster. The makedns command will configuire the DNS on the management node\n". + " to forward requests it does not know to these servers.\n". + " Note that the DNS servers on the service nodes will ignore this value\n". + " and always be configured to forward requests to the management node.\n\n". " fsptimeout: The timeout, in milliseconds, to use when communicating with FSPs.\n\n". " genmacprefix: When generating mac addresses automatically, use this manufacturing\n". " prefix (e.g. 00:11:aa)\n\n". @@ -806,7 +825,13 @@ site => { " mnroutenames: The name of the routes to be setup on the management node.\n\n". " It is a comma separated list of route names that are defined in the routes table.\n\n". " nameservers: A comma delimited list of DNS servers that each node in the cluster\n". - " should use - often the xCAT management node.\n\n". + " should use. This value will end up in the nameserver settings of the\n". + " /etc/resolv.conf on each node. It is common (but not required) to set\n". + " this attribute value to the IP address of the xCAT management node, if you have\n". + " set up the DNS on the management node by running makedns.\n". + " In a hierarchical cluster, you can also set this attribute to \"\"\n". + " to mean the DNS server for each node should be the node that is managing it\n". + " (either its service node or the management node).\n\n". " nodestatus: If set to 'n', the nodelist.status column will not be updated during\n". " the node deployment, node discovery and power operations.\n\n". " ntpservers: A comma delimited list of NTP servers for the cluster - often the\n". @@ -822,10 +847,11 @@ site => { " removing DHCP entries when noderm is executed)\n\n". " rsh: This is no longer used. path to remote shell command for xdsh.\n\n". " rcp: This is no longer used. path to remote copy command for xdcp.\n\n". - " sharedtftp: Set to 0 or no, if xCAT should not assume the directory\n". + " sharedtftp: Set to 0 or no, xCAT should not assume the directory\n". " in tftpdir is mounted on all on Service Nodes. Default is 1/yes.\n". " If value is set to a hostname, the directory in tftpdir\n". " will be mounted from that hostname on the SN\n\n". + " skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n". " SNsyncfiledir: The directory on the Service Node, where xdcp will copy the files\n". " from the MN that will eventually be copied to the compute nodes.\n\n". " snmpc: The snmp community string that xcat should use when communicating with the\n". @@ -885,7 +911,7 @@ vpd => { node => 'The node name or group name.', serial => 'The serial number of the node.', mtm => 'The machine type and model number of the node. E.g. 7984-6BU', - side => 'The side information for the BPA/FSP', + side => '- or -. The side information for the BPA/FSP. The side attribute refers to which BPA/FSP, A or B, which is determined by the slot value returned from lsslp command. It also lists the physical port within each BPA/FSP which is determined by the IP address order from the lsslp response. This information is used internally when communicating with the BPAs/FSPs', asset => 'A field for administators to use to correlate inventory numbers they may have to accomodate', uuid => 'The UUID applicable to the node', comments => 'Any user-written notes.', @@ -942,6 +968,7 @@ eventlog => { types => { recid => 'INTEGER AUTO_INCREMENT', }, + tablespace =>'XCATTBS32K', table_desc => 'Stores the events occurred.', descriptions => { recid => 'The record id.', @@ -967,6 +994,8 @@ auditlog => { types => { recid => 'INTEGER AUTO_INCREMENT', }, + compress =>'YES', + tablespace =>'XCATTBS32K', table_desc => ' Audit Data log.', descriptions => { recid => 'The record id.', @@ -986,6 +1015,7 @@ auditlog => { prescripts => { cols => [qw(node begin end comments disable)], keys => [qw(node)], + tablespace =>'XCATTBS16K', table_desc => 'The scripts that will be run at the beginning and the end of the nodeset(Linux), nimnodeset(AIX) or mkdsklsnode(AIX) command.', descriptions => { node => 'The node name or group name.', @@ -1039,13 +1069,15 @@ routes => { }, zvm => { - cols => [qw(node hcp userid comments disable)], + cols => [qw(node hcp userid nodetype parent comments disable)], keys => [qw(node)], table_desc => 'List of z/VM virtual servers.', descriptions => { node => 'The node name.', hcp => 'The hardware control point for this node.', userid => 'The z/VM userID of this node.', + nodetype => 'The node type. Valid values: cec (Central Electronic Complex), lpar (logical partition), zvm (z/VM host operating system), and vm (virtual machine).', + parent => 'The parent node. For LPAR, this specifies the CEC. For z/VM, this specifies the LPAR. For VM, this specifies the z/VM host operating system.', comments => 'Any user provided notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, @@ -1451,6 +1483,17 @@ my @nodeattrs = ( tabentry => 'ppchcp.password', access_tabentry => 'ppchcp.hcp=attr:node', }, + {attr_name => 'username', + only_if => 'nodetype=ppc', + tabentry => 'ppchcp.username', + access_tabentry => 'ppchcp.hcp=attr:node', + }, + {attr_name => 'password', + only_if => 'nodetype=ppc', + tabentry => 'ppchcp.password', + access_tabentry => 'ppchcp.hcp=attr:node', + }, + #################### # ppc table # #################### @@ -1498,16 +1541,36 @@ my @nodeattrs = ( tabentry => 'ppc.parent', access_tabentry => 'ppc.node=attr:node', }, - {attr_name => 'nodetype', + {attr_name => 'hwtype', + only_if => 'mgt=fsp', tabentry => 'ppc.nodetype', access_tabentry => 'ppc.node=attr:node', - }, + }, + {attr_name => 'hwtype', + only_if => 'mgt=bpa', + tabentry => 'ppc.nodetype', + access_tabentry => 'ppc.node=attr:node', + }, + {attr_name => 'hwtype', + only_if => 'mgt=ivm', + tabentry => 'ppc.nodetype', + access_tabentry => 'ppc.node=attr:node', + }, + {attr_name => 'hwtype', + only_if => 'mgt=hmc', + tabentry => 'ppc.nodetype', + access_tabentry => 'ppc.node=attr:node', + }, + {attr_name => 'hwtype', + only_if => 'mgt=zvm', + tabentry => 'zvm.nodetype', + access_tabentry => 'ppc.node=attr:node', + }, {attr_name => 'supernode', tabentry => 'ppc.supernode', access_tabentry => 'ppc.node=attr:node', }, {attr_name => 'sfp', - only_if => 'nodetype=frame', tabentry => 'ppc.sfp', access_tabentry => 'ppc.node=attr:node', }, @@ -1533,6 +1596,15 @@ my @nodeattrs = ( only_if => 'mgt=fsp', tabentry => 'ppcdirect.password', access_tabentry => 'ppcdirect.hcp=attr:node::ppcdirect.username=str:general', + }, + {attr_name => 'passwd.celogin', + only_if => 'mgt=fsp', + tabentry => 'ppcdirect.password', + access_tabentry => 'ppcdirect.hcp=attr:node::ppcdirect.username=str:celogin', + }, {attr_name => 'passwd.celogin', + only_if => 'mgt=bpa', + tabentry => 'ppcdirect.password', + access_tabentry => 'ppcdirect.hcp=attr:node::ppcdirect.username=str:celogin', }, {attr_name => 'passwd.HMC', only_if => 'mgt=bpa', @@ -1936,6 +2008,11 @@ push(@{$defspec{node}->{'attrs'}}, @nodeattrs); tabentry => 'linuximage.kernelver', access_tabentry => 'linuximage.imagename=attr:imagename', }, + {attr_name => 'krpmver', + only_if => 'imagetype=linux', + tabentry => 'linuximage.krpmver', + access_tabentry => 'linuximage.imagename=attr:imagename', + }, {attr_name => 'permission', only_if => 'imagetype=linux', tabentry => 'linuximage.permission', @@ -1946,6 +2023,11 @@ push(@{$defspec{node}->{'attrs'}}, @nodeattrs); tabentry => 'linuximage.dump', access_tabentry => 'linuximage.imagename=attr:imagename', }, + {attr_name => 'crashkernelsize', + only_if => 'imagetype=linux', + tabentry => 'linuximage.crashkernelsize', + access_tabentry => 'linuximage.imagename=attr:imagename', + }, #################### # nimimage table# #################### @@ -2104,6 +2186,10 @@ push(@{$defspec{node}->{'attrs'}}, @nodeattrs); {attr_name => 'vlanid', tabentry => 'networks.vlanid', access_tabentry => 'networks.netname=attr:netname', + }, + {attr_name => 'domain', + tabentry => 'networks.domain', + access_tabentry => 'networks.netname=attr:netname', }, {attr_name => 'usercomment', tabentry => 'networks.comments', diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 20c308a45..336fe4681 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -108,11 +108,12 @@ sub dbc_submit { print $clisock $data; $data=""; my $lastline=""; - while ($lastline ne "ENDOFFREEZEQFVyo4Cj6Q0j\n" and $lastline ne "*XCATBUGDETECTED*76e9b54341\n") { #index($lastline,"ENDOFFREEZEQFVyo4Cj6Q0j") < 0) { - $lastline = <$clisock>; + while (read($clisock,$lastline,32768)) { #$lastline ne "ENDOFFREEZEQFVyo4Cj6Q0j\n" and $lastline ne "*XCATBUGDETECTED*76e9b54341\n") { #index($lastline,"ENDOFFREEZEQFVyo4Cj6Q0j") < 0) { +# $lastline = <$clisock>; $data .= $lastline; } - if ($lastline eq "*XCATBUGDETECTED*76e9b54341\n") { #if it was an error + close($clisock); + if ($lastline =~ m/\*XCATBUGDETECTED\*76e9b54341\n\z/) { #if it was an error #in the midst of the operation, die like it used to die my $err; $data =~ /\*XCATBUGDETECTED\*:(.*):\*XCATBUGDETECTED\*/s; @@ -241,8 +242,10 @@ sub handle_dbc_conn { @returndata = (scalar(handle_dbc_request($request))); } $response = freeze(\@returndata); - $response .= "\nENDOFFREEZEQFVyo4Cj6Q0j\n"; + # $response .= "\nENDOFFREEZEQFVyo4Cj6Q0j\n"; print $client $response; + $clientset->remove($client); + close($client); } else { #Connection terminated, clean up $clientset->remove($client); close($client); @@ -310,8 +313,12 @@ sub handle_dbc_request { return $opentables{$tablename}->{$autocommit}->getAllNodeAttribs(@args); } elsif ($functionname eq 'getAllEntries') { return $opentables{$tablename}->{$autocommit}->getAllEntries(@args); + } elsif ($functionname eq 'writeAllEntries') { + return $opentables{$tablename}->{$autocommit}->writeAllEntries(@args); } elsif ($functionname eq 'getAllAttribsWhere') { return $opentables{$tablename}->{$autocommit}->getAllAttribsWhere(@args); + } elsif ($functionname eq 'writeAllAttribsWhere') { + return $opentables{$tablename}->{$autocommit}->writeAllAttribsWhere(@args); } elsif ($functionname eq 'addAttribs') { return $opentables{$tablename}->{$autocommit}->addAttribs(@args); } elsif ($functionname eq 'setAttribs') { @@ -346,7 +353,12 @@ sub _set_use_cache { if ($dbworkerpid) { return dbc_call($self,'_set_use_cache',@_); } - $self->{_use_cache} = shift; + + my $usecache = shift; + if ($usecache and not $self->{_tablecache}) { + return; #do not allow cache to be enabled while the cache is broken + } + $self->{_use_cache} = $usecache; } #-------------------------------------------------------------------------------- @@ -480,6 +492,18 @@ sub buildcreatestmt if ($xcatcfg =~ /^mysql:/) { #for mysql $retv .= " ENGINE=$descr->{engine} "; } + } + # allow compression for DB2 + if ($descr->{compress}) { + if ($xcatcfg =~ /^DB2:/) { #for DB2 + $retv .= " compress $descr->{compress} "; + } + } + # allow tablespace change for DB2 + if ($descr->{tablespace}) { + if ($xcatcfg =~ /^DB2:/) { #for DB2 + $retv .= " in $descr->{tablespace} "; + } } #print "retv=$retv\n"; return $retv; @@ -2028,7 +2052,7 @@ sub getNodesAttribs { push @locattribs,'node'; } unless (grep(/^groups$/,@locattribs)) { - push @locattribs,'node'; + push @locattribs,'groups'; } $self->_build_cache(\@locattribs); } else { @@ -2045,8 +2069,10 @@ sub getNodesAttribs { } $self->_clear_cache; $self->{_use_cache} = 0; - $self->{nodelist}->_clear_cache; - $self->{nodelist}->{_use_cache} = 0; + if ($self->{tabname} ne 'nodelist') { #avoid calling clear_cache on nodelist twice + $self->{nodelist}->_clear_cache; + $self->{nodelist}->{_use_cache} = 0; + } return $rethash; } @@ -2083,6 +2109,7 @@ sub _clear_cache { #PRIVATE FUNCTION TO EXPIRE CACHED DATA EXPLICITLY } #it shouldn't have been zero, but whether it was 0 or 1, ensure that the cache is gone $self->{_use_cache}=0; # Signal slow operation to any in-flight operations that may fail with empty cache + $self->{_cached_attriblist} = undef; undef $self->{_tablecache}; undef $self->{_nodecache}; } @@ -2096,13 +2123,32 @@ sub _build_cache { #PRIVATE FUNCTION, PLEASE DON'T CALL DIRECTLY } my $attriblist = shift; my $refresh = not ref $attriblist; #if attriblist is not a reference, it is a refresh request + if (not ref $attriblist) { + $attriblist = $self->{_cached_attriblist}; #need attriblist to mean something, don't know how this didn't break horribly already + } + if (not $refresh and $self->{_cache_ref}) { #we have active cache reference, increment counter and return #TODO: ensure that the cache isn't somehow still ludirously old $self->{_cache_ref} += 1; - return; + my $currattr; + my $cachesufficient=1; + foreach $currattr (@$attriblist) { #if any of the requested attributes are not cached, we must rebuild + unless (grep { $currattr eq $_ } @{$self->{_cached_attriblist}}) { + $cachesufficient=0; + last; + } + } + if ($cachesufficient) { return; } + #cache is insufficient, now we must do the converse of above + #must add any currently cached columns to new list if not requested + foreach $currattr (@{$self->{_cached_attriblist}}) { + unless (grep { $currattr eq $_ } @$attriblist) { + push @$attriblist,$currattr; + } + } } #If here, _cache_ref indicates no cache - if (not $refresh) { + if (not $refresh and not $self->{_cache_ref}) { #we have active cache reference, increment counter and return $self->{_cache_ref} = 1; } my $oldusecache = $self->{_use_cache}; #save previous 'use_cache' setting @@ -2123,7 +2169,7 @@ sub _build_cache { #PRIVATE FUNCTION, PLEASE DON'T CALL DIRECTLY push @{$self->{_nodecache}->{$_->{$nodekey}}},$_; } } - + $self->{_cached_attriblist} = $attriblist; $self->{_use_cache} = $oldusecache; #Restore setting to previous value $self->{_cachestamp} = time; } @@ -3689,5 +3735,198 @@ sub buildWhereClause { return $whereclause; } +#-------------------------------------------------------------------------- + +=head3 writeAllEntries + + Description: Read entire table and writes all entries to file + This routine was written specifically for the tabdump + command. + + Arguments: + filename or path + + Returns: + 0=good + 1=bad + Globals: + + Error: + + Example: + + my $tabh = xCAT::Table->new($table); + my $recs=$tabh->writeAllEntries($filename); + + Comments: + none + +=cut + +#-------------------------------------------------------------------------------- +sub writeAllEntries +{ + my $self = shift; + if ($dbworkerpid) { + return dbc_call($self,'writeAllEntries',@_); + } + my $filename = shift; + my $fh; + my $rc; + # open the file for write + unless (open($fh," > $filename")) { + my $msg="Unable to open $filename for write \n."; + `logger -t xcat $msg`; + return 1; + } + my $query; + my $header; + my $tabdump_header = sub { + $header = "#" . join(",", @_); + }; + $tabdump_header->(@{$self->{colnames}}); + # write the header to the file + print $fh $header; # write line to file + print $fh "\n"; + + # delimit the disable column based on the DB + my $disable= &delimitcol("disable"); + $query = $self->{dbh}->prepare('SELECT * FROM ' . $self->{tabname}); + + $query->execute(); + while (my $data = $query->fetchrow_hashref()) + { + foreach (keys %$data) + { + if ($data->{$_} =~ /^$/) + { + $data->{$_} = undef; + } + } + $rc=output_table($self->{tabname},$fh,$self,$data); + } + $query->finish(); + close $fh; + return $rc; +} + +#-------------------------------------------------------------------------- + +=head3 writeAllAttribsWhere + + Description: writes all attributes to file using the "where" clause + written for the tabdump command + + + Arguments: + array of attrval strings to be build into a Where clause + filename or path + Returns: + Outputs to filename the table header and rows + Globals: + + Error: + + Example: + + $nodelist->getAllAttribsWhere(array of attrval,$filename); + where operator can be + (==,!=,=~,!~, >, <, >=,<=) + + + + Comments: + none + +=cut + +#-------------------------------------------------------------------------------- +sub writeAllAttribsWhere +{ + + #Takes a list of attributes, returns all records in the table. + my $self = shift; + if ($dbworkerpid) { + return dbc_call($self,'writeAllAttribsWhere',@_); + } + my $clause = shift; + my $filename = shift; + my $whereclause; + my @attribs = @_; + my @results = (); + my $query; + my $query2; + my $fh; + my $rc; + # open the file for write + unless (open($fh," > $filename")) { + my $msg="Unable to open $filename for write \n."; + `logger -t xcat $msg`; + return 1; + } + my $header; + my $tabdump_header = sub { + $header = "#" . join(",", @_); + }; + $tabdump_header->(@{$self->{colnames}}); + # write the header to the file + print $fh $header; # write line to file + print $fh "\n"; + $whereclause = &buildWhereClause($clause); + + + # delimit the disable column based on the DB + my $disable= &delimitcol("disable"); + $query2='SELECT * FROM ' . $self->{tabname} . ' WHERE (' . $whereclause . ") and ($disable is NULL or $disable in ('0','no','NO','No','nO'))"; + $query = $self->{dbh}->prepare($query2); + $query->execute(); + while (my $data = $query->fetchrow_hashref()) + { + foreach (keys %$data){ + + if ($data->{$_} =~ /^$/) + { + $data->{$_} = undef; + } + } + $rc=output_table($self->{tabname},$fh,$self,$data); + } + $query->finish(); + close $fh; + return $rc ; +} +#-------------------------------------------------------------------------- + +=head3 output_table + + Description: writes table rows to file + written for the tabdump command + +=cut + +#-------------------------------------------------------------------------------- +sub output_table { + my $table = shift; + my $fh = shift; + my $tabh=shift; + my $rec=shift; + my $line = ''; + foreach (@{$tabh->{colnames}}) + { + if (defined $rec->{$_}) + { + $rec->{$_} =~ s/"/""/g; + $line = $line . '"' . $rec->{$_} . '",'; + } + else + { + $line .= ','; + } + } + $line =~ s/,$//; # remove the extra comma at the end + print $fh $line; # write line to file + print $fh "\n"; + return 0; +} 1; diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index e5b2db548..c3b82c57f 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -28,10 +28,12 @@ my %usage = ( rpower [--nodeps] [of] [-V|--verbose] PPC (HMC) specific: rpower [onstandby] [-V|--verbose] - CEC/FSP(using Direct FSP Management) specific: - rpower [on|onstandby|off|stat|state|lowpower] - Frame/BPA(using Direct FSP Management) specific: - rpower [stat|state|rackstandby|exit_rackstandby] + CEC(using Direct FSP Management) specific: + rpower [on|onstandby|off|stat|state|lowpower|resetsp] + Frame(using Direct FSP Management) specific: + rpower [stat|state|rackstandby|exit_rackstandby|resetsp] + LPAR(using Direct FSP Management) specific: + rpower [on|off|reset|stat|state|boot|of|sms] Blade specific: rpower [cycle|softoff] [-V|--verbose] ", @@ -44,8 +46,8 @@ my %usage = ( rvitals [-h|--help|-v|--version] FSP/LPAR (with HMC) specific: rvitals noderange {temp|voltage|lcds|all} - FSP/LPAR (using Direct FSP Management)specific: - rvitals noderange {lcds|rackenv|all} + CEC/LPAR/Frame (using Direct FSP Management)specific: + rvitals noderange {rackenv|lcds|all} MPA specific: rvitals noderange {temp|voltage|wattage|fanspeed|power|leds|summary|all} Blade specific: @@ -127,12 +129,36 @@ my %usage = ( general_passwd=| *_passwd=| hostname=<*|hostname> - BPA specific: + FSP/CEC (using Direct FSP Management) Specific: + rspconfig noderange HMC_passwd={currentpasswd,newpasswd} + rspconfig noderange admin_passwd={currentpasswd,newpasswd} + rspconfig noderange general_passwd={currentpasswd,newpasswd} + rspconfig noderange *_passwd={currentpasswd,newpasswd} + rspconfig [sysname] + rspconfig [sysname=<*|name>] + rspconfig [pending_power_on_side] + rspconfig [pending_power_on_side=] + rspconfig [cec_off_policy] + rspconfig [cec_off_policy=] + BPA/Frame (using Direct FSP Management)specific: + rspconfig noderange HMC_passwd={currentpasswd,newpasswd} + rspconfig noderange admin_passwd={currentpasswd,newpasswd} + rspconfig noderange general_passwd={currentpasswd,newpasswd} + rspconfig noderange *_passwd={currentpasswd,newpasswd} rspconfig [frame] rspconfig frame=<*|frame> + rspconfig [sysname] + rspconfig [sysname=<*|name>] + rspconfig [pending_power_on_side] + rspconfig [pending_power_on_side=] HMC specific: rspconfig [sshcfg] - rspconfig [sshcfg=]", + rspconfig [sshcfg=] + CEC|Frame(using ASM)Specific: + rspconfig [dev|celogin1] + rspconfig [dev=]| + rspconfig [celogin1=] + ", "getmacs" => "Usage: Common: @@ -161,7 +187,7 @@ my %usage = ( PPC (with HMC) specific: lsvm [-a|--all] PPC (using Direct FSP Management) specific: - lsvm ", + lsvm [-l|--long]", "chvm" => "Usage: Common: @@ -171,15 +197,17 @@ my %usage = ( chvm = [=...] PPC (using Direct FSP Management) specific: chvm [-p ] + chvm [lparname=<*|name>] chvm -i [-m ] -r VMware specific: chvm [-a size][-d disk][-p disk][--resize disk=size][--cpus count][--mem memory]", "rmvm" => "Usage: rmvm [--service][-V|--verbose] - rmvm [-h|--help|-v|--version]", + rmvm [-h|--help|-v|--version], + rmvm [-p] [-f]", "lsslp" => "Usage: lsslp [-h|--help|-v|--version] - lsslp [][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s BPA|MM|IVM|RSA|FSP|HMC][-C counts][-T timeout] + lsslp [][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC][-C counts][-T timeout] [-t tries][-m][-e cmd][-c [timeinterval[interval,..]]][--vpdtable] [-M vpd|switchport][--makedhcp][--updatehost][--resetnet]", "rflash" => @@ -200,7 +228,8 @@ my %usage = ( mkhwconn noderange -p single_hmc [-P HMC passwd] [-V|--verbose] PPC (using Direct FSP Management) specific: - mkhwconn noderange -t [-T tooltype] [--port port_value]", + mkhwconn noderange -t [-T tooltype] [--port port_value] + mkhwconn noderange -s [hmcnode] [-P HMC passwd] [-V|--verbose]", "rmhwconn" => "Usage: rmhwconn [-h|--help] @@ -209,7 +238,8 @@ my %usage = ( rmhwconn noderange [-V|--verbose] PPC (using Direct FSP Management) specific: - rmhwconn noderange [-T tooltype]", + rmhwconn noderange [-T tooltype] + rmhwconn noderange -s", "lshwconn" => "Usage: lshwconn [-h|--help] @@ -218,7 +248,8 @@ my %usage = ( lshwconn noderange [-V|--verbose] PPC (using Direct FSP Management) specific: - lshwconn noderange [-T tooltype]", + lshwconn noderange [-T tooltype] + lshwconn noderange -s", "renergy" => "Usage: renergy [-h | --help] @@ -229,8 +260,8 @@ my %usage = ( renergy noderange [-V] { {savingstatus}={on | off} | {cappingstatus}={on | off} | {cappingwatt}=watt | {cappingperc}=percentage } Power 7 server specific : - renergy noderange [-V] { all | { [savingstatus] [dsavingstatus] [cappingstatus] [cappingmaxmin] [cappingvalue] [cappingsoftmin] [averageAC] [averageDC] [ambienttemp] [exhausttemp] [CPUspeed] [syssbpower] [sysIPLtime] } } - renergy noderange [-V] { {savingstatus}={on | off} | {dsavingstatus}={on-norm | on-maxp | off} | {cappingstatus}={on | off} | {cappingwatt}=watt | {cappingperc}=percentage } + 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] } } @@ -245,7 +276,7 @@ my %usage = ( updatenode [-V|--verbose] [-k|--security] [--user] [--devicetype] or - updatenode [-V|--verbose] [-F|--sync] [-S|--sw] + updatenode [-V|--verbose] [-F|--sync | -f|--snsync] [-S|--sw] [-P|--scripts [script1,script2,...]] [-s|--sn] [-A|--updateallsw] [-c|--cmdlineonly] [-d alt_source_dir] [attr=val [attr=val...]] @@ -263,6 +294,9 @@ Options: [-F|--sync] Perform File Syncing. + [-f|--snsync] Performs File Syncing to the service nodes that service + the nodes in the noderange. + [-S|--sw] Perform Software Maintenance. [-P|--scripts] Execute postscripts listed in the postscripts table or diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 5decd08e2..9e96227d5 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -32,6 +32,7 @@ require xCAT::NetworkUtils; require xCAT::Schema; #require Data::Dumper; require xCAT::NodeRange; +require xCAT::Version; require DBI; our @ISA = qw(Exporter); @@ -464,14 +465,7 @@ sub Version #The following tag tells the build script where to append build info my $version = shift; - if ($version eq 'short') - { - $version = '' #XCATVERSIONSUBHERE ; - } - else - { - $version = 'Version ' #XCATVERSIONSUBHERE #XCATSVNBUILDSUBHERE ; - } + $version = xCAT::Version->Version(); return $version; } @@ -2839,96 +2833,93 @@ sub getNodeIPaddress my $c1; my $ips; unless ( $nodeip ) { - my $nttab = xCAT::Table->new('ppc'); - if ( $nttab ) { - my $type = $nttab->getNodeAttribs($nodetocheck, ['nodetype']); - if ($type) { - if ($type->{nodetype} eq "frame" or $type->{nodetype} eq "cec") { - $c1 = xCAT::DBobjUtils->getchildren($nodetocheck); + my $type = xCAT::DBobjUtils->getnodetype($nodetocheck); + if ($type) { + if ($type eq "frame" or $type eq "cec") { + $c1 = xCAT::DBobjUtils->getchildren($nodetocheck); - #if $port exists, only for mkhwconn ... CEC/Frame - if ( defined($port) ) { - my @fsp_bpa = @$c1; - undef ($c1); - # mkhwconn only creates the connections for the FSPs/BPAs whoes port is $port. - my $vpd_tab = xCAT::Table->new('vpd'); - unless($vpd_tab) { - return "-1"; # Cannot open vpd table - } - foreach ( @fsp_bpa ) { - my $vpd_hash = $vpd_tab->getNodeAttribs( $_, [qw(side)]); - my $side = $vpd_hash->{side}; - if (!defined($side)) { - #return -2; # $_: No side in vpd table for $_ - next; - } - #print $side; - if ( $side =~ /[A|a|B|b]-$port/) { - push (@$c1, $_); - } - } - $vpd_tab->close(); - - if(!defined($c1) || @$c1 == 0) { - return "-3"; # the FSP/BPA's side is not $port. - } + #if $port exists, only for mkhwconn ... CEC/Frame + if ( defined($port) ) { + my @fsp_bpa = @$c1; + undef ($c1); + # mkhwconn only creates the connections for the FSPs/BPAs whoes port is $port. + my $vpd_tab = xCAT::Table->new('vpd'); + unless($vpd_tab) { + return "-1"; # Cannot open vpd table } - - #my $hstab = xCAT::Table->new('hosts'); - #if ( $hstab ) { - # my @myip = (); - # foreach ( @$c1 ) - # { - # my $point= $hstab->getNodeAttribs($_, ['ip']); - # my $value = $point->{ip}; - # push (@myip, $value); - # } - # $ips = join ",", @myip; - # return $ips; - #} - - #modify the way of finding IP address. - my @myip = (); - my @nonip =(); - foreach ( @$c1 ) - { - my $ifip = isIpaddr($_); - if ($ifip) { - push (@myip, $_); - } else { - push (@nonip, $_); - } - } - #if (scalar(@nonip)){ - # my $hstab = xCAT::Table->new('hosts'); - # if ( $hstab ) { - # my $ent = $hstab->getNodesAttribs(\@nonip,['ip']); - # if ($ent){ - # foreach (@nonip) { - # my $i = $ent->{$_}->[0]->{ip}; - # push (@myip, $i); - # } - # } - # } - #} - foreach my $t (@nonip) { - $nodeip = xCAT::NetworkUtils->getipaddr($t); - if (!$nodeip) { - my $hoststab = xCAT::Table->new( 'hosts'); - my $ent = $hoststab->getNodeAttribs( $t, ['ip'] ); - if ( $ent->{'ip'} ) { - $nodeip = $ent->{'ip'}; - } - } - if($nodeip) { - push (@myip, $nodeip); - } - } - - - $ips = join ",", @myip; - return $ips; + foreach ( @fsp_bpa ) { + my $vpd_hash = $vpd_tab->getNodeAttribs( $_, [qw(side)]); + my $side = $vpd_hash->{side}; + if (!defined($side)) { + #return -2; # $_: No side in vpd table for $_ + next; } + #print $side; + if ( $side =~ /[A|a|B|b]-$port/) { + push (@$c1, $_); + } + } + $vpd_tab->close(); + + if(!defined($c1) || @$c1 == 0) { + return "-3"; # the FSP/BPA's side is not $port. + } + } + + #my $hstab = xCAT::Table->new('hosts'); + #if ( $hstab ) { + # my @myip = (); + # foreach ( @$c1 ) + # { + # my $point= $hstab->getNodeAttribs($_, ['ip']); + # my $value = $point->{ip}; + # push (@myip, $value); + # } + # $ips = join ",", @myip; + # return $ips; + #} + + #modify the way of finding IP address. + my @myip = (); + my @nonip =(); + foreach ( @$c1 ) + { + my $ifip = isIpaddr($_); + if ($ifip) { + push (@myip, $_); + } else { + push (@nonip, $_); + } + } + #if (scalar(@nonip)){ + # my $hstab = xCAT::Table->new('hosts'); + # if ( $hstab ) { + # my $ent = $hstab->getNodesAttribs(\@nonip,['ip']); + # if ($ent){ + # foreach (@nonip) { + # my $i = $ent->{$_}->[0]->{ip}; + # push (@myip, $i); + # } + # } + # } + #} + foreach my $t (@nonip) { + $nodeip = xCAT::NetworkUtils->getipaddr($t); + if (!$nodeip) { + my $hoststab = xCAT::Table->new( 'hosts'); + my $ent = $hoststab->getNodeAttribs( $t, ['ip'] ); + if ( $ent->{'ip'} ) { + $nodeip = $ent->{'ip'}; + } + } + if($nodeip) { + push (@myip, $nodeip); + } + } + + + $ips = join ",", @myip; + return $ips; } } } @@ -3518,6 +3509,9 @@ sub create_postscripts_tar sub get_site_Master { + if ($::XCATSITEVALS{master}) { + return $::XCATSITEVALS{master}; + } require xCAT::Table; my $Master; my $sitetab = xCAT::Table->new('site'); @@ -5735,6 +5729,10 @@ sub isIpaddr $addr = shift; } + unless ( $addr ) + { + return 0; + } #print "addr=$addr\n"; if ($addr !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { @@ -6410,6 +6408,188 @@ sub enablessh return $enablessh; } +#------------------------------------------------------------------------------- + +=head3 runcmd_S + Note this routine is being used solely by genimage to steam output. It + will be merged with runcmd in a later release. Not all paths have been + tested. + Right now requires $cmd and $::CALLBACK set + Run the given cmd and return the output in an array (already chopped). + This routine in addition streams the output to the $::CALLBACK which is + required input. + Alternately, if this function is used in a scalar context, the output + is joined into a single string with the newlines separating the lines. + + Arguments: + command, exitcode and reference to output + Returns: + see below + Globals: + $::RUNCMD_RC , $::CALLBACK + Error: + Normally, if there is an error running the cmd,it will display the + error and exit with the cmds exit code, unless exitcode + is given one of the following values: + 0: display error msg, DO NOT exit on error, but set + $::RUNCMD_RC to the exit code. + -1: DO NOT display error msg and DO NOT exit on error, but set + $::RUNCMD_RC to the exit code. + -2: DO the default behavior (display error msg and exit with cmds + exit code. + number > 0: Display error msg and exit with the given code + + Example: + my $outref = xCAT::Utils->runcmd($cmd, -2, 1); + + Comments: + If refoutput is true, then the output will be returned as a + reference to an array for efficiency. + + +=cut + +#------------------------------------------------------------------------------- +sub runcmd_S + +{ + + my ($class, $cmd, $exitcode, $refoutput) = @_; + $::RUNCMD_RC = 0; + # redirect stderr to stdout + if (!($cmd =~ /2>&1$/)) { $cmd .= ' 2>&1'; } + + if ($::VERBOSE) + { + # get this systems name as known by xCAT management node + my $Sname = xCAT::InstUtils->myxCATname(); + my $msg; + if ($Sname) { + $msg = "Running command on $Sname: $cmd"; + } else { + $msg="Running command: $cmd"; + } + + if ($::CALLBACK){ + my $rsp = {}; + $rsp->{data}->[0] = "$msg\n"; + xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); + } else { + xCAT::MsgUtils->message("I", "$msg\n"); + } + } + # steam output to $::CALLBACK and return the buffer + my @cmd; + push @cmd,$cmd; + my $outref = []; + my $outreferr = []; + my $cmdin; + my $cmdout; + my $cmderr = gensym; + my $cmdpid = open3($cmdin,$cmdout,$cmderr,@cmd); + my $cmdsel = IO::Select->new($cmdout,$cmderr); + #foreach (@indata) { + # print $cmdin $_; + #} + close($cmdin); + my @handles; + my $rsp = {}; + my $output; + my $errout; + while ($cmdsel->count()) { + @handles = $cmdsel->can_read(); + foreach (@handles) { + my $line; + my $done = sysread $_,$line,180; + if ($done) { + if ($_ eq $cmdout) { + $rsp->{data}->[0] = $line; + xCAT::MsgUtils->message("I", $rsp, $::CALLBACK, 0); + #push @$outref,$line; + $output .= $line; + } else { + $rsp->{data}->[0] = $line; + xCAT::MsgUtils->message("I", $rsp, $::CALLBACK, 0); + #push @$outreferr,$line; + $errout .= $line; + } + } else { + $cmdsel->remove($_); + close($_); + } + } + } + waitpid($cmdpid,0); + # store the return string + push @$outref,$output; + if ($?) + { + $::RUNCMD_RC = $? >> 8; + my $displayerror = 1; + my $rc; + if (defined($exitcode) && length($exitcode) && $exitcode != -2) + { + if ($exitcode > 0) + { + $rc = $exitcode; + } # if not zero, exit with specified code + elsif ($exitcode <= 0) + { + $rc = ''; # if zero or negative, do not exit + if ($exitcode < 0) { $displayerror = 0; } + } + } + else + { + $rc = $::RUNCMD_RC; + } # if exitcode not specified, use cmd exit code + if ($displayerror) + { + my $rsp = {}; + my $errmsg = ''; + if (xCAT::Utils->isLinux() && $::RUNCMD_RC == 139) + { + $errmsg = "Segmentation fault $errmsg"; + } + else + { + $errmsg = join('', @$outref); + chomp $errmsg; + + } + if ($::CALLBACK) + { + $rsp->{data}->[0] = + "Command failed: $cmd. Error message: $errmsg.\n"; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); + + } + else + { + xCAT::MsgUtils->message("E", + "Command failed: $cmd. Error message: $errmsg.\n"); + } + $xCAT::Utils::errno = 29; + } + } + if ($refoutput) + { + chomp(@$outref); + return $outref; + } + elsif (wantarray) + { + chomp(@$outref); + return @$outref; + } + else + { + my $line = join('', @$outref); + chomp $line; + return $line; + } + +} 1; diff --git a/perl-xCAT/xCAT/VMCommon.pm b/perl-xCAT/xCAT/VMCommon.pm index 28856c90c..e146fd16b 100644 --- a/perl-xCAT/xCAT/VMCommon.pm +++ b/perl-xCAT/xCAT/VMCommon.pm @@ -10,8 +10,8 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes my $vpdtab = xCAT::Table->new("vpd"); my $hmtab = xCAT::Table->new("nodehm"); my $nttab = xCAT::Table->new("nodetype"); - my $sitetab = xCAT::Table->new("site"); - $cfghash->{site}->{genmacprefix} = xCAT::Utils->get_site_attribute('genmacprefix'); + #my $sitetab = xCAT::Table->new("site"); + $cfghash->{site}->{genmacprefix} = $::XCATSITEVALS{genmacprefix}; #xCAT::Utils->get_site_attribute('genmacprefix'); if ($hmtab) { $cfghash->{nodehm} = $hmtab->getNodesAttribs($noderange,['serialspeed']); } @@ -26,7 +26,7 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes if ($vpdtab) { $cfghash->{vpd} = $vpdtab->getNodesAttribs($noderange,['uuid']); } - $cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags','datacenter','guestostype','othersettings','master']); + $cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','vidmodel','vidproto','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags','datacenter','guestostype','othersettings','master']); my $mactab = xCAT::Table->new("mac",-create=>1); my $nrtab= xCAT::Table->new("noderes",-create=>1); $cfghash->{mac} = $mactab->getAllNodeAttribs(['mac'],1); diff --git a/perl-xCAT/xCAT/Version.pm b/perl-xCAT/xCAT/Version.pm new file mode 100644 index 000000000..e492a384f --- /dev/null +++ b/perl-xCAT/xCAT/Version.pm @@ -0,0 +1,58 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +package xCAT::Version; + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} + +# 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"; +} + +use lib "$::XCATROOT/lib/perl"; +# do not put a use or require for xCAT::Table here. Add to each new routine +# needing it to avoid reprocessing of user tables ( ExtTab.pm) for each command call +use strict; +#------------------------------------------------------------------------------- + +=head3 Version + Arguments: + Optional 'short' string to request only the version; + Returns: + xcat Version number + Globals: + none + Error: + none + Example: + $version=xCAT::Version->Version(); + Comments: + none +=cut + +#------------------------------------------------------------------------------- +sub Version +{ + + #The following tag tells the build script where to append build info + my $version = shift; + if ($version eq 'short') + { + $version = '' #XCATVERSIONSUBHERE ; + } + else + { + $version = 'Version ' #XCATVERSIONSUBHERE #XCATSVNBUILDSUBHERE ; + } + return $version; + + } + +1; diff --git a/perl-xCAT/xCAT/Yum.pm b/perl-xCAT/xCAT/Yum.pm index 812e039c0..7da4b3a7d 100644 --- a/perl-xCAT/xCAT/Yum.pm +++ b/perl-xCAT/xCAT/Yum.pm @@ -3,106 +3,176 @@ use DBI; use File::Find; use File::Spec; use File::Path; + my $yumrepofile; my $distname; my $arch; my $installpfx; + sub localize_yumrepo { - my $self = shift; - my $installroot = shift; - $distname = shift; - $arch = shift; - my $dosqlite = 0; - my $repomdfile; - my $primaryxml; - $installpfx = "$installroot/$distname/$arch"; - mkpath("$installroot/postscripts/repos/$distname/$arch/"); - open($yumrepofile,">","$installroot/postscripts/repos/$distname/$arch/local-repository.tmpl"); - find(\&check_tofix,$installpfx); - close($yumrepofile); + my $self = shift; + my $installroot = shift; + $distname = shift; + $arch = shift; + + $installpfx = "$installroot/$distname/$arch"; + mkpath("$installroot/postscripts/repos/$distname/$arch/"); + open($yumrepofile,">","$installroot/postscripts/repos/$distname/$arch/local-repository.tmpl"); + find(\&check_tofix,$installpfx); + close($yumrepofile); } sub check_tofix { if (-d $File::Find::name and $File::Find::name =~ /\/repodata$/) { - fix_directory($File::Find::name); + if($distname =~ /rhels5/) + { + fix_directory($File::Find::name); + } + generate_repo($File::Find::name); } } +sub generate_repo +{ + #write local-repository.tmpl + my $dirlocation = shift; + my @dircomps = File::Spec->splitdir($dirlocation); + pop(@dircomps); + my $yumurl = File::Spec->catdir(@dircomps); + $yumurl =~ s!$installpfx!http://#INSTSERVER#/install/$distname/$arch/!; + my $reponame = $dircomps[$#dircomps]; + print $yumrepofile "[local-$distname-$arch-$reponame]\n"; + print $yumrepofile "name=xCAT configured yum repository for $distname/$arch/$reponame\n"; + print $yumrepofile "baseurl=$yumurl\n"; + print $yumrepofile "enabled=1\n"; + print $yumrepofile "gpgcheck=0\n\n"; +} sub fix_directory { - my $dirlocation = shift; - my @dircomps = File::Spec->splitdir($dirlocation); - pop(@dircomps); - my $yumurl = File::Spec->catdir(@dircomps); - $yumurl =~ s!$installpfx!http://#INSTSERVER#/install/$distname/$arch/!; - my $reponame = $dircomps[$#dircomps]; - print $yumrepofile "[local-$distname-$arch-$reponame]\n"; - print $yumrepofile "name=xCAT configured yum repository for $distname/$arch/$reponame\n"; - print $yumrepofile "baseurl=$yumurl\n"; - print $yumrepofile "enabled=1\n"; - print $yumrepofile "gpgcheck=0\n\n"; - my $oldsha=`/usr/bin/sha1sum $dirlocation/primary.xml.gz`; - my $olddbsha; - my @xmlines; - @xmlines = (); - $oldsha =~ s/\s.*//; - chomp($oldsha); - unlink("$dirlocation/primary.xml"); - system("/bin/gunzip $dirlocation/primary.xml.gz"); - my $oldopensha=`/usr/bin/sha1sum $dirlocation/primary.xml`; - $oldopensha =~ s/\s+.*//; - chomp($oldopensha); - open($primaryxml,"+<$dirlocation/primary.xml"); - while (<$primaryxml>) { - s!xml:base="media://[^"]*"!!g; - push @xmlines,$_; - } - seek($primaryxml,0,0); - print $primaryxml (@xmlines); - truncate($primaryxml,tell($primaryxml)); - @xmlines=(); - close($primaryxml); - my $newopensha=`/usr/bin/sha1sum $dirlocation/primary.xml`; - system("/bin/gzip $dirlocation/primary.xml"); - my $newsha=`/usr/bin/sha1sum $dirlocation/primary.xml.gz`; - $newopensha =~ s/\s.*//; - $newsha =~ s/\s.*//; - chomp($newopensha); - chomp($newsha); - my $newdbsha; - my $newdbopensha; - my $olddbopensha; - if (-r "$dirlocation/primary.sqlite.bz2") { - $olddbsha =`/usr/bin/sha1sum $dirlocation/primary.sqlite.bz2`; - $olddbsha =~ s/\s.*//; - chomp($olddbsha); - unlink("$dirlocation/primary.sqlite"); - system("/usr/bin/bunzip2 $dirlocation/primary.sqlite.bz2"); - $olddbopensha=`/usr/bin/sha1sum $dirlocation/primary.sqlite`; - $olddbopensha =~ s/\s+.*//; - chomp($olddbopensha); - my $pdbh = DBI->connect("dbi:SQLite:$dirlocation/primary.sqlite","","",{AutoCommit=>1}); - $pdbh->do('UPDATE "packages" SET "location_base" = NULL'); - $pdbh->disconnect; - $newdbopensha=`/usr/bin/sha1sum $dirlocation/primary.sqlite`; - system("/usr/bin/bzip2 $dirlocation/primary.sqlite"); - $newdbsha=`/usr/bin/sha1sum $dirlocation/primary.sqlite.bz2`; - $newdbopensha =~ s/\s.*//; - $newdbsha =~ s/\s.*//; - chomp($newdbopensha); - chomp($newdbsha); - } - open($primaryxml,"+<$dirlocation/repomd.xml"); - while (<$primaryxml>) { - s!xml:base="media://[^"]*"!!g; - s!$oldsha!$newsha!g; - s!$oldopensha!$newopensha!g; - if ($olddbsha) { s!$olddbsha!$newdbsha!g; } - if ($olddbsha) { s!$olddbopensha!$newdbopensha!g; } - push @xmlines,$_; - } - seek($primaryxml,0,0); - print $primaryxml (@xmlines); - truncate($primaryxml,tell($primaryxml)); - close($primaryxml); - @xmlines=(); + + my @xmlines=(); + my $primaryxml; + + $grep_result = system("grep sha256 $dirlocation/repomd.xml|grep \\) { + s!xml:base="media://[^"]*"!!g; + push @xmlines,$_; + } + seek($primaryxml,0,0); + print $primaryxml (@xmlines); + truncate($primaryxml,tell($primaryxml)); + @xmlines=(); + close($primaryxml); + + $newopensha=`/usr/bin/$sha_command $dirlocation/primary.xml`; + $newopensha =~ s/\s.*//; + chomp($newopensha); + + system("/bin/gzip $dirlocation/primary.xml"); + $newsha=`/usr/bin/$sha_command $dirlocation/primary.xml.gz`; + $newsha =~ s/\s.*//; + chomp($newsha); + } + + #----------------------------------------------------------------------- + + my $newdbsha; + my $olddbsha; + my $newdbopensha; + my $olddbopensha; + + if (-r "$dirlocation/primary.sqlite.bz2") { + + $olddbsha =`/usr/bin/$sha_command $dirlocation/primary.sqlite.bz2`; + $olddbsha =~ s/\s.*//; + chomp($olddbsha); + + #update primary.sqlite.bz2 & primary.sqlite + if ( -r "$dirlocation/primary.sqlite") + { + unlink("$dirlocation/primary.sqlite"); + } + + system("/usr/bin/bunzip2 $dirlocation/primary.sqlite.bz2"); + $olddbopensha=`/usr/bin/$sha_command $dirlocation/primary.sqlite`; + $olddbopensha =~ s/\s+.*//; + chomp($olddbopensha); + + my $pdbh = DBI->connect("dbi:SQLite:$dirlocation/primary.sqlite","","",{AutoCommit=>1}); + $pdbh->do('UPDATE "packages" SET "location_base" = NULL'); + $pdbh->disconnect; + $newdbopensha=`/usr/bin/$sha_command $dirlocation/primary.sqlite`; + $newdbopensha =~ s/\s.*//; + chomp($newdbopensha); + + system("/usr/bin/bzip2 $dirlocation/primary.sqlite"); + $newdbsha=`/usr/bin/$sha_command $dirlocation/primary.sqlite.bz2`; + $newdbsha =~ s/\s.*//; + chomp($newdbsha); + } + + #----------------------------------------------------------------------- + + #update repomd.xml + open($primaryxml,"+<$dirlocation/repomd.xml"); + while (<$primaryxml>) { + if($_ =~ m/\/) + { + next; + } + if($_ =~ m/\/) + { + next; + } + s!xml:base="media://[^"]*"!!g; + if(defined($oldsha)){ + s!$oldsha!$newsha!g; + } + if(defined($oldopensha)){ + s!$oldopensha!$newopensha!g; + } + if(defined($olddbsha)){ + s!$olddbsha!$newdbsha!g; + } + if(defined($olddbopensha)){ + s!$olddbopensha!$newdbopensha!g; + } + push @xmlines,$_; + } + seek($primaryxml,0,0); + print $primaryxml (@xmlines); + truncate($primaryxml,tell($primaryxml)); + close($primaryxml); + @xmlines=(); } diff --git a/perl-xCAT/xCAT/zvmUtils.pm b/perl-xCAT/xCAT/zvmUtils.pm index 95d9e3124..a790d9dfb 100644 --- a/perl-xCAT/xCAT/zvmUtils.pm +++ b/perl-xCAT/xCAT/zvmUtils.pm @@ -130,6 +130,37 @@ sub setNodeProp { #------------------------------------------------------- +=head3 setNodeProps + + Description : Set node properties in a given table + Arguments : Table name + Node + Reference to property name/value hash + Returns : Nothing + Example : xCAT::zvmUtils->setNodeProps($tabName, $node, \%propHash); + +=cut + +#------------------------------------------------------- +sub setNodeProps { + + # Get inputs + my ( $class, $tabName, $node, $propHash ) = @_; + + # Get table + my $tab = xCAT::Table->new( $tabName, -create => 1, -autocommit => 0 ); + + # Set property + $tab->setAttribs( { 'node' => $node }, $propHash ); + + # Save table + $tab->commit; + + return; +} + +#------------------------------------------------------- + =head3 delTabEntry Description : Delete a table entry @@ -1053,4 +1084,70 @@ sub getUserProfile { # Return the file contents $out = `ssh $hcp "cat $file"`; return $out; +} + +#------------------------------------------------------- + +=head3 inArray + + Description : Checks if a value exists in an array + Arguments : Value to search for + Array to search in + Returns : The searched expression + Example : my $rtn = xCAT::zvmUtils->inArray($needle, @haystack); + +=cut + +#------------------------------------------------------- +sub inArray { + + # Get inputs + my ( $class, $needle, @haystack ) = @_; + return grep{ $_ eq $needle } @haystack; +} + +#------------------------------------------------------- + +=head3 getOsVersion + + Description : Get the operating system of a given node + Arguments : Node + Returns : Operating system name + Example : my $os = xCAT::zvmUtils->getOsVersion($node); + +=cut + +#------------------------------------------------------- +sub getOsVersion { + + # Get inputs + my ( $class, $node ) = @_; + + my $os = ''; + my $version = ''; + + # Get operating system + my $release = `ssh -o ConnectTimeout=2 $node "cat /etc/*release"`; + my @lines = split('\n', $release); + if (grep(/SLES|Enterprise Server/, @lines)) { + $os = 'sles'; + $version = $lines[0]; + $version =~ tr/\.//; + $version =~ s/[^0-9]*([0-9]+).*/$1/; + $os = $os . $version; + + # Append service level + $version = `echo "$release" | grep "LEVEL"`; + $version =~ tr/\.//; + $version =~ s/[^0-9]*([0-9]+).*/$1/; + $os = $os . 'sp' . $version; + } elsif (grep(/Red Hat Enterprise Linux Server/, @lines)) { + $os = 'rhel'; + $version = $lines[0]; + $version =~ tr/\.//; + $version =~ s/([A-Za-z\s\(\)]+)//g; + $os = $os . $version; + } + + return xCAT::zvmUtils->trimStr($os); } \ No newline at end of file diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/IBMhpc.rhels6.ppc64.pkglist b/xCAT-IBMhpc/share/xcat/IBMhpc/IBMhpc.rhels6.ppc64.pkglist index 69005ad16..6cd2c8952 100755 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/IBMhpc.rhels6.ppc64.pkglist +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/IBMhpc.rhels6.ppc64.pkglist @@ -27,3 +27,5 @@ libstdc++-devel.ppc libstdc++-devel.ppc64 glibc-devel.ppc glibc-devel.ppc64 + +redhat-lsb.ppc64 diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/IBMhpc.sles11.ppc64.pkglist b/xCAT-IBMhpc/share/xcat/IBMhpc/IBMhpc.sles11.ppc64.pkglist index 7c8955ad6..866bfb9cd 100644 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/IBMhpc.sles11.ppc64.pkglist +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/IBMhpc.sles11.ppc64.pkglist @@ -44,3 +44,4 @@ xorg-x11-libs-32bit xorg-x11-libX11 xorg-x11-libXext +insserv diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/essl/essl.bnd b/xCAT-IBMhpc/share/xcat/IBMhpc/essl/essl.bnd index 94bd8dc0e..248cd4c9a 100644 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/essl/essl.bnd +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/essl/essl.bnd @@ -14,6 +14,7 @@ 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 diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/essl/essl_install_pessl4100 b/xCAT-IBMhpc/share/xcat/IBMhpc/essl/essl_install_pessl4100 new file mode 100644 index 000000000..84f3777cd --- /dev/null +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/essl/essl_install_pessl4100 @@ -0,0 +1,69 @@ +#!/bin/sh + +# +# Sample script to accept licenses and install ESSL and PESSL packages +# For AIX: +# TBD +# For Linux: +# Assumes all prerequisite software has been installed (e.g. compilers) + + +OS=`uname` +INSTALL_DIR='/install' +ESSL_DIR=$essldir + +if [ -z "$ESSL_DIR" ]; then + # try to default + ESSL_DIR=$INSTALL_DIR/post/otherpkgs/$OSVER/$ARCH/essl +fi + + + +if [ $OS != "AIX" ]; then + if [ $NODESETSTATE == "install" ] || [ $NODESETSTATE == "boot" ]; then + # Being run from a stateful install postscript + # Copy rpms directly from the xCAT management node and install + mkdir -p /tmp/essl + rm -f -R /tmp/essl/* + cd /tmp/essl + download_dir=`echo $ESSL_DIR | cut -d '/' -f3-` + wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=5 ftp://$SITEMASTER/$download_dir/*.rpm 2> /tmp/wget.log + #rpm -Uvh essl.license*.rpm + IBM_ESSL_LICENSE_ACCEPT=yes rpm -Uvh essl*.rpm + #install_essl=`find /opt/ibmmath/essl -name install_essl -print` + #if [ -n "$install_essl" ] ; then + # $install_essl -y -d . -nodocs + #fi + #rpm -Uvh pessl.license*.rpm + IBM_PESSL_LICENSE_ACCEPT=yes rpm -Uvh pessl*.rpm + #install_pessl=`find /opt/ibmmath/pessl -name install_pessl -print` + #if [ -n "$install_pessl" ] ; then + # $install_pessl -y -d . -nodocs + #fi + rm -Rf /tmp/essl + fi + + if [ $NODESETSTATE == "genimage" ]; then + # Being called from .postinstall script + # Assume we are on the same machine + tmpdir=tmpessl + mkdir $installroot/$tmpdir + cp -p $ESSL_DIR/* $installroot/$tmpdir + #rpm --root $installroot -Uvh $installroot/$tmpdir/essl.license*.rpm + IBM_ESSL_LICENSE_ACCEPT=yes rpm --root $installroot -Uvh $installroot/$tmpdir/essl*.rpm + cd $installroot + #install_essl=`find opt/ibmmath/essl -name install_essl -print` + #if [ -n "$install_essl" ] ; then + # chroot $installroot /$install_essl -y -nodocs -d /$tmpdir + #fi + #rpm --root $installroot -Uvh $installroot/$tmpdir/pessl.license*.rpm + IBM_PESSL_LICENSE_ACCEPT=yes rpm --root $installroot -Uvh $installroot/$tmpdir/pessl*.rpm + #install_pessl=`find opt/ibmmath/pessl -name install_pessl -print` + #if [ -n "$install_pessl" ] ; then + # chroot $installroot /$install_pessl -y -nodocs -d /$tmpdir + #fi + rm -rf $installroot/$tmpdir + fi +fi + + diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/loadl/litefile.csv b/xCAT-IBMhpc/share/xcat/IBMhpc/loadl/litefile.csv index 3fb34f772..682b09e52 100644 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/loadl/litefile.csv +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/loadl/litefile.csv @@ -1,4 +1,4 @@ #image,file,options,comments,disable "ALL","/home/",,"for user management, PE,LL use non-root user", "ALL","/var/loadl/","persistent","used by LL log, spool and exec", - +"ALL","/etc/LoadL.cfg","tmpfs","used by LL llcompute.sh", \ No newline at end of file diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/loadl/loadl_install b/xCAT-IBMhpc/share/xcat/IBMhpc/loadl/loadl_install index 80bb397f6..0d31dd2c1 100755 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/loadl/loadl_install +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/loadl/loadl_install @@ -140,9 +140,10 @@ chmod 777 $installroot$logdir/core # Owner set to 'loadl' userid, change if using a different userid chown -R $loadl_admin:$loadl_group $installroot$logdir/ -if [ "$NODESETSTATE" == "genimage" ] && [ -f /etc/LoadL.cfg ] ; then - cp /etc/LoadL.cfg $installroot/etc/LoadL.cfg -fi +# UNCOMMENT to let llcompute.sh/llserver.sh to create /etc/LoadL.cfg +#if [ "$NODESETSTATE" == "genimage" ] && [ -f /etc/LoadL.cfg ] ; then +# cp /etc/LoadL.cfg $installroot/etc/LoadL.cfg +#fi # UNCOMMENT to Start loadleveler during postscripts diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/login.rhel6.ppc64.otherpkgs.pkglist b/xCAT-IBMhpc/share/xcat/IBMhpc/login.rhel6.ppc64.otherpkgs.pkglist index ca9431e3c..7660fe1ed 100644 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/login.rhel6.ppc64.otherpkgs.pkglist +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/login.rhel6.ppc64.otherpkgs.pkglist @@ -3,3 +3,6 @@ #INCLUDE:/opt/xcat/share/xcat/IBMhpc/pe/pe.otherpkgs.pkglist# #INCLUDE:/opt/xcat/share/xcat/IBMhpc/essl/essl.otherpkgs.pkglist# #INCLUDE:/opt/xcat/share/xcat/IBMhpc/loadl/login-loadl.otherpkgs.pkglist# + +xcat/xcat-core/perl-xCAT +xcat/xcat-core/xCAT-client \ No newline at end of file diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/login.sles11.ppc64.otherpkgs.pkglist b/xCAT-IBMhpc/share/xcat/IBMhpc/login.sles11.ppc64.otherpkgs.pkglist index 8e204065a..77bacf166 100644 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/login.sles11.ppc64.otherpkgs.pkglist +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/login.sles11.ppc64.otherpkgs.pkglist @@ -7,3 +7,6 @@ #INCLUDE:/opt/xcat/share/xcat/IBMhpc/pe/pe.otherpkgs.pkglist# #INCLUDE:/opt/xcat/share/xcat/IBMhpc/essl/essl.otherpkgs.pkglist# #INCLUDE:/opt/xcat/share/xcat/IBMhpc/loadl/login-loadl.otherpkgs.pkglist# + +xcat/xcat-core/perl-xCAT +xcat/xcat-core/xCAT-client \ No newline at end of file diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/min-IBMhpc.rhels6.ppc64.pkglist b/xCAT-IBMhpc/share/xcat/IBMhpc/min-IBMhpc.rhels6.ppc64.pkglist index 104975154..0e6bc4812 100755 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/min-IBMhpc.rhels6.ppc64.pkglist +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/min-IBMhpc.rhels6.ppc64.pkglist @@ -28,3 +28,5 @@ libstdc++-devel.ppc libstdc++-devel.ppc64 glibc-devel.ppc glibc-devel.ppc64 + +redhat-lsb.ppc64 diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/min-IBMhpc.sles11.ppc64.pkglist b/xCAT-IBMhpc/share/xcat/IBMhpc/min-IBMhpc.sles11.ppc64.pkglist index 08b488782..2b222eec1 100755 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/min-IBMhpc.sles11.ppc64.pkglist +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/min-IBMhpc.sles11.ppc64.pkglist @@ -53,3 +53,4 @@ libstdc++33 #xorg-x11-libX11 #xorg-x11-libXext +insserv diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe-1100.bnd b/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe-1100.bnd index d97a0f29d..add449e60 100644 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe-1100.bnd +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe-1100.bnd @@ -8,11 +8,8 @@ I:ppe.openshmem I:ppe.rte I:ppe.loc.license -# PE HPC toolkit, needed on login node, it will be merged into ppe.rte, need to verify before GA. -#I:ppe.hpct - -# LAPI -I:rsct.lapi +# PE HPC toolkit, needed on login node +#I:ppedev.hpct # MetaCluster (checkpoint/restore) I:mcr.rte diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe-1100.otherpkgs.pkglist b/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe-1100.otherpkgs.pkglist new file mode 100644 index 000000000..711738afe --- /dev/null +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe-1100.otherpkgs.pkglist @@ -0,0 +1,6 @@ +pe/src +pe/ibm_openshmem_* +pe/ppe_rte_* + +# PE HPC toolkit, needed on login node +#pe/ppedev_hpct_* \ No newline at end of file diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe_install-1100 b/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe_install-1100 index 25a804f6e..dc971b285 100755 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe_install-1100 +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/pe/pe_install-1100 @@ -5,16 +5,6 @@ # For AIX: # TBD # For Linux: -# - For full-disk installs: -# - Copy rpms to node -# - Install and accept PE license rpm -# - Install PE rpms -# - For diskless images: -# - Install PE license on MN if not already installed -# - Install PE license rpm into image, but DO NOT ACCEPT -# (java accept program will hang) -# - Copy PE license files from MN into image -# - Install PE rpms # - Create a smaller PNSD log file in /tmp # - Configure poe.limits file @@ -33,87 +23,6 @@ if [ $NODESETSTATE != "genimage" ]; then installroot="" fi - - -if [ $OS != "AIX" ]; then - if [ $NODESETSTATE == "install" ] || [ $NODESETSTATE == "boot" ]; then - # Being run from a stateful install postscript - # Copy rpms directly from the xCAT management node and install - mkdir -p /tmp/pe - rm -f -R /tmp/pe/* - cd /tmp/pe - download_dir=`echo $PE_DIR | cut -d '/' -f3-` - wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=5 ftp://$SITEMASTER/$download_dir/*.rpm 2> /tmp/wget.log - if [ ! -f /opt/ibmhpc/install/sbin/accept_ppe_license.sh ] ; then - rpm -Uvh IBM_pe_license*.rpm - fi - IBM_PE_LICENSE_PROMPT=N /opt/ibmhpc/install/sbin/accept_ppe_license.sh -############## -### TEMPORARY FOR xCAT 2.6 Beta: - #rpm -Uvh --force ibm_pami*.rpm ibm_pe*.rpm ppe_*.rpm - rpm -Uvh --force ibm_openshmem*.rpm ppe_rte*.rpm --nodeps -############## - cd / - rm -Rf /tmp/pe - fi - - if [ $NODESETSTATE == "genimage" ]; then - # Being called from .postinstall script - # Assume we are on the same machine - if [[ $OS = sles* ]] || [[ $OS = suse* ]] || [[ -f /etc/SuSE-release ]]; then - # For SLES, assume zypper is available on the system running genimage - if [ ! -d /etc/opt/ibmhpc/license ] ; then - # Install and accept PE license on the MN - IBM_PE_LICENSE_PROMPT=N zypper install $PE_DIR/IBM_pe_license*.rpm - fi - # Install PE license rpm into image, BUT DO NOT ACCEPT - # The java process fails when you try to run in chroot - #zypper -R $installroot install $PE_DIR/IBM_pe_license*.rpm - # Copy license files from MN into the image - mkdir -p $installroot/etc/opt/ibmhpc/license - cp -pR /etc/opt/ibmhpc/license/* $installroot/etc/opt/ibmhpc/license - # Install PE product rpms - INUCLIENTS=1 INUBOSTYPE=1 zypper -R $installroot install $PE_DIR/ibm_lapi*.rpm $PE_DIR/ibm_pe*.rpm $PE_DIR/ppe_*.rpm - else - # For Redhat, etc., assume yum is available on the system running genimage - if [ ! -d /etc/opt/ibmhpc/license ] ; then - # Install and accept PE license on the MN - IBM_PE_LICENSE_PROMPT=N yum --nogpgcheck localupdate $PE_DIR/IBM_pe_license*.rpm - #IBM_PE_LICENSE_PROMPT=N yum --nogpgcheck install $PE_DIR/IBM_pe_license*.rpm - fi - # Install PE license rpm into image, BUT DO NOT ACCEPT - # The java process fails when you try to run in chroot -############## -### TEMPORARY FOR xCAT 2.6 Beta: - #yum --installroot $installroot --nogpgcheck install $PE_DIR/IBM_pe_license*.rpm - yum --installroot $installroot --nogpgcheck install $PE_DIR/IBM_pe_license*.rpm -############## - # Copy license files from MN into the image - mkdir -p $installroot/etc/opt/ibmhpc/license - cp -pR /etc/opt/ibmhpc/license/* $installroot/etc/opt/ibmhpc/license -############## -### TEMPORARY FOR xCAT 2.6 Beta: - #chroot $installroot /opt/ibmhpc/install/sbin/accept_ppe_license.sh - chroot $installroot /opt/ibmhpc/install/sbin/accept_ppe_license.sh - # Install PE product rpms - #INUCLIENTS=1 INUBOSTYPE=1 yum --installroot $installroot --nogpgcheck install $PE_DIR/ibm_lapi*.rpm $PE_DIR/ibm_pe*.rpm $PE_DIR/ppe_*.rpm - chroot $installroot mkdir -p /tmp/pe - chroot $installroot rm -f -R /tmp/pe/* - - download_dir=`echo $PE_DIR | cut -d '/' -f3-` - echo $download_dir - ### we had to set SITEMASTER to MN IP explicitly in our test cluster - #SITEMASTER=10.0.0.1 - chroot $installroot wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=5 ftp://$SITEMASTER/$download_dir/*.rpm --directory-prefix=/tmp/pe - chroot $installroot /bin/rpm -ivh /tmp/pe/s*.rpm /tmp/pe/p*.rpm /tmp/pe/ibm_*.rpm --nodeps - chroot $installroot /bin/rm -r /tmp/pe -############## - 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. diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/rsct/litefile.csv b/xCAT-IBMhpc/share/xcat/IBMhpc/rsct/litefile.csv index 4f382ebf2..d587edf35 100755 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/rsct/litefile.csv +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/rsct/litefile.csv @@ -1,3 +1,3 @@ #image,file,options,comments,disable -"ALL","/var/ct/","bind","for rsct", -"ALL","/etc/objrepos/","bind","for rsct", +"ALL","/var/ct/","","for rsct", +"ALL","/etc/objrepos/","","for rsct", diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/rsct/rsct_install b/xCAT-IBMhpc/share/xcat/IBMhpc/rsct/rsct_install index 3ab74b890..4dcdd29f7 100755 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/rsct/rsct_install +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/rsct/rsct_install @@ -35,12 +35,12 @@ if [ $OS != "AIX" ]; then # rsct don't need license. So not install and accept the rsct license on the MN # Install RSCT product rpms - INUCLIENTS=1 INUBOSTYPE=1 zypper -R $installroot install $RSCT_DIR/src-*.rpm $RSCT_DIR/rsct.core-*.rpm $RSCT_DIR/rsct.core.utils-*.rpm + INUCLIENTS=1 INUBOSTYPE=1 zypper -n -R $installroot install $RSCT_DIR/src-*.rpm $RSCT_DIR/rsct.core-*.rpm $RSCT_DIR/rsct.core.utils-*.rpm else # For Redhat, etc., assume yum is available on the system running genimage # rsct don't need license. So not install and accept the rsct license on the MN # Install RSCT product rpms - INUCLIENTS=1 INUBOSTYPE=1 yum --installroot $installroot --nogpgcheck install $RSCT_DIR/src-*.rpm $RSCT_DIR/rsct.core-*.rpm $RSCT_DIR/rsct.core.utils-*.rpm + INUCLIENTS=1 INUBOSTYPE=1 yum -y --installroot $installroot --nogpgcheck install $RSCT_DIR/src-*.rpm $RSCT_DIR/rsct.core-*.rpm $RSCT_DIR/rsct.core.utils-*.rpm fi fi diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/teal/teal-gpfs-collector.bnd b/xCAT-IBMhpc/share/xcat/IBMhpc/teal/teal-gpfs-collector.bnd new file mode 100644 index 000000000..a3d6b9a9a --- /dev/null +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/teal/teal-gpfs-collector.bnd @@ -0,0 +1,2 @@ +# For TEAL GPFS collector service node +I:teal.gpfs-sn diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/teal/teal-gpfs-collector.otherpkgs.pkglist b/xCAT-IBMhpc/share/xcat/IBMhpc/teal/teal-gpfs-collector.otherpkgs.pkglist new file mode 100644 index 000000000..f7236e28f --- /dev/null +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/teal/teal-gpfs-collector.otherpkgs.pkglist @@ -0,0 +1,2 @@ +# For TEAL GPFS collector service node +gpfs/teal-gpfs-sn diff --git a/xCAT-UI/css/style.css b/xCAT-UI/css/style.css index f40a28c39..9cd1e506f 100644 --- a/xCAT-UI/css/style.css +++ b/xCAT-UI/css/style.css @@ -683,42 +683,42 @@ table a:hover { } /*--------------- Provision and monitor forms ---------------*/ -.rmcnormal { +.monitornormal { border: 2px outset #7FFFD4; background: #66CD00; cursor: pointer; } -.rmcwarning { +.mornitorwarning { background: #FFD700; border: 2px outset #EEEE00; cursor: pointer; } -.rmcerror { +.monitorerror { background: #FF3030; border: 2px outset #FF4040; } -.rmcunknown { +.monitorunknown { background: #8B8B7A; border: 2px outset #858585; } -.rmcnodeli { +.monitornodeli { width: 16px; height: 16px; float: left; } -.rmcsumdiv { +.monitorsumdiv { width: 300px; height: 150px; float: left; margin: 0px 0px 10px 0px; } -.rmcnodediv { +.monitornodediv { width: 240px; height: 120px; margin: 0px 0px 15px 0px; diff --git a/xCAT-UI/js/monitor/gangliamon.js b/xCAT-UI/js/monitor/gangliamon.js index 25c813ff0..1aeec021b 100644 --- a/xCAT-UI/js/monitor/gangliamon.js +++ b/xCAT-UI/js/monitor/gangliamon.js @@ -31,7 +31,25 @@ function loadGangliaMon() { gangliaTab.append(nodes); // Create info bar - var info = createInfoBar('Select a group to view the nodes summary'); + var gangliaLnk = $('Click here'); + gangliaLnk.css( { + 'color' : 'blue', + 'text-decoration' : 'none' + }); + gangliaLnk.click(function() { + // Open a new window for Ganglia + window.open('../ganglia/'); + }); + + // Create info bar + var info = $('
'); + info.append(''); + var msg = $('

'); + msg.append('Select a group to view the nodes summary. '); + msg.append(gangliaLnk); + msg.append(' to open the Ganglia page.'); + info.append(msg); + info.css('margin-bottom', '10px'); nodes.append(info); // Get groups diff --git a/xCAT-UI/js/monitor/rmcmon.js b/xCAT-UI/js/monitor/rmcmon.js index 094394dbd..f3638e98b 100644 --- a/xCAT-UI/js/monitor/rmcmon.js +++ b/xCAT-UI/js/monitor/rmcmon.js @@ -277,7 +277,7 @@ function showRmcSummary(returnData) { summaryTable.append(summaryRow); } summaryRow.append(tempTd); - attrDiv = $('
'); + attrDiv = $('
'); tempTd.append(attrDiv); for ( var i in attrValues) { tempArray.push( [ globalTimeStamp[i], Number(attrValues[i]) ]); @@ -352,13 +352,13 @@ function parseRmcData(returnData){ } function createUnkownNode(nodeName){ - var tempLi = '
  • '; return tempLi; } function createErrorNode(nodeName){ - var tempLi = '
  • '; } @@ -407,13 +407,13 @@ function showRmcNodes(data, nodename) { memAvg = parseInt(tempSum / index); if (cpuAvg >= 10 && memAvg <= 90){ - classname = 'rmcnormal'; + classname = 'monitornormal'; } else{ - classname = 'rmcwarning'; + classname = 'mornitorwarning'; } - var normalLi = $('
  • '); $('#rmcmonDetail ul').append(normalLi); @@ -446,7 +446,7 @@ function showNode(nodeName) { for ( var attr in globalNodesDetail[nodeName]) { var tempTd = $(''); var attrChat = $('
    '); + + '" class="monitornodediv">'); if (0 == parseNum % 4) { nodeRow = $(''); nodeTable.append(nodeRow); diff --git a/xCAT-UI/lib/functions.php b/xCAT-UI/lib/functions.php index 6416c4040..b4cceb1ba 100644 --- a/xCAT-UI/lib/functions.php +++ b/xCAT-UI/lib/functions.php @@ -94,6 +94,8 @@ function submit_request($req, $skipVerify, $opts_array){ 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(); while(!feof($fp)) { // Read until there is no more // Remove newlines and add it to the response $str = fread($fp, 8192); @@ -109,12 +111,12 @@ function submit_request($req, $skipVerify, $opts_array){ format_TBD($tmp); } else { // Print out output by default - echo $tmp . '
    '; + echo '
    ' . $tmp . '
    '; ob_flush(); flush(); } } - } + } } // Look for serverdone response @@ -144,6 +146,9 @@ function submit_request($req, $skipVerify, $opts_array){ } else { echo "

    xCAT submit request socket error: $errno - $errstr

    "; } + + // Flush (send) the output buffer and turn off output buffering + ob_end_flush(); // Close syslog closelog(); diff --git a/xCAT-client/bin/db2sqlsetup b/xCAT-client/bin/db2sqlsetup index d6b312def..9ea70ceda 100755 --- a/xCAT-client/bin/db2sqlsetup +++ b/xCAT-client/bin/db2sqlsetup @@ -90,6 +90,7 @@ if ( 'h|help' => \$::HELP, 'v|version' => \$::VERSION, 'V|verbose' => \$::VERBOSE, + 'p|passwd' => \$::PASSWD, 'r|rm' => \$::RM, ) ) @@ -154,15 +155,21 @@ if ($::RM) } -if ((!($::INIT)) && (!($::SETUPODBC))) +if ((!($::INIT)) && (!($::SETUPODBC)) && (!($::PASSWD))) { - xCAT::MsgUtils->message("I", "Either -i or -o flag must be chosen"); + xCAT::MsgUtils->message("I", "Either -i,-o or -p flag must be chosen"); &usage; exit(1); } -if ((!($::SERVER)) && (!($::CLIENT))) +if (($::PASSWD) && ($::VERBOSE)) { - xCAT::MsgUtils->message("I", "Either -S or -C flag must be chosen"); + xCAT::MsgUtils->message("I", "Change password cannot be used with Verbose mode. "); + &usage; + exit(1); +} +if ((!($::SERVER)) && (!($::CLIENT))&& (!($::PASSWD))) +{ + xCAT::MsgUtils->message("I", "Either -S, -C, or -p flag must be chosen"); &usage; exit(1); } @@ -176,7 +183,7 @@ if (($::SERVER) && ($::CLIENT)) if ((!($::SERVER)) && (!($::CLIENT)) && ($::SETUPODBC)) { xCAT::MsgUtils->message("I", - "Either -S or -C flag must be chosen with the -o flag"); + "Either -S or -C flag must be chosen with the -o flag."); &usage; exit(1); } @@ -220,10 +227,12 @@ $::xcatrunningdb2 = 0; # determine the location of the xcatdb instance # $::databaseloc = "/var/lib/db2"; # database location default +$::databaselocdir = "/var/lib"; # database path # if database location environment variable is set, use it if ($ENV{'DATABASELOC'}) # input where xcatdb is located { $::databaseloc = $ENV{'DATABASELOC'}; + $::databaselocdir = $ENV{'DATABASELOC'}; $::databaseloc .="\/db2"; } else { # use site.databaseloc if set my $cmd = " XCATBYPASS=1 tabdump site | grep databaseloc"; @@ -232,12 +241,20 @@ if ($ENV{'DATABASELOC'}) # input where xcatdb is located { (my $attr, my $db) = split(",", $output[0]); (my $q, $::databaseloc) = split("\"", $db); + $::databaselocdir = $::databaseloc; $::databaseloc .="\/db2"; } } - - +if (!(-e $::databaselocdir)){ # if it does not exist, create it + my $cmd = "mkdir -p $::databaselocdir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } +} # if we are on the MN ( db2 server) if ($::SERVER) { @@ -277,9 +294,10 @@ if ($::SERVER) # if not just odbc update and xcat MN is not already running on DB2 # or if we are setting up the Client and not just the ODBC +# or change password # then Get instance password # -if ((($odbconly == 0) && ($::xcatrunningdb2 == 0)) || (($::CLIENT) && ($odbconly == 0))) +if ((($odbconly == 0) && ($::xcatrunningdb2 == 0)) || (($::CLIENT) && ($odbconly == 0)) || ($::PASSWD)) { if ($ENV{'XCATDB2PW'}) # passwd supplied { @@ -288,14 +306,32 @@ if ((($odbconly == 0) && ($::xcatrunningdb2 == 0)) || (($::CLIENT) && ($odbconly else { #prompt for password - my $msg = "Input the password for xcatdb instance id: "; + my $msg = "Enter the password for xcatdb instance id: "; xCAT::MsgUtils->message('I', "$msg"); `stty -echo`; chop($::adminpassword = ); `stty echo`; + $msg = "Retype the password for xcatdb instance id: "; + xCAT::MsgUtils->message('I', "$msg"); + `stty -echo`; + chop(my $adminpwd2 = ); + `stty echo`; + if ($::adminpassword ne $adminpwd2) { # no match + $msg = "Sorry, passwords do not match. "; + xCAT::MsgUtils->message('I', "$msg"); + exit 1; + } } } +# if we are just changing the password for the instance +# do it and exit +if ($::PASSWD) { + my $rc=0; + $rc=&updatepasswd; + exit $rc; +} + # initial setup request and not already running db2 if (($::INIT) && ($::xcatrunningdb2 == 0)) { @@ -433,6 +469,9 @@ if (($::INIT) && ($::xcatrunningdb2 == 0)) xCAT::MsgUtils->message("I", "xCAT is running on the DB2 database.\n"); + # add cron entry for table reorg + &updatecrontab; + } else # client { @@ -481,8 +520,8 @@ sub usage 'I', "Usage:\ndb2sqlsetup - Performs the setup of IBM DB2 for xCAT to use as its database. See man db2sqlsetup for more information." ); - my $msg = - "db2sqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> <-S|-C> [-o|--setupODBC] [-V|--verbose]\n <-o|--setupODBC> <-S|-C> [-V|--verbose]\n <-r|--rm> <-S|-C> [-V|--verbose]"; + my $msg= + "db2sqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> <-S|-C> [-o|--setupODBC] [-V|--verbose]\n <-o|--setupODBC> <-S|-C> [-V|--verbose]\n <-p|--passwd> [-S|-C]\n "; xCAT::MsgUtils->message('I', "$msg"); } @@ -502,7 +541,11 @@ sub startxcatd my $xcmd; if ($::osname eq 'AIX') { - $xcmd = "$::XCATROOT/sbin/restartxcatd"; + if ($ENV{'XCATDB2QUIET'} == 1){ # don't show errors + $xcmd = "$::XCATROOT/sbin/restartxcatd >/dev/null 2>&1"; + } else { + $xcmd = "$::XCATROOT/sbin/restartxcatd"; + } } else @@ -674,6 +717,11 @@ sub mkdb2user } # set xcatdb id password + my $verboseflg=0; + if ($::VERBOSE) { # do not show commands with password + $verboseflg=1; + $::VERBOSE=undef; + } $cmd = qq~echo "xcatdb:$::adminpassword" | /bin/chpasswd -c~; xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) @@ -682,6 +730,9 @@ sub mkdb2user xCAT::MsgUtils->message("SE", " $cmd failed."); exit(1); } + if ($verboseflg == 1) { + $::VERBOSE=1; + } } else { # Linux @@ -735,6 +786,11 @@ sub mkdb2user } # set xcatdb id password + my $verboseflg=0; + if ($::VERBOSE) { # do not show commands with password + $verboseflg=1; + $::VERBOSE=undef; + } $cmd = qq~echo $::adminpassword | passwd xcatdb --stdin~; xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) @@ -743,6 +799,9 @@ sub mkdb2user xCAT::MsgUtils->message("SE", " $cmd failed."); exit(1); } + if ($verboseflg == 1) { + $::VERBOSE=1; + } } } @@ -793,7 +852,7 @@ db2c_xcatdb 50001/tcp # Port for server connection"; Create the db2 server or client instance For server - run /instance/db2icrt -a server -p db2c_xcatdb -s ese -u xcatdb xcatdb + run /instance/db2icrt -a server -p db2c_xcatdb -u xcatdb xcatdb For Client run /instance/db2icrt -s client xcatdb @@ -820,7 +879,7 @@ sub setupinstance if ($::SERVER) { - $cmd .= "-a server -p db2c_xcatdb -s ese -u xcatdb xcatdb "; + $cmd .= "-a server -p db2c_xcatdb -u xcatdb xcatdb "; xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) { # if error exit @@ -909,6 +968,45 @@ sub setupinstance { xCAT::MsgUtils->message("SI", " $cmd warning."); } + # add export of EXTSHM to /etc/rc.db2 on AIX, so env variable will + # be exported when db2fmcd starts the database on reboot + my $message; + if ($::osname eq 'AIX') { + my $rcdb2file="/etc/rc.db2"; + my $entry="EXTSHM=ON\nexport EXTSHM"; + my $entry2="#!/usr/bin/ksh \nEXTSHM=ON\nexport EXTSHM"; + if (-e($rcdb2file)) { # add to file + $cmd = "fgrep EXTSHM $rcdb2file"; # check to see if there + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # if not there + { + $cmd = "echo \"$entry\" >> $rcdb2file"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "$cmd failed. Could not setup $rcdb2file. This will affect running ISNM on the system."; + xCAT::MsgUtils->message("E", "$message"); + } + } + } else{ # create the file + $cmd = "echo \"$entry2\" >> $rcdb2file"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "$cmd failed. Could not setup $rcdb2file. This will affect running ISNM on the system. Please check documentation for manual setup. "; + xCAT::MsgUtils->message("E", "$message"); + } else { + $cmd = "chmod 554 $rcdb2file"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + } + + } + + } + } } @@ -1365,10 +1463,81 @@ sub setupODBC if ($::RUNCMD_RC != 0) { my $message = - "\nunixODBC is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before we can setup the ODBC. If on Linux, install from the OS CDs. If RHEL6 and ppc is being used then both unixODBC.*.ppc64 and unixODBC.*.ppc should be installed. "; + "\nunixODBC is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before we can setup the ODBC. If on Linux, install from the OS CDs. If Redhat and ppc is being used then both unixODBC.*.ppc64 and unixODBC.*.ppc should be installed. "; xCAT::MsgUtils->message("E", " $cmd failed. $message"); exit(1); } + # For CNM you must have the 32 bit version on Unix ODBC, Pam, + # and openssl installed on Redhat. Put out a warning. + if ($::linuxos =~ /rh.*/) { + $cmd = "rpm -qa | grep unixODBC"; + my @output=xCAT::Utils->runcmd($cmd, 0); + # check for two lines one ppc and one ppc64 + my $foundppc64 =0; + my $foundppc =0; + foreach my $line (@output) { + if ($line =~ /\.ppc$/i) { + $foundppc=1; + } + if ($line =~ /\.ppc64$/i) { + $foundppc64=1; + } + } + if (($foundppc64 !=1) || ($foundppc != 1)) + { + my $message = + "If Redhat on power is being used then both unixODBC.*.ppc64 and unixODBC.*.ppc rpms must be installed. "; + xCAT::MsgUtils->message("I", "$message"); + + } + # check pam 32 and 64 bit installed + @output=(); + $cmd = "rpm -qa | grep \^pam-"; + @output=xCAT::Utils->runcmd($cmd, 0); + # check for two lines one ppc and one ppc64 + $foundppc64 =0; + $foundppc =0; + foreach my $line (@output) { + if ($line =~ /\.ppc$/i) { + $foundppc=1; + } + if ($line =~ /\.ppc64$/i) { + $foundppc64=1; + } + } + if (($foundppc64 !=1) || ($foundppc != 1)) + { + my $message = + "If Redhat on power is being used then both pam-*.ppc64 and pam-*.ppc rpms must be installed. "; + xCAT::MsgUtils->message("I", "$message"); + + } + # check openssl 32 and 64 bit installed + @output=(); + $cmd = "rpm -qa | grep \^openssl-"; + @output=xCAT::Utils->runcmd($cmd, 0); + # check for two lines one ppc and one ppc64 + $foundppc64 =0; + $foundppc =0; + foreach my $line (@output) { + if ($line =~ /\.ppc$/i) { + $foundppc=1; + } + if ($line =~ /\.ppc64$/i) { + $foundppc64=1; + } + } + if (($foundppc64 !=1) || ($foundppc != 1)) + { + my $message = + "If Redhat on power is being used then both openssl*.ppc64 and openssl*.ppc rpms must be installed. "; + xCAT::MsgUtils->message("I", "$message"); + + } + } + + + my @rpmoutput; my $odbcinstfile; @@ -1460,7 +1629,7 @@ sub setupODBC $sharedlibaix = "$::databaseloc/sqllib/lib/libdb2.so"; } else { $sharedlib32="$::databaseloc/sqllib/lib32/libdb2.so"; - $sharedlib64="/var/lib/db2/sqllib/lib/libdb2o.so"; + $sharedlib64="$::databaseloc/sqllib/lib/libdb2o.so"; } $cmd = "fgrep -i DB2 $odbcinstfile "; xCAT::Utils->runcmd($cmd, -1); @@ -1620,6 +1789,11 @@ sub createcfgloc xCAT::MsgUtils->message("E", " $cmd failed."); } } + my $verboseflg=0; + if ($::VERBOSE) { # do not show commands with password + $verboseflg=1; + $::VERBOSE=undef; + } my $db2entry = "DB2:xcatdb|xcatdb|$::adminpassword"; $cmd = "echo \"$db2entry\" > $cfgloc"; xCAT::Utils->runcmd($cmd, 0); @@ -1630,6 +1804,9 @@ sub createcfgloc exit(1); } + if ($verboseflg == 1) { + $::VERBOSE=1; + } # allow readonly by root chmod 0600, $cfgloc; @@ -1685,6 +1862,28 @@ sub restorexcatdb } #----------------------------------------------------------------------------- +=head3 updatecrontab + + Sets up a crontab entry to reorg the database, once a week on Sunday + night midnight + +=cut + +#----------------------------------------------------------------------------- + +sub updatecrontab +{ + my $cmd="/opt/xcat/share/xcat/tools/reorgtbls"; + my $entry="0 0 * * 0 $cmd"; + my ($code, $msg)=xCAT::Utils::add_cron_job($entry); + if ($code==0) { + xCAT::MsgUtils->message("I", "A crontab entry has been added to run DB2 table reorg once a week on Sunday 12am.\nIf you would like to change this time, use crontab -e to modify the entry for reorgtbls execution.\nYou may also limit the tables to reorg by using the -t parameter on reorgtbls.\nRun reorgtbls -h."); + } else { + xCAT::MsgUtils->message("W", " Failed to add crontab entry for Table reorg."); + } +} +#----------------------------------------------------------------------------- + =head3 adddb2paths Add paths to db2 commands to /etc/profile and ~.profile @@ -2190,6 +2389,84 @@ sub remove xCAT::MsgUtils->message("I", "Cleanup completely finished. $error errors have got. \n"); } +#----------------------------------------------------------------------------- +=head3 updatepasswd + + if -S , then update the xcatdb instance password on the MN + -C , then update the xcatdb instance password on the clients (SN) + if just -p , then update the xcatdb intance password on both +=cut +#----------------------------------------------------------------------------- + +sub updatepasswd + +{ + my $rc=0; + $ENV{'XCATDB2QUIET'} = 1; + my $updateclient=0; + my $updateserver=0; + if ($::SERVER) { # going to update the server MN + $updateserver=1; + } + + if ($::CLIENT) { # going to update the clients (SNs) + $updateclient=1; + } + if ((!($::CLIENT)) && (!($::SERVER))) { # update both MN and SNs + $updateserver=1; + $updateclient=1; + } + my $snlist; + # must read the database before we change the password on the MN + # to get the list of Service Nodes + if ($updateclient==1) { + if (xCAT::Utils->isMN()) { # if on Management Node + my @allSN=xCAT::Utils->getAllSN; + foreach my $nodes (@allSN) { + $snlist.=$nodes; + $snlist.="\,"; + } + chop $snlist; + } + } + # change password on the MN + if ($updateserver==1) { # we will change the MN + # then shutdown xcatd + # First change xcatd password + # change /etc/xcat/cfgloc + # then restart xcatd + # change odbc password, if it exists + &shutdownxcatd; + &mkdb2user; + &createcfgloc; + &startxcatd; + &setupODBC; + } + # change password on the Service Nodes + # note this routine will be run on the SN's also from xdsh + if ($updateclient==1) { # Update the clients + if (xCAT::Utils->isMN()) { # if on Management Node + # xdsh -v /opt/xcat/bin/db2sqlsetup -C -p + my $cmd="xdsh $snlist -v DATABASELOC=$::databaselocdir XCATDB2PW=$::adminpassword \/opt\/xcat\/bin\/db2sqlsetup -C -p"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $cmd2="xdsh $snlist -v DATABASELOC=$::databaselocdir XCATDB2PW=XXXXXX \/opt\/xcat\/bin\/db2sqlsetup -C -p"; + my $message = + "$cmd2 failed. Could not change password on all the Service Nodes"; + xCAT::MsgUtils->message("E", "$message"); + } + } else { # on the SN + &shutdownxcatd; + &mkdb2user; + &createcfgloc; + &startxcatd; + &setupODBC; + } + } + + return $::RUNCMD_RC; +} diff --git a/xCAT-client/bin/genimage b/xCAT-client/bin/genimage index 9468fec94..81786c200 100755 --- a/xCAT-client/bin/genimage +++ b/xCAT-client/bin/genimage @@ -12,14 +12,11 @@ use strict; use Getopt::Long; require xCAT::MsgUtils; require xCAT::DSHCLI; +require xCAT::Client; + use xCAT::Utils; -use Term::ANSIColor; use File::Basename; -# genimage is a wrapper to the genimages located in -# /opt/xcat/share/xcat/netboot// -# put tab completion -# colors -# remember the last one done + $::XCATROOT = "/opt/xcat"; my $os = ""; my $profile = ""; @@ -33,10 +30,14 @@ my @profiles; # available profiles my $profDir; # root where you do ./genimage from my $help; my $match = 0; -my $color = 0; my $imagename; my $arch; my $permission; +my $rootlimit; +my $tmplimit; +my $krpmver; +my $kerneldir; +my $mode; #----------------------------------------------------------------------------- @@ -47,44 +48,51 @@ my $permission; #----------------------------------------------------------------------------- sub print_usage { - print "Usage: genimage -h\n"; - print " genimage -v\n"; - print " genimage [-i ] [-n ] [-r ]\n [-o ] [-p ] [-k ]\n"; - print " genimage [-i ] [-n ] [-r ]\n [-k ] image_name\n"; - print "Examples:\n"; - print " genimage -i eth0 -n igb,e1000e,bnx2 -o centos5.4 -p compute\n"; - print " genimage -o suse11\n"; - print " genimage\n"; - print " genimage -i eth0 -n igb,e1000e,bnx2 myimage\n"; - print " genimage myimage\n"; + print "Usage:\n"; + print ' genimage -o [-a ] -p -i -n [-r ] [-k ] [-g ] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission ]'."\n\n"; + print ' genimage [-o ] [-a ] [-p ] [-i ] [-n ] [-r ] [-k ] [-g ] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission ] '."\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"; + print "Examples:\n"; + print " genimage -i eth0 -n tg3 -o sles11 -p compute\n"; + print " genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute\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"; + print " genimage -i eth0 -n tg3 myimagename\n"; + print " genimage myimagename\n"; } + if (!GetOptions( - 'o=s' => \$os, - 'i=s' => \$interface, - 'a=s' => \$arch, - 'p=s' => \$profile, - 'n=s' => \$drivers, - 'k=s' => \$kernel, - 'r=s' => \$otherInterfaces, - 'h|help' => \$help, - 'v|version' => \$version, - 'c' => \$color - + 'a=s' => \$arch, + 'p=s' => \$profile, + 'o=s' => \$os, + 'n=s' => \$drivers, + 'i=s' => \$interface, + 'r=s' => \$otherInterfaces, + 'l=s' => \$rootlimit, + 't=s' => \$tmplimit, + 'k=s' => \$kernel, + 'g=s' => \$krpmver, + 'm=s' => \$mode, + 'permission=s' => \$permission, + 'kerneldir=s' => \$kerneldir, + 'h|help' => \$help, + 'v|version' => \$version, )) { &print_usage; exit 1; } if($help){ - print "genimage is a shell for the genimage located in /opt/xcat/share/xcat/netboot/.\n"; - &print_usage; - exit 0; + &print_usage; + exit 0; } if ($version){ - my $version = xCAT::Utils->Version(); - xCAT::MsgUtils->message("N", $version); - exit 0; + my $version = xCAT::Utils->Version(); + xCAT::MsgUtils->message("N", $version); + exit 0; } if (@ARGV > 0) { @@ -96,25 +104,20 @@ if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) { if ($? == 0) { if (($tmpimgs) && ($tmpimgs !~ /^Could/)) { #Could is returned when the osimage table is empty my @images=split('\n', $tmpimgs); - print color("reset"); print "Do you want to re-genarate an existing image from the osimage table? "; - print color("bold"), "[y/n] ",color("reset"); + print "[y/n] "; my $conf = ; chomp($conf); if($conf ne "" && $conf !~/N|n|[Nn][Oo]/) { $match = 0; while(1){ - print color("bold"); print "Available images: \n"; - print color("reset"); foreach(sort @images){ - $color && print color("green" ); print " $_\n"; - $color && print color("reset"); } # default is the first image cause in many cases print "Which image do you want to re-generate? ["; - print color("bold"), $images[0] , color("reset"); + print $images[0]; print "] "; my $img = ; @@ -132,7 +135,7 @@ if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) { if ($match) { last; } else { - print color("red bold"), "$img is not found in the osimage table.\n", color("reset"); + print "$img is not found in the osimage table.\n"; } } } @@ -140,59 +143,6 @@ if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) { } } -if ($imagename) { - if ($os or $profile or $arch) { - print "-o, -a and -p options are not allowed when a image name is specified.\n"; - exit 1; - } - #load the module in memory - eval {require("$::XCATROOT/lib/perl/xCAT/Table.pm")}; - if ($@) { - print $@; - exit 1; - } - - #get the info from the osimage and linuximage tables - my $osimagetab=xCAT::Table->new('osimage', -create=>1); - if (!$osimagetab) { - print "The osimage table cannot be opened.\n"; - exit 1; - } - my $linuximagetab=xCAT::Table->new('linuximage', -create=>1); - if (!$linuximagetab) { - print "The linuximage table cannot be opened.\n"; - exit 1; - } - - (my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'provmethod'); - if (!$ref) { - print "Cannot find image \'$imagename\' from the osimage table.\n"; - exit 1; - } - (my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'pkglist', 'nodebootif', 'otherifce', 'netdrivers', 'kernelver', 'permission'); - if (!$ref1) { - print "Cannot find $imagename from the linuximage table\n"; - exit 1; - } - - $os=$ref->{'osvers'}; - $arch=$ref->{'osarch'}; - $profile=$ref->{'profile'}; - my $provmethod=$ref->{'provmethod'}; - - unless ($os and $profile) { - print"osimage.osvers and osimage.profile must be specified for the image $imagename in the database.\n"; - exit 1; - } - - $drivers=$ref1->{'netdrivers'}; - $kernel=$ref1->{'kernelver'}; - $interface=$ref1->{'nodebootif'}; - $otherInterfaces=$ref1->{'otherifce'}; - $permission=$ref1->{'permission'}; -} - - # get the install directory my $installdir = `gettab key=installdir site.value`; @@ -225,17 +175,13 @@ if ((!$imagename) && (!$os)){ # now they have the OSes, make sure they select one that is available $match = 0; while(1){ - print color("bold"); print "Available OSes: \n"; - print color("reset"); foreach(@oses){ - $color && print color("green" ); print " $_\n"; - $color && print color("reset"); } # default is the first OS cause in many cases, they'll only have 1. print "Which OS do you want to build a image for? ["; - print color("bold"), $oses[0] , color("reset"); + print $oses[0] ; print "] "; $os = ; @@ -253,15 +199,13 @@ if ((!$imagename) && (!$os)){ if($match){ last; }else{ - print color("red bold"), "$os is not found in '$installdir'\n", color("reset"); + print "$os is not found in '$installdir'\n"; } } chomp($os); } -$color && print color("cyan"); print " OS: $os\n"; -$color && print color("reset"); @@ -282,7 +226,7 @@ if ($osfamily =~ /sles/ && $osfamily =~ /sp/) { #print "OSfamily: $osfamily\n"; $profDir = "$::XCATROOT/share/xcat/netboot/$osfamily"; unless(-d $profDir){ - print color("red bold") , "Unable to find genimage script in $profDir\n", color("reset"); + print "Unable to find genimage script in $profDir\n"; exit 1; } @@ -301,20 +245,18 @@ if ((!$imagename) && (!$profile)){ } @profiles = sort keys %seen; if($#profiles eq -1){ - print color("red bold"), "There are no profiles in $::XCATROOT/share/xcat/netboot/$osfamily.\n", color("reset"); + print "There are no profiles in $::XCATROOT/share/xcat/netboot/$osfamily.\n"; exit 1; } $match = 0; while(1){ - print color("bold"), "Available Profiles for $os: \n", color("reset"); + print "Available Profiles for $os: \n"; foreach(@profiles){ - $color && print color("green"); print " $_\n"; - $color && print color("reset"); } # default is the first OS cause in many cases, they'll only have 1. print "Which profile do you want to use for $os? ["; - print color("bold"), $profiles[0] , color("reset"); + print "$profiles[0] "; print "] "; $profile = ; @@ -333,15 +275,13 @@ if ((!$imagename) && (!$profile)){ } } } -$color && print color("cyan"); print " Profile: $profile\n"; -$color && print color("reset"); # get the interface if ((!$imagename) && (!$interface)){ while(1){ print "Which network interface do you want the image to boot from? ["; - print color("bold"), "eth0" ,color("reset"); + print "eth0"; print "] "; $interface = ; chomp($interface); @@ -350,11 +290,9 @@ if ((!$imagename) && (!$interface)){ last; }else{ print "You want your stateless machines to boot off of "; - $color && print color("cyan"); print "$interface"; - $color && print color("reset"); print "? "; - print color("bold"),"[Y/n] ", color("reset"); + print "[Y/n] "; my $conf = ; chomp($conf); if($conf eq ""){ @@ -366,140 +304,82 @@ if ((!$imagename) && (!$interface)){ } } } -$color && print color("cyan"); print " Interface: $interface\n"; -$color && print color("reset"); - -# get drivers -if ((!$imagename) && (!$drivers)) { - while(1){ - print "Which network drivers will you need? (press enter if you're not sure) "; - print color("bold"), "\n[igb,e1000e,e1000,bnx2,tg3] ", color("reset"); - - $drivers = ; - chomp($drivers); - if($drivers eq ""){ - $drivers = "igb,e1000e,e1000,bnx2,tg3"; - last; - }else{ - print "You want to use the following driver(s): "; - $color && print color("cyan"); - print $drivers; - $color && color("reset"); - print "? "; - print color("bold"),"[Y/n] ", color("reset"); - my $conf = ; - chomp($conf); - if($conf eq ""){ - last; - } - if($conf =~ /Y|y|[Yy][Ee][Ss]/){ - last; - } - } - } -} -$color && print color("cyan"); -print " Network drivers: $drivers\n"; -$color && print color("reset"); -# get other interfac -if ((!$imagename) && (!$otherInterfaces)) { - my $first=1; - while(1){ - if ($first) { - print "Do you need to set up other interfaces? "; - $first = 0; - } else { - print "Do you need to set up more interfaces besides $otherInterfaces? "; - } - print color("bold"), "[y/n] ",color("reset"); - my $conf = ; - chomp($conf); - if($conf eq "" || $conf =~/N|n|[Nn][Oo]/){ - last; - }else{ - print "What other interface do you need? "; - my $tmp = ; - chomp($tmp); - if($tmp eq ""){ - last; - }else{ - if ($otherInterfaces) { - $otherInterfaces = "$otherInterfaces,$tmp"; - } else { - $otherInterfaces=$tmp; - } - } #end confirmation - } # end part where they don't want default - } # end question loop -} # end getting other interfaces -if($otherInterfaces){ - $color && print color("cyan"); - print " Other Interfaces: $otherInterfaces\n"; - $color && color("reset"); -} -# get kernel info -if ((!$imagename) && (!$kernel)) { - while(1){ - print "Which kernel do you want to use? ["; - print color("bold"), "default" , color("reset"); - print "] "; - $kernel = ; - chomp($kernel); - if($kernel eq ""){ - # special case of RHEL5.4 where kenrel must be specified or you - # get some other one - if($os =~ /rhels5.4|centos5.4|rhel5.4|sl5.4/){ - $kernel = "2.6.18-164.el5"; - } - last; - }else{ - print "You want to use: "; - $color && print color("cyan"); - print $kernel; - $color && print color("reset"); - print "? "; - print color("bold"),"[Y/n] ", color("reset"); - my $conf = ; - chomp($conf); - if($conf eq ""){ - last; - } - if($conf =~ /Y|y|[Yy][Ee][Ss]/){ - last; - } - } - } -} # end unless kernel -if($kernel){ - $color && print color("blue"); - print " Kernel: $kernel\n"; - $color && print color("reset"); -} - - -print "Generating image:\n"; -my $cmd; +print "Generating image: \n"; +my @arg; if ($imagename) { - $cmd = "./genimage $imagename"; -} else { - $cmd = "./genimage -i $interface -n $drivers -o $os -p $profile "; - - if ($kernel) { - $cmd .= " -k $kernel"; - } - - if($otherInterfaces){ - $cmd .= " -r $otherInterfaces"; - } + push @arg, "$imagename"; } -$color && print color("cyan"); -print "cd $profDir\n"; -print "$cmd\n"; -$color && print color("reset"); -exec("cd $profDir; $cmd"); +if ($interface) { + push @arg, "-i"; + push @arg, "$interface"; +} +if ($drivers) { + push @arg, "-n"; + push @arg, "$drivers"; +} +if ($os) { + push @arg, "-o"; + push @arg, "$os"; +} +if ($profile) { + push @arg, "-p"; + push @arg, "$profile"; +} +if ($arch) { + push @arg, "-a"; + push @arg, "$arch"; +} + +if ($kernel) { + push @arg, "-k"; + push @arg, "$kernel"; +} + +if($otherInterfaces){ + push @arg, "-r"; + push @arg, "$otherInterfaces"; +} + +if ($permission) { + push @arg, "--permission"; + push @arg, "$permission"; +} + +if ($rootlimit) { + push @arg, "-l"; + push @arg, "$rootlimit"; +} + +if($tmplimit) { + push @arg, "-t"; + push @arg, "$tmplimit"; +} + +if ($krpmver) { + push @arg, "-g"; + push @arg, "$krpmver"; +} + +if ($mode) { + push @arg, "-m"; + push @arg, "$mode"; +} + +if ($kerneldir) { + push @arg, "--kerneldir"; + push @arg, "$kerneldir"; +} + + +my $cmdref; +push (@{$cmdref->{arg}}, @arg); +$cmdref->{command}->[0] = "genimage"; + +xCAT::Client::submit_request($cmdref, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; diff --git a/xCAT-client/bin/updatenode b/xCAT-client/bin/updatenode index 900a6b102..c852b67e9 100755 --- a/xCAT-client/bin/updatenode +++ b/xCAT-client/bin/updatenode @@ -11,6 +11,7 @@ use File::Basename; use xCAT::Client; use xCAT::MsgUtils; use xCAT::Usage; +use strict; sub updatenode_usage { @@ -35,8 +36,8 @@ Getopt::Long::Configure("bundling"); # 'v|version' => \$::VERSION); # display the usage if -h or --help is specified -my $tmp=join(' ', @ARGV); -if (!($tmp =~ /--help|-h|-v|--version/)) { +my $tmp=" ".join(' ', @ARGV); +if (!($tmp =~ / (--help|-h|-v|--version)/)) { my $arg=shift(@ARGV); # Set the noderange if ($arg !~ /^-/) { @@ -75,6 +76,7 @@ if ( 'v|version' => \$::VERSION, 'V|verbose' => \$::VERBOSE, 'F|sync' => \$::FILESYNC, + 'f|snsync' => \$::SNFILESYNC, 'S|sw' => \$::SWMAINTENANCE, 's|sn' => \$::SETSERVER, 'P|scripts:s' => \$::RERUNPS, @@ -90,7 +92,7 @@ if ( if ($::HELP) { - &updatenode_usage($callback); + &updatenode_usage(); exit 0; } @@ -101,6 +103,11 @@ if ($::VERSION) print "$version\n"; exit 0; } +if (($::FILESYNC) && ($::SNFILESYNC)){ # only one + my $msg = "Choose either -f to sync the service nodes, or -F to sync the nodes not both."; + xCAT::MsgUtils->message("E", $msg); + exit 1; +} my $current_userid = getpwuid($>); diff --git a/xCAT-client/bin/xcoll b/xCAT-client/bin/xcoll index 70b9f2922..ef5a47a90 100755 --- a/xCAT-client/bin/xcoll +++ b/xCAT-client/bin/xcoll @@ -9,8 +9,10 @@ use strict; my %output; my $option; +my $printcount; -GetOptions("n"=>\$option); +GetOptions("n"=>\$option, + "c"=>\$printcount); while () { my $node; @@ -48,6 +50,10 @@ foreach my $output (keys %collated) { print "====================================\n"; print "$nodes\n"; print "====================================\n"; + if ($printcount) { + print "Node count = ".scalar( keys %{$collated{$output}})." \n"; + print "====================================\n"; + } print $output; print "\n"; } diff --git a/xCAT-client/debian/changelog b/xCAT-client/debian/changelog index d350ef1b2..33312ce38 100644 --- a/xCAT-client/debian/changelog +++ b/xCAT-client/debian/changelog @@ -1,3 +1,15 @@ +xcat-client (2.5.0-2) stable; urgency=low + + * Initial Debian build + + -- Mark Hamzy Fri, 29 Apr 2011 14:40:34 -0500 + +xcat-client (2.5.0-1) stable; urgency=low + + * Initial Release + + -- OCF xCAT Mon, 25 Oct 2010 09:00:00 -0000 + xcat-client (2.0-2) testing; urgency=low * post-release snap diff --git a/xCAT-client/debian/control b/xCAT-client/debian/control index e52d9ae0b..eef687468 100644 --- a/xCAT-client/debian/control +++ b/xCAT-client/debian/control @@ -1,12 +1,12 @@ Source: xcat-client Section: admin Priority: extra -Maintainer: Isaac Freeman +Maintainer: Isaac Freeman , Arif Ali Build-Depends: debhelper (>= 5) Standards-Version: 3.7.2 Package: xcat-client -Architecture: any -Depends: ${perl:Depends}, perl-xcat (>= 2.0-2), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, conserver-xcat-client +Architecture: all +Depends: ${perl:Depends}, nmap Description: Core executables and data of the xCAT management project xCAT-client provides the fundamental xCAT commands (chtab, chnode, rpower, etc) helpful in administrating systems at scale, with particular attention paid to large HPC clusters. diff --git a/xCAT-client/debian/dirs b/xCAT-client/debian/dirs index 63cf9220c..55b162077 100644 --- a/xCAT-client/debian/dirs +++ b/xCAT-client/debian/dirs @@ -1,7 +1,7 @@ -usr/bin -usr/sbin -usr/share/man/man1 -usr/share/man/man3 -usr/share/man/man5 -usr/share/man/man8 -usr/share/doc +opt/xcat/bin +opt/xcat/sbin +opt/xcat/share/man/man1 +opt/xcat/share/man/man3 +opt/xcat/share/man/man5 +opt/xcat/share/man/man8 +opt/xcat/share/doc diff --git a/xCAT-client/debian/docs b/xCAT-client/debian/docs index e69de29bb..9c734aebd 100644 --- a/xCAT-client/debian/docs +++ b/xCAT-client/debian/docs @@ -0,0 +1 @@ +LICENSE.html diff --git a/xCAT-client/debian/files b/xCAT-client/debian/files index e69de29bb..d2329288f 100644 --- a/xCAT-client/debian/files +++ b/xCAT-client/debian/files @@ -0,0 +1 @@ +xcat-client_2.5.0-1_all.deb admin extra diff --git a/xCAT-client/debian/xcat-client.substvars b/xCAT-client/debian/xcat-client.substvars index cd2d004a5..e4d74a396 100644 --- a/xCAT-client/debian/xcat-client.substvars +++ b/xCAT-client/debian/xcat-client.substvars @@ -1 +1,2 @@ +misc:Depends= perl:Depends=perl diff --git a/xCAT-client/pods/man1/chdef.1.pod b/xCAT-client/pods/man1/chdef.1.pod index dc55caad6..0c809a884 100644 --- a/xCAT-client/pods/man1/chdef.1.pod +++ b/xCAT-client/pods/man1/chdef.1.pod @@ -42,7 +42,7 @@ If the value of the attribute is a list then this option may be used to remove o Change the current object name to the new-name which is specified by the -n option. The object of site, monitoring types cannot be supported. -Note: For the B<-n> option, only one node can be handled. +Note: For the B<-n> option, only one node can be handled. For some special nodes such as fsp, bpa, frame, cec etc., usually their hcp attributes are their names, if you use B<-n> option, please check if you need to change the hcp attribute to their new names. =item I @@ -148,6 +148,12 @@ To change the node object name from node1 to node2. chdef -t node -o node1 -n node2 +=item 10. + +To change the node hwtype, this command will change the value of ppc.nodetype. + + chdef -t node -o node1 hwtype=lpar + =back diff --git a/xCAT-client/pods/man1/chvm.1.pod b/xCAT-client/pods/man1/chvm.1.pod index 5f317960f..56be6192f 100644 --- a/xCAT-client/pods/man1/chvm.1.pod +++ b/xCAT-client/pods/man1/chvm.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Changes HMC- and IVM-managed partition profiles. For P7 IH, 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 - Changes HMC- and IVM-managed partition profiles. 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. =head1 SYNOPSIS @@ -18,9 +18,11 @@ B [B<-V>| B<--verbose>] I I=I [I=I...] B I [B<-p> I] -B I B<-i id> B<-m> I B<-r> I +B I [B={B<*>|B}] -=head2 VMware specific: +B I B<-i id> [B<-m> I] B<-r> I + +=head2 VMware/KVM specific: B I [B<-a> I] [B<-d> I] [B<-p> I] [B<--resize> B=I] [B<--cpus> I] [B<--mem> I] @@ -40,7 +42,7 @@ chvm is also designed to assign the I/O slots to the new LPAR. Both the current 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. -=head2 VMware specific: +=head2 VMware/KVM specific: The chvm command modifes the vm specified in noderange. Calling with deregister or purge options at the same time as the resize option is not recommended. @@ -84,11 +86,11 @@ Verbose output. =item B<-i> -Starting numeric id of the newly created partitions. For P7 IH 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 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>. =item B<-m> -memory interleaving. The value only could be B or B. B mode means the memory cannot be shared across the processors in an octant. B means the memory can be shared. +memory interleaving. The value only could be B or B. B mode means the memory cannot be shared across the processors in an octant. B means the memory can be shared. The default value is B . =item B<-r> @@ -110,9 +112,13 @@ The octants configuration value for one Octant could be B<1>, B<2>, B<3>, B<4>, Name of I/O slots assignment profile. +=item B={B<*>|B} + +Set LPAR name for the specified lpars. If '*' specified, it means to get names from xCAT database and then set them for the specified lpars. If a string is specified, it only supports single node and the string will be set for the specified lpar. The user can use lsvm to check the lparnames for lpars. + =back -=head2 VMware specific: +=head2 VMware/KVM specific: =over 10 @@ -178,7 +184,7 @@ Output is similar to: =head2 PPC (using Direct FSP Management) specific: -1. For P7 IH, 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 the 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 @@ -191,7 +197,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 P7 IH, 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 @@ -211,7 +217,7 @@ 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 P7 IH 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, 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: mkdef -t node -o lpar1-lpar9 mgt=fsp groups=all parent=cec1 nodetype=lpar hcp=cec1 @@ -246,7 +252,15 @@ then run the command: chvm lpar1-lpar8 -p /tmp/lparfile -=head2 VMware specific: +6. To change the LPAR name, enter: + + chvm lpar1 lparname=test_lpar01 + +Output is similar to: + + lpar1: Success + +=head2 VMware/KVM specific: chvm vm1 -a 8,16 --mem 512 --cpus 2 diff --git a/xCAT-client/pods/man1/db2sqlsetup.1.pod b/xCAT-client/pods/man1/db2sqlsetup.1.pod index 05e07438f..e7c19fd82 100644 --- a/xCAT-client/pods/man1/db2sqlsetup.1.pod +++ b/xCAT-client/pods/man1/db2sqlsetup.1.pod @@ -13,7 +13,7 @@ B {B<-i>|B<--init>}{<-S> | <-C>} [-o|--setupODBC] [B<-V>|B<--verbo B {B<-o>|B<--setupODBC>} {<-S> | <-C>} [-V|--verbose] -B {B<-r>|B<--removal>}{<-S> | <-C>} [B<-V>|B<--verbose>] +B {B<-p>|B<--passwd>} [<-S> | <-C>] =head1 DESCRIPTION @@ -54,9 +54,9 @@ Displays verbose messages. The init option is used to setup an installed DB2 database on AIX or Linux (p-Series) so that xCAT can use the database. This must be combined with either the -S or -C flag to indicate whether we are setting up the Server or the Client. With the -S flag, it involves creating the xcatdb database, the xcatdb instance id, allowing access to the xcatdb database by the Management Node. It also backs up the current xCAT database and restores it into the newly setup xcatdb DB2 database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the DB2 database and restarts the xcatd daemon using the database. -=item B<-r|--removal> +=item B<-p|--passwd> -The removal option is used to remove DB2 from xCAT and uninstall DB2 from either management node or service node. This must be combined with either the -S or -C flag. It not only remove the configuration of DB2 but also un-install DB2. +The password change option is to change the database access password for the DB2 xcatdb database. If -S is input then it will only change the password on the DB2 Server (MN). If -C is input it will only change on the DB2 clients (SN). If neither -S or -C are input with this flag, then it will change both the DB2 Server and Clients. When changing the password the xcatd daemon will be stopped and restarted. Any other tools accessing the database should also be stopped before changing and restarted after changing. =item B<-S|-C> @@ -104,8 +104,8 @@ B I<-r> I<-S> =item * -To remove DB2 from xCAT MN: +To change the DB2 xcatdb password on both the Management and Service Nodes: -B I<-r> I<-C> +B I<-p> =back diff --git a/xCAT-client/pods/man1/dumpxCATdb.1.pod b/xCAT-client/pods/man1/dumpxCATdb.1.pod index 291505668..0af2ed9e2 100644 --- a/xCAT-client/pods/man1/dumpxCATdb.1.pod +++ b/xCAT-client/pods/man1/dumpxCATdb.1.pod @@ -11,7 +11,7 @@ B [B<-h>|B<--help>] [B<-v>|B<--version>] =head1 DESCRIPTION -The dumpxCATdb command creates .csv files for all xCAT database tables and puts them in the directory given by the -p flag. These files can be used by the restorexCATdb command to restore the database. +The dumpxCATdb command creates .csv files for xCAT database tables and puts them in the directory given by the -p flag. These files can be used by the restorexCATdb command to restore the database. The command will read the list of tables in the site.skiptables attribute and not backup those tables. =head1 OPTIONS @@ -24,7 +24,7 @@ B<-V> Verbose. B<-a> All,without this flag the eventlog and auditlog will be skipped. -B<-p> Path to the directory to dump the tables. +B<-p> Path to the directory to dump the tables. It will be created, if it does not exist. =head1 RETURN VALUE @@ -43,7 +43,9 @@ B B +2. To have dumpxCATdb not backup the hosts or passwd table: +B =head1 FILES diff --git a/xCAT-client/pods/man1/genimage.1.pod b/xCAT-client/pods/man1/genimage.1.pod index c1e8b82cc..1279ea0a0 100644 --- a/xCAT-client/pods/man1/genimage.1.pod +++ b/xCAT-client/pods/man1/genimage.1.pod @@ -4,9 +4,9 @@ B - Generates a stateless image to be used for a diskless install. =head1 SYNOPSIS -B [B<-i> I] [B<-n> I] B<-o> I B<-p> I [B<-l> I] [B<-r> I] [B<-k> I] [B<--permission> I] +B B<-o> I B<-p> I [B<-i> I] [B<-n> I] [B<-l> I] [B<-r> I] [B<-k> I] [B<-g> I] [B<-m> statelite] [B<--permission> I] -B [B<-i> I] [B<-n> I] [B<-o> I] [B<-l> I] [B<-r> I] [B<-k> I] imagename +B [B<-o> I] [B<-l> I] [B<-i> I] [B<-n> I] [B<-r> I] [B<-k> I] [B<-g> I] [B<-m> statelite] imagename B [B<-h> | B<--help> | B<-v> | B<--version>] @@ -34,7 +34,9 @@ image, install any additional software you would like, or make modifications to B to prepare the image for deployment. The B and B commands will generate two initial ramdisks for B and B, one is B, the other one is B. - + +The B command can not be used in interactive mode. If any of the rpms or other scripts prompt, such as to accept a license agreement, you must use the genimage script specific to your OS from the /opt/xcat/share/xcat/netboot/ directory. + =head1 Parameters I specifies the name of a os image definition to be used. The specification for the image is storted in the I table and I table. @@ -88,6 +90,15 @@ Other network interfaces (e.g. eth1) in the image that should be configured via 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<-g> I + +This flag is for SLES only. Use this flag to specify the rpm version for kernel packages in the image. It must be present if -k flag is specified in the command for SLES. + +=item B<-m> statelite + +This flag is for Ubuntu, Debian and Fedora12 only. Use this flag to specify if you want to generate statelite image. The default is to generate stateless image for these three operating systems. For others, this flag is invalid because both stateless and statelite images will be generated with this command. + + =item B<-v|--version> Display version. @@ -126,6 +137,8 @@ This would use the profile information from the /opt/xcat/share/xcat/netboot/fed =head1 FILES +/opt/xcat/bin/genimage + /opt/xcat/share/xcat/netboot//genimage diff --git a/xCAT-client/pods/man1/getmacs.1.pod b/xCAT-client/pods/man1/getmacs.1.pod index 903d3880b..192b9b14c 100644 --- a/xCAT-client/pods/man1/getmacs.1.pod +++ b/xCAT-client/pods/man1/getmacs.1.pod @@ -12,7 +12,7 @@ B [B<-h>| B<--help> | B<-v>| B<--version>] B I [B<-F> I] -B I [B<-V>| B<--verbose>] [B<-f>] [B<-d>] [B<--arp>] | [B<-D> [B<-S> I] [B<-G> I] [B<-C> I] [B<--hfi>] [B<-o>]] +B I [B<-V>| B<--verbose>] [B<-f>] [B<-d>] [B<--arp>] | [B<-D> [B<-S> I] [B<-G> I] [B<-C> I] [B<-o>]] =head2 blade specific: @@ -26,8 +26,6 @@ If no ping test performed, getmacs writes the first adapter MAC to the xCAT dat For PPC (without HMC, using Direct FSP Management) specific: -If users run "B I" directly for P7 IH LPARs, it will return the HIF MAC addresses which are owned by the LPARs. If run B with ping test by default, it will return the physical mac address. If run getmacs with ping test using B<--hfi>, it will return the HFI MAC address. - Note: If network adapters are physically assigned to LPARs, getmacs cannot read the MAC addresses unless perform ping test, since there is no HMC command to read them and getmacs has to login to open formware. And if the LPARs has never been activated before, getmacs need to be performed with the option "B<-D>" to get theirs MAC addresses. =head1 OPTIONS @@ -64,10 +62,6 @@ B<-h> Display usage message. -B<--hfi> - -Read HFI MAC address. This option mush be used with [B<-D>] option to perform ping test. - B<-o> Read MAC address when the lpar is in openfirmware state. This option mush be used with [B<-D>] option to perform ping test. Before use B<-o>, the lpar must be in openfirmware state. @@ -152,27 +146,16 @@ Output is similar to: #Type Location Code MAC Address Full Path Name Ping Result ent U9133.55A.10B7D1G-V12-C4-T1 8e:e2:24:5c:f0:04 /vdevice/l-lan@30000004 successful virtual -6. To retrieve the MAC address for P7 IH LPARl using Direct FSP Management without ping test and display the result only, enter: +6. To retrieve the MAC address for Power 775 LPAR using Direct FSP Management without ping test and display the result only, enter: - getmacs c250f07c04ap01 -d + getmacs lpar4 -d Output is similar to: - c250f07c04ap01: + lpar4: #Type Phys_Port_Loc MAC_Address Adapter Port_Group Phys_Port Logical_Port VLan VSwitch Curr_Conn_Speed HFI N/A 02:00:02:00:00:04:|02:00:02:00:00:05:|02:00:02:00:00:06 N/A N/A N/A N/A N/A N/A N/A -7. To retrieve the HFI MAC address for P7 IH LPARl using Direct FSP Management ping test and display the result only, enter: - - getmacs c250f07c07ap01 -d -D --hfi - -Output is similar to: - - c250f07c07ap01: - # Type Location Code MAC Address Full Path Name Ping Result - hfi-ent U78A9.001.0123456-P1 020004200004 /hfi-iohub@300000000000000/hfi-ethernet@0 unsuccessful physical - hfi-ent U78A9.001.0123456-P1 020004200004 /hfi-iohub@300000000000000/hfi-ethernet@1 unsuccessful physical - =head1 FILES /opt/xcat/bin/getmacs diff --git a/xCAT-client/pods/man1/lsdef.1.pod b/xCAT-client/pods/man1/lsdef.1.pod index 0ce4ddc08..bd4a1f0fe 100644 --- a/xCAT-client/pods/man1/lsdef.1.pod +++ b/xCAT-client/pods/man1/lsdef.1.pod @@ -8,7 +8,7 @@ B [B<-h>|B<--help>] [B<-t> I] B [B<-V>|B<--verbose>] [B<-l>|B<--long>] [B<-s>|B<--short>] [B<-a>|B<--all>] [B<-S>] [B<-t> I] [B<-o> I] [B<-z>|B<--stanza>] [B<-i> I] -[[B<-w> I==I] [B<-w> I=~I] ...] [I] +[B<-c>|B<--compress>] [B<--osimage>][[B<-w> I==I] [B<-w> I=~I] ...] [I] =head1 DESCRIPTION @@ -25,6 +25,12 @@ in the xCAT database. Display all definitions. +=item B<-c|--compress> + +Display information in compressed mode, each output line has format ": ". +The output can be passed to command xcoll or xdshbak for formatted output. +The -c flag must be used with -i flag. + =item B<-h|--help> Display usage message. @@ -54,6 +60,10 @@ See the "noderange" man page for details on supported formats. A set of comma delimited object names. +=item B<--osimage> + +Show all the osimage information for the node. + =item B<-t> I A set of comma delimited object types. Use the help option to get a list of valid objects. @@ -185,8 +195,14 @@ The hidden nodes are FSP/BPAs. lsdef -S -=back +=item 15. + +To list the nodes status and use xcoll to format the output. + + lsdef -t node -i status -c | xcoll + +=back =head1 FILES diff --git a/xCAT-client/pods/man1/lshwconn.1.pod b/xCAT-client/pods/man1/lshwconn.1.pod index 56de2333b..6e958831e 100644 --- a/xCAT-client/pods/man1/lshwconn.1.pod +++ b/xCAT-client/pods/man1/lshwconn.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Use this command to display the connection status for FSP and BPA nodes. +B - Use this command to display the connection status for CEC and Frame nodes. =head1 SYNOPSIS @@ -18,7 +18,7 @@ B I B<-T> I =head1 DESCRIPTION -This command is used to display the connection status for FSP and BPA node. +This command is used to display the connection status for CEC and Frame node. =head1 OPTIONS @@ -34,7 +34,7 @@ Verbose output. =item B<-T> -The tooltype is used to communicate to the FSP/BPA. The value could be lpar or fnm. The tooltype value lpar is for xCAT and fnm is for CNM. +The tooltype is used to communicate to the CEC/Frame. The value could be lpar or fnm. The tooltype value lpar is for xCAT and fnm is for CNM. =back @@ -51,9 +51,9 @@ The tooltype is used to communicate to the FSP/BPA. The value could be lpar or f =item 1. -To display connection status for all FSP nodes in node group fsp: +To display connection status for all CEC nodes in node group CEC: - lshwconn fsp + lshwconn cec Output is similar to: @@ -62,7 +62,7 @@ Output is similar to: =item 2. -To display connection status for BPA node frame1: +To display connection status for Frame node frame1: lshwconn frame1 @@ -73,9 +73,9 @@ Output is similar to: =item 3. -To display connection status for all FSP nodes in node group fsp to hardware server, and using lpar tooltype: +To display connection status for all CEC nodes in node group CEC to hardware server, and using lpar tooltype: - lshwconn fsp -T lpar + lshwconn cec -T lpar Output is similar to: diff --git a/xCAT-client/pods/man1/lsslp.1.pod b/xCAT-client/pods/man1/lsslp.1.pod index 9ed4af811..44d4bb573 100644 --- a/xCAT-client/pods/man1/lsslp.1.pod +++ b/xCAT-client/pods/man1/lsslp.1.pod @@ -9,7 +9,7 @@ I I -I] [-V| --verbose] [-i ip[,ip..]][-w][-r|-x|-z][-n][-s CEC|FRAME|MM|IVM|RSA|HMC][-t tries][-m][-I][-e command][-c [timeinterval[timeinterval,..]]][-C counts][-T timeout][--vpdtable][-M vpd|switchport][--updatehosts][-makedhcp][--resetnet]> +I] [-V| --verbose] [-i ip[,ip..]][-w][-r|-x|-z][-n][-s CEC|FRAME|MM|IVM|RSA|HMC][-t tries][-m][-I][-e command][-c [timeinterval[timeinterval,..]]][-C counts][-T timeout][--vpdtable][-M vpd|switchport][--updatehosts][-makedhcp]> =head1 DESCRIPTION @@ -65,8 +65,6 @@ B<-C> The number of the nodes expected to find, specified by the user. B<-T> The number in seconds to limite the time costing of lsslp. Must be used with the flag -C. See the help of flag -C for more details. -B<--resetnet> Login to hardwares and reset the network interfaces. This option is only valid - for the nodes with different attributes: ip and otherinterfaces in hosts table. B<-s> Service type interested in discovering. @@ -243,20 +241,9 @@ Output is similar to: ip=50.0.0.1 -6. To list all the FSPs and reset their network interfaces to get new IP from dhcp server, enter: +6. To list all the CECs, enter: - lsslp -s CEC --resetnet - -Output is similar to: - - Start to reset network.. - - Reset network failed nodes: - - Reset network succeed nodes: - Server-8233-E8B-SN1000ECP-A,Server-9119-FHA-SN0275995-B,Server-9119-FHA-SN0275995-A, - - Reset network finished. + lsslp -s CEC device type-model serial-number side ip-addresses hostname FSP 9117-MMB 105EBEP A-1 20.0.0.138 20.0.0.138 diff --git a/xCAT-client/pods/man1/lsvm.1.pod b/xCAT-client/pods/man1/lsvm.1.pod index f2abc05f8..a9b74cb18 100644 --- a/xCAT-client/pods/man1/lsvm.1.pod +++ b/xCAT-client/pods/man1/lsvm.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Lists partition profile information for HMC- and IVM-managed nodes. For P7 IH, it lists the LPARs' I/O slots information and CEC configuration. +B - Lists partition profile information for HMC- and IVM-managed nodes. For Power 775, it lists the LPARs' I/O slots information and CEC configuration. =head1 SYNOPSIS @@ -14,7 +14,7 @@ B [B<-a>| B<--all>] I =head2 For PPC (using Direct FSP Management): -B I +B [B<-l>| B<--long>] I =head1 DESCRIPTION @@ -22,7 +22,7 @@ B I =head2 For PPC (using Direct FSP Management): - For P7 IH, lsvm lists all partition I/O slots information for the partitions specified in noderange. If noderange is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information + For Power 775, lsvm lists all partition I/O slots information for the partitions specified in noderange. If noderange is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information =head1 OPTIONS @@ -43,6 +43,10 @@ B<-a> List all the profiles for one partition +B<-l> + +Show lparnames for lpars. + =head1 RETURN VALUE 0 The command completed successfully. @@ -63,13 +67,13 @@ Output is similar to: lsvm cec01 -Output is similar to: +g Output is similar to: cec01: name=10-B7D1G,lpar_name=10-B7D1G,lpar_id=1,os_type=vioserver,all_resources=0,min_mem=512, desired_mem=2048,max_mem=2048,proc_mode=shared,min_proc_units=0.10,desired_proc_units=0.40, max_proc_units=4.00,min_procs=1,desired_procs=4,max_procs=4,sharing_mode=uncap,uncap_weight=128, "io_slots=21010002/none/0,21010003/none/0,21010004/none/0,21020003/none/0,21020004/none/0,21030003/none/0,21030004/none/0,21040003/none/0,21040004/none/0",lpar_io_pool_ids=none,max_virtual_slots=48, "virtual_serial_adapters=0/server/1/any//any/1,1/server/1/any//any/1,10/client/0/2/lp2/0/0,12/client/0/3/lp3/0/0,14/client/0/4/lp4/0/0","virtual_scsi_adapters=11/server/2/lp2/2/0,13/server/3/lp3/2/0,15/server/4/lp4/2/0","virtual_eth_adapters=3/0/1//1/0,4/0/2//1/0,5/0/3//1/0,6/0/4//1/0",boot_mode=norm,conn_monitoring=0,auto_start=0,power_ctrl_lpar_ids=none name=lp2,lpar_name=lp2,lpar_id=2,os_type=aixlinux,all_resources=0,min_mem=128,desired_mem=1024,max_mem=1024,proc_mode=shared,min_proc_units=0.10,desired_proc_units=0.10,max_proc_units=4.00,min_procs=1,desired_procs=1,max_procs=4,sharing_mode=uncap,uncap_weight=128,io_slots=none,lpar_io_pool_ids=none,max_virtual_slots=6, "virtual_serial_adapters=0/server/1/any//any/1,1/server/1/any//any/1",virtual_scsi_adapters=2/client/1/10-7D1G/11/1,virtual_eth_adapters=4/0/1//0/0,boot_mode=norm,conn_monitoring=0,auto_start=0,power_ctrl_lpar_ids=none name=lp3,lpar_name=lp3,lpar_id=3,os_type=aixlinux,all_resources=0,min_mem=128,desired_mem=128,max_mem=128,proc_mode=shared,min_proc_units=0.10,desired_proc_units=0.10,max_proc_units=4.00,min_procs=1,desired_procs=1,max_procs=4,sharing_mode=uncap,uncap_weight=128,io_slots=none,lpar_io_pool_ids=none,max_virtual_slots=6, "virtual_serial_adapters=0/server/1/any//any/1,1/server/1/any//any/1",virtual_scsi_adapters=2/client/1/10-B7D1G/13/1,virtual_eth_adapters=4/0/1//0/0,boot_mode=of,conn_monitoring=0,auto_start=1, power_ctrl_lpar_ids=none -3. For P7 IH, to list the I/O slot information of lpar1, enter: +3. For Power 775, to list the I/O slot information of lpar1, enter: lsvm lpar1 @@ -79,7 +83,16 @@ Output is similar to: 1: 513/U78A9.001.0123456-P1-C15/0x21010201/2/1 1: 512/U78A9.001.0123456-P1-C16/0x21010200/2/1 -4. For P7 IH, to list the I/O slot information and octant configuration of cec1, enter: +To list the lparname of lpars, enter: + + lsvm lpar1 -l + +Output is similar to: + lpar1: 1: 514/U78A9.001.0123456-P1-C17/0x21010202/2/1 + lpar1: 1: 513/U78A9.001.0123456-P1-C15/0x21010201/2/1 + lpar1: 1: 512/U78A9.001.0123456-P1-C16/0x21010200/2/1 + +4. For Power 775, to list the I/O slot information and octant configuration of cec1, enter: lsvm cec1 @@ -104,6 +117,31 @@ Output is similar to: 9: 528/U78A9.001.0123456-P1-C12/0x21010210/2/9 cec1: PendingPumpMode=1,CurrentPumpMode=1,OctantCount=8:OctantID=0,PendingOctCfg=5,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=1,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=2,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=3,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=4,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=5,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=6,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=7,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2; +To list the lparname of lpars, enter: + + lsvm cec1 -l + +Output is similar to: + + lpar1: 1: 514/U78A9.001.0123456-P1-C17/0x21010202/2/1 + lpar1: 1: 513/U78A9.001.0123456-P1-C15/0x21010201/2/1 + lpar1: 1: 512/U78A9.001.0123456-P1-C16/0x21010200/2/1 + lpar13: 13: 537/U78A9.001.0123456-P1-C9/0x21010219/2/13 + lpar13: 13: 536/U78A9.001.0123456-P1-C10/0x21010218/2/13 + lpar17: 17: 545/U78A9.001.0123456-P1-C7/0x21010221/2/17 + lpar17: 17: 544/U78A9.001.0123456-P1-C8/0x21010220/2/17 + lpar21: 21: 553/U78A9.001.0123456-P1-C5/0x21010229/2/21 + lpar21: 21: 552/U78A9.001.0123456-P1-C6/0x21010228/2/21 + lpar24: 25: 569/U78A9.001.0123456-P1-C1/0x21010239/2/25 + lpar25: 25: 561/U78A9.001.0123456-P1-C3/0x21010231/2/25 + lpar25: 25: 560/U78A9.001.0123456-P1-C4/0x21010230/2/25 + lpar29: 29: 568/U78A9.001.0123456-P1-C2/0x21010238/2/29 + lpar5: 5: 521/U78A9.001.0123456-P1-C13/0x21010209/2/5 + lpar5: 5: 520/U78A9.001.0123456-P1-C14/0x21010208/2/5 + lpar9: 9: 529/U78A9.001.0123456-P1-C11/0x21010211/2/9 + lpar9: 9: 528/U78A9.001.0123456-P1-C12/0x21010210/2/9 + cec1: PendingPumpMode=1,CurrentPumpMode=1,OctantCount=8:OctantID=0,PendingOctCfg=5,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=1,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=2,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=3,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=4,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=5,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=6,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2;OctantID=7,PendingOctCfg=1,CurrentOctCfg=1,PendingMemoryInterleaveMode=2,CurrentMemoryInterleaveMode=2; + =head1 FILES /opt/xcat/bin/lsvm diff --git a/xCAT-client/pods/man1/mkdsklsnode.1.pod b/xCAT-client/pods/man1/mkdsklsnode.1.pod index 5459245b2..7c1aa4082 100644 --- a/xCAT-client/pods/man1/mkdsklsnode.1.pod +++ b/xCAT-client/pods/man1/mkdsklsnode.1.pod @@ -6,15 +6,29 @@ B - Use this xCAT command to define and initialize AIX/NIM diskless B -B +B =head1 DESCRIPTION -This xCAT command can be used to define and/or initialize AIX/NIM diskless machines. Once this step is completed the xCAT rnetboot command may be used to initiate a network boot of the nodes. +This xCAT command can be used to define and/or initialize AIX/NIM diskless machines. Once this step is completed the xCAT B command may be used to initiate a network boot of the nodes. -The command can be used to define and initialize a new NIM machine object or it may be used to reinitialize an existing machine to use a different operating system image. +The command can be used to define and initialize a new NIM machine object or it can be used to reinitialize an existing machine to use a different operating system image. -Note: The length of a NIM object name must be no longer than 39 characters. +This command will also create a NIM resolv_conf resource to be used when installing the node. If a resolv_conf resource is not already included in the xCAT osimage definition and if the "domain" and "nameservers" values are set then a new resolv_conf resource will be created and the name will be added to the osimage definition. + +The "domain" and "nameservers" attributes can be set in either the xCAT "network" definition used by the nodes or in the xCAT cluster "site" definition. The setting in the "network" definition will take priority. + +The "nameservers" value can either be set to a specific IP address or the "" key word. The "" key word means that the value of the "xcatmaster" attribute of the node definition will be used in the /etc/resolv.conf file. (I.e. The name of the install server as known by the node.) + +You can set the "domain" and "nameservers" attributes by using the B command. For example: + +=over 3 + +chdef -t network -o clstr_net domain=cluster.com nameservers= + +=back + +If the "domain" and "nameservers" attributes are not set in either the nodes "network" definition or the "site" definition then no new NIM resolv_conf resource will be created. If you are using xCAT service nodes the B command will automatically determine the correct server(s) for the node and create the NIM definitions on that server(s). @@ -24,9 +38,9 @@ You can use the "-n" option of the mkdsklsnode command to create and initialize You can use the force option to reinitialize a node if it already has resources allocated or it is in the wrong NIM state. This option will reset the NIM node and deallocate resources before reinititializing. Use this option with caution since reinitializing a node will stop the node if it is currently running. -After the mkdsklsnode command completes you can use the lsnim command to check the NIM node definition to see if it is ready for booting the node. ("lsnim -l "). +After the mkdsklsnode command completes you can use the B command to check the NIM node definition to see if it is ready for booting the node. ("lsnim -l "). -You can supply your own scripts to be run on the mn or on the service node (if their is hierarchy) for a node during the mkdsklsnode command. Such scripts are called B. They should be copied to /install/prescripts dirctory. A table called I is used to specify the scripts and their associated actions. The scripts to be run at the beginning of the mkdsklsnode command are stored in the 'begin' column of I table. The scripts to be run at the end of the mkdsklsnode command are stored in the 'end' column of I table. Please run 'tabdump prescripts -d' command for details. An example for the 'begin' or the 'end' column is: I. The following two environment variables will be passed to each script: NODES contains all the names of the nodes that need to run the script for and ACTION contains the current current nodeset action, in this case "diskless". If I<#xCAT setting:MAX_INSTANCE=number> is specified in the script, the script will get invoked for each node in parallel, but no more than I of instances will be invoked at at a time. If it is not sepcified, the script will be invoked once for all the nodes. +You can supply your own scripts to be run on the management node or on the service node (if their is hierarchy) for a node during the B command. Such scripts are called B. They should be copied to /install/prescripts dirctory. A table called I is used to specify the scripts and their associated actions. The scripts to be run at the beginning of the B command are stored in the 'begin' column of I table. The scripts to be run at the end of the B command are stored in the 'end' column of I table. Please run 'tabdump prescripts -d' command for details. An example for the 'begin' or the 'end' column is: I. The following two environment variables will be passed to each script: NODES contains all the names of the nodes that need to run the script for and ACTION contains the current current nodeset action, in this case "diskless". If I<#xCAT setting:MAX_INSTANCE=number> is specified in the script, the script will get invoked for each node in parallel, but no more than I of instances will be invoked at at a time. If it is not sepcified, the script will be invoked once for all the nodes. =head1 OPTIONS @@ -80,13 +94,13 @@ Use the force option to reinitialize the NIM machines. Display usage message. -=item B<--hfi> - -Create a new NIM machine booting from HFI interfaces. - =item B<-i image_name> -The name of an existing xCAT osimage definition. If this information is not provided on the command line the code checks the node definition for the value of the "profile" attribute. If the "-i" value is provided on the command line then that value will be used to set the "profile" attribute of the node definiions. +The name of an existing xCAT osimage definition. If this information is not provided on the command line the code checks the node definition for the value of the "provmethod" attribute. If the "-i" value is provided on the command line then that value will be used to set the "provmethod" attribute of the node definitions. + +=item B<-l|--location> + +The directory location to use when creating new NIM resolv_conf resources. The default location is /install/nim. =item B<-n|--newname> @@ -132,7 +146,7 @@ B =item 2 -Initialize all AIX diskless nodes contained in the xCAT node group called "aixnodes" using the image definitions pointed to by the "profile" attribute of the xCAT node definitions. +Initialize all AIX diskless nodes contained in the xCAT node group called "aixnodes" using the image definitions pointed to by the "provmethod" attribute of the xCAT node definitions. B diff --git a/xCAT-client/pods/man1/mkhwconn.1.pod b/xCAT-client/pods/man1/mkhwconn.1.pod index e7b00afd7..bc0e0ef34 100644 --- a/xCAT-client/pods/man1/mkhwconn.1.pod +++ b/xCAT-client/pods/man1/mkhwconn.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Sets up connections for FSP and BPA nodes to HMC nodes or hardware server. +B - Sets up connections for CEC and Frame nodes to HMC nodes or hardware server. =head1 SYNOPSIS @@ -10,13 +10,13 @@ B [B<-v>| B<--version>] =head2 PPC (with HMC) specific: -B [B<-V>| B<--verbose>] I B<-t> +B [B<-V>| B<--verbose>] I B<-t> [B<--port> I] -B [B<-V>| B<--verbose>] Inoderange B<-s> +B [B<-V>| B<--verbose>] I B<-s> [I B<--port> I] -B [B<-V>| B<--verbose>] I B<-p> I [B<-P> I] +B [B<-V>| B<--verbose>] I B<-p> I [B<-P> I] [B<--port> I] -=head2 PPC (without HMC, using Direct FSP Management) specific: +=head2 PPC (using Direct FSP Management) specific: B I B<-t> [B<-T tooltype>] [B<--port> I] @@ -24,26 +24,26 @@ B I B<-t> [B<-T tooltype>] [B<--port> I] For PPC (with HMC) specific: -This command is used to set up connections for FSP and BPA nodes to HMC nodes. (If the connection already exists, it will not break it.) -This command is useful when you have multiple HMCs, each of which will manage a subset of the FSPs/BPAs. Use B to tell -each HMC which FSPs/BPAs it should manage. When using this, you should turn off the self-discovery on each HMC. You also need -to put all the HMCs and all the BPAs on a single flat service network. +This command is used to set up connections for CEC and Frame nodes to HMC nodes. (If the connection already exists, it will not break it.) +This command is useful when you have multiple HMCs, each of which will manage a subset of the CECs/Frames. Use B to tell +each HMC which CECs/Frames it should manage. When using this, you should turn off the self-discovery on each HMC. You also need +to put all the HMCs and all the Frames on a single flat service network. -When B<-t> is specified, this command reads the connection information from the xCAT ppc table (e.g. the parent attribute), and read the user/password from the ppcdirect table. Then this command will assign FSP nodes and BPA nodes to HMC nodes. +When B<-t> is specified, this command reads the connection information from the xCAT ppc table (e.g. the parent attribute), and read the user/password from the ppcdirect table. Then this command will assign CEC nodes and Frame nodes to HMC nodes. -When B<-p> is specified, this command gets the connection information from command line arguments. If B<-P> is not specified, the default password for FSP and BPA nodes is used. +When B<-p> is specified, this command gets the connection information from command line arguments. If B<-P> is not specified, the default password for CEC and Frame nodes is used. -The flag B<-s> is used to make the connection between the frame and its Service focal point(HMC). The sfp of the frame should be specified in ppc table. +The flag B<-s> is used to make the connection between the frame and its Service focal point(HMC). Makehwconn will also set the connections between the CECs within this Frame and the HMC. The sfp of the frame/CEC can either be defined in ppc table beforehand or specified in command line after the flag -s. If the user use mkhwconn noderange -s HMC_name, it will not only make the connections but also set the sfp attributes for these nodes in PPC table. -In any case, before running this command, the FSP and BPA nodes need be defined with correct nodetype.nodetype value (fsp or bpa) and nodehm.mgt value (hmc). +In any case, before running this command, the CEC and Frame nodes need be defined with correct nodetype.nodetype value (cec or frame) and nodehm.mgt value (hmc). -Note: If a CEC (FSP) belongs to a frame, which has a BPA installed, this CEC should not be assigned to an HMC individually. Instead, the whole frame (BPA) should be assigned to the HMC. +Note: If a CEC belongs to a frame, which has a BPA installed, this CEC should not be assigned to an HMC individually. Instead, the whole frame should be assigned to the HMC. -For PPC (without HMC, using Direct FSP Management) specific: +For PPC (using Direct FSP Management) specific: -It is used to set up connections for FSP and BPA node to Hardware Server on management node (or service node ). It only could be done according to the node definition in xCAT DB. And this command will try to read the user/password from the ppcdirect table firstly. If fails, then read them from passwd table. Commonly , the username is B. If using the B table, each FSP/BPA and user/password should be stored in B table. If using the B table, the key should be "B" or "B", and the related user/password are stored in B table. +It is used to set up connections for CEC and Frame node to Hardware Server on management node (or service node ). It only could be done according to the node definition in xCAT DB. And this command will try to read the user/password from the ppcdirect table firstly. If fails, then read them from passwd table. Commonly , the username is B. If using the B table, each CEC/Frame and user/password should be stored in B table. If using the B table, the key should be "B" or "B", and the related user/password are stored in B table. -When B<--port> is specified, this command will create the connections for FSPs/BPAs whose side in B table is equal to port value. +When B<--port> is specified, this command will create the connections for CECs/Frames whose side in B table is equal to port value. =head1 OPTIONS @@ -55,7 +55,7 @@ Display usage message. =item B<-t> -Read connection information from xCAT DB (ppc and ppcdirect tables). Use this option if you need to connect multiple FSPs/BPAs +Read connection information from xCAT DB (ppc and ppcdirect tables). Use this option if you need to connect multiple CECs/Frames to multiple HMCs in a single command. =item B<-p> @@ -64,19 +64,19 @@ The HMC node name. Only one HMC nodes can be specified by this flag. To setup co =item B<-P> -The password of HMC based FSP/BPA login user(Default user name is 'HMC'). This flag is optional. +The password of HMC based CEC/Frame login user(Default user name is 'HMC'). This flag is optional. =item B<-T> -The tooltype is used to communicate to the FSP/BPA. The value could be B or B. The tooltype value B is for xCAT and B is for CNM. The default value is "B". +The tooltype is used to communicate to the CEC/Frame. The value could be B or B. The tooltype value B is for xCAT and B is for CNM. The default value is "B". =item B<--port> -The port value specify which side will be used to create the connection to the FSP/BPA. The value could be "B<0>" or "B<1>". If this port value is not specfied in the command, it will use the default value "B<0>". If the port value is "B<0>", in the vpd table, the side column should be B and B; If the port value is "B<1>", the side column should be B and B. +The port value specify which side will be used to create the connection to the CEC/Frame. The value could be "B<0>" or "B<1>". If this port value is not specfied in the command, it will use the default value "B<0>". If the port value is "B<0>", in the vpd table, the side column should be B and B; If the port value is "B<1>", the side column should be B and B. When making hardware connection between CEC/Frame and HMC, the port is used to specify the fsp/bpa port of the cec/frame. =item B<-s> -The flag -s is used to make the connection between the frame and its Service Focal Point(HMC). -s flag is not supposed to work with other functional flags. The noderange should be frame. +The flag -s is used to make the connection between the frame and its Service Focal Point(HMC). -s flag is not supposed to work with other functional flags. =item B<-V|--verbose> @@ -96,21 +96,33 @@ Verbose output. =item 1. -To setup the connection for all FSP nodes in node group fsp to HMC node, according to the definition in xCAT DB: +To setup the connection for all CEC nodes in node group cec to HMC node, according to the definition in xCAT DB: - mkhwconn fsp -t + mkhwconn cec -t =item 2. -To setup the connection for BPA nodes in node group frame_grp1 to HMC node hmc1, with password 'abc123': +To setup the connection for Frame nodes in node group frame to HMC node hmc1, with password 'abc123': - mkhwconn frame_grp1 -p hmc1 -P abc123 + mkhwconn frame -p hmc1 -P abc123 =item 3. -To setup the connections for all FSP nodes in node group fsp to hardware server, and the tooltype value is lpar: +To setup the connections for all CEC nodes in node group cec to hardware server, and the tooltype value is lpar: - mkhwconn fsp -t -T lpar + mkhwconn cec -t -T lpar + +=item 4. + +To setup the connections for all cecs nodes in node group cec to hardware server, and the tooltype value is lpar, and the port value is 1: + + mkhwconn cec -t -T lpar --port 1 + +=item 5. + +To setup the connection between the frame and it's SFP node. This command will also set the connections between the CECs within this frame and their SFP node. User need to define HMC_name in the database in advance, but no need to set the sfp attribute for these node, xCAT will set the HMC_name as ppc.sfp for these nodes. The CECs within this frame should have the same sfp attribute as the frame. + + mkhwconn cec -s HMC_name -P HMC_passwd =back diff --git a/xCAT-client/pods/man1/mysqlsetup.1.pod b/xCAT-client/pods/man1/mysqlsetup.1.pod index 9821ac9c1..2ac3be44a 100644 --- a/xCAT-client/pods/man1/mysqlsetup.1.pod +++ b/xCAT-client/pods/man1/mysqlsetup.1.pod @@ -20,8 +20,7 @@ B {B<-L>|B<--LL>} [-V|--verbose] =head1 DESCRIPTION B - Sets up the MySQL database for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code has been installed. Before running the init option, the MySQL server should be stopped. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in -http://xcat.svn.sourceforge.net/viewvc/xcat/xcat-core/trunk/ -xCAT-client/share/doc/xCAT2.SetupMySQL.pdf. +https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_MySQL_as_the_xCAT_DB Two passwords must be supplied for the setup, a password for the xcatadmin id and a password for the root id in the MySQL database. These will be prompted for interactively, unless the environment variables XCATMYSQLADMIN_PW and XCATMYSQLROOT_PW are set to the passwords for the xcatadmin id and root id in the database,resp. =head1 OPTIONS @@ -57,15 +56,13 @@ This option runs during update, it will take all the host from the input file (p This option sets up the ODBC /etc/../odbcinst.ini, /etc/../odbc.ini and the .odbc.ini file in roots home directory will be created and initialized to run off the xcatdb MySQL database. See "Add ODBC Support" in -http://xcat.svn.sourceforge.net/viewvc/xcat/xcat-core/trunk/ -xCAT-client/share/doc/xCAT2.SetupMySQL.pdf +https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_MySQL_as_the_xCAT_DB =item B<-L|--LL> Additional database configuration specifically for the LoadLeveler product. See "Add ODBC Support" in -http://xcat.svn.sourceforge.net/viewvc/xcat/xcat-core/trunk/ -xCAT-client/share/doc/xCAT2.SetupMySQL.pdf +https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_MySQL_as_the_xCAT_DB =back @@ -95,7 +92,7 @@ B I<-i> =item * -To add hosts from /tmp/xcat/hostlist that can access the xcatdb database in MySQL: +Add hosts from /tmp/xcat/hostlist that can access the xcatdb database in MySQL: B I<-u> I<-f /tmp/xcat/hostlist> diff --git a/xCAT-client/pods/man1/nimnodeset.1.pod b/xCAT-client/pods/man1/nimnodeset.1.pod index 128737245..36a7cd05a 100644 --- a/xCAT-client/pods/man1/nimnodeset.1.pod +++ b/xCAT-client/pods/man1/nimnodeset.1.pod @@ -6,15 +6,33 @@ B - Use this xCAT command to initialize AIX/NIM standalone machines. B -B +B =head1 DESCRIPTION -This xCAT command can be used to initialize AIX/NIM standalone machines. Once this step is completed the xCAT rnetboot command may be used to initiate a network boot of the nodes. +This xCAT command can be used to initialize AIX/NIM standalone machines. Once this step is completed the xCAT B command may be used to initiate a network boot of the nodes. If you are using xCAT service nodes the B command will automatically determine the correct server(s) for the node and do the initialization on that server(s). -The osimage_name is the name of an xCAT osimage definition that contains the list of NIM resources to use when initializing the nodes. If the osimage_name is not provided on the command line the code checks the node definition for the value of the "profile" attribute (which is the name of an osimage definition). If the osimage_image is provided on the command line then the code will also set the "profile" attribute of the node definiions. +The osimage_name is the name of an xCAT osimage definition that contains the list of NIM resources to use when initializing the nodes. If the osimage_name is not provided on the command line the code checks the node definition for the value of the "provmethod" attribute (which is the name of an osimage definition). If the osimage_image is provided on the command line then the code will also set the "provmethod" attribute of the node definiions. + +This command will also create a NIM resolv_conf resource to be used when installing the node. If a resolv_conf resource is not already included in the xCAT osimage definition and if the "domain" and "nameservers" values are set then a new +resolv_conf resource will be created and the name will be added to the osimage definition. + +The "domain" and "nameservers" attributes can be set in either the xCAT "network" definition used by the nodes or in the xCAT cluster "site" definition. The setting in the "network" definition will take priority. + +The "nameservers" value can either be set to a specific IP address or the "" key word. The "" key word means that the value of the "xcatmaster" attribute of the node definition will be used in the /etc/resolv.conf file. (I.e. The name of the install server as known by the node.) + +You can set the "domain" and "nameservers" attributes by using the B command. For example: + +=over 3 + +chdef -t network -o clstr_net domain=cluster.com nameservers= + +=back + +If the "domain" and "nameservers" attributes are not set in either the nodes "network" definition or the "site" definition then no new NIM resolv_conf resource +will be created. You can specify additional attributes and values using the "attr=val" command line option. This information will be passed on to the underlying call to the NIM "nim -o bos_inst" command. See the NIM documentation for information on valid command line options for the nim command. The "attr" must correspond to a NIM attribute supported for the NIM "bos_inst" operation. Information provided by the "attr=val" option will take precedence over the information provided in the osimage definition. @@ -22,9 +40,9 @@ The force option can be used to reinitialize a node if it already has resources This command will also create a NIM script resource to enable the xCAT support for user-provided customization scripts. -After the nimnodeset command completes you can use the lsnim command to check the NIM node definition to see if it is ready for booting the node. ("lsnim -l "). +After the B command completes you can use the B command to check the NIM node definition to see if it is ready for booting the node. ("lsnim -l "). -You can supply your own scripts to be run on the mn or on the service node (if their is hierarchy) for a node during the nimnodeset command. Such scripts are called B. They should be copied to /install/prescripts dirctory. A table called I is used to specify the scripts and their associated actions. The scripts to be run at the beginning of the nimnodeset command are stored in the 'begin' column of I table. The scripts to be run at the end of the nimnodeset command are stored in the 'end' column of I table. Please run 'tabdump prescripts -d' command for details. An example for the 'begin' or the 'end' column is: I. The following two environment variables will be passed to each script: NODES contains all the names of the nodes that need to run the script for and ACTION contains the current current nodeset action, in this case "standalone". If I<#xCAT setting:MAX_INSTANCE=number> is specified in the script, the script will get invoked for each node in parallel, but no more than I of instances will be invoked at at a time. If it is not sepcified, the script will be invoked once for all the nodes. +You can supply your own scripts to be run on the management node or on the service node (if their is hierarchy) for a node during the B command. Such scripts are called B. They should be copied to /install/prescripts dirctory. A table called I is used to specify the scripts and their associated actions. The scripts to be run at the beginning of the B command are stored in the 'begin' column of I table. The scripts to be run at the end of the B command are stored in the 'end' column of I table. Please run 'tabdump prescripts -d' command for details. An example for the 'begin' or the 'end' column is: I. The following two environment variables will be passed to each script: NODES contains all the names of the nodes that need to run the script for and ACTION contains the current nodeset action, in this case "standalone". If I<#xCAT setting:MAX_INSTANCE=number> is specified in the script, the script will get invoked for each node in parallel, but no more than I of instances will be invoked at at a time. If it is not sepcified, the script will be invoked once for all the nodes. =head1 OPTIONS @@ -51,6 +69,11 @@ Display usage message. The name of an existing xCAT osimage definition. +=item B<-l|--location> + +The directory location to use when creating new NIM resolv_conf resources. The d +efault location is /install/nim. + =item B<-p|--primarySN> When using backup service nodes only update the primary. The default is to update both the primary and backup service nodes. @@ -89,7 +112,7 @@ B =back -2) Initialize all AIX nodes contained in the xCAT node group called "aixnodes" using the image definitions pointed to by the "profile" attribute of the xCAT node definitions. +2) Initialize all AIX nodes contained in the xCAT node group called "aixnodes" using the image definitions pointed to by the "provmethod" attribute of the xCAT node definitions. =over 5 diff --git a/xCAT-client/pods/man1/renergy.1.pod b/xCAT-client/pods/man1/renergy.1.pod index f764a379e..21ae00166 100644 --- a/xCAT-client/pods/man1/renergy.1.pod +++ b/xCAT-client/pods/man1/renergy.1.pod @@ -29,10 +29,12 @@ B B I [-V] { all | [savingstatus] [dsavingstatus] [cappingstatus] [cappingmaxmin] [cappingvalue] [cappingsoftmin] [averageAC] [averageDC] [ambienttemp] [exhausttemp] [CPUspeed] -[syssbpower] [sysIPLtime] } +[syssbpower] [sysIPLtime] [fsavingstatus] [ffoMin] [ffoVmin] +[ffoTurbo] [ffoNorm] [ffovalue]} B I [-V] { savingstatus={on | off} -| dsavingstatus={on-norm | on-maxp | off} +| dsavingstatus={on-norm | on-maxp | off} +| fsavingstatus={on | off} | ffovalue=MHZ | cappingstatus={on | off} | cappingwatt=watt | cappingperc=percentage } @@ -142,7 +144,7 @@ B: savingstatus =back -B<8233-E8B>, B<8236-E8C>, B<9125-F2C> +B<8233-E8B>, B<8236-E8C> =over 4 @@ -157,6 +159,22 @@ cappingperc =back +B<9125-F2C> + +=over 4 + +Supported attributes: + +B: savingstatus,dsavingstatus,cappingstatus,cappingmin, +cappingmax,cappingvalue,cappingsoftmin,averageAC,averageDC, +ambienttemp,exhausttemp,CPUspeed,syssbpower,sysIPLtime, +fsavingstatus,ffoMin,ffoVmin,ffoTurbo,ffoNorm,ffovalue + +B: savingstatus,dsavingstatus,cappingstatus,cappingwatt, +cappingperc,fsavingstatus,ffovalue + +=back + =back Note: @@ -331,6 +349,62 @@ B is in turn off status. Query the current exhaust temperature. (Unit is centigrade) +=item B + +Query the minimum cpu frequency which can be set for FFO. (Fixed +Frequency Override) + +=item B + +Query the maximum cpu frequency which can be set for FFO. + +=item B + +Query the advertised maximum cpu frequency (selling point). + +=item B + +Query the minimum cpu frequency which can be set for dropping down +the voltage to save power. That means when you drop the cpu +frequency from the ffoVmin to ffoVmin, the voltage won't change, +then there's no obvious power to be saved. + +=item B + +Query the current value of FFO. + +=item B=B + +Set the current value of FFO. The valid value of ffovalue should +be between the ffoMin and ffoNorm. + +Note1: Due to the limitation of firmware, the frequency in the range +3501 MHz - 3807 MHz can NOT be set to ffovalue. This range may be +changed in future. + +Note2: The setting will take effect only when the fsavingstatus is in +'on' status. But you need to set the ffovalue to a valid value before +enabling the fsavingstatus. (It's a limitation of the initial firmware +and will be fixed in future.) + +The ffovalue setting operation needs about 1 minute to take effect. + +=item B + +Query the status of FFO. The result should be 'on' or 'off'. +'on' - enable; 'off' - disable. + +=item B={B │ B} + +Set the status of FFO. The value must be 'on' or 'off'. + +'on' - enable. It will take effect only when the B +has been set to a valid value. + +'off' -disable. It will take effect immediately. + +Note: See the Note2 of ffovalue=MHZ. + =item B Query the maximum processor frequency. (Unit is MHz) diff --git a/xCAT-client/pods/man1/restorexCATdb.1.pod b/xCAT-client/pods/man1/restorexCATdb.1.pod index 57f7b2228..bbc152be1 100644 --- a/xCAT-client/pods/man1/restorexCATdb.1.pod +++ b/xCAT-client/pods/man1/restorexCATdb.1.pod @@ -11,7 +11,7 @@ B [B<-h>|B<--help>] [B<-v>|B<--version>] =head1 DESCRIPTION -The restorexCATdb command restores the xCAT database tables from the directory given by the -p flag. +The restorexCATdb command restores the xCAT database tables from the directory given by the -p flag. The site table skiptables attribute can be set to a list of tables not to restore. See man dumpxCATdb. =head1 OPTIONS diff --git a/xCAT-client/pods/man1/rflash.1.pod b/xCAT-client/pods/man1/rflash.1.pod index 03d27f9d3..6785bfa56 100644 --- a/xCAT-client/pods/man1/rflash.1.pod +++ b/xCAT-client/pods/man1/rflash.1.pod @@ -26,7 +26,9 @@ The command scans the specified directory structure for Firmware update package The POWER5 and POWER6 systems contain several components that use Licensed Internal Code. The B command supports two of these components: the managed system (also known as the Central Electronics Complex, or CEC) and the power subsystem (also known as the Bulk Power Assembly (BPA) or Bulk Power Controller (BPC)). Some POWER5 managed systems can be attached to a power subsystem. These power subsystems can support multiple managed systems. When the B command is invoked, xCAT will determine the managed system or power subsystem associated with that CEC and perform the update. -The B can be an CEC or CEC list, a Lpar or Lpar list and a BPA or BPA list. But CEC (or Lpar) and BPA B be used at the same time. When the I is an CEC or CEC list, B will upgrade the firmware of the CEC or CECs in the cec list. If I is a Lpar or Lpar list, B will update Licensed Internal Code (LIC) on HMC-attached POWER5 and POWER6 pSeries nodes. If I is a BPA or BPA list, B will update Licensed Internal Code (LIC) of the power subsystem on HMC-attached POWER5 and POWER6 pSeries nodes. The I can also be the specified node groups. You can specify a comma or space-separated list of node group ranges. See the I man page for detailed usage information. +The B can be an CEC or CEC list, a Lpar or Lpar list and a Frame or Frame list. But CEC (or Lpar) and Frame B be used at the same time. When the I is an CEC or CEC list, B will upgrade the firmware of the CEC or CECs in the cec list. If I is a Lpar or Lpar list, B will update Licensed Internal Code (LIC) on HMC-attached POWER5 and POWER6 pSeries nodes, and POWER7 systems using Direct FSP management. If I is a Frame or Frame list, B will update Licensed Internal Code (LIC) of the power subsystem on HMC-attached POWER5 and POWER6 pSeries nodes. The I can also be the specified node groups. You can specify a comma or space-separated list of node group ranges. See the I man page for detailed usage information. + +=head2 PPC (with HMC) specific: The B command uses the B command to connect to the HMC controlling the given managed system and perform the updates. Before run B, please use B to check if the related HMC ssh is enabled. If enable a HMC ssh connection, please use B comamnd. @@ -48,6 +50,12 @@ B If the power subsystem is recycled, all of its attached managed s If it outputs B<"Timeout waiting for prompt"> during the upgrade, please set the B<"ppctimeout"> larger in the B table. After the upgrade, remeber to change it back. If run the B<"rflash"> command on an AIX management node, need to make sure the value of B<"useSSHonAIX"> is B<"yes"> in the site table. +=head2 PPC (using Direct FSP Management) specific: + +In currently Direct FSP/BPA Management, our B doesn't support B value of B<--activate> flag, and only support B. The B option will cause any affected systems that are powered on to be powered down before installing and activating the update. So we require that the systems should be powered off before do the firmware update. + +For Power 775, the rflash command takes effect on the primary and secondary FSPs or BPAs almost in parallel. + =head1 B =over 7 diff --git a/xCAT-client/pods/man1/rmhwconn.1.pod b/xCAT-client/pods/man1/rmhwconn.1.pod index 8125cc059..d0e2a731b 100644 --- a/xCAT-client/pods/man1/rmhwconn.1.pod +++ b/xCAT-client/pods/man1/rmhwconn.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Use this command to remove connections from FSP and BPA nodes to HMC nodes. +B - Use this command to remove connections from CEC and Frame nodes to HMC nodes. =head1 SYNOPSIS @@ -20,13 +20,13 @@ B I B<-T> I For PPC (with HMC) specific: -This command is used to disconnect FSP and BPA nodes from HMC nodes, according to the connection information defined in ppc talbe in xCAT DB. +This command is used to disconnect CEC and Frame nodes from HMC nodes, according to the connection information defined in ppc talbe in xCAT DB. -Note: If a CEC (FSP node represents) belongs to a frame with a BPA installed, this CEC cannot be disconnected individually. Instead, the whole frame (BPA node represents) should be disconnected. +Note: If a CEC belongs to a frame with a BPA installed, this CEC cannot be disconnected individually. Instead, the whole frame should be disconnected. For PPC (without HMC, using FSPAPI) specific: -It's used to disconnection FSP and BPA nodes from hardware server. +It's used to disconnection CEC and Frame nodes from hardware server. =head1 OPTIONS @@ -42,7 +42,7 @@ Verbose output. =item B<-T> -The tooltype is used to communicate to the FSP/BPA. The value could be B or B. The tooltype value B is for xCAT and B is for CNM. +The tooltype is used to communicate to the CEC/Frame. The value could be B or B. The tooltype value B is for xCAT and B is for CNM. =back @@ -59,21 +59,21 @@ The tooltype is used to communicate to the FSP/BPA. The value could be B o =item 1. -To disconnect all FSP nodes in node group fsp from their HMC nodes: +To disconnect all CEC nodes in node group cec from their HMC nodes: - rmhwconn fsp + rmhwconn cec =item 2. -To remove the connection for BPA node frame1: +To remove the connection for Frame node frame1: rmhwconn frame1 =item 3. -To disconnect all FSP nodes in node group fsp from their related hardware serveri, using lpar tooltype: +To disconnect all CEC nodes in node group cec from their related hardware serveri, using lpar tooltype: - rmhwconn fsp -T lpar + rmhwconn cec -T lpar =back diff --git a/xCAT-client/pods/man1/rmvm.1.pod b/xCAT-client/pods/man1/rmvm.1.pod index b7e74dd3d..9a8a2520f 100644 --- a/xCAT-client/pods/man1/rmvm.1.pod +++ b/xCAT-client/pods/man1/rmvm.1.pod @@ -11,6 +11,7 @@ I I +I =head1 DESCRIPTION @@ -25,10 +26,13 @@ B<-v> Command Version. B<-V> Verbose output. -B<-r> Remain the data object definitions of the nodes. +B<-r> Retain the data object definitions of the nodes. B<--service> Remove the service partitions of the specified CECs. +B<-p> Purge the existence of the VM from persistant storage. This will erase all storage related to the VM in addition to removing it from the active virtualization configuration. + +B<-f> Force remove the VM, even if the VM appears to be online. This will bring down a live VM if requested. =head1 RETURN VALUE @@ -65,7 +69,7 @@ Output is similar to: cec01: Success cec02: Success -4. To remove the partition lpar1, but remaining its definition, enter: +4. To remove the partition lpar1, but retain its definition, enter: I diff --git a/xCAT-client/pods/man1/rnetboot.1.pod b/xCAT-client/pods/man1/rnetboot.1.pod index da7c0084b..26529710c 100644 --- a/xCAT-client/pods/man1/rnetboot.1.pod +++ b/xCAT-client/pods/man1/rnetboot.1.pod @@ -4,7 +4,7 @@ B - Cause the range of nodes to boot to network. =head1 SYNOPSIS -B [B<-V>|B<--verbose>] [B<-s> I] [B<-F>] [B<-f>] [B<--hfi>] I [B<-m> I==I [B<-m> I=~I]] [B<-t> I] [B<-r> I] +B [B<-V>|B<--verbose>] [B<-s> I] [B<-F>] [B<-f>] I [B<-m> I==I [B<-m> I=~I]] [B<-t> I] [B<-r> I] B [B<-h>|B<--help>] [B<-v>|B<--version>] @@ -29,10 +29,6 @@ B<-f> Force immediate shutdown of the partition. -B<--hfi> - -Netboot the nodes from HFI devices. - B<-m> Use one or multiple -m flags to specify the node attributes and the expected status for the node installation monitoring and automatic retry mechanism. The operators ==, !=, =~ and !~ are valid. This flag must be used with -t flag. diff --git a/xCAT-client/pods/man1/rpower.1.pod b/xCAT-client/pods/man1/rpower.1.pod index 365b3231d..20b8913c4 100644 --- a/xCAT-client/pods/man1/rpower.1.pod +++ b/xCAT-client/pods/man1/rpower.1.pod @@ -20,11 +20,15 @@ B I [B] =head2 CEC (using Direct FSP Management) specific: -B I [B|B|B|B|B|B] +B I [B|B|B|B|B|B] =head2 Frame (using Direct FSP Management) specific: -B I [B|B|B|B] +B I [B|B|B|B|B] + +=head2 LPAR (using Direct FSP Management) specific: + +B I [B|B|B|B|B|B|B|B] =head2 Blade specific: @@ -48,7 +52,7 @@ Turn power on to standby state =item B -Turn CEC to low power state. This is a disruptive operation which requires the CEC to be powered off prior to entering low power mode. +Turn CEC to low power state (state EOCT). This is a disruptive operation which requires the CEC to be powered off prior to entering low power mode. And we can use power off command to get out of lowepower state. =item B @@ -58,6 +62,10 @@ Places the rack in the rack standby state. It requires that all CECs and DE be p Exit Rack standby will be the default state that a rack goes into when power is initially applied to the rack. It simply moves the BPA from Rack standby to both bpa's in standby state. +=item B + +Reboot the service processor. If there are primary and secondary FSPs/BPAs of one cec/frame, it will reboot them almost at the sametime. + =item B Attempt to request clean shutdown of OS (may not detect failures in completing command) @@ -90,7 +98,11 @@ Power off, then on. =item B -Boot the node to open firmware mode. +Boot the node to open firmware console mode. + +=item B + +Boot the node to open firmware SMS menu mode. =item B<-m> I==I B<-m> I=~I diff --git a/xCAT-client/pods/man1/rspconfig.1.pod b/xCAT-client/pods/man1/rspconfig.1.pod index 225ef7544..e92cac017 100644 --- a/xCAT-client/pods/man1/rspconfig.1.pod +++ b/xCAT-client/pods/man1/rspconfig.1.pod @@ -46,14 +46,18 @@ B I B={[B],[B],[B]} B I B={[B],[B],[B],[B]} -=head2 FSP specific: +=head2 FSP/CEC specific: -B I {B|B|B|B|B|B