Compare commits

..

4 Commits

278 changed files with 3540 additions and 16888 deletions

View File

@ -1 +1 @@
2.10
2.9

View File

@ -68,7 +68,7 @@ function makedeb {
}
# build all debian packages
packages="xCAT-client xCAT-nbroot xCAT-nbroot2 perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-IBMhpc xCAT-rmc xCAT-vlan xCAT-confluent"
packages="xCAT-client xCAT-nbroot xCAT-nbroot2 perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-IBMhpc xCAT-rmc"
for file in `echo $packages`
do

View File

@ -27,7 +27,6 @@
# release this build, use PROMOTE=1 without PREGA
# BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in prep for a release.
# UP=0 or UP=1 - override the default upload behavior
# LOG=<filename> - provide an LOG file option to redirect some output into log file
#
# For the dependency packages 1. please run the build-debs-all in xcat-dep svn first( there is usage detail in that script)
# 2. run ./build-ubunturepo -d
@ -95,7 +94,8 @@ curdir=`pwd`
#define the dep source code path, core build target path and dep build target path
local_core_repo_path="$curdir/../../xcat-core"
local_dep_repo_path="$curdir/../../xcat-dep/xcat-dep"
xcat_dep_path="$curdir/../../../xcat-dep/src/xcat-dep"
local_dep_repo_path="$curdir/../../../xcat-dep/xcat-dep"
#define the url used for creating the source list file
#define the upload dir used for uploading packages
@ -112,18 +112,13 @@ fi
export HOME=/root
WGET_CMD="wget"
if [ ! -z ${LOG} ]; then
WGET_CMD="wget -o ${LOG}"
fi
#sync the gpg key to the build machine local
gsa_url=http://pokgsa.ibm.com/projects/x/xcat/build/linux
mkdir -p $HOME/.gnupg
for key_name in pubring.gpg secring.gpg trustdb.gpg; do
if [ ! -f $HOME/.gnupg/$key_name ] || [ `wc -c $HOME/.gnupg/$key_name|cut -f 1 -d' '` == 0 ]; then
rm -f $HOME/.gnupg/$key_name
${WGET_CMD} -P $HOME/.gnupg $gsa_url/keys/$key_name
wget -P $HOME/.gnupg $gsa_url/keys/$key_name
chmod 600 $HOME/.gnupg/$key_name
fi
done
@ -199,7 +194,8 @@ then
if [ ! -d ../../$package_dir_name ];then
mkdir -p "../../$package_dir_name"
fi
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test xCAT-buildkit xCAT-vlan xCAT-confluent"
#packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal xCAT-buildkit"
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test xCAT-buildkit"
target_archs=(amd64 ppc64el)
for file in `echo $packages`
do
@ -225,7 +221,6 @@ then
rc=$?
if [ $rc -gt 0 ]; then
echo "Error: $file build package failed exit code $rc"
exit $rc
fi
cd -
find $file -maxdepth 3 -type d -name "${file_low}*" | grep debian | xargs rm -rf

View File

@ -12,45 +12,44 @@
# at https://sourceforge.net/account/ssh
# - On Linux: make sure createrepo is installed on the build machine
# - On AIX: Install openssl and openssh installp pkgs and run updtvpkg. Install from http://www.perzl.org/aix/ :
# apr, apr-util, bash, bzip2, db4, expat, gdbm, gettext, glib2, gmp, info, libidn, neon, openssl (won't
# conflict with the installp version - but i don't think you need this), pcre, perl-DBD-SQLite, perl-DBI,
# popt, python, readline, rsynce, sqlite, subversion, unixODBC, zlib.
# Install wget from http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html
# apr, apr-util, bash, bzip2, db4, expat, gdbm, gettext, glib2, gmp, info, libidn, neon, openssl (won't
# conflict with the installp version - but i don't think you need this), pcre, perl-DBD-SQLite, perl-DBI,
# popt, python, readline, rsynce, sqlite, subversion, unixODBC, zlib. Install wget from http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html
# - Run this script from the local svn repository you just created. It will create the other
# directories that are needed.
# Usage: buildcore.sh [attr=value attr=value ...]
# Before running buildcore.sh, you must change the local git repo to the branch you want built, using: git checkout <branch>
# PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release. This does not actually build
# xcat, just uploads the most recent snap build to https://sourceforge.net/projects/xcat/files/xcat/ .
# If not specified, a snap build is assumed, which uploads to https://sourceforge.net/projects/xcat/files/yum/
# or https://sourceforge.net/projects/xcat/files/aix/.
# PREGA=1 - use this option with PROMOTE=1 on a branch that already has a released dot release, but this build is
# a GA candidate build, not to be released yet. This will result in the tarball being uploaded to
# https://sourceforge.net/projects/xcat/files/yum/ or https://sourceforge.net/projects/xcat/files/aix/
# (but the tarball file name will be like a released tarball, not a snap build). When you are ready to
# release this build, use PROMOTE=1 without PREGA
# BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in prep for a release.
# UP=0 or UP=1 - override the default upload behavior
# SVNUP=<filename> - control which rpms get built by specifying a coresvnup file
# GITUP=<filename> - control which rpms get built by specifying a coregitup file
# EMBED=<embedded-environment> - the environment for which a minimal version of xcat should be built, e.g. zvm or flex
# VERBOSE=1 - to see lots of verbose output
# LOG=<filename> - provide an LOG file option to redirect some output into log file
# Before running buildcore.sh, you must change the local git repo to the branch you want built, using: git checkout <branch>
# PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release. This does not
# actually build xcat, just uploads the most recent snap build to https://sourceforge.net/projects/xcat/files/xcat/ .
# If not specified, a snap build is assumed, which uploads to https://sourceforge.net/projects/xcat/files/yum/
# or https://sourceforge.net/projects/xcat/files/aix/.
# PREGA=1 - use this option with PROMOTE=1 on a branch that already has a released dot release, but this build is
# a GA candidate build, not to be released yet. This will result in the tarball being uploaded to
# https://sourceforge.net/projects/xcat/files/yum/ or https://sourceforge.net/projects/xcat/files/aix/
# (but the tarball file name will be like a released tarball, not a snap build). When you are ready to
# release this build, use PROMOTE=1 without PREGA
# BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in prep for a release.
# UP=0 or UP=1 - override the default upload behavior
# SVNUP=<filename> - control which rpms get built by specifying a coresvnup file
# GITUP=<filename> - control which rpms get built by specifying a coregitup file
# EMBED=<embedded-environment> - the environment for which a minimal version of xcat should be built, e.g. zvm or flex
# VERBOSE=1 - to see lots of verbose output
# you can change this if you need to
UPLOADUSER=litingt
UPLOADUSER=bp-sawyers
FRS=/home/frs/project/x/xc/xcat
# These are the rpms that should be built for each kind of xcat build
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-SoftLayer xCAT-vlan xCAT-confluent"
#ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal"
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-SoftLayer"
ZVMBUILD="perl-xCAT xCAT-server xCAT-UI"
ZVMLINK="xCAT-client xCAT xCATsn"
# xCAT and xCATsn have PCM specific configuration - conserver-xcat, syslinux-xcat
# xCAT-server has PCM specific configuration - RESTAPI(perl-JSON)
# xCAT-client has PCM specific configuration - getxcatdocs(perl-JSON)
PCMBUILD="xCAT xCAT-server xCAT-client xCATsn"
PCMLINK="perl-xCAT xCAT-buildkit xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 xCAT-vlan"
PCMLINK="perl-xCAT xCAT-buildkit xCAT-genesis-scripts-x86_64"
# Note: for FSM, the FlexCAT rpm is built separately from gsa/git
FSMBUILD="perl-xCAT xCAT-client xCAT-server"
FSMLINK=""
@ -86,19 +85,21 @@ if [ "$OSNAME" != "AIX" ]; then
echo "Can't get lock /var/lock/xcatbld-$REL.lock. Someone else must be doing a build right now. Exiting...."
exit 1
fi
# This is so rpm and gpg will know home, even in sudo
export HOME=/root
export HOME=/root # This is so rpm and gpg will know home, even in sudo
fi
# for the git case, query the current branch and set REL (changing master to devel if necessary)
function setbranch {
#git checkout $BRANCH
#REL=`git rev-parse --abbrev-ref HEAD`
REL=`git name-rev --name-only HEAD`
if [ "$REL" = "master" ]; then
REL="devel"
fi
}
if [ "$REL" = "xcat-core" ]; then # using git
if [ "$REL" = "xcat-core" ]; then # using git
GIT=1
setbranch # this changes the REL variable
fi
@ -130,7 +131,7 @@ fi
XCATCORE="xcat-core" # core-snap is a sym link to xcat-core
if [ "$GIT" = "1" ]; then # using git - need to include REL in the path where we put the built rpms
if [ "$GIT" = "1" ]; then # using git - need to include REL in the path where we put the built rpms
DESTDIR=../../$REL$EMBEDDIR/$XCATCORE
else
DESTDIR=../..$EMBEDDIR/$XCATCORE
@ -183,8 +184,7 @@ fi
# If they have not given us a premade update file, do an svn update or git pull and capture the results
SOMETHINGCHANGED=0
if [ "$GIT" = "1" ]; then
# using git
if [ "$GIT" = "1" ]; then # using git
if [ -z "$GITUP" ]; then
GITUP=../coregitup
echo "git pull > $GITUP"
@ -198,8 +198,7 @@ if [ "$GIT" = "1" ]; then
if ! $GREP 'Already up-to-date' $GITUP; then
SOMETHINGCHANGED=1
fi
else
# using svn
else # using svn
GIT=0
if [ -z "$SVNUP" ]; then
SVNUP=../coresvnup
@ -242,19 +241,17 @@ if [ "$OSNAME" = "AIX" ]; then
fi
# Build the rest of the noarch rpms
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT-SoftLayer xCAT-vlan xCAT-confluent; do
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT-SoftLayer; do
#if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi # for zvm embedded env only need to build server and UI
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-SoftLayer" ]; then continue; fi # do not build xCAT-softlayer on aix
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-vlan" ]; then continue; fi # do not build xCAT-vlan on aix
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-confluent" ]; then continue; fi # do not build xCAT-confluent on aix
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-SoftLayer" ]; then continue; fi # do not build xCAT-softlayer on aix
if $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then
UPLOAD=1
maker $rpmname
fi
if [ "$OSNAME" = "AIX" ]; then
if [ "$rpmname" = "xCAT-client" -o "$rpmname" = "xCAT-server" ]; then
# we do not automatically install the rest of the rpms on AIX
if [ "$rpmname" = "xCAT-client" -o "$rpmname" = "xCAT-server" ]; then # we do not automatically install the rest of the rpms on AIX
echo "rpm -Uvh $rpmname-$SHORTSHORTVER*rpm" >> $DESTDIR/instxcat
fi
fi
@ -282,7 +279,8 @@ if [ "$OSNAME" != "AIX" ]; then
fi
# Build the xCAT and xCATsn rpms for all platforms
for rpmname in xCAT xCATsn; do
for rpmname in xCAT xCATsn xCAT-OpenStack xCAT-OpenStack-baremetal; do
#if [ "$EMBED" = "zvm" ]; then break; fi
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $GITUP; then
UPLOAD=1
@ -344,10 +342,6 @@ fi
#else we will continue
# Prepare the RPMs for pkging and upload
WGET_CMD="wget"
if [ ! -z ${LOG} ]; then
WGET_CMD="wget -o ${LOG}"
fi
# get gpg keys in place
if [ "$OSNAME" != "AIX" ]; then
@ -355,7 +349,7 @@ if [ "$OSNAME" != "AIX" ]; then
for i in pubring.gpg secring.gpg trustdb.gpg; do
if [ ! -f $HOME/.gnupg/$i ] || [ `wc -c $HOME/.gnupg/$i|cut -f 1 -d' '` == 0 ]; then
rm -f $HOME/.gnupg/$i
${WGET_CMD} -P $HOME/.gnupg $GSA/keys/$i
wget -P $HOME/.gnupg $GSA/keys/$i
chmod 600 $HOME/.gnupg/$i
fi
done
@ -365,7 +359,7 @@ if [ "$OSNAME" != "AIX" ]; then
echo '%_signature gpg' >> $MACROS
fi
if ! $GREP '%_gpg_name' $MACROS 2>/dev/null; then
echo '%_gpg_name xCAT Security Key' >> $MACROS
echo '%_gpg_name Jarrod Johnson' >> $MACROS
fi
echo "Signing RPMs..."
build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
@ -377,10 +371,10 @@ if [ "$OSNAME" != "AIX" ]; then
gpg -a --detach-sign $DESTDIR/repodata/repomd.xml
gpg -a --detach-sign $SRCDIR/repodata/repomd.xml
if [ ! -f $DESTDIR/repodata/repomd.xml.key ]; then
${WGET_CMD} -q -P $DESTDIR/repodata $GSA/keys/repomd.xml.key
wget -P $DESTDIR/repodata $GSA/keys/repomd.xml.key
fi
if [ ! -f $SRCDIR/repodata/repomd.xml.key ]; then
${WGET_CMD} -P $SRCDIR/repodata $GSA/keys/repomd.xml.key
wget -P $SRCDIR/repodata $GSA/keys/repomd.xml.key
fi
fi
@ -428,18 +422,7 @@ EOF
#!/bin/sh
cd `dirname $0`
REPOFILE=`basename xCAT-*.repo`
if [[ $REPOFILE == "xCAT-*.repo" ]]; then
echo "ERROR: For xcat-dep, please execute $0 in the correct <os>/<arch> subdirectory"
exit 1
fi
#
# default to RHEL yum, if doesn't exist try Zypper
#
DIRECTORY="/etc/yum.repos.d"
if [[ ! -d ${DIRECTORY} ]]; then
DIRECTORY="/etc/zypp/repos.d"
fi
sed -e 's|baseurl=.*|baseurl=file://'"`pwd`"'|' $REPOFILE | sed -e 's|gpgkey=.*|gpgkey=file://'"`pwd`"'/repodata/repomd.xml.key|' > ${DIRECTORY}/$REPOFILE
sed -e 's|baseurl=.*|baseurl=file://'"`pwd`"'|' $REPOFILE | sed -e 's|gpgkey=.*|gpgkey=file://'"`pwd`"'/repodata/repomd.xml.key|' > /etc/yum.repos.d/$REPOFILE
cd -
EOF2
chmod 775 mklocalrepo.sh
@ -519,9 +502,8 @@ if [ "$OSNAME" != "AIX" -a "$REL" = "devel" -a "$PROMOTE" != 1 -a -z "$EMBED" ];
rpm2cpio ../$XCATCORE/perl-xCAT-*.$NOARCH.rpm | cpio -id '*.html'
rpm2cpio ../$XCATCORE/xCAT-test-*.$NOARCH.rpm | cpio -id '*.html'
rpm2cpio ../$XCATCORE/xCAT-buildkit-*.$NOARCH.rpm | cpio -id '*.html'
#rpm2cpio ../$XCATCORE/xCAT-OpenStack-*.x86_64.rpm | cpio -id '*.html'
rpm2cpio ../$XCATCORE/xCAT-OpenStack-*.x86_64.rpm | cpio -id '*.html'
rpm2cpio ../$XCATCORE/xCAT-SoftLayer-*.$NOARCH.rpm | cpio -id '*.html'
rpm2cpio ../$XCATCORE/xCAT-vlan-*.$NOARCH.rpm | cpio -id '*.html'
i=0
while [ $((i+=1)) -le 5 ] && ! rsync $verboseflag -r 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

View File

@ -19,7 +19,7 @@
# VERBOSE=1 - to see lots of verbose output
# you can change this if you need to
UPLOADUSER=litingt
UPLOADUSER=bp-sawyers
FRS=/home/frs/project/x/xc/xcat
OSNAME=$(uname)
@ -92,7 +92,7 @@ if [ "$OSNAME" != "AIX" ]; then
echo '%_signature gpg' >> $MACROS
fi
if ! $GREP -q '%_gpg_name' $MACROS 2>/dev/null; then
echo '%_gpg_name xCAT Security Key' >> $MACROS
echo '%_gpg_name Jarrod Johnson' >> $MACROS
fi
# Sign the rpms that are not already signed. The "standard input reopened" warnings are normal.

View File

@ -63,7 +63,7 @@ echo "This is an Ubuntu system"
mkdir -p $CURDIR/build
for rpmname in xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test xCAT-vlan; do
for rpmname in xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test; do
rpmname_low=`echo $rpmname | tr '[A-Z]' '[a-z]'`
echo "============================================"
echo "$rpmname_low"
@ -102,14 +102,14 @@ echo "This is an $OSNAME system"
# Build the rest of the noarch rpms
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-test xCAT-buildkit xCAT-vlan; do
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-test xCAT-buildkit; do
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi
$CURDIR/makerpm $rpmname
done
#build xCAT-genesis-scripts if it is x86_64 platform
ARCH=$(uname -p)
if [ "$ARCH" = "x86_64" ]; then
if [ "$ARCH" = "x64_64" ]; then
$CURDIR/makerpm xCAT-genesis-scripts x86_64
else
$CURDIR/makerpm xCAT-genesis-scripts ppc64
@ -141,7 +141,7 @@ echo "This is an $OSNAME system"
#begin to create repo for redhat platform
grep -i 'Red' /etc/*release*;
grep -i 'Red' /etc/issue;
if [ "$OSNAME" != "AIX" -a $? -eq 0 ]; then
cat >$CURDIR/build/xCAT-core.repo << EOF
[xcat-2-core]

12
makerpm
View File

@ -23,18 +23,6 @@ function makenoarch {
RC=$?
else # linux
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..."
# TODO: should fix this up, this is a hack for the new build machine
if [ $RPMNAME = "xCAT-UI" ]; then
# Only if the old compiler.jar file does not exist.....
if [ ! -e /xcat2/build/tools/compiler.jar ]; then
# look for the dynamic location of the compiler.jar file
DIRNAME=`dirname $(readlink -f $0)`
COMPILER_JAR=`echo "${DIRNAME%%linux_rpm/*}tools/compiler.jar"`
if [ -f $COMPILER_JAR ]; then
sed -i "s#/xcat2/build/tools/compiler.jar#${COMPILER_JAR}#g" xCAT-UI/xCAT-UI.spec
fi
fi
fi
tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz

View File

@ -1,462 +0,0 @@
#! /usr/bin/env perl
# IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
# This package offers subroutines to access CIM server
package xCAT::CIMUtils;
use strict;
use warnings;
use HTTP::Headers;
use HTTP::Request;
use LWP::UserAgent;
use XML::LibXML;
use Data::Dumper;
=head1 HTTP_PARAMS
A hash which includes all the parameters for accessing HTTP server. The valid parameter:
ip: The IP address of the HTTP server
user: The user to access HTTP server.
password: The password for the user.
method: The http method. (GET, PUT, POST, DELETE). Default is GET
protocol: The protocol which will be used to access HTTP server. (http/https). Default is https
format: The format of payload. Default is xml
payload: The payload of http
Example:
my %http_params = ( ip => '192.168.1.1',
port => '5989',
user => 'HMC',
password => 'admin',
method => 'POST',
protocol => 'https');
=cut
=head1 enum_instance ()
Description:
Enumerate CIM instances.
Arguments:
http_params: A reference to HTTP_PARAMS
cim_params: The CIM parameters
classname - a mandatory param to specify the class that enumerate will target to.
Return:
1 - A hash reference. The valid key includes:
rc - The return code. 0 - success. > 0 - fail.
cim_rc - The return code from CIM server.
msg - Output message.
2 - Array of instances, each instance is a hash contains lots of properties.
3 - The name path of instance
=cut
sub enum_instance
{
my $http_params = shift;
unless (ref($http_params)) {
$http_params = shift;
}
my $cim_params = shift;
# This is a mandatory parameter
unless ($cim_params->{classname}) {
return ({rc => 1, msg => "Missed the classname"});
}
unless ($cim_params->{namespace}) {
$cim_params->{namespace} = "ibmsd";
}
# prepare the CIM payload
my $tmpnode;
# create a new doc
my $doc = XML::LibXML->createDocument('1.0','UTF-8');
# create and add the root element
my $root = $doc->createElement("CIM");
$root->setAttribute("CIMVERSION", "2.0");
$root->setAttribute("DTDVERSION", "2.0");
$doc->setDocumentElement($root);
# create and add the MESSAGE element
my $message = $doc->createElement("MESSAGE");
$message->setAttribute("ID", "1000");
$message->setAttribute("PROTOCOLVERSION", "1.0");
$root->addChild($message);
# add a SIMPLE REQUEST
my $simple_request = $doc->createElement("SIMPLEREQ");
$message->addChild($simple_request);
# add an IMETHOD CALL
my $imethod_call = $doc->createElement("IMETHODCALL");
$imethod_call->setAttribute("NAME", "EnumerateInstances");
$simple_request->addChild($imethod_call);
# add the local name space path
my $localnamespacepath = $doc->createElement("LOCALNAMESPACEPATH");
$tmpnode = $doc->createElement("NAMESPACE");
$tmpnode->setAttribute("NAME", "root");
$localnamespacepath->addChild($tmpnode);
$tmpnode = $doc->createElement("NAMESPACE");
$tmpnode->setAttribute("NAME", $cim_params->{namespace});
$localnamespacepath->addChild($tmpnode);
$imethod_call->addChild($localnamespacepath);
# add the target class name
my $param_classname = $doc->createElement("IPARAMVALUE");
$param_classname->setAttribute("NAME", "ClassName");
$imethod_call->addChild($param_classname);
my $classname = $doc->createElement("CLASSNAME");
$classname->setAttribute("NAME", $cim_params->{classname});
$param_classname->addChild($classname);
# add several common parameters
$imethod_call->appendWellBalancedChunk('<IPARAMVALUE NAME="DeepInheritance"><VALUE>TRUE</VALUE></IPARAMVALUE><IPARAMVALUE NAME="LocalOnly"><VALUE>FALSE</VALUE></IPARAMVALUE><IPARAMVALUE NAME="IncludeQualifiers"><VALUE>FALSE</VALUE></IPARAMVALUE><IPARAMVALUE NAME="IncludeClassOrigin"><VALUE>TRUE</VALUE></IPARAMVALUE>');
my $payload = $doc->toString();
# generate http request
my $ret = gen_http_request($http_params, $payload);
if ($ret->{rc}) {
return $ret;
}
# send request to http server
$ret = send_http_request($http_params, $ret->{request});
if ($ret->{rc}) {
return $ret;
}
# parse the http response
my $ret_value;
my $parser = XML::LibXML->new();
my $resp_doc = $parser->parse_string($ret->{payload});
# check the error message from CIM
my $error_node = $resp_doc->getElementsByTagName("ERROR");
if ($error_node) {
my $msg = $error_node->[0]->getAttribute("DESCRIPTION");
my $errorcode = $error_node->[0]->getAttribute("CODE");
return ({rc => 1, cim_rc => $errorcode, msg => $error_node->[0]->getAttribute("DESCRIPTION")." [cim return code: $errorcode]"});
}
# get the name path of the instance, which is used to set property
my @namepath = $resp_doc->getElementsByTagName("INSTANCENAME");
my $namepath_string;
if (@namepath) {
$namepath_string = $namepath[0]->toString();
}
# get all the instance elements
my @instances = $resp_doc->getElementsByTagName("VALUE.NAMEDINSTANCE");
foreach my $instance (@instances) {
# get all the property element for each instance
my @properties = $instance->getElementsByTagName("PROPERTY");
if (my @property_arrays = $instance->getElementsByTagName("PROPERTY.ARRAY")) {
push @properties, @property_arrays;
}
my $ins_value;
foreach my $property (@properties) {
# get name, vlaue and type for each property. (only the one which has value)
if (my $pname = $property->getAttribute("NAME")) {
if (my $pvalue = $property->getAttribute("TYPE")) {
$ins_value->{property}->{$pname}->{type} = $pvalue;
}
if ($property->getElementsByTagName("VALUE.ARRAY")) {
my @nodelist = $property->getElementsByTagName("VALUE");
my @value_array = ();
foreach my $n (@nodelist) {
push @value_array, $n->textContent;
}
$ins_value->{property}->{$pname}->{value} = join(',',@value_array);
} elsif (my $node = $property->getElementsByTagName("VALUE")) {
$ins_value->{property}->{$pname}->{value} = $node->[0]->textContent;
}
}
}
push @{$ret_value}, $ins_value;
}
return ({rc =>0}, $ret_value, $namepath_string);
}
=head1 set_property ()
Description:
Set the property for an instance.
Arguments:
http_params: A reference to HTTP_PARAMS
cim_params: The CIM parameters
namepath - a mandatory param to specify the path of the instance.
It should be returned from 'enum_instance' subroutine.
Return:
1 - A hash reference. The valid key includes:
rc - The return code. 0 - success. > 0 - fail.
cim_rc - The return code from CIM server.
msg - Output message.
=cut
sub set_property
{
my $http_params = shift;
unless (ref($http_params)) {
$http_params = shift;
}
my $cim_params = shift;
# This is a mandatory parameter
unless ($cim_params->{namepath}) {
return ({rc => 1, msg => "Missed the name path for the instance"});
}
unless ($cim_params->{namespace}) {
$cim_params->{namespace} = "ibmsd";
}
# prepare the CIM payload
my $tmpnode;
# create a new doc
my $doc = XML::LibXML->createDocument('1.0','UTF-8');
# create and add the root element
my $root = $doc->createElement("CIM");
$root->setAttribute("CIMVERSION", "2.0");
$root->setAttribute("DTDVERSION", "2.0");
$doc->setDocumentElement($root);
# create and add the MESSAGE element
my $message = $doc->createElement("MESSAGE");
$message->setAttribute("ID", "1000");
$message->setAttribute("PROTOCOLVERSION", "1.0");
$root->addChild($message);
# add a SIMPLE REQUEST
my $simple_request = $doc->createElement("SIMPLEREQ");
$message->addChild($simple_request);
# add an IMETHOD CALL
my $imethod_call = $doc->createElement("IMETHODCALL");
$imethod_call->setAttribute("NAME", "SetProperty");
$simple_request->addChild($imethod_call);
# add the local name space path
my $localnamespacepath = $doc->createElement("LOCALNAMESPACEPATH");
$tmpnode = $doc->createElement("NAMESPACE");
$tmpnode->setAttribute("NAME", "root");
$localnamespacepath->addChild($tmpnode);
$tmpnode = $doc->createElement("NAMESPACE");
$tmpnode->setAttribute("NAME", $cim_params->{namespace});
$localnamespacepath->addChild($tmpnode);
$imethod_call->addChild($localnamespacepath);
# add the target property name
my $param_propertyname = $doc->createElement("IPARAMVALUE");
$param_propertyname->setAttribute("NAME", "PropertyName");
$imethod_call->addChild($param_propertyname);
$tmpnode = $doc->createElement("VALUE");
$tmpnode->appendTextNode($cim_params->{propertyname});
$param_propertyname->addChild($tmpnode);
# add the target property value
my $param_newvaluename = $doc->createElement("IPARAMVALUE");
$param_newvaluename->setAttribute("NAME", "NewValue");
$imethod_call->addChild($param_newvaluename);
$tmpnode = $doc->createElement("VALUE");
$tmpnode->appendTextNode($cim_params->{propertyvalue});
$param_newvaluename->addChild($tmpnode);
# add parameters of instance name path
my $param_namepath = $doc->createElement("IPARAMVALUE");
$param_namepath->setAttribute("NAME", "InstanceName");
$param_namepath->appendWellBalancedChunk($cim_params->{namepath});
$imethod_call->addChild($param_namepath);
my $payload = $doc->toString();
# generate http request
my $ret = gen_http_request($http_params, $payload);
if ($ret->{rc}) {
return $ret;
}
# send request to http server
$ret = send_http_request($http_params, $ret->{request});
if ($ret->{rc}) {
return $ret;
}
# parse the http response
my $ret_value;
my $parser = XML::LibXML->new();
my $resp_doc = $parser->parse_string($ret->{payload});
# check the error message from CIM
my $error_node = $resp_doc->getElementsByTagName("ERROR");
if ($error_node) {
my $msg = $error_node->[0]->getAttribute("DESCRIPTION");
my $errorcode = $error_node->[0]->getAttribute("CODE");
return ({rc => 1, cim_rc => $errorcode, msg => $error_node->[0]->getAttribute("DESCRIPTION")." [cim return code: $errorcode]"});
}
# if no http and cim error, the setting was succeeded
return ($ret);
}
=head1 gen_http_request ()
Description:
Generate a http request.
Arguments:
http_params: A reference to HTTP_PARAMS
payload: The payload for the http request. It can be null if the payload has been set in http_params.
Return:
A hash reference. The valid key includes:
rc - The return code. 0 - success. > 0 - fail.
msg - Output message
request - The generated HTTP::Request object
=cut
sub gen_http_request
{
my $http_params = shift;
my $http_payload = shift;
# check the mandatory parameters
unless (defined ($http_params->{ip}) && defined ($http_params->{port}) && defined($http_params->{user}) && defined($http_params->{password})) {
return ({rc => 1, msg => "Missed the mandatory parameters: ip, port, user or password"});
}
# set the default value for parameters
unless (defined ($http_params->{protocol})) {
$http_params->{protocol} = 'https';
}
unless (defined ($http_params->{format})) {
$http_params->{format} = 'xml';
}
unless (defined ($http_params->{method})) {
$http_params->{method} = 'GET';
}
my $payload = '';
if (defined ($http_params->{payload})) {
$payload = $http_params->{payload};
}
if (defined ($http_payload)) {
unless (ref($http_payload)) { #Todo: support payloasd to be a hash
$payload = $http_payload;
}
}
# create the http head
my $header = HTTP::Headers->new('content-type' => "application/$http_params->{format}",
'Accept' => "application/$http_params->{format}",
'User-Agent' => "xCAT/2",
'Host' => "$http_params->{ip}:$http_params->{port}");
# set the user & password
$header->authorization_basic($http_params->{user}, $http_params->{password});
# set the length of payload
my $plen = length($payload);
$header->push_header('Content-Length' => $plen);
# create the URL
my $url = "$http_params->{protocol}://$http_params->{ip}:$http_params->{port}";
my $request = HTTP::Request->new($http_params->{method}, $url, $header, $payload);
# set the http version
$request->protocol('HTTP/1.1');
return ({rc => 0, request => $request});
}
=head1 send_http_request ()
Description:
Send http request to http server and waiting for the response.
Arguments:
http_params: A reference to HTTP_PARAMS
http_request: A HTTP::Request object
Return:
A hash reference. The valid key includes:
rc - The return code. 0 - success. > 0 - fail.
http_rc - The return code of http. 200, 400 ...
msg - Output message
payload - The http response from http server
=cut
sub send_http_request
{
my $http_params = shift;
my $http_request = shift;
# Load the library LWP::Protocol::https for https support
if ($http_params->{protocol} eq 'https') {
eval { require LWP::Protocol::https};
if ($@) {
return ({rc => 1, msg => "Failed to load perl library LWP::Protocol::https"});
}
}
# create a new HTTP User Agent Object
my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0, SSL_verify_mode => 0});
if ($http_params->{timeout}) {
$ua->timeout($http_params->{timeout});
} else {
$ua->timeout(10); # the default timeout is 10s
}
if (defined($http_params->{verbose}) && defined ($http_params->{callback})) {
$http_params->{callback}({data => ["\n========CIM Request Start========", $http_request->as_string(), "=======CIM Request End======="]});
}
# send request and receive the response
my $response = $ua->request($http_request);
if (defined($http_params->{verbose}) && defined ($http_params->{callback}) && defined ($response->{_content})) {
$http_params->{callback}({data => ["\n========CIM Response Start========", $response->{_content}, "=======CIM Response End======="]});
}
# check the http response
if (defined ($response) && defined ($response->{_rc}) && defined ($response->{_msg})) {
if ($response->{_rc} eq "200" && $response->{_msg} eq "OK") {
return ({rc => 0, http_rc => $response->{_rc}, msg => "$response->{_msg} [http return code: $response->{_rc}]", payload => $response->{_content}});
}
}
return ({rc => 1, http_rc => $response->{_rc}, msg => $response->{_msg}});
}
1;

View File

@ -237,10 +237,6 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
}
}
my $client;
my %sslargs;
if (defined($ENV{'XCATSSLVER'})) {
$sslargs{SSL_version} = $ENV{'XCATSSLVER'};
}
if (-r $keyfile and -r $certfile and -r $cafile) {
$client = IO::Socket::SSL->start_SSL($pclient,
SSL_key_file => $keyfile,
@ -249,7 +245,6 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
SSL_verify_mode => SSL_VERIFY_PEER,
SSL_use_cert => 1,
Timeout => 0,
%sslargs,
);
} else {
$client = IO::Socket::SSL->start_SSL($pclient,

View File

@ -407,7 +407,7 @@ sub lshwconn_parse_args
}
if (scalar(@error_type_nodes)) {
my $tmp_nodelist = join ',', @error_type_nodes;
my $link = (scalar(@error_type_nodes) eq '1')? 'is':'are';
my $link = (scalar(@error_type_nodes) == '1')? 'is':'are';
return( ["Node type of node(s) $tmp_nodelist $link not supported for this command in FSPAPI.\n"]);
}
#$nodetypetab->close();

View File

@ -141,13 +141,13 @@ sub chvm_parse_extra_options {
} elsif ($cmd eq "vmmemory") {
if ($value =~ /^([\d|.]+)([G|M]?)\/([\d|.]+)([G|M]?)\/([\d|.]+)([G|M]?)$/i) {
my ($mmin, $mcur, $mmax);
if ($2 eq "G" or $2 eq '') {
if ($2 == "G" or $2 == '') {
$mmin = $1 * 1024;
}
if ($4 eq "G" or $4 eq '') {
if ($4 == "G" or $4 == '') {
$mcur = $3 * 1024;
}
if ($6 eq "G" or $6 eq '') {
if ($6 == "G" or $6 == '') {
$mmax = $5 * 1024;
}
unless ($mmin <= $mcur and $mcur <= $mmax) {
@ -872,17 +872,17 @@ sub do_op_extra_cmds {
if ($param =~ /(\d+)([G|M]?)\/(\d+)([G|M]?)\/(\d+)([G|M]?)/i) {
my $memsize = $memhash->{mem_region_size};
my $min = $1;
if ($2 eq "G" or $2 eq '') {
if ($2 == "G" or $2 == '') {
$min = $min * 1024;
}
$min = int($min/$memsize);
my $cur = $3;
if ($4 eq "G" or $4 eq '') {
if ($4 == "G" or $4 == '') {
$cur = $cur * 1024;
}
$cur = int($cur/$memsize);
my $max = $5;
if ($6 eq "G" or $6 eq '') {
if ($6 == "G" or $6 == '') {
$max = $max * 1024;
}
$max = int($max/$memsize);
@ -928,7 +928,7 @@ sub do_op_extra_cmds {
}
if (@query_array) {
my $rethash = query_cec_info_actions($request, $name, $d, 1, \@query_array);
unless (scalar keys(%$rethash)) {
unless (scalar keys(%$memhash)) {
push @values, [$mtms, "Can not get hypervisor information", 1];
next;
}
@ -1183,7 +1183,7 @@ sub get_cec_lpar_name {
my @value = split(/\n/, $lpar_info);
foreach my $v (@value) {
if($v =~ /lparname:\s*([^\,]*),\s*lparid:\s*([\d]+),/) {
if($2 eq $lparid) {
if($2 == $lparid) {
return $1;
}
}
@ -1738,7 +1738,7 @@ sub parse_part_get_info {
$hash->{process_units_avail} = $2;
} elsif ($line =~ /Authority Lpar id:(\w+)/i) {
$hash->{service_lparid} = $1;
} elsif ($line =~ /(\d+),(\d+),[^,]*,(\w+),\w*\(([\w| |-|_|\/]*)\)/) {
} elsif ($line =~ /(\d+),(\d+),[^,]*,(\w+),\w*\(([\w| |-|_]*)\)/) {
$hash->{bus}->{$3}->{cur_lparid} = $1;
$hash->{bus}->{$3}->{bus_slot} = $2;
$hash->{bus}->{$3}->{des} = $4;
@ -2001,7 +2001,7 @@ sub query_cec_info {
last;
}
#push @result, [@td[3], $rethash, 0];
#push @result, @$rethash;
push @result, @$rethash;
}
}
if ($args->{updatedb} and %lpar_hash) {
@ -2347,13 +2347,13 @@ sub mkspeclpar {
next;
}
my ($mmin, $mcur, $mmax);
if ($2 eq "G" or $2 eq '') {
if ($2 == "G" or $2 == '') {
$mmin = $1 * 1024;
}
if ($4 eq "G" or $4 eq '') {
if ($4 == "G" or $4 == '') {
$mcur = $3 * 1024;
}
if ($6 eq "G" or $6 eq '') {
if ($6 == "G" or $6 == '') {
$mmax = $5 * 1024;
}
unless ($mmin <= $mcur and $mcur <= $mmax) {

View File

@ -1098,8 +1098,7 @@ sub my_if_netmap
Error:
none
Example:
my $ip = xCAT::NetworkUtils->my_ip_facing($peerip)
my @ip = xCAT::NetworkUtils->my_ip_facing($peerip) # return multiple
xCAT::NetworkUtils->my_ip_facing
Comments:
none
=cut
@ -1117,8 +1116,6 @@ sub my_ip_facing
unless ($peernumber) { return undef; }
my $noden = unpack("N", inet_aton($peer));
my @nets = split /\n/, `/sbin/ip addr`;
my @ips;
foreach (@nets)
{
my @elems = split /\s+/;
@ -1131,19 +1128,10 @@ sub my_ip_facing
my $curn = unpack("N", inet_aton($curnet));
if (($noden & $curmask) == ($curn & $curmask))
{
push @ips, $curnet;
return $curnet;
}
}
if (@ips) {
if (wantarray) {
return @ips;
} else {
return $ips[0];
}
} else {
return undef;
}
return undef;
}
#-------------------------------------------------------------------------------
@ -2030,6 +2018,49 @@ sub getNodeNameservers{
return \%nodenameservers;
}
#-------------------------------------------------------------------------------
=head3 getNodeGateway
Description:
Get gateway from the networks table of the node.
Arguments:
ip: the ip address of the node
Returns:
Return a string, of the gateway
undef - Failed to get the gateway
Globals:
none
Error:
none
Example:
my $gateway = xCAT::NetworkUtils::getNodeGateway('192.168.1.0');
Comments:
none
=cut
#-------------------------------------------------------------------------------
sub getNodeGateway
{
my $ip=shift;
if( $ip =~ /xCAT::NetworkUtils/)
{
$ip=shift;
}
my $gateway=undef;
my $nettab = xCAT::Table->new("networks");
if ($nettab) {
my @nets = $nettab->getAllAttribs('net','mask','gateway');
foreach my $net (@nets) {
if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) {
$gateway=$net->{'gateway'};
}
}
}
return $gateway;
}
#-------------------------------------------------------------------------------
@ -2062,22 +2093,18 @@ sub getNodeNetworkCfg
$node =shift;
}
my $nets = xCAT::NetworkUtils::my_nets();
my $ip = xCAT::NetworkUtils->getipaddr($node);
my $mask = undef;
my $gateway = undef;
my $nettab = xCAT::Table->new("networks");
if ($nettab) {
my @nets = $nettab->getAllAttribs('net','mask','gateway');
foreach my $net (@nets) {
if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) {
$gateway=$net->{'gateway'};
$mask=$net->{'mask'};
}
}
for my $net (keys %$nets)
{
my $netname;
($netname,$mask) = split /\//, $net;
last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1));
}
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,0,0));
$gateway=xCAT::NetworkUtils::getNodeGateway($ip);
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0));
}
@ -2428,105 +2455,6 @@ sub get_all_nicips{
}
}
#-------------------------------------------------------------------------------
=head3 gen_net_boot_params
Description:
This subroutine is used to generate all possible kernel parameters for network boot (rh/sles/ubuntu + diskfull/diskless)
The supported network boot parameters:
ksdevice - Specify network device for Anaconda. For rh6 and earlier. Format: 'ksdevice={$mac|$nicname}'
BOOTIF - Specify network device for Anaconda. The boot device which set by pxe. xCAT also set it if the bootload is not pxe. Format 'BOOTIF={$mac}'
ifname - Specify a interfacename<->mac pair, it will set the interfacename to the interface which has the <mac>. Format 'ifname=$ifname:$mac'
# This will only be generated when linuximage.nodebootif is set.
bootdev - Specify the boot device. Mostly it's used with <ip> parameter and when there are multiple <ip> params. Format 'bootdev={$mac|$ifname}
ip - Specify the network configuration for an interface. Format: 'ip=dhcp', 'ip=$ifname:dhcp'
netdevice - Specify network device for Linuxrc (Suse bootloader). Format: 'netdevice={$mac|$nicname}'
netdev - Specify the interfacename which is used by xCAT diskless boot script to select the network interface. Format: 'netdev=$nicname'
Reference:
Redhat anaconda doc: https://github.com/rhinstaller/anaconda/blob/master/docs/boot-options.txt
Suse Linuxrc do: https://en.opensuse.org/SDB:Linuxrc
Arguments:
$installnic <- node.installnic
$primarynic <- node.primarynic
$macmac <- node.mac
$nodebootif <- linuximage.nodebootif
Returns:
$net_params - The key will be the parameter name, the value for the key will be the parameter value.
Valid Parameter Name:
ksdevice
netdev
netdevice
ip
ifname
BOOTIF
And following two keys also will be returned for reference
mac
nicname
Example:
my $netparams = xCAT::NetworkUtils->gen_net_boot_params($installnic, $primmarynic, $macmac, $nodebootif);
=cut
#-------------------------------------------------------------------------------
sub gen_net_boot_params
{
my $class = shift;
my $installnic = shift;
my $primarynic = shift;
my $macmac = shift;
my $nodebootif = shift;
my $net_params;
# arbitrary use primarynic if installnic is not set
unless ($installnic) {
$installnic = $primarynic;
}
# just use the installnic to generate the nic related kernel parameters
my $mac;
my $nicname;
if ((! defined ($installnic)) || ($installnic eq "") || ($installnic =~ /^mac$/i)) {
$mac = $macmac;
$net_params->{mac} = $mac;
} elsif ($installnic =~ /^[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}$/) {
$mac = $installnic;
$net_params->{mac} = $mac;
$net_params->{setmac} = $mac;
} else {
$mac = $macmac;
$nicname = $installnic;
$net_params->{nicname} = $nicname;
$net_params->{mac} = $mac;
}
if ($nicname) {
$net_params->{ksdevice} = "ksdevice=$nicname";
$net_params->{ip} = "ip=$nicname:dhcp";
$net_params->{netdev} = "netdev=$nicname";
$net_params->{netdevice} = "netdevice=$nicname";
$net_params->{ifname} = "ifname=$nicname:$mac";
} elsif ($mac) {
$net_params->{ksdevice} = "ksdevice=$mac";
$net_params->{BOOTIF} = "BOOTIF=$mac";
$net_params->{bootdev} = "bootdev=$mac";
$net_params->{ip} = "ip=dhcp";
if ($nodebootif) {
$net_params->{ifname} = "ifname=$nodebootif:$mac";
}
$net_params->{netdevice} = "netdevice=$mac";
}
return $net_params;
}
1;

View File

@ -196,7 +196,6 @@ sub expandatom {
$nodelist->_set_use_cache(1);
@allnodeset = $nodelist->getAllAttribs('node','groups');
%allnodehash = map { $_->{node} => 1 } @allnodeset;
$nodelist->_set_use_cache(0); #The {_use_cache} for nodelist table object must be turn off, otherwise it will keep open and affect the Table.pm subroutines like getNodesAttribs when it tries to access nodelist table to get status column.
}
my $verify = (scalar(@_) >= 1 ? shift : 1);
my %options = @_; # additional options

View File

@ -339,7 +339,7 @@ sub lshwconn_parse_args
}
if (scalar(@error_type_nodes)) {
my $tmp_nodelist = join ',', @error_type_nodes;
my $link = (scalar(@error_type_nodes) eq '1')? 'is':'are';
my $link = (scalar(@error_type_nodes) == '1')? 'is':'are';
return( ["Node type of node(s) $tmp_nodelist $link not supported for this command.\n"]);
}
$request->{nodetype} = $nodetype;

View File

@ -277,7 +277,7 @@ sub get_nodes_nic_attrs{
my $nodes = shift;
my $nicstab = xCAT::Table->new( 'nics');
my $entry = $nicstab->getNodesAttribs($nodes, ['nictypes', 'nichostnamesuffixes', 'nichostnameprefixes', 'niccustomscripts', 'nicnetworks', 'nicips', 'nicextraparams']);
my $entry = $nicstab->getNodesAttribs($nodes, ['nictypes', 'nichostnamesuffixes', 'nichostnameprefixes', 'niccustomscripts', 'nicnetworks', 'nicips']);
my %nicsattrs;
my @nicattrslist;
@ -361,19 +361,6 @@ sub get_nodes_nic_attrs{
$nicsattrs{$node}{$nicattrs[0]}{'ip'} = $nicattrs[1];
}
}
if($entry->{$node}->[0]->{'nicextraparams'}){
@nicattrslist = split(",", $entry->{$node}->[0]->{'nicextraparams'});
foreach (@nicattrslist){
my @nicattrs;
if ($_ =~ /!/) {
@nicattrs = split("!", $_);
} else {
@nicattrs = split(":", $_);
}
$nicsattrs{$node}{$nicattrs[0]}{'extraparams'} = $nicattrs[1];
}
}
}
return \%nicsattrs;
@ -858,13 +845,6 @@ sub check_profile_consistent{
my $arch = $nodetypeentry->{'arch'};
$nodetypetab->close();
# Get Imageprofile pkgdir
my $osdistroname = $os . "-" . $arch;
my $osdistrotab = xCAT::Table->new('osdistro');
my $osdistroentry = ($osdistrotab->getAllAttribsWhere("osdistroname = '$osdistroname'", 'ALL' ))[0];
my $pkgdir = $osdistroentry->{'dirpaths'};
$osdistrotab->close();
# Get networkprofile netboot and installnic
my $noderestab = xCAT::Table->new('noderes');
my $noderesentry = $noderestab->getNodeAttribs($networkprofile, ['netboot', 'installnic']);
@ -896,33 +876,24 @@ sub check_profile_consistent{
my $nodetype = undef;
$nodetype = $ntentry->{'nodetype'} if ($ntentry->{'nodetype'});
$ppctab->close();
# Checking whether netboot initrd image for Ubuntu ppc64
# This image should be downloaded from internet
if ($arch =~ /ppc64/i and $os =~ /ubuntu/i and !(-e "$pkgdir/install/netboot/initrd.gz")){
return 0, "The netboot initrd is not found in $pkgdir/install/netboot, please download it firstly.";
}
# Check if exists provision network
if (not ($installnic and exists $netprofile_nicshash{$installnic}{"network"})){
return 0, "Provisioning network not defined for network profile."
}
# Remove check mechanism about arch and netboot attribute
# Attribute 'neboot' will be generated based on arch, management method, os
# Profile consistent keys, arch=>netboot, mgt=>nictype
#my $ppc_netboot = 'yaboot';
#if( $os =~ /rhels7/ ){
# $ppc_netboot = 'grub2';
#}
#my %profile_dict = ('x86' => 'xnba','x86_64' => 'xnba', 'ppc64' => $ppc_netboot,
# 'ppc64el' => $ppc_netboot,
# 'fsp' => 'FSP', 'ipmi' => 'BMC');
my $ppc_netboot = 'yaboot';
if( $os =~ /rhels7/ ){
$ppc_netboot = 'grub2';
}
my %profile_dict = ('x86' => 'xnba','x86_64' => 'xnba', 'ppc64' => $ppc_netboot,
'ppc64el' => $ppc_netboot,
'fsp' => 'FSP', 'ipmi' => 'BMC');
# Check if imageprofile is consistent with networkprofile
#if ($profile_dict{$arch} ne $netboot) {
# return 0, "Imageprofile's arch is not consistent with networkprofile's netboot."
#}
if ($profile_dict{$arch} ne $netboot) {
return 0, "Imageprofile's arch is not consistent with networkprofile's netboot."
}
# Check if networkprofile is consistent with hardwareprofile
if (not $hardwareprofile) { # Not define hardwareprofile
@ -932,29 +903,29 @@ sub check_profile_consistent{
return 0, "$nictype networkprofile must use with hardwareprofile.";
}
}
my %mgt_dict = ('fsp' => 'FSP', 'ipmi' => 'BMC', 'kvm' => '');
if ($mgt eq 'vm') {
if ($mgt eq 'vm')
{
return 1, "";
}
# For nodetype is lpar node, not need to check the nictype as it is not required for lpar node
if (not $nictype and $mgt and $nodetype ne 'lpar' ) {
# define hardwareprofile, not define fsp or bmc networkprofile, and the node type is not lpar
return 0, "$profile_dict{$mgt} hardwareprofile must use with $profile_dict{$mgt} networkprofile.";
}
if ($nodetype eq 'lpar') {
if ($nictype) {
# Can not associate FSP/BMC network if the node type is lpar
return 0, "The node with hardware type $nodetype can not use with $nictype networkprofile.";
}
return 1, ""
if ($profile_dict{$mgt} ne $nictype and $nodetype ne 'lpar') {
# Networkprofile's nictype is not consistent with hadrwareprofile's mgt, and the node type is not lpar
return 0, "Networkprofile's nictype is not consistent with hardwareprofile's mgt.";
}
if ($mgt and $mgt_dict{$mgt} ne $nictype) {
my $errmsg = "$mgt hardwareprofile must use with $mgt_dict{$mgt} networkprofile.";
if ( $mgt eq 'kvm' ) {
$errmsg = "$mgt hardwareprofile must use with non-BMC and non-FSP networkprofile."
}
return 0, $errmsg;
if ($nodetype eq 'lpar' and $nictype eq 'FSP')
{
# can not associate FSP network if the node type is lpar
return 0, "The node with hardware type $nodetype can not use with $nictype networkprofile.";
}
return 1, "";
}
@ -996,72 +967,6 @@ sub is_fsp_node
#-------------------------------------------------------------------------------
=head3 is_kvm_node
Description : Judge whether nodes are KVM nodes.
Arguments : $hardwareprofile - hardwareprofile name
Returns : 1 - KVM nodes
0 - Not KVM nodes
=cut
#-------------------------------------------------------------------------------
sub is_kvm_node
{
my $class = shift;
my $hardwareprofile = shift;
if (not $hardwareprofile) {
return 0;
}
#Get hardwareprofile mgt
my $nodehmtab = xCAT::Table->new('nodehm');
my $mgtentry = $nodehmtab->getNodeAttribs($hardwareprofile, ['mgt']);
my $mgt = undef;
$mgt = $mgtentry->{'mgt'} if ($mgtentry->{'mgt'});
$nodehmtab->close();
if ($mgt eq 'kvm') {
return 1;
}
return 0;
}
#-------------------------------------------------------------------------------
=head3 is_kvm_hypv_node
Description : Judge whether nodes are KVM nodes.
Arguments : $imageprofile - imageprofile name
Returns : 1 - KVM hypervisor nodes
0 - Not KVM hypervisor nodes
=cut
#-------------------------------------------------------------------------------
sub is_kvm_hypv_node
{
my $class = shift;
my $imageprofile = shift;
# Get provmethod
my $provmethod = xCAT::ProfiledNodeUtils->get_imageprofile_prov_method($imageprofile);
unless ($provmethod ){
return 0;
}
my $osimage_tab = xCAT::Table->new('osimage');
my $osimage_tab_entry = $osimage_tab->getAttribs({'imagename'=> $provmethod},('osdistroname'));
my $osdistroname = $osimage_tab_entry->{'osdistroname'};
$osimage_tab->close();
if ($osdistroname and $osdistroname =~ /^pkvm/ ) {
return 1;
}
return 0;
}
#-------------------------------------------------------------------------------
=head3 get_nodes_cmm
Description : Get the CMM of nodelist
Arguments : $nodelist - the ref of node list array
@ -1327,13 +1232,6 @@ sub gen_chain_for_profiles{
unless ($netprofileattr){
return (1, "Can not get attributes for network profile $netprofile");
}
# Get node's netboot attribute
my ($retcode, $retval) = xCAT::ProfiledNodeUtils->get_netboot_attr($imgprofile, $hwprofile);
if (not $retcode) {
return (1, $retval);
}
my $netboot = $retval;
$final_chain = 'osimage='.$provmethod.":--noupdateinitrd";
# get the chain attribute from hardwareprofile and insert it to node.
@ -1346,8 +1244,7 @@ sub gen_chain_for_profiles{
}
}
#run bmcsetups.
#PowerNV nodes can't use 'runcmd=bmcsetup' to set BMC.
if ((exists $netprofileattr->{"bmc"}) and $hw_reconfig and $netboot ne 'petitboot'){
if ((exists $netprofileattr->{"bmc"}) and $hw_reconfig){
if (index($final_chain, "runcmd=bmcsetup") == -1){
$final_chain = 'runcmd=bmcsetup,'.$final_chain.':reboot4deploy';
}
@ -1357,195 +1254,3 @@ sub gen_chain_for_profiles{
}
return (0, $final_chain);
}
#-------------------------------------------------------------------------------
=head3 get_all_vmhosts
Description : Get all vm hosts/hypervisor from DB.
Arguments : N/A
Returns : ref for vm hosts/hypervisor hash.
Example :
my $hashref = xCAT::ProfiledNodeUtils->get_all_vmhosts();
=cut
#-------------------------------------------------------------------------------
sub get_all_vmhosts
{
my %vmhostshash;
my $nodelisttab = xCAT::Table->new('nodelist');
# groups like '__Hypervisor_pkvm' means this node is Power KVM hypervisor
my @vmhosts = $nodelisttab->getAllAttribsWhere("groups like '%__Hypervisor_kvm%'", 'node');
foreach (@vmhosts) {
if($_->{'node'}) {
$vmhostshash{$_->{'node'}} = 1;
}
}
$nodelisttab->close();
# Return the ref accordingly
return \%vmhostshash;
}
#-------------------------------------------------------------------------------
=head3 get_netboot_attr
Description : Get netboot attribute for node
Arguments : $imageprofile - image profile name, mandatory. e.g. "__ImageProfile_rhels7.0-x86_64-stateful-mgmtnode"
$hardwareprofile - harware profile name, optional. e.g. "__HardwareProfile_IBM_System_x_M4"
Returns : (returncode, netboot)
returncode=0 - can not get netboot value,netboot is the error message
returncode=1 - can get netboot value,netboot is the right value
=cut
#-------------------------------------------------------------------------------
sub get_netboot_attr{
my $class = shift;
my $imageprofile = shift;
my $hardwareprofile = shift;
my $netboot;
my @nodegrps = xCAT::TableUtils->list_all_node_groups();
unless(grep{ $_ eq $imageprofile} @nodegrps)
{
return 0, "Image profile not defined in DB."
}
$imageprofile =~ s/^__ImageProfile_//;
if ($hardwareprofile){
unless(grep{ $_ eq $hardwareprofile} @nodegrps)
{
return 0, "Hardware profile not defined in DB."
}
}
else
{
$hardwareprofile = '*';
}
# Get os name, os major version, osarch
my $osimage_tab = xCAT::Table->new('osimage');
my $osimage_tab_entry = $osimage_tab->getAttribs({'imagename'=> $imageprofile},('osdistroname'));
my $osdistroname = $osimage_tab_entry->{'osdistroname'};
$osimage_tab->close();
my $osdistro_tab = xCAT::Table->new('osdistro');
my $osdistro_tab_entry = $osdistro_tab->getAttribs({'osdistroname'=> $osdistroname},('basename', 'majorversion', 'arch'));
my $os_name = $osdistro_tab_entry->{'basename'};
my $os_major_version = $osdistro_tab_entry->{'majorversion'};
my $os_arch = $osdistro_tab_entry->{'arch'};
$osdistro_tab->close;
# Treate os name rhel,centos,rhelhpc same as rhels
if ($os_name eq 'centos' || $os_name eq 'rhelhpc' || $os_name eq 'rhel')
{
$os_name = 'rhels';
}
# Treate arch ppc64el same as ppc64le,x86 same as x86_64
if ($os_arch eq 'ppc64el')
{
$os_arch = 'ppc64le';
}elsif ($os_arch eq 'x86')
{
$os_arch = 'x86_64';
}
# Identify whether this node is PowerKVM or PowerNV if os arch is ppc64le
# If hardware profile is defined
my $mgt = '*';
if ($os_arch eq 'ppc64le' and $hardwareprofile ne '*') {
my $nodehmtab = xCAT::Table->new('nodehm');
my $nodehmtab_entry = $nodehmtab->getNodeAttribs($hardwareprofile, ['mgt']);
if (defined $nodehmtab_entry->{'mgt'}) {
$mgt = $nodehmtab_entry->{'mgt'};
}
}
# Rule for netboot attribute.If update the rule,just update %netboot_dict and @condition_array
# It's sequence sensitive: os arch -> os name -> os major version -> hardware profile
# Priority | Arch | OS Name | OS Major Version | Management method | Noderes.netboot |
# 1 | x86_64/x86 | * | * | * | xnba |
# 2 | ppc64 | rhels | 7 | * | grub2 |
# 2 | ppc64 | pkvm | * | * | petitboot |
# 3 | | * | * | * | yaboot |
# 4 | ppc64le/el | * | * | * | grub2
# 4 | ppc64le/el | * | * | ipmi | petitboot
# arch osname version hardware netboot
my %netboot_dict = ( 'x86_64' => 'xnba',
'ppc64' => {
'rhels' => {
'7' => 'grub2',
'*' => 'yaboot',
},
'pkvm' => 'petitboot',
'*' => 'yaboot',
},
'ppc64le' => {
'*' => {
'*' => {
'*' => 'grub2',
'ipmi' => 'petitboot',
},
},
},
);
my $condition_array_ref = [$os_arch, $os_name, $os_major_version, $mgt];
$netboot = cal_netboot(\%netboot_dict, $condition_array_ref);
if($netboot eq '0')
{
return 0, "Can not get the netboot attribute";
}
else
{
return 1, $netboot;
}
}
#-------------------------------------------------------------------------------
=head3 cal_netboot
Description : Calculate netboot attribute by conditions recursively, internal use.
Arguments : $netboot_dict_ref
$condition_array_ref
Returns : netboot
returncode=0 - can not get netboot value
=cut
#-------------------------------------------------------------------------------
sub cal_netboot{
my $netboot_dict_ref = shift;
my $condition_array_ref = shift;
my $condition_array_len = scalar @$condition_array_ref;
if( $condition_array_len == 0 ){
return 0;
}
my $condition = shift @$condition_array_ref;
if( (exists($netboot_dict_ref->{$condition})) || (exists($netboot_dict_ref->{'*'})) )
{
if(!exists($netboot_dict_ref->{$condition}))
{
$condition = '*';
}
if(ref($netboot_dict_ref->{$condition}) eq 'HASH')
{
if($condition_array_len > 1)
{
return cal_netboot($netboot_dict_ref->{$condition}, $condition_array_ref);
}
else
{
return 0;
}
}
else
{
return $netboot_dict_ref->{$condition};
}
}
else
{
return 0;
}
}

View File

@ -326,7 +326,7 @@ bootparams => {
'kernel' => 'The kernel that network boot actions should currently acquire and use. Note this could be a chained boot loader such as memdisk or a non-linux boot loader',
'initrd' => 'The initial ramdisk image that network boot actions should use (could be a DOS floppy or hard drive image if using memdisk as kernel)',
'kcmdline' => 'Arguments to be passed to the kernel',
'addkcmdline' => 'User specified one or more parameters to be passed to the kernel. For the kernel options need to be persistent after installation, specify them with prefix "R::"',
'addkcmdline' => 'User specified one or more parameters to be passed to the kernel',
'dhcpstatements' => 'xCAT manipulated custom dhcp statements (not intended for user manipulation)',
'adddhcpstatements' => 'Custom dhcp statements for administrator use (not implemneted yet)',
comments => 'Any user-written notes.',
@ -542,7 +542,7 @@ networks => {
netname => 'Name used to identify this network definition.',
net => 'The network address.',
mask => 'The network mask.',
mgtifname => 'The interface name of the management/service node facing this network. !remote!<nicname> indicates a non-local network on a specific nic for relay DHCP.',
mgtifname => 'The interface name of the management/service node facing this network. !remote! indicates a non-local network for relay DHCP.',
gateway => 'The network gateway. It can be set to an ip address or the keyword <xcatmaster>, the keyword <xcatmaster> 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.',
@ -643,14 +643,14 @@ noderes => {
descriptions => {
node => 'The node name or group name.',
servicenode => 'A comma separated list of node names (as known by the management node) that provides most services for this node. The first service node on the list that is accessible will be used. The 2nd node on the list is generally considered to be the backup service node for this node when running commands like snmove.',
netboot => 'The type of network booting to use for this node. Valid values: pxe or xnba for x86* architecture, yaboot for POWER architecture, grub2-tftp and grub2-http for RHEL7 on Power and all the os deployment on Power LE. Notice: yaboot is not supported from rhels7 on Power,use grub2-tftp or grub2-http instead, the difference between the 2 is the file transfer protocol(i.e, http or tftp)',
netboot => 'The type of network booting to use for this node. Valid values: pxe or xnba for x86* architecture, yaboot for POWER architecture, grub2 for RHEL7 on Power. Notice: yaboot is not supported from rhels7 on Power,use grub2 instead',
tftpserver => 'The TFTP server for this node (as known by this node). If not set, it defaults to networks.tftpserver.',
tftpdir => 'The directory that roots this nodes contents from a tftp and related perspective. Used for NAS offload by using different mountpoints.',
nfsserver => 'The NFS or HTTP server for this node (as known by this node).',
monserver => 'The monitoring aggregation point for this node. The format is "x,y" where x is the ip address as known by the management node and y is the ip address as known by the node.',
nfsdir => 'The path that should be mounted from the NFS server.',
installnic => 'The network adapter on the node that will be used for OS deployment, the installnic can be set to the network adapter name or the mac address or the keyword "mac" which means that the network interface specified by the mac address in the mac table will be used. If not set, primarynic will be used. If primarynic is not set too, the keyword "mac" will be used as default.',
primarynic => 'This attribute will be deprecated. All the used network interface will be determined by installnic. The network adapter on the node that will be used for xCAT management, the primarynic can be set to the network adapter name or the mac address or the keyword "mac" which means that the network interface specified by the mac address in the mac table will be used. Default is eth0.',
installnic => 'The network adapter on the node that will be used for OS deployment, the installnic can be set to the network adapter name or the mac address or the keyword "mac" which means that the network interface specified by the mac address in the mac table will be used. If not set, primarynic will be used.',
primarynic => 'The network adapter on the node that will be used for xCAT management, the primarynic can be set to the network adapter name or the mac address or the keyword "mac" which means that the network interface specified by the mac address in the mac table will be used. Default is eth0.',
discoverynics => 'If specified, force discovery to occur on specific network adapters only, regardless of detected connectivity. Syntax can be simply "eth2,eth3" to restrict discovery to whatever happens to come up as eth2 and eth3, or by driver name such as "bnx2:0,bnx2:1" to specify the first two adapters managed by the bnx2 driver',
cmdinterface => 'Not currently used.',
xcatmaster => 'The hostname of the xCAT service node (as known by this node). This acts as the default value for nfsserver and tftpserver, if they are not set. If xcatmaster is not set, the node will use whoever responds to its boot request as its master. For the directed bootp case for POWER, it will use the management node if xcatmaster is not set.',
@ -754,13 +754,13 @@ linuximage => {
imagename => 'The name of this xCAT OS image definition.',
template => 'The fully qualified name of the template file that will be used to create the OS installer configuration file for stateful installations (e.g. kickstart for RedHat, autoyast for SLES).',
boottarget => 'The name of the boottarget definition. When this attribute is set, xCAT will use the kernel, initrd and kernel params defined in the boottarget definition instead of the default.',
addkcmdline=> 'User specified arguments to be passed to the kernel. The user arguments are appended to xCAT.s default kernel arguments. For the kernel options need to be persistent after installation, specify them with prefix "R::". This attribute is ignored if linuximage.boottarget is set.',
addkcmdline=> 'User specified arguments to be passed to the kernel. The user arguments are appended to xCAT.s default kernel arguments. This attribute is ignored if linuximage.boottarget is set.',
pkglist => 'The fully qualified name of the file that stores the distro packages list that will be included in the image. Make sure that if the pkgs in the pkglist have dependency pkgs, the dependency pkgs should be found in one of the pkgdir',
pkgdir => 'The name of the directory where the distro packages are stored. It could be set multiple paths.The multiple paths must be seperated by ",". The first path in the value of osimage.pkgdir must be the OS base pkg dir path, such as pkgdir=/install/rhels6.2/x86_64,/install/updates . In the os base pkg path, there are default repository data. And in the other pkg path(s), the users should make sure there are repository data. If not, use "createrepo" command to create them. For ubuntu, multiple mirrors can be specified in the pkgdir attribute, the mirrors must be prefixed by the protocol(http/ssh) and delimited with "," between each other.',
otherpkglist => 'The fully qualified name of the file that stores non-distro package lists that will be included in the image. It could be set multiple paths.The multiple paths must be seperated by ",".',
otherpkgdir => 'The base directory where the non-distro packages are stored. Only 1 local directory supported at present.',
pkgdir => 'The name of the directory where the distro packages are stored. It could be set multiple paths.The multiple paths must be seperated by ",". The first path in the value of osimage.pkgdir must be the OS base pkg dir path, such as pkgdir=/install/rhels6.2/x86_64,/install/updates . In the os base pkg path, there are default repository data. And in the other pkg path(s), the users should make sure there are repository data. If not, use "createrepo" command to create them. ',
otherpkglist => 'The fully qualified name of the file that stores non-distro package lists that will be included in the image.',
otherpkgdir => 'The base directory where the non-distro packages are stored.',
exlist => 'The fully qualified name of the file that stores the file names and directory names that will be excluded from the image during packimage command. It is used for diskless image only.',
postinstall => 'The fully qualified name of the script file that will be run at the end of the genimage command. It could be set multiple paths.The multiple paths must be seperated by ",". It is used for diskless image only.',
postinstall => 'The fully qualified name of the script file that will be run at the end of the genimage command. It is used for diskless image only.',
rootimgdir => 'The directory name where the image is stored. It is generally used for diskless image. it also can be used in sysclone environment to specify where the image captured from golden client is stored. in sysclone environment, rootimgdir is generally assigned to some default value by xcat, but you can specify your own store directory. just one thing need to be noticed, wherever you save the image, the name of last level directory must be the name of image. for example, if your image name is testimage and you want to save this image under home directoy, rootimgdir should be assigned to value /home/testimage/',
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)',
@ -1420,7 +1420,7 @@ firmware => {
},
nics => {
cols => [qw(node nicips nichostnamesuffixes nichostnameprefixes nictypes niccustomscripts nicnetworks nicaliases nicextraparams comments disable)],
cols => [qw(node nicips nichostnamesuffixes nichostnameprefixes nictypes niccustomscripts nicnetworks nicaliases comments disable)],
keys => [qw(node)],
tablespace =>'XCATTBS16K',
table_desc => 'Stores NIC details.',
@ -1457,12 +1457,6 @@ nics => {
Format: eth0!<alias list>,eth1!<alias1 list>|<alias2 list>
For multiple aliases per nic use a space-separated list.
For example: eth0!moe larry curly,eth1!tom|jerry',
nicextraparams => 'Comma-separated list of extra parameters that will be used for each NIC configuration.
If only one ip address is associated with each NIC:
<nic1>!<param1=value1 param2=value2>,<nic2>!<param3=value3>, for example, eth0!MTU=1500,ib0!MTU=65520 CONNECTED_MODE=yes.
If multiple ip addresses are associated with each NIC:
<nic1>!<param1=value1 param2=value2>|<param3=value3>,<nic2>!<param4=value4 param5=value5>|<param6=value6>, for example, eth0!MTU=1500|MTU=1460,ib0!MTU=65520 CONNECTED_MODE=yes.
The xCAT object definition commands support to use nicextraparams.<nicname> as the sub attributes.',
comments => 'Any user-written notes.',
disable => "Set to 'yes' or '1' to comment out this row.",
},
@ -2389,11 +2383,7 @@ my @nodeattrs = (
tabentry => 'nics.nicaliases',
access_tabentry => 'nics.node=attr:node',
},
{attr_name => 'nicextraparams',
tabentry => 'nics.nicextraparams',
access_tabentry => 'nics.node=attr:node',
},
#######################
######################
# prodkey table #
######################
{attr_name => 'productkey',
@ -3710,7 +3700,7 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
},
{attr_name => 'kitreponame',
tabentry => 'kitcomponent.kitreponame',
tabentry => 'kitcomponent.kitrepoid',
access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname',
},
{attr_name => 'basename',

View File

@ -185,13 +185,6 @@ sub isServiceReq
if (!exists($servicehash->{'tftpserver'})) {
$servicehash->{'tftpserver'} = 1;
}
# On Ubuntu management node, we disabled the isc-dhcp-server in upstart,
# through file /etc/init/isc-dhcp-server.override, see bug 4399
# however, this causes a new problem, bug 4515
# the fix is to start dhcp server when starting xcatd
if (!exists($servicehash->{'dhcpserver'}) && xCAT::Utils->osver() =~ /ubuntu.*/i) {
$servicehash->{'dhcpserver'} = 1;
}
}
$servicenodetab->close;

View File

@ -333,16 +333,12 @@ my %usage = (
renergy [-v | --version]
Power 6 server specific :
renergy noderange [-V] { all | { [savingstatus] [cappingstatus] [cappingmaxmin] [cappingvalue] [cappingsoftmin] [averageAC] [averageDC] [ambienttemp] [exhausttemp] [CPUspeed] } }
renergy noderange [-V] { {savingstatus}={on | off} | {cappingstatus}={on | off} | {cappingwatt}=watt | {cappingperc}=percentage }
renergy noderange [-V] { all | { [savingstatus] [cappingstatus] [cappingmaxmin] [cappingvalue] [cappingsoftmin] [averageAC] [averageDC] [ambienttemp] [exhausttemp] [CPUspeed] } }
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] [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 }
Power 8 server specific :
renergy noderange [-V] { all | [savingstatus] [dsavingstatus] [averageAC] [averageAChistory] [averageDC] [averageDChistory] [ambienttemp] [ambienttemphistory] [exhausttemp] [exhausttemphistory] [fanspeed] [fanspeedhistory] [CPUspeed] [CPUspeedhistory] [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 }
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 }
BladeCenter specific :
For Management Modules:

194
perl-xCAT/xCAT/Utils.pm Normal file → Executable file
View File

@ -1013,11 +1013,10 @@ sub runcmd
}
# store the return string
#push @$outref,$output;
close(PIPE); # This will set the $? properly
}
# now if not streaming process errors
if ($?)
if (($?) && (!defined($stream)))
{
$::RUNCMD_RC = $? >> 8;
my $displayerror = 1;
@ -3299,68 +3298,13 @@ sub noderangecontainsMn
return; # if no MN in the noderange, return nothing
}
# the MTM of P6 and P7 machine
my %MTM_P6P7 = (
# P6 systems
'7998-60X' => 1,
'7998-61X' => 1,
'7778-23X' => 1,
'8203-E4A' => 1,
'8204-E8A' => 1,
'8234-EMA' => 1,
'9117-MMA' => 1,
'9119-FHA' => 1,
# P7 systems
'8406-70Y' => 1,
'8406-71Y' => 1,
'7891-73X' => 1,
'7891-74X' => 1,
'8231-E2B' => 1,
'8202-E4B' => 1,
'8231-E2B' => 1,
'8205-E6B' => 1,
'8233-E8B' => 1,
'8236-E8C' => 1,
'9117-MMB' => 1,
'9179-MHB' => 1,
'9119-FHB' => 1,
);
#-----------------------------------------------------------------------------
=head3 isP6P7
Check whether a MTM is a P6 or P7 machine
Parameter: MTM of Power machine
=cut
#-------------------------------------------------------------------------------
sub isP6P7
{
my $class = shift;
my $mtm = shift;
if ($class !~ /Utils/) {
$mtm = $class;
}
if (defined $MTM_P6P7{$mtm} && $MTM_P6P7{$mtm} == 1) {
return 1;
}
return 0;
}
=head3 filter_nodes
##########################################################################
# Fliter the nodes to specific groups
# For specific command, figure out the node lists which should be handled by blade.pm, fsp.pm or ipmi.pm
# mp group (argument: $mpnodes): the nodes will be handled by blade.pm
# fsp group (argument: $fspnodes): the nodes will be handled by fsp.pm
# bmc group (argument: $bmcnodes): the nodes will be handled by ipmi.pm
# mp group: the nodes will be handled by blade.pm
# fsp group: the nodes will be handled by fsp.pm
# bmc group: the nodes will be handled by ipmi.pm
# For rspconfig network, the NGP ppc blade will be included in the group of mp, othewise in the fsp group
# For getmacs -D, the NGP ppc blade will be included in the group of common fsp, otherwise in the mp group
# For renergy command, NGP blade will be moved to mp group
@ -3402,35 +3346,18 @@ sub filter_nodes{
if ($ipmitab) {
$ipmitabhash = $ipmitab->getNodesAttribs(\@nodes,['bmc']);
}
# get the node attributes from the nodehm table
my $nodehmhash;
my $nodehmtab = xCAT::Table->new("nodehm");
if ($nodehmtab) {
$nodehmhash = $nodehmtab->getNodesAttribs(\@nodes,['mgt']);
}
# get the node attributes from the nodetype table
my $nodetypehash;
my $nodetypetab = xCAT::Table->new("nodetype");
if ($nodetypetab) {
$nodetypehash = $nodetypetab->getNodesAttribs(\@nodes, ['arch']);
}
# get the node attributes from the vpd table
my $vpdhash,
my $vpdtab = xCAT::Table->new("vpd");
if ($vpdtab) {
$vpdhash = $vpdtab->getNodesAttribs(\@nodes, ['mtm']);
}
my (@mp, @ngpfsp, @ngpbmc, @commonfsp, @commonbmc, @unknow, @nonppcle, @p6p7);
my (@mp, @ngpfsp, @ngpbmc, @commonfsp, @commonbmc, @unknow);
# if existing in both 'mpa' and 'ppc', a ngp power blade
# if existing in both 'mpa' and 'ipmi', a ngp x86 blade
# if only in 'ppc', a common power node
# if only in 'ipmi', a common x86 node
# if in ipmi and arch =~ /ppc64/, a pp64le node
foreach (@nodes) {
if (defined ($mptabhash->{$_}->[0]) && defined ($mptabhash->{$_}->[0]->{'mpa'})) {
if ($mptabhash->{$_}->[0]->{'mpa'} eq $_) {
@ -3459,21 +3386,9 @@ sub filter_nodes{
} elsif (defined ($ppctabhash->{$_}->[0]) && defined ($ppctabhash->{$_}->[0]->{'hcp'})) {
# common power node
push @commonfsp, $_;
# whether is a Power 8 or higher with FSP
if (defined ($vpdhash->{$_}->[0]) && defined ($vpdhash->{$_}->[0]->{'mtm'})) {
if (isP6P7($vpdhash->{$_}->[0]->{'mtm'})) {
push @p6p7, $_;
}
}
} elsif (defined ($ipmitabhash->{$_}->[0]) && defined ($ipmitabhash->{$_}->[0]->{'bmc'})) {
# common bmc node
push @commonbmc, $_;
# whether is a Power 8 or higher with FSP
if (defined ($nodetypehash->{$_}->[0]) && defined ($nodetypehash->{$_}->[0]->{'arch'})) {
if ($nodetypehash->{$_}->[0]->{'arch'} !~ /^ppc64/i) {
push @nonppcle, $_;
}
}
} else {
push @unknow, $_;
}
@ -3507,16 +3422,6 @@ sub filter_nodes{
push @{$mpnodes}, @ngpfsp;
}
} elsif ($cmd eq "renergy") {
# for renergy command, only the p6,p7 get to the general fsp.pm
# P8 and higher will get in the energy.pm
@{$fspnodes} = ();
push @{$fspnodes}, @p6p7;
# for rnergy command, only the non-ppcle nodes get to the general ipmi.pm
# ppcle of P8 and higher will get in the energy.pm
@{$bmcnodes} = ();
push @{$bmcnodes}, @nonppcle;
if (grep /^(relhistogram)/, @args) {
push @{$bmcnodes}, @ngpbmc;
} else {
@ -3597,8 +3502,6 @@ sub version_cmp {
$ver_a = shift;
}
my $ver_b = shift;
$ver_a =~ s/([-.]0+)+$//;
$ver_b =~ s/([-.]0+)+$//;
my @array_a = ($ver_a =~ /([-.]|\d+|[^-.\d]+)/g);
my @array_b = ($ver_b =~ /([-.]|\d+|[^-.\d]+)/g);
@ -3623,12 +3526,9 @@ sub version_cmp {
} elsif ( $b eq '.' ) {
return 1;
} elsif ($a =~ /^\d+$/ and $b =~ /^\d+$/) {
# if ($a =~ /^0/ || $b =~ /^0/) {
# return ($a cmp $b);
# } else {
# return ($a <=> $b);
# }
if($a != $b ){
if ($a =~ /^0/ || $b =~ /^0/) {
return ($a cmp $b);
} else {
return ($a <=> $b);
}
} else {
@ -4125,9 +4025,7 @@ sub restartservice{
return -1;
}
#xCAT::Utils->runcmd($cmd, -1);
system($cmd);
$::RUNCMD_RC=$?;
xCAT::Utils->runcmd($cmd, -1);
return $::RUNCMD_RC;
}
@ -4477,60 +4375,30 @@ sub cleanup_for_powerLE_hardware_discovery {
#This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1").
sub parseMacTabEntry{
my $macString=shift;
if( $macString =~ /xCAT::Utils/) {
$macString=shift;
}
my $HostName=shift;
my $mac_ret;
my @macEntry=split(/\|/,$macString);
foreach my $mac_t (@macEntry){
if($mac_t =~ /!/){
if($mac_t =~ /(.+)!$HostName$/){
$mac_ret=$1;
}
}else{
$mac_ret=$mac_t;
}
}
my $macString=shift;
if( $macString =~ /xCAT::Utils/)
{
$macString=shift;
if ($mac_ret) {
if ($mac_ret !~ /:/) {
$mac_ret =~ s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
}
}
return $mac_ret;
}
my $HostName=shift;
my $mac_ret;
my @macEntry=split(/\|/,$macString);
foreach my $mac_t (@macEntry){
if($mac_t =~ /!/){
if($mac_t =~ /(.+)!$HostName$/){
$mac_ret=$1;
}
}else{
$mac_ret=$mac_t;
}
}
return $mac_ret;
}
#The splitkcmdline subroutine is used to split the "persistent kernel options"
#and "provision-time kernel options" out of the kernel cmdline string
#Arguments:
# $kcmdline: the native kernel cmdline string
#Return value:
# a reference of hash with the following KEY-VALUE def:
# "persistent" ==> string of persistent kernel options,delimited with space " "
# "volatile" ==> string of provision-time kernel options,delimited with space " "
sub splitkcmdline{
my $kcmdline=shift;
if( $kcmdline =~ /xCAT::Utils/) {
$kcmdline=shift;
}
my %cmdhash;
my @cmdlist=split(/[, ]/,$kcmdline);
foreach my $cmd (@cmdlist){
if($cmd =~ /^R::(.*)$/){
$cmdhash{persistent}.="$1 ";
}else{
$cmdhash{volatile}.="$cmd ";
}
}
return \%cmdhash;
}
1;

View File

@ -69,11 +69,6 @@ require Exporter;
"1384198011.520581" => "rhels6.5", #ppc64
"1411733344.627228" => "rhels6.6", #x86_64
"1411733344.616389" => "rhels6.6", #ppc64
"1399449226.171922" => "rhels7", #x86_64
"1399449226.155578" => "rhels7", #ppc64
"1424360759.989976" => "rhels7.1", #x86_64
"1424360759.878519" => "rhels7.1", #ppc64
"1424361409.280138" => "rhels7.1", #ppc64le
"1285193176.593806" => "rhelhpc6", #x86_64
"1305067719.718814" => "rhelhpc6.1",#x86_64
"1321545261.599847" => "rhelhpc6.2",#x86_64

View File

@ -614,6 +614,8 @@ sub punch2Reader {
my $out;
if ( $os =~ m/sles10/i ) {
$out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /sbin/vmur punch $options -u $userId -r $srcFile -N $tgtFile"`;
} elsif ( $os =~ m/sles11/i ) {
$out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /usr/sbin/vmur punch $options -u $userId -r $srcFile -N $tgtFile"`;
} elsif ( $os =~ m/rhel/i ) {
$out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /usr/sbin/vmur punch $options -u $userId -r $srcFile -N $tgtFile"`;
} else {

View File

@ -71,7 +71,7 @@ sub createDummyPods {
my $cmd = "grep -r -E 'L<.+\\([57]\\)\\|.+\\.[57]>' " . $poddir;
#print "Running cmd: ", $cmd, "\n";
my @lines = `$cmd`;
if ($?) { print "Did not find any section 5 man page, creating dummy pods...\n"; print join('', @lines); }
if ($?) { print "Error running: $cmd\n"; print join('', @lines); }
#my @lines;
#system($cmd);
my @dummyPods;

View File

@ -1,111 +0,0 @@
#!/usr/bin/env python
"""
Usage: getslnodes.py [-h] [-v] [<hostname-match>]
Description:
Query your SoftLayer account and get attributes for each bare metal server.
The attributes can be piped to 'mkdef -z' to define the nodes into the xCAT
Database so that xCAT can manage them.
getslnodes requires a the .softlayer configuration file defined which can
be set by running "sl config setup" on the command line.
positional arguments:
hostname-match Select servers that include this partial hostname.
Optional:
-h, --help show this help message and exit
-v, --verbose display verbose output
"""
import sys
try:
import docopt
import pprint
import SoftLayer
except ImportError as e:
print 'Error: install missing python module before running this command: ' + str(e)
sys.exit(2)
def get_sl_servers():
# username, api_key, endpoint_url come from the .softlayer file
client = SoftLayer.Client()
mask = "hostname, fullyQualifiedDomainName, manufacturerSerialNumber, \
operatingSystem.id, operatingSystem.passwords.username, operatingSystem.passwords.password, \
remoteManagementAccounts.username, remoteManagementAccounts.password, remoteManagementComponent.ipmiIpAddress, \
primaryBackendNetworkComponent.primaryIpAddress, primaryBackendNetworkComponent.macAddress"
#
# If they specified hnmatch, it would be faster to have softlayer filter the response with something like:
# filter={'hardware': {'hostname': {'operation': '*= '+hostname}, 'domain': {'operation': '*= '+domain}}}
# But those 2 operations are ANDed together, so it will not work. And currently, filtering does not work on fullyQualifiedDomainName.
#
servers = client['Account'].getHardware(mask=mask)
return servers
def print_xcat_node_stanza(servers, hnmatch):
for server in servers:
if hnmatch and server['fullyQualifiedDomainName'].find(hnmatch) == -1:
continue
print "\n"+server['hostname']+":"
print "\tobjtype=node"
print "\tgroups=slnode,ipmi,all"
print "\tmgt=ipmi"
print "\tbmc="+server['remoteManagementComponent']['ipmiIpAddress']
# I have seen svrs with no remoteManagementAccounts entries
if len(server['remoteManagementAccounts']):
print "\tbmcusername="+server['remoteManagementAccounts'][0]['username']
print "\tbmcpassword="+server['remoteManagementAccounts'][0]['password']
print "\tip="+server['primaryBackendNetworkComponent']['primaryIpAddress']
print "\tmac="+server['primaryBackendNetworkComponent']['macAddress']
print "\tserial="+server['manufacturerSerialNumber']
print "\tnetboot=xnba"
print "\tarch=x86_64"
# Find the root or Administrator username and pw
username = None
password = None
for entry in server['operatingSystem']['passwords']:
if entry['username'] == 'root' or entry['username'] == 'Administrator':
# found it
username = entry['username']
password = entry['password']
break
elif not username:
# save the 1st entry, in case we never find root or Administrator
username = entry['username']
password = entry['password']
if username and password:
userStr = ", user:"+username+", pw:"+password
print "\tusercomment=hostname:"+server['fullyQualifiedDomainName']+userStr
if __name__ == '__main__':
try:
arguments = (docopt.docopt(__doc__, version="1.0"))
# print arguments
servers = get_sl_servers()
if arguments['--verbose']:
pprint.pprint(servers)
print_xcat_node_stanza(servers, arguments['<hostname-match>'])
except docopt.DocoptExit as e:
print e
except SoftLayer.exceptions.SoftLayerAPIError as e:
print e
sys.exit(1)

View File

@ -26,23 +26,7 @@ my $usage = sub {
exit $exitcode;
};
my $file = '/etc/os-release';
if (-f $file) {
#
# SLES and RHEL also have /etc/os-release file, so actually need to open the file
# and look for Ubuntu in the 'NAME=' lines before declaring Ubuntu
#
open my $info, $file or die "Could not open $file: $!";
while( my $line = <$info>) {
if (index($line, 'NAME=') != -1) {
if ($line =~ /Ubuntu/i) {
die "This script does not support Ubuntu at this time.\n";
}
}
}
close $info;
}
if (-f '/etc/os-release') { die "This script doesn't support ubuntu yet.\n"; }
# Process the cmd line args
Getopt::Long::Configure("bundling");

View File

@ -31,7 +31,7 @@ my $usage = sub {
# Process the cmd line args
Getopt::Long::Configure("bundling");
# Getopt::Long::Configure("pass_through");
#Getopt::Long::Configure("pass_through");
Getopt::Long::Configure("no_pass_through");
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'dryrun' => \$DRYRUN, 'w|waittime=s' => \$WAITTIME, 'a|noautoinst' => \$NOAUTOINST)) { $usage->(1); }
@ -40,13 +40,10 @@ if (scalar(@ARGV) != 1) { $usage->(1); }
if (!defined($WAITTIME)) { $WAITTIME = 75; } # seconds to wait after configuring the nic (to let the switch handle the state change)
my $noderange = $ARGV[0];
#
# Run some Node verification before starting pushinitrd
#
verifyNodeConfiguration($noderange);
my %bootparms = getBootParms($noderange);
copyFilesToNodes($noderange, \%bootparms);
updateGrubOnNodes($noderange, \%bootparms);
if ($DRYRUN) { exit(0); }
@ -57,6 +54,8 @@ if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); }
exit(0);
sub isRedhat { return (-e '/etc/redhat-release' || -e '/etc/centos-release' || -e '/etc/fedora-release'); }
# Query the db for the kernel, initrd, and kcmdline attributes of the 1st node in the noderange
sub getBootParms {
my $nr = shift @_;
@ -114,14 +113,12 @@ sub copyFilesToNodes {
my $localfile = "/tftpboot/$file";
# for the
my $remotefile = '/boot/' . remoteFilename($file);
my $cmd = "xdcp $nr -p $localfile $remotefile";
if ($DRYRUN) {
print "Dry run: Copying $localfile to $nr:$remotefile\n";
print "Dry run: $cmd\n";
print "Dry run: would copy $localfile to $nr:$remotefile\n";
}
else {
print "Copying $localfile to $nr:$remotefile\n";
runcmd($cmd);
runcmd("xdcp $nr -p $localfile $remotefile");
}
}
}
@ -187,20 +184,20 @@ sub modifyAutoinstFiles {
my $replace = "$sedstring\nchmod 755 $file.new; mv -f $file.new $file";
# Add a script that gets invoked by the OS after the nic is brought up
# Note: this does not work, because midway thru the autoyast process, the if-up.d scripts do not seem to get invoked
# so autoyast fails to get the media
# these are specific to SLES
#my $netdir = '/etc/sysconfig/network';
#my $filename = '/etc/sysconfig/network/if-up.d/xcat-sl-wait';
#my $mnip = $bootparms->{mnip};
#todo: to support rhel, use these values instead
#my $netdir='/etc/sysconfig/network-scripts';
#my $filename='/sbin/ifup-local';
# Note: this does not work, because midway thru the autoyast process, the if-up.d scripts do not seem to get invoked
# so autoyast fails to get the media
# these are specific to SLES
#my $netdir = '/etc/sysconfig/network';
#my $filename = '/etc/sysconfig/network/if-up.d/xcat-sl-wait';
#my $mnip = $bootparms->{mnip};
#todo: to support rhel, use these values instead
#my $netdir='/etc/sysconfig/network-scripts';
#my $filename='/sbin/ifup-local';
#my $replace = qq(
#FILENAME=$filename
#NETDIR=$netdir
#MNIP=$mnip
#);
#FILENAME=$filename
#NETDIR=$netdir
#MNIP=$mnip
#);
# $replace .= q(
#cat >$FILENAME << EOF1
#MNIP=$MNIP
@ -236,23 +233,6 @@ sub modifyAutoinstFiles {
}
}
sub verifyNodeConfiguration {
my $nr = shift @_;
my @nodes = runcmd("nodels $nr");
chomp(@nodes);
foreach my $n (@nodes) {
# Verify the IP is set for the node
my @output = runcmd("nodels $n hosts.ip");
chomp($output[0]);
my ($junk, $ip) = split(/\s+/, $output[0]);
#todo: also support getting the ip from name resolution
if (!$ip) {
die "Error: The ip attribute must be set for $n.\n";
}
}
}
# Copy softlayer specific systemimager post-install scripts to the systemimager location.
# These cause si to use static ip and insert a wait into the bring up of the network.
@ -272,6 +252,7 @@ sub getNodeIpInfo {
chomp($output[0]);
my ($junk, $ip) = split(/\s+/, $output[0]);
#todo: also support getting the ip from name resolution
if (!$ip) { die "Error: the ip attribute must be set for $node.\n"; }
# find relevant network in the networks table
# first get the networks in a hash

View File

@ -1,140 +0,0 @@
#!/usr/bin/python
"""
Usage:
softlayer_storage.py --type=<type> [--hostname=<hostname> --username=<username> --password=<password> --mountpoint=<mountpoint> ] (mount | unmount)
softlayer_storage.py --type=<type> [options] (mount | unmount)
Options:
-h --help Show help screen
--version Show version
--type=<type> Type of File Storage to mount ( consistent | nas )
--hostname=<hostname> SoftLayer Storage hostname
--username=<username> SoftLayer Storage LUN username
--password=<password> SoftLayer Storage LUN password
--mountpoint=<mountpoint> The mountpoint to use [default: /mnt/nas]
Description:
For consistent performance file storate, make sure the host accessing the
file storage has been authorized through the SoftLayer portal.
"""
import os
import sys
import docopt
path = os.path.dirname(os.path.realpath(__file__))
path = os.path.realpath(os.path.join(path, '..', 'lib', 'python'))
if path.startswith('/opt'):
# if installed into system path, do not muck with things
sys.path.append(path)
from xcat import xcatutils
def mount_nas_storage(hostname, user, passwd, mountPoint):
print "Attempting to mount the NAS File Storage at %s" %(mountPoint)
if xcatutils.isMounted(mountPoint):
raise xcatutils.xCatError("The mount point %s is already in use." %(mountPoint))
cmd = "mount -t cifs //%s/%s -o username=%s,password=%s,rw,nounix,iocharset=utf8,file_mode=0644,dir_mode=0755 %s" %(hostname, user, user, passwd, mountPoint)
out,err = xcatutils.run_command(cmd)
if err:
raise xcatutils.xCatError("Error when mounting. (%s)" %(err))
else:
print "Success\n"
# To help out with automount, print this msg
print "\nNote: To configure automount on reboot, add the following into /etc/fstab:"
cmd = "//%s/%s %s cifs defaults,username=%s,password=%s 0 0" %(hostname,user,mountPoint,user,passwd)
print "%s\n" %(cmd)
def mount_consistent_storage(hostname, user, mountPoint):
# TODO: would be good to be able to specify the nfs version as a argument
print "Attempting to mount the Consistent Performance File Storage at %s" %(mountPoint)
if xcatutils.isMounted(mountPoint):
raise xcatutils.xCatError("The mount point %s is already in use." %(mountPoint))
cmd = "mount -t nfs4 %s:/%s %s" %(hostname, user, mountPoint)
out,err = xcatutils.run_command(cmd)
if err:
raise xcatutils.xCatError("Error when mounting. (%s)" %(err))
else:
print "Success\n"
# To help out with automount, print this msg
print "\nNote: To configure automount on reboot, add the following into /etc/fstab:"
cmd = "%s:/%s %s nfs4 defaults,hard,intr 0 0" %(hostname,user,mountPoint)
print "%s\n" %(cmd)
def unmount_storage(mountPoint):
print "Attempting to unmount the NAS at %s..." %(mountPoint)
if not xcatutils.isMounted(mountPoint):
raise xcatutils.xCatError("The mount point %s is NOT mounted." %(mountPoint))
else:
cmd = "umount %s" %(mountPoint)
out,err = xcatutils.run_command(cmd)
if err:
print "Encountered error while unmounting..."
print err
def setup_softlayer_storage():
#
# set code defaults to consistent file storage options
#
requirePassword=False
preReqPackages = ['nfs-utils','nfs-utils-lib']
#
# if NAS is selected as the type, override the code defaults
#
if 'nas' in arguments['--type']:
requirePassword=True
preReqPackages = ['cifs-utils']
#
# verify information before starting
#
if arguments['--hostname'] is None:
arguments['--hostname'] = xcatutils.getUserInput("Enter the SoftLayer storage hostname")
if arguments['--username'] is None:
arguments['--username'] = xcatutils.getUserInput("Enter the SoftLayer storage username")
if arguments['--password'] is None and requirePassword:
arguments['--password'] = xcatutils.getUserInput("Enter the SoftLayer storage password")
#
# install prereqs
#
print "Checking for installed packages: %s" %(preReqPackages)
xcatutils.installPackages(preReqPackages)
#
# mount the file storage
#
if 'nas' in arguments['--type']:
mount_nas_storage(arguments['--hostname'],arguments['--username'],arguments['--password'],arguments['--mountpoint'])
elif 'consistent' in arguments['--type']:
mount_consistent_storage(arguments['--hostname'],arguments['--username'],arguments['--mountpoint'])
if __name__ == '__main__':
try:
arguments = (docopt.docopt(__doc__, version="1.0"))
if not arguments['--type'] in ('nas', 'consistent'):
raise xcatutils.xCatError("The type=%s is not a supported file system type." %(arguments['--type']))
if arguments['unmount']:
unmount_storage(arguments['--mountpoint'])
else:
setup_softlayer_storage()
except docopt.DocoptExit as e:
print e
except xcatutils.xCatError as e:
print "xCatError: %s" %(e)

View File

@ -1,85 +0,0 @@
import sys
import os
import platform
class xCatError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def isMounted(mountPoint):
if os.path.ismount(mountPoint):
return True
else:
return False
def run_command(cmd):
"""
Function: run_command
Arguments: cmd - string to be run as a command
Description: runs the command then returns out and err
"""
import subprocess
p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
(out,err) = p.communicate()
return (out,err)
def isRhel():
myDistro = platform.linux_distribution()
if "Red Hat Enterprise Linux Server" or "CentOS" in myDistro:
return True
else:
return False
def isSles():
myDistro = platform.linux_distribution()
if "SUSE Linux Enterprise Server" in myDistro:
return True
else:
return False
def isUbuntu():
myDistro = platform.linux_distribution()
if "Ubuntu" in myDistro:
return True
else:
return False
def getUserInput(question):
response = raw_input("%s: " %(question))
return response
def filterInstalledPackages(pkglist=[]):
fulllist = ""
if isRhel():
# using YUM
import yum
yb = yum.YumBase()
for x in pkglist:
if not yb.rpmdb.searchNevra(name='%s' %(x)):
fulllist += "%s " %(x)
return fulllist
def installPackages(pkglist=[]):
fulllist = filterInstalledPackages(pkglist)
if isRhel():
if fulllist.strip() != "":
cmd = "yum -y install %s" %(fulllist)
out,err = xcatutils.run_command(cmd)
elif isSles():
print "Using zyppr..."
elif isUbuntu():
print "Using apt-get..."
else:
print "Error!"

View File

@ -47,9 +47,6 @@ xCAT-SoftLayer provides Utilities to make xCAT work in a SoftLayer environment.
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/python
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/python/xcat
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/install
#mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
@ -62,8 +59,6 @@ cp -p -R share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin
chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
cp -d lib/python/xcat/* $RPM_BUILD_ROOT/%{prefix}/lib/python/xcat/
#cp -d postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
#chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts/*

View File

@ -71,7 +71,7 @@ sub createDummyPods {
my $cmd = "grep -r -E 'L<.+\\([57]\\)\\|.+\\.[57]>' " . $poddir;
#print "Running cmd: ", $cmd, "\n";
my @lines = `$cmd`;
if ($?) { print "Did not find any section 5 man page, creating dummy pods...\n"; print join('', @lines); }
if ($?) { print "Error running: $cmd\n"; print join('', @lines); }
#my @lines;
#system($cmd);
my @dummyPods;

0
xCAT-UI/debian/rules Executable file → Normal file
View File

View File

@ -210,11 +210,11 @@ Add product package rpms to a previously built kit tar file. This is used for p
=over 3
=item <B>0
=item 0
The command completed successfully.
=item <B>1
=item 1
An error has occurred.

0
xCAT-buildkit/share/xcat/kits/debian_template/rules Executable file → Normal file
View File

View File

@ -314,38 +314,6 @@ if ((($odbconly == 0) && ( $::xcatrunningmysql == 0)) || $::UPDATE || $::SETUPLL
# initial setup request, if not already running mysql
if (($::INIT) && ($::xcatrunningmysql == 0))
{
# MySQL not running, then initialize the database
if ($::mysqlrunning == 0)
{
# Add mysql user and group for AIX
# Correct directory permissions
#
&fixinstalldir;
#
# Init mysql db and setup my.cnf
#
&initmysqldb;
#
# Start MySQL server
#
&mysqlstart;
#
# Setup MySQL to restart on reboot
#
&mysqlreboot;
#
# set mysql root password in database
#
#
&setupmysqlroot;
}
# Verify the mysql root password, if it is wrong, do nothing and die.
&verifymysqlroot;
#
# Backup current database
@ -398,6 +366,37 @@ if (($::INIT) && ($::xcatrunningmysql == 0))
exit(1);
}
# MySQL not running, then initialize the database
if ($::mysqlrunning == 0)
{
# Add mysql user and group for AIX
# Correct directory permissions
#
&fixinstalldir;
#
# Init mysql db and setup my.cnf
#
&initmysqldb;
#
# Start MySQL server
#
&mysqlstart;
#
# Setup MySQL to restart on reboot
#
&mysqlreboot;
#
# set mysql root password in database
#
#
&setupmysqlroot;
}
# if xcat not already configured to run mysql, then add xcat info to the DB
if ($::xcatrunningmysql == 0)
{
@ -1064,39 +1063,6 @@ sub mysqlreboot
}
sub verifymysqlroot
{
# Verify if mysql has an correct user input root password
if ($::osname eq 'AIX')
{
my $cmd2 =
"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;";
$cmd = $cmd2;
$cmd .= "$::installdir/bin/mysqladmin -u root -p$::rootpassword version";
}
else
{
$cmd = "/usr/bin/mysqladmin -u root -p$::rootpassword version";
}
my $tmpv = $::VERBOSE;
$::VERBOSE = 0;
xCAT::Utils->runcmd($cmd, 0);
$::VERBOSE = $tmpv;
if ($::RUNCMD_RC == 0)
{
# User has input an correct root passwd. That is fine. Do nothing and go head.
return
}
# The password is wrong, warn the user and die.
xCAT::MsgUtils->message(
"E",
"Wrong MySQL root password."
);
exit 1;
}
#-----------------------------------------------------------------------------
=head3 setupmysqlroot

View File

@ -225,7 +225,7 @@ sub asunode {
} else {
foreach my $a (@_) { $args .= ' ' . xCAT::Utils->quote($a); }
}
my $cmd = "$::asucmd $args --host '$bmc' --user '$username' --password '$passwd' 2>&1 |";
my $cmd = "$::asucmd $args --host $bmc --user $username --password $passwd 2>&1 |";
if ($::VERBOSE) { print "forking $cmd\n"; }
my $pid = open($$out, $cmd);
$pids{$pid} = $node;

View File

@ -779,7 +779,7 @@ sub initpgdb
`$cmd`;
if ($::osname eq 'Linux')
{
$cmd = qq~ echo listen_addresses = \\'localhost,$::MN\\' >> $pgconf~;
$cmd = qq~ echo listen_addresses = \\'*\\' >> $pgconf~;
`$cmd`;
}

View File

@ -59,11 +59,6 @@ if ($::NOEXPAND) { # this is when ppping is calling us and has already expanded
@nodes = split(/,/, $noderange);
}
else { # the normal case of the user running the cmd - expand the noderange using xcatd
my %sslargs;
if (defined($ENV{'XCATSSLVER'})) {
$sslargs{SSL_version} = $ENV{'XCATSSLVER'};
}
my $client = IO::Socket::SSL->new(
PeerAddr=>$xcathost,
SSL_key_file=> xCAT::Utils->getHomeDir()."/.xcat/client-cred.pem",
@ -71,7 +66,6 @@ else { # the normal case of the user running the cmd - expand the noderange us
SSL_ca_file => xCAT::Utils->getHomeDir()."/.xcat/ca.pem",
SSL_use_cert => 1,
SSL_verify_mode => 1,
%sslargs,
);
die "Connection failure: $!\n" unless ($client);
my %cmdref = (command => 'noderange', noderange => $noderange);
@ -179,7 +173,7 @@ sub nmap_pping {
my @nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions");
my $more_options = $nmap_options[0];
open (FPING, "nmap -PE --unprivileged --system-dns --send-ip -sP $more_options ".join(' ',@$nodes). " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
open (FPING, "nmap -PE --system-dns --send-ip -sP $more_options ".join(' ',@$nodes). " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
my $node;
while (<FPING>) {
if (/Host (.*) \(.*\) appears to be up/) {

View File

@ -77,19 +77,13 @@ my $noderange = $ARGV[0];
my @user = getpwuid($>);
my $homedir=$user[7];
my %sslargs;
if (defined($ENV{'XCATSSLVER'})) {
$sslargs{SSL_version} = $ENV{'XCATSSLVER'};
}
my $client = IO::Socket::SSL->new(
PeerAddr=>$xcathost,
SSL_key_file=>$homedir."/.xcat/client-cred.pem",
SSL_cert_file=>$homedir."/.xcat/client-cred.pem",
SSL_ca_file => $homedir."/.xcat/ca.pem",
SSL_use_cert => 1,
%sslargs,
SSL_verify_mode => SSL_VERIFY_PEER,
#SSL_verify_mode => 1,
);
die "Connection failure: $!\n" unless ($client);
my %cmdref = (command => 'noderange', noderange => $noderange);

View File

@ -63,11 +63,6 @@ if ($fanout) { # see if they overroad the fanout from the command line
(my $noderange,my $destloc) = split(/:/,$ARGV[1]);
my @user = getpwuid($>);
my $homedir=$user[7];
my %sslargs;
if (defined($ENV{'XCATSSLVER'})) {
$sslargs{SSL_version} = $ENV{'XCATSSLVER'};
}
my $client = IO::Socket::SSL->new(
PeerAddr=>$xcathost,
SSL_key_file=>$homedir."/.xcat/client-cred.pem",
@ -75,7 +70,6 @@ my $client = IO::Socket::SSL->new(
SSL_ca_file => $homedir."/.xcat/ca.pem",
SSL_use_cert => 1,
SSL_verify_mode => 1,
%sslargs,
);
die "Connection failure: $!\n" unless ($client);
my %cmdref = (command => 'noderange', noderange => $noderange);

View File

@ -137,6 +137,7 @@ sub processoutput { #This way, one arbiter handles output, no interrupting
sub scpnode {
my $inputs = shift;
my $nodehdl = shift;
my $out = shift;
my $node = shift;
my $in;
#my $args = join(" ",@_);

View File

@ -61,7 +61,7 @@ else {
SSL_cert_file=>$homedir."/.xcat/client-cred.pem",
SSL_ca_file => $homedir."/.xcat/ca.pem",
SSL_use_cert => 1,
SSL_verify_mode => SSL_VERIFY_MODE,
#SSL_verify_mode => 1,
);
die "Connection failure: $!\n" unless ($client);
my %cmdref = (command => 'noderange', noderange => $noderange);

View File

@ -52,28 +52,15 @@ if [ -n "$2" ]; then
fi
fi
# xCAT 2.9.1 allows for an option to use confluent as a rcons replacement and only use
# confluent if this keyword is defined in the site table. This allows for confluent to
# be installed on the xCAT management node and switch between conserver & confluent
USE_CONFLUENT=0
CONSOLE_SERVICE_KEYWORD=`tabdump site | grep consoleservice | cut -d, -f1 | tr -d '"'`
CONSOLE_SERVICE_VALUE=`tabdump site | grep consoleservice | cut -d, -f2 | tr -d '"'`
if [ "$CONSOLE_SERVICE_KEYWORD" == "consoleservice" ]; then
if [ "$CONSOLE_SERVICE_VALUE" == "confluent" ]; then
USE_CONFLUENT=1
fi
fi
if [ $USE_CONFLUENT == "1" ] && ([ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ] || [ -x "/usr/local/bin/confetty" ]); then
#use confluent
CONFETTY="confetty"
if [ -x "/opt/confluent/bin/confetty" ]; then
if [ -x "/opt/confluent/bin/confetty" ] || [ -x "/usr/bin/confetty" ]; then
#use confluent
CONFETTY="confetty"
if [ -x "/opt/confluent/bin/confetty" ]; then
CONFETTY="/opt/confluent/bin/confetty"
fi
if [ ! -z "$CONSCONTROLPATH" ]; then
CONSCONTROLPATH="-c $CONSCONTROLPATH"
fi
fi
if [ ! -z "$CONSCONTROLPATH" ]; then
CONSCONTROLPATH="-c $CONSCONTROLPATH"
fi
if [ -z "$CONSERVER" ]; then
CONSERVER=`nodels $1 nodehm.conserver 2>/dev/null | awk -F: '{print $2}' | tr -d ' '`
fi

View File

@ -18,11 +18,9 @@ my $sb;
my $tilefact;
my $xrm="-xrm xterm.mainMenu.*.font:fixed -xrm xterm.vtMenu.*.font:fixed -xrm xterm.fontMenu.*.font:fixed -xrm xterm -xrm xterm.vt100.font6:grvga.737";
my $font = "5x7";
my $sizegeometry;
GetOptions(
#'sb' => \$sb,
'tile|t:i' => \$tilefact,
'geometry|g:s' => \$sizegeometry,
#'font|f=s' => \$font
);
my $noderange = $ARGV[$#ARGV];
@ -106,12 +104,8 @@ if (defined($tilefact)) {
$ENV{CONSCONTROLPATH} = "/tmp/wconscontrol.$firstnode.$$";
system("xterm $xrm -bg black -fg white -title $firstnode -n $firstnode -geometry $sizegeometry+0+0 ".join(" ",@ARGV)." -e /bin/bash -c \"/bin/true ".$ENV{DISPLAY}." $firstnode $firstnode & let SDATE=`date +%s`+5; $mydir/rcons $firstnode ".$conservers{$firstnode}."; if [ \\\$SDATE -gt \\`date +%s\\` ]; then echo Press enter to close; read SDATE; fi \" &");
$ENV{CONSCONTROLPATH} = "";
system("xterm $xrm -bg black -fg white -title $firstnode -n $firstnode -geometry +0+0 ".join(" ",@ARGV)." -e /bin/bash -c \"$mydir/xtcd.pl ".$ENV{DISPLAY}." $firstnode $firstnode & let SDATE=`date +%s`+5; $mydir/rcons $firstnode ".$conservers{$firstnode}."; if [ \\\$SDATE -gt \\`date +%s\\` ]; then echo Press enter to close; read SDATE; fi \" &");
my $remainwait = 2;
if (-x "/opt/confluent/bin/confetty" or -x "/usr/bin/confetty" or -x "/usr/local/bin/confetty" ) {
$remainwait = 10;
}
while (not -S "/tmp/wconscontrol.$firstnode.$$" and $remainwait > 0) {
sleep(0.1);
$remainwait -= 0.1;
@ -160,11 +154,7 @@ if (defined($tilefact)) {
$currx=0;
}
} else {
my $geo;
if ($sizegeometry) {
$geo = "-g $sizegeometry ";
}
system("xterm $xrm $geo-bg black -fg white -title $firstnode -n $firstnode ".join(" ",@ARGV)." -e /bin/bash -c \"$mydir/xtcd.pl ".$ENV{DISPLAY}." $firstnode $firstnode & let SDATE=`date +%s`+5; $mydir/rcons $firstnode ".$conservers{$firstnode}."; if [ \\\$SDATE -gt \\`date +%s\\` ]; then echo Press enter to close; read SDATE; fi\" &");
system("xterm $xrm -bg black -fg white -title $firstnode -n $firstnode ".join(" ",@ARGV)." -e /bin/bash -c \"$mydir/xtcd.pl ".$ENV{DISPLAY}." $firstnode $firstnode & let SDATE=`date +%s`+5; $mydir/rcons $firstnode ".$conservers{$firstnode}."; if [ \\\$SDATE -gt \\`date +%s\\` ]; then echo Press enter to close; read SDATE; fi\" &");
}
my $geometry="";
@ -172,7 +162,7 @@ foreach (@nodes) {
if ($tilefact) {
my $corrected_x=$currx+$wmxo;
my $corrected_y=$curry+$wmyo;
$geometry="-geometry $sizegeometry+$corrected_x+$corrected_y";
$geometry="-geometry +$corrected_x+$corrected_y";
$currx+=$window_width;
if ($currx >= ($tilefact * $window_width)) {
$currx=0;
@ -181,8 +171,6 @@ foreach (@nodes) {
$curry = $panel_pad; #+$top_pad;
}
}
} elsif ($sizegeometry) {
$geometry = "-geometry $sizegeometry";
}
system("xterm $xrm -bg black -fg white ".join(" ",@ARGV)." -title $_ -n $_ $geometry -e /bin/bash -c \"$mydir/xtcd.pl .".$ENV{DISPLAY}." $_ $_ & let SDATE=`date +%s`+5; $mydir/rcons $_ ".$conservers{$_}."; if [ \\\$SDATE -gt \\`date +%s\\` ]; then echo Press enter to close; read SDATE; fi\" &");

View File

@ -97,27 +97,3 @@ opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkitcomp
opt/xcat/bin/xcatclientnnr opt/xcat/bin/chkkitcomp
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitdeployparam
opt/xcat/bin/xcatclient opt/xcat/bin/postage
opt/xcat/bin/xcatclient opt/xcat/bin/cfghost
opt/xcat/bin/xcatclientnnr opt/xcat/bin/cfgve
opt/xcat/bin/xcatclientnnr opt/xcat/bin/chzone
opt/xcat/bin/xcatclientnnr opt/xcat/bin/configfpc
opt/xcat/bin/xcatclientnnr opt/xcat/bin/geninitrd
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskmodules
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lsve
opt/xcat/bin/xcatclientnnr opt/xcat/bin/mkzone
opt/xcat/bin/xcatclientnnr opt/xcat/bin/nodeaddunmged
opt/xcat/bin/xcatclient opt/xcat/bin/nodechmac
opt/xcat/bin/xcatclient opt/xcat/bin/nodechprofile
opt/xcat/bin/xcatclientnnr opt/xcat/bin/nodediscoverdef
opt/xcat/bin/xcatclientnnr opt/xcat/bin/nodediscoverls
opt/xcat/bin/xcatclientnnr opt/xcat/bin/nodediscoverstart
opt/xcat/bin/xcatclientnnr opt/xcat/bin/nodediscoverstatus
opt/xcat/bin/xcatclientnnr opt/xcat/bin/nodediscoverstop
opt/xcat/bin/xcatclientnnr opt/xcat/bin/nodeimport
opt/xcat/bin/xcatclient opt/xcat/bin/nodepurge
opt/xcat/bin/xcatclient opt/xcat/bin/noderefresh
opt/xcat/bin/xcatclient opt/xcat/bin/noderegenips
opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmosdistro
opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmzone
opt/xcat/bin/xcatclientnnr opt/xcat/bin/slpdiscover
opt/xcat/bin/xcatclient opt/xcat/bin/xCATWorld

View File

@ -134,22 +134,12 @@ To import nodes using a profile, follow the following steps:
cec=mycec
lparid=2
# Node information file ends.
Example of a node information file that specifies a PowerKVM Guest node that uses KVM management:
# Node information file begins
# This entry defines a PowerKVM Guest node.
# Make sure the node 'vm01' is already created on Hypervisor
vm01:
mac=b8:ef:3f:28:31:15
vmhost=pkvm1
# Node information file ends.
The node information file includes the following items:
B<__hostname__:> This is a mandatory item.
Description: The name of the node, where __hostname__ is automatically generated by the node name format. You can also input a fixed node name, for example "compute-node".
Description: The name of the node, where __hostname__ is automatically generated by the node name format. You can also input a fixed node name, for example “compute-node”.
B<mac=<mac-address>> This is a mandatory item.
@ -195,10 +185,6 @@ B<unit=<rack-server-unit-location>> This is an optional item.
Description: node location info, for rack server only. Specify the node's start unit number in rack, in U. this item must be specified together with rack and height.
B<vmhost=<PowerKVM Hypervisior Host Name>> This is a mandatory option for defining PowerKVM Guest nodes.
Description: Specifies the vmhost of a Power KVM Guest node, where <vmhost> is the host name of PowerKVM Hypervisior.
3. Import the nodes, by using the following commands. Note: If we want to import PureFlex X/P nodes, hardware profile must be set to a PureFlex hardware type.
nodeimport file=/root/hostinfo.txt networkprofile=default_cn imageprofile=rhels6.3_packaged hostnameformat=compute-#NNN

View File

@ -27,38 +27,17 @@ B<Power 7 server specific :>
=over 2
B<renergy> I<noderange> [-V] { all | [savingstatus] [dsavingstatus]
[cappingstatus] [cappingmaxmin] [cappingvalue] [cappingsoftmin]
[averageAC] [averageDC] [ambienttemp] [exhausttemp] [CPUspeed]
[syssbpower] [sysIPLtime] [fsavingstatus] [ffoMin] [ffoVmin]
[ffoTurbo] [ffoNorm] [ffovalue]}
B<renergy> I<noderange> [-V] { savingstatus={on | off}
| dsavingstatus={on-norm | on-maxp | off}
| fsavingstatus={on | off} | ffovalue=MHZ
| cappingstatus={on | off} | cappingwatt=watt
| cappingperc=percentage }
=back
B<Power 8 server specific :>
=over 2
B<renergy> I<noderange> [-V] { all | [savingstatus] [dsavingstatus]
[averageAC] [averageAChistory] [averageDC] [averageDChistory]
[ambienttemp] [ambienttemphistory] [exhausttemp] [exhausttemphistory]
[fanspeed] [fanspeedhistory] [CPUspeed] [CPUspeedhistory]
[cappingstatus] [cappingmaxmin] [cappingvalue] [cappingsoftmin]
[averageAC] [averageDC] [ambienttemp] [exhausttemp] [CPUspeed]
[syssbpower] [sysIPLtime] [fsavingstatus] [ffoMin] [ffoVmin]
[ffoTurbo] [ffoNorm] [ffovalue]}
B<renergy> I<noderange> [-V] { savingstatus={on | off}
| dsavingstatus={on-norm | on-maxp | off}
| fsavingstatus={on | off} | ffovalue=MHZ }
I<NOTE:> The setting operation for B<Power 8> server is only supported
for the server which is running in PowerVM mode. Do NOT run the setting
for the server which is running in OPAL mode.
| fsavingstatus={on | off} | ffovalue=MHZ
| cappingstatus={on | off} | cappingwatt=watt
| cappingperc=percentage }
=back
@ -148,11 +127,10 @@ user can query and set the power saving and power capping status, and also can
query the average consumed energy, the ambient and exhaust temperature,
the processor frequency for a server.
B<renergy> command supports IBM POWER6, POWER7 and POWER8 rack-mounted servers,
B<renergy> command supports IBM POWER6 and POWER7 rack-mounted servers,
BladeCenter management modules, blade servers, and iDataPlex servers.
For I<Power6> and I<Power7> rack-mounted servers, the following specific hardware types are supported:
For system p rack-mounted servers, the following specific hardware types are supported:
I<8203-E4A>, I<8204-E8A>, I<9125-F2A>, I<8233-E8B>, I<8236-E8C>.
For I<Power8> server, there's no hardware type restriction.
The parameter I<noderange> needs to be specified for the B<renergy> command to
get the target servers. The I<noderange> should be a list of CEC node names, blade
@ -256,13 +234,11 @@ will get response immediately.
=head1 B<PREREQUISITES>
For the I<Power6> and I<Power7> nodes, the B<renergy> command depends
For the system p nodes, the B<renergy> command depends
on the Energy Management Plugin B<xCAT-pEnergy> to
communicate with server. B<xCAT-pEnergy> can be downloaded from the IBM web site:
http://www.ibm.com/support/fixcentral/. (Other Software -> EM)
NOTE: I<Power8> nodes don't need this specific energy management package.
For iDataPlex nodes, the B<renergy> command depends
on the Energy Management Plugin B<xCAT-xEnergy> to
communicate with server. This plugin must be requested from IBM.
@ -286,14 +262,12 @@ Display the version information.
Verbose output.
=item B<all>
Query all energy attributes which supported by the specific
type of hardware.
For I<Power8> machines, will not display the attributes
for historical records.
=item B<pd1all>
Query all energy attributes of the power domain 1 for blade
@ -308,10 +282,6 @@ management module node.
Query the current ambient temperature. (Unit is centigrade)
=item B<ambienttemphistory>
Query the historical records which were generated in last one hour for B<ambienttemp>.
=item B<availableDC>
Query the total DC power available for the entire blade center chassis.
@ -328,18 +298,10 @@ averageAC is the total AC power being consumed by all modules
in the chassis. It also includes power consumed by the Chassis
Cooling Devices for BCH chassis.
=item B<averageAChistory>
Query the historical records which were generated in last one hour for B<averageAC>.
=item B<averageDC>
Query the average power consumed (Output). (Unit is watt)
=item B<averageDChistory>
Query the historical records which were generated in last one hour for B<averageDC>.
=item B<capability>
Query the Power Capabilities of the blade server.
@ -418,10 +380,6 @@ guaranteed.
Query the effective processor frequency. (Unit is MHz)
=item B<CPUspeedhistory>
Query the historical records which were generated in last one hour for B<CPUspeed>
=item B<dsavingstatus>
Query the dynamic power saving status. The result should
@ -452,21 +410,6 @@ B<savingstatus> is in turn off status.
Query the current exhaust temperature. (Unit is centigrade)
=item B<exhausttemphistory>
Query the historical records which were generated in last one hour for B<exhausttemp>
=item B<fanspeed>
Query the fan speed for all the fans which installed in this node. (Unit is RPM - Rotations Per Minute))
If there are multiple fans for a node, multiple lines will be output. And a fan name in bracket will be
appended after B<fanspped> attribute name.
=item B<fanspeedhistory>
Query the historical records which were generated in last one hour for B<fanspeed>.
=item B<ffoMin>
Query the minimum cpu frequency which can be set for FFO. (Fixed
@ -512,7 +455,7 @@ The ffovalue setting operation needs about 1 minute to take effect.
Query the status of FFO. The result should be 'on' or 'off'.
'on' - enable; 'off' - disable.
=item B<fsavingstatus>={B<on> | B<off>}
=item B<fsavingstatus>={B<on> B<off>}
Set the status of FFO. The value must be 'on' or 'off'.
@ -631,7 +574,7 @@ Query the time used from FSP standby to OS standby.
=item B<syssbpower>
Query the system power consumed prior to power on.
(Unit is Watt)
(Unit is MHz)
=item B<thermaloutput>
@ -652,7 +595,7 @@ center chassis.
=item 1
Query all attributes which CEC1,CEC2 supported.
Query all the attributes which CEC1,CEC2 supported.
B<renergy> CEC1,CEC2 all
@ -686,43 +629,6 @@ The output of the query operation:
=item 2
Query the B<fanspeed> attribute for Power8 CEC.
B<renergy> CEC1 fanspeed
The output of the query operation:
CEC1: fanspeed (Fan U78CB.001.WZS00MA-A1 00002101): 5947 RPM
CEC1: fanspeed (Fan U78CB.001.WZS00MA-A2 00002103): 6081 RPM
CEC1: fanspeed (Fan U78CB.001.WZS00MA-A3 00002105): 6108 RPM
CEC1: fanspeed (Fan U78CB.001.WZS00MA-A4 00002107): 6000 RPM
CEC1: fanspeed (Fan U78CB.001.WZS00MA-A5 00002109): 6013 RPM
CEC1: fanspeed (Fan U78CB.001.WZS00MA-A6 0000210B): 6013 RPM
CEC1: fanspeed (Fan U78CB.001.WZS00MA-E1 0000210C): 4992 RPM
CEC1: fanspeed (Fan U78CB.001.WZS00MA-E2 0000210D): 5016 RPM
=item 3
Query the historical records for the B<CPUspeed> attribute. (Power8 CEC)
B<renergy> CEC1 CPUspeedhistory
The output of the query operation:
CEC1: CPUspeedhistory: 2027 MHZ: 20141226042900
CEC1: CPUspeedhistory: 2027 MHZ: 20141226042930
CEC1: CPUspeedhistory: 2244 MHZ: 20141226043000
CEC1: CPUspeedhistory: 2393 MHZ: 20141226043030
CEC1: CPUspeedhistory: 2393 MHZ: 20141226043100
CEC1: CPUspeedhistory: 2393 MHZ: 20141226043130
CEC1: CPUspeedhistory: 2393 MHZ: 20141226043200
CEC1: CPUspeedhistory: 2393 MHZ: 20141226043230
CEC1: CPUspeedhistory: 2393 MHZ: 20141226043300
CEC1: CPUspeedhistory: 2393 MHZ: 20141226043330
...
=item 4
Query all the attirbutes for management module node MM1. (For chassis)
B<renergy> MM1 all
@ -752,7 +658,7 @@ The output of the query operation:
in this power domain.
mm1: thermaloutput: 9717.376000 BTU/hour
=item 5
=item 3
Query all the attirbutes for blade server node blade1.
@ -768,7 +674,7 @@ The output of the query operation:
blade1: maxCPUspeed: 4204MHZ
blade1: savingstatus: off
=item 6
=item 4
Query the attributes savingstatus, cappingstatus
and CPUspeed for server CEC1.
@ -781,7 +687,7 @@ The output of the query operation:
CEC1: cappingstatus: on
CEC1: CPUspeed: 3621 MHz
=item 7
=item 5
Turn on the power saving function of CEC1.
@ -792,7 +698,7 @@ The output of the setting operation:
CEC1: Set savingstatus succeeded.
CEC1: This setting may need some minutes to take effect.
=item 8
=item 6
Set the power capping value base on the percentage of the
max-min capping value. Here, set it to 50%.

View File

@ -86,6 +86,8 @@ Reboot the service processor. If there are primary and secondary FSPs/BPAs of on
Attempt to request clean shutdown of OS (may not detect failures in completing command)
For stateless osimage, the 'acpid' package needs to be added to the .pkglist configuration file for the stateless osimage to enable the 'softoff' function.
=item B<off>
Turn power off.

View File

@ -294,14 +294,6 @@ export XCATROOT PATH MANPATH
export PERL_BADLANG=0
EOF
# export XCATSSLVER for sles11. Others OS can work without this setting.
if [ -r /etc/SuSE-release ]; then
ver=`grep 'VERSION' /etc/SuSE-release | awk -F= '{print $2}' | sed 's/ //g'`
if [ "$ver" = "11" ]; then
echo 'export XCATSSLVER=TLSv1' >> /etc/profile.d/xcat.sh
fi
fi
cat << EOF > /etc/profile.d/xcat.csh
setenv XCATROOT "$RPM_INSTALL_PREFIX0"
setenv PATH \${XCATROOT}/bin:\${XCATROOT}/sbin:\${XCATROOT}/share/xcat/tools:\${PATH}

View File

@ -72,7 +72,7 @@ sub createDummyPods {
my $cmd = "grep -r -E 'L<.+\\([57]\\)\\|.+\\.[57]>' " . $poddir;
#print "Running cmd: ", $cmd, "\n";
my @lines = `$cmd`;
if ($?) { print "Did not find any section 5 man page, creating dummy pods...\n"; print join('', @lines); }
if ($?) { print "Error running: $cmd\n"; print join('', @lines); }
#my @lines;
#system($cmd);
my @dummyPods;

View File

@ -1,326 +0,0 @@
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<title>Eclipse Public License - Version 1.0</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Revision>2</o:Revision>
<o:TotalTime>3</o:TotalTime>
<o:Created>2004-03-05T23:03:00Z</o:Created>
<o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
<o:Pages>4</o:Pages>
<o:Words>1626</o:Words>
<o:Characters>9270</o:Characters>
<o:Lines>77</o:Lines>
<o:Paragraphs>18</o:Paragraphs>
<o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
<o:Version>9.4402</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:TrackRevisions/>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:553679495 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p
{margin-right:0in;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p.BalloonText, li.BalloonText, div.BalloonText
{mso-style-name:"Balloon Text";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:8.0pt;
font-family:Tahoma;
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US style='tab-interval:.5in'>
<div class=Section1>
<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
</p>
<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
OF THIS AGREEMENT.</span> </p>
<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
in the case of the initial Contributor, the initial code and documentation
distributed under this Agreement, and<br clear=left>
b) in the case of each subsequent Contributor:</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
changes to the Program, and</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
additions to the Program;</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
such changes and/or additions to the Program originate from and are distributed
by that particular Contributor. A Contribution 'originates' from a Contributor
if it was added to the Program by such Contributor itself or anyone acting on
such Contributor's behalf. Contributions do not include additions to the
Program which: (i) are separate modules of software distributed in conjunction
with the Program under their own license agreement, and (ii) are not derivative
works of the Program. </span></p>
<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
entity that distributes the Program.</span> </p>
<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
claims licensable by a Contributor which are necessarily infringed by the use
or sale of its Contribution alone or when combined with the Program. </span></p>
<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
distributed in accordance with this Agreement.</span> </p>
<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
receives the Program under this Agreement, including all Contributors.</span> </p>
<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
Subject to the terms of this Agreement, each Contributor hereby grants Recipient
a non-exclusive, worldwide, royalty-free copyright license to<span
style='color:red'> </span>reproduce, prepare derivative works of, publicly
display, publicly perform, distribute and sublicense the Contribution of such
Contributor, if any, and such derivative works, in source code and object code
form.</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
patent license under Licensed Patents to make, use, sell, offer to sell, import
and otherwise transfer the Contribution of such Contributor, if any, in source
code and object code form. This patent license shall apply to the combination
of the Contribution and the Program if, at the time the Contribution is added
by the Contributor, such addition of the Contribution causes such combination
to be covered by the Licensed Patents. The patent license shall not apply to
any other combinations which include the Contribution. No hardware per se is
licensed hereunder. </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
Recipient understands that although each Contributor grants the licenses to its
Contributions set forth herein, no assurances are provided by any Contributor
that the Program does not infringe the patent or other intellectual property
rights of any other entity. Each Contributor disclaims any liability to Recipient
for claims brought by any other entity based on infringement of intellectual
property rights or otherwise. As a condition to exercising the rights and
licenses granted hereunder, each Recipient hereby assumes sole responsibility
to secure any other intellectual property rights needed, if any. For example,
if a third party patent license is required to allow Recipient to distribute
the Program, it is Recipient's responsibility to acquire that license before
distributing the Program.</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
Each Contributor represents that to its knowledge it has sufficient copyright
rights in its Contribution, if any, to grant the copyright license set forth in
this Agreement. </span></p>
<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
Program in object code form under its own license agreement, provided that:</span>
</p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
it complies with the terms and conditions of this Agreement; and</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
its license agreement:</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
effectively disclaims on behalf of all Contributors all warranties and
conditions, express and implied, including warranties or conditions of title
and non-infringement, and implied warranties or conditions of merchantability
and fitness for a particular purpose; </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
effectively excludes on behalf of all Contributors all liability for damages,
including direct, indirect, special, incidental and consequential damages, such
as lost profits; </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
states that any provisions which differ from this Agreement are offered by that
Contributor alone and not by any other party; and</span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
states that source code for the Program is available from such Contributor, and
informs licensees how to obtain it in a reasonable manner on or through a
medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
<p><span style='font-size:10.0pt'>When the Program is made available in source
code form:</span> </p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
it must be made available under this Agreement; and </span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
copy of this Agreement must be included with each copy of the Program. </span></p>
<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
copyright notices contained within the Program. </span></p>
<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
originator of its Contribution, if any, in a manner that reasonably allows
subsequent Recipients to identify the originator of the Contribution. </span></p>
<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
<p><span style='font-size:10.0pt'>Commercial distributors of software may
accept certain responsibilities with respect to end users, business partners
and the like. While this license is intended to facilitate the commercial use
of the Program, the Contributor who includes the Program in a commercial
product offering should do so in a manner which does not create potential
liability for other Contributors. Therefore, if a Contributor includes the
Program in a commercial product offering, such Contributor (&quot;Commercial
Contributor&quot;) hereby agrees to defend and indemnify every other
Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
legal actions brought by a third party against the Indemnified Contributor to
the extent caused by the acts or omissions of such Commercial Contributor in
connection with its distribution of the Program in a commercial product
offering. The obligations in this section do not apply to any claims or Losses
relating to any actual or alleged intellectual property infringement. In order
to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
Contributor in writing of such claim, and b) allow the Commercial Contributor
to control, and cooperate with the Commercial Contributor in, the defense and
any related settlement negotiations. The Indemnified Contributor may participate
in any such claim at its own expense.</span> </p>
<p><span style='font-size:10.0pt'>For example, a Contributor might include the
Program in a commercial product offering, Product X. That Contributor is then a
Commercial Contributor. If that Commercial Contributor then makes performance
claims, or offers warranties related to Product X, those performance claims and
warranties are such Commercial Contributor's responsibility alone. Under this
section, the Commercial Contributor would have to defend claims against the
other Contributors related to those performance claims and warranties, and if a
court requires any other Contributor to pay any damages as a result, the
Commercial Contributor must pay those damages.</span> </p>
<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
responsible for determining the appropriateness of using and distributing the
Program and assumes all risks associated with its exercise of rights under this
Agreement , including but not limited to the risks and costs of program errors,
compliance with applicable laws, damage to or loss of data, programs or
equipment, and unavailability or interruption of operations. </span></p>
<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
or unenforceable under applicable law, it shall not affect the validity or
enforceability of the remainder of the terms of this Agreement, and without
further action by the parties hereto, such provision shall be reformed to the
minimum extent necessary to make such provision valid and enforceable.</span> </p>
<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
against any entity (including a cross-claim or counterclaim in a lawsuit)
alleging that the Program itself (excluding combinations of the Program with
other software or hardware) infringes such Recipient's patent(s), then such
Recipient's rights granted under Section 2(b) shall terminate as of the date
such litigation is filed. </span></p>
<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
shall terminate if it fails to comply with any of the material terms or
conditions of this Agreement and does not cure such failure in a reasonable
period of time after becoming aware of such noncompliance. If all Recipient's
rights under this Agreement terminate, Recipient agrees to cease use and
distribution of the Program as soon as reasonably practicable. However,
Recipient's obligations under this Agreement and any licenses granted by
Recipient relating to the Program shall continue and survive. </span></p>
<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
copies of this Agreement, but in order to avoid inconsistency the Agreement is
copyrighted and may only be modified in the following manner. The Agreement
Steward reserves the right to publish new versions (including revisions) of
this Agreement from time to time. No one other than the Agreement Steward has
the right to modify this Agreement. The Eclipse Foundation is the initial
Agreement Steward. The Eclipse Foundation may assign the responsibility to
serve as the Agreement Steward to a suitable separate entity. Each new version
of the Agreement will be given a distinguishing version number. The Program
(including Contributions) may always be distributed subject to the version of
the Agreement under which it was received. In addition, after a new version of
the Agreement is published, Contributor may elect to distribute the Program
(including its Contributions) under the new version. Except as expressly stated
in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
the intellectual property of any Contributor under this Agreement, whether
expressly, by implication, estoppel or otherwise. All rights in the Program not
expressly granted under this Agreement are reserved.</span> </p>
<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
State of New York and the intellectual property laws of the United States of
America. No party to this Agreement will bring a legal action under this
Agreement more than one year after the cause of action arose. Each party waives
its rights to a jury trial in any resulting litigation.</span> </p>
<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
</div>
</body>
</html>

View File

@ -1,2 +0,0 @@
#!/bin/bash
exec /opt/xcat/share/xcat/cons/hmc $CONFLUENT_NODE

View File

@ -1,2 +0,0 @@
#!/bin/bash
exec /opt/xcat/share/xcat/cons/kvm $CONFLUENT_NODE

View File

@ -1,5 +0,0 @@
xcat-confluent (2.10-snap20150325) unstable; urgency=low
* Initial release
-- root <root@hostname> Wed, 25 Mar 2015 13:41:35 -0400

View File

@ -1 +0,0 @@
9

View File

@ -1,11 +0,0 @@
Source: xcat-confluent
Section: admin
Priority: extra
Maintainer: xCAT <xcat-user@lists.sourceforge.net>
Build-Depends: debhelper (>= 8.0.0)
Standards-Version: 3.9.2
Package: xcat-confluent
Architecture: all
Depends: xcat-client
Description: xCAT integration with confluent systems management server

View File

@ -1 +0,0 @@
/opt/confluent/

View File

@ -1,30 +0,0 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
build:
clean:
dh_testdir
dh_testroot
dh_clean -d
install:
dh_installdirs
cp -r confluent/* debian/xcat-confluent/opt/confluent
binary-indep: build install
binary-arch:
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

View File

@ -1,58 +0,0 @@
Summary: xCAT integration with confluent systems management server
Name: xCAT-confluent
Version: %(cat Version)
Release: snap%(date +"%Y%m%d%H%M")
Epoch: 4
License: EPL
Group: Applications/System
Source: xCAT-confluent-%(cat Version).tar.gz
Packager: IBM Corp.
Vendor: IBM Corp.
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
Prefix: /opt/xcat
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
%ifos linux
BuildArch: noarch
%endif
Requires: confluent_server
Provides: xCAT-confluent = %{epoch}:%{version}
%description
xCAT confluent provides the necessary integration pieces to utilize the confluent
system management server
%prep
%setup -q -n xCAT-confluent
%build
# Convert pods to man pages and html pages
#./xpod2man
%install
rm -rf $RPM_BUILD_ROOT
# Uncomment the following line if we ship bin files
# mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
# cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin/
# chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
mkdir -p $RPM_BUILD_ROOT/opt/confluent
cp -dr confluent/* $RPM_BUILD_ROOT/opt/confluent/
#cp share/man/man1/* $RPM_BUILD_ROOT/%{prefix}/share/man/man1
#chmod 444 $RPM_BUILD_ROOT/%{prefix}/share/man/man1/*
#cp share/doc/man1/* $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
#chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/man1/*
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
# Uncomment the following line if we ship bin files
# %{prefix}
/opt/confluent
%post

View File

@ -1,213 +0,0 @@
#!/usr/bin/perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
# First builds the xCAT summary man page from Synopsis of each man page.
# Then converts all of the pod man pages into html (including links to each other)
# We assume that this script is run in the xCAT-vlan-2.0 dir, so everything is
# done relative to that.
use strict;
#use lib '.';
use Pod::Man;
use Pod::Html;
my $poddir = 'pods';
my $mandir = 'share/man';
my $htmldir = 'share/doc';
my $cachedir = '/tmp';
my @pods = getPodList($poddir);
#foreach (@pods) { print "$_\n"; } exit;
# Build the cmd overview page.
#writesummarypage("$poddir/man1/xcat.1.pod", @pods);
# Build the man page for each pod.
#mkdir($mandir) or die "Error: could not create $mandir.\n";
print "Converting PODs to man pages...\n";
foreach my $podfile (@pods) {
my $manfile = $podfile;
$manfile =~ s/^$poddir/$mandir/; # change the beginning of the path
$manfile =~ s/\.pod$//; # change the ending
my $mdir = $manfile;
$mdir =~ s|/[^/]*$||; # get rid of the basename part
if (system("mkdir -p $mdir")) { die "Error: could not create $mdir.\n"; }
my ($section) = $podfile =~ /\.(\d+)\.pod$/;
convertpod2man($podfile, $manfile, $section);
}
my @dummyPods = createDummyPods($poddir, \@pods);
# Build the html page for each pod.
#mkdir($htmldir) or die "Error: could not create $htmldir.\n";
print "Converting PODs to HTML pages...\n";
# have to clear the cache, because old entries can cause a problem
unlink("$cachedir/pod2htmd.tmp", "$cachedir/pod2htmi.tmp");
foreach my $podfile (@pods) {
my $htmlfile = $podfile;
$htmlfile =~ s/^$poddir/$htmldir/; # change the beginning of the path
$htmlfile =~ s/\.pod$/\.html/; # change the ending
my $hdir = $htmlfile;
$hdir =~ s|/[^/]*$||; # get rid of the basename part
if (system("mkdir -p $hdir")) { die "Error: could not create $hdir.\n"; }
#print "$podfile, $htmlfile, $poddir, $htmldir\n";
convertpod2html($podfile, $htmlfile, $poddir, $htmldir);
}
# Remove the dummy pods
unlink @dummyPods;
rmdir "$poddir/man7";
exit;
# To enable linking between the cmd man pages and the db man pages, need to:
# grep thru the cmd pods searching for references (L<>) to any section 5 man page
# if that pod does not exist, create an empty one that will satisfy pod2html
# keep track of all dummy pods created, so they can be removed later
sub createDummyPods {
my ($poddir, $pods) = @_;
my $cmd = "grep -r -E 'L<.+\\([57]\\)\\|.+\\.[57]>' " . $poddir;
#print "Running cmd: ", $cmd, "\n";
my @lines = `$cmd`;
if ($?) { print "Did not find any section 5 man page, creating dummy pods...\n"; print join('', @lines); }
#my @lines;
#system($cmd);
my @dummyPods;
foreach my $l (@lines) {
#print "$l\n";
my @matches = $l =~ /L<([^\(]+)\(([57])\)\|\1\.[57]>/g; # get all the matches in the line
# The above line should create the array with every other entry being the man page name
# and every other entry is the section # (5 or 7)
my $cmd;
while ($cmd=shift @matches) {
#foreach my $m (@matches) {
my $section = shift @matches;
my $filename = "$poddir/man$section/$cmd.$section.pod";
#print "$filename\n";
if (!(grep /^$filename$/, @$pods) && !(grep /^$filename$/, @dummyPods)) { push @dummyPods, $filename; }
}
}
# Create these empty files
print "Creating empty linked-to files: ", join(', ', @dummyPods), "\n";
mkdir "$poddir/man7";
foreach my $d (@dummyPods) {
if (!open(TMP, ">>$d")) { warn "Could not create dummy pod file $d ($!)\n"; }
else { close TMP; }
}
return @dummyPods;
}
# Recursively get the list of pod man page files.
sub getPodList {
my $poddir = shift;
my @files;
# 1st get toplevel dir listing
opendir(DIR, $poddir) or die "Error: could not read $poddir.\n";
my @topdir = grep !/^\./, readdir(DIR); # /
close(DIR);
# Now go thru each subdir (these are man1, man3, etc.)
foreach my $mandir (@topdir) {
opendir(DIR, "$poddir/$mandir") or die "Error: could not read $poddir/$mandir.\n";
my @dir = grep !/^\./, readdir(DIR); # /
close(DIR);
foreach my $file (@dir) {
push @files, "$poddir/$mandir/$file";
}
}
return sort @files;
}
# Create the xcat man page that gives a summary description of each xcat cmd.
sub writesummarypage {
my $file = shift; # relative path file name of the man page
# the rest of @_ contains the pod files that describe each cmd
open(FILE, ">$file") or die "Error: could not open $file for writing.\n";
print FILE <<'EOS1';
=head1 NAME
B<xcat> - extreme Cluster Administration Tool.
=head1 DESCRIPTION
Extreme Cluster Administration Toolkit (xCAT). xCAT is a scalable distributed computing management
and provisioning tool that provides a unified interface for hardware control, discovery, and
OS diskful/diskfree deployment.
=head1 XCAT DATABASE
All of the cluster configuration information is in the xCAT database. See L<xcatdb(5)|xcatdb.5> for
descriptions of every table in the database.
=head1 XCAT COMMANDS
What follows is a short description of each xCAT command. To get more information about a particular
command, see its man page. Note that the commands are listed in alphabetical order B<within each section>,
i.e. all the commands in section 1, then the commands in section 3, etc.
=over 12
EOS1
# extract the summary for each cmd from its man page
foreach my $manpage (@_) {
my ($sectionnum) = $manpage =~ /\.(\d+)\.pod$/;
# Suck in the whole file, then we will parse it.
open(MANPAGE, "$manpage") or die "Error: could not open $manpage for reading.\n";
my @contents = <MANPAGE>;
my $wholemanpage = join('', @contents);
close(MANPAGE);
# This regex matches: optional space, =head1, space, title, space, cmd, space, description, newline
my ($cmd, $description) = $wholemanpage =~ /^\s*=head1\s+\S+\s+(\S+)\s+(.+?)\n/si;
if (!defined($cmd)) { print "Warning: $manpage is not in a recognized structure. It will be ignored.\n"; next; }
if (!defined($description)) { print "Warning: $manpage does not have a description for $cmd. It will be ignored.\n"; next; }
$cmd =~ s/^.<(.+)>$/$1/; # if the cmd name has pod formatting around it, strip it off
$description =~ s/^-\s*//; # if the description has a leading hypen, strip it off
print FILE "\n=item L<$cmd($sectionnum)|$cmd.$sectionnum>\n\n".$description."\n";
}
# Artificially add the xcattest cmd, because the xCAT-test rpm will add this
print FILE "\n=item L<xcattest(1)|xcattest.1>\n\nRun automated xCAT test cases.\n";
print FILE <<"EOS3";
=back
EOS3
close FILE;
}
# Create the html page for one pod.
sub convertpod2html {
my ($podfile, $htmlfile, $poddir, $htmldir) = @_;
#TODO: use --css=<stylesheet> and --title=<pagetitle> to make the pages look better
pod2html($podfile,
"--outfile=$htmlfile",
"--podpath=man1",
"--podroot=$poddir",
"--htmldir=$htmldir",
"--recurse",
"--cachedir=$cachedir",
);
}
# Create the man page for one pod.
sub convertpod2man {
my ($podfile, $manfile, $section) = @_;
my $parser = Pod::Man->new(section => $section);
$parser->parse_from_file($podfile, $manfile);
}

View File

@ -8,7 +8,6 @@ HOSTOS="$1"
DIR=`dirname $0`
#DIR=`realpath $DIR`
DIR=`readlink -f $DIR`
BUILDARCH=`uname -m`
# get the input files for dracut in the right place
# Fedora 20 ppc64 uses /usr/lib/dracut/modules.d
@ -22,64 +21,9 @@ fi
mkdir -p $DRACUTMODDIR
cp $DIR/* $DRACUTMODDIR
if [ "$HOSTOS" = "mcp" ]; then
#Special handlings for MCP PPC64 platform building.
if [ $BUILDARCH = "ppc64" ]; then
sed -i 's/dracut_install efibootmgr//' $DRACUTMODDIR/install
sed -i 's/dracut_install dmidecode \/usr\/lib64\/libstdc++.so.5//' $DRACUTMODDIR/install
sed -i 's/dmidecode//' $DRACUTMODDIR/install
sed -i 's/\/lib\/ld-linux.so.2/\/usr\/lib64\/ld-2.17.so/' $DRACUTMODDIR/install
else
sed -i 's/\/lib\/ld-linux.so.2/\/usr\/lib64\/ld-linux-x86-64.so.2/' $DRACUTMODDIR/install
fi
sed -i 's/mkfs.btrfs//' $DRACUTMODDIR/install
sed -i 's/\/etc\/redhat-release/\/etc\/base-release \/etc\/system-release/' $DRACUTMODDIR/install
sed -i 's/btrfs//' $DRACUTMODDIR/installkernel
sed -i 's/\/usr\/bin\/basename/\/bin\/basename/' $DRACUTMODDIR/install
sed -i 's/\/lib64\/libnss_dns-2.12.so/\/usr\/lib64\/libnss_dns-2.17.so/' $DRACUTMODDIR/install
sed -i 's/\/lib64\/libnss_dns.so.2/\/usr\/lib64\/libnss_dns.so.2/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libc.so.6/\/usr\/lib64\/libc.so.6/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libdl.so.2/\/usr\/lib64\/libdl.so.2/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libm.so.6/\/usr\/lib64\/libm.so.6/' $DRACUTMODDIR/install
sed -i 's/\/usr\/lib\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.19/' $DRACUTMODDIR/install
sed -i 's/\/usr\/lib64\/libstdc++.so.5//' $DRACUTMODDIR/install
sed -i 's/\/lib\/libpthread.so.0/\/usr\/lib64\/libpthread.so.0/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libncurses.so.5.7/\/usr\/lib64\/libncurses.so.5.9/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libgcc_s.so.1/\/usr\/lib64\/libgcc_s.so.1/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libtinfo.so.5.7/\/usr\/lib64\/libtinfo.so.5.9/' $DRACUTMODDIR/install
sed -i 's/\/usr\/lib64\/libsasl2.so.2/\/usr\/lib64\/libsasl2.so.3/' $DRACUTMODDIR/install
sed -i 's/\/lib\/terminfo\/l\/linux/\/usr\/share\/terminfo\/l\/linux/g' $DRACUTMODDIR/install
sed -i 's/\/lib\/terminfo\/v\/vt100/\/usr\/share\/terminfo\/v\/vt100/g' $DRACUTMODDIR/install
# these are needed for sysclone, but are not yet in mcp
sed -i 's/ bc//' $DRACUTMODDIR/install
sed -i 's/ mkdosfs//' $DRACUTMODDIR/install
sed -i 's/ rsync//' $DRACUTMODDIR/install
sed -i 's/ kexec//' $DRACUTMODDIR/install
sed -i 's/ klogd//' $DRACUTMODDIR/install
sed -i 's/ mdadm//' $DRACUTMODDIR/install
sed -i 's/ mkfs\.xfs//' $DRACUTMODDIR/install
sed -i 's/ xfs_db//' $DRACUTMODDIR/install
sed -i 's/ mkreiserfs//' $DRACUTMODDIR/install
sed -i 's/ reiserfstune//' $DRACUTMODDIR/install
sed -i 's/ vconfig//' $DRACUTMODDIR/install
sed -i 's/ killall//' $DRACUTMODDIR/install
# These timezone files are not available in the latest mcp build
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh87//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh88//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh89//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh87//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh88//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh89//' $DRACUTMODDIR/install
# For ppc64 platform, needs to remove some files,
# # and some files are in different directories
elif [ $BUILDARCH = "ppc64" ]; then
# and some files are in different directories
if [ `uname -m` = "ppc64" ]; then
sed -i 's/dracut_install efibootmgr//' $DRACUTMODDIR/install
sed -i 's/ dmidecode//' $DRACUTMODDIR/install
sed -i 's/\/lib\/libncurses.so.5.7/\/lib64\/libncurses.so.5.7/' $DRACUTMODDIR/install
@ -102,11 +46,38 @@ elif [ $BUILDARCH = "ppc64" ]; then
sed -i 's/\/lib\/terminfo\/v\/vt100/\/usr\/share\/terminfo\/v\/vt100/g' $DRACUTMODDIR/install
fi
mkdir -p /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs
if [ "$HOSTOS" = "mcp" ]; then
sed -i 's/mkfs.btrfs//' $DRACUTMODDIR/install
sed -i 's/\/etc\/redhat-release/\/etc\/base-release \/etc\/system-release/' $DRACUTMODDIR/install
sed -i 's/btrfs//' $DRACUTMODDIR/installkernel
sed -i 's/\/usr\/bin\/basename/\/bin\/basename/' $DRACUTMODDIR/install
# these are needed for sysclone, but are not yet in mcp
sed -i 's/ bc//' $DRACUTMODDIR/install
sed -i 's/ mkdosfs//' $DRACUTMODDIR/install
sed -i 's/ rsync//' $DRACUTMODDIR/install
sed -i 's/ kexec//' $DRACUTMODDIR/install
sed -i 's/ klogd//' $DRACUTMODDIR/install
sed -i 's/ mdadm//' $DRACUTMODDIR/install
sed -i 's/ mkfs\.xfs//' $DRACUTMODDIR/install
sed -i 's/ xfs_db//' $DRACUTMODDIR/install
sed -i 's/ mkreiserfs//' $DRACUTMODDIR/install
sed -i 's/ reiserfstune//' $DRACUTMODDIR/install
# These timezone files are not available in the latest mcp build
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh87//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh88//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh89//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh87//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh88//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh89//' $DRACUTMODDIR/install
fi
mkdir -p /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs
# run dracut
if [ "$HOSTOS" = "mcp" ]; then
KPATH=`/bin/ls -d /lib/modules/*`
KPATH=`/bin/ls -d /lib/modules/*.x86_64`
KERNELVERSION=`basename $KPATH`
echo Creating the initramfs in /tmp/xcatgenesis.$$.rfs using dracut and kernel $KERNELVERSION ...
else
@ -114,31 +85,31 @@ else
fi
# On Fedora 20 ppc64, dracut uses host-only mode by default
if [ $BUILDARCH = "ppc64" ]; then
if [ `uname -m` = "ppc64" ]; then
dracut -m "xcat base" -N -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION
else
dracut -m "xcat base" -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION
fi
echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs ...
cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs
echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs ...
cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs
zcat /tmp/xcatgenesis.$$.rfs|cpio -dumi
# add the kernel
if [ "$HOSTOS" = "mcp" ]; then
echo Adding kernel /boot/vmlinuz-* ...
cp /boot/vmlinuz-* /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/kernel
cp /boot/vmlinuz-*.x86_64 /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/kernel
else
echo Adding kernel /boot/vmlinuz-$BUILDARCH ...
cp /boot/vmlinuz-`uname -r` /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/kernel
echo Adding kernel /boot/vmlinuz-`uname -r` ...
cp /boot/vmlinuz-`uname -r` /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/kernel
fi
cd -
# create tar file
echo Tarring /tmp/xcatgenesis.$$/opt into ~/rpmbuild/SOURCES/xCAT-genesis-base-$BUILDARCH.tar.bz2 ...
echo Tarring /tmp/xcatgenesis.$$/opt into ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 ...
cd /tmp/xcatgenesis.$$
tar jcf ~/rpmbuild/SOURCES/xCAT-genesis-base-$BUILDARCH.tar.bz2 opt
tar jcf ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 opt
# build the rpm
echo Building xCAT-genesis-base rpm from ~/rpmbuild/SOURCES/xCAT-genesis-base-$BUILDARCH.tar.bz2 and $DIR/xCAT-genesis-base.spec ...
echo Building xCAT-genesis-base rpm from ~/rpmbuild/SOURCES/xCAT-genesis-base-`uname -m`.tar.bz2 and $DIR/xCAT-genesis-base.spec ...
rpmbuild -ba $DIR/xCAT-genesis-base.spec
rm -rf $DRACUTMODDIR

View File

@ -11,7 +11,7 @@ dracut_install mkswap df brctl vconfig ifenslave ssh-keygen scp clear dhclient l
dracut_install lldptool /lib64/libnss_dns-2.12.so /lib64/libnss_dns.so.2
dracut_install poweroff ntpq ntpd hwclock date /usr/share/terminfo/x/xterm /usr/share/terminfo/s/screen /etc/nsswitch.conf /etc/services
dracut_install /sbin/rsyslogd /etc/protocols umount /bin/rpm /usr/lib/rpm/rpmrc
dracut_install chmod /lib/libc.so.6 /lib/ld-linux.so.2 /lib/libdl.so.2 /lib/libm.so.6 /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
dracut_install chmod /lib/libc.so.6 /lib/ld-linux.so.2 /lib/libdl.so.2 /lib/libm.so.6 /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail /usr/bin/basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements
dracut_install dmidecode /usr/lib64/libstdc++.so.6 #uxspi prereqs, but will use dmidecode to improve decision on loading ipmi_si
dracut_install dmidecode /usr/lib64/libstdc++.so.5 #broadcom firmware update links against old lib
dracut_install /lib/libpthread.so.0 #32 bit lib because UXSPI will not ship a native 64 bit build

View File

@ -1,6 +1,6 @@
#!/bin/bash
instmods nfs sunrpc
instmods e1000 e1000e virtio_net virtio_pci igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf qlcnic xfs
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf qlcnic xfs
instmods macvlan macvtap 8021q bridge bonding vmxnet3 cpufreq_ondemand acpi-cpufreq powernow-k8 cdc_ether
instmods mptctl #LSI firmware management requires this
instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys
@ -9,4 +9,3 @@ instmods ibmveth # ppc64 virtual ethernet
instmods ibmvscsi # ppc64 virtual disk
instmods ehea # ppc64 hea ethernet
instmods dm-mod #support LVM for sysclone
instmods sg # Lenovo thinkserver firmware update support

View File

@ -7,7 +7,6 @@ echo PS1="'"'[xCAT Genesis running on \H \w]\$ '"'" > /.bash_profile
mkdir -p /etc/ssh
mkdir -p /var/tmp/
mkdir -p /var/empty/sshd
sed -i '/^root:x/d' /etc/passwd
echo root:x:0:0::/:/bin/bash >> /etc/passwd
echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd
echo rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin >> /etc/passwd

View File

@ -117,7 +117,6 @@ mask2prefix() {
}
# see if they specified static ip info, otherwise use dhcp
XCATPORT=3001
for parm in `cat /proc/cmdline`; do
key=`echo $parm|awk -F= '{print $1}'`
value=`echo $parm|awk -F= '{print $2}'`
@ -127,14 +126,8 @@ for parm in `cat /proc/cmdline`; do
netmask=$value
elif [[ ${key,,} == "gateway" ]]; then
gateway=$value
elif [[ ${key,,} == "xcatd" ]]; then
XCATMASTER=`echo $value |awk -F: '{print $1}'`
XCATPORT=`echo $value |awk -F: '{print $2}'`
fi
done
export XCATPORT
export XCATMASTER
if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then
# doing static ip
# the device was determined above from the bootif mac, and put in bootnic
@ -152,68 +145,54 @@ if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then
sleep 3
else
echo "Setting IP via DHCP..."
# This section is for System P hardware discovery, which won't have a BOOTIF value set
if [ -z "$bootnic" ]; then
tries=0
while [ $tries -lt 100 ]; do
ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo | sort -n -r`
for tmp1 in $ALLUP_NICS; do
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$tmp1.pid $tmp1 &
dhclient -6 -pf /var/run/dhclient6.$tmp1.pid $tmp1 -lf /var/lib/dhclient/dhclient6.leases &
#bootnic=$tmp1
#break
done
if [ ! -z "$ALLUP_NICS" ]; then
break
fi
sleep 2
tries=$(($tries+1))
done
echo -n "Acquiring network addresses.."
while [ -z "$bootnic" ]; do
for tmp1 in $ALLUP_NICS; do
if ip addr show dev $tmp1|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; then
result=`ping -c1 -I $tmp1 $XCATMASTER 2>&1`
if [ $? -eq 0 ]; then
bootnic=$tmp1
break
fi
fi
done
sleep 2
done
# This section is for System P hardware discovery, which won't have a BOOTIF value set
tries=0
while [ $tries -lt 5 ]; do
if [ -z "$bootnic" ]; then
/bin/bash
ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo`
for tmp1 in $ALLUP_NICS; do
bootnic=$tmp1
break
done
else
break
fi
else
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic &
#we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce
#chances that we'll perform a partial discovery
#in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up
dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases &
NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'`
export NICSTOBRINGUP
for nic in $NICSTOBRINGUP; do
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) &
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) &
done
gripeiter=101
echo -n "Acquiring network addresses.."
while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; do
sleep 0.1
if [ $gripeiter = 1 ]; then
echo
echo "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..."
fi
gripeiter=$((gripeiter-1))
sleep 2
tries=$(($tries+1))
done
if [ -z "$bootnic" ]; then
ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo`
for tmp in $ALL_NICS; do
bootnic=$tmp
break
done
fi
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic &
#we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce
#chances that we'll perform a partial discovery
#in other scenarios where downed non-bootnics cause issues, will rely on retries to fix things up
dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/dhclient6.leases &
NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'`
export NICSTOBRINGUP
for nic in $NICSTOBRINGUP; do
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) &
(while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) &
done
fi
openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 &
gripeiter=101
echo -n "Acquiring network addresses.."
while ! ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet > /dev/null; do
sleep 0.1
if [ $gripeiter = 1 ]; then
echo
echo "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..."
fi
gripeiter=$((gripeiter-1))
done
echo -n "Acquired IPv4 address on $bootnic: "
ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}'
ntpd -g -x
@ -235,7 +214,16 @@ if [ -f "/usr/sbin/dmidecode" ]; then
fi
DEVICE=$bootnic
export DEVICE
XCATPORT=3001
export XCATPORT
for parm in `cat /proc/cmdline`; do
key=`echo $parm|awk -F= '{print $1}'`
if [ "$key" = "xcatd" ]; then
XCATMASTER=`echo $parm|awk -F= '{print $2}'|awk -F: '{print $1}'`
XCATPORT=`echo $parm|awk -F= '{print $2}'|awk -F: '{print $2}'`
fi
done
export XCATMASTER
if [ "$destiny" != "discover" ]; then #we aren't discoverying, we probably can and should get a cert
/bin/getcert $XCATMASTER:$XCATPORT
fi

0
xCAT-nbroot/debian/rules Executable file → Normal file
View File

View File

@ -3,5 +3,4 @@ instmods nfs sunrpc
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb qlge mptsas mpt2sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf
instmods macvlan macvtap 8021q bridge bonding vmxnet3 acpi-cpufreq powernow-k8 cdc_ether
instmods mptctl #LSI firmware management requires this
instmods sg # Lenovo Thinkserver firmware management uses sg interface
instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys

View File

@ -3,9 +3,9 @@
$RES::Condition{'CheckFTPonSN_AIX'} = {
Name => q(CheckFTPonSN_AIX),
ResourceClass => q(IBM.Sensor),
EventExpression => q(String ne "ftpd is active"),
EventExpression => q(String != "ftpd is active"),
EventDescription => q(For AIX only. An event will be generated when the FTP server is down on the service node. There may be other nodes in this management domain such as HMCs. To exclude them, just change the SelectionString to: "ProgramName=='vsftpd' && NodeNameList >< {'hmc1','hmc2}" where hmc1 and hmc2 are the names for the nodes that you want to exclude.),
RearmExpression => q(String eq "ftpd is active"),
RearmExpression => q(String == "ftpd is active"),
RearmDescription => q(A rearm event will be generated when the FTP server is up on the service node.),
SelectionString => q(Name="CheckFTPSensor_AIX"),
ManagementScope => q(4),

View File

@ -3,9 +3,9 @@
$RES::Condition{'CheckxCATonSN'} = {
Name => q(CheckxCATonSN),
ResourceClass => q(IBM.Sensor),
EventExpression => q(String ne "xcatd is ok"),
EventExpression => q(String != "xcatd is ok"),
EventDescription => q(An event will be generated when xcatd is not working.),
RearmExpression => q(String eq "xcatd is ok"),
RearmExpression => q(String == "xcatd is ok"),
RearmDescription => q(An rearm event will be generated when xcatd resumes working state.),
SelectionString => q(Name="CheckxCATSensor"),
ManagementScope => q(4),

View File

@ -70,11 +70,6 @@ if ($hmtab) {
exit(1);
}
my $file = "/var/log/consoles/$node";
#use confluent if it is there
if ((-x "/opt/confluent/bin/confetty") || (-x "/usr/bin/confetty")) {
$file = "/var/log/confluent/consoles/$node";
}
#print "file=$file\n";
#if has conserver, goto conserver the execute replaycons command
my @hostinfo=xCAT::NetworkUtils->determinehostname();

View File

@ -34,6 +34,5 @@ opt/xcat/xdsh/Context
opt/xcat/ws
etc/init.d
etc/xcat
etc/apache2/conf-enabled
etc/apache2/conf-available
etc/apache2/conf.d
opt/xcat/share/doc/packages/xCAT-server

View File

@ -30,7 +30,7 @@ case "$1" in
update-rc.d xcatd disable
rm -f /usr/sbin/xcatd #remove the symbolic
rm -f /etc/apache2/conf-enabled/xcat-ws.conf
rm -f /etc/apache2/conf.d/xcat-ws.conf
;;
*)

5
xCAT-server/debian/rules Executable file → Normal file
View File

@ -66,10 +66,9 @@ binary-arch:
chmod 644 $(rootdir)/lib/perl/xCAT_schema/samples/*
chmod 644 $(rootdir)/lib/shfunctions
chmod 644 $(rootdir)/share/doc/packages/xCAT-server/*
echo "ScriptAlias /xcatws $(prefix)/ws/xcatws.cgi" > $(buildroot)/etc/apache2/conf-available/xcat-ws.conf
cat $(PWD)/xCAT-wsapi/xcat-ws.conf.ubuntu >> $(buildroot)/etc/apache2/conf-available/xcat-ws.conf
echo "ScriptAlias /xcatws $(prefix)/ws/xcatws.cgi" > $(buildroot)/etc/apache2/conf.d/xcat-ws.conf
cat $(PWD)/xCAT-wsapi/xcat-ws.conf.ubuntu >> $(buildroot)/etc/apache2/conf.d/xcat-ws.conf
rm -rf $(rootdir)/ws/xcat-ws.conf*
ln -s ../conf-available/xcat-ws.conf $(buildroot)/etc/apache2/conf-enabled/xcat-ws.conf
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate

View File

@ -2152,7 +2152,7 @@ sub findme {
my @nodes = ();
my $pbmc_node;
foreach (@$tmp_nodes) {
if ($::XCATMPHASH{$_}) {
if ($::XCATPPCHASH{$_}) {
$pbmc_node = $_;
} else {
push @nodes, $_;

View File

@ -518,13 +518,6 @@ sub makescript {
## kit and kitcomponent parameter.
my $kitcomp_deployparams = getKitcompDeployParams($osimgname,\%image_hash);
# get mac address for the node
my $macaddress;
if( defined( $::GLOBAL_TAB_HASH{mac}) && defined( $::GLOBAL_TAB_HASH{mac}{$node}) ) {
my $macmac = $::GLOBAL_TAB_HASH{mac}{$node}{mac};
$macaddress = xCAT::Utils->parseMacTabEntry($macmac, $node);
}
#ok, now do everything else..
#$inc =~ s/#XCATVAR:([^#]+)#/envvar($1)/eg;
#$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
@ -552,8 +545,6 @@ sub makescript {
#$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
$inc =~ s/\$NTYPE/$nodetype/eg;
$inc =~ s/\$MACADDRESS/$macaddress/eg;
# This line only is used to compatible with the old code
$inc =~ s/#Subroutine:([^:]+)::([^:]+)::([^:]+):([^#]+)#/runsubroutine($1,$2,$3,$4)/eg;
@ -1204,27 +1195,14 @@ sub getImageitems_for_node
}
#Adds SDK repositoryi for sles. The SDKDIR is a comma separated list of
#directory names. For example:
#SDKDIR='/install/sles12/x86_64/sdk1,/install/sles12/x86_64/sdk2'
# SLES sdk
if ($os =~ /sles.*/)
{
my @sdkdir=();
my $installdir = $::XCATSITEVALS{'installdir'} ? $::XCATSITEVALS{'installdir'} : "/install";
if (opendir(SRCDIR, "$installdir/$os/$arch/")) {
while (my $tmpfile = readdir(SRCDIR)) {
if ($tmpfile =~ m/^sdk/) {
my $srcdir_sdk = "$installdir/$os/$arch/${tmpfile}";
if ( -d "$srcdir_sdk") {
push @sdkdir, $srcdir_sdk;
}
}
}
}
if (@sdkdir > 0)
my $sdkdir = "$installdir/$os/$arch/sdk1";
if (-e "$sdkdir")
{
$result .= "SDKDIR='" . join(',', @sdkdir) . "'\n";
$result .= "SDKDIR='" . $sdkdir . "'\n";
$result .= "export SDKDIR\n";
}
}

View File

@ -104,7 +104,7 @@ sub subvars {
$ENV{NODESTATUS}=$tmp;
}
$ENV{PERSKCMDLINE}=getPersistentKcmdline($node);
#replace the env with the right value so that correct include files can be found
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
@ -136,7 +136,7 @@ sub subvars {
# append preseed directive lines
while (<PKGLISTFILE>) {
chomp $_;
if ((/^\s*#.*/ ) || ( $_ =~ /^-/ )){
if (/^\s*#.*/ ){
next;
}
$pkglist .= " " . $_;
@ -248,9 +248,7 @@ sub subvars {
$inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
$inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
$inc =~ s/#MIRRORSPEC#/mirrorspec()/eg;
$inc =~ s/#YAST2NET#/yast2network()/eg;
$inc =~ s/#KICKSTARTBOOTLOADER#/kickstartbootloader()/eg;
$inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
$inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
$inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
@ -274,7 +272,7 @@ sub subvars {
if ($partitionfile && $doneincludes) {
#the content of the specified file is a script which can write partition definition into /tmp/partitionfile
# split the partition file out from the $inc
($inc, $partcontent) = split(/FFFFFFFFFFFFPARTITIONFILESTART\n/, $inc);
($inc, $partcontent) = split(/FFFFFFFFFFFFPARTITIONFILESTART/, $inc);
if ($scriptflag){
# since the whole partition file needs be packaged in %pre first and generate an executable file at running time,
# all the special chars like ',",%,\ need be kept, we have to use the base64 coding to code it and put it in
@ -663,66 +661,6 @@ sub get_node_domain {
}
#get persistent command options from node and osimage definition
sub getPersistentKcmdline {
my $lcnode=shift;
if ( $lcnode eq 'THISNODE' ){
$lcnode=$node;
}
my @nodes=($lcnode);
my $bptab=xCAT::Table->new('bootparams',-create=>1);
my $bphash = $bptab->getNodesAttribs(\@nodes,['addkcmdline']);
my $typetab=xCAT::Table->new('nodetype',-create=>1);
my $typehash=$typetab->getNodesAttribs(\@nodes,['provmethod']);
my $linuximgtab=xCAT::Table->new('linuximage',-create=>1);
my $ent = $typehash->{$lcnode}->[0];
my $osimgname = $ent->{'provmethod'};
my $linuximghash = $linuximgtab->getAttribs({imagename => $osimgname}, 'boottarget', 'addkcmdline');
my $kern = $bphash->{$lcnode}->[0];
my $addkcmdline;
if ($kern->{addkcmdline}) {
$addkcmdline .= $kern->{addkcmdline}." ";
}
if($linuximghash and $linuximghash->{'addkcmdline'})
{
unless($linuximghash->{'boottarget'})
{
$addkcmdline .= $linuximghash->{'addkcmdline'}." ";
}
}
my $cmdhashref;
if($addkcmdline){
$cmdhashref=xCAT::Utils->splitkcmdline($addkcmdline);
}
my $ret="";
if($cmdhashref and $cmdhashref->{persistent})
{
$ret=$cmdhashref->{persistent};
}
return $ret;
}
sub kickstartbootloader {
my $line="bootloader";
if($ENV{PERSKCMDLINE}){
$line.=" --append=\"".$ENV{PERSKCMDLINE}."\"";
}
return $line;
}
sub esxipv6setup {
if (not $::XCATSITEVALS{managedaddressmode} or $::XCATSITEVALS{managedaddressmode} =~ /v4/) { return ""; } # blank line for ipv4 schemes
my $v6addr;
@ -803,68 +741,6 @@ sub kickstartnetwork {
return $line;
}
sub mirrorspec{
my $line;
my $ostab = xCAT::Table->new('nodetype');
my %oents = %{$ostab->getNodesAttribs([$node],[qw(os arch profile provmethod)])};
my $ent = $oents{$node}->[0];
my $imagename;
if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) {
$imagename=$ent->{provmethod};
}
unless($imagename){
$tmplerr ="cannot determine the osimage for $node";
return;
}
my $pkgdirval;
my $linuximagetab=xCAT::Table->new('linuximage', -create=>1);
my $ref = $linuximagetab->getAttribs({imagename => $imagename}, 'pkgdir');
if (($ref) && ($ref->{'pkgdir'})) {
$pkgdirval=$ref->{'pkgdir'};
}
my $pkgdir;
my @mirrors;
my @pkgdirlist=split(/,/,$pkgdirval);
my $masternode = xCAT::TableUtils->get_site_Master();
foreach (@pkgdirlist){
if($_ =~ /^http|ssh/){
push @mirrors,$_;
}else{
# If multiple pkgdirs are provided, The first path in the value of osimage.pkgdir
if (!$pkgdir) {
$pkgdir=$_;
}else {
my $osuurl = "http://" . $masternode . $_ . " ./";
push @mirrors,$osuurl;
}
}
}
if($pkgdir){
$line .="
d-i mirror/country string manual\n
d-i mirror/protocol string http\n
d-i mirror/http/directory string $pkgdir\n
d-i mirror/http/proxy string\n";
}
if(scalar @mirrors){
my $index=0;
foreach(@mirrors){
$line .= "
d-i apt-setup/local$index/repository string deb $_\n
d-i apt-setup/local$index/comment string online mirror $index\n";
$index=$index+1;
}
}
return $line;
}
sub yast2network {
my $line;

View File

@ -116,10 +116,9 @@ sub process_request {
if ($command eq 'kitnodeadd' or $command eq 'kitnodeupdate' or $command eq 'kitnoderefresh') {
push @commandslist, ['makehosts', ''];
push @commandslist, ['makedns', ''];
# Remove 'makedhcp' command, nodeset will update dhcp lease file
#if ($macflag) {
# push @commandslist, ['makedhcp', ''];
#}
if ($macflag) {
push @commandslist, ['makedhcp', ''];
}
push @commandslist, ['makeknownhosts', ''];
if ($runconservercmd) {
push @commandslist, ['makeconservercf', ''];
@ -180,13 +179,13 @@ sub process_request {
$retref = "";
if(($current_cmd eq "nodeset") && $noupdate_flag)
{
$retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args, "--noupdateinitrd"]}, $request_command, -1, 1);
$retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args, "--noupdateinitrd"]}, $request_command, 0, 2);
}
else
{
$retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args]}, $request_command, -1, 1);
$retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args]}, $request_command, 0, 2);
}
log_cmd_return($current_cmd, $retref, $callback);
log_cmd_return($retref);
}
}
@ -212,37 +211,24 @@ sub setrsp_progress
=head3 log_cmd_return
Description: Log commands return ref into log files.
Args: $command - current command name
$return - command return ref.
Args: $return - command return ref.
=cut
#-------------------------------------------------------
sub log_cmd_return
{
my $command = shift;
my $res = shift;
my $callback = shift;
my $errmsg = undef;
if($::RUNCMD_RC) {
$errmsg = "Command '$command' failed, " . join(',', @$res);
}elsif ($command eq 'nodeset') { # Only check output for 'nodeset' command
foreach my $line (@$res) {
if (($line =~ /kernel cannot be found/) or ($line =~ /stop configuration/) or ($line =~ /failed to set up install resources/)) {
$errmsg = "Command '$command' failed, $line.";
last;
}
my $return = shift;
if ($return){
if ($return->{error}){
my $errarrayref = $return->{error};
xCAT::MsgUtils->message('S', "Command error message:".Dumper($errarrayref));
}
if ($return->{data}){
my $dataarrayref = $return->{data};
xCAT::MsgUtils->message('S', "Command output message:".Dumper($dataarrayref));
}
}
if($errmsg)
{
$callback->({
error=>[$errmsg],
errorcode=>[1]
});
}
}
}
1;

View File

@ -429,7 +429,7 @@ sub setupInstallloc
{
# update fstab
my $cmd = "grep \"$master:$installloc $installdir\" /etc/fstab ";
my $cmd = "grep $master:$installloc $installdir /etc/fstab ";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0)
{
@ -544,13 +544,9 @@ sub setup_DHCP
if (xCAT::Utils->isMN()) { # on the MN
#my @output = xCAT::Utils->runcmd("service dhcpd status", -1);
#if ($::RUNCMD_RC != 0) { # not running
my $dhcpservice = "dhcpd";
if (-e "/etc/init.d/isc-dhcp-server") { #Ubuntu
$dhcpservice = "isc-dhcp-server";
}
my $retcode= xCAT::Utils->checkservicestatus($dhcpservice);
my $retcode= xCAT::Utils->checkservicestatus("dhcpd");
if($retcode!=0){
$rc = xCAT::Utils->startservice($dhcpservice);
$rc = xCAT::Utils->startservice("dhcpd");
if ($rc != 0)
{
return 1;

View File

@ -547,7 +547,7 @@ sub processArgs
# --nics is the equivalent of -i nicips,nichostnamesuffixes...
if ($::opt_nics) {
$::opt_i="nicips,nichostnamesuffixes,nichostnameprefixes,nictypes,niccustomscripts,nicnetworks,nicaliases,nicextraparams";
$::opt_i="nicips,nichostnamesuffixes,nichostnameprefixes,nictypes,niccustomscripts,nicnetworks,nicaliases";
}
# -i and -s cannot be used together

294
xCAT-server/lib/xcat/plugins/anaconda.pm Executable file → Normal file
View File

@ -745,33 +745,82 @@ sub mknetboot
$kcmdline .= " nonodestatus ";
}
# Add kernel parameters to specify the boot network interface
my $installnic;
my $primarynic;
my $mac;
if (defined ($reshash->{$node}->[0]) && $reshash->{$node}->[0]->{installnic}) {
$installnic = $reshash->{$node}->[0]->{installnic};
}
if (defined ($reshash->{$node}->[0]) and $reshash->{$node}->[0]->{primarynic}) {
$primarynic = $reshash->{$node}->[0]->{primarynic};
}
if (defined ($machash->{$node}->[0]) && $machash->{$node}->[0]->{'mac'}) {
$mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{'mac'}, $node);
}
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($installnic, $primarynic, $mac, $nodebootif);
if (defined ($net_params->{ifname}) || defined ($net_params->{netdev})) {
if (defined ($net_params->{ifname})) {
$kcmdline .= "$net_params->{ifname} ";
}
if ( defined ($net_params->{netdev})) {
$kcmdline .= "$net_params->{netdev} ";
}
} elsif (defined ($net_params->{BOOTIF}) && ($net_params->{setmac} || $arch=~ /ppc/)) {
$kcmdline .= "$net_params->{BOOTIF} ";
# add one parameter: ifname=<eth0>:<mac address>
# which is used for dracut
# the redhat5.x os will ignore it
my $useifname=0;
#for rhels5.x-ppc64, if installnic="mac", BOOTIF=<mac> should be appended
my $usemac=0;
my $nicname="";
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
$useifname=1;
#$kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":";
$nicname=$reshash->{$node}->[0]->{installnic};
} elsif ($nodebootif) {
$useifname=1;
#$kcmdline .= "ifname=$nodebootif:";
$nicname=$nodebootif;
} elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
$useifname=1;
#$kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":";
$nicname=$reshash->{$node}->[0]->{primarynic};
}else{
if($arch=~ /ppc/)
{
$usemac=1;
}
}
#else { #no, we autodetect and don't presume anything
# $kcmdline .="eth0:";
# print "eth0 is used as the default booting network devices...\n";
#}
# append the mac address
my $mac;
if( ($usemac || $useifname) && $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) {
# TODO: currently, only "mac" attribute with classic style is used, the "|" delimited string of "macaddress!hostname" format is not used
$mac = $machash->{$node}->[0]->{'mac'};
# if ( (index($mac, "|") eq -1) and (index($mac, "!") eq -1) ) {
#convert to linux format
if ($mac !~ /:/) {
$mac =~s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
}
$mac =~ s/!.*//; #remove multi-interface mac information
$mac =~ s/\|.*//;
# } else {
# $callback->({ error=>[ qq{In the "mac" table, the "|" delimited string of "macaddress!hostname" format is not supported by "nodeset <nr> netboot|statelite if installnic/primarynic is set".}], errorcode=>[1]});
# return;
# }
}
if( ($nicname ne "") and (not xCAT::NetworkUtils->isValidMAC($nicname) )){
if ($useifname && $mac) {
$kcmdline .= "ifname=$nicname:$mac ";
}
$kcmdline .= "netdev=$nicname ";
}else {
if($mac){
$kcmdline .= "BOOTIF=$mac ";
}
}
# add "netdev=<eth0>" or "BOOTIF=<mac>"
# which are used for other scenarios
#my $netdev = "";
#if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
# $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
#} elsif ($nodebootif) {
# $kcmdline .= "netdev=" . $nodebootif . " ";
#} elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
# $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
#} else {
# if ( ($usemac || $useifname) && $mac) {
# $kcmdline .= "BOOTIF=" . $mac . " ";
# }
#}
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
if ( $client_nethash{$node}{mgtifname} =~ /hf/ )
{
@ -949,13 +998,13 @@ sub mkinstall
my $restab = xCAT::Table->new('noderes');
my $bptab = xCAT::Table->new('bootparams',-create=>1);
my $hmtab = xCAT::Table->new('nodehm');
my $mactab = xCAT::Table->new('mac');
my %osents = %{$ostab->getNodesAttribs(\@nodes, ['profile', 'os', 'arch', 'provmethod'])};
my %rents = %{$restab->getNodesAttribs(\@nodes,
my %rents =
%{$restab->getNodesAttribs(\@nodes,
['xcatmaster', 'nfsserver', 'tftpdir', 'primarynic', 'installnic'])};
my %hents = %{$hmtab->getNodesAttribs(\@nodes,
my %hents =
%{$hmtab->getNodesAttribs(\@nodes,
['serialport', 'serialspeed', 'serialflow'])};
my %macents = %{$mactab->getNodesAttribs(\@nodes, ['mac'])};
#my $addkcmdhash =
# $bptab->getNodesAttribs(\@nodes, ['addkcmdline']);
require xCAT::Template;
@ -1339,8 +1388,15 @@ sub mkinstall
#We have a shot...
my $ent = $rents{$node}->[0];
# $restab->getNodeAttribs($node,
# ['nfsserver', 'primarynic', 'installnic']);
my $sent = $hents{$node}->[0];
my $macent = $macents{$node}->[0];
# $hmtab->getNodeAttribs(
# $node,
# [
# 'serialport', 'serialspeed', 'serialflow'
# ]
# );
my $instserver = $xcatmaster;
if ($ent and $ent->{nfsserver}) {
$instserver=$ent->{nfsserver};
@ -1352,15 +1408,15 @@ sub mkinstall
$instserver=$ip;
}
}
my $httpprefix=$pkgdir;
if ($installroot =~ /\/$/) {
$httpprefix =~ s/^$installroot/\/install\//;
} else {
$httpprefix =~ s/^$installroot/\/install/;
}
my $httpprefix=$pkgdir;
if ($installroot =~ /\/$/) {
$httpprefix =~ s/^$installroot/\/install\//;
} else {
$httpprefix =~ s/^$installroot/\/install/;
}
my $kcmdline;
my $kversion=$os;
$kversion =~ s/^\D*([\.0-9]+)/$1/;
$kversion =~ s/\.$//;
@ -1384,27 +1440,63 @@ sub mkinstall
if ($maxmem) {
$kcmdline.=" mem=$maxmem";
}
# Add kernel parameters to specify the boot network interface
if($esxi){
$ent->{installnic} =~ s/eth/vmnic/g;
$ent->{primarynic} =~ s/eth/vmnic/g;
my $ksdev = "";
if ($ent->{installnic})
{
if ($ent->{installnic} eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$ksdev = $ent->{installnic};
}
}
my $mac;
if ($macent->{mac}) {
$mac = xCAT::Utils->parseMacTabEntry($macent->{mac}, $node);
elsif ($ent->{primarynic})
{
if ($ent->{primarynic} eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$ksdev = $ent->{primarynic};
}
}
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($ent->{installnic}, $ent->{primarynic}, $mac);
else
{
$ksdev = "bootif"; #if not specified, fall back to bootif
}
if ($ksdev eq "")
{
$callback->(
{
error => ["No MAC address defined for " . $node],
errorcode => [1]
}
);
}
if($esxi){
$ksdev =~ s/eth/vmnic/g;
}
my $nicname = $net_params->{nicname};
if(xCAT::Utils->version_cmp($kversion,"7.0") < 0){
$kcmdline .= " $net_params->{ksdevice} ";
}elsif ($arch =~ /ppc/) {
$kcmdline .= " $net_params->{BOOTIF} ";
}
my $nicname;
if(xCAT::Utils->version_cmp($kversion,"7.0")<0){
$kcmdline .= " ksdevice=" . $ksdev;
}else{
if(xCAT::NetworkUtils->isValidMAC($ksdev)){
$kcmdline .= " BOOTIF=" . $ksdev;
}elsif($ksdev ne "bootif"){
$nicname=$ksdev;
}
}
#if site.managedaddressmode=static, specify the network configuration as kernel options
#to avoid multicast dhcp
if($::XCATSITEVALS{managedaddressmode} =~ /static/){
@ -1435,6 +1527,7 @@ sub mkinstall
$kcmdline .= " ifname=$nicname:$mac";
}
$kcmdline .=" ip=$ipaddr"."::"."$gateway".":"."$netmask".":"."$hostname".":"."$nicname".":"."none";
$kcmdline .=" bootdev=$nicname ";
}
@ -1464,8 +1557,12 @@ sub mkinstall
}
}
}else{
if (xCAT::Utils->version_cmp($kversion,"7.0") >= 0){
$kcmdline .= " $net_params->{ip} ";
unless(xCAT::Utils->version_cmp($kversion,"7.0")<0){
if($nicname){
$kcmdline .=" ip=$nicname:dhcp ";
}else{
$kcmdline .=" ip=dhcp ";
}
}
}
@ -1587,15 +1684,13 @@ sub mksysclone
my $restab = xCAT::Table->new('noderes');
my $bptab = xCAT::Table->new('bootparams',-create=>1);
my $hmtab = xCAT::Table->new('nodehm');
my $mactab = xCAT::Table->new('mac');
my %osents = %{$ostab->getNodesAttribs(\@nodes, ['profile', 'os', 'arch', 'provmethod'])};
my %rents = %{$restab->getNodesAttribs(\@nodes,
my %rents =
%{$restab->getNodesAttribs(\@nodes,
['xcatmaster', 'nfsserver', 'tftpdir', 'primarynic', 'installnic'])};
my %hents = %{$hmtab->getNodesAttribs(\@nodes,
my %hents =
%{$hmtab->getNodesAttribs(\@nodes,
['serialport', 'serialspeed', 'serialflow'])};
my %macents = %{$mactab->getNodesAttribs(\@nodes, ['mac'])};
my @entries = xCAT::TableUtils->get_site_attribute("xcatdport");
my $port_entry = $entries[0];
my $xcatdport="3001";
@ -1863,20 +1958,50 @@ sub mksysclone
#We have a shot...
my $ent = $rents{$node}->[0];
my $sent = $hents{$node}->[0];
my $macent = $macents{$node}->[0];
my $kcmdline = "ramdisk_size=$ramdisk_size";
# Add kernel parameters to specify the boot network interface
my $mac;
if ($macent->{mac}) {
$mac = xCAT::Utils->parseMacTabEntry($macent->{mac}, $node);
my $kcmdline =
"ramdisk_size=$ramdisk_size";
my $ksdev = "";
if ($ent->{installnic})
{
if ($ent->{installnic} eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$ksdev = $ent->{installnic};
}
}
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($ent->{installnic}, $ent->{primarynic}, $mac);
$kcmdline .= " $net_params->{ksdevice} ";
if ($arch =~ /ppc/) {
$kcmdline .= " $net_params->{BOOTIF} ";
}
elsif ($ent->{primarynic})
{
if ($ent->{primarynic} eq "mac")
{
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else
{
$ksdev = $ent->{primarynic};
}
}
else
{
$ksdev = "bootif"; #if not specified, fall back to bootif
}
if ($ksdev eq "")
{
$callback->(
{
error => ["No MAC address defined for " . $node],
errorcode => [1]
}
);
}
$kcmdline .= " ksdevice=" . $ksdev;
#TODO: dd=<url> for driver disks
if (defined($sent->{serialport}))
@ -1906,6 +2031,27 @@ sub mksysclone
}
$kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename";
my $nodetab = xCAT::Table->new('nodetype');
my $archref = $nodetab->getNodeAttribs($node, ['arch']);
if ($archref->{arch} eq "ppc64"){
my $mactab = xCAT::Table->new('mac');
my $macref = $mactab->getNodeAttribs($node, ['mac']);
my $formatmac = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
$formatmac =~ s/:/-/g;
$formatmac = "01-".$formatmac;
$kcmdline .= " BOOTIF=$formatmac ";
}
#$kcmdline .= " noipv6";
# add the addkcmdline attribute to the end
# of the command, if it exists
#my $addkcmd = $addkcmdhash->{$node}->[0];
# add the extra addkcmd command info, if in the table
#if ($addkcmd->{'addkcmdline'}) {
# $kcmdline .= " ";
# $kcmdline .= $addkcmd->{'addkcmdline'};
#}
my $k;
my $i;
#$k = "xcat/genesis.kernel.$arch";
@ -2192,7 +2338,7 @@ sub copycd
);
return;
}
if ($arch eq "ppc") { $arch = "ppc64" }
if ($arch =~ /ppc/) { $arch = "ppc64" }
}
if($inspection)

View File

@ -11,7 +11,6 @@ BEGIN
}
}
use lib "$::XCATROOT/lib/perl";
#use Net::SNMP qw(:snmp INTEGER);
use xCAT::Table;
@ -2005,7 +2004,7 @@ sub getmacs {
}
my @macs = ();
(my $code,my @orig_macs)=inv($node, 'mac');
(my $code,my @orig_macs)=inv('mac');
my $ignore_gen_mac = 0;
foreach my $mac (@orig_macs) {
if ($mac =~ /(.*) -> (.*)/) {
@ -2114,7 +2113,6 @@ sub getmacs {
}
sub inv {
my $node = shift;
my @invitems;
my $data;
my @output;
@ -2241,67 +2239,50 @@ sub inv {
$updatehash{serial}=$data;
}
#print "item=$item, slot=$slot\n";
if ($item =~ /^mac/) {
if ($slot !~ /:/) {
foreach (0..3) {
$data=$session->get([$macoids[$_],$slot]);
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
if ($data =~ /:/) {
push @output,"MAC Address ".($_+1).": ".$data;
}
}
foreach (0..3) {
my $oid=$hsdcmacoids[$_].".$slot";
$data=$session->get([$hsdcmacoids[$_],$slot]);
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
if ($data =~ /:/) {
push @output,"HS Daughter card MAC Address ".($_+1).": ".$data;
}
}
foreach (0..3) {
$data=$session->get([$dcmacoids[$_],$slot]);
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
if ($data =~ /:/) {
push @output,"Daughter card 1 MAC Address ".($_+1).": ".$data;
}
}
foreach (0..3) {
$data=$session->get([$sidecardoids[$_],$slot]);
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
if ($data =~ /:/) {
push @output,"Side card MAC Address ".($_+1).": ".$data;
}
}
} else {
my $cmd="pasu $node show PXE |grep NicPortMacAddress";
my $mac_list = xCAT::Utils->runcmd($cmd, 0, 1);
#print "mac_list=$mac_list\n";
if (@$mac_list > 0) {
foreach my $mac (@$mac_list) {
#print "mac=$mac\n";
$mac =~ s/^.*PXE.NicPortMacAddress.*(\d+)=(.*)$/"MAC Address $1: $2/;
#print "mac=$mac\n";
push @output, $mac;
}
}
if ($item =~ /^mac/ and $slot !~ /:/) {
foreach (0..3) {
$data=$session->get([$macoids[$_],$slot]);
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
if ($data =~ /:/) {
push @output,"MAC Address ".($_+1).": ".$data;
}
}
}
if ($updatetable and $updatehash{mtm}) {
}
foreach (0..3) {
my $oid=$hsdcmacoids[$_].".$slot";
$data=$session->get([$hsdcmacoids[$_],$slot]);
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
if ($data =~ /:/) {
push @output,"HS Daughter card MAC Address ".($_+1).": ".$data;
}
}
foreach (0..3) {
$data=$session->get([$dcmacoids[$_],$slot]);
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
if ($data =~ /:/) {
push @output,"Daughter card 1 MAC Address ".($_+1).": ".$data;
}
}
foreach (0..3) {
$data=$session->get([$sidecardoids[$_],$slot]);
if ($session->{ErrorStr}) { return (1,$session->{ErrorStr}); }
if ($data =~ /:/) {
push @output,"Side card MAC Address ".($_+1).": ".$data;
}
}
}
}
if ($updatetable and $updatehash{mtm}) {
#updatenodegroups
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($updatehash{mtm}) ;
if (defined($tmp_pre)) {
xCAT::TableUtils->updatenodegroups($currnode, $tmp_pre);
}
}
if ($updatetable and keys %updatehash) {
}
if ($updatetable and keys %updatehash) {
my $vpdtab = xCAT::Table->new('vpd');
$vpdtab->setNodeAttribs($currnode,\%updatehash);
}
return (0,@output);
}
return (0,@output);
}
sub power {
my $subcommand = shift;
@ -3735,7 +3716,7 @@ sub bladecmd {
} elsif ($command eq "getmacs") {
return getmacs($node, @args);
} elsif ($command eq "rinv") {
return inv($node, @args);
return inv(@args);
} elsif ($command eq "reventlog") {
return eventlog(@args);
} elsif ($command eq "rscan") {

View File

@ -347,39 +347,6 @@ sub donodeent {
}
my $ipmiauthdata = xCAT::PasswordUtils::getIPMIAuth(
noderange=>\@toconfignodes, ipmihash=>$ipmientries);
my $nltab = xCAT::Table->new('nodelist', -create=>0);
my $groupdata = {};
if ($nltab) {
$groupdata = $nltab->getNodesAttribs(\@toconfignodes,
[qw/groups/]);
}
my @cfgroups;
foreach (keys %$groupdata) {
push @cfgroups, split /,/,$groupdata->{$_}->[0]->{groups};
}
$confluent->read('/nodegroups/');
my $currgroup = $confluent->next_result();
my %currgroups;
while ($currgroup) {
if (exists $currgroup->{item}) {
my $groupname = $currgroup->{item}->{href};
$groupname =~ s/\/$//;
$currgroups{$groupname} = 1;
}
$currgroup = $confluent->next_result();
}
foreach (@cfgroups) {
if (not exists $currgroups{$_}) {
$confluent->create('/nodegroups/', parameters=>{name=>$_});
my $rsp = $confluent->next_result();
while ($rsp) {
if (exists $rsp->{error}) {
xCAT::SvrUtils::sendmsg([1,"Confluent error: " . $rsp->{error}],$cb);
}
$rsp = $confluent->next_result();
}
}
}
# Go thru all nodes specified to add them to the file
foreach my $node (sort keys %$cfgenthash) {
@ -412,7 +379,6 @@ foreach my $node (sort keys %$cfgenthash) {
} elsif ($::XCATSITEVALS{'consoleondemand'} and $::XCATSITEVALS{'consoleondemand'} !~ m/^n/) {
$parameters{'console.logging'} = 'none';
}
$parameters{'groups'} = [split /,/,$groupdata->{$node}->[0]->{'groups'}];
if (exists $currnodes{$node}) {
$confluent->update('/nodes/'.$node.'/attributes/current', parameters=>\%parameters);
my $rsp = $confluent->next_result();

View File

@ -355,15 +355,13 @@ sub process_request {
if ($net and $net->{nameservers})
{
my $valid = 0;
my @myips = xCAT::NetworkUtils->my_ip_facing($net->{net});
my $myip = xCAT::NetworkUtils->my_ip_facing($net->{net});
foreach (split /,/, $net->{nameservers})
{
chomp $_;
foreach my $myip (@myips) {
if (($_ eq $myip) || ($_ eq '<xcatmaster>') || ($_ eq $sitens))
{
$valid += 1;
}
if (($_ eq $myip) || ($_ eq '<xcatmaster>') || ($_ eq $sitens))
{
$valid += 1;
}
}
unless ($valid > 0)
@ -1413,66 +1411,60 @@ sub add_or_delete_records {
}
my $zone;
foreach $zone (keys %{$ctx->{updatesbyzone}}) {
unless (defined ($ctx->{nsmap}->{$zone}) && $ctx->{nsmap}->{$zone}) {
next;
my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone});
if( !defined $ip) {
xCAT::SvrUtils::sendmsg([1,"Please make sure $ctx->{nsmap}->{$zone} exist either in /etc/hosts or DNS."], $callback);
return 1;
}
# the ns for zone might be multiple ones which separated with ,
foreach my $zoneserver (split(',', $ctx->{nsmap}->{$zone})) {
my $ip = xCAT::NetworkUtils->getipaddr($zoneserver);
if( !defined $ip) {
xCAT::SvrUtils::sendmsg([1,"Please make sure $zoneserver exist either in /etc/hosts or DNS."], $callback);
return 1;
my $resolver = Net::DNS::Resolver->new(nameservers=>[$ip]);
my $entry;
my $numreqs = 300; # limit to 300 updates in a payload, something broke at 644 on a certain sample, choosing 300 for now
my $update = Net::DNS::Update->new($zone);
foreach $entry (@{$ctx->{updatesbyzone}->{$zone}}) {
if ($ctx->{deletemode}) {
$update->push(update=>rr_del($entry));
} else {
$update->push(update=>rr_add($entry));
}
my $resolver = Net::DNS::Resolver->new(nameservers=>[$ip]);
my $entry;
my $numreqs = 300; # limit to 300 updates in a payload, something broke at 644 on a certain sample, choosing 300 for now
my $update = Net::DNS::Update->new($zone);
foreach $entry (@{$ctx->{updatesbyzone}->{$zone}}) {
if ($ctx->{deletemode}) {
$update->push(update=>rr_del($entry));
} else {
$update->push(update=>rr_add($entry));
}
$numreqs -= 1;
if ($numreqs == 0) {
$update->sign_tsig("xcat_key",$ctx->{privkey});
$numreqs=300;
my $reply = $resolver->send($update);
if ($reply)
{
if ($reply->header->rcode ne 'NOERROR')
{
xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone, error was ".$reply->header->rcode.". See more details in system log."], $callback);
}
}
else
{
xCAT::SvrUtils::sendmsg([1,"No reply received when sending DNS update to zone $zone"], $callback);
}
$update = Net::DNS::Update->new($zone); #new empty request
}
}
if ($numreqs != 300) { #either no entries at all to begin with or a perfect multiple of 300
$numreqs -= 1;
if ($numreqs == 0) {
$update->sign_tsig("xcat_key",$ctx->{privkey});
$numreqs=300;
my $reply = $resolver->send($update);
if ($reply)
if ($reply)
{
if ($reply->header->rcode ne 'NOERROR')
{
if ($reply->header->rcode ne 'NOERROR')
{
xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone, error was ".$reply->header->rcode.". See more details in system log."], $callback);
}
}
else
{
xCAT::SvrUtils::sendmsg([1,"No reply received when sending DNS update to zone $zone"], $callback);
xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone, error was ".$reply->header->rcode.". See more details in system log."], $callback);
}
}
else
{
xCAT::SvrUtils::sendmsg([1,"No reply received when sending DNS update to zone $zone"], $callback);
}
# sometimes resolver does not work if the update zone request sent so quick
sleep 1;
$update = Net::DNS::Update->new($zone); #new empty request
}
}
if ($numreqs != 300) { #either no entries at all to begin with or a perfect multiple of 300
$update->sign_tsig("xcat_key",$ctx->{privkey});
my $reply = $resolver->send($update);
if ($reply)
{
if ($reply->header->rcode ne 'NOERROR')
{
xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone, error was ".$reply->header->rcode.". See more details in system log."], $callback);
}
}
else
{
xCAT::SvrUtils::sendmsg([1,"No reply received when sending DNS update to zone $zone"], $callback);
}
# sometimes resolver does not work if the update zone request sent so quick
sleep 1;
}
}
xCAT::SvrUtils::sendmsg("Completed updating DNS records.", $callback);
}
@ -1524,17 +1516,13 @@ sub find_nameserver_for_dns {
if ($reply->header->rcode ne 'NOERROR') {
xCAT::SvrUtils::sendmsg([1,"Failure encountered querying $zone, error was ".$reply->header->rcode], $callback);
}
my @zoneserver;
foreach my $record ($reply->answer) {
if ( $record->nsdname =~ /blackhole.*\.iana\.org/) {
$ctx->{nsmap}->{$zone} = 0;
} else {
push @zoneserver, $record->nsdname;
$ctx->{nsmap}->{$zone} = $record->nsdname;
}
}
unless (defined ($ctx->{nsmap}->{$zone})) {
$ctx->{nsmap}->{$zone} = join(',', @zoneserver);
}
} else {
$ctx->{nsmap}->{$zone} = 0;
}

View File

@ -212,27 +212,17 @@ sub copycd
#this plugin needs $path...
return;
}
if ( $distname
and $distname !~ /^debian/i
and $distname !~ /^ubuntu/i)
{
#If they say to call it something unidentifiable, give up?
if ( $copypath || $noosimage || $nonoverwrite ){
$callback->({info=> ["copycd on debian/ubuntu doesn't support -p, -o, -w options!"]});
return;
}
unless (-r $path . "/.disk/info")
{
#xCAT::MsgUtils->message("S","The CD doesn't look like a Debian CD, exiting...");
return;
}
if ( $copypath || $nonoverwrite )
{
$callback->({info=> ["copycds on Ubuntu/Debian does not support -p or -w option."]});
return;
}
my $dinfo;
open($dinfo, $path . "/.disk/info");
my $line = <$dinfo>;
@ -263,9 +253,7 @@ sub copycd
# So that we have the netboot images
$isnetinst = 1 if ($line2[7] eq "NETINST");
if (!$distname) {
$distname="debian".$ver;
}
$distname="debian".$ver;
$detdistname="debian".$ver;
}
elsif ($prod eq "Ubuntu" or $prod eq "Ubuntu-Server" )
@ -273,9 +261,7 @@ sub copycd
# to cover for LTS releases
$darch = $line2[7] if ($line2[2] eq "LTS");
if (!$distname) {
$distname="ubuntu".$ver;
}
$distname="ubuntu".$ver;
$detdistname="ubuntu".$ver;
$discno = `cat $path/README.diskdefines | grep 'DISKNUM ' | awk '{print \$3}'`;
}
@ -421,24 +407,23 @@ sub copycd
}
$callback->({data => "Media copy operation successful"});
unless($noosimage) {
my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch, $temppath, $osdistroname);
if ($ret[0] != 0) {
$callback->({data => "Error when updating the osimage tables: " . $ret[1]});
}
my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot", $temppath, $osdistroname);
if ($ret[0] != 0) {
$callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]});
}
my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite", $temppath, $osdistroname);
if ($ret[0] != 0) {
$callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]});
}
my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch, $temppath, $osdistroname);
if ($ret[0] != 0) {
$callback->({data => "Error when updating the osimage tables: " . $ret[1]});
}
my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot", $temppath, $osdistroname);
if ($ret[0] != 0) {
$callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]});
}
my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite", $temppath, $osdistroname);
if ($ret[0] != 0) {
$callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]});
}
}
}
sub mkinstall {
sub mkinstall
{
xCAT::MsgUtils->message("S","Doing debian mkinstall");
my $request = shift;
my $callback = shift;
@ -466,7 +451,6 @@ sub mkinstall {
my $restab = xCAT::Table->new('noderes');
my $bptab = xCAT::Table->new('bootparams',-create=>1);
my $hmtab = xCAT::Table->new('nodehm');
my $mactab = xCAT::Table->new('mac');
my %osents = %{$ostab->getNodesAttribs(\@nodes, ['profile', 'os', 'arch', 'provmethod'])};
my %rents =
%{$restab->getNodesAttribs(\@nodes,
@ -474,7 +458,6 @@ sub mkinstall {
my %hents =
%{$hmtab->getNodesAttribs(\@nodes,
['serialport', 'serialspeed', 'serialflow'])};
my %macents = %{$mactab->getNodesAttribs(\@nodes, ['mac'])};
#my $addkcmdhash =
# $bptab->getNodesAttribs(\@nodes, ['addkcmdline']);
require xCAT::Template;
@ -489,13 +472,16 @@ sub mkinstall {
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
$callback->( { warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset <noderange> osimage=<osimage_name>\" instead."], });
$callback->(
{
warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset <noderange> osimage=<osimage_name>\" instead."],
}
);
# Do not print this warning message multiple times
last;
}
}
}
foreach $node (@nodes)
{
my $os;
@ -504,8 +490,6 @@ sub mkinstall {
my $profile;
my $tmplfile;
my $pkgdir;
my $pkgdirval;
my @mirrors;
my $pkglistfile;
my $imagename; # set it if running of 'nodeset osimage=xxx'
my $platform;
@ -513,115 +497,101 @@ sub mkinstall {
my $osinst;
my $ent = $osents{$node}->[0]; #$ostab->getNodeAttribs($node, ['profile', 'os', 'arch']);
if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite')) {
$imagename=$ent->{provmethod};
if (!exists($img_hash{$imagename})) {
if (!$osimagetab) {
$osimagetab=xCAT::Table->new('osimage', -create=>1);
}
(my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'provmethod');
if ($ref) {
$img_hash{$imagename}->{osver}=$ref->{'osvers'};
$img_hash{$imagename}->{osarch}=$ref->{'osarch'};
$img_hash{$imagename}->{profile}=$ref->{'profile'};
$img_hash{$imagename}->{provmethod}=$ref->{'provmethod'};
if (!$linuximagetab) {
$linuximagetab=xCAT::Table->new('linuximage', -create=>1);
}
(my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'template', 'pkgdir', 'pkglist');
if ($ref1) {
if ($ref1->{'template'}) {
$img_hash{$imagename}->{template}=$ref1->{'template'};
}
if ($ref1->{'pkgdir'}) {
$img_hash{$imagename}->{pkgdir}=$ref1->{'pkgdir'};
}
if ($ref1->{'pkglist'}) {
$img_hash{$imagename}->{pkglist}=$ref1->{'pkglist'};
}
}
# if the install template wasn't found, then lets look for it in the default locations.
unless($img_hash{$imagename}->{template}) {
my $pltfrm=getplatform($ref->{'osvers'});
my $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$pltfrm",
$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'});
if (! $tmplfile) {
$imagename=$ent->{provmethod};
if (!exists($img_hash{$imagename})) {
if (!$osimagetab) {
$osimagetab=xCAT::Table->new('osimage', -create=>1);
}
(my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'provmethod');
if ($ref) {
$img_hash{$imagename}->{osver}=$ref->{'osvers'};
$img_hash{$imagename}->{osarch}=$ref->{'osarch'};
$img_hash{$imagename}->{profile}=$ref->{'profile'};
$img_hash{$imagename}->{provmethod}=$ref->{'provmethod'};
if (!$linuximagetab) {
$linuximagetab=xCAT::Table->new('linuximage', -create=>1);
}
(my $ref1) = $linuximagetab->getAttribs({imagename => $imagename}, 'template', 'pkgdir', 'pkglist');
if ($ref1) {
if ($ref1->{'template'}) {
$img_hash{$imagename}->{template}=$ref1->{'template'};
}
if ($ref1->{'pkgdir'}) {
$img_hash{$imagename}->{pkgdir}=$ref1->{'pkgdir'};
}
if ($ref1->{'pkglist'}) {
$img_hash{$imagename}->{pkglist}=$ref1->{'pkglist'};
}
}
# if the install template wasn't found, then lets look for it in the default locations.
unless($img_hash{$imagename}->{template}){
my $pltfrm=getplatform($ref->{'osvers'});
my $tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$pltfrm",
$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'});
if (! $tmplfile) {
$tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$::XCATROOT/share/xcat/install/$pltfrm",
$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'});
}
# if we managed to find it, put it in the hash:
if($tmplfile) {
$img_hash{$imagename}->{template}=$tmplfile;
}
}
$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'});
}
# if we managed to find it, put it in the hash:
if($tmplfile){
$img_hash{$imagename}->{template}=$tmplfile;
}
}
#if the install pkglist wasn't found, then lets look for it in the default locations
unless($img_hash{$imagename}->{pkglist}) {
my $pltfrm=getplatform($ref->{'osvers'});
my $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$installroot/custom/install/$pltfrm",
$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'});
if (! $pkglistfile) {
unless($img_hash{$imagename}->{pkglist}){
my $pltfrm=getplatform($ref->{'osvers'});
my $pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$installroot/custom/install/$pltfrm",
$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'});
if (! $pkglistfile) {
$pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$::XCATROOT/share/xcat/install/$pltfrm",
$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'});
}
# if we managed to find it, put it in the hash:
if($pkglistfile) {
$img_hash{$imagename}->{pkglist}=$pkglistfile;
}
}
}
$ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'});
}
# if we managed to find it, put it in the hash:
if($pkglistfile){
$img_hash{$imagename}->{pkglist}=$pkglistfile;
}
}
}
else {
$callback->(
{error => ["The os image $imagename does not exists on the osimage table for $node"],
errorcode => [1]});
next;
}
}
my $ph=$img_hash{$imagename};
$os = $ph->{osver};
$arch = $ph->{osarch};
$profile = $ph->{profile};
$platform=xCAT_plugin::debian::getplatform($os);
$tmplfile=$ph->{template};
$pkgdirval=$ph->{pkgdir};
my @pkgdirlist=split(/,/,$pkgdirval);
foreach (@pkgdirlist) {
if($_ =~ /^http|ssh/) {
push @mirrors,$_;
} else {
# If multiple pkgdirs are provided, The first path in the value of osimage.pkgdir
# must be the OS base pkg dir path, so use the first path as pkgdir
if (!$pkgdir) {
$pkgdir=$_;
}
}
}
if (!$pkgdir) {
$pkgdir="$installroot/$os/$arch";
}
$pkglistfile=$ph->{pkglist};
}
else {
$os = $ent->{os};
$arch = $ent->{arch};
$profile = $ent->{profile};
$platform=xCAT_plugin::debian::getplatform($os);
my $genos = $os;
$genos =~ s/\..*//;
$tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$platform", $profile, $os, $arch, $genos);
if (! $tmplfile) {
$callback->(
{error => ["The os image $imagename does not exists on the osimage table for $node"],
errorcode => [1]});
next;
}
}
my $ph=$img_hash{$imagename};
$os = $ph->{osver};
$arch = $ph->{osarch};
$profile = $ph->{profile};
$platform=xCAT_plugin::debian::getplatform($os);
$tmplfile=$ph->{template};
$pkgdir=$ph->{pkgdir};
if (!$pkgdir) {
$pkgdir="$installroot/$os/$arch";
}
$pkglistfile=$ph->{pkglist};
}
else {
$os = $ent->{os};
$arch = $ent->{arch};
$profile = $ent->{profile};
$platform=xCAT_plugin::debian::getplatform($os);
my $genos = $os;
$genos =~ s/\..*//;
$tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$platform", $profile, $os, $arch, $genos);
if (! $tmplfile) {
$tmplfile=xCAT::SvrUtils::get_tmpl_file_name("$::XCATROOT/share/xcat/install/$platform", $profile, $os, $arch, $genos);
}
$pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$installroot/custom/install/$platform", $profile, $os, $arch, $genos);
if (! $pkglistfile) {
$pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$installroot/custom/install/$platform", $profile, $os, $arch, $genos);
if (! $pkglistfile) {
$pkglistfile=xCAT::SvrUtils::get_pkglist_file_name("$::XCATROOT/share/xcat/install/$platform", $profile, $os, $arch, $genos);
}
$pkgdir="$installroot/$os/$arch";
}
$pkgdir="$installroot/$os/$arch";
}
if ($arch eq "x86_64") {
$darch = "amd64";
@ -638,7 +608,7 @@ sub mkinstall {
my @missingparms;
unless ($os) {
if ($imagename) {
if ($imagename) {
push @missingparms,"osimage.osvers";
}
else {
@ -655,7 +625,7 @@ sub mkinstall {
}
}
unless ($profile) {
if ($imagename) {
if ($imagename) {
push @missingparms,"osimage.profile";
}
else {
@ -666,7 +636,7 @@ sub mkinstall {
unless ($os and $arch and $profile){
$callback->({error => ["Missing ".join(',',@missingparms)." for $node"],
errorcode => [1]});
next; # No profile
next; #No profile
}
unless ( -r "$tmplfile") {
@ -679,42 +649,46 @@ sub mkinstall {
my $tmperr;
my $preerr;
my $posterr;
if ($imagename) {
$tmperr="Unable to find template file: $tmplfile";
} else {
if ($imagename) {
$tmperr="Unable to find template file: $tmplfile";
} else {
$tmperr="Unable to find template in $installroot/custom/install/$platform or $::XCATROOT/share/xcat/install/$platform (for $profile/$os/$arch combination)";
}
}
if (-r "$tmplfile") {
$tmperr =
xCAT::Template->subvars($tmplfile,
"$installroot/autoinst/" . $node,
$node,
$pkglistfile,
$pkgdir,
$platform
);
xCAT::Template->subvars(
$tmplfile,
"$installroot/autoinst/" . $node,
$node,
$pkglistfile,
$pkgdir,
$platform
);
}
my $prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform";
my $postscript = "$::XCATROOT/share/xcat/install/scripts/post.$platform";
my $prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform";
my $postscript = "$::XCATROOT/share/xcat/install/scripts/post.$platform";
# for powerkvm VM ubuntu LE#
if ($arch =~ /ppc64/i and $platform eq "ubuntu") {
$prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform.ppc64";
}
# for powerkvm VM ubuntu LE#
if ($arch =~ /ppc64/i and $platform eq "ubuntu") {
$prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform.ppc64";
}
if (-r "$prescript"){
$preerr = xCAT::Template->subvars($prescript,
"$installroot/autoinst/" . $node . ".pre",
$node
);
}
if (-r "$postscript") {
$posterr = xCAT::Template->subvars($postscript,
"$installroot/autoinst/" . $node . ".post",
$node
);
if (-r "$prescript"){
$preerr =
xCAT::Template->subvars(
$prescript,
"$installroot/autoinst/" . $node . ".pre",
$node
);
}
if (-r "$postscript") {
$posterr =
xCAT::Template->subvars(
$postscript,
"$installroot/autoinst/" . $node . ".post",
$node
);
}
my $errtmp;
@ -725,9 +699,9 @@ sub mkinstall {
}
if ($arch =~ /ppc64/i and !(-e "$pkgdir/install/netboot/initrd.gz")) {
$callback->({error => ["The network boot initrd.gz is not found in $pkgdir/install/netboot. This is provided by Ubuntu, please download and retry."],
errorcode=>[1]});
next;
$callback->({error => ["The netboot initrd not found in $pkgdir/install/netboot, pls download first"],
errorcode=>[1]});
next;
}
my $tftpdir = "/tftpboot";
@ -738,30 +712,31 @@ sub mkinstall {
my $maxmem;
if (
(
($arch =~ /x86/ and
(
( -r "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
and $kernpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
and -r "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz"
) or
( -r "$pkgdir/install/netboot/vmlinuz"
and $kernpath = "$pkgdir/install/netboot/vmlinuz"
and -r "$pkgdir/install/netboot/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
)
(
($arch =~ /x86/ and
(
( -r "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
and $kernpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
and -r "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/initrd.gz"
) or
( -r "$pkgdir/install/netboot/vmlinuz"
and $kernpath = "$pkgdir/install/netboot/vmlinuz"
and -r "$pkgdir/install/netboot/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
)
) or (
)
) or (
$arch =~ /ppc64/i and (
-r "$pkgdir/install/vmlinux"
and $kernpath = "$pkgdir/install/vmlinux"
and -r "$pkgdir/install/netboot/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
-r "$pkgdir/install/vmlinux"
and $kernpath = "$pkgdir/install/vmlinux"
and -r "$pkgdir/install/netboot/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
)
)
)
){
)
){
#TODO: driver slipstream, targetted for network.
# Copy the install resource to /tftpboot and check to only copy once
@ -790,46 +765,77 @@ sub mkinstall {
copyAndAddCustomizations($initrdpath,"$tftppath/initrd.img");
}
# We have a shot...
#We have a shot...
my $ent = $rents{$node}->[0];
# $restab->getNodeAttribs($node,
# ['nfsserver', 'primarynic', 'installnic']);
my $sent = $hents{$node}->[0];
my $macent = $macents{$node}->[0];
# $hmtab->getNodeAttribs(
# $node,
# [
# 'serialport', 'serialspeed', 'serialflow'
# ]
# );
my $instserver;
if ($ent and $ent->{xcatmaster}) {
if ($ent and $ent->{xcatmaster}){
$instserver = $ent->{xcatmaster};
}
else {
else{
$instserver = '!myipfn!';
}
if ($ent and $ent->{nfsserver}) {
if ($ent and $ent->{nfsserver})
{
$instserver = $ent->{nfsserver};
}
my $kcmdline = "nofb utf8 auto url=http://" . $instserver . "/install/autoinst/" . $node;
#if ($platform eq "ubuntu"){
# my $kcmdline =
# "nofb utf8 auto url=http://"
# . $ent->{nfsserver}
# . "$installroot/autoinst/"
# . $node;
#} else
#{
my $kcmdline = "nofb utf8 auto url=http://"
. $instserver
. "/install/autoinst/"
. $node;
#}
$kcmdline .= " xcatd=".$instserver;
$kcmdline .= " mirror/http/hostname=".$instserver;
if ($maxmem) {
$kcmdline.=" mem=$maxmem";
}
# parse Mac table to get one mac address in case there are multiples.
my $mac;
if ($macent->{mac}) {
$mac = xCAT::Utils->parseMacTabEntry($macent->{mac},$node);
my $ksdev = "";
if ($ent->{installnic}){
if ($ent->{installnic} eq "mac"){
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else{
$ksdev = $ent->{installnic};
}
}
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($ent->{installnic},$ent->{primarynic},$mac);
if (exists($net_params->{nicname})) {
$kcmdline .= " netcfg/choose_interface=". $net_params->{nicname};
} elsif (exists($net_params->{mac})) {
$kcmdline .= " netcfg/choose_interface=". $net_params->{mac};
elsif ($ent->{primarynic}){
if ($ent->{primarynic} eq "mac"){
my $mactab = xCAT::Table->new("mac");
my $macref = $mactab->getNodeAttribs($node, ['mac']);
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
}
else{
$ksdev = $ent->{primarynic};
}
}
if ($ksdev){
$kcmdline .= " netcfg/choose_interface=" . $ksdev;
}
#TODO: dd=<url> for driver disks
if (defined($sent->{serialport})) {
unless ($sent->{serialspeed}) {
if (defined($sent->{serialport})){
unless ($sent->{serialspeed}){
$callback->({error => ["serialport defined, but no serialspeed for $node in nodehm table"],
errorcode => [1]});
next;
@ -839,49 +845,68 @@ sub mkinstall {
} else {
$kcmdline .= " console=tty0 console=ttyS".$sent->{serialport} . "," . $sent->{serialspeed};
}
if ($sent->{serialflow} =~ /(hard|cts|ctsrts)/) {
if ($sent->{serialflow} =~ /(hard|cts|ctsrts)/){
$kcmdline .= "n8r";
}
} else {
$callback->({ warning => ["rcons my not work since no serialport specified"], });
}
#$kcmdline .= " noipv6";
# add the addkcmdline attribute to the end
# of the command, if it exists
#my $addkcmd = $addkcmdhash->{$node}->[0];
# add the extra addkcmd command info, if in the table
#if ($addkcmd->{'addkcmdline'}) {
# $kcmdline .= " ";
# $kcmdline .= $addkcmd->{'addkcmdline'};
#}
# need to add these in, otherwise aptitude will ask questions
$kcmdline .= " locale=en_US";
#$kcmdline .= " netcfg/wireless_wep= netcfg/get_hostname= netcfg/get_domain=";
$kcmdline .= " locale=en_US";
#$kcmdline .= " netcfg/wireless_wep= netcfg/get_hostname= netcfg/get_domain=";
# default answers as much as possible, we don't want any interactiveness :)
$kcmdline .= " priority=critical";
$kcmdline .= " priority=critical";
# Automatically detect all HDD
# $kcmdline .= " all-generic-ide irqpoll";
#$kcmdline .= " all-generic-ide irqpoll";
# by default do text based install
# $kcmdline .= " DEBIAN_FRONTEND=text";
# by default do text based install
#$kcmdline .= " DEBIAN_FRONTEND=text";
# Maybe useful for debugging purposes
#
# $kcmdline .= " BOOT_DEBUG=3";
# $kcmdline .= " DEBCONF_DEBUG=5";
# Maybe useful for debugging purposes
#
#$kcmdline .= " BOOT_DEBUG=3";
#$kcmdline .= " DEBCONF_DEBUG=5";
# I don't need the timeout for ubuntu, but for debian there is a problem with getting dhcp in a timely manner
# I don't need the timeout for ubuntu, but for debian there is a problem with getting dhcp in a timely manner
# safer way to set hostname, avoid problems with nameservers
$kcmdline .= " hostname=".$node;
#from 12.10, the live install changed, so add the live-installer
if ( -r "$pkgdir/install/filesystem.squashfs") {
$kcmdline .= " live-installer/net-image=http://${instserver}${pkgdir}/install/filesystem.squashfs";
}
if ( -r "$pkgdir/install/filesystem.squashfs")
{
$kcmdline .= " live-installer/net-image=http://${instserver}${pkgdir}/install/filesystem.squashfs";
}
$bptab->setNodeAttribs($node, { kernel => "$rtftppath/vmlinuz",
initrd => "$rtftppath/initrd.img",
kcmdline => $kcmdline });
$bptab->setNodeAttribs(
$node,
{
kernel => "$rtftppath/vmlinuz",
initrd => "$rtftppath/initrd.img",
kcmdline => $kcmdline
}
);
}
else{
$callback->({error => ["Install image not found in $installroot/$os/$arch"],
errorcode => [1]});
}
}
#my $rc = xCAT::TableUtils->create_postscripts_tar();
#if ($rc != 0)
#{
# xCAT::MsgUtils->message("S", "Error creating postscripts tar file.");
#}
}
sub mknetboot
@ -1397,16 +1422,17 @@ sub mknetboot
# add one parameter: ifname=<eth0>:<mac address>
# which is used for dracut
# the redhat5.x os will ignore it
my $useifname=0;
my $installnic = undef;
my $primarynic = undef;
my $mac = undef;
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic}) {
$installnic = $reshash->{$node}->[0]->{installnic};
}
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic}) {
$primarynic= $reshash->{$node}->[0]->{primarynic};
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
$useifname=1;
$kcmdline .= "ifname=".$reshash->{$node}->[0]->{installnic} . ":";
} elsif ($nodebootif) {
$useifname=1;
$kcmdline .= "ifname=$nodebootif:";
} elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
$useifname=1;
$kcmdline .= "ifname=".$reshash->{$node}->[0]->{primarynic}.":";
}
#else { #no, we autodetect and don't presume anything
# $kcmdline .="eth0:";
@ -1417,15 +1443,34 @@ sub mknetboot
if( $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) {
# TODO: currently, only "mac" attribute with classic style is used, the "|" delimited string of "macaddress!hostname" format is not used
$mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{'mac'},$node);
# if ( (index($mac, "|") eq -1) and (index($mac, "!") eq -1) ) {
#convert to linux format
if ($mac !~ /:/) {
$mac =~s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
}
# } else {
# $callback->({ error=>[ qq{In the "mac" table, the "|" delimited string of "macaddress!hostname" format is not supported by "nodeset <nr> netboot|statelite if installnic/primarynic is set".}], errorcode=>[1]});
# return;
# }
}
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($installnic, $primarynic, $mac, $nodebootif);
if (defined($net_params->{ifname})) {
$kcmdline .= "$net_params->{ifname} ";
if ($useifname && $mac) {
$kcmdline .= "$mac ";
}
if (defined($net_params->{netdev})) {
$kcmdline .= "$net_params->{netdev} ";
} elsif (defined($net_params->{BOOTIF}) && ($net_params->{setmac} || $arch=~ /ppc/)) {
$kcmdline .= "$net_params->{BOOTIF} ";
# add "netdev=<eth0>" or "BOOTIF=<mac>"
# which are used for other scenarios
my $netdev = "";
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and $reshash->{$node}->[0]->{installnic} ne "mac") {
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
} elsif ($nodebootif) {
$kcmdline .= "netdev=" . $nodebootif . " ";
} elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") {
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
} else {
if ( !$useifname && $mac) {
$kcmdline .= "BOOTIF=" . $mac . " ";
}
}
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
@ -1462,12 +1507,6 @@ sub mknetboot
{
$kcmdline .= "n8r";
}
} else {
$callback->(
{
warning => ["rcons my not work since no serialport specified"],
}
);
}
# add the addkcmdline attribute to the end
# of the command, if it exists

View File

@ -1450,7 +1450,7 @@ sub process_request
my $n = $_->{net};
my $if = $_->{mgtifname};
my $nm = $_->{mask};
if ($if =~ /!remote!\S+/ and $n !~ /:/) { #only take in networks with special interface, but only v4 for now
if ($if =~ /!remote!/ and $n !~ /:/) { #only take in networks with special interface, but only v4 for now
push @nrn, "$n:$if:$nm";
}
}
@ -1467,27 +1467,20 @@ sub process_request
{
next;
}
my $netif = $ent[1];
if ($netif =~ /!remote!/) {
$netif =~ s/!remote!\s*(.*)$/$1/;
}
# Bridge nics
if ((-f "/usr/sbin/brctl") || (-f "/sbin/brctl"))
{
#system "brctl showmacs $ent[1] 2>&1 1>/dev/null";
system "brctl showmacs $netif 2>&1 1>/dev/null";
system "brctl showmacs $ent[1] 2>&1 1>/dev/null";
if ($? == 0)
{
#$activenics{$ent[1]} = 1;
$activenics{$netif} = 1;
$activenics{$ent[1]} = 1;
next;
}
}
#if ($ent[1] =~ m/(remote|ipoib|ib|vlan|bond|eth|myri|man|wlan|en\S*\d+|em\S*\d+)/)
if ($netif =~ m/(remote|ipoib|ib|vlan|bond|eth|myri|man|wlan|en\S*\d+|em\S*\d+)/)
if ($ent[1] =~ m/(remote|ipoib|ib|vlan|bond|eth|myri|man|wlan|en\S*\d+|em\S*\d+)/)
{ #Mask out many types of interfaces, like xCAT 1.x
#$activenics{$ent[1]} = 1;
$activenics{$netif} = 1;
$activenics{$ent[1]} = 1;
}
}
}
@ -1707,18 +1700,7 @@ sub process_request
{
next;
}
my $netif = $line[1];
if ($netif =~ /!remote!/) {
$netif =~ s/!remote!\s*(.*)$/$1/;
if (!defined($activenics{"!remote!"})) {
next;
} elsif (!defined($activenics{$netif})) {
addnic($netif,\@dhcpconf);
$activenics{$netif} = 1;
}
}
#if ($activenics{$line[1]} and $line[3] !~ /G/)
if ($activenics{$netif} and $line[3] !~ /G/)
if ($activenics{$line[1]} and $line[3] !~ /G/)
{
addnet($line[0], $line[2]);
}
@ -2141,9 +2123,6 @@ sub addnet
if ($ent[0] eq $net and $ent[2] eq $mask)
{
$nic = $ent[1];
if ($nic =~ /!remote!/) {
$nic =~ s/!remote!\s*(.*)$/$1/;
}
# The first nic that matches the network,
# what will happen if there are more than one nics in the same subnet,
# and we want to use the second nic as the dhcp interfaces?
@ -2558,8 +2537,8 @@ sub addnic
#$restartdhcp=1;
#print "Adding NIC $nic\n";
if ($nic =~ /!remote!/) {
#push @$conf, "#shared-network $nic {\n";
#push @$conf, "#\} # $nic nic_end\n";
push @$conf, "#shared-network $nic {\n";
push @$conf, "#\} # $nic nic_end\n";
} else {
push @$conf, "shared-network $nic {\n";
push @$conf, "\} # $nic nic_end\n";

File diff suppressed because it is too large Load Diff

View File

@ -101,7 +101,6 @@ my %guestidmap = (
"centos6.*" => "rhel6_",
"centos5.*" => "rhel5_",
"centos4.*" => "rhel4_",
"sles12.*" => "sles12_",
"sles11.*" => "sles11_",
"sles10.*" => "sles10_",
"win2k8" => "winLonghorn",
@ -122,7 +121,7 @@ sub handled_commands{
return {
copycd => 'esx',
mknetboot => "nodetype:os=(esxi.*)",
mkinstall => "nodetype:os=(esxi[56].*)",
mkinstall => "nodetype:os=(esxi5.*)",
rpower => 'nodehm:power,mgt',
esxiready => "esx",
rsetboot => 'nodehm:power,mgt',
@ -2476,7 +2475,7 @@ sub clone_vms_from_master {
sub make_customization_spec {
my $node = shift;
my %args = @_;
my $password;
my $password="Passw0rd";
my $wintimezone;
#map of number to strings can be found at
#http://osman-shener-en.blogspot.com/2008/02/unattendedtxt-time-zone-index.html
@ -4550,7 +4549,7 @@ sub copycd {
# let everyone read it
#chdir "/tmp";
chmod 0755, "$installroot/$distname/$arch";
if ($distname =~ /esxi[56]/) { #going to tweak boot.cfg for install and default stateless case
if ($distname =~ /esxi5/) { #going to tweak boot.cfg for install and default stateless case
if (! -r "$installroot/$distname/$arch/boot.cfg.stateless") {
copy("$installroot/$distname/$arch/boot.cfg","$installroot/$distname/$arch/boot.cfg.stateless");
my $bootcfg;
@ -4644,7 +4643,7 @@ sub makecustomizedmod {
my @otherusers = qw/nobody nfsnobody dcui daemon/;
if ($osver =~ /esxi4/) {
push @otherusers,"vimuser";
} elsif ($osver =~ /esxi[56]/) {
} elsif ($osver =~ /esxi5/) {
push @otherusers,"vpxuser";
}
print $shadow "root:$password:$dayssince1970:0:99999:7:::\n";
@ -4656,18 +4655,18 @@ sub makecustomizedmod {
if ($osver =~ /esxi4/ and -e "$::XCATROOT/share/xcat/netboot/esxi/38.xcat-enableipv6") {
mkpath($tempdir."/etc/vmware/init/init.d");
copy( "$::XCATROOT/share/xcat/netboot/esxi/38.xcat-enableipv6",$tempdir."/etc/vmware/init/init.d/38.xcat-enableipv6");
} elsif ($osver =~ /esxi[56]/ and -e "$::XCATROOT/share/xcat/netboot/esxi/xcat-ipv6.json") {
} elsif ($osver =~ /esxi5/ and -e "$::XCATROOT/share/xcat/netboot/esxi/xcat-ipv6.json") {
mkpath($tempdir."/usr/libexec/jumpstart/plugins/");
copy( "$::XCATROOT/share/xcat/netboot/esxi/xcat-ipv6.json",$tempdir."/usr/libexec/jumpstart/plugins/xcat-ipv6.json");
}
if ($osver =~ /esxi4/ and -e "$::XCATROOT/share/xcat/netboot/esxi/47.xcat-networking") {
copy( "$::XCATROOT/share/xcat/netboot/esxi/47.xcat-networking",$tempdir."/etc/vmware/init/init.d/47.xcat-networking");
} elsif ($osver =~ /esxi[56]/ and -e "$::XCATROOT/share/xcat/netboot/esxi/39.ipv6fixup") {
} elsif ($osver =~ /esxi5/ and -e "$::XCATROOT/share/xcat/netboot/esxi/39.ipv6fixup") {
mkpath($tempdir."/etc/init.d");
copy( "$::XCATROOT/share/xcat/netboot/esxi/39.ipv6fixup",$tempdir."/etc/init.d/39.ipv6fixup");
chmod(0755,"$tempdir/etc/init.d/39.ipv6fixup");
}
if ($osver =~ /esxi[56]/ and -e "$::XCATROOT/share/xcat/netboot/esxi/48.esxifixup") {
if ($osver =~ /esxi5/ and -e "$::XCATROOT/share/xcat/netboot/esxi/48.esxifixup") {
mkpath($tempdir."/etc/init.d");
copy( "$::XCATROOT/share/xcat/netboot/esxi/48.esxifixup",$tempdir."/etc/init.d/48.esxifixup");
chmod(0755,"$tempdir/etc/init.d/48.esxifixup");
@ -5105,7 +5104,7 @@ sub cpNetbootImages {
}
}
}elsif ($osver =~ /esxi[56]/) { #we need boot.cfg.stateles
}elsif ($osver =~ /esxi5/) { #we need boot.cfg.stateles
my @filestocopy = ("boot.cfg.$bootmode");
if (-r "$srcDir/boot.cfg.$bootmode" or -r "$overridedir/boot.cfg.$bootmode") {
@filestocopy = ("boot.cfg.$bootmode");

View File

@ -81,7 +81,7 @@ sub preprocess_request {
my (@fspnodes, @nohandle);
xCAT::Utils->filter_nodes($arg1, undef, \@fspnodes, undef, \@nohandle);
if (@fspnodes) {
$arg1->{node} = \@fspnodes;
$arg1->{noderange} = \@fspnodes;
} else {
return [];
}

View File

@ -168,36 +168,11 @@ sub process_request {
return 1;
}
$pkglist = $ref_linuximage_tab->{'pkglist'};
if ($pkglist ne "") {
foreach my $file (split ',', $pkglist) {
if (! -r $file) {
$callback->({error=>["The pkglist specified \'$file\' does not exist!"],errorcode=>[1]});
return 1;
}
}
}
$srcdir = $ref_linuximage_tab->{'pkgdir'};
$srcdir_otherpkgs = $ref_linuximage_tab->{'otherpkgdir'};
$otherpkglist = $ref_linuximage_tab->{'otherpkglist'};
if ($otherpkglist ne "") {
foreach my $file (split ',', $otherpkglist) {
if (! -r $file) {
$callback->({error=>["The otherpkglist specified \'$file\' does not exist!"],errorcode=>[1]});
return 1;
}
}
}
$postinstall_filename = $ref_linuximage_tab->{'postinstall'};
if ($postinstall_filename ne "") {
foreach my $file (split ',', $postinstall_filename) {
if (! -r $file) {
$callback->({error=>["The postinstall_filename specified \'$file\' does not exist!"],errorcode=>[1]});
return 1;
}
}
}
$destdir = $ref_linuximage_tab->{'rootimgdir'};
$rootimg_dir = $ref_linuximage_tab->{'rootimgdir'};
$driverupdatesrc = $ref_linuximage_tab->{'driverupdatesrc'};
@ -317,7 +292,7 @@ sub process_request {
if ($interactive) { $cmd .= " --interactive" }
if ($onlyinitrd) { $cmd .= " --onlyinitrd" }
if ($srcdir) { $cmd .= " --srcdir \"$srcdir\"";}
if ($srcdir) { $cmd .= " --srcdir $srcdir";}
if ($pkglist) { $cmd .= " --pkglist $pkglist";}
if ($srcdir_otherpkgs) { $cmd .= " --otherpkgdir \"$srcdir_otherpkgs\""; }
if ($otherpkglist) { $cmd .= " --otherpkglist $otherpkglist"; }

View File

@ -201,7 +201,7 @@ sub geninitrd {
return;
}
} elsif ($arch =~ /ppc/) {
if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)|(pkvm.*)/) {
if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)/) {
$kernelpath = "$tftppath/vmlinuz";
copy("$pkgdir/ppc/ppc64/vmlinuz", $kernelpath);
if (-r "$pkgdir/ppc/ppc64/ramdisk.image.gz") {

View File

@ -26,10 +26,8 @@ my %usage = (
"nodeset" => "Usage: nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=<imagename>]|offline]",
);
sub handled_commands {
# process noderes:netboot like "grub2-<transfer protocol>"
# such as grub2-http and grub2-tftp
return {
nodeset => "noderes:netboot=(grub2[-]?.*)"
nodeset => "noderes:netboot"
}
}
@ -132,29 +130,17 @@ sub setstate {
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
}
}
my $addkcmdline;
if ($kern->{addkcmdline}) {
$addkcmdline .= $kern->{addkcmdline}." ";
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
}
if($linuximghash and $linuximghash->{'addkcmdline'})
{
unless($linuximghash->{'boottarget'})
{
$addkcmdline .= $linuximghash->{'addkcmdline'}." ";
$kern->{kcmdline} .= " ".$linuximghash->{'addkcmdline'};
}
}
my $cmdhashref;
if($addkcmdline){
$cmdhashref=xCAT::Utils->splitkcmdline($addkcmdline);
}
if($cmdhashref and $cmdhashref->{volatile})
{
$kern->{kcmdline}.=" ".$cmdhashref->{volatile};
}
my $pcfg;
unless (-d "$tftpdir/boot/grub2") {
@ -203,47 +189,20 @@ sub setstate {
}
$tftpserverip{$tftpserver} = $serverip;
}
my $grub2protocol="tftp";
if (defined ($nrhash{$node}->[0]) && $nrhash{$node}->[0]->{'netboot'}
&& ($nrhash{$node}->[0]->{'netboot'} =~ /grub2-(.*)/)) {
$grub2protocol = $1;
}
unless($grub2protocol =~ /^http|tftp$/ ){
$::callback->(
{
error => [
"Invalid netboot method, please check noderes.netboot for $node"
],
errorcode => [1]
}
);
return;
}
print $pcfg "set default=\"xCAT OS Deployment\"\n";
print $pcfg "menuentry \"xCAT OS Deployment\" {\n";
print $pcfg " insmod http\n";
print $pcfg " insmod tftp\n";
print $pcfg " set root=$grub2protocol,$serverip\n";
print $pcfg " set root=http,$serverip\n";
print $pcfg " echo Loading Install kernel ...\n";
my $protocolrootdir="";
if($grub2protocol =~ /^http$/)
{
$protocolrootdir=$tftpdir;
}
if ($kern and $kern->{kcmdline}) {
print $pcfg " linux $protocolrootdir/$kern->{kernel} $kern->{kcmdline}\n";
print $pcfg " linux $tftpdir/$kern->{kernel} $kern->{kcmdline}\n";
} else {
print $pcfg " linux $protocolrootdir/$kern->{kernel}\n";
print $pcfg " linux $tftpdir/$kern->{kernel}\n";
}
print $pcfg " echo Loading initial ramdisk ...\n";
if ($kern and $kern->{initrd}) {
print $pcfg " initrd $protocolrootdir/$kern->{initrd}\n";
print $pcfg " initrd $tftpdir/$kern->{initrd}\n";
}
print $pcfg "}";
@ -498,7 +457,7 @@ sub process_request {
my $mactab=xCAT::Table->new('mac',-create=>1);
my $machash=$mactab->getNodesAttribs(\@nodes,['mac']);
my $nrtab=xCAT::Table->new('noderes',-create=>1);
my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode','tftpserver','xcatmaster','netboot']);
my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode','tftpserver','xcatmaster']);
my $typetab=xCAT::Table->new('nodetype',-create=>1);
my $typehash=$typetab->getNodesAttribs(\@nodes,['os','provmethod','arch','profile']);
my $linuximgtab=xCAT::Table->new('linuximage',-create=>1);

View File

@ -26,7 +26,6 @@ use xCAT::TableUtils;
use xCAT::IMMUtils;
use xCAT::ServiceNodeUtils;
use xCAT::SvrUtils;
use xCAT::NetworkUtils;
use xCAT::Usage;
use Thread qw(yield);
use LWP 5.64;
@ -1230,8 +1229,6 @@ sub getrvidparms_imm2 {
return;
}
my $host = $sessdata->{ipmisession}->{bmc};
my $hostname;
($hostname, $host) = xCAT::NetworkUtils->gethostnameandip($host);
my $ip6mode=0;
if ($host =~ /:/) { $ip6mode=1; $host = "[".$host."]"; }
my $message = "user=".$sessdata->{ipmisession}->{userid}."&password=".$sessdata->{ipmisession}->{password}."&SessionTimeout=1200";
@ -1255,15 +1252,15 @@ sub getrvidparms_imm2 {
$response = $browser->request(GET $baseurl."data/logout");
return;
}
$response = $browser->request(GET $baseurl."designs/imm/viewer(".$host.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp)');
$response = $browser->request(GET $baseurl."designs/imm/viewer(".$sessdata->{ipmisession}->{bmc}.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp)');
#arguments are host, then ipv6 or not, then timestamp, then whether to encrypte or not, singleusermode, finally 'notwin32'
my $jnlp = $response->content;
unless ($jnlp) { #ok, might be the newer syntax...
$response = $browser->request(GET $baseurl."designs/imm/viewer(".$host.'@'.$httpport.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp'.'@USERID@0@0@0@0'.')');
$response = $browser->request(GET $baseurl."designs/imm/viewer(".$sessdata->{ipmisession}->{bmc}.'@'.$httpport.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp'.'@USERID@0@0@0@0'.')');
#arguments are host, then ipv6 or not, then timestamp, then whether to encrypte or not, singleusermode, finally 'notwin32'
$jnlp = $response->content;
if ($jnlp =~ /Failed to parse ip format for request/) {
$response = $browser->request(GET $baseurl."designs/imm/viewer(".$host.'@'.$httpport.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp'.'@USERID@0@0@0@0@0'.')');
$response = $browser->request(GET $baseurl."designs/imm/viewer(".$sessdata->{ipmisession}->{bmc}.'@'.$httpport.'@'.$ip6mode.'@'.time().'@1@0@1@jnlp'.'@USERID@0@0@0@0@0'.')');
#arguments are host, then ipv6 or not, then timestamp, then whether to encrypte or not, singleusermode, 'notwin32', and one more (unknown)
$jnlp = $response->content;
}
@ -2577,41 +2574,31 @@ sub initfru_zero {
$sessdata->{genhwfru} = [];
foreach $key (sort {$sdr_hash{$a}->id_string cmp $sdr_hash{$b}->id_string} keys %sdr_hash) {
my $sdr = $sdr_hash{$key};
unless ($sdr->rec_type == 0x11) { #skip non fru sdr stuff
unless ($sdr->rec_type == 0x11 and $sdr->fru_type == 0x10) { #skip non fru sdr stuff and frus I don't understand
next;
}
if ($sdr->fru_subtype == 0x1) { #DIMM
push @{$sessdata->{dimmfru}},$sdr;
} elsif ($sdr->fru_subtype == 0 or $sdr->fru_subtype == 2) {
push @{$sessdata->{genhwfru}},$sdr;
if ($sdr->fru_type == 0x10) { #supported
if ($sdr->fru_subtype == 0x1) { #DIMM
push @{$sessdata->{dimmfru}},$sdr;
} elsif ($sdr->fru_subtype == 0 or $sdr->fru_subtype == 2) {
push @{$sessdata->{genhwfru}},$sdr;
}
}
}
if (scalar @{$sessdata->{dimmfru}}) {
$sessdata->{currfrusdr} = shift @{$sessdata->{dimmfru}};
while ($sessdata->{currfrusdr}->sensor_number == 0 and scalar @{$sessdata->{dimmfru}}) {
$sessdata->{currfrusdr} = shift @{$sessdata->{dimmfru}};
}
if ($sessdata->{currfrusdr}->sensor_number !=0) {
$sessdata->{currfruid} = $sessdata->{currfrusdr}->sensor_number;
$sessdata->{currfrutype}="dimm";
$sessdata->{ipmisession}->subcmd(netfn=>0xa,command=>0x10,data=>[$sessdata->{currfruid}],callback=>\&process_currfruid,callback_args=>$sessdata);
return;
}
}
if (scalar @{$sessdata->{genhwfru}}) {
$sessdata->{currfruid} = $sessdata->{currfrusdr}->sensor_number;
$sessdata->{currfrutype}="dimm";
$sessdata->{ipmisession}->subcmd(netfn=>0xa,command=>0x10,data=>[$sessdata->{currfruid}],callback=>\&process_currfruid,callback_args=>$sessdata);
} elsif (scalar @{$sessdata->{genhwfru}}) {
$sessdata->{currfrusdr} = shift @{$sessdata->{genhwfru}};
while ($sessdata->{currfrusdr}->sensor_number == 0 and scalar @{$sessdata->{genhwfru}}) {
$sessdata->{currfrusdr} = shift @{$sessdata->{genhwfru}};
}
if ($sessdata->{currfrusdr}->sensor_number !=0) {
$sessdata->{currfruid} = $sessdata->{currfrusdr}->sensor_number;
$sessdata->{currfrutype}="genhw";
$sessdata->{ipmisession}->subcmd(netfn=>0xa,command=>0x10,data=>[$sessdata->{currfruid}],callback=>\&process_currfruid,callback_args=>$sessdata);
return;
}
$sessdata->{currfruid} = $sessdata->{currfrusdr}->sensor_number;
$sessdata->{currfrutype}="genhw";
$sessdata->{ipmisession}->subcmd(netfn=>0xa,command=>0x10,data=>[$sessdata->{currfruid}],callback=>\&process_currfruid,callback_args=>$sessdata);
} else {
fru_initted($sessdata);
}
fru_initted($sessdata);
}
sub get_frusize {
my $fruid=shift;
@ -2878,29 +2865,17 @@ sub add_fruhash {
}
if (scalar @{$sessdata->{dimmfru}}) {
$sessdata->{currfrusdr} = shift @{$sessdata->{dimmfru}};
while ($sessdata->{currfrusdr}->sensor_number == 0 and scalar @{$sessdata->{dimmfru}}) {
$sessdata->{currfrusdr} = shift @{$sessdata->{dimmfru}};
}
if ($sessdata->{currfrusdr}->sensor_number != 0) {
$sessdata->{currfruid} = $sessdata->{currfrusdr}->sensor_number;
$sessdata->{currfrutype}="dimm";
$sessdata->{ipmisession}->subcmd(netfn=>0xa,command=>0x10,data=>[$sessdata->{currfruid}],callback=>\&process_currfruid,callback_args=>$sessdata);
return;
}
}
if (scalar @{$sessdata->{genhwfru}}) {
$sessdata->{currfruid} = $sessdata->{currfrusdr}->sensor_number;
$sessdata->{currfrutype}="dimm";
$sessdata->{ipmisession}->subcmd(netfn=>0xa,command=>0x10,data=>[$sessdata->{currfruid}],callback=>\&process_currfruid,callback_args=>$sessdata);
} elsif (scalar @{$sessdata->{genhwfru}}) {
$sessdata->{currfrusdr} = shift @{$sessdata->{genhwfru}};
while ($sessdata->{currfrusdr}->sensor_number == 0 and scalar @{$sessdata->{genhwfru}}) {
$sessdata->{currfrusdr} = shift @{$sessdata->{genhwfru}};
}
if ($sessdata->{currfrusdr}->sensor_number != 0) {
$sessdata->{currfruid} = $sessdata->{currfrusdr}->sensor_number;
$sessdata->{currfrutype}="genhw";
$sessdata->{ipmisession}->subcmd(netfn=>0xa,command=>0x10,data=>[$sessdata->{currfruid}],callback=>\&process_currfruid,callback_args=>$sessdata);
return;
}
$sessdata->{currfruid} = $sessdata->{currfrusdr}->sensor_number;
$sessdata->{currfrutype}="genhw";
$sessdata->{ipmisession}->subcmd(netfn=>0xa,command=>0x10,data=>[$sessdata->{currfruid}],callback=>\&process_currfruid,callback_args=>$sessdata);
} else {
fru_initted($sessdata);
}
fru_initted($sessdata);
}
sub readcurrfrudevice {
@ -3101,15 +3076,8 @@ sub parsefru {
return "unknown-COULDGUESS",undef;
}
$currsize=($bytes->[$curridx+1])*8;
# some systems have malformed board info
# Just in case, give the board area parser access to end
# of total area unless product or multirecord is there
my $endidx = $#{$bytes};
if ($bytes->[4] or $bytes->[5]) {
$endidx = $curridx + $currsize - 1;
}
if ($currsize > 0) {
@currarea=@{$bytes}[$curridx..$endidx];
@currarea=@{$bytes}[$curridx..($curridx+$currsize-1)];
$fruhash->{board} = parseboard(@currarea);
}
}

View File

@ -1346,16 +1346,16 @@ sub addkit
} else {
$rc = system("cp -rf $kitdir/other_files/$_ $installdir/postscripts/");
}
if($rc && !-e "$installdir/postscripts/$_"){
my %rsp;
push@{ $rsp{data} }, "Failed to copy scripts from $kitdir/scripts/ to $installdir/postscripts";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
}
$rc = 0;
chmod(0755,"$installdir/postscripts/$_");
}
if($rc){
my %rsp;
push@{ $rsp{data} }, "Failed to copy scripts from $kitdir/scripts/ to $installdir/postscripts";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
}
# Copying plugins to /opt/xcat/lib/perl/xCAT_plugin/
if ( -d "$kitdir/plugins/" ) {
@ -2748,13 +2748,9 @@ sub rmkitcomp
my %newosikitcomponents;
foreach my $allosikitcomp (@allosikitcomps) {
if ( $allosikitcomp->{kitcomponents} and $allosikitcomp->{imagename} ) {
(my $allosiotherpkgdir) = $tabs{linuximage}->getAttribs({imagename=> $allosikitcomp->{imagename}}, 'otherpkgdir');
my @allkitcomps = split /,/, $allosikitcomp->{kitcomponents};
foreach my $allkitcomp ( @allkitcomps ) {
if ( (($allosikitcomp->{imagename} ne $osimage) and
($allosiotherpkgdir->{otherpkgdir} eq $otherpkgdir))
or ($allkitcomp ne $kitcomponent) ) {
if ( $allosikitcomp->{imagename} ne $osimage or $allkitcomp ne $kitcomponent ) {
$newosikitcomponents{$allkitcomp} = 1;
}
}

View File

@ -287,7 +287,6 @@ sub lskmodules {
}
return ( $rc - 1 );
}
if ($::VERBOSE) {
my $rsp;
push @{ $rsp->{data} }, "Running lskmodules command... ";
@ -302,7 +301,7 @@ sub lskmodules {
xCAT::MsgUtils->message( "E", $rsp, $::CALLBACK );
return 1;
}
# Get the list of kernel modules in each rpm/img file
my @modlist;
foreach my $source (@sources) {
@ -310,12 +309,7 @@ sub lskmodules {
$source =~ s/^dud://;
push (@modlist, &mods_in_img($source) );
} else {
my $osver = xCAT::Utils->osver();
if ($osver =~ /ubuntu/) {
$source =~ s/^deb://;
}else{
$source =~ s/^rpm://;
}
$source =~ s/^rpm://;
push (@modlist, &mods_in_rpm($source) );
}
}
@ -334,7 +328,7 @@ sub lskmodules {
push @{ $rsp->{data} }, $mn->{name}.': '.$mn->{description};
}
}
#xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK );
if ( $rsp ) {
$::CALLBACK->($rsp);
}
@ -449,7 +443,7 @@ sub set_sources {
if ( defined($::opt_u) ) {
my $outab = xCAT::Table->new('osdistroupdate');
foreach my $ou (split( ',', $::opt_u)) {
my ($ou_entry) = $outab->getAttribs({'osupdatename'=>$ou},('dirpath','basename'));
my ($ou_entry) = $outab->getAttribs({'osupdatename'=>$ou},('dirpath'));
if ( !($ou_entry) || !(defined($ou_entry->{'dirpath'})) ) {
if ($::VERBOSE) {
my $rsp;
@ -459,16 +453,7 @@ sub set_sources {
next;
}
my $dirpath = $ou_entry->{'dirpath'};
my @kernel_rpms = ();
if ($ou_entry->{'basename'} =~ /^ubuntu/)
{
@kernel_rpms = `find $dirpath/pool/main/l/linux/ -name *deb`;
}
else
{
@kernel_rpms = `find $dirpath -name kernel-*.rpm`;
}
my @kernel_rpms = `find $dirpath -name kernel-*.rpm`;
foreach my $krpm (@kernel_rpms) {
chomp($krpm);
my $base_krpm = basename($krpm);
@ -492,13 +477,13 @@ sub set_sources {
if ( defined($::opt_o) ) {
my $odtab = xCAT::Table->new('osdistro');
foreach my $od (split( ',', $::opt_o)) {
my ($od_entry) = $odtab->getAttribs({'osdistroname'=>$od},('dirpaths','basename'));
my ($od_entry) = $odtab->getAttribs({'osdistroname'=>$od},('dirpaths'));
if ( !($od_entry) ) {
# try building dirpath from distro_name/local_arch
my $arch = `uname -m`;
chomp($arch);
$arch = "x86" if ($arch =~ /i.86$/);
my $dirpath = $installdir.'/'.$od.'/'.$arch;
my $dirpath = $installdir.'/'.$od.'/'.$arch;
if (!(-e $dirpath)) {
if ($::VERBOSE) {
my $rsp;
@ -507,17 +492,7 @@ sub set_sources {
}
next;
}
my @kernel_rpms = ();
if ($od_entry->{'basename'} =~ /ubuntu/)
{
@kernel_rpms = `find $dirpath/pool/main/l/linux/ -name *deb`;
}
else
{
@kernel_rpms = `find $dirpath -name kernel-*.rpm`;
}
my @kernel_rpms = `find $dirpath -name kernel-*.rpm`;
foreach my $krpm (@kernel_rpms) {
chomp($krpm);
my $base_krpm = basename($krpm);
@ -529,16 +504,7 @@ sub set_sources {
}
} else {
foreach my $dirpath (split( ',', $od_entry->{'dirpaths'})){
my @kernel_rpms = ();
if ($od_entry->{'basename'} =~ /ubuntu/)
{
@kernel_rpms = `find $dirpath/pool/main/l/linux/ -name *deb`;
}
else
{
@kernel_rpms = `find $dirpath -name kernel-*.rpm`;
}
#my @kernel_rpms = `find $dirpath -name kernel-*.rpm`;
my @kernel_rpms = `find $dirpath -name kernel-*.rpm`;
foreach my $krpm (@kernel_rpms) {
chomp($krpm);
my $base_krpm = basename($krpm);
@ -607,24 +573,14 @@ sub mods_in_rpm {
my $tmp_path = "/tmp/lskmodules_expanded_rpm";
mkpath($tmp_path);
if (-r $krpm) {
my $osver = xCAT::Utils->osver();
if ($osver =~ /ubuntu/) {
if (system ("cd $tmp_path; dpkg -X $krpm $tmp_path > /dev/null 2>&1 ; cd - > /dev/null 2>&1")) {
my $rsp;
push @{ $rsp->{data} }, "Unable to extract files from the deb package $krpm.";
xCAT::MsgUtils->message( "E", $rsp, $::CALLBACK );
rmtree($tmp_path);
return;}
}else{
if (system ("cd $tmp_path; rpm2cpio $krpm | cpio -idum *.ko > /dev/null 2>&1 ; cd - > /dev/null 2>&1")) {
my $rsp;
push @{ $rsp->{data} }, "Unable to extract files from the rpm $krpm.";
xCAT::MsgUtils->message( "E", $rsp, $::CALLBACK );
rmtree($tmp_path);
return;
}
}
}else{
if (system ("cd $tmp_path; rpm2cpio $krpm | cpio -idum *.ko > /dev/null 2>&1 ; cd - > /dev/null 2>&1")) {
my $rsp;
push @{ $rsp->{data} }, "Unable to extract files from the rpm $krpm.";
xCAT::MsgUtils->message( "E", $rsp, $::CALLBACK );
rmtree($tmp_path);
return;
}
} else {
my $rsp;
push @{ $rsp->{data} }, "Unable to read rpm $krpm.";
xCAT::MsgUtils->message( "E", $rsp, $::CALLBACK );

38
xCAT-server/lib/xcat/plugins/kvm.pm Executable file → Normal file
View File

@ -37,10 +37,14 @@ my $parser;
my @destblacklist;
my $updatetable; #when a function is performing per-node operations, it can queue up a table update by populating parts of this hash
my $confdata; #a reference to serve as a common pointer betweer VMCommon functions and this plugin
require Sys::Virt;
if (Sys::Virt->VERSION =~ /^0\.[10]\./) {
my $libvirtsupport;
$libvirtsupport = eval {
require Sys::Virt;
if (Sys::Virt->VERSION =~ /^0\.[10]\./) {
die;
}
}
1;
};
use XML::Simple;
$XML::Simple::PREFERRED_PARSER='XML::Parser';
@ -63,6 +67,9 @@ my $callback;
my $requester; #used to track the user
sub handled_commands {
#unless ($libvirtsupport) {
# return {};
#}
return {
rpower => 'nodehm:power,mgt',
mkvm => 'nodehm:power,mgt',
@ -549,11 +556,9 @@ sub build_diskstruct {
}
}
my $cdprefix='hd';
# device name vd* doesn't work for CDROM, so delete it.
#if ($storagemodel eq 'virtio') {
# $cdprefix='vd';
#} els
if ($storagemodel eq 'scsi') {
if ($storagemodel eq 'virtio') {
$cdprefix='vd';
} elsif ($storagemodel eq 'scsi') {
$cdprefix='sd';
}
$suffidx += 1;
@ -2573,7 +2578,7 @@ sub adopt {
if ($confdata->{vm}->{$node}->[0]->{memory}) {
$addmemory{$target}+=getUnits($confdata->{vm}->{$node}->[0]->{memory},"M",1024);
} else {
$addmemory{$target}+=getUnits("4096","M",1024);
$addmemory{$target}+=getUnits("512","M",1024);
}
$hyphash{$target}->{nodes}->{$node}=1;
delete $orphash->{$node};
@ -2606,9 +2611,18 @@ sub process_request {
$requester=$request->{_xcat_authname}->[0];
}
$callback = shift;
require Sys::Virt;
if ( xCAT::Utils::version_cmp(Sys::Virt->VERSION, "0.2.0") < 0 ) {
die;
unless ($libvirtsupport) {
$libvirtsupport = eval {
require Sys::Virt;
if ( xCAT::Utils::version_cmp(Sys::Virt->VERSION, "0.2.0") < 0 ) {
die;
}
1;
};
}
unless ($libvirtsupport) { #Still no Sys::Virt module
$callback->({error=>"Sys::Virt perl module missing or older than 0.2.0, unable to fulfill KVM plugin requirements",errorcode=>[42]});
return [];
}
require Sys::Virt::Domain;
%runningstates = (&Sys::Virt::Domain::STATE_NOSTATE=>1,&Sys::Virt::Domain::STATE_RUNNING=>1,&Sys::Virt::Domain::STATE_BLOCKED=>1);

View File

@ -171,7 +171,7 @@ my %globalnodetype = (
ivm => $::NODETYPE_PPC,
cmm => $::NODETYPE_MP,
lpar =>"$::NODETYPE_PPC,$::NODETYPE_OSI",
pbmc => $::NODETYPE_MP,
pbmc => $::NODETYPE_PPC,
);
my %globalmgt = (
fsp => "fsp",
@ -1128,10 +1128,6 @@ sub parse_responses {
$atthash{ip} = ${$searchmacs{$rsp}}{peername};
$atthash{url} = ${$searchmacs{$rsp}}{payload};
$atthash{hostname} = 'Server-'.$atthash{mtm}.'-SN'.$atthash{serial};
if (exists($::OLD_DATA_CACHE{"mp*".$atthash{mtm}."*".$atthash{serial}})) {
$atthash{hostname} = $::OLD_DATA_CACHE{"mp*".$atthash{mtm}."*".$atthash{serial}};
push @matchnode, 'Server-'.$atthash{mtm}.'-SN'.$atthash{serial};
}
$outhash{'Server-'.$atthash{mtm}.'-SN'.$atthash{serial}} = \%atthash;
}elsif (($type eq SERVICE_FSP) && (${$attributes->{'machinetype-model'}}[0] =~ /^7895|1457|7954/ )) {
@ -1500,7 +1496,7 @@ sub xCATdB {
$machash{$hostname} = {mac=>$mac} if ($type =~ /^fsp|bpa$/);
} elsif ( $type =~ /^pbmc$/) {
$nodelisthash{$hostname} = {groups=>$groups, hidden=>$hidden};
$mphash{$hostname} = {nodetype=>$globalhwtype{$type}};
$ppchash{$hostname} = {nodetype=>$globalhwtype{$type}};
$vpdhash{$hostname} = {mtm=>$model, serial=>$serial};
$nodehmhash{$hostname} = {mgt=>$globalmgt{$type}};
$nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}};

View File

@ -194,9 +194,6 @@ sub process_request {
unless ($nent and $nent->{supportedarchs} eq $request->{arch}->[0] and $nent->{arch} eq $request->{arch}->[0]) {
$typetab->setNodeAttribs($node,{arch=>$request->{arch}->[0],supportedarchs=>$request->{arch}->[0]});
}
if ($request->{arch}->[0] =~ /ppc/ and $request->{platform}->[0] =~ /PowerNV/) {
$typetab->setNodeAttribs($node,{nodetype=>'mp'});
}
}
my $currboot='';
$nrtab = xCAT::Table->new('noderes'); #Attempt to check and set if wrong the netboot method on discovery, if admin omitted

View File

@ -641,9 +641,9 @@ sub process_request_nmap {
foreach my $ip6 (0,1) { #first pass, ipv4, second pass ipv6
if ($ip6 and scalar(@ip6s)) {
open($fping,"nmap --unprivileged -6 -PS$ports,3001 -n --send-ip -p $ports,3001 $more_options ".join(' ',@ip6s). " 2> /dev/null|") or die("Can't start nmap: $!");
open($fping,"nmap -6 -PS$ports,3001 -n --send-ip -p $ports,3001 $more_options ".join(' ',@ip6s). " 2> /dev/null|") or die("Can't start nmap: $!");
} elsif (not $ip6 and scalar(@ips)) {
open($fping,"nmap --unprivileged -PE -n --send-ip -p $ports,3001 $more_options ".join(' ',@ips). " 2> /dev/null|") or die("Can't start nmap: $!");
open($fping,"nmap -PE -n --send-ip -p $ports,3001 $more_options ".join(' ',@ips). " 2> /dev/null|") or die("Can't start nmap: $!");
} else { next; }
while (<$fping>) {
if (/Interesting ports on ([^ ]*)[: ]/ or /Nmap scan report for ([^ ]*)/) {

View File

@ -402,13 +402,6 @@ sub process_request {
}
if ($errored) { return; }
# Fix the bug 4611: PowerNV stateful CN provision will hang at reboot stage#
if ($args[0] eq 'next') {
$sub_req->({command=>['rsetboot'],
node=>\@nodes,
arg=>['default']});
xCAT::MsgUtils->message("S", "xCAT: petitboot netboot: clear node(s): @nodes boot device setting.");
}
my $bptab=xCAT::Table->new('bootparams',-create=>1);
my $bphash = $bptab->getNodesAttribs(\@nodes,['kernel','initrd','kcmdline','addkcmdline']);
my $chaintab=xCAT::Table->new('chain',-create=>1);

View File

@ -42,10 +42,8 @@ my %allracks;
my %allchassis;
my %allswitches;
my %all_switchports;
my %allvmhosts;
my @switch_records;
my $netboot;
# The array of all chassis which is special CMM
my %allcmmchassis;
@ -382,13 +380,6 @@ Usage:
setrsp_errormsg($errmsg);
return;
}
# Get the netboot attribute for node
my ($retcode, $retval) = xCAT::ProfiledNodeUtils->get_netboot_attr($imageprofile, $hardwareprofile);
if (not $retcode) {
setrsp_errormsg($retval);
return;
}
$netboot = $retval;
# Get database records: all hostnames, all ips, all racks...
xCAT::MsgUtils->message('S', "Getting database records.");
@ -439,10 +430,6 @@ Usage:
# Get all LPAR ids
$recordsref = xCAT::ProfiledNodeUtils->get_all_lparids(\%allcecs);
%alllparids = %$recordsref;
# Get all vm hosts/hypervisiors
$recordsref = xCAT::ProfiledNodeUtils->get_all_vmhosts();
%allvmhosts = %$recordsref;
#TODO: can not use getallnode to get rack infos.
$recordsref = xCAT::ProfiledNodeUtils->get_all_rack(1);
@ -471,7 +458,6 @@ Usage:
my $mac_addr_mode = 0;
my $switch_mode = 0;
my $powerkvm_mode = 0;
# Parse and validate the hostinfo string. The real hostnames will be generated here.
xCAT::MsgUtils->message('S', "Parsing hostinfo string and validate it.");
my ($hostinfo_dict_ref, $invalid_records_ref) = validate_node_entries();
@ -500,10 +486,6 @@ Usage:
{
$switch_mode = 1;
}
if(defined($hostinfo_dict{$mynode}{'vmhost'}))
{
$powerkvm_mode = 1;
}
}
# cannot mix switch discovery with mac import
@ -540,20 +522,6 @@ Usage:
$warnstr = "Warning: failed to import some nodes.";
setrsp_progress($warnstr);
}
# create default uuid for PowerKVM nodes
if ($powerkvm_mode) {
my $vpdtab = xCAT::Table->new( 'vpd', -create=>1, -autocommit=>0 );
foreach (@nodelist) {
my $keyhash;
my $updatehash;
$keyhash->{'node'} = $_;
$updatehash->{'uuid'} = '00000000-0000-0000-0000-000000000000';
$vpdtab->setAttribs($keyhash, $updatehash);
}
$vpdtab->commit;
}
# create switch, port, interface relationship.
if($switch_mode){
#debug message.
@ -794,7 +762,6 @@ Usage:
my $nodelstab = xCAT::Table->new('nodelist');
my $nodeshashref = $nodelstab->getNodesAttribs($nodes, ['groups']);
my %updatenodeshash;
my %updatenodereshash;
my %nodeoldprofiles = ();
foreach (@$nodes){
@ -814,8 +781,6 @@ Usage:
$nodecurrprofiles{'networkprofile'} = $group;
}elsif ($group =~ /__HardwareProfile/){
$nodecurrprofiles{'hardwareprofile'} = $group;
}elsif ($group =~ /__Hypervisor/){
next;
}else{
$nodecurrprofiles{'groups'} .= $group.",";
}
@ -860,22 +825,6 @@ Usage:
if(exists $args_dict{'hardwareprofile'}){
$hardwareprofile = $args_dict{'hardwareprofile'};
}
# Verify whether this node is KVM hypervisor node
my $is_kvm_hypv = xCAT::ProfiledNodeUtils->is_kvm_hypv_node($imageprofile);
# Get the netboot attribute for node
my $new_netboot = undef;
my $latestimgproflie = $imageprofile?$imageprofile:$nodeoldprofiles{'imageprofile'};
my $latesthardwareprofile = $hardwareprofile?$hardwareprofile:$nodeoldprofiles{'hardwareprofile'};
if ($latestimgproflie){
my ($retcode, $retval) = xCAT::ProfiledNodeUtils->get_netboot_attr( $latestimgproflie, $latesthardwareprofile);
if (not $retcode) {
setrsp_errormsg($retval);
return;
}
$new_netboot = $retval;
}
# After checking, all nodes' profile should be same
# Get the new profile with specified ones in args_dict
@ -890,10 +839,7 @@ Usage:
xCAT::MsgUtils->message('S', "Specified networkprofile is same with current value, ignore.");
$networkprofile = undef;
}
}else{
$profile_groups .= $nodeoldprofiles{'networkprofile'}.",";
}
if($hardwareprofile){
$profile_groups .= $hardwareprofile . ",";
if ($hardwareprofile ne $nodeoldprofiles{'hardwareprofile'}){
@ -903,12 +849,7 @@ Usage:
xCAT::MsgUtils->message('S', "Specified hardwareprofile is same with current value, ignore.");
$hardwareprofile = undef;
}
}else{
if($nodeoldprofiles{'hardwareprofile'}){
$profile_groups .= $nodeoldprofiles{'hardwareprofile'}.",";
}
}
if($imageprofile){
$profile_groups .= $imageprofile . ",";
if ($imageprofile ne $nodeoldprofiles{'imageprofile'}){
@ -918,8 +859,6 @@ Usage:
xCAT::MsgUtils->message('S', "Specified imageprofile is same with current value, ignore.");
$imageprofile = undef;
}
}else{
$profile_groups .= $nodeoldprofiles{'imageprofile'}.",";
}
# make sure there are something changed, otherwise we should quit without any changes.
unless ($changeflag){
@ -930,22 +869,14 @@ Usage:
# Update nodes' attributes
foreach (@$nodes) {
$updatenodeshash{$_}{'groups'} .= $profile_groups;
if ($is_kvm_hypv) {
$updatenodeshash{$_}{'groups'} .= ",__Hypervisor_kvm";
}
if($new_netboot){
$updatenodereshash{$_}{'netboot'} = $new_netboot;
}
}
}
#update DataBase.
setrsp_progress("Updating database records...");
my $nodetab = xCAT::Table->new('nodelist',-create=>1);
$nodetab->setNodesAttribs(\%updatenodeshash);
$nodetab->close();
my $noderestab = xCAT::Table->new('noderes',-create=>1);
$noderestab->setNodesAttribs(\%updatenodereshash);
$noderestab->close();
#update node's status:
if($profile_status eq "defined"){
xCAT::Utils->runxcmd({command=>["updatenodestat"], node=>$nodes, arg=>['defined']}, $request_command, -1, 2);
@ -1842,16 +1773,6 @@ sub findme{
}
}
}
my $imageprofile = $args_dict{'imageprofile'};
my $networkprofile = $args_dict{'networkprofile'};
my $hardwareprofile = $args_dict{'hardwareprofile'};
# Get the netboot attribute for node
my ($retcode, $retval) = xCAT::ProfiledNodeUtils->get_netboot_attr($imageprofile, $hardwareprofile);
if (not $retcode) {
setrsp_errormsg($retval);
return;
}
$netboot = $retval;
# Get database records: all hostnames, all ips, all racks...
# To improve performance, we should initalize a daemon later??
@ -2055,9 +1976,6 @@ sub gen_new_hostinfo_dict{
# Check whether this is Power env.
my $is_fsp = xCAT::ProfiledNodeUtils->is_fsp_node($args_dict{'networkprofile'});
# Check whether this node is PowerKVM Hypervisor node
my $is_kvm_hypv = xCAT::ProfiledNodeUtils->is_kvm_hypv_node($args_dict{'imageprofile'});
foreach my $item (sort(keys %hostinfo_dict)){
# Set Nodes's type:
$hostinfo_dict{$item}{"objtype"} = 'node';
@ -2155,7 +2073,6 @@ sub gen_new_hostinfo_dict{
if (exists $args_dict{'imageprofile'}){$hostinfo_dict{$item}{"groups"} .= ",".$args_dict{'imageprofile'}}
if (exists $args_dict{'hardwareprofile'}){$hostinfo_dict{$item}{"groups"} .= ",".$args_dict{'hardwareprofile'}}
if (exists $args_dict{'groups'}){$hostinfo_dict{$item}{"groups"} .= ",".$args_dict{'groups'}}
if ($is_kvm_hypv) {$hostinfo_dict{$item}{"groups"} .= ",__Hypervisor_kvm"}
# xCAT limitation: slotid attribute only for power, id is for x.
if ((exists $hostinfo_dict{$item}{"slotid"}) && (! $is_fsp) ){
@ -2186,9 +2103,6 @@ sub gen_new_hostinfo_dict{
$hostinfo_dict{$item}{"mgt"} = "fsp";
}
# Set netboot attribute for node
$hostinfo_dict{$item}{"netboot"} = $netboot;
# get the chain attribute from hardwareprofile and insert it to node.
my $chaintab = xCAT::Table->new('chain');
my $hardwareprofile = $args_dict{'hardwareprofile'};
@ -2468,18 +2382,11 @@ sub validate_node_entry{
# validate if node use FSP network
my $is_fsp = xCAT::ProfiledNodeUtils->is_fsp_node($args_dict{'networkprofile'});
# Check whether this node is a KVM node
my $is_kvm = xCAT::ProfiledNodeUtils->is_kvm_node($args_dict{'hardwareprofile'});
if (not $node_entry{'vmhost'} and $is_kvm) {
# Using kvm hardware profile but not define vmhost in nodeinfo file
$errmsg .= "No vmhost specified. Specify a vmhost and set it to the node information file if you are using the default IBM_PowerKVM_Guest hardware profile.\n";
}
# validate each single value.
foreach (keys %node_entry){
if ($_ eq "mac"){
if (exists $allmacsupper{uc($node_entry{$_})}){
$errmsg .= "MAC address $node_entry{$_} already exists in the database or in the node information file. You must use a new MAC address.\n";
$errmsg .= "MAC address $node_entry{$_} already exists in the database or in the nodeinfo file. You must use a new MAC address.\n";
}elsif(! xCAT::NetworkUtils->isValidMAC($node_entry{$_})){
$errmsg .= "MAC address $node_entry{$_} is invalid. You must use a valid MAC address.\n";
}else{
@ -2488,7 +2395,7 @@ sub validate_node_entry{
}
}elsif ($_ eq "ip"){
if (exists $allips{$node_entry{$_}}){
$errmsg .= "IP address $node_entry{$_} already exists in the database or in the node information file.\n";
$errmsg .= "IP address $node_entry{$_} already exists in the database or in the nodeinfo file.\n";
}elsif((xCAT::NetworkUtils->validate_ip($node_entry{$_}))[0]->[0] ){
$errmsg .= "IP address $node_entry{$_} is invalid. You must use a valid IP address.\n";
}else {
@ -2531,7 +2438,7 @@ sub validate_node_entry{
# now, we need to check "swith_switchport" string list to avoid duplicate config
my $switch_port = $spilist[1] . "_" . $spilist[2];
if (exists $all_switchports{$switch_port}){
$errmsg .= "Specified switch $spilist[1] and port $spilist[2] already exists in the database or in the node information file. You must use a new switch port.\n";
$errmsg .= "Specified switch $spilist[1] and port $spilist[2] already exists in the database or in the nodeinfo file. You must use a new switch port.\n";
}else{
# after checking, add this one into all_switchports
$all_switchports{$switch_port} = 0;
@ -2607,7 +2514,7 @@ sub validate_node_entry{
}
if (exists $alllparids{$cec_name}{$lpar_id}){
$errmsg .= "The CEC name $cec_name and LPAR id $lpar_id already exist in the database or in the node information file. You must use a new CEC name and LPAR id.\n";
$errmsg .= "The CEC name $cec_name and LPAR id $lpar_id already exist in the database or in the nodeinfo file. You must use a new CEC name and LPAR id.\n";
}else{
$alllparids{$cec_name}{$lpar_id} = 0;
}
@ -2622,7 +2529,7 @@ sub validate_node_entry{
@nic_and_ips = split(/!/, $nic_ips);
$nic_ip = $nic_and_ips[1];
if (exists $allips{$nic_ip}){
$errmsg .= "IP address $nic_ip already exists in the database or in the node information file.\n";
$errmsg .= "IP address $nic_ip already exists in the database or in the nodeinfo file.\n";
}elsif((xCAT::NetworkUtils->validate_ip($nic_ip))[0]->[0] ){
$errmsg .= "IP address $nic_ip is invalid. You must use a valid IP address.\n";
}else {
@ -2631,17 +2538,6 @@ sub validate_node_entry{
}
}
}
}elsif ($_ eq "vmhost") {
# Support PowerKVM vms
my $vm_host= $node_entry{"vmhost"};
if (! exists $allvmhosts{$vm_host}){
$errmsg .= "Specified vmhost '$vm_host' is not defined in the system. Specify a correct vmhost.\n";
}
if (not $is_kvm) {
$errmsg .= "Incorrect vmhost '$vm_host' found in node information file. vmhost must be used together with the IBM_PowerKVM_Guest hardware profile\n";
}
}else{
$errmsg .= "Invalid attribute $_ specified\n";
}
@ -2668,7 +2564,7 @@ sub setrsp_invalidrecords
my $rsp;
# The total number of invalid records.
$rsp->{error} = ["Errors found in node information file"];
$rsp->{error} = ["Errors found in nodeinfo file"];
$rsp->{errorcode} = [2];
$rsp->{invalid_records_num}->[0] = scalar @$recordsref;

View File

@ -108,16 +108,6 @@ sub setstate {
my $kcmdlinehack = ($imgaddkcmdline)?$kern->{addkcmdline}." ".$imgaddkcmdline : $kern->{addkcmdline};
my $cmdhashref;
if($kcmdlinehack){
$cmdhashref=xCAT::Utils->splitkcmdline($kcmdlinehack);
}
if($cmdhashref and $cmdhashref->{volatile})
{
$kcmdlinehack=$cmdhashref->{volatile};
}
while ($kcmdlinehack =~ /#NODEATTRIB:([^:#]+):([^:#]+)#/) {
my $natab = xCAT::Table->new($1);

Some files were not shown because too many files have changed in this diff Show More