Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a8479cd85 | |||
| f3449882b3 | |||
| 8f3b04bd1a | |||
| abbd20549a |
@@ -1,88 +0,0 @@
|
||||
#!/bin/bash
|
||||
###########
|
||||
#
|
||||
# This script call make<package>deb and create the deb packages
|
||||
# for xCAT
|
||||
#
|
||||
# Author: Leonardo Tonetto <tonetto@linux.vnet.ibm.com>
|
||||
# Revisor: Adalberto Medeiros <adalbas@linux.vnet.ibm.com>
|
||||
# Revisor2: Arif Ali <aali@ocf.co.uk>
|
||||
#
|
||||
# Input:
|
||||
#
|
||||
# $1 is the build type/location
|
||||
# $2 is the string added to the debian/changelog of each package
|
||||
#
|
||||
############
|
||||
|
||||
##############
|
||||
# Get input
|
||||
##############
|
||||
|
||||
PKG_LOCATION=$1 # local | snap | alpha
|
||||
if [ -z $PKG_LOCATION ]; then
|
||||
PKG_LOCATION="local"
|
||||
fi
|
||||
BUILD_STRING=$2
|
||||
if [ -z $BUILD_STRING ]; then
|
||||
BUILD_STRING="Personal Build"
|
||||
fi
|
||||
XCAT_VERSION=`cat Version`
|
||||
TRUNK_REVISION=`svnversion | cut -d ":" -f1`
|
||||
CUR_DATE=`date +%Y%m%d`
|
||||
VERSION="${XCAT_VERSION}-${PKG_LOCATION}${CUR_DATE}"
|
||||
|
||||
function makedeb {
|
||||
SRC_ROOT=$1
|
||||
PKG_LOCATION=$2
|
||||
BUILD_STRING=$3
|
||||
VERSION=$4
|
||||
|
||||
#
|
||||
# Make DEBs
|
||||
#
|
||||
# build perl-xCAT - deps are libsoap-lite-perl, libdigest-sha1-perl, libdbi-perl
|
||||
#
|
||||
|
||||
find $SRC_ROOT -maxdepth 2 -name debian -type d | while read DEBIAN_DIR
|
||||
do
|
||||
DIR=`echo ${DEBIAN_DIR} | sed -e 's/[/]debian$//'`
|
||||
cd ${DIR}
|
||||
dch -v $VERSION -b -c debian/changelog "$BUILD_STRING"
|
||||
dpkg-buildpackage
|
||||
cd -
|
||||
RC=$?
|
||||
if [ ${RC} -gt 0 ]
|
||||
then
|
||||
echo "Warning: ${DEBIAN_DIR} failed exit code ${RC}"
|
||||
fi
|
||||
done
|
||||
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
# Eliminate unnecessary directories and debian/files made by dpkg-buildpackage
|
||||
|
||||
find $SRC_ROOT -maxdepth 3 -type d -name "xcat-*" | grep debian | xargs rm -rf
|
||||
find $SRC_ROOT -maxdepth 3 -type f -name "files" | grep debian | xargs rm -f
|
||||
}
|
||||
|
||||
# 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"
|
||||
|
||||
for file in `echo $packages`
|
||||
do
|
||||
makedeb $file $PKG_LOCATION "$BUILD_STRING" $VERSION
|
||||
done
|
||||
|
||||
if [ -d debs ]; then
|
||||
rm -rf debs
|
||||
fi
|
||||
|
||||
mkdir debs
|
||||
mv xcat* debs/
|
||||
mv perl-xcat* debs/
|
||||
|
||||
echo $VERSION > latest_version
|
||||
|
||||
exit 0
|
||||
+25
-73
@@ -53,7 +53,7 @@ for i in $*; do
|
||||
done
|
||||
|
||||
# Supported distributions
|
||||
dists="maverick natty oneiric precise saucy trusty"
|
||||
dists="maverick natty oneiric precise saucy"
|
||||
|
||||
c_flag= # xcat-core (trunk-delvel) path
|
||||
d_flag= # xcat-dep (trunk) path
|
||||
@@ -86,7 +86,7 @@ if [ "$c_flag" -a "$d_flag" ];then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
uploader="ligc"
|
||||
uploader="bp-sawyers"
|
||||
# Find where this script is located to set some build variables
|
||||
old_pwd=`pwd`
|
||||
cd `dirname $0`
|
||||
@@ -195,38 +195,26 @@ then
|
||||
mkdir -p "../../$package_dir_name"
|
||||
fi
|
||||
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal"
|
||||
target_archs=(amd64 ppc64el)
|
||||
|
||||
for file in `echo $packages`
|
||||
do
|
||||
file_low=`echo $file | tr '[A-Z]' '[a-z]'`
|
||||
if [ "$file" = "xCAT" ]; then
|
||||
target_archs="amd64 ppc64el"
|
||||
else
|
||||
target_archs="all"
|
||||
fi
|
||||
for target_arch in `echo $target_archs`
|
||||
do
|
||||
if grep -q $file $update_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then
|
||||
rm -f ../../$package_dir_name/${file_low}_*.$target_arch.deb
|
||||
#only for genesis package
|
||||
rm -f ../../$package_dir_name/${file_low}-amd64_*.deb
|
||||
cd $file
|
||||
dch -v $pkg_version -b -c debian/changelog $build_string
|
||||
if [ "$target_arch" = "all" ]; then
|
||||
dpkg-buildpackage -uc -us
|
||||
else
|
||||
dpkg-buildpackage -uc -us -a$target_arch
|
||||
fi
|
||||
rc=$?
|
||||
if [ $rc -gt 0 ]; then
|
||||
echo "Error: $file build package failed exit code $rc"
|
||||
fi
|
||||
cd -
|
||||
find $file -maxdepth 3 -type d -name "${file_low}*" | grep debian | xargs rm -rf
|
||||
find $file -maxdepth 3 -type f -name "files" | grep debian | xargs rm -rf
|
||||
mv ${file_low}* ../../$package_dir_name/
|
||||
if grep -q $file $update_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then
|
||||
rm -f ../../$package_dir_name/${file_low}_*.deb
|
||||
#only for genesis package
|
||||
rm -f ../../$package_dir_name/${file_low}-amd64_*.deb
|
||||
cd $file
|
||||
dch -v $pkg_version -b -c debian/changelog $build_string
|
||||
dpkg-buildpackage -uc -us
|
||||
rc=$?
|
||||
if [ $rc -gt 0 ]; then
|
||||
echo "Error: $file build package failed exit code $rc"
|
||||
fi
|
||||
done
|
||||
cd -
|
||||
find $file -maxdepth 3 -type d -name "${file_low}*" | grep debian | xargs rm -rf
|
||||
find $file -maxdepth 3 -type f -name "files" | grep debian | xargs rm -rf
|
||||
mv ${file_low}* ../../$package_dir_name/
|
||||
fi
|
||||
done
|
||||
|
||||
find ../../$package_dir_name/* ! -name *.deb | xargs rm -f
|
||||
@@ -262,16 +250,11 @@ then
|
||||
mkdir conf
|
||||
|
||||
for dist in $dists; do
|
||||
if [ "$dist" = "trusty" ]; then
|
||||
tmp_out_arch="amd64 ppc64el"
|
||||
else
|
||||
tmp_out_arch="amd64"
|
||||
fi
|
||||
cat << __EOF__ >> conf/distributions
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-core bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: $tmp_out_arch
|
||||
Architectures: amd64
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
SignWith: yes
|
||||
@@ -286,29 +269,17 @@ basedir .
|
||||
__EOF__
|
||||
|
||||
#import the deb packages into the repo
|
||||
amd_files=`ls ../$package_dir_name/*.deb | grep -v "ppc64el"`
|
||||
all_files=`ls ../$package_dir_name/*.deb`
|
||||
for dist in $dists; do
|
||||
if [ "$dist" = "trusty" ]; then
|
||||
deb_files=$all_files
|
||||
else
|
||||
deb_files=$amd_files
|
||||
fi
|
||||
for file in $deb_files; do
|
||||
for file in `ls ../$package_dir_name/*.deb`; do
|
||||
reprepro -b ./ includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
|
||||
#create the mklocalrepo script
|
||||
cat << '__EOF__' > mklocalrepo.sh
|
||||
. /etc/lsb-release
|
||||
cd `dirname $0`
|
||||
host_arch=`uname -m`
|
||||
if [ "$host_arch" != "ppc64le" ];then
|
||||
host_arch="amd64"
|
||||
else
|
||||
host_arch="ppc64el"
|
||||
fi
|
||||
echo deb [arch=$host_arch] file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-core.list
|
||||
echo deb file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-core.list
|
||||
__EOF__
|
||||
|
||||
chmod 775 mklocalrepo.sh
|
||||
@@ -382,16 +353,11 @@ then
|
||||
|
||||
#create the conf/distributions file
|
||||
for dist in $dists; do
|
||||
if [ "$dist" = "trusty" ]; then
|
||||
tmp_out_arch="amd64 ppc64el"
|
||||
else
|
||||
tmp_out_arch="amd64"
|
||||
fi
|
||||
cat << __EOF__ >> conf/distributions
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-dep bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: $tmp_out_arch
|
||||
Architectures: amd64
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
SignWith: yes
|
||||
@@ -405,16 +371,8 @@ ask-passphrase
|
||||
basedir .
|
||||
__EOF__
|
||||
|
||||
#import the deb packages into the repo
|
||||
amd_files=`ls ../debs/*.deb | grep -v "ppc64el"`
|
||||
all_files=`ls ../debs/*.deb`
|
||||
for dist in $dists; do
|
||||
if [ "$dist" = "trusty" ]; then
|
||||
deb_files=$all_files
|
||||
else
|
||||
deb_files=$amd_files
|
||||
fi
|
||||
for file in $deb_files; do
|
||||
for file in `ls ../debs/*.deb`; do
|
||||
reprepro -b ./ includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
@@ -422,13 +380,7 @@ __EOF__
|
||||
cat << '__EOF__' > mklocalrepo.sh
|
||||
. /etc/lsb-release
|
||||
cd `dirname $0`
|
||||
host_arch=`uname -m`
|
||||
if [ "$host_arch" != "ppc64le" ];then
|
||||
host_arch="amd64"
|
||||
else
|
||||
host_arch="ppc64el"
|
||||
fi
|
||||
echo deb [arch=$host_arch] file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-dep.list
|
||||
echo deb file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-dep.list
|
||||
__EOF__
|
||||
|
||||
chmod 775 mklocalrepo.sh
|
||||
|
||||
+2
-5
@@ -44,10 +44,8 @@ FRS=/home/frs/project/x/xc/xcat
|
||||
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"
|
||||
ZVMBUILD="perl-xCAT xCAT-server xCAT-UI"
|
||||
ZVMLINK="xCAT-client xCAT xCATsn"
|
||||
# xCAT has PCM specific configuration - conserver-xcat, syslinux-xcat
|
||||
# xCAT-server has PCM specific configuration - RESTAPI(perl-JSON)
|
||||
PCMBUILD="xCAT xCAT-server"
|
||||
PCMLINK="perl-xCAT xCAT-client xCAT-buildkit xCAT-genesis-scripts-x86_64"
|
||||
PCMBUILD="xCAT"
|
||||
PCMLINK="perl-xCAT xCAT-client xCAT-server 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=""
|
||||
@@ -243,7 +241,6 @@ for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xC
|
||||
#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 $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then
|
||||
UPLOAD=1
|
||||
maker $rpmname
|
||||
|
||||
+19
-74
@@ -8,29 +8,10 @@
|
||||
OSNAME=$(uname)
|
||||
NAMEALL=$(uname -a)
|
||||
|
||||
for i in $*; do
|
||||
# upper case the variable name
|
||||
varstring=`echo "$i"|cut -d '=' -f 1|tr '[a-z]' '[A-Z]'`=`echo "$i"|cut -d '=' -f 2`
|
||||
export $varstring
|
||||
done
|
||||
|
||||
if [ -z "$CURDIR" ]; then
|
||||
echo "get current directory!"
|
||||
CURDIR=$(pwd)
|
||||
fi
|
||||
|
||||
echo "CURDIR is $CURDIR"
|
||||
echo "OSNAME is $OSNAME!"
|
||||
echo "NAMEALL is $NAMEALL"
|
||||
|
||||
grep -i 'SUSE' /etc/issue
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "This is a SUSE system!"
|
||||
OS="SUSE";
|
||||
fi
|
||||
|
||||
|
||||
ls $CURDIR/makerpm
|
||||
ls /code/xcat-core
|
||||
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "Error:no repo exist, exit 1."
|
||||
@@ -44,9 +25,10 @@ if ! flock -n 8; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#delete old package if there is
|
||||
rm -rf $CURDIR/build/
|
||||
cd $CURDIR
|
||||
#used only for hard code, will change later
|
||||
cd /code/xcat-core
|
||||
|
||||
rm -rf build/
|
||||
|
||||
echo "==============================================="
|
||||
echo $NAMEALL | egrep "Ubuntu"
|
||||
@@ -61,7 +43,7 @@ echo "This is an Ubuntu system"
|
||||
short_ver=`cat Version|cut -d. -f 1,2`
|
||||
pkg_version="${short_ver}-${pkg_type}${cur_date}"
|
||||
|
||||
mkdir -p $CURDIR/build
|
||||
mkdir -p /code/xcat-core/build
|
||||
|
||||
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]'`
|
||||
@@ -75,86 +57,49 @@ echo "This is an Ubuntu system"
|
||||
echo "Error: $rpmname build package failed exit code $rc"
|
||||
fi
|
||||
cd -
|
||||
mv ${rpmname_low}* $CURDIR/build
|
||||
mv ${rpmname_low}* /code/xcat-core/build
|
||||
|
||||
done
|
||||
#delete all files except .deb file
|
||||
find $CURDIR/build/* ! -name *.deb | xargs rm -f
|
||||
find /code/xcat-core/build/* ! -name *.deb | xargs rm -f
|
||||
|
||||
else
|
||||
#This is not an Ubuntu system
|
||||
echo "This is an $OSNAME system"
|
||||
|
||||
if [ "$OS" = "SUSE" ]; then
|
||||
rm -rf /usr/src/packages/RPMS/noarch/*
|
||||
rm -rf /usr/src/packages/RPMS/x86_64/*
|
||||
rm -rf /usr/src/packages/RPMS/ppc64/*
|
||||
else
|
||||
rm -rf /root/rpmbuild/RPMS/noarch/*
|
||||
rm -rf /root/rpmbuild/RPMS/x86_64/*
|
||||
rm -rf /root/rpmbuild/RPMS/ppc64/*
|
||||
fi
|
||||
|
||||
mkdir -p $CURDIR/build/
|
||||
|
||||
#always build perl-xCAT
|
||||
$CURDIR/makerpm perl-xCAT
|
||||
|
||||
|
||||
rm -rf /root/rpmbuild/RPMS/noarch/*
|
||||
rm -rf /root/rpmbuild/RPMS/x86_64/*
|
||||
rm -rf /root/rpmbuild/RPMS/ppc64/*
|
||||
mkdir build/
|
||||
# Build the rest of the noarch rpms
|
||||
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
|
||||
./makerpm $rpmname
|
||||
done
|
||||
|
||||
#build xCAT-genesis-scripts if it is x86_64 platform
|
||||
ARCH=$(uname -p)
|
||||
if [ "$ARCH" = "x64_64" ]; then
|
||||
$CURDIR/makerpm xCAT-genesis-scripts x86_64
|
||||
./makerpm xCAT-genesis-scripts x86_64
|
||||
fi
|
||||
|
||||
|
||||
# Build the xCAT and xCATsn rpms for all platforms
|
||||
for rpmname in xCAT xCATsn; do
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
$CURDIR/makerpm $rpmname
|
||||
./makerpm $rpmname
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
|
||||
else
|
||||
for arch in x86_64 ppc64 s390x; do
|
||||
$CURDIR/makerpm $rpmname $arch
|
||||
./makerpm $rpmname $arch
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$OS" = "SUSE" ]; then
|
||||
cp /usr/src/packages/RPMS/noarch/* $CURDIR/build/
|
||||
cp /usr/src/packages/RPMS/x86_64/* $CURDIR/build/
|
||||
cp /usr/src/packages/RPMS/ppc64/* $CURDIR/build/
|
||||
else
|
||||
cp /root/rpmbuild/RPMS/noarch/* $CURDIR/build/
|
||||
cp /root/rpmbuild/RPMS/x86_64/* $CURDIR/build/
|
||||
cp /root/rpmbuild/RPMS/ppc64/* $CURDIR/build/
|
||||
fi
|
||||
|
||||
#begin to create repo for redhat platform
|
||||
|
||||
grep -i 'Red' /etc/issue;
|
||||
if [ "$OSNAME" != "AIX" -a $? -eq 0 ]; then
|
||||
cat >$CURDIR/build/xCAT-core.repo << EOF
|
||||
[xcat-2-core]
|
||||
name=xCAT 2 Core packages
|
||||
baseurl=file://$CURDIR/build
|
||||
enabled=1
|
||||
gpgcheck=0
|
||||
EOF
|
||||
|
||||
cp $CURDIR/build/xCAT-core.repo /etc/yum.repos.d/
|
||||
createrepo $CURDIR/build
|
||||
else
|
||||
rm -f /etc/zypp/repos.d/xCAT-core.repo
|
||||
zypper ar file://$CURDIR/build xCAT-core
|
||||
fi
|
||||
cp /root/rpmbuild/RPMS/noarch/* build/
|
||||
cp /root/rpmbuild/RPMS/x86_64/* build/
|
||||
cp /root/rpmbuild/RPMS/ppc64/* build/
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -85,7 +85,6 @@ function makexcat {
|
||||
cd `dirname $0`/$RPMNAME
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/license.tar.gz LICENSE.html
|
||||
cp xcat.conf $RPMROOT/SOURCES
|
||||
cp xcat.conf.apach24 $RPMROOT/SOURCES
|
||||
cp xCATSN $RPMROOT/SOURCES
|
||||
cd - >/dev/null
|
||||
elif [ "$RPMNAME" = "xCAT-buildkit" ]; then
|
||||
@@ -106,23 +105,7 @@ function makexcat {
|
||||
fi
|
||||
}
|
||||
|
||||
# make ironic rpm for ironic baremetal driver
|
||||
function makeironic {
|
||||
RPMNAME="$1"
|
||||
ARCH="$2"
|
||||
cd `dirname $0`/$RPMNAME
|
||||
cp -rf ironic_baremetal /tmp/
|
||||
cd /tmp/ironic_baremetal
|
||||
git init
|
||||
git add *
|
||||
git commit -a -m "generate rpm"
|
||||
python setup.py bdist_rpm
|
||||
rm -rf $RPMROOT/RPMS/$ARCH/
|
||||
mkdir -p $RPMROOT/RPMS/$ARCH/
|
||||
cp -rf dist/*.rpm $RPMROOT/RPMS/$ARCH/
|
||||
rm -rf /tmp/ironic_baremetal
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Make the xCAT-nbroot-core rpm
|
||||
function makenbroot {
|
||||
@@ -222,6 +205,7 @@ else # linux
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "$1" = "xCAT" -o "$1" = "xCATsn" -o "$1" = "xCAT-buildkit" -o "$1" = "xCAT-OpenStack" ]; then
|
||||
exportEmbed $3
|
||||
makexcat $1 $2
|
||||
@@ -234,8 +218,6 @@ elif [ "$1" = "xCAT-genesis-builder" ]; then
|
||||
elif [ "$1" = "xCAT-genesis-scripts" ]; then
|
||||
exportEmbed $3
|
||||
makegenesisscripts $1 $2
|
||||
elif [ "$1" = "xCAT-OpenStack-ironic" ]; then
|
||||
makeironic $1 $2
|
||||
else # must be one of the noarch rpms
|
||||
exportEmbed $2
|
||||
makenoarch $1
|
||||
|
||||
@@ -48,7 +48,7 @@ binary-arch: build install
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/man5/*
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/man/man7/*
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/man7/*
|
||||
./modifyUtils `cat ../Version` `git log -n 1 | head -n 1 | cut -f 2 -d ' '`
|
||||
./modifyUtils `cat ../Version` `svn info | grep Revision | cut -d" " -f 2`
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
#!/bin/sh
|
||||
# Put the version, svn revision #, and build date into the Version function in Version.pm
|
||||
|
||||
if [ -z "$2" ]
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "modifyUtils: Error: must specify the xCAT version as an argument" >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
VER=$1
|
||||
GITREF="git commit $2, "
|
||||
|
||||
BUILDDATE=`date`
|
||||
#echo ". '(built $BUILDDATE)'"
|
||||
|
||||
if [ "$(uname)" = "AIX" ]
|
||||
then
|
||||
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${GITREF}built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
|
||||
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
|
||||
mv xCAT/Version.pm.new xCAT/Version.pm
|
||||
else
|
||||
if [ -f "/etc/debian_version" ];then
|
||||
@@ -23,5 +22,5 @@ else
|
||||
else
|
||||
FILENAME="xCAT/Version.pm"
|
||||
fi
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${GITREF}built $BUILDDATE)'"/ $FILENAME
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ $FILENAME
|
||||
fi
|
||||
|
||||
@@ -23,8 +23,6 @@ Provides: perl-xCAT = %{epoch}:%{version}
|
||||
Provides perl xCAT libraries for core functionality. Required for all xCAT installations.
|
||||
Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
|
||||
%define gitinfo %(git log -n 1 | head -n 1 | cut -f 2 -d ' ')
|
||||
|
||||
%define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi)
|
||||
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
|
||||
|
||||
@@ -38,7 +36,7 @@ Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
%if %fsm
|
||||
%else
|
||||
# Modify the Version() function in xCAT/Utils.pm to automatically have the correct version
|
||||
./modifyUtils %{version} %{gitinfo}
|
||||
./modifyUtils %{version}
|
||||
|
||||
# Build the pod version of the man pages for each DB table. It puts them in the man5 and man7 subdirs.
|
||||
# Then convert the pods to man pages and html pages.
|
||||
|
||||
+2
-125
@@ -500,7 +500,6 @@ sub setCFMPkglistFile {
|
||||
Arguments:
|
||||
$imagename - the specified linuximage name
|
||||
@curospkgs - the currently selected OS packages list
|
||||
$mode - using Fuzzy Matching or Exact Matching to check packages
|
||||
Returns:
|
||||
0 - update successfully
|
||||
1 - update failed
|
||||
@@ -510,22 +509,13 @@ sub setCFMPkglistFile {
|
||||
none
|
||||
Example:
|
||||
my $ret = CAT::CFMUtils->updateCFMPkglistFile($imagename, @cur_selected_pkgs);
|
||||
my $ret = CAT::CFMUtils->updateCFMPkglistFile($imagename, @cur_selected_pkgs, 1);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub updateCFMPkglistFile {
|
||||
my ($class, $img, $ospkgs, $mode) = @_;
|
||||
|
||||
if(defined($mode)){
|
||||
# Exact Matching
|
||||
$mode = 1;
|
||||
}else {
|
||||
# Fuzzy Matching
|
||||
$mode = 0;
|
||||
}
|
||||
|
||||
my ($class, $img, $ospkgs) = @_;
|
||||
|
||||
my @cur_selected = @$ospkgs;
|
||||
my $cfmpkglist = "/install/osimages/$img/pkglist.cfm";
|
||||
|
||||
@@ -559,14 +549,6 @@ sub updateCFMPkglistFile {
|
||||
my @selected = @$selected_ref;
|
||||
@basepkgs = xCAT::CFMUtils->arrayops("U", \@basepkgs, \@selected);
|
||||
}
|
||||
|
||||
# Fuzzy Matching
|
||||
if (not $mode){
|
||||
my ($ref1, $ref2, $ref3) = xCAT::CFMUtils->updateSelectedPkgs(\@pre_selected, \@pre_removed, \@cur_selected);
|
||||
@pre_selected = @$ref1;
|
||||
@pre_removed = @$ref2;
|
||||
@cur_selected = @$ref3;
|
||||
}
|
||||
|
||||
# get diff between previous and current selected OS packages lists
|
||||
my @diff = xCAT::CFMUtils->getPkgsDiff(\@pre_selected, \@cur_selected);
|
||||
@@ -679,48 +661,6 @@ sub getPreOSpkgsList {
|
||||
return (\@selected, \@removed);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getPreBaseOSpkgsList
|
||||
Get previously selected and removed base OS packages lists from pkglist file. Packages named with "example.xxx" should be the base name "example"
|
||||
|
||||
Arguments:
|
||||
$ospkglist - the path for ospkglist file
|
||||
Returns:
|
||||
refs for selected and removed OS packages arrays
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $pre_selected_ref = xCAT::CFMUtils->getPreOSpkgsList($ospkglist);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getPreBaseOSpkgsList {
|
||||
my ($class, $pkglist) = @_;
|
||||
|
||||
my ($pre_selected_ref, $pre_removed_ref) = xCAT::CFMUtils->getPreOSpkgsList($pkglist);
|
||||
|
||||
my %pre_selected_hash = ();
|
||||
foreach (@$pre_selected_ref) {
|
||||
my @names = split(/\./, $_);
|
||||
my $basename = $names[0];
|
||||
|
||||
if ($_ =~ /^$basename\.([^\.]+)$/) {
|
||||
$pre_selected_hash{$basename} = 1;
|
||||
}else {
|
||||
$pre_selected_hash{$_} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
my @pre_selected = keys %pre_selected_hash;
|
||||
|
||||
return \@pre_selected;
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getPkgsDiff
|
||||
@@ -879,66 +819,3 @@ sub arrayops {
|
||||
|
||||
#return (\@union, \@intersection, \@difference);
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 updateSelectedPkgs
|
||||
Update previous selected, previous removed and current selected packages based on fuzzy matching rules. Packages named with "example.i686" should be same with package "example"
|
||||
|
||||
Arguments:
|
||||
\@pre_selected - reference to previous selected packages
|
||||
\@pre_removed - reference to previous removed packages
|
||||
\@cur_selected - reference to current selected packages
|
||||
Returns:
|
||||
new previous selected, previous removed, current selected packages
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my ($ref1, $ref2, $ref3) = xCAT::CFMUtils->arrayops(\@pre_selected, \@pre_removed, \@cur_selected);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub updateSelectedPkgs() {
|
||||
my ($class, $pre_selected_ref, $pre_removed_ref, $cur_selected_ref) = @_;
|
||||
|
||||
my %pre_selected_hash = map{$_ => 1} @$pre_selected_ref;
|
||||
my %pre_removed_hash = map{$_ => 1} @$pre_removed_ref;
|
||||
my %cur_selected_hash = map{$_ => 1} @$cur_selected_ref;
|
||||
|
||||
my %new_pre_selected_hash = %pre_selected_hash;
|
||||
my %new_pre_removed_hash = %pre_removed_hash;
|
||||
my %new_cur_selected_hash = %cur_selected_hash;
|
||||
|
||||
foreach (keys %cur_selected_hash) {
|
||||
my $father = $_;
|
||||
my $flag = 0;
|
||||
foreach (keys %pre_selected_hash) {
|
||||
my $child = $_;
|
||||
if ($child =~ /^$father\.([^\.]+)$/) {
|
||||
$new_cur_selected_hash{$child} = 1;
|
||||
$flag = 1;
|
||||
}
|
||||
}
|
||||
if ($flag and not exists $pre_selected_hash{$father}){
|
||||
delete $new_cur_selected_hash{$father} if exists $new_cur_selected_hash{$father};
|
||||
}
|
||||
|
||||
foreach (keys %pre_removed_hash) {
|
||||
my $child = $_;
|
||||
if ($child =~ /^$father\.([^\.]+)$/) {
|
||||
delete $new_pre_removed_hash{$child} if exists $new_pre_removed_hash{$child};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my @new_cur_selected = keys %new_cur_selected_hash;
|
||||
my @new_pre_selected = keys %new_pre_selected_hash;
|
||||
my @new_pre_removed = keys %new_pre_removed_hash;
|
||||
|
||||
|
||||
return (\@new_pre_selected, \@new_pre_removed, \@new_cur_selected);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ if ($inet6support) {
|
||||
|
||||
if ($^O =~ /^linux/i) {
|
||||
# Is IPv6 enabled on the MN or xcat client node at all?
|
||||
my $ipv6enabled = `ip addr 2> /dev/null | grep inet6`;
|
||||
my $ipv6enabled = `ip addr | grep inet6`;
|
||||
if (!$ipv6enabled) {
|
||||
$inet6support = 0;
|
||||
}
|
||||
|
||||
+26
-48
@@ -598,7 +598,7 @@ sub _execute_dsh
|
||||
}
|
||||
else
|
||||
{
|
||||
# HERE: This is where the output shows up
|
||||
# LKV: This is where the output shows up
|
||||
#print STDOUT @{$output_buffers{$user_target}};
|
||||
#print STDERR @{$error_buffers{$user_target}};
|
||||
chomp(@{$output_buffers{$user_target}});
|
||||
@@ -1020,7 +1020,6 @@ sub fork_fanout_dsh
|
||||
}
|
||||
}
|
||||
# save the original exports, we are going to add the unique node name below
|
||||
my $firstpass=0;
|
||||
while (@$targets_waiting
|
||||
&& (keys(%$targets_active) < $$options{'fanout'}))
|
||||
{
|
||||
@@ -1047,7 +1046,6 @@ sub fork_fanout_dsh
|
||||
}
|
||||
if ($$options{'environment'})
|
||||
{
|
||||
if ($firstpass ==0) { # do the servicenode stuff only once
|
||||
# if we are on a servicenode need to get the environment file
|
||||
# from the SNsyncfiledir, not local
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
@@ -1070,10 +1068,8 @@ sub fork_fanout_dsh
|
||||
$rsp->{error}->[0] = "File $$options{'environment'} does not exist";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
}
|
||||
$firstpass=1;
|
||||
}
|
||||
# build the xdsh command
|
||||
push @dsh_command,
|
||||
# build the xdsh command
|
||||
push @dsh_command,
|
||||
"$exportnode$$options{'pre-command'} . $$options{'environment'} ; $$options{'command'}$$options{'post-command'}";
|
||||
}
|
||||
|
||||
@@ -3997,7 +3993,8 @@ sub parse_and_run_dsh
|
||||
{
|
||||
$options{'user'} = $ENV{'DSH_TO_USERID'};
|
||||
}
|
||||
if ((!(defined($nodes))) && (!(defined($options{'rootimg'}))))
|
||||
|
||||
if ((!(defined(@$nodes))) && (!(defined($options{'rootimg'}))))
|
||||
{ # no nodes and not -i option, error
|
||||
my $rsp = ();
|
||||
$rsp->{error}->[0] = "Unless using -i option, noderange is required.";
|
||||
@@ -4036,7 +4033,7 @@ sub parse_and_run_dsh
|
||||
{ # from sinv, discard this name
|
||||
undef @$nodes;
|
||||
}
|
||||
if (@$nodes[0])
|
||||
if (defined(@$nodes))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
@@ -4407,16 +4404,8 @@ sub parse_and_run_dcp
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return;
|
||||
}
|
||||
if (@$nodes[0])
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Input noderange:@$nodes and any other xdsh flags or environment variables are not valid with -i flag.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((!(defined($nodes))) && (!(defined($options{'rootimg'}))))
|
||||
if ((!(defined(@$nodes))) && (!(defined($options{'rootimg'}))))
|
||||
{ # no nodes and not -i option, error
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "Unless using -i option, noderange is required.";
|
||||
@@ -4513,7 +4502,7 @@ sub parse_and_run_dcp
|
||||
#
|
||||
# build list of nodes
|
||||
my @nodelist;
|
||||
if (@$nodes[0])
|
||||
if (defined(@$nodes))
|
||||
{ # there are nodes
|
||||
@nodelist = @$nodes;
|
||||
$options{'nodes'} = join(',', @nodelist);
|
||||
@@ -4983,8 +4972,7 @@ sub parse_rsync_input_file_on_MN
|
||||
$::process_line = 0;
|
||||
my $destfileisdir;
|
||||
my $clause=0;
|
||||
my $addmergescript =0;
|
||||
my $addappendscript =0;
|
||||
|
||||
open(INPUTFILE, "< $input_file") || die "File $input_file does not exist\n";
|
||||
while (my $line = <INPUTFILE>)
|
||||
{
|
||||
@@ -5025,16 +5013,12 @@ sub parse_rsync_input_file_on_MN
|
||||
# this triggers the running of the appendscript
|
||||
$::appendscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
|
||||
}
|
||||
|
||||
# add the append script to the sync
|
||||
if ($addappendscript == 0) { # only add once
|
||||
my $appscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
|
||||
my $appendscriptline = "$appscript -> $appscript";
|
||||
$syncappendscript=1; # syncing the xdcpappend.sh script
|
||||
&build_append_rsync($appendscriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncappendscript);
|
||||
$addappendscript=1;
|
||||
}
|
||||
} # end APPEND clause
|
||||
my $appscript ="/opt/xcat/share/xcat/scripts/xdcpappend.sh";
|
||||
my $appendscriptline = "$appscript -> $appscript";
|
||||
$syncappendscript=1; # syncing the xdcpappend.sh script
|
||||
&build_append_rsync($appendscriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncappendscript);
|
||||
}
|
||||
if ($clause =~ /MERGE:/) {
|
||||
# location of the base merge script
|
||||
# for MERGE we have to sync the mergescript and the
|
||||
@@ -5046,16 +5030,12 @@ sub parse_rsync_input_file_on_MN
|
||||
# this triggers the running of the mergescript
|
||||
$::mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
|
||||
}
|
||||
|
||||
# add the merge script to the sync
|
||||
if ($addmergescript == 0) { # only add once
|
||||
my $mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
|
||||
my $mergescriptline = "$mergescript -> $mergescript";
|
||||
$syncmergescript=1; # syncing the xdcpmerge.sh script
|
||||
&build_merge_rsync($mergescriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncmergescript);
|
||||
$addmergescript=1;
|
||||
}
|
||||
} # end MERGE clause
|
||||
my $mergescript ="/opt/xcat/share/xcat/scripts/xdcpmerge.sh";
|
||||
my $mergescriptline = "$mergescript -> $mergescript";
|
||||
$syncmergescript=1; # syncing the xdcpmerge.sh script
|
||||
&build_merge_rsync($mergescriptline,$nodes, $options, $input_file,$rsyncSN, $syncdir,$nodesyncfiledir,$onServiceNode,$syncmergescript);
|
||||
}
|
||||
|
||||
}
|
||||
} else { # not processing EXECUTE, EXECUTEALWAYS or APPEND
|
||||
@@ -5219,7 +5199,6 @@ sub build_append_rsync
|
||||
push @::appendlines,$line;
|
||||
}
|
||||
my $src_file = $1; # append file left of arror
|
||||
my $orig_src_file = $1; # append file left of arror
|
||||
# it will be sync'd to $nodesyncfiledir/$append_file
|
||||
my $dest_file = $nodesyncfiledir;
|
||||
$dest_file .= $src_file;
|
||||
@@ -5248,7 +5227,7 @@ sub build_append_rsync
|
||||
# to pick up files from /var/xcat/syncfiles...
|
||||
if ($onServiceNode == 1) {
|
||||
my $newsrcfile = $syncdir; # add SN syndir on front
|
||||
$newsrcfile .= $orig_src_file;
|
||||
$newsrcfile .= $src_file;
|
||||
$src_file=$newsrcfile;
|
||||
}
|
||||
# destination file name
|
||||
@@ -5331,8 +5310,7 @@ sub build_merge_rsync
|
||||
if ($syncmergescript == 0) { # don't add the xdcpmerge.sh line
|
||||
push @::mergelines,$line;
|
||||
}
|
||||
my $src_file = $1; # merge file left of arrow
|
||||
my $orig_src_file = $1;
|
||||
my $src_file = $1; # merge file left of arror
|
||||
# it will be sync'd to $nodesyncfiledir/$merge_file
|
||||
my $dest_file = $nodesyncfiledir;
|
||||
$dest_file .= $src_file;
|
||||
@@ -5361,7 +5339,7 @@ sub build_merge_rsync
|
||||
# to pick up files from /var/xcat/syncfiles...
|
||||
if ($onServiceNode == 1) {
|
||||
my $newsrcfile = $syncdir; # add SN syndir on front
|
||||
$newsrcfile .= $orig_src_file;
|
||||
$newsrcfile .= $src_file;
|
||||
$src_file=$newsrcfile;
|
||||
}
|
||||
# destination file name
|
||||
@@ -6051,11 +6029,11 @@ sub run_always_rsync_postscripts
|
||||
# if on the service node need to add the $syncdir directory
|
||||
# to the path
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
my $tmps=$syncdir . $ps;
|
||||
push @args, $tmps;
|
||||
} else{
|
||||
push @args, $ps;
|
||||
my $tmpp=$syncdir . $ps;
|
||||
$ps=$tmpp;
|
||||
}
|
||||
push @args, $ps;
|
||||
|
||||
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
|
||||
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
|
||||
@@ -253,6 +253,64 @@ use strict;
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
=head3
|
||||
ifconfig_inet
|
||||
|
||||
Builds a list of all IP Addresses bound to the local host and
|
||||
stores them in a global list
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Globals:
|
||||
@local_inet
|
||||
|
||||
Error:
|
||||
None
|
||||
|
||||
Example:
|
||||
xCAT::DSHCore->ifconfig_inet;
|
||||
|
||||
Comments:
|
||||
Internal routine only
|
||||
|
||||
=cut
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
sub ifconfig_inet
|
||||
{
|
||||
my @local_inet = ();
|
||||
|
||||
if ($^O eq 'aix')
|
||||
{
|
||||
my @ip_address = ();
|
||||
my @output = `/usr/sbin/ifconfig -a`;
|
||||
|
||||
foreach my $line (@output)
|
||||
{
|
||||
($line =~ /inet ((\d{1,3}?\.){3}(\d){1,3})\s/o)
|
||||
&& (push @local_inet, $1);
|
||||
}
|
||||
}
|
||||
|
||||
elsif ($^O eq 'linux')
|
||||
{
|
||||
my @ip_address = ();
|
||||
my @output = `/sbin/ifconfig -a`;
|
||||
|
||||
foreach my $line (@output)
|
||||
{
|
||||
($line =~ /inet addr:((\d{1,3}?\.){3}(\d){1,3})\s/o)
|
||||
&& (push @local_inet, $1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ sub temp {
|
||||
# No frame commands for IVM
|
||||
#################################
|
||||
if ( $hwtype eq "ivm" ) {
|
||||
push @result, [$name,"$prefix Not available (No BPA)",0];
|
||||
push @result, [$name,"$prefix Not available (No BPA)",1];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
@@ -272,14 +272,14 @@ sub temp {
|
||||
#################################
|
||||
if ( @$d[4] !~ /^(fsp|lpar|cec)$/ ) {
|
||||
my $text = "$prefix Only available for CEC/LPAR";
|
||||
push @result, [$name,$text,0];
|
||||
push @result, [$name,$text,1];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
# Error - No frame
|
||||
#################################
|
||||
if ( $mtms eq "0" ) {
|
||||
push @result, [$name,"$prefix Not available (No BPA)",0];
|
||||
push @result, [$name,"$prefix Not available (No BPA)",1];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
@@ -352,7 +352,7 @@ sub rackenv {
|
||||
#################################
|
||||
if ( @$d[4] !~ /^(bpa|frame)$/ ) {
|
||||
my $text = "$prefix Only available for BPA/Frame";
|
||||
push @result, [$name,$text,0];
|
||||
push @result, [$name,$text,1];
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
+57
-265
@@ -16,7 +16,7 @@ use xCAT::Usage;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT::FSPUtils;
|
||||
use xCAT::VMCommon;
|
||||
use Data::Dumper;
|
||||
#use Data::Dumper;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
##############################################
|
||||
# Globals
|
||||
@@ -48,26 +48,15 @@ sub parse_args {
|
||||
##########################################################################
|
||||
# Parse the chvm command line for options and operands
|
||||
##########################################################################
|
||||
my @query_array = ();
|
||||
my %param_list_map = (
|
||||
'vmcpus' => 'part_get_lpar_processing',
|
||||
'vmmemory' => 'part_get_lpar_memory',
|
||||
'add_physlots' => 'part_get_all_io_bus_info',
|
||||
'del_physlots' => 'part_get_all_io_bus_info',
|
||||
'add_vmnics' => 'part_get_all_vio_info',
|
||||
'add_vmstorage' => 'part_get_all_vio_info',
|
||||
'del_vadapter' => 'part_get_all_vio_info'
|
||||
);
|
||||
|
||||
sub chvm_parse_extra_options {
|
||||
my $args = shift;
|
||||
my $opt = shift;
|
||||
# Partition used attributes #
|
||||
my @support_ops = qw(vmcpus vmmemory add_physlots vmothersetting add_vmstorage add_vmnics del_vadapter del_physlots);
|
||||
my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting vmstorage vmnics del_vadapter);
|
||||
if (ref($args) ne 'ARRAY') {
|
||||
return "$args";
|
||||
}
|
||||
my %tmp_hash = ();
|
||||
foreach (@$args) {
|
||||
my ($cmd, $value) = split (/\=/, $_);
|
||||
if (!defined($value)) {
|
||||
@@ -86,33 +75,17 @@ sub chvm_parse_extra_options {
|
||||
# return "'$value' invalid";
|
||||
# }
|
||||
} elsif (grep(/^$cmd$/, @support_ops)) {
|
||||
if (exists($param_list_map{$cmd})) {
|
||||
$tmp_hash{$param_list_map{$cmd}} = 1;
|
||||
}
|
||||
if (exists($opt->{p775})) {
|
||||
return "'$cmd' doesn't work for Power 775 machines.";
|
||||
} elsif ($cmd eq "del_vadapter") {
|
||||
if ($value !~ /^\d+$/) {
|
||||
return "Invalid param '$value', only one slot id can be specified";
|
||||
}
|
||||
} elsif ($cmd eq "del_physlots") {
|
||||
my @tmp_array = split ",",$value;
|
||||
foreach (@tmp_array) {
|
||||
unless (/(0x\w{8})/) {
|
||||
return "'$_' is invalid";
|
||||
}
|
||||
}
|
||||
} elsif ($cmd eq "vmothersetting") {
|
||||
if ($value =~ /hugepage:\s*(\d+)/i) {
|
||||
$opt->{huge_page} = $1;
|
||||
$tmp_hash{'get_huge_page'} = 1;
|
||||
}
|
||||
if ($value =~ /bsr:\s*(\d+)/i) {
|
||||
$opt->{bsr} = $1;
|
||||
$tmp_hash{'get_cec_bsr'} = 1;
|
||||
}
|
||||
next;
|
||||
} elsif ($cmd eq "add_vmstorage") {
|
||||
} elsif ($cmd eq "vmstorage") {
|
||||
if (exists($opt->{vios})) {
|
||||
if ($value !~ /\d+/) {
|
||||
return "'$value' is invalid, must be numbers";
|
||||
@@ -156,7 +129,7 @@ sub chvm_parse_extra_options {
|
||||
} else {
|
||||
return "'$value' is invalid";
|
||||
}
|
||||
} elsif ($cmd eq "add_physlots") {
|
||||
} elsif ($cmd eq "vmphyslots") {
|
||||
my @tmp_array = split ",",$value;
|
||||
foreach (@tmp_array) {
|
||||
unless (/(0x\w{8})/) {
|
||||
@@ -170,7 +143,7 @@ sub chvm_parse_extra_options {
|
||||
return "'$_' is invalid";
|
||||
}
|
||||
}
|
||||
} elsif ($cmd eq "add_vmnics") {
|
||||
} elsif ($cmd eq "vmnics") {
|
||||
my @tmp_array = split ",", $value;
|
||||
foreach (@tmp_array) {
|
||||
unless (/^vlan\d+$/i) {
|
||||
@@ -184,7 +157,6 @@ sub chvm_parse_extra_options {
|
||||
}
|
||||
$opt->{$cmd} = $value;
|
||||
}
|
||||
@query_array = keys(%tmp_hash);
|
||||
return undef;
|
||||
}
|
||||
|
||||
@@ -747,7 +719,7 @@ sub lsvm_parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose l|long p775 updatedb) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|verbose l|long p775) )) {
|
||||
return( usage() );
|
||||
}
|
||||
if (exists($opt{l}) && !exists($opt{p775})) {
|
||||
@@ -786,12 +758,11 @@ sub modify {
|
||||
return op_extra_cmds ($request, $hash) if ($request->{opt}->{lparname} || $request->{opt}->{huge_page});
|
||||
return ([["Error", "Miss argument\n".$usage_string, 1]]);
|
||||
}
|
||||
|
||||
sub do_op_extra_cmds {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my @values = ();
|
||||
my %lpar_hash = ();
|
||||
|
||||
while (my ($mtms, $h) = each(%$hash)) {
|
||||
my $memhash;
|
||||
while (my($name, $d) = each(%$h)) {
|
||||
@@ -804,11 +775,11 @@ sub do_op_extra_cmds {
|
||||
$action = "set_huge_page";
|
||||
} elsif ($op eq "vmcpus") {
|
||||
$action = "part_set_lpar_pending_proc";
|
||||
} elsif ($op eq "add_physlots" or $op eq "del_physlots") {
|
||||
} elsif ($op eq "vmphyslots") {
|
||||
$action = "set_io_slot_owner_uber";
|
||||
} elsif ($op eq "del_vadapter") {
|
||||
$action = "part_clear_vslot_config";
|
||||
} elsif ($op eq "add_vmnics") {
|
||||
} elsif ($op eq "vmnics") {
|
||||
my @vlans = split /,/,$param;
|
||||
foreach (@vlans) {
|
||||
if (/vlan(\d+)/i) {
|
||||
@@ -827,7 +798,7 @@ sub do_op_extra_cmds {
|
||||
}
|
||||
}
|
||||
next;
|
||||
} elsif ($op eq "add_vmstorage") {
|
||||
} elsif ($op eq "vmstorage") {
|
||||
foreach my $v_info (@$param) {
|
||||
if ($v_info =~ /(\d+),([\w_-]*):(\d+)/) {
|
||||
my $vios = &find_lpar_id($request, @$d[3], $2);
|
||||
@@ -856,17 +827,17 @@ sub do_op_extra_cmds {
|
||||
if ($2 == "G" or $2 == '') {
|
||||
$min = $min * 1024;
|
||||
}
|
||||
$min = int($min/$memsize);
|
||||
$min = $min/$memsize;
|
||||
my $cur = $3;
|
||||
if ($4 == "G" or $4 == '') {
|
||||
$cur = $cur * 1024;
|
||||
}
|
||||
$cur = int($cur/$memsize);
|
||||
$cur = $cur/$memsize;
|
||||
my $max = $5;
|
||||
if ($6 == "G" or $6 == '') {
|
||||
$max = $max * 1024;
|
||||
}
|
||||
$max = int($max/$memsize);
|
||||
$max = $max/$memsize;
|
||||
$request->{opt}->{$op} ="$min/$cur/$max";
|
||||
$param = $request->{opt}->{$op};
|
||||
} else {
|
||||
@@ -878,11 +849,7 @@ sub do_op_extra_cmds {
|
||||
$memhash->{lpar_used_regions} = 0;
|
||||
my $ret = &deal_with_avail_mem($request, $name, $d, $memhash);
|
||||
if (ref($ret) eq "ARRAY") {
|
||||
if (@$ret[2]) {
|
||||
return ([[@$ret]]);
|
||||
} else {
|
||||
push @values, $ret;
|
||||
}
|
||||
return ([[@$ret]]);
|
||||
}
|
||||
$param = $memhash->{memory};
|
||||
$action = "part_set_lpar_pending_mem";
|
||||
@@ -896,26 +863,15 @@ sub do_op_extra_cmds {
|
||||
}
|
||||
my $tmp_value = ($param eq '*') ? $name : $param;
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} $action for node:$name, parm:$tmp_value.");
|
||||
my @tmpd = @$d;
|
||||
if ($op eq "del_physlots") {
|
||||
@tmpd[0] = "-1";
|
||||
}
|
||||
my $value = xCAT::FSPUtils::fsp_api_action($request, $name, \@tmpd, $action, 0, $tmp_value);
|
||||
my $value = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action, 0, $tmp_value);
|
||||
if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) {
|
||||
return ([[$name, @$value[1], '1']]) ;
|
||||
} else {
|
||||
push @values, [$name, "Success", '0'];
|
||||
}
|
||||
}
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, 1, \@query_array);
|
||||
# need to add update db here
|
||||
$lpar_hash{$name} = $rethash;
|
||||
$lpar_hash{$name}->{parent} = @$d[3];
|
||||
}
|
||||
}
|
||||
if (%lpar_hash) {
|
||||
update_vm_db($request, \%lpar_hash);
|
||||
}
|
||||
return \@values;
|
||||
}
|
||||
sub check_node_info {
|
||||
@@ -1696,7 +1652,6 @@ my @partition_query_actions = qw(part_get_partition_cap part_get_hyp_process_and
|
||||
sub parse_part_get_info {
|
||||
my $hash = shift;
|
||||
my $data = shift;
|
||||
my $lparid = shift;
|
||||
my @array = split /\n/, $data;
|
||||
foreach my $line (@array) {
|
||||
chomp($line);
|
||||
@@ -1717,12 +1672,9 @@ sub parse_part_get_info {
|
||||
$hash->{bus}->{$3}->{cur_lparid} = $1;
|
||||
$hash->{bus}->{$3}->{bus_slot} = $2;
|
||||
$hash->{bus}->{$3}->{des} = $4;
|
||||
if ($lparid and $lparid eq $1) {
|
||||
push @{$hash->{lpar_phy_bus}}, $3;
|
||||
}
|
||||
} elsif ($line =~ /Phy drc_index:(\w+), Port group: (\w+), Phy port id: (\w+)/) {
|
||||
$hash->{phy_drc_group_port}->{$1}->{$2}->{$3} = '1';
|
||||
#} elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) {
|
||||
} elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) {
|
||||
if (($2 == -1) && ($4 == 255)) {
|
||||
$hash->{logic_drc_phydrc}->{$3}->{$5} = $1;
|
||||
#$hash->{logic_drc_phydrc}->{$5}->{$1} = [$2,$3,$4];
|
||||
@@ -1735,49 +1687,12 @@ sub parse_part_get_info {
|
||||
$hash->{lpar0_used_mem} = $2;
|
||||
$hash->{phy_min_mem_req} = $3;
|
||||
#print "===>lpar0_used_mem:$hash->{lpar0_used_mem}.\n";
|
||||
} elsif ($line =~ /Curr Memory (Min|Req|Max):\s*([\d]*)[^\(]*\((\d+)\s*regions\)/) {
|
||||
if ($1 eq 'Min') {
|
||||
$hash->{lpar_mem_min} = $2
|
||||
} elsif ($1 eq 'Max') {
|
||||
$hash->{lpar_mem_max} = $2;
|
||||
} else {
|
||||
$hash->{lpar_mem_req} = $2;
|
||||
$hash->{lpar_used_regions} = $3;
|
||||
}
|
||||
} elsif ($line =~ /Curr Processor (Min|Req|Max):\s*(\d+)/) {
|
||||
if ($1 eq 'Min') {
|
||||
$hash->{lpar_cpu_min} = $2;
|
||||
} elsif ($1 eq 'Max') {
|
||||
$hash->{lpar_cpu_max} = $2;
|
||||
} else {
|
||||
$hash->{lpar_cpu_req} = $2;
|
||||
}
|
||||
} elsif ($line =~ /\s*lpar_id=(\d+),type=vSCSI,slot=(\d+),attr=(\d+).*remote_lpar_id=0x(\w+),remote_slot_num=0x(\w+)/) {
|
||||
if ($3 eq '0') {
|
||||
my $lparid = hex($4);
|
||||
my $slotid = hex($5);
|
||||
push @{$hash->{lpar_vmstorage_client}}, "$lparid:$slotid";
|
||||
} else {
|
||||
if (exists($hash->{lpar_vmstorage_server})) {
|
||||
$hash->{lpar_vmstorage_server}++;
|
||||
} else {
|
||||
$hash->{lpar_vmstorage_server} = 1;
|
||||
}
|
||||
}
|
||||
} elsif ($line =~ /\s*lpar_id=(\d+),type=(vEth),slot=(\d+).*port_vlan_id=(\d+),mac_addr=(\w+)/) {
|
||||
push @{$hash->{lpar_vmnics}}, "vlan$4";
|
||||
} elsif ($line =~ /Curr Memory Req:[^\(]*\((\d+)\s*regions\)/) {
|
||||
$hash->{lpar_used_regions} = $1;
|
||||
} elsif ($line =~ /Available huge page memory\(in pages\):\s*(\d+)/) {
|
||||
$hash->{huge_page_avail} = $1;
|
||||
} elsif ($line =~ /Available BSR array:\s*(\d+)/) {
|
||||
$hash->{cec_bsr_avail} = $1;
|
||||
} elsif ($line =~ /^\d+\/(\d+)\/\d+$/) {
|
||||
if ($1 ne 0) {
|
||||
push @{$hash->{lpar_othersetting}}, "hugepage:$1";
|
||||
}
|
||||
} elsif ($line =~ /^(\d+)\.$/) {
|
||||
if ($1 ne 0) {
|
||||
push @{$hash->{lpar_othersetting}}, "bsr:$1";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1788,7 +1703,6 @@ sub query_cec_info_actions {
|
||||
my $td = shift;
|
||||
my $usage = shift;
|
||||
my $action_array = shift;
|
||||
my $lpar_hash = shift;
|
||||
my $lparid = @$td[0];
|
||||
my $data;
|
||||
my @array = ();
|
||||
@@ -1803,16 +1717,12 @@ sub query_cec_info_actions {
|
||||
chomp(@$values[1]);
|
||||
#if ($action eq "part_get_partition_cap" and (@$values[1] =~ /Error:/i or @$values[2] ne 0)) {
|
||||
if (@$values[1] =~ /Error:/i or @$values[2] ne 0) {
|
||||
next; #return ([[@$values]]);
|
||||
return ([[@$values]]);
|
||||
}
|
||||
if (@$values[1] =~ /^$/) {
|
||||
next;
|
||||
}
|
||||
if ($usage eq 1 or $usage eq 2) {
|
||||
&parse_part_get_info(\%hash, @$values[1], $lparid);
|
||||
}
|
||||
|
||||
if ($usage eq 0 or $usage eq 2) {
|
||||
if ($usage eq 0) {
|
||||
if ($lparid) {
|
||||
if ($action eq "lpar_lhea_mac") {
|
||||
my @output = split /\n/,@$values[1];
|
||||
@@ -1867,72 +1777,18 @@ sub query_cec_info_actions {
|
||||
}
|
||||
#$data .= "@$values[1]\n\n";
|
||||
push @array, [$name, @$values[1], @$values[2]];
|
||||
}
|
||||
}
|
||||
if ($usage eq 0 or $usage eq 2) {
|
||||
#return $data;
|
||||
if ($usage eq 2) {
|
||||
%$lpar_hash = %hash;
|
||||
} else {
|
||||
&parse_part_get_info(\%hash, @$values[1]);
|
||||
}
|
||||
}
|
||||
if ($usage eq 0) {
|
||||
#return $data;
|
||||
return \@array;
|
||||
} else {
|
||||
return \%hash;
|
||||
}
|
||||
}
|
||||
|
||||
sub update_vm_db {
|
||||
my $request = shift;
|
||||
my $lpar_hash = shift;
|
||||
my $vm_hd = xCAT::Table->new('vm');
|
||||
my %name_id_map = ();
|
||||
my $commit = 0;
|
||||
foreach (keys (%$lpar_hash)) {
|
||||
my %db_update = ();
|
||||
my $node_hash = $lpar_hash->{$_};
|
||||
if (exists($node_hash->{lpar_cpu_min})) {
|
||||
$db_update{cpus} = "$node_hash->{lpar_cpu_min}/$node_hash->{lpar_cpu_req}/$node_hash->{lpar_cpu_max}";
|
||||
}
|
||||
if (exists($node_hash->{lpar_mem_min})) {
|
||||
$db_update{memory} = "$node_hash->{lpar_mem_min}/$node_hash->{lpar_mem_req}/$node_hash->{lpar_mem_max}";
|
||||
}
|
||||
if (exists($node_hash->{lpar_vmstorage_server})) {
|
||||
$db_update{storage} = $node_hash->{lpar_vmstorage_server};
|
||||
} elsif (exists($node_hash->{lpar_vmstorage_client})) {
|
||||
my @tmp_array = ();
|
||||
foreach (@{$node_hash->{lpar_vmstorage_client}}) {
|
||||
if (/(\d+):(\d+)/) {
|
||||
if (exists($name_id_map{$1})) {
|
||||
push @tmp_array, "$name_id_map{$1}:$2";
|
||||
} else {
|
||||
my $vios_name = &find_lpar_name($request, $node_hash->{parent}, $1);
|
||||
if (defined($vios_name)) {
|
||||
$name_id_map{$1} = $vios_name;
|
||||
push @tmp_array, "$vios_name:$2";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$db_update{storage} = join(",",@tmp_array);
|
||||
}
|
||||
if (exists($node_hash->{lpar_vmnics})) {
|
||||
$db_update{nics} = join(",",@{$node_hash->{lpar_vmnics}});
|
||||
}
|
||||
if (exists($node_hash->{lpar_phy_bus})) {
|
||||
$db_update{physlots} = join(",",@{$node_hash->{lpar_phy_bus}});
|
||||
}
|
||||
if (exists($node_hash->{lpar_othersetting})) {
|
||||
$db_update{othersettings} = join(",",@{$node_hash->{lpar_othersetting}});
|
||||
}
|
||||
if (%db_update) {
|
||||
$vm_hd->setNodeAttribs($_,\%db_update);
|
||||
$commit = 1;
|
||||
}
|
||||
}
|
||||
if ($commit) {
|
||||
$vm_hd->commit;
|
||||
}
|
||||
}
|
||||
|
||||
#my @partition_query_actions = qw(part_get_partition_cap part_get_num_of_lpar_slots part_get_hyp_config_process_and_mem part_get_hyp_avail_process_and_mem part_get_service_authority_lpar_id part_get_shared_processing_resource part_get_all_vio_info lpar_lhea_mac part_get_all_io_bus_info part_get_lpar_processing part_get_lpar_memory get_huge_page get_cec_bsr);
|
||||
sub query_cec_info {
|
||||
my $request = shift;
|
||||
@@ -1940,36 +1796,25 @@ sub query_cec_info {
|
||||
my $args = $request->{opt};
|
||||
my @td = ();
|
||||
my @result = ();
|
||||
my $usage = 0;
|
||||
my %lpar_hash = ();
|
||||
#print Dumper($request);
|
||||
#print Dumper($hash);
|
||||
while (my ($mtms,$h) = each(%$hash) ) {
|
||||
while (my ($name, $d) = each (%$h)) {
|
||||
my %tmp_hash = ();
|
||||
@td = @$d;
|
||||
if (@$d[0] == 0 && @$d[4] !~ /lpar|vios/) {
|
||||
last;
|
||||
}
|
||||
#my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","lpar_lhea_mac","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
|
||||
if ($args->{updatedb}) {
|
||||
$usage = 2;
|
||||
}
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, $usage, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","part_get_all_vio_info","get_huge_page","get_cec_bsr"], \%tmp_hash);
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","part_get_all_vio_info","get_huge_page","get_cec_bsr"]);
|
||||
#push @result, [$name, $rethash, 0];
|
||||
push @result, @$rethash;
|
||||
$lpar_hash{$name} = \%tmp_hash;
|
||||
$lpar_hash{$name}->{parent} = @$d[3];
|
||||
}
|
||||
if (@td[0] == 0) {
|
||||
my $rethash = query_cec_info_actions($request, @td[3],\@td, $usage);
|
||||
my $rethash = query_cec_info_actions($request, @td[3],\@td, 0);
|
||||
#push @result, [@td[3], $rethash, 0];
|
||||
push @result, @$rethash;
|
||||
}
|
||||
}
|
||||
if ($args->{updatedb} and %lpar_hash) {
|
||||
update_vm_db($request, \%lpar_hash);
|
||||
}
|
||||
return \@result;
|
||||
}
|
||||
|
||||
@@ -2064,12 +1909,9 @@ sub deal_with_avail_mem {
|
||||
my $cur_mem_in_G = $lparhash->{hyp_avail_mem} * $lparhash->{mem_region_size} * 1.0 / 1024;
|
||||
return([$name, "Parse reserverd regions failed, no enough memory, available:$cur_mem_in_G GB.", 1]);
|
||||
}
|
||||
if (($cur_avail > 0) and ($cur > $cur_avail)) {
|
||||
my $cur_avail_in_G = $cur_avail * $lparhash->{mem_region_size} * 1.0 / 1024;
|
||||
$lparhash->{memory} = "$min/$cur_avail/$max";
|
||||
unless ($lparhash->{full_par}) {
|
||||
return([$name, "Available memory is less than required, allocate $cur_avail_in_G GB.", 0]);
|
||||
}
|
||||
if ($cur > $cur_avail) {
|
||||
my $new_cur = $cur_avail;
|
||||
$lparhash->{memory} = "$min/$new_cur/$max";
|
||||
}
|
||||
} else {
|
||||
return ([$name, "Failed to get hypervisor reserved memory regions.", 1]);
|
||||
@@ -2089,25 +1931,11 @@ sub find_lpar_id {
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub find_lpar_name {
|
||||
my $request = shift;
|
||||
my $parent = shift;
|
||||
my $id = shift;
|
||||
my %mapping = %{$request->{ppc}->{$parent}->{mapping}};
|
||||
foreach (keys %mapping) {
|
||||
if ($mapping{$_} eq $id) {
|
||||
return $_;
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub create_lpar {
|
||||
my $request = shift;
|
||||
my $name = shift;
|
||||
my $d = shift;
|
||||
my $lparhash = shift;
|
||||
my @ret = ();
|
||||
my $values;
|
||||
if (exists($request->{opt}->{vios})) {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x03);
|
||||
@@ -2120,7 +1948,7 @@ sub create_lpar {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_lpar_name", 0, $name);
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([[$name, @$values[1], @$values[0]]]);
|
||||
return ([$name, @$values[1], @$values[0]]);
|
||||
}
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_shared_pool_util_auth");
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_group_id");
|
||||
@@ -2131,7 +1959,7 @@ sub create_lpar {
|
||||
#$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner", 0, join(",",@phy_io_array));
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
}
|
||||
}
|
||||
if (exists($lparhash->{nics})) {
|
||||
@@ -2147,7 +1975,7 @@ sub create_lpar {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request,$name, $d, "part_set_veth_slot_config",0,"0,$vlanid,$mac");
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2157,7 +1985,7 @@ sub create_lpar {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request,$name, $d, "part_set_vscsi_slot_config",0,$v_info);
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2188,23 +2016,19 @@ sub create_lpar {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_proc", 0, $lparhash->{cpus});
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
}
|
||||
$values = &deal_with_avail_mem($request, $name, $d,$lparhash);
|
||||
if (ref($values) eq "ARRAY") {
|
||||
if (@$values[2]) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([[@$values]]);
|
||||
} else {
|
||||
push @ret, $values;
|
||||
}
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([@$values]);
|
||||
}
|
||||
|
||||
#print "======>memory:$lparhash->{memory}.\n";
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_mem", 0, $lparhash->{memory});
|
||||
if (@$values[2] ne 0) {
|
||||
&set_lpar_undefined($request, $name, $d);
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
}
|
||||
|
||||
xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_comp_modes");
|
||||
@@ -2219,11 +2043,9 @@ sub create_lpar {
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x02);
|
||||
}
|
||||
if (@$values[2] ne 0) {
|
||||
return ([[$name, @$values[1], @$values[2]]]);
|
||||
return ([$name, @$values[1], @$values[2]]);
|
||||
}
|
||||
push @ret, [$name, "Done", 0];
|
||||
#return ([$name, "Done", 0]);
|
||||
return \@ret;
|
||||
return ([$name, "Done", 0]);
|
||||
}
|
||||
|
||||
sub mkspeclpar {
|
||||
@@ -2232,7 +2054,6 @@ sub mkspeclpar {
|
||||
my $opt = $request->{opt};
|
||||
my $values;
|
||||
my @result = ();
|
||||
my %lpar_hash = ();
|
||||
my $vmtab = xCAT::Table->new( 'vm');
|
||||
unless($vmtab) {
|
||||
return([["Error","Cannot open vm table", 1]]);
|
||||
@@ -2246,12 +2067,11 @@ sub mkspeclpar {
|
||||
push @result, [$name, "Node must be LPAR", 1];
|
||||
last;
|
||||
}
|
||||
#if (!exists($memhash->{run}))
|
||||
{
|
||||
if (!exists($memhash->{run})) {
|
||||
my @td = @$d;
|
||||
@td[0] = 0;
|
||||
$memhash = &query_cec_info_actions($request, $name, \@td, 1, ["part_get_hyp_process_and_mem","lpar_lhea_mac","part_get_all_io_bus_info"]);
|
||||
#$memhash->{run} = 1;
|
||||
$memhash->{run} = 1;
|
||||
}
|
||||
my $tmp_ent = $ent->{$name}->[0];
|
||||
if (exists($opt->{vmcpus})) {
|
||||
@@ -2287,23 +2107,11 @@ sub mkspeclpar {
|
||||
if ($tmp_ent->{cpus} =~ /^(\d+)\/(\d+)\/(\d+)$/) {
|
||||
unless ($1 <= $2 and $2 <= $3) {
|
||||
return([[$name, "Parameter for 'vmcpus' is invalid", 1]]);
|
||||
} elsif ($memhash->{process_units_avail} eq '0') {
|
||||
push @result, [$name, "No process available", 1];
|
||||
next;
|
||||
} elsif ($2 > $memhash->{process_units_avail}) {
|
||||
my $cur = $memhash->{process_units_avail};
|
||||
my $min = $1 > $cur ? $cur : $1;
|
||||
$tmp_ent->{cpus} = "$min/$cur/$3";
|
||||
push @result, [$name, "Available processor is less than required, allocate $cur processors.", 0];
|
||||
}
|
||||
} else {
|
||||
return([[$name, "Parameter for 'vmcpus' is invalid", 1]]);
|
||||
}
|
||||
if ($tmp_ent->{memory} =~ /^([\d|.]+)([G|M]?)\/([\d|.]+)([G|M]?)\/([\d|.]+)([G|M]?)$/i) {
|
||||
if ($memhash->{hyp_avail_mem} eq '0') {
|
||||
push @result, [$name, "No memory available", 1];
|
||||
next;
|
||||
}
|
||||
my ($mmin, $mcur, $mmax);
|
||||
if ($2 == "G" or $2 == '') {
|
||||
$mmin = $1 * 1024;
|
||||
@@ -2318,9 +2126,9 @@ sub mkspeclpar {
|
||||
return([[$name, "Parameter for 'vmmemory' is invalid", 1]]);
|
||||
}
|
||||
my $memsize = $memhash->{mem_region_size};
|
||||
$mmin = int(($mmin + $memsize - 1) / $memsize);
|
||||
$mcur = int(($mcur + $memsize - 1) / $memsize);
|
||||
$mmax = int(($mmax + $memsize - 1) / $memsize);
|
||||
$mmin = ($mmin + $memsize) / $memsize;
|
||||
$mcur = ($mcur + $memsize) / $memsize;
|
||||
$mmax = ($mmax + $memsize) / $memsize;
|
||||
$tmp_ent->{memory} = "$mmin/$mcur/$mmax";
|
||||
$tmp_ent->{mem_region_size} = $memsize;
|
||||
} else {
|
||||
@@ -2370,27 +2178,21 @@ sub mkspeclpar {
|
||||
$tmp_ent->{storage} = \@array;
|
||||
}
|
||||
} else {
|
||||
if (exists($tmp_ent->{storage})) {
|
||||
my @tmp_array = split ",",$tmp_ent->{storage};
|
||||
my $storage_array = undef;
|
||||
foreach (@tmp_array) {
|
||||
if (/([\w_-]*):(\d+)/) {
|
||||
my $vios = &find_lpar_id($request, @$d[3], $1);
|
||||
my $r_slotid = $2;
|
||||
if (defined($vios)) {
|
||||
push @$storage_array, "0,$vios,$r_slotid";
|
||||
} else {
|
||||
return ([[$name, "Cannot find lparid for Server lpar:$1"]]);
|
||||
}
|
||||
} else {
|
||||
return ([[$name, "Parameter for 'vmstorage' is invalid", 1]]);
|
||||
if (exists($tmp_ent->{storage}) and $tmp_ent->{storage} !~ /^[\w_-]*:\d+$/) {
|
||||
return ([[$name, "Parameter for 'vmstorage' is invalid", 1]]);
|
||||
} elsif (exists($tmp_ent->{storage})) {
|
||||
if ($tmp_ent->{storage} =~ /([\w_-]*):(\d+)/) {
|
||||
my $vios = &find_lpar_id($request, @$d[3], $1);
|
||||
my $r_slotid = $2;
|
||||
if (!defined($vios)) {
|
||||
return ([[$name, "Cannot find lparid for Server lpar:$1"]]);
|
||||
}
|
||||
$tmp_ent->{storage} = ["0,$vios,$r_slotid"];
|
||||
}
|
||||
$tmp_ent->{storage} = $storage_array;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$tmp_ent->{hyp_config_mem} = $memhash->{hyp_config_mem};
|
||||
$tmp_ent->{hyp_avail_mem} = $memhash->{hyp_avail_mem};
|
||||
if (exists($tmp_ent->{othersettings})) {
|
||||
@@ -2410,19 +2212,11 @@ sub mkspeclpar {
|
||||
$tmp_ent->{phy_hea} = $memhash->{phy_drc_group_port};
|
||||
$tmp_ent->{logic_drc_phydrc} = $memhash->{logic_drc_phydrc};
|
||||
$values = &create_lpar($request, $name, $d, $tmp_ent);
|
||||
push @result, @$values;
|
||||
#need to add update db here
|
||||
my $rethash = query_cec_info_actions($request, $name, $d, 1, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]);
|
||||
$lpar_hash{$name} = $rethash;
|
||||
$lpar_hash{$name}->{parent} = @$d[3];
|
||||
|
||||
push @result, $values;
|
||||
$name = undef;
|
||||
$d = undef;
|
||||
}
|
||||
}
|
||||
if (%lpar_hash) {
|
||||
update_vm_db($request, \%lpar_hash);
|
||||
}
|
||||
return \@result;
|
||||
}
|
||||
|
||||
@@ -2453,17 +2247,15 @@ sub mkfulllpar {
|
||||
$lpar_param{memory} = "1/".$rethash->{hyp_avail_mem}."/".$rethash->{hyp_config_mem};
|
||||
$lpar_param{hyp_config_mem} = $rethash->{hyp_config_mem};
|
||||
$lpar_param{hyp_avail_mem} = $rethash->{hyp_avail_mem};
|
||||
$lpar_param{mem_region_size} = $rethash->{mem_region_size};
|
||||
my @phy_io_array = keys(%{$rethash->{bus}});
|
||||
$lpar_param{physlots} = join(",", @phy_io_array);
|
||||
$lpar_param{huge_page} = "1/".$rethash->{huge_page_avail}."/".$rethash->{huge_page_avail};
|
||||
$lpar_param{bsr_num} = $rethash->{cec_bsr_avail};
|
||||
$lpar_param{phy_hea} = $rethash->{phy_drc_group_port};
|
||||
$lpar_param{logic_drc_phydrc} = $rethash->{logic_drc_phydrc};
|
||||
$lpar_param{full_par} = 1;
|
||||
$values = &create_lpar($request, $name, $d, \%lpar_param);
|
||||
$rethash->{logic_drc_phydrc} = $lpar_param{logic_drc_phydrc};
|
||||
push @result, @$values;
|
||||
push @result, $values;
|
||||
$name = undef;
|
||||
$d = undef;
|
||||
}
|
||||
|
||||
Executable → Regular
+10
-18
@@ -217,23 +217,14 @@ sub is_me
|
||||
#my ($b1, $b2, $b3, $b4) = split /\./, $nameIP;
|
||||
|
||||
# get all the possible IPs for the node I'm running on
|
||||
# this is a common subroutine for both AIX and Linux,
|
||||
# AIX does not have ip command
|
||||
my $ipcmd;
|
||||
if ( -f "/sbin/ip" )
|
||||
{
|
||||
$ipcmd = "ip addr | grep 'inet'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ipcmd = "ifconfig -a | grep 'inet'";
|
||||
}
|
||||
my $result = xCAT::Utils->runcmd($ipcmd, -1, 1);
|
||||
my $ifcmd = "ifconfig -a | grep 'inet'";
|
||||
my $result = xCAT::Utils->runcmd($ifcmd, -1, 1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $str="Error running ipcmd";
|
||||
xCAT::MsgUtils->message("S", $str);
|
||||
$::VERBOSE = $verb;
|
||||
my $rsp;
|
||||
# push @{$rsp->{data}}, "Could not run $ifcmd.\n";
|
||||
# xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
$::VERBOSE = $verb;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -241,6 +232,7 @@ sub is_me
|
||||
{
|
||||
my ($inet, $myIP, $str) = split(" ", $int);
|
||||
chomp $myIP;
|
||||
$myIP =~ s/addr://;
|
||||
$myIP =~ s/\/.*//; # ipv6 address 4000::99/64
|
||||
$myIP =~ s/\%.*//; # ipv6 address ::1%1/128
|
||||
|
||||
@@ -1031,7 +1023,7 @@ sub dolitesetup
|
||||
$nrange = join(',',@nodel);
|
||||
}
|
||||
|
||||
@flist = xCAT::Utils->runcmd("/opt/xcat/bin/litefile $nrange", -1);
|
||||
my @flist = xCAT::Utils->runcmd("/opt/xcat/bin/litefile $nrange", -1);
|
||||
if (scalar(@flist) > 0) {
|
||||
foreach my $l (@flist) {
|
||||
my ($j1, $j2, $file) = split /\s+/, $l;
|
||||
@@ -1143,8 +1135,8 @@ sub dolitesetup
|
||||
|
||||
if (!$file) {
|
||||
next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# ex. .../inst_root/foo/bar/ or .../inst_root/etc/lppcfg
|
||||
my $instrootfile = $instrootloc . $file;
|
||||
|
||||
|
||||
Executable → Regular
+3
-9
@@ -1240,12 +1240,6 @@ sub ping_server{
|
||||
$msg[3] = "Status: ping return code now on stack\n";
|
||||
$newstate[3] = 4;
|
||||
|
||||
# get the timeout for ping test
|
||||
my $to4pt;
|
||||
if ( $ENV{TIMEOUT4PINGTEST} =~ /^\d+$/ ) {
|
||||
$to4pt = ",$ENV{TIMEOUT4PINGTEST}";
|
||||
}
|
||||
|
||||
#IPv6
|
||||
if ( $server_ip =~ /:/ ) {
|
||||
#::1, calculate link local address
|
||||
@@ -1255,9 +1249,9 @@ sub ping_server{
|
||||
} else {
|
||||
$linklocal_ip = $client_ip;
|
||||
}
|
||||
$cmd[3] = "ping $full_path_name:ipv6,$server_ip,$linklocal_ip,$gateway_ip$to4pt\r";
|
||||
$cmd[3] = "ping $full_path_name:ipv6,$server_ip,$linklocal_ip,$gateway_ip\r";
|
||||
} else {
|
||||
$cmd[3] = "ping $full_path_name:$server_ip,$client_ip,$gateway_ip$to4pt\r";
|
||||
$cmd[3] = "ping $full_path_name:$server_ip,$client_ip,$gateway_ip\r";
|
||||
}
|
||||
$pattern[3] = ".*ping(.*)ok(.*)0 >(.*)";
|
||||
|
||||
@@ -2634,7 +2628,7 @@ sub lparnetbootexp
|
||||
sub {
|
||||
$rc = 2;
|
||||
$rconsole->clear_accum();
|
||||
nc_msg(1, "Please make sure rcons $node works.\n");
|
||||
nc_msg($verbose, "Please make sure rcons $node works.\n");
|
||||
}
|
||||
],
|
||||
);
|
||||
|
||||
+177
-266
@@ -19,7 +19,6 @@ use File::Path;
|
||||
use Math::BigInt;
|
||||
use Socket;
|
||||
use xCAT::GlobalDef;
|
||||
#use Data::Dumper;
|
||||
use strict;
|
||||
use warnings "all";
|
||||
my $socket6support = eval { require Socket6 };
|
||||
@@ -643,11 +642,16 @@ sub get_nic_ip
|
||||
{
|
||||
my $nic;
|
||||
my %iphash;
|
||||
my $cmd = "ifconfig -a";
|
||||
my $result = `$cmd`;
|
||||
my $mode = "MULTICAST";
|
||||
my $payingattention=0;
|
||||
my $interface;
|
||||
my $keepcurrentiface;
|
||||
|
||||
#############################################
|
||||
# Error running command
|
||||
#############################################
|
||||
if ( !$result ) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
##############################################################
|
||||
@@ -659,14 +663,6 @@ sub get_nic_ip
|
||||
# en1: ...
|
||||
#
|
||||
##############################################################
|
||||
my $cmd = "ifconfig -a";
|
||||
my $result = `$cmd`;
|
||||
#############################################
|
||||
# Error running command
|
||||
#############################################
|
||||
if ( !$result ) {
|
||||
return undef;
|
||||
}
|
||||
my @adapter = split /(\w+\d+):\s+flags=/, $result;
|
||||
foreach ( @adapter ) {
|
||||
if ($_ =~ /^(en\d)/) {
|
||||
@@ -686,39 +682,37 @@ sub get_nic_ip
|
||||
}
|
||||
}
|
||||
}
|
||||
else { # linux
|
||||
my @ipoutput = `ip addr`;
|
||||
#############################################
|
||||
# Error running command
|
||||
#############################################
|
||||
if ( !@ipoutput ) {
|
||||
return undef;
|
||||
}
|
||||
foreach my $line (@ipoutput) {
|
||||
if ($line =~ /^\d/) { # new interface, new context..
|
||||
if ($interface and not $keepcurrentiface) {
|
||||
#don't bother reporting unusable nics
|
||||
delete $iphash{$interface};
|
||||
else {
|
||||
##############################################################
|
||||
# Should look like this for Linux:
|
||||
# eth0 Link encap:Ethernet HWaddr 00:02:55:7B:06:30
|
||||
# inet addr:9.114.154.193 Bcast:9.114.154.223
|
||||
# inet6 addr: fe80::202:55ff:fe7b:630/64 Scope:Link
|
||||
# UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
|
||||
# RX packets:1280982 errors:0 dropped:0 overruns:0 frame:0
|
||||
# TX packets:3535776 errors:0 dropped:0 overruns:0 carrier:0
|
||||
# collisions:0 txqueuelen:1000
|
||||
# RX bytes:343489371 (327.5 MiB) TX bytes:870969610 (830.6 MiB)
|
||||
# Base address:0x2600 Memory:fbfe0000-fc0000080
|
||||
#
|
||||
# eth1 ...
|
||||
#
|
||||
##############################################################
|
||||
my @adapter= split /\n{2,}/, $result;
|
||||
foreach ( @adapter ) {
|
||||
if ( !($_ =~ /LOOPBACK / ) and
|
||||
$_ =~ /UP / and
|
||||
$_ =~ /$mode / ) {
|
||||
my @ip = split /\n/;
|
||||
for my $ent ( @ip ) {
|
||||
if ($ent =~ /^(eth\d|ib\d|hf\d)\s+/) {
|
||||
$nic = $1;
|
||||
}
|
||||
if ( $ent =~ /^\s*inet addr:\s*(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
$iphash{$nic} = $1;
|
||||
next;
|
||||
}
|
||||
}
|
||||
$keepcurrentiface=0;
|
||||
if ( !($line =~ /LOOPBACK/ ) and
|
||||
$line =~ /UP( |,|>)/ and
|
||||
$line =~ /$mode/ ) {
|
||||
|
||||
$payingattention=1;
|
||||
$line =~ /^([^:]*): ([^:]*):/;
|
||||
$interface=$2;
|
||||
} else {
|
||||
$payingattention=0;
|
||||
next;
|
||||
}
|
||||
}
|
||||
unless ($payingattention) { next; }
|
||||
if ($line =~ /inet/) {
|
||||
$keepcurrentiface=1;
|
||||
}
|
||||
if ( $line =~ /^\s*inet \s*(\d+\.\d+\.\d+\.\d+)/ ) {
|
||||
$iphash{$interface} = $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1601,124 +1595,56 @@ sub thishostisnot
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#sub gethost_ips1
|
||||
#{
|
||||
# my ($class) = @_;
|
||||
# my $cmd;
|
||||
# my @ipaddress;
|
||||
# $cmd = "ifconfig" . " -a";
|
||||
# $cmd = $cmd . "| grep \"inet\"";
|
||||
# my @result = xCAT::Utils->runcmd($cmd, 0);
|
||||
# if ($::RUNCMD_RC != 0)
|
||||
# {
|
||||
# xCAT::MsgUtils->message("S", "Error from $cmd\n");
|
||||
# exit $::RUNCMD_RC;
|
||||
# }
|
||||
# foreach my $addr (@result)
|
||||
# {
|
||||
# my @ip;
|
||||
# if (xCAT::Utils->isLinux())
|
||||
# {
|
||||
# if ($addr =~ /inet6/)
|
||||
# {
|
||||
# #TODO, Linux ipv6
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
|
||||
# #@ip = split(":", $addr1);
|
||||
# #push @ipaddress, $ip[1];
|
||||
# $addr1 =~ s/.*://;
|
||||
# push @ipaddress, $addr1;
|
||||
# }
|
||||
# }
|
||||
# else
|
||||
# { #AIX
|
||||
# if ($addr =~ /inet6/)
|
||||
# {
|
||||
# $addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/;
|
||||
# my $v6ip = $1;
|
||||
# my $v6mask = $2;
|
||||
# if ($v6ip)
|
||||
# {
|
||||
# push @ipaddress, $v6ip;
|
||||
# }
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
|
||||
# split(" ", $addr);
|
||||
# push @ipaddress, $addr1;
|
||||
# }
|
||||
#
|
||||
# }
|
||||
# }
|
||||
# my @names = @ipaddress;
|
||||
# foreach my $ipaddr (@names)
|
||||
# {
|
||||
# my $hostname = xCAT::NetworkUtils->gethostname($ipaddr);
|
||||
# if ($hostname)
|
||||
# {
|
||||
# my @shorthost = split(/\./, $hostname);
|
||||
# push @ipaddress, $shorthost[0];
|
||||
# }
|
||||
# }
|
||||
#
|
||||
# return @ipaddress;
|
||||
#}
|
||||
|
||||
|
||||
sub gethost_ips
|
||||
{
|
||||
my ($class) = @_;
|
||||
my $cmd;
|
||||
my @ipaddress;
|
||||
if (xCAT::Utils->isLinux())
|
||||
$cmd = "ifconfig" . " -a";
|
||||
$cmd = $cmd . "| grep \"inet\"";
|
||||
my @result = xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
$cmd="ip -4 --oneline addr show |awk -F ' ' '{print \$4}'|awk -F '/' '{print \$1}'";
|
||||
my @result =xCAT::Utils->runcmd($cmd);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("S", "Error from $cmd\n");
|
||||
exit $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
push @ipaddress, @result;
|
||||
xCAT::MsgUtils->message("S", "Error from $cmd\n");
|
||||
exit $::RUNCMD_RC;
|
||||
}
|
||||
else
|
||||
{ #AIX
|
||||
|
||||
$cmd = "ifconfig" . " -a";
|
||||
$cmd = $cmd . "| grep \"inet\"";
|
||||
my @result = xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("S", "Error from $cmd\n");
|
||||
exit $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
foreach my $addr (@result)
|
||||
{
|
||||
if ($addr =~ /inet6/)
|
||||
{
|
||||
$addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/;
|
||||
my $v6ip = $1;
|
||||
my $v6mask = $2;
|
||||
if ($v6ip)
|
||||
{
|
||||
push @ipaddress, $v6ip;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
|
||||
split(" ", $addr);
|
||||
push @ipaddress, $addr1;
|
||||
}
|
||||
foreach my $addr (@result)
|
||||
{
|
||||
my @ip;
|
||||
if (xCAT::Utils->isLinux())
|
||||
{
|
||||
if ($addr =~ /inet6/)
|
||||
{
|
||||
#TODO, Linux ipv6
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
|
||||
@ip = split(":", $addr1);
|
||||
push @ipaddress, $ip[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{ #AIX
|
||||
if ($addr =~ /inet6/)
|
||||
{
|
||||
$addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/;
|
||||
my $v6ip = $1;
|
||||
my $v6mask = $2;
|
||||
if ($v6ip)
|
||||
{
|
||||
push @ipaddress, $v6ip;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
|
||||
split(" ", $addr);
|
||||
push @ipaddress, $addr1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my @names = @ipaddress;
|
||||
foreach my $ipaddr (@names)
|
||||
{
|
||||
@@ -1729,9 +1655,9 @@ sub gethost_ips
|
||||
push @ipaddress, $shorthost[0];
|
||||
}
|
||||
}
|
||||
|
||||
return @ipaddress;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_subnet_aix
|
||||
@@ -1907,6 +1833,102 @@ sub validate_ip
|
||||
}
|
||||
return([0]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getFacingIP
|
||||
Gets the ip address of the adapter of the localhost that is facing the
|
||||
the given node.
|
||||
Assume it is the same as my_ip_facing...
|
||||
Arguments:
|
||||
The name of the node that is facing the localhost.
|
||||
Returns:
|
||||
The ip address of the adapter that faces the node.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getFacingIP
|
||||
{
|
||||
my ($class, $node) = @_;
|
||||
my $ip;
|
||||
my $cmd;
|
||||
my @ipaddress;
|
||||
|
||||
my $nodeip = inet_ntoa(inet_aton($node));
|
||||
unless ($nodeip =~ /\d+\.\d+\.\d+\.\d+/)
|
||||
{
|
||||
return 0; #Not supporting IPv6 here IPV6TODO
|
||||
}
|
||||
|
||||
$cmd = "ifconfig" . " -a";
|
||||
$cmd = $cmd . "| grep \"inet \"";
|
||||
my @result = xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("S", "Error from $cmd\n");
|
||||
exit $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
# split node address
|
||||
my ($n1, $n2, $n3, $n4) = split('\.', $nodeip);
|
||||
|
||||
foreach my $addr (@result)
|
||||
{
|
||||
my $ip;
|
||||
my $mask;
|
||||
if (xCAT::Utils->isLinux())
|
||||
{
|
||||
my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr);
|
||||
if ((!$addr1) || (!$Mask)) { next; }
|
||||
my @ips = split(":", $addr1);
|
||||
my @masks = split(":", $Mask);
|
||||
$ip = $ips[1];
|
||||
$mask = $masks[1];
|
||||
}
|
||||
else
|
||||
{ #AIX
|
||||
my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) =
|
||||
split(" ", $addr);
|
||||
if ((!$addr1) && (!$mask1)) { next; }
|
||||
$ip = $addr1;
|
||||
$mask1 =~ s/0x//;
|
||||
$mask =
|
||||
`printf "%d.%d.%d.%d" \$(echo "$mask1" | sed 's/../0x& /g')`;
|
||||
}
|
||||
|
||||
if ($ip && $mask)
|
||||
{
|
||||
|
||||
# split interface IP
|
||||
my ($h1, $h2, $h3, $h4) = split('\.', $ip);
|
||||
|
||||
# split mask
|
||||
my ($m1, $m2, $m3, $m4) = split('\.', $mask);
|
||||
|
||||
# AND this interface IP with the netmask of the network
|
||||
my $a1 = ((int $h1) & (int $m1));
|
||||
my $a2 = ((int $h2) & (int $m2));
|
||||
my $a3 = ((int $h3) & (int $m3));
|
||||
my $a4 = ((int $h4) & (int $m4));
|
||||
|
||||
# AND node IP with the netmask of the network
|
||||
my $b1 = ((int $n1) & (int $m1));
|
||||
my $b2 = ((int $n2) & (int $m2));
|
||||
my $b3 = ((int $n3) & (int $m3));
|
||||
my $b4 = ((int $n4) & (int $m4));
|
||||
|
||||
if (($b1 == $a1) && ($b2 == $a2) && ($b3 == $a3) && ($b4 == $a4))
|
||||
{
|
||||
return $ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xCAT::MsgUtils->message("S", "Cannot find master for the node $node\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 isIpaddr
|
||||
@@ -1959,108 +1981,6 @@ sub isIpaddr
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 getNodeNameservers
|
||||
Description:
|
||||
Get nameservers of specified nodes.
|
||||
The priority: noderes.nameservers > networks.nameservers > site.nameservers
|
||||
Arguments:
|
||||
node: node name list
|
||||
Returns:
|
||||
Return a hash ref, of the $nameservers{$node}
|
||||
undef - Failed to get the nameservers
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $nameservers = xCAT::NetworkUtils::getNodeNameservers(\@node);
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getNodeNameservers{
|
||||
my $nodes=shift;
|
||||
if( $nodes =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$nodes=shift;
|
||||
}
|
||||
my @nodelist = @$nodes;
|
||||
my %nodenameservers;
|
||||
my $nrtab = xCAT::Table->new('noderes',-create=>0);
|
||||
my %nrhash = %{$nrtab->getNodesAttribs(\@nodelist,['nameservers'])};
|
||||
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
my %nethash = xCAT::DBobjUtils->getNetwkInfo( \@nodelist );
|
||||
|
||||
my @nameservers = xCAT::TableUtils->get_site_attribute("nameservers");
|
||||
my $sitenameservers=$nameservers[0];
|
||||
|
||||
|
||||
foreach my $node (@nodelist){
|
||||
if ($nrhash{$node} and $nrhash{$node}->[0] and $nrhash{$node}->[0]->{nameservers})
|
||||
{
|
||||
$nodenameservers{$node}=$nrhash{$node}->[0]->{nameservers};
|
||||
}elsif($nethash{$node}{nameservers})
|
||||
{
|
||||
$nodenameservers{$node}=$nethash{$node}{nameservers};
|
||||
}elsif($sitenameservers)
|
||||
{
|
||||
$nodenameservers{$node}=$sitenameservers;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getNodeNetworkCfg
|
||||
@@ -2087,27 +2007,19 @@ sub getNodeGateway
|
||||
sub getNodeNetworkCfg
|
||||
{
|
||||
my $node = shift;
|
||||
if( $node =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$node =shift;
|
||||
}
|
||||
|
||||
my $nets = xCAT::NetworkUtils::my_nets();
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
my $mask = undef;
|
||||
my $gateway = undef;
|
||||
for my $net (keys %$nets)
|
||||
{
|
||||
my $netname;
|
||||
($netname,$mask) = split /\//, $net;
|
||||
last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1));
|
||||
}
|
||||
$gateway=xCAT::NetworkUtils::getNodeGateway($ip);
|
||||
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0));
|
||||
return ($ip, $node, undef, xCAT::NetworkUtils::formatNetmask($mask,1,0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_hdwr_ip
|
||||
@@ -2283,7 +2195,6 @@ sub isValidHostname
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 isValidFQDN
|
||||
|
||||
@@ -21,6 +21,7 @@ sub parse_args {
|
||||
my %opt = ();
|
||||
my $cmd = $request->{command};
|
||||
my $args = $request->{arg};
|
||||
my @VERSION = qw( 2.1 );
|
||||
|
||||
#############################################
|
||||
# Responds with usage statement
|
||||
@@ -59,8 +60,7 @@ sub parse_args {
|
||||
# Option -v for version
|
||||
####################################
|
||||
if ( exists( $opt{v} )) {
|
||||
my $version = xCAT::Utils->Version();
|
||||
return ([$version]);
|
||||
return( \@VERSION );
|
||||
}
|
||||
|
||||
if ( exists( $opt{s} ) ){
|
||||
@@ -350,27 +350,6 @@ sub do_rnetboot {
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# Set the boot mode to norm from 'of' (open firmware)
|
||||
# NOW, only necessary for IVM
|
||||
my $hwtype = @$exp[2];
|
||||
if ($hwtype eq "ivm") {
|
||||
my $server = @$exp[3];
|
||||
|
||||
# creat connection first
|
||||
my @newexp = xCAT::PPCcli::connect( $request, $hwtype, $server );
|
||||
if (ref($newexp[0]) eq "Expect" ) {
|
||||
my $cfg = "lpar_id=@$d[0],boot_mode=norm";
|
||||
# change the boot mode to 'norm'
|
||||
xCAT::PPCcli::chsyscfg(\@newexp, "prof", $d, $cfg);
|
||||
xCAT::PPCcli::disconnect(\@newexp);
|
||||
} else {
|
||||
my $rsp;
|
||||
$rsp->{data} = ["Failed to set the boot mode to normal. For rnetboot command, you have to rpower off and then on the node after finishing the OS deployment."];
|
||||
xCAT::MsgUtils->message("E", $rsp, $request->{callback});
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -436,9 +436,9 @@ sub sshcfg {
|
||||
#####################################
|
||||
# userid@host not found in key file
|
||||
#####################################
|
||||
#if ( $sshkey !~ /\s+(\S+\@\S+$)/ ) {
|
||||
# return( [[$server,"Cannot find userid\@host in '$fname'",RC_ERROR]] );
|
||||
#}
|
||||
if ( $sshkey !~ /\s+(\S+\@\S+$)/ ) {
|
||||
return( [[$server,"Cannot find userid\@host in '$fname'",RC_ERROR]] );
|
||||
}
|
||||
my $logon = $1;
|
||||
|
||||
#####################################
|
||||
|
||||
@@ -156,7 +156,7 @@ sub connect {
|
||||
# Shell prompt regexp based on HW Type
|
||||
##################################################
|
||||
my %prompt = (
|
||||
hmc => "~>\\s*\$",
|
||||
hmc => "~> \$",
|
||||
ivm => "\\\$ \$"
|
||||
);
|
||||
##################################################
|
||||
|
||||
+19
-14
@@ -296,37 +296,42 @@ sub renergy {
|
||||
$deadnodes{$_}=1;
|
||||
}
|
||||
open (NMAP, "nmap -PE --system-dns --send-ip -sP ". join(' ',@hcps_ip) . " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
|
||||
my $node;
|
||||
my $node1;
|
||||
my $msg1;
|
||||
while (<NMAP>) {
|
||||
#print "$_\n";
|
||||
if (/Host (.*) \((.*)\) appears to be up/) {
|
||||
$node=$2;
|
||||
unless ($deadnodes{$node}) {
|
||||
$node1=$2;
|
||||
unless ($deadnodes{$node1}) {
|
||||
foreach (keys %deadnodes) {
|
||||
if ($node =~ /^$_\./) {
|
||||
$node = $_;
|
||||
if ($node1 =~ /^$_\./) {
|
||||
$node1 = $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete $deadnodes{$node};
|
||||
delete $deadnodes{$node1};
|
||||
if ($verbose) {
|
||||
push @return_msg, [$node, $_, 0];
|
||||
}
|
||||
push(@pingable_hcp, $node);
|
||||
} elsif (/Nmap scan report for ([^ ]*)/) {
|
||||
$node=$1;
|
||||
push(@pingable_hcp, $node1);
|
||||
} elsif (/Nmap scan report for ([^ ]*) \((.*)\)/) {
|
||||
$node1=$2;
|
||||
$msg1=$_;
|
||||
} elsif (/Host is up./) {
|
||||
unless ($deadnodes{$node}) {
|
||||
unless ($deadnodes{$node1}) {
|
||||
foreach (keys %deadnodes) {
|
||||
if ($node =~ /^$_\./) {
|
||||
$node = $_;
|
||||
if ($node1 =~ /^$_\./) {
|
||||
$node1 = $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete $deadnodes{$node};
|
||||
push(@pingable_hcp, $node);
|
||||
delete $deadnodes{$node1};
|
||||
if ($verbose) {
|
||||
push @return_msg, [$node, "$msg1$_", 0];
|
||||
}
|
||||
push(@pingable_hcp, $node1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -144,16 +144,12 @@ sub connect {
|
||||
##################################
|
||||
# Set options
|
||||
##################################
|
||||
#my $hosttab = xCAT::Table->new( 'hosts' );
|
||||
#if ( $hosttab) {
|
||||
# my $hostshash = $hosttab->getNodeAttribs( $server, [qw(ip otherinterfaces)]);
|
||||
# if ( $hostshash ) {
|
||||
# $server = $hostshash->{ip};
|
||||
# }
|
||||
#}
|
||||
$server = xCAT::NetworkUtils::getNodeIPaddress( $server );
|
||||
unless ($server) {
|
||||
return( "Unable to get IP address for $server" );
|
||||
my $hosttab = xCAT::Table->new( 'hosts' );
|
||||
if ( $hosttab) {
|
||||
my $hostshash = $hosttab->getNodeAttribs( $server, [qw(ip otherinterfaces)]);
|
||||
if ( $hostshash ) {
|
||||
$server = $hostshash->{ip};
|
||||
}
|
||||
}
|
||||
# my $serverip = inet_ntoa(inet_aton($server));
|
||||
my $url = "https://$server/cgi-bin/cgi?form=2";
|
||||
|
||||
@@ -347,7 +347,7 @@ sub bus {
|
||||
#################################
|
||||
# Output header
|
||||
#################################
|
||||
push @result, [$name,"I/O Bus Information", 0];
|
||||
push @result, [$name,"I/O Bus Information"];
|
||||
|
||||
#################################
|
||||
# Output error
|
||||
@@ -532,7 +532,7 @@ sub config {
|
||||
#################################
|
||||
# Output header
|
||||
#################################
|
||||
push @result, [$name,"Machine Configuration Info", 0];
|
||||
push @result, [$name,"Machine Configuration Info"];
|
||||
my $i;
|
||||
|
||||
foreach ( @prefix ) {
|
||||
|
||||
@@ -203,7 +203,7 @@ sub voltage {
|
||||
# Voltages available in frame
|
||||
#################################
|
||||
if ( @$d[4] ne "bpa" ) {
|
||||
push @result, [$name,"$text Only available for BPA",0];
|
||||
push @result, [$name,"$text Only available for BPA",1];
|
||||
next;
|
||||
}
|
||||
my $volt = enumerate_volt( $exp, $d );
|
||||
@@ -256,7 +256,7 @@ sub temp {
|
||||
# No frame commands for IVM
|
||||
#################################
|
||||
if ( $hwtype eq "ivm" ) {
|
||||
push @result, [$name,"$prefix Not available (No BPA)",0];
|
||||
push @result, [$name,"$prefix Not available (No BPA)",1];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
@@ -264,14 +264,14 @@ sub temp {
|
||||
#################################
|
||||
if ( @$d[4] !~ /^(fsp|cec|lpar)$/ ) {
|
||||
my $text = "$prefix Only available for CEC/LPAR";
|
||||
push @result, [$name,$text,0];
|
||||
push @result, [$name,$text,1];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
# Error - No frame
|
||||
#################################
|
||||
if ( $mtms eq "0" ) {
|
||||
push @result, [$name,"$prefix Not available (No BPA)",0];
|
||||
push @result, [$name,"$prefix Not available (No BPA)",1];
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
|
||||
@@ -719,6 +719,28 @@ sub get_nodes_profiles
|
||||
return \%profile_dict;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_imageprofile_prov_osvers
|
||||
Description : Get A node's provisioning os version and profile from its imageprofile attribute.
|
||||
Arguments : $imgprofilename - imageprofile name
|
||||
Returns : node's osversion and profile
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_imageprofile_prov_osvers
|
||||
{
|
||||
|
||||
my $class = shift;
|
||||
my $imgprofilename = shift;
|
||||
my $osimgtab = xCAT::Table->new('osimage');
|
||||
my $osimgentry = ($osimgtab->getAllAttribsWhere("imagename = '$imgprofilename'", 'ALL' ))[0];
|
||||
my $osversion = $osimgentry->{'osvers'};
|
||||
my $profile = $osimgentry->{'profile'};
|
||||
return ($osversion, $profile);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_imageprofile_prov_method
|
||||
@@ -748,27 +770,6 @@ sub get_imageprofile_prov_method
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_imageprofile_prov_osvers
|
||||
Description : Get A node's provisioning os version and profile from its imageprofile attribute.
|
||||
Arguments : $imgprofilename - imageprofile name
|
||||
Returns : node's osversion and profile
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_imageprofile_prov_osvers
|
||||
{
|
||||
|
||||
my $class = shift;
|
||||
my $imgprofilename = shift;
|
||||
my $osimgtab = xCAT::Table->new('osimage');
|
||||
my $osimgentry = ($osimgtab->getAllAttribsWhere("imagename = '$imgprofilename'", 'ALL' ))[0];
|
||||
my $osversion = $osimgentry->{'osvers'};
|
||||
my $profile = $osimgentry->{'profile'};
|
||||
return ($osversion, $profile);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 check_profile_consistent
|
||||
Description : Check if three profile consistent
|
||||
Arguments : $imageprofile - image profile name
|
||||
@@ -860,11 +861,6 @@ sub check_profile_consistent{
|
||||
return 0, "$nictype networkprofile must use with hardwareprofile.";
|
||||
}
|
||||
}
|
||||
|
||||
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' ) {
|
||||
|
||||
@@ -810,10 +810,6 @@ sub senddeviceskeys
|
||||
# add to the command
|
||||
$setupcmd .=$key;
|
||||
$setupcmd .="\"";
|
||||
# Special case for vios
|
||||
if ($ENV{DEVICETYPE} eq 'vios') {
|
||||
$setupcmd = "\"echo $key | tee -a ~/.ssh/authorized_keys2\"";
|
||||
}
|
||||
# For each input device
|
||||
my @nodelist=split(/,/,$nodes);
|
||||
foreach my $node (@nodelist) {
|
||||
|
||||
@@ -287,7 +287,7 @@ sub dodiscover {
|
||||
if ($rethash{$peername}) {
|
||||
next; #got a dupe, discard
|
||||
}
|
||||
my $result = process_slp_packet(packet=>$slpkg,sockaddr=>$pkg,'socket'=>$args{'socket'}, peername=>$peername, callback=>$args{reqcallback});
|
||||
my $result = process_slp_packet(packet=>$slpkg,sockaddr=>$pkg,'socket'=>$args{'socket'});
|
||||
if ($result) {
|
||||
if ($peername =~ /\./) { #ipv4
|
||||
$peername =~ s/::ffff://;
|
||||
@@ -371,10 +371,9 @@ sub process_slp_packet {
|
||||
if ($parsedpacket->{FunctionId} == 2) {#Service Reply
|
||||
parse_service_reply($parsedpacket->{payload},$parsedpacket);
|
||||
unless (ref $parsedpacket->{service_urls} and scalar @{$parsedpacket->{service_urls}}) { return undef; }
|
||||
if ($parsedpacket->{attributes} && get_mac_for_addr($args{peername})) {
|
||||
#service reply had ext. Stop here if has gotten attributes and got mac.
|
||||
#continue the unicast request for service attributes if cannot find mac for peernode
|
||||
return $parsedpacket; #don't bother sending attrrequest, already got it in first packet
|
||||
if ($parsedpacket->{attributes}) { #service reply had ext
|
||||
|
||||
return $parsedpacket; #don't bother sending attrrequest, already got it in first packet
|
||||
}
|
||||
my $srvtype = $xid_to_srvtype_map{$parsedpacket->{Xid}};
|
||||
my $packet = generate_attribute_request(%args,SrvType=>$srvtype);
|
||||
|
||||
@@ -393,46 +393,7 @@ ipmi => {
|
||||
descriptions => {
|
||||
node => 'The node name or group name.',
|
||||
bmc => 'The hostname of the BMC adapater.',
|
||||
bmcport => ' In systems with selectable shared/dedicated ethernet ports,
|
||||
this parameter can be used to specify the preferred port. 0
|
||||
means use the shared port, 1 means dedicated, blank is to not
|
||||
assign.
|
||||
|
||||
The following special cases exist for IBM System x servers:
|
||||
|
||||
For x3755 M3 systems, 0 means use the dedicated port, 1 means
|
||||
shared, blank is to not assign.
|
||||
|
||||
For certain systems which have a mezzaine or ML2 adapter, there is a second
|
||||
value to include:
|
||||
|
||||
|
||||
For x3750 M4 (Model 8722):
|
||||
|
||||
|
||||
0 2 1st 1Gbps interface for LOM
|
||||
|
||||
0 0 1st 10Gbps interface for LOM
|
||||
|
||||
0 3 2nd 1Gbps interface for LOM
|
||||
|
||||
0 1 2nd 10Gbps interface for LOM
|
||||
|
||||
|
||||
For x3750 M4 (Model 8752), x3850/3950 X6, dx360 M4, x3550 M4, and x3650 M4:
|
||||
|
||||
|
||||
0 Shared (1st onboard interface)
|
||||
|
||||
1 Dedicated
|
||||
|
||||
2 0 First interface on ML2 or mezzanine adapter
|
||||
|
||||
2 1 Second interface on ML2 or mezzanine adapter
|
||||
|
||||
2 2 Third interface on ML2 or mezzanine adapter
|
||||
|
||||
2 3 Fourth interface on ML2 or mezzanine adapter',
|
||||
bmcport => 'In systems with selectable shared/dedicated ethernet ports, this parameter can be used to specify the preferred port. 0 means use the shared port, 1 means dedicated, blank is to not assign',
|
||||
taggedvlan => 'Have bmcsetup place the BMC on the specified vlan tag on a shared netwirk interface. Some network devices may be incompatible with this option',
|
||||
bmcid => 'Unique identified data used by discovery processes to distinguish known BMCs from unrecognized BMCs',
|
||||
username => 'The BMC userid. If not specified, the key=ipmi row in the passwd table is used as the default.',
|
||||
@@ -752,7 +713,7 @@ linuximage => {
|
||||
table_desc => 'Information about a Linux operating system image that can be used to deploy cluster nodes.',
|
||||
descriptions => {
|
||||
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).',
|
||||
template => 'The fully qualified name of the template file that is used to create the kick start file for diskful installation.',
|
||||
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. 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',
|
||||
@@ -761,7 +722,7 @@ linuximage => {
|
||||
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 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/',
|
||||
rootimgdir => 'The directory name where the image is stored. It is used for diskless image only.',
|
||||
kerneldir => 'The directory name where the 3rd-party kernel is stored. It is used for diskless image only.',
|
||||
nodebootif => 'The network interface the stateless/statelite node will boot over (e.g. eth0)',
|
||||
otherifce => 'Other network interfaces (e.g. eth1) in the image that should be configured via DHCP',
|
||||
@@ -771,7 +732,7 @@ linuximage => {
|
||||
permission => 'The mount permission of /.statelite directory is used, its default value is 755',
|
||||
dump => qq{The NFS directory to hold the Linux kernel dump file (vmcore) when the node with this image crashes, its format is "nfs://<nfs_server_ip>/<kdump_path>". If you want to use the node's "xcatmaster" (its SN or MN), <nfs_server_ip> can be left blank. For example, "nfs:///<kdump_path>" means the NFS directory to hold the kernel dump file is on the node's SN, or MN if there's no SN.},
|
||||
crashkernelsize => 'the size that assigned to the kdump kernel. If the kernel size is not set, 256M will be the default value.',
|
||||
partitionfile => 'The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "<partition file absolute path>" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES). "s:<partitioning script absolute path>" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify "<partition file absolute path>"; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.',
|
||||
partitionfile => 'The path of the configuration file which is used to part the disk for the node. For stateful: two types of value can be set for this attribute. One is "<partition file absolute path>", the content of the partition file must use the corresponding format with the OS type. The other one is "s:<partition file absolute path>", the content of the partition file should be a shell script which must write the partition definition into /tmp/partitionfile on the node. For statelite: the valid value is <partition file absolute path>, refer to the statelite doc for the xCAT defined format of the configuration file.',
|
||||
driverupdatesrc => 'The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_srouce_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
@@ -786,7 +747,7 @@ winimage => {
|
||||
imagename => 'The name of this xCAT OS image definition.',
|
||||
template => 'The fully qualified name of the template file that is used to create the windows unattend.xml file for diskful installation.',
|
||||
installto => 'The disk and partition that the Windows will be deployed to. The valid format is <disk>:<partition>. If not set, default value is 0:1 for bios boot mode(legacy) and 0:3 for uefi boot mode; If setting to 1, it means 1:1 for bios boot and 1:3 for uefi boot',
|
||||
partitionfile => 'The path of partition configuration file. Since the partition configuration for bios boot mode and uefi boot mode are different, this configuration file can include both configurations if you need to support both bios and uefi mode. Either way, you must specify the boot mode in the configuration. Example of partition configuration file: [BIOS]xxxxxxx[UEFI]yyyyyyy. To simplify the setting, you also can set installto in partitionfile with section like [INSTALLTO]0:1',
|
||||
partitionfile => 'The path of partition configuration file. Since the partition configuration for bios boot mode and uefi boot mode are different, this configuration file should include two parts if customer wants to support both bios and uefi mode. If customer just wants to support one of the modes, specify one of them anyway. Example of partition configuration file: [BIOS]xxxxxxx[UEFI]yyyyyyy. To simplify the setting, you also can set installto in partitionfile with section likes [INSTALLTO]0:1',
|
||||
winpepath => 'The path of winpe which will be used to boot this image. If the real path is /tftpboot/winboot/winpe1/, the value for winpepath should be set to winboot/winpe1',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
@@ -960,11 +921,6 @@ site => {
|
||||
" '0' value means include all the nodes in the subnet.\n\n".
|
||||
" pruneservices: Whether to enable service pruning when noderm is run (i.e.\n".
|
||||
" removing DHCP entries when noderm is executed)\n\n".
|
||||
" managedaddressmode: The mode of networking configuration during node provision.\n".
|
||||
" If set to 'static', the network configuration will be configured \n".
|
||||
" in static mode based on the node and network definition on MN.\n".
|
||||
" If set to 'dhcp', the network will be configured with dhcp protocol.\n".
|
||||
" The default is 'dhcp'.\n\n".
|
||||
" ------------\n".
|
||||
"DNS ATTRIBUTES\n".
|
||||
" ------------\n".
|
||||
@@ -985,12 +941,6 @@ site => {
|
||||
" \"<xcatmaster>\" to mean the DNS server for each node should be the\n".
|
||||
" node that is managing it (either its service node or the management\n".
|
||||
" node).\n\n".
|
||||
" externaldns: To specify that external dns is used. If externaldns is set to any value\n".
|
||||
" then, makedns command will not start the local nameserver on xCAT MN. \n".
|
||||
" Default is to start the local nameserver.\n\n".
|
||||
" dnsupdaters: The value are \',\' separated string which will be added to the zone config\n".
|
||||
" section. This is an interface for user to add configuration entries to\n".
|
||||
" the zone sections in named.conf.\n\n".
|
||||
" -------------------------\n".
|
||||
"HARDWARE CONTROL ATTRIBUTES\n".
|
||||
" -------------------------\n".
|
||||
@@ -1146,10 +1096,6 @@ site => {
|
||||
" will not interfere.\n\n".
|
||||
" vmwarereconfigonpower: When set to no, the VMWare plugin will make no effort to\n".
|
||||
" push vm.cpus/vm.memory updates from xCAT to VMWare.\n\n".
|
||||
" persistkvmguests: Keep the kvm definition on the kvm hypervisor when you power off\n".
|
||||
" the kvm guest node. This is useful for you to manually change the \n".
|
||||
" kvm xml definition file in virsh for debugging. Set anything means\n".
|
||||
" enable.\n\n".
|
||||
" --------------------\n".
|
||||
"XCAT DAEMON ATTRIBUTES\n".
|
||||
" --------------------\n".
|
||||
@@ -1160,9 +1106,9 @@ site => {
|
||||
" locking out admin interactive use. This value works with the\n".
|
||||
" xcatmaxconnections and xcatmaxbatch attributes. Is not supported on AIX.\n".
|
||||
" If the value is no, nodes sleep for a random time before contacting\n".
|
||||
" xcatd, and retry. The default is no.\n".
|
||||
" xcatd, and retry. On a new install of xcat, this value will be set to yes.\n".
|
||||
" See the following document for details:\n".
|
||||
" Hints_and_Tips_for_Large_Scale_Clusters\n\n".
|
||||
" https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Hints_and_Tips_for_Large_Scale_Clusters\n\n".
|
||||
" xcatmaxconnections: Number of concurrent xCAT protocol requests before requests\n".
|
||||
" begin queueing. This applies to both client command requests\n".
|
||||
" and node requests, e.g. to get postscripts. Default is 64.\n\n".
|
||||
@@ -1622,18 +1568,7 @@ hwinv => {
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
token => {
|
||||
cols => [qw(tokenid username expire comments disable)],
|
||||
keys => [qw(tokenid)],
|
||||
table_desc => 'The token of users for authentication.',
|
||||
descriptions => {
|
||||
tokenid => 'It is a UUID as an unified identify for the user.',
|
||||
username => 'The user name.',
|
||||
expire => 'The expire time for this token.',
|
||||
comments => 'Any user-provided notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
|
||||
); # end of tabspec definition
|
||||
|
||||
|
||||
|
||||
Executable → Regular
+3
-4
@@ -429,6 +429,7 @@ rmdir \"/tmp/$to_userid\" \n";
|
||||
# Need to check if nodes are in a zone.
|
||||
my @zones;
|
||||
my $tab = xCAT::Table->new("zone");
|
||||
my @zones;
|
||||
if ($tab)
|
||||
{
|
||||
# if we have zones, need to send the zone keys to each node in the zone
|
||||
@@ -622,7 +623,7 @@ sub sendkeysTOzones
|
||||
my ($class, $ref_nodes,$expecttimeout) = @_;
|
||||
my @nodes=$ref_nodes;
|
||||
my $n_str = $nodes[0];
|
||||
@nodes= split(",", $n_str);
|
||||
my @nodes= split(",", $n_str);
|
||||
my $rsp = ();
|
||||
my $cmd;
|
||||
my $roothome = xCAT::Utils->getHomeDir("root");
|
||||
@@ -1177,9 +1178,7 @@ sub getAppStatus
|
||||
my ($class, $nodes_ref, $application) = @_;
|
||||
my @nodes = @$nodes_ref;
|
||||
|
||||
# FIXME: why autocommit matters for a read-only subroutine getNodesAttribs?
|
||||
# but could not get the appstatus without the autocommit=0
|
||||
my $nltab = xCAT::Table->new('nodelist', -autocommit => 0);
|
||||
my $nltab = xCAT::Table->new('nodelist');
|
||||
my $nodeappstat = $nltab->getNodesAttribs(\@nodes,['appstatus']);
|
||||
|
||||
my $ret_nodeappstat;
|
||||
|
||||
+8
-13
@@ -18,9 +18,8 @@ use xCAT::Utils;
|
||||
my %usage = (
|
||||
"rnetboot" =>
|
||||
"Usage: rnetboot <noderange> [-s net|hd] [-F] [-f] [-V|--verbose] [-m table.colum==expectedstatus] [-m table.colum==expectedstatus...] [-r <retrycount>] [-t <timeout>]
|
||||
rnetboot [-h|--help|-v|--version]
|
||||
zVM specific:
|
||||
rnetboot <noderange> [ipl= address]",
|
||||
rnetboot <noderange> [ipl= address]
|
||||
rnetboot [-h|--help|-v|--version]",
|
||||
"rpower" =>
|
||||
"Usage: rpower <noderange> [--nodeps] [on|onstandby|off|suspend|reset|stat|state|boot] [-V|--verbose] [-m table.colum==expectedstatus][-m table.colum==expectedstatus...] [-r <retrycount>] [-t <timeout>]
|
||||
rpower [-h|--help|-v|--version]
|
||||
@@ -28,10 +27,8 @@ my %usage = (
|
||||
rpower <noderange> [boot] [ -c <path to iso> ]
|
||||
PPC (with IVM or HMC) specific:
|
||||
rpower <noderange> [--nodeps] [of] [-V|--verbose]
|
||||
CEC (with HMC) specific:
|
||||
rpower <noderange> [on|off|reset|boot|onstandby]
|
||||
LPAR(with HMC) specific:
|
||||
rpower <noderange> [on|off|reset|stat|state|boot|of|sms|softoff]
|
||||
PPC (HMC) specific:
|
||||
rpower <noderange> [onstandby] [-V|--verbose]
|
||||
CEC(using Direct FSP Management) specific:
|
||||
rpower <noderange> [on|onstandby|off|stat|state|lowpower|resetsp]
|
||||
Frame(using Direct FSP Management) specific:
|
||||
@@ -134,7 +131,7 @@ my %usage = (
|
||||
textid=<*>|
|
||||
frame=<*>|
|
||||
ntp=<[ntp],[ip],[frequency],[v3]>
|
||||
FSP/CEC (using ASM Interface) Specific:
|
||||
FSP/BPA Common:
|
||||
rspconfig <noderange> [autopower|iocap|decfg|memdecfg|procdecfg|time|date|spdump|sysdump|network|hostname]
|
||||
rspconfig <noderange> autopower=<enable|disable>|
|
||||
iocap=<enable|disable>|
|
||||
@@ -225,7 +222,7 @@ my %usage = (
|
||||
lsvm <noderange> [-a|--all]
|
||||
PPC (using Direct FSP Management) specific:
|
||||
lsvm <noderange> [-l|--long] --p775
|
||||
lsvm <noderange>
|
||||
lsvm <noderange>
|
||||
zVM specific:
|
||||
lsvm noderange
|
||||
lsvm noderange --getnetworknames
|
||||
@@ -244,10 +241,8 @@ my %usage = (
|
||||
chvm <noderange> --p775 -i <id> [-m <memory_interleaving>] -r <partition_rule>
|
||||
chvm <noderange> [lparname=<*|name>]
|
||||
chvm <noderange> [vmcpus=min/req/max] [vmmemory=min/req/max]
|
||||
[vmothersetting=hugepage:N,bsr:N]
|
||||
[add_physlots=drc_index1,drc_index2...]
|
||||
[add_vmnics=vlan1,vlan2] [add_vmstorage=<N|viosnode:slotid>] [--vios]
|
||||
chvm <noderange> [del_physlots=drc_index1,drc_index2...]
|
||||
[vmphyslots=drc_index1,drc_index2...] [vmothersetting=hugepage:N,bsr:N]
|
||||
[vmnics=vlan1,vlan2] [vmstorage=<N|viosnode:slotid>] [--vios]
|
||||
chvm <noderange> [del_vadapter=slotid]
|
||||
VMware specific:
|
||||
chvm <noderange> [-a size][-d disk][-p disk][--resize disk=size][--cpus count][--mem memory]
|
||||
|
||||
Executable → Regular
+3
-600
@@ -1370,30 +1370,11 @@ sub runxcmd_output
|
||||
}
|
||||
}
|
||||
}
|
||||
if (defined($node->{error}))
|
||||
{
|
||||
if (ref(\($node->{error}->[0])) eq 'SCALAR')
|
||||
{
|
||||
$desc = $desc . ": " . $node->{error}->[0];
|
||||
}
|
||||
}
|
||||
if (defined($node->{errorcode}))
|
||||
{
|
||||
if (ref(\($node->{errorcode}->[0])) eq 'SCALAR')
|
||||
{
|
||||
$::RUNCMD_RC |= $node->{errorcode}->[0];
|
||||
}
|
||||
}
|
||||
push @$::xcmd_outref, $desc;
|
||||
}
|
||||
if (defined($resp->{error}))
|
||||
{
|
||||
if (ref($resp->{error}) eq 'ARRAY')
|
||||
{
|
||||
push @$::xcmd_outref, @{$resp->{error}};
|
||||
} else {
|
||||
push @$::xcmd_outref, $resp->{error};
|
||||
}
|
||||
}
|
||||
if (defined($resp->{errorcode}))
|
||||
{
|
||||
@@ -1879,7 +1860,8 @@ sub get_image_name
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 StartService
|
||||
Supports AIX only, use startservice for Linux
|
||||
Supports AIX and Linux as long as the service is registered with
|
||||
lssrc or startsrc.
|
||||
Used by the service node plugin (AAsn.pm) to start requested services.
|
||||
Checks to see if the input service is already started. If it is started
|
||||
it stops and starts the service. Otherwise
|
||||
@@ -1899,9 +1881,7 @@ sub get_image_name
|
||||
Example:
|
||||
if (xCAT::Utils->startService("named") { ...}
|
||||
Comments:
|
||||
this subroutine is deprecated for Linux,
|
||||
will be used as an internal function to process AIX service,
|
||||
for linux, use xCAT::Utils->startservice instead
|
||||
none
|
||||
|
||||
=cut
|
||||
|
||||
@@ -2552,12 +2532,6 @@ sub check_deployment_monitoring_settings()
|
||||
($attr, $val) = split /=~/,$m,2;
|
||||
$val =~ s/^\///;
|
||||
$val =~ s/\/$//;
|
||||
} elsif ($m =~ /^[^=]*!=/) {
|
||||
($attr, $val) = split /!=/,$m,2;
|
||||
} elsif ($m =~ /^[^=]*!~/) {
|
||||
($attr, $val) = split /!~/,$m,2;
|
||||
$val =~ s/^\///;
|
||||
$val =~ s/\/$//;
|
||||
} else {
|
||||
my $rsp={};
|
||||
$rsp->{data}->[0] = "Invalid string \"$m\" specified with -m flag";
|
||||
@@ -3513,575 +3487,4 @@ sub fullpathbin
|
||||
|
||||
return $fullpath;
|
||||
}
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 gettimezone
|
||||
returns the name of the timezone defined on the Linux distro.
|
||||
This routine was written to replace the use of /etc/sysconfig/clock which in no
|
||||
longer supported on future Linux releases such as RHEL7. It is suppose to be a routine
|
||||
that can find the timezone on any Linux OS or AIX.
|
||||
Arguments:
|
||||
none
|
||||
Returns:
|
||||
Name of timezone, for example US/Eastern
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
None
|
||||
Example:
|
||||
my $timezone = xCAT::Utils->gettimezone();
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub gettimezone
|
||||
{
|
||||
my ($class) = @_;
|
||||
|
||||
my $tz;
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
$tz= $ENV{'TZ'};
|
||||
} else { # all linux
|
||||
my $localtime = "/etc/localtime";
|
||||
my $zoneinfo = "/usr/share/zoneinfo";
|
||||
my $cmd = "find $zoneinfo -xtype f -exec cmp -s $localtime {} \\; -print | grep -v posix | grep -v SystemV | grep -v right | grep -v localtime ";
|
||||
my $zone_result = xCAT::Utils->runcmd("$cmd", 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
$tz="Could not determine timezone checksum";
|
||||
return $tz;
|
||||
}
|
||||
my @zones = split /\n/, $zone_result;
|
||||
|
||||
$zones[0] =~ s/$zoneinfo\///;
|
||||
if (!$zones[0]) { # if we still did not get one, then default
|
||||
$tz = `cat /etc/timezone`;
|
||||
chomp $tz;
|
||||
} else {
|
||||
$tz=$zones[0];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return $tz;
|
||||
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 servicemap
|
||||
returns the name of service unit(for systemd) or service daemon(for SYSVinit).
|
||||
Arguments:
|
||||
$svcname: the name of the service
|
||||
$svcmgrtype: the service manager type:
|
||||
0: SYSVinit
|
||||
1: systemd
|
||||
2: upstart
|
||||
Returns:
|
||||
the name of service unit or service daemon
|
||||
undef on fail
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
None
|
||||
Example:
|
||||
my $svc = xCAT::Utils->servicemap($svcname,1);
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub servicemap{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
}
|
||||
|
||||
my $svcmgrtype=shift;
|
||||
|
||||
|
||||
#hash structure:
|
||||
#"service name $svcname" =>{
|
||||
#"service manager name(SYSVinit/systemd) $svcmgrtype"
|
||||
#=> ["list of possible service file names for the specified $svcname under the specified $svcmgrtype "]
|
||||
# }
|
||||
#
|
||||
#
|
||||
# if there are more than 1 possible service names for a service among
|
||||
# different os distributions and os releases, the service should be
|
||||
# specified in %svchash with structure
|
||||
# (general service name) => {list of possible service names}
|
||||
#
|
||||
my %svchash=(
|
||||
"dhcp" => ["dhcp3-server","dhcpd","isc-dhcp-server"],
|
||||
"nfs" => ["nfsserver","nfs-server","nfs","nfs-kernel-server"],
|
||||
"named" => ["named","bind9"],
|
||||
"syslog" => ["syslog","syslogd","rsyslog"],
|
||||
"firewall" => ["iptables","firewalld","SuSEfirewall2_setup","ufw"],
|
||||
"http" => ["apache2","httpd"],
|
||||
"ntpserver" =>["ntpd","ntp"],
|
||||
"mysql" => ["mysqld","mysql"],
|
||||
);
|
||||
|
||||
my $path=undef;
|
||||
my $postfix="";
|
||||
my $retdefault=$svcname;
|
||||
if($svcmgrtype == 0){
|
||||
$path="/etc/init.d/";
|
||||
}elsif ($svcmgrtype == 1){
|
||||
$path="/usr/lib/systemd/system/";
|
||||
$postfix=".service";
|
||||
# $retdefault=$svcname.".service";
|
||||
}elsif ($svcmgrtype == 2){
|
||||
$path="/etc/init/";
|
||||
$postfix=".conf";
|
||||
}
|
||||
|
||||
|
||||
my $ret=undef;
|
||||
if($svchash{$svcname}){
|
||||
foreach my $file (@{$svchash{$svcname}}){
|
||||
if(-e $path.$file.$postfix ){
|
||||
$ret=$file;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(-e $path.$retdefault.$postfix){
|
||||
$ret=$retdefault;
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 startservice
|
||||
start a service
|
||||
Arguments:
|
||||
service name
|
||||
Returns:
|
||||
0 on success
|
||||
nonzero otherwise
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils->startservice("nfs");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub startservice{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
}
|
||||
|
||||
my $cmd="";
|
||||
#for Systemd
|
||||
my $svcunit=undef;
|
||||
#for sysVinit
|
||||
my $svcd=undef;
|
||||
#for upstart
|
||||
my $svcjob=undef;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
if($svcunit)
|
||||
{
|
||||
$cmd="systemctl start $svcunit";
|
||||
}
|
||||
elsif( $svcjob )
|
||||
{
|
||||
$cmd="initctl start $svcjob";
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
$cmd="service $svcd start";
|
||||
}
|
||||
|
||||
#print "$cmd\n";
|
||||
if( $cmd eq "" )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#xCAT::Utils->runcmd($cmd, -1); # do not use runcmd (backtics), must use system to not fork
|
||||
system($cmd);
|
||||
$::RUNCMD_RC=$?;
|
||||
return $::RUNCMD_RC;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 stopservice
|
||||
stop a service
|
||||
Arguments:
|
||||
service name
|
||||
Returns:
|
||||
0 on success
|
||||
nonzero otherwise
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils->stopservice("nfs");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub stopservice{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
}
|
||||
|
||||
my $cmd="";
|
||||
my $svcunit=undef;
|
||||
my $svcd=undef;
|
||||
my $svcjob=undef;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
if($svcunit)
|
||||
{
|
||||
$cmd="systemctl stop $svcunit";
|
||||
}
|
||||
elsif( $svcjob )
|
||||
{
|
||||
$cmd="initctl status $svcjob |grep stop; if [ \"\$?\" != \"0\" ]; then initctl stop $svcjob ; fi";
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
$cmd="service $svcd stop";
|
||||
}
|
||||
|
||||
|
||||
#print "$cmd\n";
|
||||
if( $cmd eq "" )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#xCAT::Utils->runcmd($cmd, -1); # do not use runcmd (backtics), must use system to not fork
|
||||
system($cmd);
|
||||
$::RUNCMD_RC=$?;
|
||||
return $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 restartservice
|
||||
restart a service
|
||||
Arguments:
|
||||
service name
|
||||
Returns:
|
||||
0 on success
|
||||
nonzero otherwise
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils->restartservice("nfs");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub restartservice{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
}
|
||||
|
||||
my $cmd="";
|
||||
my $svcunit=undef;
|
||||
my $svcd=undef;
|
||||
my $svcjob=undef;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
if($svcunit)
|
||||
{
|
||||
$cmd="systemctl restart $svcunit";
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
$cmd="service $svcd restart";
|
||||
}
|
||||
elsif( $svcjob )
|
||||
{
|
||||
$cmd="initctl status $svcjob |grep stop; if [ \"\$?\" != \"0\" ]; then initctl restart $svcjob ; else initctl start $svcjob; fi";
|
||||
}
|
||||
|
||||
#print "$cmd\n";
|
||||
if( $cmd eq "" )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
return $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 checkservicestatus
|
||||
returns theservice status.
|
||||
Arguments:
|
||||
$svcname: the name of the service
|
||||
$outputoption[optional]:
|
||||
the output option
|
||||
1: return a hashref with the keys:"retcode","retmsg"
|
||||
otherwise: return retcode only
|
||||
Returns:
|
||||
undef on fail
|
||||
a hashref if $outputoption is 1,the hash structure is:
|
||||
{"retcode"=>(status code, 0 for running/active,1 for stopped/inactive,2 for failed)
|
||||
"retmsg" =>(status string, running/active/stopped/inactive/failed)
|
||||
}
|
||||
the status code otherwise
|
||||
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
None
|
||||
Example:
|
||||
my $ret = xCAT::Utils-checkservicestatus($svcname,1);
|
||||
my $retcode = xCAT::Utils-checkservicestatus($svcname);
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub checkservicestatus{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
}
|
||||
|
||||
my $outputoption=shift;
|
||||
|
||||
my $cmd="";
|
||||
my $svcunit=undef;
|
||||
my $svcd=undef;
|
||||
my $svcjob=undef;
|
||||
my %ret;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
my $output=undef;
|
||||
|
||||
if($svcunit)
|
||||
{
|
||||
#for systemd, parse the output since it is formatted
|
||||
$cmd="systemctl show --property=ActiveState $svcunit|awk -F '=' '{print \$2}'";
|
||||
$output=xCAT::Utils->runcmd($cmd, -1);
|
||||
if($output =~ /^active$/i){
|
||||
$ret{retcode}=0;
|
||||
}elsif($output =~ /^failed$/i){
|
||||
$ret{retcode}=2;
|
||||
|
||||
}elsif($output =~ /^inactive$/i){
|
||||
$ret{retcode}=1;
|
||||
}
|
||||
}
|
||||
elsif ( $svcjob )
|
||||
{
|
||||
#for upstart, parse the output
|
||||
$cmd="initctl status $svcjob";
|
||||
$output=xCAT::Utils->runcmd($cmd, -1);
|
||||
if($output =~ /waiting/i){
|
||||
$ret{retcode}=2;
|
||||
}elsif($output =~ /running/i){
|
||||
$ret{retcode}=0;
|
||||
}
|
||||
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
#for SYSVinit, check the return value since the "service" command output is confused
|
||||
$cmd="service $svcd status";
|
||||
$output=xCAT::Utils->runcmd($cmd, -1);
|
||||
$ret{retcode}=$::RUNCMD_RC;
|
||||
# if($output =~ /stopped|not running/i){
|
||||
# $ret{retcode}=1;
|
||||
# }elsif($output =~ /running/i){
|
||||
# $ret{retcode}=0;
|
||||
# }
|
||||
}
|
||||
if($output)
|
||||
{
|
||||
$ret{retmsg}=$output;
|
||||
}
|
||||
|
||||
|
||||
if(defined $outputoption and $outputoption == 1 ){
|
||||
return \%ret;
|
||||
}elsif(exists $ret{retcode}){
|
||||
return $ret{retcode};
|
||||
}
|
||||
|
||||
return undef;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 enableservice
|
||||
enable a service to start it on the system bootup
|
||||
Arguments:
|
||||
service name
|
||||
Returns:
|
||||
0 on success
|
||||
nonzero otherwise
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils->enableservice("nfs");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub enableservice{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
|
||||
}
|
||||
my $cmd="";
|
||||
my $svcunit=undef;
|
||||
my $svcd=undef;
|
||||
my $svcjob=undef;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
if($svcunit)
|
||||
{
|
||||
$cmd="systemctl enable $svcunit";
|
||||
}
|
||||
elsif($svcjob)
|
||||
{
|
||||
$cmd="update-rc.d $svcjob defaults";
|
||||
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
|
||||
if($CHKCONFIG ne "chkconfig"){
|
||||
$cmd="$CHKCONFIG $svcd on";
|
||||
}else{
|
||||
$CHKCONFIG = xCAT::Utils->fullpathbin("update-rc.d");
|
||||
if($CHKCONFIG ne "update-rc.d"){
|
||||
$cmd="$CHKCONFIG $svcd defaults";
|
||||
}
|
||||
}
|
||||
}
|
||||
if( $cmd eq "" )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
return $::RUNCMD_RC;
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 disableservice
|
||||
disable a service to prevent it from starting on system bootup
|
||||
Arguments:
|
||||
service name
|
||||
Returns:
|
||||
0 on success
|
||||
nonzero otherwise
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::Utils->disableservice("nfs");
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub disableservice{
|
||||
my $svcname=shift;
|
||||
if( $svcname =~ /xCAT::Utils/)
|
||||
{
|
||||
$svcname=shift;
|
||||
|
||||
}
|
||||
my $cmd="";
|
||||
my $svcunit=undef;
|
||||
my $svcjob=undef;
|
||||
my $svcd=undef;
|
||||
|
||||
$svcunit=servicemap($svcname,1);
|
||||
$svcjob=servicemap($svcname,2);
|
||||
$svcd=servicemap($svcname,0);
|
||||
if($svcunit)
|
||||
{
|
||||
$cmd="systemctl disable $svcunit";
|
||||
}
|
||||
elsif($svcjob)
|
||||
{
|
||||
$cmd="update-rc.d -f $svcjob remove";
|
||||
|
||||
}
|
||||
elsif( $svcd )
|
||||
{
|
||||
my $CHKCONFIG = xCAT::Utils->fullpathbin("chkconfig");
|
||||
if($CHKCONFIG ne "chkconfig"){
|
||||
$cmd="$CHKCONFIG $svcd off";
|
||||
}else{
|
||||
$CHKCONFIG = xCAT::Utils->fullpathbin("update-rc.d");
|
||||
if($CHKCONFIG ne "update-rc.d"){
|
||||
$cmd="$CHKCONFIG -f $svcd remove";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# print "$cmd\n";
|
||||
if( $cmd eq "" )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
return $::RUNCMD_RC;
|
||||
}
|
||||
1;
|
||||
|
||||
@@ -18,7 +18,6 @@ require Exporter;
|
||||
"1341569670.539525" => "centos6.3",#x86
|
||||
"1362445555.957609" => "centos6.4",#x86_64
|
||||
"1385726732.061157" => "centos6.5",#x86_64
|
||||
"1404489053.504589" => "centos7.0",
|
||||
"1176234647.982657" => "centos5",
|
||||
"1156364963.862322" => "centos4.4",
|
||||
"1178480581.024704" => "centos4.5",
|
||||
@@ -30,7 +29,6 @@ require Exporter;
|
||||
"1272326751.405938" => "centos5.5",
|
||||
"1330913492.861127" => "centos5.8",#x86_64
|
||||
"1357930415.252042" => "centos5.9",#x86_64
|
||||
"1381776971.473332" => "centos5.10",#x86_64
|
||||
"1195488871.805863" => "centos4.6",
|
||||
"1195487524.127458" => "centos4.6",
|
||||
"1301444731.448392" => "centos5.6",
|
||||
@@ -72,8 +70,6 @@ require Exporter;
|
||||
"1321545261.599847" => "rhelhpc6.2",#x86_64
|
||||
"1339640148.070971" => "rhelhpc6.3",#x86_64
|
||||
"1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode
|
||||
"1384196516.465862" => "rhelhpc6.5",#x86_64, RHEL ComputeNode
|
||||
"1399449226.140088" => "rhelhpc7.0",#x86_64, RHEL ComputeNode
|
||||
"1194015916.783841" => "fedora8",
|
||||
"1194015385.299901" => "fedora8",
|
||||
"1210112435.291709" => "fedora9",
|
||||
@@ -92,11 +88,9 @@ require Exporter;
|
||||
"1194512327.501046" => "rhas4.6",
|
||||
"1241464993.830723" => "rhas4.8", #x86-64
|
||||
|
||||
"1273608367.051780" => "SL5.5", #x86_64 DVD ISO
|
||||
"1299104542.844706" => "SL6", #x86_64 DVD ISO
|
||||
"1390839789.062069" => "SL6.5", #x86_64 DVD ISO Install
|
||||
|
||||
"1394111947.452332" => "pkvm2.1", # ppc64, PowerKVM
|
||||
"1273608367.051780" => "SL5.5", #x86_64 DVD ISO
|
||||
"1299104542.844706" => "SL6", #x86_64 DVD ISO
|
||||
"1394111947.452332" => "pkvm2.1", # ppc64
|
||||
);
|
||||
my %numdiscs = (
|
||||
"1156364963.862322" => 4,
|
||||
|
||||
+3755
-917
File diff suppressed because it is too large
Load Diff
@@ -2393,7 +2393,7 @@ sub getFreeRepoSpace {
|
||||
if ($master eq $ip) {
|
||||
# If the master IP and node IP match, then it is the management node
|
||||
my $out = `$sudo /bin/df -h /install | sed 1d`;
|
||||
# causing problems on other platforms $out =~ s/\h+/ /g;$out =~ s/\h+/ /g;
|
||||
$out =~ s/\h+/ /g;
|
||||
my @results = split(' ', $out);
|
||||
return ($results[3]);
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# AIX Bundle file for compiler runtime packages
|
||||
|
||||
I:xlC.aix61
|
||||
I:xlC.rte
|
||||
I:xlfrte
|
||||
I:xlfrte.aix61
|
||||
I:xlfrte.msg.en_US
|
||||
I:xlsmp.aix61.rte
|
||||
I:xlsmp.msg.en_US.rte
|
||||
I:xlsmp.rte
|
||||
@@ -41,8 +41,8 @@ if [ $OS != "AIX" ]; then
|
||||
mkdir -p /tmp/gpfs_updates
|
||||
rm -f -R /tmp/gpfs_updates/*
|
||||
cd /tmp/gpfs_updates
|
||||
# wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=3 ftp://$MASTER/$UPDATES_DIR/*.rpm 2> /tmp/wget.log
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=4 --reject "index.html*" --no-parent http://$MASTER$INSTALL_DIR/$UPDATES_DIR/ 2> /tmp/wget.log
|
||||
# wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=3 ftp://$SITEMASTER/$UPDATES_DIR/*.rpm 2> /tmp/wget.log
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -t 10 -T 60 -nH --cut-dirs=4 --reject "index.html*" --no-parent http://$SITEMASTER$INSTALL_DIR/$UPDATES_DIR/ 2> /tmp/wget.log
|
||||
if [ -n "`ls *.rpm 2> /dev/null`" ] ; then
|
||||
rpm -Uvh *.rpm
|
||||
fi
|
||||
|
||||
@@ -62,8 +62,7 @@ else
|
||||
file=$1
|
||||
fi
|
||||
|
||||
#ifconfig -a | grep 'inet ' | awk ' { print $2 } ' | grep -v 127.0.0.1 |
|
||||
ip -4 -oneline addr show 2>/dev/null |grep inet | sed -ne "s/.*inet //p"|awk -F ' ' '{print $1}'|awk -F '/' '{print $1}'|
|
||||
ifconfig -a | grep 'inet ' | awk ' { print $2 } ' | grep -v 127.0.0.1 |
|
||||
while read my_address ; do
|
||||
##print "checking $my_address"
|
||||
grep -q " ${my_address}$" $file
|
||||
|
||||
@@ -67,13 +67,11 @@ sub opsaddbmnode {
|
||||
|
||||
my $help;
|
||||
my $version;
|
||||
my $verbose;
|
||||
my $host;
|
||||
|
||||
if(!GetOptions(
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$version,
|
||||
'V|verbose' => \$verbose,
|
||||
's=s' => \$host,
|
||||
))
|
||||
{
|
||||
@@ -245,18 +243,7 @@ sub opsaddbmnode {
|
||||
$disk = 1;
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Attributes gathered from the xCAT database:";
|
||||
push @{$rsp->{data}}, " bmc=$bmc";
|
||||
push @{$rsp->{data}}, " bmc_user=$bmc_user";
|
||||
push @{$rsp->{data}}, " bmc_password=$bmc_password";
|
||||
push @{$rsp->{data}}, " mac=$mac";
|
||||
push @{$rsp->{data}}, " cpu=$cpu";
|
||||
push @{$rsp->{data}}, " memory=$memory";
|
||||
push @{$rsp->{data}}, " disk=$disk";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
#print "$bmc, $bmc_user, $bmc_password, $mac, $cpu, $memory, $disk\n";
|
||||
|
||||
#call OpenStack command to add the node into the OpenStack as
|
||||
#a baremetal node.
|
||||
@@ -276,14 +263,7 @@ sub opsaddbmnode {
|
||||
}
|
||||
$cmd_tmp .= " $host $cpu $memory $disk $mac";
|
||||
|
||||
my $cmd = qq~$cmd_tmp~;
|
||||
if ($verbose) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "The command to run on $host:";
|
||||
push @{$rsp->{data}}, " $cmd";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
my $cmd = qq~source \~/openrc;$cmd_tmp~;
|
||||
#print "cmd=$cmd\n";
|
||||
my $output =
|
||||
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$host], $cmd, 0);
|
||||
@@ -291,17 +271,8 @@ sub opsaddbmnode {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "OpenStack creating baremetal node $node:";
|
||||
push @{$rsp->{data}}, "$output";
|
||||
push @{$rsp->{data}}, "The command was: $cmd";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
} else {
|
||||
if (($verbose) && ($output)) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$output";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +296,6 @@ sub opsaddimage {
|
||||
|
||||
my $help;
|
||||
my $version;
|
||||
my $verbose;
|
||||
#my $cloud;
|
||||
my $ops_img_names;
|
||||
my $controller;
|
||||
@@ -333,7 +303,6 @@ sub opsaddimage {
|
||||
if(!GetOptions(
|
||||
'h|help' => \$help,
|
||||
'v|version' => \$version,
|
||||
'V|verbose' => \$verbose,
|
||||
'c=s' => \$controller,
|
||||
'n=s' => \$ops_img_names,
|
||||
))
|
||||
@@ -422,46 +391,16 @@ sub opsaddimage {
|
||||
}
|
||||
my $cmd_tmp = "glance image-create --name $new_name --public --disk-format qcow2 --container-format bare --property xcat_image_name=\'$image\' < /tmp/$image.qcow2";
|
||||
|
||||
my $cmd = qq~touch /tmp/$image.qcow2;$cmd_tmp~;
|
||||
if ($verbose) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "The command to run on $controller:";
|
||||
push @{$rsp->{data}}, " $cmd";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
my $cmd = qq~touch /tmp/$image.qcow2;source \~/openrc;$cmd_tmp;rm /tmp/$image.qcow2~;
|
||||
#print "cmd=$cmd\ncontroller=$controller\n";
|
||||
my $output =
|
||||
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$controller], $cmd, 0);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "OpenStack creating image $new_name:";
|
||||
push @{$rsp->{data}}, "$output";
|
||||
push @{$rsp->{data}}, "The command was: $cmd";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
} else {
|
||||
if (($verbose) && ($output)) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$output";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
my $cmd1 = qq~rm /tmp/$image.qcow2~;
|
||||
if ($verbose) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "The command to run on $controller:";
|
||||
push @{$rsp->{data}}, " $cmd1";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
my $output1 =
|
||||
xCAT::InstUtils->xcmd($callback, $doreq, "xdsh", [$controller], $cmd1, 0);
|
||||
if (($verbose) && ($output1)) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "$output1";
|
||||
push @{$rsp->{data}}, " ";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -906,7 +845,7 @@ sub opsaddbmnode_usage {
|
||||
|
||||
$rsp->{data}->[0]= "Usage: opsaddbmnode -h";
|
||||
$rsp->{data}->[1]= " opsaddbmnode -v";
|
||||
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host> [-V]";
|
||||
$rsp->{data}->[2]= " opsaddbmnode <noderange> -s <service_host>";
|
||||
$cb->($rsp);
|
||||
}
|
||||
|
||||
@@ -924,7 +863,7 @@ sub opsaddimage_usage {
|
||||
|
||||
$rsp->{data}->[0]= "Usage: opsaddimage -h";
|
||||
$rsp->{data}->[1]= " opsaddimage -v";
|
||||
$rsp->{data}->[2]= " opsaddimage <image1,image2...> [-n <new_name1,new_name2...> -c <controller> [-V]";
|
||||
$rsp->{data}->[2]= " opsaddimage <image1,image2...> [-n <new_name1,new_name2...> -c <controller>";
|
||||
$cb->($rsp);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ B<opsaddbmnode> - It adds xCAT baremetal nodes to an OpenStack cloud.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<opsaddbmnode> I<noderange> B<-s> I<service_host> [B<-V>|B<--verbose>]
|
||||
B<opsaddbmnode> I<noderange> B<-s> I<service_host>
|
||||
|
||||
B<opsaddbmnode> [B<-h>|B<--help>]
|
||||
|
||||
@@ -59,8 +59,6 @@ I<noderage> is a comma separated node or node group names.
|
||||
|
||||
=item B<-v|--version> The Command Version.
|
||||
|
||||
=item B<-V|--verbose> Verbose output.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
@@ -4,7 +4,7 @@ B<opsaddimage> - It adds or removes nodes for the vlan.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<opsaddimage> I<image1,image2,...> B<-n> I<new_name1,new_name2,...> [B<-c> I<controller>] [B<-V>|B<--verbose>]
|
||||
B<opsaddimage> I<image1,image2,...> B<-n> I<new_name1,new_name2,...> [B<-c> I<controller>]
|
||||
|
||||
B<opsaddimage> [B<-h>|B<--help>]
|
||||
|
||||
@@ -35,8 +35,6 @@ I<image1,image1...> a comma separated xCAT images names.
|
||||
|
||||
=item B<-v|--version> The Command Version.
|
||||
|
||||
=item B<-V|--verbose> Verbose output.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
@@ -100,8 +100,8 @@ change_host_name()
|
||||
|
||||
if [ "$str_os_type" = "sles" ];then
|
||||
echo "Persistently changing the hostname not implemented yet."
|
||||
#debian ubuntu and rh7
|
||||
elif [ -f "/etc/hostname" ];then
|
||||
#debian ubuntu
|
||||
elif [ "$str_os_type" = "debian" ];then
|
||||
conf_file="/etc/hostname"
|
||||
echo "$str_hostname" > $conf_file
|
||||
else
|
||||
|
||||
@@ -36,8 +36,8 @@ change_host_name()
|
||||
|
||||
if [ "$str_os_type" = "sles" ];then
|
||||
echo "Persistently changing the hostname not implemented yet."
|
||||
#debian ubuntu and rh7
|
||||
elif [ -f "/etc/hostname" ];then
|
||||
#debian ubuntu
|
||||
elif [ "$str_os_type" = "debian" ];then
|
||||
conf_file="/etc/hostname"
|
||||
echo "$str_hostname" > $conf_file
|
||||
else
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
include AUTHORS
|
||||
include ChangeLog
|
||||
exclude .gitignore
|
||||
exclude .gitreview
|
||||
|
||||
global-exclude *.pyc
|
||||
@@ -1,44 +0,0 @@
|
||||
xCAT Driver for ironic x86/64 machine
|
||||
==================================
|
||||
|
||||
xCAT is a Extreme Cluster/Cloud Administration Toolkit. We can use xcat
|
||||
to do :
|
||||
1 hardward discoveery
|
||||
2 remote hardware control
|
||||
3 remote sonsole
|
||||
4 hardware inventory
|
||||
5 firmware flashing
|
||||
|
||||
Ironic is a project in Openstack, it will replace the nova-baremetal in juno release. Ironic's design is very flexable, we can add driver to extend function
|
||||
without change any code in Openstack. Ironic xCAT driver takes the advantage of xcat and openstack, we can use it to deploy the baremetal machine very easily.
|
||||
|
||||
Before using this driver, we must setup the openstack environment at least for two nodes( ironic conductor and neutron network node can't setup on the same node)
|
||||
Ironic conductor and the baremetal node( waiting for deploy) must in the same vlan
|
||||
|
||||
Add the follows in the ironic egg-info entry_points.txt file (ironic.drivers section)
|
||||
|
||||
pxe_xcat = ironic.drivers.xcat:XCATBaremetalDriver
|
||||
|
||||
When the openstack with ironic is ready, just execute command in the ironic_xcat directory as follows:
|
||||
|
||||
$ python setup.py install
|
||||
|
||||
Restart the ironic-conductor process
|
||||
|
||||
Initialize the xcat environment according to http://sourceforge.net/p/xcat/wiki/XCAT_iDataPlex_Cluster_Quick_Start/
|
||||
Using xCAT baremetal driver need config site table and run copycds to generate image. The node definition is not requirement.
|
||||
|
||||
Ironic use neutron as the network service.
|
||||
Check the openvswitch config on the network node ,make sure brbm bridge connect to the baremetal node.
|
||||
|
||||
==================================================================================
|
||||
Some Example to use the xCAT baremetal driver.
|
||||
|
||||
$touch /tmp/rhelhpc6.5-x86_64-install-compute.qcow2;glance image-create --name rhelhpc6.5-x86_64-install-compute --public --disk-format qcow2 --container-format bare --property xcat_image_name='rhels6.4-x86_64-install-compute' < /tmp/rhelhpc6.5-x86_64-install-compute.qcow2
|
||||
--name rhelhpc6.5-x86_64-install-compute is the image name in xcat. You can use lsdef -t osimage on the ironic-conductor node which xcat is installed.
|
||||
|
||||
$ ironic node-create --driver pxe_xcat -i ipmi_address=xxx.xxx.xxx.xxx -i ipmi_username=userid -i ipmi_password=password -i xcat_node=x3550m4n02 -i xcatmaster=10.1.0.241 -i netboot=xnba -i ipmi_terminal_port=0 -p memory_mb=2048 -p cpus=8
|
||||
|
||||
$ ironic port-create --address ff:ff:ff:ff:ff:ff --node_uuid <ironic node uuid>
|
||||
|
||||
$ nova boot --flavor baremetal --image <image-id> testing --nic net-id=<internal network id>
|
||||
@@ -1,25 +0,0 @@
|
||||
"""xCAT baremtal exceptions.
|
||||
"""
|
||||
|
||||
from oslo.config import cfg
|
||||
import six
|
||||
|
||||
from ironic.openstack.common.gettextutils import _
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.common.exception import IronicException
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
class xCATCmdFailure(IronicException):
|
||||
message = _("xcat call failed: %(cmd)s %(node)s %(args)s.")
|
||||
|
||||
class xCATDeploymentFailure(IronicException):
|
||||
message = _("xCAT node deployment failed for node %(node)s:%(error)s")
|
||||
|
||||
class GetNetworkFixedIPFailure(IronicException):
|
||||
message = _("get fixed ip failed for mac %(mac_address)s")
|
||||
|
||||
class GetNetworkIdFailure(IronicException):
|
||||
message = _("get node network in failed for mac %(mac_address)s")
|
||||
|
||||
class FailedToGetInfoOnPort(IronicException):
|
||||
message = _("Show info on port: %(port_id)s failed.")
|
||||
@@ -1,41 +0,0 @@
|
||||
"""
|
||||
Get the network from neutron
|
||||
This is a xcat patch for the ironic/common/neutron.py
|
||||
"""
|
||||
|
||||
from neutronclient.common import exceptions as neutron_client_exc
|
||||
from ironic.common import exception
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.common import neutron
|
||||
from ironic.drivers.modules import xcat_exception
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
def get_vif_port_info(task, port_id):
|
||||
""" Get detail port info from neutron with a given port id """
|
||||
api = neutron.NeutronAPI(task.context)
|
||||
try:
|
||||
port_info = api.client.show_port(port_id)
|
||||
except neutron_client_exc.NeutronClientException:
|
||||
LOG.exception(_("Failed to get port info %s."), port_id)
|
||||
raise exception.FailedToGetInfoOnPort(port_id=port_id)
|
||||
return port_info
|
||||
|
||||
|
||||
def get_ports_info_from_neutron(task):
|
||||
""" Get neutron port info from neutron about this task """
|
||||
vifs = neutron.get_node_vif_ids(task)
|
||||
if not vifs:
|
||||
LOG.warning(_("No VIFs found for node %(node)s when attempting to "
|
||||
"update Neutron DHCP BOOT options."),
|
||||
{'node': task.node.uuid})
|
||||
return
|
||||
failures = []
|
||||
vif_ports_info = {}
|
||||
for port_id, port_vif in vifs.iteritems():
|
||||
try:
|
||||
vif_ports_info[port_id] = get_vif_port_info(task,port_vif)
|
||||
except xcat_exception.FailedToGetInfoOnPort(port_id=port_vif):
|
||||
failures.append(port_vif)
|
||||
return vif_ports_info
|
||||
|
||||
@@ -1,453 +0,0 @@
|
||||
"""
|
||||
pxe procedure for the xcat baremetal driver
|
||||
use xcat to config dhcp and tftp
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
import paramiko
|
||||
import datetime
|
||||
from oslo.config import cfg
|
||||
from ironic.common import exception
|
||||
from ironic.common import image_service as service
|
||||
from ironic.common import keystone
|
||||
from ironic.common import states
|
||||
from ironic.common import utils
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.conductor import utils as manager_utils
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers import utils as driver_utils
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.openstack.common import strutils
|
||||
from ironic.drivers.modules import xcat_neutron
|
||||
from ironic.drivers.modules import xcat_util
|
||||
from ironic.openstack.common import loopingcall
|
||||
from nova.openstack.common import timeutils
|
||||
from ironic.openstack.common import lockutils
|
||||
from ironic.drivers.modules import xcat_exception
|
||||
|
||||
|
||||
pxe_opts = [
|
||||
cfg.StrOpt('pxe_append_params',
|
||||
default='nofb nomodeset vga=normal',
|
||||
help='Additional append parameters for baremetal PXE boot.'),
|
||||
cfg.StrOpt('default_ephemeral_format',
|
||||
default='ext4',
|
||||
help='Default file system format for ephemeral partition, '
|
||||
'if one is created.'),
|
||||
]
|
||||
xcat_opts = [
|
||||
cfg.StrOpt('network_node_ip',
|
||||
default='127.0.0.1',
|
||||
help='IP address of neutron network node'),
|
||||
cfg.StrOpt('ssh_user',
|
||||
default='root',
|
||||
help='Username of neutron network node.'),
|
||||
cfg.StrOpt('ssh_password',
|
||||
default='cluster',
|
||||
help='Password of neutron network node'),
|
||||
cfg.IntOpt('ssh_port',
|
||||
default=22,
|
||||
help='ssh connection port for the neutron '),
|
||||
cfg.StrOpt('host_filepath',
|
||||
default='/etc/hosts',
|
||||
help='host file of server'),
|
||||
cfg.IntOpt('deploy_timeout',
|
||||
default=3600,
|
||||
help='max depolyment time(seconds) for the xcat driver'),
|
||||
cfg.IntOpt('deploy_checking_interval',
|
||||
default=30,
|
||||
help='interval time(seconds) to check the xcat deploy state'),
|
||||
]
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(pxe_opts, group='pxe')
|
||||
CONF.register_opts(xcat_opts, group='xcat')
|
||||
CONF.import_opt('use_ipv6', 'ironic.netconf')
|
||||
|
||||
EM_SEMAPHORE = 'xcat_pxe'
|
||||
|
||||
def _check_for_missing_params(info_dict, param_prefix=''):
|
||||
missing_info = []
|
||||
for label, value in info_dict.items():
|
||||
if not value:
|
||||
missing_info.append(param_prefix + label)
|
||||
|
||||
if missing_info:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"Can not validate PXE bootloader. The following parameters "
|
||||
"were not passed to ironic: %s") % missing_info)
|
||||
|
||||
def _parse_driver_info(node):
|
||||
"""Gets the driver specific Node deployment info.
|
||||
|
||||
This method validates whether the 'driver_info' property of the
|
||||
supplied node contains the required information for this driver to
|
||||
deploy images to the node.
|
||||
|
||||
:param node: a single Node.
|
||||
:returns: A dict with the driver_info values.
|
||||
"""
|
||||
info = node.driver_info
|
||||
d_info = {}
|
||||
d_info['xcat_node'] = info.get('xcat_node')
|
||||
return d_info
|
||||
|
||||
def _parse_instance_info(node):
|
||||
"""Gets the instance specific Node deployment info.
|
||||
|
||||
This method validates whether the 'instance_info' property of the
|
||||
supplied node contains the required information for this driver to
|
||||
deploy images to the node.
|
||||
|
||||
:param node: a single Node.
|
||||
:returns: A dict with the instance_info values.
|
||||
"""
|
||||
|
||||
info = node.instance_info
|
||||
i_info = {}
|
||||
i_info['image_source'] = info.get('image_source')
|
||||
i_info['root_gb'] = info.get('root_gb')
|
||||
i_info['image_file'] = i_info['image_source']
|
||||
|
||||
_check_for_missing_params(i_info)
|
||||
|
||||
# Internal use only
|
||||
i_info['deploy_key'] = info.get('deploy_key')
|
||||
|
||||
i_info['swap_mb'] = info.get('swap_mb', 0)
|
||||
i_info['ephemeral_gb'] = info.get('ephemeral_gb', 0)
|
||||
i_info['ephemeral_format'] = info.get('ephemeral_format')
|
||||
|
||||
err_msg_invalid = _("Can not validate PXE bootloader. Invalid parameter "
|
||||
"%(param)s. Reason: %(reason)s")
|
||||
for param in ('root_gb', 'swap_mb', 'ephemeral_gb'):
|
||||
try:
|
||||
int(i_info[param])
|
||||
except ValueError:
|
||||
reason = _("'%s' is not an integer value.") % i_info[param]
|
||||
raise exception.InvalidParameterValue(err_msg_invalid %
|
||||
{'param': param, 'reason': reason})
|
||||
|
||||
if i_info['ephemeral_gb'] and not i_info['ephemeral_format']:
|
||||
i_info['ephemeral_format'] = CONF.pxe.default_ephemeral_format
|
||||
|
||||
preserve_ephemeral = info.get('preserve_ephemeral', False)
|
||||
try:
|
||||
i_info['preserve_ephemeral'] = strutils.bool_from_string(
|
||||
preserve_ephemeral, strict=True)
|
||||
except ValueError as e:
|
||||
raise exception.InvalidParameterValue(err_msg_invalid %
|
||||
{'param': 'preserve_ephemeral', 'reason': e})
|
||||
return i_info
|
||||
|
||||
|
||||
def _parse_deploy_info(node):
|
||||
"""Gets the instance and driver specific Node deployment info.
|
||||
|
||||
This method validates whether the 'instance_info' and 'driver_info'
|
||||
property of the supplied node contains the required information for
|
||||
this driver to deploy images to the node.
|
||||
|
||||
:param node: a single Node.
|
||||
:returns: A dict with the instance_info and driver_info values.
|
||||
"""
|
||||
info = {}
|
||||
info.update(_parse_instance_info(node))
|
||||
info.update(_parse_driver_info(node))
|
||||
return info
|
||||
|
||||
def _validate_glance_image(ctx, deploy_info):
|
||||
"""Validate the image in Glance.
|
||||
|
||||
Check if the image exist in Glance and if it contains the
|
||||
'kernel_id' and 'ramdisk_id' properties.
|
||||
|
||||
:raises: InvalidParameterValue.
|
||||
"""
|
||||
image_id = deploy_info['image_source']
|
||||
if not image_id:
|
||||
raise exception.ImageNotFound
|
||||
|
||||
class PXEDeploy(base.DeployInterface):
|
||||
"""PXE Deploy Interface: just a stub until the real driver is ported."""
|
||||
|
||||
def validate(self, task):
|
||||
"""Validate the deployment information for the task's node.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:raises: InvalidParameterValue.
|
||||
"""
|
||||
node = task.node
|
||||
if not driver_utils.get_node_mac_addresses(task):
|
||||
raise exception.InvalidParameterValue(_("Node %s does not have "
|
||||
"any port associated with it.") % node.uuid)
|
||||
|
||||
d_info = _parse_deploy_info(node)
|
||||
# Try to get the URL of the Ironic API
|
||||
try:
|
||||
# TODO(lucasagomes): Validate the format of the URL
|
||||
CONF.conductor.api_url or keystone.get_service_url()
|
||||
except (exception.CatalogFailure,
|
||||
exception.CatalogNotFound,
|
||||
exception.CatalogUnauthorized):
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"Couldn't get the URL of the Ironic API service from the "
|
||||
"configuration file or keystone catalog."))
|
||||
|
||||
_validate_glance_image(task.context, d_info)
|
||||
|
||||
@task_manager.require_exclusive_lock
|
||||
def deploy(self, task):
|
||||
"""Start deployment of the task's node'.
|
||||
|
||||
Config host file and xcat dhcp, generate image info for xcat
|
||||
and issues a reboot request to the power driver.
|
||||
This causes the node to boot into the deployment ramdisk and triggers
|
||||
the next phase of PXE-based deployment via
|
||||
VendorPassthru._continue_deploy().
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:returns: deploy state DEPLOYDONE.
|
||||
"""
|
||||
|
||||
d_info = _parse_deploy_info(task.node)
|
||||
if not task.node.instance_info.get('fixed_ip_address') or not task.node.instance_info.get('image_name'):
|
||||
raise exception.InvalidParameterValue
|
||||
self._config_host_file(d_info,task.node.instance_info.get('fixed_ip_address'))
|
||||
self._make_dhcp()
|
||||
self._nodeset_osimage(d_info,task.node.instance_info.get('image_name'))
|
||||
manager_utils.node_set_boot_device(task, 'pxe', persistent=True)
|
||||
manager_utils.node_power_action(task, states.REBOOT)
|
||||
try:
|
||||
self._wait_for_node_deploy(task)
|
||||
except xcat_exception.xCATDeploymentFailure:
|
||||
LOG.info(_("xcat deployment failed"))
|
||||
return states.ERROR
|
||||
|
||||
return states.DEPLOYDONE
|
||||
|
||||
@task_manager.require_exclusive_lock
|
||||
def tear_down(self, task):
|
||||
"""Tear down a previous deployment on the task's node.
|
||||
|
||||
Power off the node. All actual clean-up is done in the clean_up()
|
||||
method which should be called separately.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:returns: deploy state DELETED.
|
||||
"""
|
||||
manager_utils.node_power_action(task, states.POWER_OFF)
|
||||
return states.DELETED
|
||||
|
||||
def prepare(self, task):
|
||||
"""Prepare the deployment environment for this task's node.
|
||||
Get the image info from glance, config the mac for the xcat
|
||||
use ssh and iptables to disable dhcp on network node
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
"""
|
||||
# TODO(deva): optimize this if rerun on existing files
|
||||
d_info = _parse_deploy_info(task.node)
|
||||
i_info = task.node.instance_info
|
||||
image_id = d_info['image_source']
|
||||
try:
|
||||
glance_service = service.Service(version=1, context=task.context)
|
||||
image_name = glance_service.show(image_id)['name']
|
||||
i_info['image_name'] = image_name
|
||||
except (exception.GlanceConnectionFailed,
|
||||
exception.ImageNotAuthorized,
|
||||
exception.Invalid):
|
||||
LOG.warning(_("Failed to connect to Glance to get the properties "
|
||||
"of the image %s") % image_id)
|
||||
|
||||
node_mac_addresses = driver_utils.get_node_mac_addresses(task)
|
||||
vif_ports_info = xcat_neutron.get_ports_info_from_neutron(task)
|
||||
try:
|
||||
network_info = self._get_deploy_network_info(vif_ports_info, node_mac_addresses)
|
||||
except (xcat_exception.GetNetworkFixedIPFailure,xcat_exception.GetNetworkIdFailure):
|
||||
LOG.error(_("Failed to get network info"))
|
||||
return
|
||||
if not network_info:
|
||||
LOG.error(_("Failed to get network info"))
|
||||
return
|
||||
|
||||
fixed_ip_address = network_info['fixed_ip_address']
|
||||
deploy_mac_address = network_info['mac_address']
|
||||
network_id = network_info['network_id']
|
||||
|
||||
i_info['fixed_ip_address'] = fixed_ip_address
|
||||
i_info['network_id'] = network_id
|
||||
i_info['deploy_mac_address'] = deploy_mac_address
|
||||
|
||||
# use iptables to drop the dhcp mac of baremetal machine
|
||||
self._ssh_append_dhcp_rule(CONF.xcat.network_node_ip,CONF.xcat.ssh_port,CONF.xcat.ssh_user,
|
||||
CONF.xcat.ssh_password,network_id,deploy_mac_address)
|
||||
self._chdef_node_mac_address(d_info,deploy_mac_address)
|
||||
|
||||
def clean_up(self, task):
|
||||
"""Clean up the deployment environment for the task's node.
|
||||
|
||||
Unlinks TFTP and instance images and triggers image cache cleanup.
|
||||
Removes the TFTP configuration files for this node. As a precaution,
|
||||
this method also ensures the keystone auth token file was removed.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
"""
|
||||
pass
|
||||
|
||||
def take_over(self, task):
|
||||
pass
|
||||
|
||||
def _get_deploy_network_info(self, vif_ports_info, valid_node_mac_addrsses):
|
||||
"""Get network info from mac address of ironic node.
|
||||
:param vif_ports_info: info collection from neutron ports
|
||||
:param valid_node_mac_addrsses: mac address from ironic node
|
||||
:raises: GetNetworkFixedIpFailure if search the fixed ip from mac address failure
|
||||
:raises: GetNetworkIdFailure if search the network id from mac address failure
|
||||
"""
|
||||
network_info = {}
|
||||
for port_info in vif_ports_info.values():
|
||||
if(port_info['port']['mac_address'] in valid_node_mac_addrsses ):
|
||||
network_info['fixed_ip_address'] = port_info['port']['fixed_ips'][0]['ip_address']
|
||||
if not network_info['fixed_ip_address']:
|
||||
raise xcat_exception.GetNetworkFixedIPFailure(mac_address=port_info['port']['mac_address'])
|
||||
network_info['mac_address'] = port_info['port']['mac_address']
|
||||
network_info['network_id'] = port_info['port']['network_id']
|
||||
if not network_info['network_id']:
|
||||
raise xcat_exception.GetNetworkIdFailure(mac_address=port_info['port']['mac_address'])
|
||||
network_info['port_id'] = port_info['port']['id']
|
||||
return network_info
|
||||
return network_info
|
||||
|
||||
def _chdef_node_mac_address(self, driver_info, deploy_mac):
|
||||
""" run chdef command to set mac address"""
|
||||
cmd = 'chdef'
|
||||
args = 'mac='+ deploy_mac
|
||||
try:
|
||||
out_err = xcat_util.exec_xcatcmd(driver_info, cmd, args)
|
||||
LOG.info(_("xcat chdef cmd exetute output: %(out_err)s") % {'out_err':out_err})
|
||||
except xcat_exception.xCATCmdFailure as e:
|
||||
LOG.warning(_("xcat chdef failed for node %(xcat_node)s with "
|
||||
"error: %(error)s.")
|
||||
% {'xcat_node': driver_info['xcat_node'], 'error': e})
|
||||
raise exception.IPMIFailure(cmd=cmd)
|
||||
|
||||
@lockutils.synchronized(EM_SEMAPHORE, 'xcat-hosts-')
|
||||
def _config_host_file(self, driver_info, deploy_ip):
|
||||
""" append node and ip infomation to host file"""
|
||||
with open(CONF.xcat.host_filepath,"r+") as f:
|
||||
lines = []
|
||||
for line in f:
|
||||
temp = line.split('#')
|
||||
if temp[0].strip():
|
||||
host_name = xcat_util._tsplit(temp[0].strip(),(' ','\t'))[1]
|
||||
if driver_info['xcat_node'] not in host_name:
|
||||
lines.append(line)
|
||||
|
||||
# append a new line to host file
|
||||
line = "%s\t%s\n" %(deploy_ip,driver_info['xcat_node'])
|
||||
lines.append(line)
|
||||
f.seek(0)
|
||||
f.truncate()
|
||||
for line in lines:
|
||||
f.write(line)
|
||||
|
||||
def _nodeset_osimage(self, driver_info, image_name):
|
||||
"""run nodeset command to config the image for the xcat node
|
||||
:param driver_info: xcat node deploy info
|
||||
:param image_name: image for the xcat deployment
|
||||
"""
|
||||
cmd = 'nodeset'
|
||||
args = 'osimage='+ image_name
|
||||
try:
|
||||
xcat_util.exec_xcatcmd(driver_info, cmd, args)
|
||||
except xcat_exception.xCATCmdFailure as e:
|
||||
LOG.warning(_("xcat nodeset failed for node %(xcat_node)s with "
|
||||
"error: %(error)s.")
|
||||
% {'xcat_node': driver_info['xcat_node'], 'error': e})
|
||||
|
||||
def _make_dhcp(self):
|
||||
"""run makedhcp command to setup dhcp environment for the xcat node"""
|
||||
cmd = ['makedhcp',
|
||||
'-n'
|
||||
]
|
||||
try:
|
||||
out, err = utils.execute(*cmd)
|
||||
LOG.info(_(" excute cmd: %(cmd)s \n output: %(out)s \n. Error: %(err)s \n"),
|
||||
{'cmd':cmd,'out': out, 'err': err})
|
||||
except Exception as e:
|
||||
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
||||
{'cmd': cmd, 'exception': e})
|
||||
# makedhcp -a
|
||||
cmd = ['makedhcp',
|
||||
'-a'
|
||||
]
|
||||
try:
|
||||
out, err = utils.execute(*cmd)
|
||||
LOG.info(_(" excute cmd: %(cmd)s \n output: %(out)s \n. Error: %(err)s \n"),
|
||||
{'cmd':cmd,'out': out, 'err': err})
|
||||
except Exception as e:
|
||||
LOG.error(_("Unable to execute %(cmd)s. Exception: %(exception)s"),
|
||||
{'cmd': cmd, 'exception': e})
|
||||
|
||||
def _ssh_append_dhcp_rule(self,ip,port,username,password,network_id,mac_address):
|
||||
""" drop the dhcp package in network node to avoid of confilct of dhcp """
|
||||
netns = 'qdhcp-%s' %network_id
|
||||
append_cmd = 'sudo ip netns exec %s iptables -A INPUT -m mac --mac-source %s -j DROP' % \
|
||||
(netns,mac_address)
|
||||
cmd = [append_cmd]
|
||||
xcat_util.xcat_ssh(ip,port,username,password,cmd)
|
||||
|
||||
def _ssh_delete_dhcp_rule(self,ip,port,username,password,network_id,mac_address):
|
||||
""" delete the iptable rule on network node to recover the environment"""
|
||||
netns = 'qdhcp-%s' %network_id
|
||||
cancel_cmd = 'sudo ip netns exec %s iptables -D INPUT -m mac --mac-source %s -j DROP' % \
|
||||
(netns,mac_address)
|
||||
cmd = [cancel_cmd]
|
||||
xcat_util.xcat_ssh(ip,port,username,password,cmd)
|
||||
|
||||
def _wait_for_node_deploy(self, task):
|
||||
"""Wait for xCAT node deployment to complete."""
|
||||
locals = {'errstr':''}
|
||||
driver_info = _parse_deploy_info(task.node)
|
||||
node_mac_addrsses = driver_utils.get_node_mac_addresses(task)
|
||||
i_info = task.node.instance_info
|
||||
|
||||
def _wait_for_deploy():
|
||||
out,err = xcat_util.exec_xcatcmd(driver_info,'nodels','nodelist.status')
|
||||
if err:
|
||||
locals['errstr'] = _("Error returned when quering node status"
|
||||
" for node %s:%s") % (driver_info['xcat_node'], err)
|
||||
LOG.warning(locals['errstr'])
|
||||
raise loopingcall.LoopingCallDone()
|
||||
|
||||
if out:
|
||||
node,status = out.split(": ")
|
||||
status = status.strip()
|
||||
if status == "booted":
|
||||
LOG.info(_("Deployment for node %s completed.")
|
||||
% driver_info['xcat_node'])
|
||||
raise loopingcall.LoopingCallDone()
|
||||
|
||||
if (CONF.xcat.deploy_timeout and
|
||||
timeutils.utcnow() > expiration):
|
||||
locals['errstr'] = _("Timeout while waiting for"
|
||||
" deployment of node %s.") % driver_info['xcat_node']
|
||||
LOG.warning(locals['errstr'])
|
||||
raise loopingcall.LoopingCallDone()
|
||||
|
||||
expiration = timeutils.utcnow() + datetime.timedelta(
|
||||
seconds=CONF.xcat.deploy_timeout)
|
||||
timer = loopingcall.FixedIntervalLoopingCall(_wait_for_deploy)
|
||||
# default check every 10 seconds
|
||||
timer.start(interval=CONF.xcat.deploy_checking_interval).wait()
|
||||
|
||||
if locals['errstr']:
|
||||
raise xcat_exception.xCATDeploymentFailure(locals['errstr'])
|
||||
# deploy end, delete the dhcp rule for xcat
|
||||
self._ssh_delete_dhcp_rule(CONF.xcat.network_node_ip,CONF.xcat.ssh_port,CONF.xcat.ssh_user,
|
||||
CONF.xcat.ssh_password,i_info['network_id'],node_mac_addrsses[0])
|
||||
|
||||
|
||||
@@ -1,479 +0,0 @@
|
||||
|
||||
"""
|
||||
IPMI power manager driver.
|
||||
"""
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import stat
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common import states
|
||||
from ironic.common import utils
|
||||
from ironic.conductor import task_manager
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers.modules import console_utils
|
||||
from ironic.openstack.common import excutils
|
||||
from ironic.openstack.common import log as logging
|
||||
from ironic.openstack.common import loopingcall
|
||||
from ironic.openstack.common import processutils
|
||||
from ironic.drivers.modules import xcat_exception
|
||||
from ironic.drivers.modules import xcat_util
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('retry_timeout',
|
||||
'ironic.drivers.modules.ipminative',
|
||||
group='ipmi')
|
||||
CONF.import_opt('min_command_interval',
|
||||
'ironic.drivers.modules.ipminative',
|
||||
group='ipmi')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
VALID_BOOT_DEVICES = ['net', 'hd', 'cd', 'floppy', 'def', 'stat']
|
||||
VALID_PRIV_LEVELS = ['ADMINISTRATOR', 'CALLBACK', 'OPERATOR', 'USER']
|
||||
TIMING_SUPPORT = None
|
||||
|
||||
|
||||
def _is_timing_supported(is_supported=None):
|
||||
# shim to allow module variable to be mocked in unit tests
|
||||
global TIMING_SUPPORT
|
||||
|
||||
if (TIMING_SUPPORT is None) and (is_supported is not None):
|
||||
TIMING_SUPPORT = is_supported
|
||||
return TIMING_SUPPORT
|
||||
|
||||
|
||||
def check_timing_support():
|
||||
"""Check the installed version of ipmitool for -N -R option support.
|
||||
|
||||
Support was added in 1.8.12 for the -N -R options, which enable
|
||||
more precise control over timing of ipmi packets. Prior to this,
|
||||
the default behavior was to retry each command up to 18 times at
|
||||
1 to 5 second intervals.
|
||||
http://ipmitool.cvs.sourceforge.net/viewvc/ipmitool/ipmitool/ChangeLog?revision=1.37 # noqa
|
||||
|
||||
This method updates the module-level TIMING_SUPPORT variable so that
|
||||
it is accessible by any driver interface class in this module. It is
|
||||
intended to be called from the __init__ method of such classes only.
|
||||
|
||||
:returns: boolean indicating whether support for -N -R is present
|
||||
:raises: OSError
|
||||
"""
|
||||
if _is_timing_supported() is None:
|
||||
# Directly check ipmitool for support of -N and -R options. Because
|
||||
# of the way ipmitool processes' command line options, if the local
|
||||
# ipmitool does not support setting the timing options, the command
|
||||
# below will fail.
|
||||
try:
|
||||
out, err = utils.execute(*['ipmitool', '-N', '0', '-R', '0', '-h'])
|
||||
except processutils.ProcessExecutionError:
|
||||
# the local ipmitool does not support the -N and -R options.
|
||||
_is_timing_supported(False)
|
||||
else:
|
||||
# looks like ipmitool supports timing options.
|
||||
_is_timing_supported(True)
|
||||
|
||||
|
||||
def _console_pwfile_path(uuid):
|
||||
"""Return the file path for storing the ipmi password for a console."""
|
||||
file_name = "%(uuid)s.pw" % {'uuid': uuid}
|
||||
return os.path.join(tempfile.gettempdir(), file_name)
|
||||
|
||||
def _parse_driver_info(node):
|
||||
"""Gets the parameters required for ipmitool to access the node.
|
||||
|
||||
:param node: the Node of interest.
|
||||
:returns: dictionary of parameters.
|
||||
:raises: InvalidParameterValue if any required parameters are missing.
|
||||
|
||||
"""
|
||||
info = node.driver_info or {}
|
||||
address = info.get('ipmi_address')
|
||||
username = info.get('ipmi_username')
|
||||
password = info.get('ipmi_password')
|
||||
port = info.get('ipmi_terminal_port')
|
||||
priv_level = info.get('ipmi_priv_level', 'ADMINISTRATOR')
|
||||
xcat_node = info.get('xcat_node')
|
||||
xcatmaster = info.get('xcatmaster')
|
||||
netboot = info.get('netboot')
|
||||
|
||||
if port:
|
||||
try:
|
||||
port = int(port)
|
||||
except ValueError:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"IPMI terminal port is not an integer."))
|
||||
|
||||
if not address:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"IPMI address not supplied to xcat driver."))
|
||||
|
||||
if priv_level not in VALID_PRIV_LEVELS:
|
||||
valid_priv_lvls = ', '.join(VALID_PRIV_LEVELS)
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"Invalid privilege level value:%(priv_level)s, the valid value"
|
||||
" can be one of %(valid_levels)s") %
|
||||
{'priv_level': priv_level, 'valid_levels': valid_priv_lvls})
|
||||
|
||||
if not xcat_node:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"xcat node name not supplied to xcat driver"))
|
||||
|
||||
if not xcatmaster:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"xcatmaster not supplied to xcat driver"))
|
||||
|
||||
if not netboot:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"netboot not supplied to xcat driver"))
|
||||
|
||||
return {
|
||||
'address': address,
|
||||
'username': username,
|
||||
'password': password,
|
||||
'port': port,
|
||||
'uuid': node.uuid,
|
||||
'priv_level': priv_level,
|
||||
'xcat_node': xcat_node,
|
||||
'xcatmaster': xcatmaster,
|
||||
'netboot': netboot
|
||||
}
|
||||
def chdef_node(driver_info):
|
||||
"""Run the chdef command in xcat, config the node
|
||||
:param driver_info: driver_info for the xcat node
|
||||
"""
|
||||
cmd = 'chdef'
|
||||
args = 'mgt=ipmi' + \
|
||||
' bmc=' + driver_info['address'] + \
|
||||
' bmcusername=' + driver_info['username'] + \
|
||||
' bmcpassword=' + driver_info['password'] + \
|
||||
' xcatmaster=' + driver_info['xcatmaster']+ \
|
||||
' netboot=' + driver_info['netboot']+ \
|
||||
' primarynic=mac'+ \
|
||||
' installnic=mac'+ \
|
||||
' monserver=' + driver_info['xcatmaster'] + \
|
||||
' nfsserver=' + driver_info['xcatmaster'] + \
|
||||
' serialflow=hard'+ \
|
||||
' serialspeed=115200' + \
|
||||
' serialport=' + str(driver_info['port']);
|
||||
|
||||
try:
|
||||
xcat_util.exec_xcatcmd(driver_info, cmd, args)
|
||||
except xcat_exception.xCATCmdFailure as e:
|
||||
LOG.warning(_("xcat chdef failed for node %(node_id)s with "
|
||||
"error: %(error)s.")
|
||||
% {'node_id': driver_info['uuid'], 'error': e})
|
||||
|
||||
def _sleep_time(iter):
|
||||
"""Return the time-to-sleep for the n'th iteration of a retry loop.
|
||||
This implementation increases exponentially.
|
||||
|
||||
:param iter: iteration number
|
||||
:returns: number of seconds to sleep
|
||||
|
||||
"""
|
||||
if iter <= 1:
|
||||
return 1
|
||||
return iter ** 2
|
||||
|
||||
|
||||
def _set_and_wait(target_state, driver_info):
|
||||
"""Helper function for DynamicLoopingCall.
|
||||
|
||||
This method changes the power state and polls the BMCuntil the desired
|
||||
power state is reached, or CONF.ipmi.retry_timeout would be exceeded by the
|
||||
next iteration.
|
||||
|
||||
This method assumes the caller knows the current power state and does not
|
||||
check it prior to changing the power state. Most BMCs should be fine, but
|
||||
if a driver is concerned, the state should be checked prior to calling this
|
||||
method.
|
||||
|
||||
:param target_state: desired power state
|
||||
:param driver_info: the ipmitool parameters for accessing a node.
|
||||
:returns: one of ironic.common.states
|
||||
:raises: IPMIFailure on an error from ipmitool (from _power_status call).
|
||||
|
||||
"""
|
||||
if target_state == states.POWER_ON:
|
||||
state_name = "on"
|
||||
elif target_state == states.POWER_OFF:
|
||||
state_name = "off"
|
||||
|
||||
def _wait(mutable):
|
||||
try:
|
||||
# Only issue power change command once
|
||||
if mutable['iter'] < 0:
|
||||
xcat_util.exec_xcatcmd(driver_info,'rpower',state_name)
|
||||
else:
|
||||
mutable['power'] = _power_status(driver_info)
|
||||
except Exception:
|
||||
# Log failures but keep trying
|
||||
LOG.warning(_("xcat rpower %(state)s failed for node %(node)s."),
|
||||
{'state': state_name, 'node': driver_info['uuid']})
|
||||
finally:
|
||||
mutable['iter'] += 1
|
||||
|
||||
if mutable['power'] == target_state:
|
||||
raise loopingcall.LoopingCallDone()
|
||||
|
||||
sleep_time = _sleep_time(mutable['iter'])
|
||||
if (sleep_time + mutable['total_time']) > CONF.ipmi.retry_timeout:
|
||||
# Stop if the next loop would exceed maximum retry_timeout
|
||||
LOG.error(_('xcat rpower %(state)s timed out after '
|
||||
'%(tries)s retries on node %(node_id)s.'),
|
||||
{'state': state_name, 'tries': mutable['iter'],
|
||||
'node_id': driver_info['uuid']})
|
||||
mutable['power'] = states.ERROR
|
||||
raise loopingcall.LoopingCallDone()
|
||||
else:
|
||||
mutable['total_time'] += sleep_time
|
||||
return sleep_time
|
||||
|
||||
# Use mutable objects so the looped method can change them.
|
||||
# Start 'iter' from -1 so that the first two checks are one second apart.
|
||||
status = {'power': None, 'iter': -1, 'total_time': 0}
|
||||
|
||||
timer = loopingcall.DynamicLoopingCall(_wait, status)
|
||||
timer.start().wait()
|
||||
return status['power']
|
||||
|
||||
def _power_on(driver_info):
|
||||
"""Turn the power ON for this node.
|
||||
|
||||
:param driver_info: the xcat parameters for accessing a node.
|
||||
:returns: one of ironic.common.states POWER_ON or ERROR.
|
||||
:raises: IPMIFailure on an error from ipmitool (from _power_status call).
|
||||
|
||||
"""
|
||||
return _set_and_wait(states.POWER_ON, driver_info)
|
||||
|
||||
|
||||
def _power_off(driver_info):
|
||||
"""Turn the power OFF for this node.
|
||||
|
||||
:param driver_info: the xcat parameters for accessing a node.
|
||||
:returns: one of ironic.common.states POWER_OFF or ERROR.
|
||||
:raises: IPMIFailure on an error from ipmitool (from _power_status call).
|
||||
|
||||
"""
|
||||
return _set_and_wait(states.POWER_OFF, driver_info)
|
||||
|
||||
def _power_status(driver_info):
|
||||
"""Get the power status for a node.
|
||||
|
||||
:param driver_info: the xcat access parameters for a node.
|
||||
:returns: one of ironic.common.states POWER_OFF, POWER_ON or ERROR.
|
||||
:raises: IPMIFailure on an error from ipmitool.
|
||||
|
||||
"""
|
||||
cmd = "rpower"
|
||||
try:
|
||||
out_err = xcat_util.exec_xcatcmd(driver_info,cmd,'status')
|
||||
except Exception as e:
|
||||
LOG.warning(_("xcat rpower status failed for node %(node_id)s with "
|
||||
"error: %(error)s.")
|
||||
% {'node_id': driver_info['uuid'], 'error': e})
|
||||
|
||||
if out_err[0].split(' ')[1].strip() == "on":
|
||||
return states.POWER_ON
|
||||
elif out_err[0].split(' ')[1].strip() == "off":
|
||||
return states.POWER_OFF
|
||||
else:
|
||||
return states.ERROR
|
||||
|
||||
|
||||
class XcatPower(base.PowerInterface):
|
||||
|
||||
def __init__(self):
|
||||
try:
|
||||
check_timing_support()
|
||||
except OSError:
|
||||
raise exception.DriverLoadError(
|
||||
driver=self.__class__.__name__,
|
||||
reason="Unable to locate usable xcat command in "
|
||||
"the system path when checking xcat version")
|
||||
|
||||
def validate(self, task):
|
||||
"""Validate driver_info for xcat driver.
|
||||
|
||||
Check that node['driver_info'] contains IPMI credentials.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:raises: InvalidParameterValue if required ipmi parameters are missing.
|
||||
|
||||
"""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
try:
|
||||
chdef_node(driver_info)
|
||||
except exception:
|
||||
LOG.error(_("chdef xcat info error!"))
|
||||
|
||||
def get_power_state(self, task):
|
||||
"""Get the current power state of the task's node.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:returns: one of ironic.common.states POWER_OFF, POWER_ON or ERROR.
|
||||
|
||||
"""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
return _power_status(driver_info)
|
||||
|
||||
@task_manager.require_exclusive_lock
|
||||
def set_power_state(self, task, pstate):
|
||||
"""Turn the power on or off.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:param pstate: The desired power state, one of ironic.common.states
|
||||
POWER_ON, POWER_OFF.
|
||||
:raises: InvalidParameterValue if required ipmi parameters are missing
|
||||
or if an invalid power state was specified.
|
||||
:raises: PowerStateFailure if the power couldn't be set to pstate.
|
||||
|
||||
"""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
|
||||
if pstate == states.POWER_ON:
|
||||
state = _power_on(driver_info)
|
||||
elif pstate == states.POWER_OFF:
|
||||
state = _power_off(driver_info)
|
||||
else:
|
||||
raise exception.InvalidParameterValue(_("set_power_state called "
|
||||
"with invalid power state %s.") % pstate)
|
||||
if state != pstate:
|
||||
raise exception.PowerStateFailure(pstate=pstate)
|
||||
|
||||
@task_manager.require_exclusive_lock
|
||||
def reboot(self, task):
|
||||
"""Cycles the power to the task's node.
|
||||
|
||||
:param task: a TaskManager instance containing the node to act on.
|
||||
:raises: InvalidParameterValue if required ipmi parameters are missing.
|
||||
:raises: PowerStateFailure if the final state of the node is not
|
||||
POWER_ON.
|
||||
|
||||
"""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
_power_off(driver_info)
|
||||
state = _power_on(driver_info)
|
||||
|
||||
if state != states.POWER_ON:
|
||||
raise exception.PowerStateFailure(pstate=states.POWER_ON)
|
||||
|
||||
class VendorPassthru(base.VendorInterface):
|
||||
@task_manager.require_exclusive_lock
|
||||
def _set_boot_device(self, task, device, persistent=False):
|
||||
"""Set the boot device for a node.
|
||||
|
||||
:param task: a TaskManager instance.
|
||||
:param device: Boot device. One of [net, hd, cd, floppy, def, stat].
|
||||
:param persistent: Whether to set next-boot, or make the change
|
||||
permanent. Default: False.
|
||||
:raises: InvalidParameterValue if an invalid boot device is specified
|
||||
or if required ipmi parameters are missing.
|
||||
:raises: IPMIFailure on an error from ipmitool.
|
||||
|
||||
"""
|
||||
if device not in VALID_BOOT_DEVICES:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"Invalid boot device %s specified.") % device)
|
||||
cmd = "rsetboot"
|
||||
if persistent:
|
||||
cmd = cmd + " options=persistent"
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
try:
|
||||
xcat_util.exec_xcatcmd(driver_info, cmd, device)
|
||||
# TODO(deva): validate (out, err) and add unit test for failure
|
||||
except xcat_exception.xCATCmdFailure:
|
||||
LOG.error(_("rsetboot %(node)s %(device)s"),{'node':driver_info['xcat_node]'],
|
||||
'device':device})
|
||||
|
||||
|
||||
def validate(self, task, **kwargs):
|
||||
""" run chdef command to config xcat node infomation """
|
||||
method = kwargs['method']
|
||||
if method == 'set_boot_device':
|
||||
device = kwargs.get('device')
|
||||
if device not in VALID_BOOT_DEVICES:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"Invalid boot device %s specified.") % device)
|
||||
else:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"Unsupported method (%s) passed to xcat driver.")
|
||||
% method)
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
chdef_node(driver_info)
|
||||
|
||||
def vendor_passthru(self, task, **kwargs):
|
||||
method = kwargs['method']
|
||||
if method == 'set_boot_device':
|
||||
return self._set_boot_device(
|
||||
task,
|
||||
kwargs.get('device'),
|
||||
kwargs.get('persistent', False))
|
||||
|
||||
|
||||
class IPMIShellinaboxConsole(base.ConsoleInterface):
|
||||
"""A ConsoleInterface that uses ipmitool and shellinabox."""
|
||||
|
||||
def __init__(self):
|
||||
try:
|
||||
check_timing_support()
|
||||
except OSError:
|
||||
raise exception.DriverLoadError(
|
||||
driver=self.__class__.__name__,
|
||||
reason="Unable to locate usable xcat command in "
|
||||
"the system path when checking xcat version")
|
||||
|
||||
def validate(self, task):
|
||||
"""Validate the Node console info.
|
||||
|
||||
:param task: a task from TaskManager.
|
||||
:raises: InvalidParameterValue
|
||||
"""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
if not driver_info['xcat_node']:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"xcat node name not supplied to xcat baremetal driver."))
|
||||
if not driver_info['port']:
|
||||
raise exception.InvalidParameterValue(_(
|
||||
"IPMI terminal port not supplied to IPMI driver."))
|
||||
|
||||
def start_console(self, task):
|
||||
"""Start a remote console for the node."""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
|
||||
path = _console_pwfile_path(driver_info['uuid'])
|
||||
pw_file = console_utils.make_persistent_password_file(
|
||||
path, driver_info['password'])
|
||||
|
||||
ipmi_cmd = "/:%(uid)s:%(gid)s:HOME:ipmitool -H %(address)s" \
|
||||
" -I lanplus -U %(user)s -f %(pwfile)s" \
|
||||
% {'uid': os.getuid(),
|
||||
'gid': os.getgid(),
|
||||
'address': driver_info['address'],
|
||||
'user': driver_info['username'],
|
||||
'pwfile': pw_file}
|
||||
if CONF.debug:
|
||||
ipmi_cmd += " -v"
|
||||
ipmi_cmd += " sol activate"
|
||||
console_utils.start_shellinabox_console(driver_info['uuid'],
|
||||
driver_info['port'],
|
||||
ipmi_cmd)
|
||||
|
||||
def stop_console(self, task):
|
||||
"""Stop the remote console session for the node."""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
console_utils.stop_shellinabox_console(driver_info['uuid'])
|
||||
utils.unlink_without_raise(_console_pwfile_path(driver_info['uuid']))
|
||||
|
||||
def get_console(self, task):
|
||||
"""Get the type and connection information about the console."""
|
||||
driver_info = _parse_driver_info(task.node)
|
||||
url = console_utils.get_shellinabox_console_url(driver_info['port'])
|
||||
return {'type': 'shellinabox', 'url': url}
|
||||
@@ -1,110 +0,0 @@
|
||||
"""
|
||||
util for xcat baremetal driver
|
||||
exec_xcatcmd
|
||||
xcat_ssh to excute remote cmd
|
||||
"""
|
||||
import paramiko
|
||||
import time
|
||||
import socket
|
||||
from ironic.openstack.common import log as logging
|
||||
from oslo.config import cfg
|
||||
from ironic.drivers.modules import xcat_exception
|
||||
from ironic.common import utils
|
||||
|
||||
xcat_opts = [
|
||||
cfg.IntOpt('ssh_session_timeout',
|
||||
default=10,
|
||||
help='ssh session time'),
|
||||
cfg.FloatOpt('ssh_shell_wait',
|
||||
default=0.5,
|
||||
help='wait time for the ssh cmd excute'),
|
||||
cfg.IntOpt('ssh_buf_size',
|
||||
default=65535,
|
||||
help='Maximum size (in charactor) of cache for ssh, '
|
||||
'including those in use'),
|
||||
cfg.StrOpt('ssh_key',
|
||||
default=None,
|
||||
help='ssh private key to login '),
|
||||
cfg.StrOpt('ssh_key_pass',
|
||||
default=None,
|
||||
help='Maximum size (in charactor) of cache for ssh, '
|
||||
'including those in use'),
|
||||
]
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(xcat_opts, group='xcat')
|
||||
|
||||
LAST_CMD_TIME = {}
|
||||
|
||||
def xcat_ssh(ip,port,username,password,cmd):
|
||||
""" exec remote command with ssh """
|
||||
key =None
|
||||
if CONF.xcat.ssh_key:
|
||||
try:
|
||||
key=paramiko.RSAKey.from_private_key_file(CONF.xcat.ssh_key)
|
||||
except paramiko.PasswordRequiredException:
|
||||
if not CONF.ssh_key_pass:
|
||||
raise Exception.message("no pubkey password")
|
||||
key = paramiko.RSAKey.from_private_key_file(
|
||||
CONF.xcat.ssh_key, CONF.xcat.ssh_key.ssh_key_pass)
|
||||
s = paramiko.SSHClient()
|
||||
s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
try:
|
||||
s.connect(ip,port,username=username,password=password,pkey=key,
|
||||
timeout=CONF.xcat.ssh_session_timeout)
|
||||
except socket.timeout as e:
|
||||
LOG.error(_("Unable to connect to the ssh server Exception: %(exception)s"),
|
||||
{'exception': e})
|
||||
chan = s.invoke_shell()
|
||||
output = chan.recv(CONF.xcat.ssh_buf_size)
|
||||
while not output.rstrip().endswith('#') and not output.rstrip().endswith('$'):
|
||||
output = chan.recv(CONF.xcat.ssh_buf_size)
|
||||
for c in cmd :
|
||||
_xcat_ssh_exec(chan,c,password)
|
||||
|
||||
def _xcat_ssh_exec(chan,cmd,password):
|
||||
""" exec ssh command """
|
||||
chan.send(cmd + '\n')
|
||||
time.sleep(CONF.xcat.ssh_shell_wait)
|
||||
ret = chan.recv(CONF.xcat.ssh_buf_size)
|
||||
if 'password' in ret and ret.rstrip().endswith(':'):
|
||||
chan.send(password + '\n')
|
||||
output = chan.recv(CONF.xcat.ssh_buf_size)
|
||||
while not output.rstrip().endswith('#') and not output.rstrip().endswith('$'):
|
||||
output = chan.recv(CONF.xcat.ssh_buf_size)
|
||||
return output
|
||||
|
||||
def _tsplit(string, delimiters):
|
||||
""" Behaves str.split but supports multiple delimiters. """
|
||||
delimiters = tuple(delimiters)
|
||||
stack = [string,]
|
||||
for delimiter in delimiters:
|
||||
for i, substring in enumerate(stack):
|
||||
substack = substring.split(delimiter)
|
||||
stack.pop(i)
|
||||
for j, _substring in enumerate(substack):
|
||||
stack.insert(i+j, _substring)
|
||||
return stack
|
||||
|
||||
def exec_xcatcmd(driver_info, command, args):
|
||||
""" excute xcat cmd """
|
||||
cmd = [command,
|
||||
driver_info['xcat_node']
|
||||
]
|
||||
cmd.extend(args.split(" "))
|
||||
# NOTE: ensure that no communications are excuted more
|
||||
# often than once every min_command_interval seconds.
|
||||
time_till_next_poll = CONF.ipmi.min_command_interval - (
|
||||
time.time() - LAST_CMD_TIME.get(driver_info['xcat_node'], 0))
|
||||
if time_till_next_poll > 0:
|
||||
time.sleep(time_till_next_poll)
|
||||
try:
|
||||
out, err = utils.execute(*cmd)
|
||||
if err:
|
||||
raise xcat_exception.xCATCmdFailure(cmd=cmd,node=driver_info['xcat_node'],
|
||||
args=args)
|
||||
finally:
|
||||
LAST_CMD_TIME[driver_info['xcat_node']] = time.time()
|
||||
return out, err
|
||||
@@ -1,30 +0,0 @@
|
||||
"""
|
||||
XCATBaremetalDriver
|
||||
use xcat to deploy a baremetal machine
|
||||
"""
|
||||
|
||||
|
||||
from ironic.drivers import base
|
||||
from ironic.drivers.modules import ipmitool
|
||||
from ironic.drivers.modules import pxe
|
||||
from ironic.drivers.modules import xcat_pxe
|
||||
from ironic.drivers import utils
|
||||
from ironic.drivers.modules import xcat_rpower
|
||||
|
||||
|
||||
class XCATBaremetalDriver(base.BaseDriver):
|
||||
"""xCAT driver
|
||||
This driver implements the `core` functionality, combinding
|
||||
:class:`ironic.drivers.xcat_rpower.XcatPower` for power on/off and reboot with
|
||||
:class:`ironic.driver.xcat_pxe.PXEDeploy` for image deployment. Implementations are in
|
||||
those respective classes; this class is merely the glue between them.
|
||||
"""
|
||||
def __init__(self):
|
||||
self.power = xcat_rpower.XcatPower()
|
||||
self.console = ipmitool.IPMIShellinaboxConsole()
|
||||
self.deploy = xcat_pxe.PXEDeploy()
|
||||
self.pxe_vendor = pxe.VendorPassthru()
|
||||
self.ipmi_vendor = ipmitool.VendorPassthru()
|
||||
self.mapping = {'pass_deploy_info': self.pxe_vendor,
|
||||
'set_boot_device': self.ipmi_vendor}
|
||||
self.vendor = utils.MixinVendorInterface(self.mapping)
|
||||
@@ -1,33 +0,0 @@
|
||||
[DEFAULT]
|
||||
|
||||
# The list of modules to copy from oslo-incubator
|
||||
module=cliutils
|
||||
module=config.generator
|
||||
module=context
|
||||
module=db
|
||||
module=db.sqlalchemy
|
||||
module=db.sqlalchemy.migration_cli
|
||||
module=eventlet_backdoor
|
||||
module=excutils
|
||||
module=fileutils
|
||||
module=gettextutils
|
||||
module=importutils
|
||||
module=jsonutils
|
||||
module=local
|
||||
module=lockutils
|
||||
module=log
|
||||
module=loopingcall
|
||||
module=network_utils
|
||||
module=periodic_task
|
||||
module=policy
|
||||
module=processutils
|
||||
module=service
|
||||
module=strutils
|
||||
module=timeutils
|
||||
module=versionutils
|
||||
|
||||
# Tools
|
||||
|
||||
|
||||
# The base module to hold the copy of openstack.common
|
||||
base=ironic
|
||||
@@ -1,34 +0,0 @@
|
||||
[metadata]
|
||||
name = ironic
|
||||
version = 2014.2
|
||||
summary = OpenStack Bare Metal Provisioning
|
||||
description-file =
|
||||
README.rst
|
||||
author = chenglch
|
||||
author-email = chenglch@cn.ibm.com
|
||||
home-page = http://xcat.sf.net/
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
Intended Audience :: Information Technology
|
||||
Intended Audience :: System Administrators
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 2
|
||||
Programming Language :: Python :: 2.7
|
||||
Programming Language :: Python :: 2.6
|
||||
|
||||
[files]
|
||||
packages =
|
||||
ironic
|
||||
|
||||
[entry_points]
|
||||
ironic.drivers =
|
||||
pxe_xcat = ironic.drivers.xcat:XCATBaremetalDriver
|
||||
|
||||
[pbr]
|
||||
autodoc_index_modules = True
|
||||
|
||||
[global]
|
||||
setup-hooks =
|
||||
pbr.hooks.setup_hook
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||
import setuptools
|
||||
|
||||
# In python < 2.7.4, a lazy loading of package `pbr` will break
|
||||
# setuptools if some other modules registered functions in `atexit`.
|
||||
# solution from: http://bugs.python.org/issue15881#msg170215
|
||||
try:
|
||||
import multiprocessing # noqa
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr'],
|
||||
pbr=True)
|
||||
@@ -1,22 +0,0 @@
|
||||
hacking>=0.8.0,<0.9
|
||||
coverage>=3.6
|
||||
discover
|
||||
fixtures>=0.3.14
|
||||
mock>=1.0
|
||||
Babel>=1.3
|
||||
MySQL-python
|
||||
psycopg2
|
||||
python-ironicclient
|
||||
python-subunit>=0.0.18
|
||||
testrepository>=0.0.18
|
||||
testtools>=0.9.34
|
||||
|
||||
# Doc requirements
|
||||
sphinx>=1.1.2,!=1.2.0,<1.3
|
||||
sphinxcontrib-pecanwsme>=0.8
|
||||
oslosphinx
|
||||
|
||||
# Required for Nova unit tests in ironic/nova/tests/ and can be removed
|
||||
# once the driver code lands in Nova.
|
||||
http://tarballs.openstack.org/nova/nova-master.tar.gz#egg=nova
|
||||
mox>=0.5.3
|
||||
@@ -89,7 +89,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%ifos linux
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then
|
||||
/etc/init.d/xcatd restart
|
||||
/etc/init.d/xcatd reload
|
||||
fi
|
||||
fi
|
||||
%endif
|
||||
|
||||
@@ -38,9 +38,11 @@ if (scalar(@ARGV)>1) { $usage->(1); }
|
||||
my $hnmatch = $ARGV[0]; # if they specified a hostname match, only show svrs that start with that
|
||||
|
||||
readconf("$ENV{HOME}/.slconfig"); # get the userid and api key from the config file
|
||||
#my $api_username = 'SL276540';
|
||||
#my $api_key = '799d5d9267a927a330ec016f00bfe17e6fc532d203cf68b3b0d997b2d27a3ce1';
|
||||
|
||||
my $slinstalled = eval { push @INC, $CONFIG{apidir}; require SoftLayer::API::SOAP; };
|
||||
if (!$slinstalled) { die "$@\nError: either the SoftLayer::API::SOAP perl module is not installed, or some dependencies are missing. Download it using 'git clone https://github.com/softlayer/softlayer-api-perl-client', put the directory in ~/.slconfig , and ensure its dependencies are installed."; }
|
||||
if (!$slinstalled) { die "Error: the SoftLayer::API::SOAP perl module is not installed. Download it using 'git clone https://github.com/softlayer/softlayer-api-perl-client' and put the directory in ~/.slconfig ."; }
|
||||
|
||||
my $client = SoftLayer::API::SOAP->new('SoftLayer_Account', undef, $CONFIG{userid}, $CONFIG{apikey});
|
||||
|
||||
@@ -62,23 +64,12 @@ foreach my $server (@$servers) {
|
||||
print "\tbmc=".$server->{remoteManagementComponent}->{ipmiIpAddress}."\n";
|
||||
print "\tbmcusername=".$server->{remoteManagementAccounts}->[0]->{username}."\n";
|
||||
print "\tbmcpassword=".$server->{remoteManagementAccounts}->[0]->{password}."\n";
|
||||
|
||||
# find the 1st active private nic that is not the bmc
|
||||
foreach my $nic (@{$server->{backendNetworkComponents}}) {
|
||||
#print "nic:\n"; foreach my $key (keys(%$nic)) { print " $key = ", $nic->{$key}, "\n"; }
|
||||
if ($nic->{status} eq 'ACTIVE' && $nic->{name} eq 'eth' && $nic->{macAddress} && $nic->{primaryIpAddress}) {
|
||||
# found it
|
||||
print "\tmac=".$nic->{macAddress}."\n";
|
||||
print "\tip=".$nic->{primaryIpAddress}."\n";
|
||||
}
|
||||
}
|
||||
#print "\tip=".$server->{privateIpAddress}."\n"; # getting this from the backendNetworkComponents instead
|
||||
print "\tserial=".$server->{manufacturerSerialNumber}."\n";
|
||||
print "\tmac=".$server->{backendNetworkComponents}->[0]->{macAddress}."\n";
|
||||
print "\tip=".$server->{privateIpAddress}."\n";
|
||||
print "\tnetboot=xnba\n";
|
||||
print "\tarch=x86_64\n";
|
||||
print "\tusercomment=hostname:".$server->{fullyQualifiedDomainName}.", user:".$server->{operatingSystem}->{passwords}->[0]->{username}.", pw:".$server->{operatingSystem}->{passwords}->[0]->{password}."\n";
|
||||
|
||||
verbose('SoftLayer API bare metal server entry: ' . Dumper($server));
|
||||
#print Dumper($server->{remoteManagementAccounts});
|
||||
#print "#Softlayer_account_info_for ".$server->{fullyQualifiedDomainName} . " Username: ";
|
||||
#print $server->{operatingSystem}->{passwords}->[0]->{username} . " Password: ";
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# remove entries from the .ssh/known_hosts file for a node
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Data::Dumper;
|
||||
#$Data::Dumper::Maxdepth=2;
|
||||
|
||||
# Globals - these are set once and then only read.
|
||||
my $HELP;
|
||||
my $VERBOSE;
|
||||
my $file = '~/.ssh/known_hosts';
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: khrem <node>\n";
|
||||
print " Removes the entries in the .ssh/known_hosts file associated with this node.\n";
|
||||
exit $exitcode;
|
||||
};
|
||||
|
||||
# Process the cmd line args
|
||||
Getopt::Long::Configure("bundling");
|
||||
#Getopt::Long::Configure("pass_through");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE)) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
if (scalar(@ARGV)!=1) { $usage->(1); }
|
||||
my $node = $ARGV[0]; # if they specified a hostname match, only show svrs that start with that
|
||||
|
||||
my @output = runcmd("host $node");
|
||||
my $hostname;
|
||||
my $line = shift @output;
|
||||
#print "line=$line\n";
|
||||
if ($line =~ m/is an alias for /) {
|
||||
($hostname) = $line =~ m/is an alias for ([^\.]+)/;
|
||||
#print "hostname=$hostname\n";
|
||||
$line = shift @output;
|
||||
}
|
||||
#print "line=$line\n";
|
||||
my ($ip) = $line =~ m/has address (.+)$/;
|
||||
if (defined($hostname)) {
|
||||
print "Removing entries from $file for: $node, $hostname, $ip\n";
|
||||
runcmd("sed -i '/^$node/d;/^$hostname/d;/^$ip/d' $file");
|
||||
}
|
||||
else {
|
||||
print "Removing entries from $file for: $node, $ip\n";
|
||||
runcmd("sed -i '/^$node/d;/^$ip/d' $file");
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
|
||||
# Pring msg only if -v was specified
|
||||
sub verbose { if ($VERBOSE) { print shift, "\n"; } }
|
||||
|
||||
|
||||
|
||||
|
||||
# Run a command. If called in the context of return an array, it will capture the output
|
||||
# of the cmd and return it. Otherwise, it will display the output to stdout.
|
||||
# If the cmd has a non-zero rc, this function will die with a msg.
|
||||
sub runcmd
|
||||
{
|
||||
my ($cmd) = @_;
|
||||
my $rc;
|
||||
|
||||
$cmd .= ' 2>&1' ;
|
||||
verbose($cmd);
|
||||
|
||||
my @output;
|
||||
if (wantarray) {
|
||||
@output = `$cmd`;
|
||||
$rc = $?;
|
||||
}
|
||||
else {
|
||||
system($cmd);
|
||||
$rc = $?;
|
||||
}
|
||||
|
||||
if ($rc) {
|
||||
$rc = $rc >> 8;
|
||||
if ($rc > 0) { die "Error: rc $rc return from cmd: $cmd\n"; }
|
||||
else { die "Error: system error returned from cmd: $cmd\n"; }
|
||||
}
|
||||
elsif (wantarray) { return @output; }
|
||||
}
|
||||
+24
-103
@@ -12,14 +12,12 @@ use Socket;
|
||||
# Globals - these are set once and then only read.
|
||||
my $HELP;
|
||||
my $VERBOSE;
|
||||
my $DRYRUN;
|
||||
my $WAITTIME;
|
||||
my $PROVMETHOD;
|
||||
my $XCATNETBOOTTITLE = 'xCAT network boot kernel and initrd';
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] [-p <provmethod] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
|
||||
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [-w <waittime>] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
|
||||
if (!$exitcode) {
|
||||
print "Modify the grub config file on the node to boot the specified kernel and initrd.\n";
|
||||
}
|
||||
@@ -32,7 +30,7 @@ if (-f '/etc/os-release') { die "This script doesn't support ubuntu yet.\n"; }
|
||||
Getopt::Long::Configure("bundling");
|
||||
#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, 'p|provmethod=s' => \$PROVMETHOD)) { $usage->(1); }
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME)) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
if (scalar(@ARGV) != 4) { $usage->(1); }
|
||||
@@ -60,95 +58,41 @@ sub addKernelParms {
|
||||
# replace <nodename> with the nodename
|
||||
my $nodename = $ENV{NODE}; # this env var is set by xdsh
|
||||
$args->{kernelparms} =~ s/<nodename>/$nodename/g;
|
||||
# get node ip and add it to the kernel parms
|
||||
my ($nic, $ip, $netmask, $network, $broadcast, $gateway, $mac) = getNodeIpInfo($args);
|
||||
if (!$ip) { die "Error: could not find the NIC that would connect to the xCAT mgmt node's IP (".$args->{mnip}.").\n"; }
|
||||
# if we are booting genesis, need to add the BOOTIF parm
|
||||
my $bootif;
|
||||
if ($args->{kernelpath} =~ m/genesis\.kernel\.x86_64/) {
|
||||
$bootif = $mac;
|
||||
$bootif =~ s/:/-/g;
|
||||
$bootif = "BOOTIF=01-$bootif";
|
||||
}
|
||||
|
||||
#todo: if you are running genesis shell (nodeset <node> shell), this if-else will depend on the nodeset done before that.
|
||||
# really should check for currstate=shell, or something like that
|
||||
if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') {
|
||||
# add additional parms for sysclone
|
||||
# DEVICE=eth0 IPADDR=10.0.0.99 NETMASK=255.255.255.0 NETWORK=10.0.0.0 BROADCAST=10.0.0.255 GATEWAY=10.0.0.1 GATEWAYDEV=eth0
|
||||
#todo: should we also add ETHER_SLEEP=$WAITTIME textmode=1 dns=$mnip ?
|
||||
$args->{kernelparms} .= " $bootif IPADDR=$ip NETMASK=$netmask NETWORK=$network BROADCAST=$broadcast GATEWAY=$gateway HOSTNAME=$nodename DEVICE=$nic GATEWAYDEV=$nic";
|
||||
}
|
||||
else { # scripted install
|
||||
#todo: the parameters for kickstart are likely different
|
||||
$args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
|
||||
# print Dumper($args->{kernelparms})
|
||||
}
|
||||
# get node ip and add it to the kernel parms
|
||||
my ($nic, $ip, $netmask, $gateway) = getNodeIpInfo($args);
|
||||
if (!$ip) { die "Error: could not find the NIC that would connect to the xCAT mgmt node's IP (".$args->{mnip}.").\n"; }
|
||||
$args->{kernelparms} .= " hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
|
||||
}
|
||||
|
||||
|
||||
# get this nodes nic, ip, netmask, gateway, and mac. Returns them in a 5 element array.
|
||||
# get this nodes nic, ip, netmask, and gateway. Returns them in a 4 element array.
|
||||
sub getNodeIpInfo {
|
||||
my $args = shift @_;
|
||||
my ($ipprefix) = $args->{mnip}=~m/^(\d+)\./; #todo: this is a hack, just using the 1st octet of the mn ip addr
|
||||
my ($ipprefix) = $args->{mnip}=~m/^(\d+\.\d+)\./; #todo: this is a hack, just using the 1st 2 octets of the mn ip addr
|
||||
verbose("using IP prefix $ipprefix");
|
||||
|
||||
# parse ip addr show output, looking for ipprefix, to determine nic, ip, mac
|
||||
my @output = runcmd("/sbin/ip addr show");
|
||||
my ($nic, $mac, $ipandmask);
|
||||
# parse ip addr show output, looking for ipprefix, to determine nic and ip
|
||||
my @output = runcmd("ip addr show");
|
||||
my ($nic, $ipandmask);
|
||||
foreach my $line (@output) {
|
||||
my ($nictmp, $mactmp, $iptmp);
|
||||
my ($nictmp, $iptmp);
|
||||
if (($nictmp) = $line=~m/^\d+:\s+(\S+): /) { $nic = $nictmp; } # new stanza, remember it
|
||||
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) |) { $mac = $mactmp; } # got mac, remember it
|
||||
if (($iptmp) = $line=~m/^\s+inet\s+($ipprefix\S+) /) { $ipandmask = $iptmp; last; } # got ip, we are done
|
||||
}
|
||||
if (!defined($ipandmask)) { die "Error: can't find a NIC with a prefix $ipprefix that communicates with".$args->{mnip}.".\n"; }
|
||||
my ($ip, $netmask, $network, $broadcast) = convertIpAndMask($ipandmask);
|
||||
my ($ip, $netmask) = convertIpAndMask($ipandmask);
|
||||
|
||||
# if the nic is a bonded nic (common on sl), then find the 1st real nic that is up that is part of it.
|
||||
# also find that real nics real mac
|
||||
my $realnic;
|
||||
# if the nic is a bonded nic (common on sl), then find the 1st real nic that is part of it
|
||||
my $realnic = $nic;
|
||||
if ($nic =~ /^bond/) {
|
||||
my @nics = grep(m/\s+master\s+$nic\s+/, @output);
|
||||
if (!scalar(@nics)) { die "Error: can't find the NICs that are part of $nic.\n"; }
|
||||
foreach my $line (@nics) {
|
||||
my ($nictmp, $state) = $line=~m/^\d+:\s+(\S+): .* state\s+(\S+)/;
|
||||
if (defined($nictmp) && defined($state) && $state eq 'UP') { $realnic = $nictmp; last; } # got ip, we are done
|
||||
}
|
||||
if (!defined($realnic)) { die "Error: can't find a physical NIC that is up and part of $nic.\n"; }
|
||||
|
||||
# now get the real mac of this real nic (when 2 nics are bonded, ip addr show displays one of the nics
|
||||
# macs for both nics and the bond). So we have to depend on /proc/net/bonding/$bond instead.
|
||||
my @bondout = runcmd("cat /proc/net/bonding/$nic");
|
||||
my $foundnic;
|
||||
foreach my $line (@bondout) {
|
||||
my $mactmp;
|
||||
if ($line=~m/^Slave Interface:\s+$realnic/) { $foundnic = 1; } # found the stanza for this nic, remember it
|
||||
if ($foundnic && (($mactmp) = $line=~m/^Permanent HW addr:\s+(\S+)/)) { $mac = $mactmp; last; }
|
||||
}
|
||||
($realnic) = $nics[0]=~m/^\d+:\s+(\S+): /;
|
||||
}
|
||||
else { $realnic = $nic; }
|
||||
|
||||
# centos/redhat seems to name the nic in a different order than sles on some svrs.
|
||||
# sles seems to name them in the same order as 'ip addr show' displays them, centos does not.
|
||||
# so if we are on centos right now, we need to count down to determine the number that sles
|
||||
# will give the nic that we have selected, because it is the sles naming that we care about,
|
||||
# because that is the initrd that will be running in the scripted install case.
|
||||
# For the sysclone case, genesis doxcat should be changed to use the mac to find the nic.
|
||||
if (isRedhat()) {
|
||||
my @nics = grep(m/^\d+:\s+eth/, @output);
|
||||
my $i = 0;
|
||||
foreach my $line (@nics) {
|
||||
my ($nictmp) = $line=~m/^\d+:\s+(\S+):/;
|
||||
if (defined($nictmp) && $nictmp eq $realnic) { $realnic = "eth$i"; last; } # got ip, we are done
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "Determined that SLES will call the install NIC $realnic (it has mac $mac)\n";
|
||||
|
||||
# finally, find the gateway
|
||||
my $gateway;
|
||||
my @output = runcmd("/sbin/ip route");
|
||||
my @output = runcmd("ip route");
|
||||
# we are looking for a line like: 10.0.0.0/8 via 10.54.51.1 dev bond0
|
||||
my @networks = grep(m/ via .* $nic\s*$/, @output);
|
||||
if (scalar(@networks)) { ($gateway) = $networks[0]=~m/ via\s+(\S+)/; }
|
||||
@@ -158,37 +102,19 @@ sub getNodeIpInfo {
|
||||
verbose("using xCAT mgmt node IP as the fall back gateway.");
|
||||
}
|
||||
|
||||
verbose("IP info: realnic=$realnic, ip=$ip, netmask=$netmask, gateway=$gateway, mac=$mac");
|
||||
return ($realnic, $ip, $netmask, $network, $broadcast, $gateway, $mac);
|
||||
verbose("IP info: realnic=$realnic, ip=$ip, netmask=$netmask, gateway=$gateway");
|
||||
return ($realnic, $ip, $netmask, $gateway);
|
||||
}
|
||||
|
||||
|
||||
# Convert an ip/mask in slash notation (like 10.1.1.1/26) to separate ip, netmask, network, and broadcast values,
|
||||
# like: 10.1.1.1, 255.255.255.192, 10.1.1.0, 10.1.1.63
|
||||
# Convert an ip/mask in slash notation (like 10.0.0.1/26) to separate ip and netmask like 10.0.0.1 and 255.255.255.192
|
||||
sub convertIpAndMask {
|
||||
my $ipandmask = shift @_;
|
||||
my ($ip, $masknum) = split('/', $ipandmask);
|
||||
|
||||
# build the netmask
|
||||
my $nmbin = oct("0b" . '1' x $masknum . '0' x (32-$masknum)); # create a str like '1111100', then convert to binary
|
||||
my @nmarr=unpack('C4',pack('N',$nmbin)); # separate into the 4 octets
|
||||
my $netmask=join('.',@nmarr); # put them together into the normal looking netmask
|
||||
|
||||
# create binary form of ip
|
||||
my @iparr=split(/\./,$ip);
|
||||
my ( $ipbin ) = unpack('N', pack('C4',@iparr ) );
|
||||
|
||||
# Calculate network address by logical AND operation of ip & netmask and convert network address to IP address format
|
||||
my $netbin = ( $ipbin & $nmbin );
|
||||
my @netarr=unpack('C4', pack('N',$netbin ) );
|
||||
my $network=join(".",@netarr);
|
||||
|
||||
# Calculate broadcast address by inverting the netmask and adding it to the network address
|
||||
my $bcbin = ( $ipbin & $nmbin ) + ( ~ $nmbin );
|
||||
my @bcarr=unpack('C4', pack('N',$bcbin ) ) ;
|
||||
my $broadcast=join(".",@bcarr);
|
||||
|
||||
return ($ip, $netmask, $network, $broadcast);
|
||||
my $netbin = oct("0b" . '1' x $masknum . '0' x (32-$masknum)); # create a str like '1111100', then convert to binary
|
||||
my @netarr=unpack('C4',pack('N',$netbin)); # separate into the 4 octets
|
||||
my $netmask=join('.',@netarr); # put them together into the normal looking netmask
|
||||
return ($ip, $netmask);
|
||||
}
|
||||
|
||||
|
||||
@@ -229,11 +155,6 @@ sub updateGrub {
|
||||
"\tkernel " . $fileprefix . $args->{kernelpath} . ' ' . $args->{kernelparms} . "\n",
|
||||
"\tinitrd " . $fileprefix . $args->{initrdpath} . "\n",
|
||||
);
|
||||
if ($DRYRUN) {
|
||||
print "Dry run: would add this stanza to $grubfile:\n";
|
||||
foreach my $l (@entry) { print $l; }
|
||||
return;
|
||||
}
|
||||
|
||||
my $needtowritefile = 1;
|
||||
if (grep(/^title\s+$XCATNETBOOTTITLE/, @lines)) { $needtowritefile = updateGrubEntry(\@lines, \@entry); } # there is already an entry in there
|
||||
|
||||
+21
-155
@@ -13,13 +13,12 @@ use Data::Dumper;
|
||||
# Globals - these are set once and then only read.
|
||||
my $HELP;
|
||||
my $VERBOSE;
|
||||
my $DRYRUN;
|
||||
my $WAITTIME;
|
||||
my $NOAUTOINST;
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] <noderange>\n\n";
|
||||
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [-w <waittime>] <noderange>\n\n";
|
||||
if (!$exitcode) {
|
||||
print "Copy the initrd, kernel, params, and static IP info to nodes, so they can net install\n";
|
||||
print "even across vlans (w/o setting up pxe/dhcp broadcast relay). This assumes a working\n";
|
||||
@@ -33,7 +32,7 @@ my $usage = sub {
|
||||
Getopt::Long::Configure("bundling");
|
||||
#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); }
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME, 'a|noautoinst' => \$NOAUTOINST)) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
if (scalar(@ARGV) != 1) { $usage->(1); }
|
||||
@@ -46,45 +45,32 @@ copyFilesToNodes($noderange, \%bootparms);
|
||||
|
||||
updateGrubOnNodes($noderange, \%bootparms);
|
||||
|
||||
if ($DRYRUN) { exit(0); }
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); }
|
||||
if (!$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
|
||||
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 @_;
|
||||
my %bootparms;
|
||||
my @output = runcmd("nodels $nr bootparams.kernel bootparams.initrd bootparams.kcmdline nodetype.provmethod");
|
||||
my @output = runcmd("nodels $nr bootparams.kernel bootparams.initrd bootparams.kcmdline");
|
||||
|
||||
# the attributes can be displayed in a different order than requested, so need to grep for them
|
||||
foreach my $attr (qw(bootparams.kernel bootparams.initrd bootparams.kcmdline nodetype.provmethod)) {
|
||||
my ($a) = $attr =~ m/\.(.*)$/;
|
||||
my @gresults = grep(/^\S+:\s+$attr:/, @output);
|
||||
my @gresults;
|
||||
foreach my $a (qw(kernel initrd kcmdline)) {
|
||||
my $attr = "bootparams.$a";
|
||||
@gresults = grep(/^\S+:\s+$attr:/, @output);
|
||||
if (!scalar(@gresults)) { die "Error: attribute $attr not defined for the noderange. Did you run 'nodeset <noderange> osimage=<osimage>' ?\n"; }
|
||||
# for now just pick the 1st one. They should all be the same, except for the node name in kcmdline
|
||||
chomp($gresults[0]);
|
||||
$gresults[0] =~ s/^\S+:\s+$attr:\s*//;
|
||||
#print "gresults='$gresults[0]'\n";
|
||||
if ($gresults[0] !~ m/\S/) { die "Error: attribute $attr not defined for the noderange. Did you run 'nodeset <noderange> osimage=<osimage>' ?\n"; }
|
||||
$bootparms{$a} = $gresults[0];
|
||||
if ($a eq 'kcmdline') { $bootparms{$a} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|; }
|
||||
}
|
||||
$bootparms{kcmdline} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|;
|
||||
|
||||
# from the nodes provmethod, get the osimage provmethod, so we know the type of install
|
||||
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod");
|
||||
chomp($output[0]);
|
||||
if ($output[0] =~ m/^Could not find/) { die "Error: provmethod $bootparms{provmethod} is set for the node, but there is no osimage definition by that name."; }
|
||||
my ($junk, $provmethod) = split(/=/, $output[0]);
|
||||
$bootparms{osimageprovmethod} = $provmethod;
|
||||
|
||||
# get the mgmt node cluster-facing ip addr
|
||||
@output = runcmd('lsdef -t site -ci master');
|
||||
@output = runcmd('lsdef -t site -i master -c');
|
||||
chomp($output[0]);
|
||||
my ($junk, $ip) = split(/=/, $output[0]);
|
||||
$bootparms{mnip} = $ip;
|
||||
@@ -104,13 +90,8 @@ sub copyFilesToNodes {
|
||||
my $localfile = "/tftpboot/$file";
|
||||
# for the
|
||||
my $remotefile = '/boot/' . remoteFilename($file);
|
||||
if ($DRYRUN) {
|
||||
print "Dry run: would copy $localfile to $nr:$remotefile\n";
|
||||
}
|
||||
else {
|
||||
print "Copying $localfile to $nr:$remotefile\n";
|
||||
runcmd("xdcp $nr -p $localfile $remotefile");
|
||||
}
|
||||
print "Copying $localfile to $nr:$remotefile\n";
|
||||
runcmd("xdcp $nr -p $localfile $remotefile");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +99,7 @@ sub copyFilesToNodes {
|
||||
# Form the remote file name, using the last 2 parts of the path, separated by "-"
|
||||
sub remoteFilename {
|
||||
my $f = shift @_;
|
||||
$f =~ s|^.*?([^/]+)/([^/]+)$|$1-$2|;
|
||||
$f =~ s|^.*/([^/]+)/([^/]+)$|$1-$2|;
|
||||
return $f;
|
||||
}
|
||||
|
||||
@@ -129,12 +110,10 @@ sub updateGrubOnNodes {
|
||||
my $nr = shift @_;
|
||||
my $bootparms = shift @_;
|
||||
my $vtxt = ($VERBOSE ? '-v' : '');
|
||||
my $dtxt = ($DRYRUN ? '--dryrun' : '');
|
||||
my @output = runcmd('which modifygrub');
|
||||
my $modifygrub = $output[0];
|
||||
chomp($modifygrub);
|
||||
my $euser ="root";
|
||||
my $cmd = "xdsh $nr -l $euser -e $modifygrub $vtxt $dtxt -w $WAITTIME -p " . $bootparms->{osimageprovmethod} . ' ' . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
|
||||
my $cmd = "xdsh $nr -e $modifygrub $vtxt -w $WAITTIME " . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
|
||||
# we need to quote the kernel parms, both here when passing it to xdsh, and on the node
|
||||
# when xdsh is passing it to modifygrub. The way to get single quotes inside single quotes
|
||||
# is to quote each of the outer single quotes with double quotes.
|
||||
@@ -145,7 +124,8 @@ sub updateGrubOnNodes {
|
||||
}
|
||||
|
||||
|
||||
# Hack the autoinst files to overcome the nic coming up delay.
|
||||
# Hack the autoinst files to wait in a key spot to make them work even tho it takes
|
||||
# the NICs almost a min before they can transmit after a state change.
|
||||
#todo: this has only been tested with SLES nodes
|
||||
sub modifyAutoinstFiles {
|
||||
my $nr = shift @_;
|
||||
@@ -155,144 +135,30 @@ sub modifyAutoinstFiles {
|
||||
my @nodes = runcmd("nodels $nr");
|
||||
chomp(@nodes);
|
||||
|
||||
# Modify chroot.sles to insert a wait in the /etc/init.d/network of each node. This is
|
||||
# necessary because even tho compute.sles11.softlayer.tmpl configures bonding, when autoyast
|
||||
# reboots the node after installing the rpms, it does not bring up the network in the normal way
|
||||
# at first and seems to skip any bonding and the if-up.d scripts. So we are left doing this.
|
||||
# (After autoyast is done with all of its post-configuration, it brings up the network in the
|
||||
# normal way, so bonding gets done then, which is good at least.)
|
||||
|
||||
# Edit each file to have chroot.sles insert a wait at the end of /etc/init.d/network
|
||||
# this finds the end of boot.sh script (which is chroot.sles)
|
||||
my $search = '\n\]\]>\s*</source>\s*</script>\s*</chroot-scripts>';
|
||||
# hack the /etc/init.d/network script to put a wait in it
|
||||
my $file = '/mnt/etc/init.d/network'; # at this point in the installation, the permanent file system is just mounted
|
||||
# this is the string to insert in the nodes /etc/init.d/network script. It is a while loop pinging the mn, but some of the chars need to be escaped for sed
|
||||
my $waitstring = 'echo -n Waiting to reach xCAT mgmt node ' . $bootparms->{mnip} . '.;xcatretries=60;while \[ \$\(\(xcati+=1\)\) -le \$xcatretries \] \&\& ! ping -c2 -w3 ' . $bootparms->{mnip} .' \>\/dev\/null 2\>\&1; do echo -n .; done; if \[ \$xcati -le \$xcatretries \]; then echo success; else echo failed; fi';
|
||||
#my $waitstring = 'echo Sleeping for 55s;sleep 55';
|
||||
# this is the string to insert in the nodes /etc/init.d/network script. It is a while loop pinging the mn, but some of the chars need to be escape for sed
|
||||
my $waitstring = 'echo Waiting to reach xCAT mgmt node...;while \[ \$\(\(xcati+=1\)\) -le 60 \] \&\& ! ping -c2 -w3 ' . $bootparms->{mnip} .'; do echo i=\$xcati ; done; sleep 10';
|
||||
# this crazy sed string is from google. It gathers up the whole file into the hold buffer, and then the substitution is done on the whole file
|
||||
my $sedstring = q|sed -n '1h;1!H;${;g;s/\(\t\treload_firewall\n\)\n/\1\t\t| . $waitstring . q(\n\n/g;p;}') . " $file > $file.new";
|
||||
# finally create the perl replace string that will be used to modify the autoinst file
|
||||
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';
|
||||
#my $replace = qq(
|
||||
#FILENAME=$filename
|
||||
#NETDIR=$netdir
|
||||
#MNIP=$mnip
|
||||
#);
|
||||
# $replace .= q(
|
||||
#cat >$FILENAME << EOF1
|
||||
#MNIP=$MNIP
|
||||
#NETDIR=$NETDIR
|
||||
#EOF1
|
||||
#
|
||||
# this part of the file we do NOT want to expand the variables in the content
|
||||
#cat >>$FILENAME << 'EOF2'
|
||||
#NIC="$1"
|
||||
# look in this ifcfg script to get the nics ip to see if this is the one we should be waiting on
|
||||
#NICIP=`awk -F= '/^IPADDR/ {print $2}' $NETDIR/ifcfg-$NIC | tr -d \' `
|
||||
#if [ "${NICIP%.*.*}" != "${MNIP%.*.*}" ]; then exit; fi # hack: compare the 1st 2 octets
|
||||
#echo -n Waiting to reach xCAT mgmt node $MNIP.
|
||||
#xcatretries=60
|
||||
#while [ $((xcati+=1)) -le $xcatretries ] && ! ping -c2 -w3 $MNIP >/dev/null 2>&1; do echo -n .; done
|
||||
#if [ $xcati -le $xcatretries ]; then echo " success"; else echo " failed"; fi
|
||||
#sleep 3
|
||||
#EOF2
|
||||
#
|
||||
#chmod +x $FILENAME
|
||||
#);
|
||||
|
||||
# The compute.sles11.softlayer.tmpl file contains 2 variables (node ip and netmask) that are
|
||||
# not replaced by Template.pm. Substitute those in the autoinst files now.
|
||||
# Also use our own multiline sed to put the network script hack in.
|
||||
# now actually update the file
|
||||
print "Updating /install/autoinst files.\n";
|
||||
foreach my $n (@nodes) {
|
||||
my $f = "/install/autoinst/$n";
|
||||
my ($ip, $netmask, $gateway) = getNodeIpInfo($n);
|
||||
runcmd("sudo sed -i 's/#NODEIPADDR#/$ip/;s/#NODENETMASK#/$netmask/;s/#NODEGATEWAY#/$gateway/' $f");
|
||||
my $matches = sed($f, $search, $replace, mode=>'insertbefore');
|
||||
if (!$matches) { die "Error: could not find the right place in $f to insert the sed of the network wait.\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.
|
||||
sub copySyscloneFiles {
|
||||
my $cmd = "cp -f /opt/xcat/share/xcat/sysclone/post-install/* /install/sysclone/scripts/post-install";
|
||||
print "Copying SoftLayer-specific post scripts to the SystemImager post-install directory.\n";
|
||||
runcmd($cmd);
|
||||
}
|
||||
|
||||
|
||||
# Get IP and network of a node
|
||||
sub getNodeIpInfo {
|
||||
my $node = shift;
|
||||
|
||||
# get ip for the node
|
||||
my @output = runcmd("nodels $node 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 $node.\n"; }
|
||||
|
||||
# find relevant network in the networks table
|
||||
# first get the networks in a hash
|
||||
my %networks;
|
||||
@output = runcmd("lsdef -t network -ci net,mask,gateway");
|
||||
foreach my $line (@output) {
|
||||
chomp($line);
|
||||
my ($netname, $attr, $val) = $line =~ m/^(.+):\s+(.+?)=(.+)$/;
|
||||
$networks{$netname}->{$attr} = $val;
|
||||
}
|
||||
# now go thru the networks looking for the correct one
|
||||
my ($netmask, $gateway);
|
||||
foreach my $key (keys %networks) {
|
||||
if (isIPinNet($ip, $networks{$key}->{net}, $networks{$key}->{mask})) { # found it
|
||||
$netmask = $networks{$key}->{mask};
|
||||
$gateway = $networks{$key}->{gateway};
|
||||
last;
|
||||
}
|
||||
}
|
||||
if (!$netmask) { die "Error: could not find a network in the networks table that $node $ip is part of.\n"; }
|
||||
if (!$gateway) { die "Error: gateway not specified in the networks table for the network that $node $ip is part of.\n"; }
|
||||
|
||||
verbose("IP info for $node: ip=$ip, netmask=$netmask, gateway=$gateway");
|
||||
return ($ip, $netmask, $gateway);
|
||||
}
|
||||
|
||||
|
||||
# Is the IP in the network/netmask combo
|
||||
sub isIPinNet {
|
||||
my ($ip, $net, $mask) = @_;
|
||||
my $ipbin = convert2bin($ip);
|
||||
my $netbin = convert2bin($net);
|
||||
my $maskbin = convert2bin($mask);
|
||||
$ipbin &= $maskbin;
|
||||
if ($ipbin && $netbin && ($ipbin == $netbin)) { return 1; }
|
||||
else { return 0; }
|
||||
}
|
||||
|
||||
|
||||
# Convert dotted decimal format (1.2.3.4) to a binary number
|
||||
sub convert2bin {
|
||||
my @arr=split(/\./, shift);
|
||||
my ($bin) = unpack('N', pack('C4',@arr ) );
|
||||
return $bin;
|
||||
}
|
||||
|
||||
|
||||
# this is like multi-line sed replace function
|
||||
# Args: filename, search-string, replace-string, options (mode=>{insertbefore,insertafter,replace})
|
||||
# Args: filename, search-string, replace-string
|
||||
sub sed {
|
||||
my ($file, $search, $replace, %options) = @_;
|
||||
#my $opts = 's';
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# xCAT postscript for configuring bonding of nics.
|
||||
# Usage: configbond bond1 eth1 [eth3]
|
||||
#
|
||||
# Note: this postscript currently has some assumptions that are specific to the softlayer environment.
|
||||
# We only use this to configure bond1, because bond0 gets configured by the node provisioning process.
|
||||
# (altho this script would work for bond0)
|
||||
|
||||
use strict;
|
||||
# Check number of args
|
||||
|
||||
my $nargs = $#ARGV + 1;
|
||||
if (scalar(@ARGV) < 2 || scalar(@ARGV) > 3) {
|
||||
system("logger -t xcat -p local4.err 'Usage: configbond <bond> <dev0> [<dev1>]'");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $bond = shift(@ARGV);
|
||||
my $nic = $ARGV[0];
|
||||
my @devs;
|
||||
foreach my $a (@ARGV) { push(@devs,split('@',$a)); } # support the new syntax in the xcat configbond postscript
|
||||
my $nicips = $ENV{NICIPS};
|
||||
my $nicnetworks = $ENV{NICNETWORKS};
|
||||
my $net_cnt = $ENV{NETWORKS_LINES};
|
||||
|
||||
#todo: change this script so they dont need to specify nicnetworks
|
||||
if (!$nicips || !$nicnetworks) { system("logger -t xcat -p local4.err 'configbond: must specify attributes nicips and nicnetworks in the xcat db for this node.'"); exit 1; }
|
||||
|
||||
#todo: these are specific to softlayer. They should be another attribute or argument
|
||||
my $bondingopts = 'mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1';
|
||||
|
||||
my $netmask ='';
|
||||
my $ipaddr = '';
|
||||
my $nic_num = '';
|
||||
my $subnet = '';
|
||||
my $nic_net = '';
|
||||
my $net_name = '';
|
||||
my @nic_nets = (); # array of networks for this nic
|
||||
my @nic_ips =(); # array of ipaddresses for this nic
|
||||
my @networks = (); # array of all networks from networks table.
|
||||
# { network_name, subnet, netmask }
|
||||
|
||||
system("logger -t xcat -p local4.err 'configbond: Master: $bond'");
|
||||
system("logger -t xcat -p local4.err 'configbond: Slaves: @devs'");
|
||||
#system("logger -t xcat -p local4.err 'configbond: NIC: $nic'");
|
||||
system("logger -t xcat -p local4.err 'configbond: NICNETWORKS: $nicnetworks'");
|
||||
system("logger -t xcat -p local4.err 'configbond: NICIPS: $nicips'");
|
||||
|
||||
# Update modprobe
|
||||
my $file = "/etc/modprobe.d/$bond.conf";
|
||||
if (!open(FILE, ">$file")) { system("logger -t xcat -p local4.err 'configbond: cannot open $file.'"); exit 1; }
|
||||
|
||||
print FILE "alias $bond bonding\n";
|
||||
# the bonding options are put in the ifcfg file instead
|
||||
#print FILE "options $bond mode=balance-rr miimon=100\n";
|
||||
close FILE;
|
||||
|
||||
# create array of network info. Needed in case where there are
|
||||
# more than one ip address per nic and shouldn't be many networks.
|
||||
my $net_info;
|
||||
my $cnt = 1;
|
||||
|
||||
while ( $cnt <= $net_cnt ) {
|
||||
$net_info = $ENV{"NETWORKS_LINE$cnt"};
|
||||
$net_info =~ /^netname=([^\|]*)\|\|/;
|
||||
$net_name = $1;
|
||||
$net_info =~ /net=([^\|]*)\|\|/;
|
||||
$subnet = $1;
|
||||
$net_info =~ /mask=([^\|]*)\|\|/;
|
||||
$netmask = $1;
|
||||
push @{ $networks[$cnt-1] }, ($net_name, $subnet, $netmask);
|
||||
$cnt +=1;
|
||||
}
|
||||
|
||||
# get network or networks for this nic from NICNETWORKS:
|
||||
# eth0:1_0_0_0-255_255_0_0|network2,eth1:1_1_0_0
|
||||
# create array of networks for this nic
|
||||
foreach my $nic_networks (split(/,/,$nicnetworks)) {
|
||||
my @net = ();
|
||||
if ( $nic_networks =~ /!/ ) {
|
||||
@net = split(/!/,$nic_networks);
|
||||
} else {
|
||||
@net = split(/:/,$nic_networks);
|
||||
}
|
||||
if ($net[0] eq $nic) {
|
||||
@nic_nets = split(/\|/,$net[1]);
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# get all nic ipaddress from $nicips: i.e. eth0:1.0.0.1|2.0.0.1,eth1:1.1.1.1
|
||||
# Then get all ips for this specific nic, i.e. eth0.
|
||||
foreach my $ips (split(/,/,$nicips)) {
|
||||
my @ip = ();
|
||||
if ( $ips =~ /!/ ) {
|
||||
@ip = split(/!/,$ips);
|
||||
} else {
|
||||
@ip = split(/:/,$ips);
|
||||
}
|
||||
if ($ip[0] eq $nic ) {
|
||||
@nic_ips = split(/\|/,$ip[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $i;
|
||||
for ($i=0; $i < (scalar @nic_ips) ; $i++ ) {
|
||||
|
||||
# Time to create the interfaces.
|
||||
# loop through the nic networks, find the matching networks to get the
|
||||
# subnet and netmask and then create the appropriate ifcfg file for linux
|
||||
my $specific_nic = $nic;
|
||||
if ($i > 0) {
|
||||
$specific_nic = $nic . ":" . ($i);
|
||||
}
|
||||
|
||||
#todo: support case in which nicnetworks is not specified, find the correct network by calculation
|
||||
$cnt = 0;
|
||||
$subnet = "";
|
||||
$netmask = "";
|
||||
$net_name = "";
|
||||
while ( $cnt < $net_cnt ) {
|
||||
if ( $networks[$cnt][0] eq $nic_nets[$i] ) {
|
||||
|
||||
$subnet = $networks[$cnt][1];
|
||||
$netmask = $networks[$cnt][2];
|
||||
$cnt = $net_cnt; # found match - get out.
|
||||
}
|
||||
else {
|
||||
$cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
# check that there is a subnet and netmask set
|
||||
if ( !(length($subnet) > 0) || !(length($netmask) > 0) ) {
|
||||
system("logger -t xcat -p local4.err 'configbond: network subnet or netmask not set.'");
|
||||
exit 1;
|
||||
}
|
||||
system("logger -t xcat -p local4.err 'configbond: network subnet and netmask: $subnet, $netmask'");
|
||||
system("logger -t xcat -p local4.err 'configbond: $specific_nic, $nic_ips[$i]'");
|
||||
|
||||
# Write the master info to the ifcfg file
|
||||
if (-d "/etc/sysconfig/network-scripts") {
|
||||
# rhel/centos/fedora
|
||||
my $dir = "/etc/sysconfig/network-scripts";
|
||||
if (!open(FILE, ">$dir/ifcfg-$bond")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$bond.'"); exit 1; }
|
||||
|
||||
print FILE "DEVICE=$bond\n";
|
||||
print FILE "BOOTPROTO=none\n";
|
||||
print FILE "IPADDR=$nic_ips[$i]\n";
|
||||
print FILE "NETMASK=$netmask\n";
|
||||
print FILE "ONBOOT=yes\n";
|
||||
print FILE "USERCTL=no\n";
|
||||
print FILE qq(BONDING_OPTS="$bondingopts"\n);
|
||||
close FILE;
|
||||
|
||||
# Configure slaves
|
||||
my @output = `ip addr show 2>&1`; # to check for existance of the device later
|
||||
foreach my $dev (@devs) {
|
||||
# as a convenience, make sure the device exists before adding it to the bond
|
||||
if (!grep(m/^\d+:\s+$dev:/, @output)) {
|
||||
system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'");
|
||||
unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning
|
||||
next;
|
||||
}
|
||||
|
||||
system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'");
|
||||
if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; }
|
||||
print FILE "DEVICE=$dev\n";
|
||||
print FILE "BOOTPROTO=none\n";
|
||||
print FILE "MASTER=$bond\n";
|
||||
print FILE "ONBOOT=yes\n";
|
||||
print FILE "SLAVE=yes\n";
|
||||
print FILE "USERCTL=no\n";
|
||||
close FILE;
|
||||
}
|
||||
}
|
||||
elsif (-d "/etc/sysconfig/network") {
|
||||
# sles
|
||||
my $dir = "/etc/sysconfig/network";
|
||||
if (!open(FILE, ">$dir/ifcfg-$bond")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$bond.'"); exit 1; }
|
||||
|
||||
print FILE "BOOTPROTO=static\n";
|
||||
print FILE "BONDING_MASTER=yes\n";
|
||||
print FILE "BONDING_MODULE_OPTS='$bondingopts'\n";
|
||||
print FILE "NAME='Bonded Interface'\n";
|
||||
print FILE "IPADDR=$nic_ips[$i]\n";
|
||||
print FILE "NETMASK=$netmask\n";
|
||||
print FILE "STARTMODE=onboot\n";
|
||||
print FILE "USERCONTROL=no\n";
|
||||
my $devnum = 0;
|
||||
my @output = `ip addr show 2>&1`; # to check for existance of the device later
|
||||
foreach my $dev (@devs) {
|
||||
if (!grep(m/^\d+:\s+$dev:/, @output)) { next; }
|
||||
print FILE "BONDING_SLAVE_$devnum=$dev\n";
|
||||
$devnum++;
|
||||
}
|
||||
close FILE;
|
||||
|
||||
# Configure slaves
|
||||
foreach my $dev (@devs) {
|
||||
# as a convenience, make sure the device exists before adding it to the bond
|
||||
if (!grep(m/^\d+:\s+$dev:/, @output)) {
|
||||
system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'");
|
||||
unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning
|
||||
next;
|
||||
}
|
||||
|
||||
system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'");
|
||||
if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; }
|
||||
print FILE "BOOTPROTO=none\n";
|
||||
print FILE "STARTMODE=hotplug\n";
|
||||
close FILE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
# do not recognize this distro
|
||||
system("logger -t xcat -p local4.err 'configbond: network directory is not either the Red Hat or SuSE format.'");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Apply the changes. Since we are only doing bond1 right now, lets not restart the whole network
|
||||
# so we dont disrupt the installnic connection. Instead we just need to bring down the slave nics,
|
||||
# and then bring up the bond nic.
|
||||
#runcmd("service network restart");
|
||||
foreach my $dev (@devs) {
|
||||
runcmd("ifdown $dev");
|
||||
}
|
||||
runcmd("ifdown $bond"); # in case it was already up
|
||||
runcmd("ifup $bond"); # note: this wont reload the bonding kernel module, so we are depending on the provisioning process to already have set the correct bonding options
|
||||
system("logger -t xcat -p local4.info 'configbond: successfully configured $specific_nic.'");
|
||||
|
||||
}
|
||||
exit 0;
|
||||
|
||||
sub runcmd {
|
||||
my $cmd = shift @_;
|
||||
$cmd .= ' 2>&1';
|
||||
my @output = `$cmd`;
|
||||
my $rc = $? >> 8;
|
||||
if ($rc) {
|
||||
system("logger -t xcat -p local4.err 'configeth: command $cmd failed with rc $rc: " . join('',@output) . "'");
|
||||
my $errout= "configeth: command $cmd failed with rc $rc.";
|
||||
`echo $errout`;
|
||||
exit $rc;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set the default route of the node to the ip address and nic passed in
|
||||
# this should be added to the postbootscripts, NOT postscripts
|
||||
|
||||
gateway="$1"
|
||||
nic="$2"
|
||||
|
||||
# set it temporarily
|
||||
echo "ip route replace to default via $gateway dev $nic"
|
||||
ip route replace to default via $gateway dev $nic
|
||||
|
||||
# set it permanently
|
||||
#todo: this is only for sles right now
|
||||
file=/etc/sysconfig/network/routes
|
||||
if grep -q -E '^default ' $file; then
|
||||
# replace the default route that is already in there
|
||||
sed -i 's/^default .*$/default '$gateway' - -/' $file
|
||||
else
|
||||
# no default route yet, append to file
|
||||
echo "default $gateway - -" >>$file
|
||||
fi
|
||||
|
||||
# While we are here, clean up the network wait hack, if it is still there.
|
||||
# (It was added during scripted install, because autoyast will not use the bond
|
||||
# configuration for 1 part of the process.) Do not know a better place to clean
|
||||
# this up.
|
||||
sed -i '/Waiting to reach xCAT mgmt node/d' /etc/init.d/network
|
||||
set -x
|
||||
ip route replace to default via $1 dev $2
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
</user>
|
||||
</users>
|
||||
<networking>
|
||||
<keep_install_network config:type="boolean">true</keep_install_network>
|
||||
<dns>
|
||||
<domain>#TABLE:site:key=domain:value#</domain>
|
||||
<hostname>#TABLE:nodelist:$NODE:node#</hostname>
|
||||
@@ -77,53 +78,10 @@
|
||||
<search>#TABLE:site:key=domain:value#</search>
|
||||
</searchlist>
|
||||
</dns>
|
||||
<interfaces config:type="list">
|
||||
<interface>
|
||||
<bonding_master>yes</bonding_master>
|
||||
<bonding_module_opts>mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1</bonding_module_opts>
|
||||
<bonding_slave0>eth0</bonding_slave0>
|
||||
<bonding_slave1>eth2</bonding_slave1>
|
||||
<device>bond0</device>
|
||||
<bootproto>static</bootproto>
|
||||
<startmode>auto</startmode>
|
||||
<ipaddr>#NODEIPADDR#</ipaddr>
|
||||
<netmask>#NODENETMASK#</netmask>
|
||||
<usercontrol>no</usercontrol>
|
||||
</interface>
|
||||
<interface>
|
||||
<bootproto>none</bootproto>
|
||||
<device>eth0</device>
|
||||
<name>Ethernet Card 0</name>
|
||||
<startmode>off</startmode>
|
||||
</interface>
|
||||
<interface>
|
||||
<bootproto>none</bootproto>
|
||||
<device>eth2</device>
|
||||
<name>Ethernet Card 2</name>
|
||||
<startmode>off</startmode>
|
||||
</interface>
|
||||
</interfaces>
|
||||
<routing>
|
||||
<ip_forward config:type="boolean">false</ip_forward>
|
||||
<routes config:type="list">
|
||||
<route>
|
||||
<destination>default</destination>
|
||||
<device>-</device>
|
||||
<gateway>#NODEGATEWAY#</gateway>
|
||||
<netmask>-</netmask>
|
||||
</route>
|
||||
</routes>
|
||||
</routing>
|
||||
</networking>
|
||||
<files config:type="list">
|
||||
<file>
|
||||
<file_contents><![CDATA[alias bond0 bonding
|
||||
]]></file_contents>
|
||||
<file_owner>root</file_owner>
|
||||
<file_path>/etc/modprobe.d/bond0.conf</file_path>
|
||||
<file_permissions>644</file_permissions>
|
||||
</file>
|
||||
</files>
|
||||
<scripts>
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.sles#
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/chroot.sles#
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SI post-install script to configure the efi boot mgr or grub after SI has installed the OS
|
||||
# SI post-install scripts run in a chroot environment of the final OS image
|
||||
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
echo "Setting Boot Manager for the next boot."
|
||||
echo "delete all sysclone boot list"
|
||||
str_bootnums=`efibootmgr | grep 'syscloneLinux' | awk '{print $1}' | sed 's/boot//i' | sed 's/*//'`
|
||||
for str_num in $str_bootnums
|
||||
do
|
||||
efibootmgr -b $str_num -B -q
|
||||
done
|
||||
|
||||
if [ -f "/boot/efi/EFI/redhat/grub.efi" ];then
|
||||
efibootmgr -c -l \\EFI\\redhat\\grub.efi -L syscloneLinux
|
||||
elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then
|
||||
efibootmgr -c -l \\efi\\SuSE\\elilo.efi -L syscloneLinux
|
||||
else
|
||||
echo "Can not find the boot loader."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "run grub-install to configure the MBR."
|
||||
if [ -e /etc/mtab ];then
|
||||
mv /etc/mtab /etc/mtab.bak
|
||||
fi
|
||||
grep -v rootfs /proc/mounts > /etc/mtab
|
||||
boot_device=''
|
||||
if [ -f "/etc/systemconfig/systemconfig.conf" ];then
|
||||
boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'`
|
||||
else
|
||||
boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'`
|
||||
boot_device=`echo $boot_root | sed -e 's/[0-9]*$//'`
|
||||
|
||||
#str_temp=`mount | awk '{print $1","$3}'`
|
||||
#for line in $str_temp
|
||||
#do
|
||||
# mp=`echo $line | awk -F, '{print $2}'`
|
||||
# if [ "$mp" = "/" ];then
|
||||
# boot_device=`echo $line | awk -F, '{print $1}' | sed -e 's/[0-9]*$//'`
|
||||
# break
|
||||
# fi
|
||||
#done
|
||||
fi
|
||||
|
||||
if [ -n "$boot_device" ];then
|
||||
echo "The boot device is $boot_device"
|
||||
echo "The boot root device is $boot_root"
|
||||
else
|
||||
echo "Can not find the boot device, return error"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# set grub to use this boot device
|
||||
if grep -qe '^VERSION\s*=\s*11' /etc/SuSE-release; then
|
||||
#sles11, run grub-install.unsupported directly
|
||||
echo "grub-install.unsupported --no-floppy --recheck $boot_device"
|
||||
grub-install.unsupported --no-floppy --recheck $boot_device
|
||||
# note: the error about grub-set-default not existing is harmless, because we want the default to be 0 anyway
|
||||
else
|
||||
#for sles10, should run grub-install with parameters
|
||||
echo "grub-install --no-floppy --recheck $boot_device"
|
||||
grub-install --no-floppy --recheck $boot_device
|
||||
fi
|
||||
|
||||
# change the entries in the grub conf file to use the correct boot root device
|
||||
# (not the one leftover from the golden image)
|
||||
if [ -f "/boot/grub/grub.conf" ];then
|
||||
conffile="/boot/grub/grub.conf"
|
||||
else
|
||||
conffile="/boot/grub/menu.lst"
|
||||
fi
|
||||
sed -i 's| root=\S*| root='$boot_root'|' $conffile
|
||||
sed -i 's| resume=\S*| noresume|' $conffile
|
||||
|
||||
if [ -e /etc/mtab.bak ];then
|
||||
mv -f /etc/mtab.bak /etc/mtab
|
||||
else
|
||||
rm -f /etc/mtab
|
||||
fi
|
||||
fi
|
||||
@@ -1,209 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SI post-install script to configure network settings after SI has installed the OS
|
||||
# SI post-install scripts run in a chroot environment of the final OS image
|
||||
|
||||
. /tmp/post-install/variables.txt
|
||||
|
||||
bondingopts='mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1'
|
||||
|
||||
# determine if we should be using a static ip or dhcp
|
||||
staticIP () {
|
||||
# Eventually we should use the SI variable IP_ASSIGNMENT_METHOD below to determine this.
|
||||
# But this requires a patch in both xcat/sysclone (to set si_getimage -ip-assignment method)
|
||||
# and SI (to set IP_ASSIGNMENT_METHOD as a result of that). Until both of those patches
|
||||
# are in the main releases, assume that if we have set the IPADDR kernel parm for the boot
|
||||
# kernel to use static ip, that the final OS should use static ip too.
|
||||
# Note: the IPADDR environment variable will be set by SI, even if it got it thru dhcp, so
|
||||
# that is not a reliable way to decide.
|
||||
str=`cat /proc/cmdline`
|
||||
#str='netmask=255.255.255.192 IPADDR=10.54.51.11 GATEWAY=10.54.51.1 dns=10.54.51.2 hostname=sap64-4 DEVICE=eth0'
|
||||
for parm in $str; do
|
||||
key=`echo $parm|awk -F= '{print $1}'`
|
||||
value=`echo $parm|awk -F= '{print $2}'`
|
||||
if [[ $key == "IPADDR" || $key == "ipaddr" ]]; then
|
||||
return 0 # yes, we should use static ip
|
||||
fi
|
||||
done
|
||||
if [[ -n $IP_ASSIGNMENT_METHOD && ${IP_ASSIGNMENT_METHOD,,} == "static" ]]; then
|
||||
return 0 # this means yes/true
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
#delete the udev rule in the image
|
||||
rule_file=`ls /etc/udev/rules.d/*net_persistent_names.rules 2>/dev/null`
|
||||
if [ -n "$rule_file" ];then
|
||||
rm -f $rule_file
|
||||
fi
|
||||
|
||||
hostname $HOSTNAME
|
||||
bond=bond0
|
||||
# this is a softlayer assumption that the two devices on the private net will be eth0 and eth2
|
||||
if [[ $DEVICE == "eth0" ]]; then
|
||||
DEVICE2=eth2
|
||||
elif [[ $DEVICE == "eth2" ]]; then
|
||||
DEVICE2=eth0
|
||||
fi
|
||||
ip addr show|grep -q -E "^[0-9]+:\s+$DEVICE2:" # make sure it exists on the system
|
||||
if [[ $? == 0 ]]; then
|
||||
DEVICE2EXISTS="yes"
|
||||
fi
|
||||
|
||||
device_names=`ifconfig -a | grep -i hwaddr | grep -i 'Ethernet' | grep -v usb| awk '{print $1}'`
|
||||
str_cfg_file=''
|
||||
if [ -d "/etc/sysconfig/network-scripts/" ];then
|
||||
#redhat
|
||||
dir="/etc/sysconfig/network-scripts"
|
||||
grep -i HOSTNAME /etc/sysconfig/network
|
||||
if [ $? -eq 0 ];then
|
||||
sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network
|
||||
else
|
||||
echo "HOSTNAME=$HOSTNAME" >> /etc/sysconfig/network
|
||||
fi
|
||||
if staticIP; then
|
||||
# delete all nic cfg files left over from the golden node
|
||||
for i in $device_names;do
|
||||
rm -f "$dir/ifcfg-$i"
|
||||
done
|
||||
|
||||
# set static ip from variables in variables.txt
|
||||
# write ifcfg-bond0. For now we assume the installnic should be part of bond0,
|
||||
# because in SL i think that is always the case.
|
||||
i="$bond"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=none" >> $str_cfg_file
|
||||
echo "ONBOOT=yes" >> $str_cfg_file
|
||||
echo "USERCTL=no" >> $str_cfg_file
|
||||
echo 'BONDING_OPTS="'$bondingopts'"' >> $str_cfg_file
|
||||
echo "IPADDR=$IPADDR" >> $str_cfg_file
|
||||
echo "NETMASK=$NETMASK" >> $str_cfg_file
|
||||
echo "NETWORK=$NETWORK" >> $str_cfg_file
|
||||
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
|
||||
#todo: add gateway config? Not sure, because the boot kernels gateway might not be the final OS gateway
|
||||
|
||||
# write ifcfg-eth0
|
||||
i="$DEVICE"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=none" >> $str_cfg_file
|
||||
echo "MASTER=$bond" >> $str_cfg_file
|
||||
echo "ONBOOT=yes" >> $str_cfg_file
|
||||
echo "SLAVE=yes" >> $str_cfg_file
|
||||
echo "USERCTL=no" >> $str_cfg_file
|
||||
|
||||
i="$DEVICE2"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
if [[ $DEVICE2EXISTS == "yes" ]]; then
|
||||
# write ifcfg-eth2
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=none" >> $str_cfg_file
|
||||
echo "MASTER=$bond" >> $str_cfg_file
|
||||
echo "ONBOOT=yes" >> $str_cfg_file
|
||||
echo "SLAVE=yes" >> $str_cfg_file
|
||||
echo "USERCTL=no" >> $str_cfg_file
|
||||
else
|
||||
rm -f $str_cfg_file # in case it was left over in the image that was captured
|
||||
fi
|
||||
|
||||
# write modprobe alias config
|
||||
str_cfg_file="/etc/modprobe.d/$bond.conf"
|
||||
echo "alias $bond bonding" > $str_cfg_file
|
||||
|
||||
#todo: figure out how to set the default gateway in rhel
|
||||
else
|
||||
# use dhcp for all nics
|
||||
for i in $device_names;do
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=dhcp" >> $str_cfg_file
|
||||
echo "NM_CONTROLLED=yes" >> $str_cfg_file
|
||||
echo "ONBOOT=yes" >> $str_cfg_file
|
||||
done
|
||||
fi
|
||||
elif [ -d "/etc/sysconfig/network/" ];then
|
||||
#suse
|
||||
dir="/etc/sysconfig/network"
|
||||
echo "$HOSTNAME" > /etc/HOSTNAME
|
||||
if staticIP; then
|
||||
# delete all nic cfg files left over from the golden node
|
||||
for i in $device_names;do
|
||||
rm -f "$dir/ifcfg-$i"
|
||||
done
|
||||
|
||||
# set static ip from variables in variables.txt
|
||||
# write ifcfg-bond0. For now we assume the installnic should be part of bond0,
|
||||
# because in SL i think that is always the case.
|
||||
i="$bond"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "BOOTPROTO=static" > $str_cfg_file
|
||||
echo "STARTMODE=onboot" >> $str_cfg_file
|
||||
echo "BONDING_MASTER=yes" >> $str_cfg_file
|
||||
echo "BONDING_MODULE_OPTS='$bondingopts'" >> $str_cfg_file
|
||||
echo "NAME='Bonded Interface'" >> $str_cfg_file
|
||||
echo "IPADDR=$IPADDR" >> $str_cfg_file
|
||||
echo "NETMASK=$NETMASK" >> $str_cfg_file
|
||||
echo "NETWORK=$NETWORK" >> $str_cfg_file
|
||||
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
|
||||
echo "USERCONTROL=no" >> $str_cfg_file
|
||||
echo "BONDING_SLAVE_0=$DEVICE" >> $str_cfg_file
|
||||
if [[ $DEVICE2EXISTS == "yes" ]]; then
|
||||
echo "BONDING_SLAVE_1=$DEVICE2" >> $str_cfg_file
|
||||
fi
|
||||
|
||||
# write ifcfg-eth0
|
||||
i="$DEVICE"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "BOOTPROTO=none" > $str_cfg_file
|
||||
echo "STARTMODE=hotplug" >> $str_cfg_file
|
||||
|
||||
i="$DEVICE2"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
if [[ $DEVICE2EXISTS == "yes" ]]; then
|
||||
# write ifcfg-eth2
|
||||
echo "BOOTPROTO=none" > $str_cfg_file
|
||||
echo "STARTMODE=hotplug" >> $str_cfg_file
|
||||
else
|
||||
rm -f $str_cfg_file # in case it was left over in the image that was captured
|
||||
fi
|
||||
|
||||
# write modprobe alias config
|
||||
str_cfg_file="/etc/modprobe.d/$bond.conf"
|
||||
echo "alias $bond bonding" > $str_cfg_file
|
||||
|
||||
# set the default gateway (at this point this is the private nic gateway, to handle provision across vlans)
|
||||
file=/etc/sysconfig/network/routes
|
||||
if grep -q -E '^default ' $file; then
|
||||
# replace the default route that is already in there
|
||||
sed -i 's/^default .*$/default '$GATEWAY' - -/' $file
|
||||
else
|
||||
# no default route yet, append to file
|
||||
echo "default $GATEWAY - -" >>$file
|
||||
fi
|
||||
|
||||
# this was the original config of the eth0 nic (without bonding)
|
||||
#echo "DEVICE=$i" > $str_cfg_file
|
||||
#echo "BOOTPROTO=static" >> $str_cfg_file
|
||||
#echo "STARTMODE=onboot" >> $str_cfg_file
|
||||
#echo "IPADDR=$IPADDR" >> $str_cfg_file
|
||||
#echo "NETMASK=$NETMASK" >> $str_cfg_file
|
||||
#echo "NETWORK=$NETWORK" >> $str_cfg_file
|
||||
#echo "BROADCAST=$BROADCAST" >> $str_cfg_file
|
||||
#todo: add gateway config? Not sure, because the boot kernels gateway might not be the final OS gateway
|
||||
else
|
||||
# use dhcp for all nics
|
||||
for i in $device_names;do
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=dhcp" >> $str_cfg_file
|
||||
echo "STARTMODE=onboot" >> $str_cfg_file
|
||||
echo "DHCLIENT_PRIMARY_DEVICE=yes" >> $str_cfg_file
|
||||
done
|
||||
fi
|
||||
else
|
||||
#ubuntu
|
||||
echo "Does not support ubuntu."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
#Used only by sysclone
|
||||
|
||||
# This SI post-install script is needed because the initrd that autoyast/kickstart/ubuntu builds when installing
|
||||
# sles/rh/ubuntu on the golden node may not have the drivers when that initrd runs on the node that is
|
||||
# being deployed with this image (specifically, drivers to be able to mount the disk).
|
||||
# So rebuild the initrd on the to-node after putting the image on the disk, but before rebooting.
|
||||
|
||||
#todo: Make this script work on red hat by checking for dracut and using that if it exists.
|
||||
# And do whatever is necessary on ubuntu.
|
||||
|
||||
if [[ -f /sbin/dracut ]]; then
|
||||
# redhat/centos
|
||||
echo "Running dracut to regenerate the initrd with the drivers needed by this node:"
|
||||
dracut --force
|
||||
else
|
||||
# suse/sles
|
||||
echo "Running mkinitrd to regenerate the initrd with the drivers needed by this node:"
|
||||
mkinitrd
|
||||
fi
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SI post-install script, run after SI has installed the OS, to kill processes SI does not kill
|
||||
# (so /a can be umounted cleanly)
|
||||
# SI post-install scripts run in a chroot environment of the final OS image
|
||||
|
||||
if [ -f "/etc/SuSE-release" ];then
|
||||
str_out=`ps -ef | grep -v grep | grep syslog-ng`
|
||||
if [ $? -eq 0 ];then
|
||||
str_id=`echo $str_out | awk '{print $2}'`
|
||||
kill -9 $str_id
|
||||
fi
|
||||
fi
|
||||
|
||||
# SI starts klogd in the chroot, but does not kill it. Remove this line when SI fixes their bug.
|
||||
killall klogd
|
||||
|
||||
# flush all write buffers, just in case SI can not umount /a
|
||||
echo "Syncing file systems"
|
||||
sync
|
||||
|
||||
#todo: remove
|
||||
#echo "Processes still using /:"
|
||||
#fuser -v /
|
||||
#sleep 30
|
||||
@@ -17,11 +17,6 @@ BuildArch: noarch
|
||||
Requires: xCAT-server
|
||||
#Requires: xCAT-server >= %{epoch}:%(cat Version|cut -d. -f 1,2)
|
||||
|
||||
# perl-ExtUtils-MakeMaker, perl-CPAN, perl-Test-Harness are only available in rhel.
|
||||
# When this rpm supports being installed in sles, need to add these to xcat-dep.
|
||||
# perl-SOAP-Lite is already in xcat-dep
|
||||
Requires: perl-ExtUtils-MakeMaker perl-CPAN perl-Test-Harness perl-SOAP-Lite
|
||||
|
||||
Provides: xCAT-SoftLayer = %{epoch}:%{version}
|
||||
|
||||
%description
|
||||
@@ -48,22 +43,18 @@ xCAT-SoftLayer provides Utilities to make xCAT work in a SoftLayer environment.
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/install
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
|
||||
mkdir -p $RPM_BUILD_ROOT/install/postscripts
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
|
||||
|
||||
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 postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
|
||||
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts/*
|
||||
|
||||
cp -d si-post-install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
|
||||
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install/*
|
||||
cp -d postscripts/* $RPM_BUILD_ROOT/install/postscripts
|
||||
chmod 755 $RPM_BUILD_ROOT/install/postscripts/*
|
||||
|
||||
cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer/*
|
||||
@@ -80,13 +71,4 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root)
|
||||
#%doc LICENSE.html
|
||||
%{prefix}
|
||||
|
||||
%post
|
||||
# We are shipping the postscripts in a sysclone dir and then copying them to /install/postscripts here,
|
||||
# because we want to allow base xcat to eventually ship them and not conflict on the file name/path
|
||||
# But base xcat now has a newer/better configbond written in bash, so if that is there do not overwrite it.
|
||||
head /install/postscripts/configbond | grep -q -E '^#! */bin/bash'
|
||||
if [[ $? != 0 ]]; then
|
||||
# the new configbond from xcat 2.8.5 is not there, so copy ours
|
||||
cp -f /%{prefix}/share/xcat/sysclone/postscripts/* /install/postscripts
|
||||
fi
|
||||
/install/postscripts
|
||||
|
||||
+19
-39
@@ -590,16 +590,13 @@ sub startxcatd
|
||||
} else {
|
||||
$xcmd = "$::XCATROOT/sbin/restartxcatd";
|
||||
}
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#$xcmd = "service xcatd restart";
|
||||
my $ret=xCAT::Utils->restartservice("xcatd");
|
||||
return $ret;
|
||||
$xcmd = "service xcatd restart";
|
||||
}
|
||||
|
||||
system($xcmd);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -621,16 +618,13 @@ sub shutdownxcatd
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$xcmd = "stopsrc -s xcatd";
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#$xcmd = "service xcatd stop";
|
||||
my $ret=xCAT::Utils->stopservice("xcatd");
|
||||
return $ret;
|
||||
$xcmd = "service xcatd stop";
|
||||
}
|
||||
|
||||
system($xcmd);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -1878,7 +1872,7 @@ sub restorexcatdb
|
||||
# restore the database
|
||||
xCAT::MsgUtils->message(
|
||||
"I",
|
||||
"Restoring the xCAT Database with $::backupdir to DB2 database.\nThis could take several minutes."
|
||||
"Restoring the xCat Database with $::backupdir to DB2 database.\nThis could take several minutes."
|
||||
);
|
||||
if (!(-d $::backupdir))
|
||||
{ # does not exist, error
|
||||
@@ -2079,12 +2073,11 @@ sub adddb2paths
|
||||
#-----------------------------------------------------------------------------
|
||||
sub remove
|
||||
{
|
||||
my $cmd;
|
||||
my @output;
|
||||
my $error = 0;
|
||||
my $retcode=0;
|
||||
#see if DB2 is installed
|
||||
if (!(-e ($::installdb2dir)))
|
||||
my $cmd;
|
||||
my @output;
|
||||
my $error = 0;
|
||||
#see if DB2 is installed
|
||||
if (!(-e ($::installdb2dir)))
|
||||
{
|
||||
my $message =
|
||||
"\nDB2 is not installed.";
|
||||
@@ -2127,23 +2120,18 @@ sub remove
|
||||
|
||||
my $cmd = "ps -elf|grep xcatd";
|
||||
my @output = xCAT::Utils->runcmd($cmd, 0);
|
||||
|
||||
if ($::RUNCMD_RC == 0)
|
||||
{
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
my $cmd = "startsrc -s xcatd";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
$retcode=$::RUNCMD_RC;
|
||||
}
|
||||
else
|
||||
{
|
||||
#my $cmd = "service xcatd start";
|
||||
$retcode=xCAT::Utils->startservice("xcatd");
|
||||
my $cmd = "service xcatd start";
|
||||
}
|
||||
#xCAT::Utils->runcmd($cmd, -1);
|
||||
#if ($::RUNCMD_RC !=0)
|
||||
if($retcode!=0)
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC !=0)
|
||||
{
|
||||
my $message = "can't start xcatd";
|
||||
$error += 1;
|
||||
@@ -2167,17 +2155,13 @@ sub remove
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
my $cmd = "stopsrc -s xcatd";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
$retcode=$::RUNCMD_RC;
|
||||
}
|
||||
else
|
||||
{
|
||||
#my $cmd = "service xcatd stop";
|
||||
$retcode=xCAT::Utils->stopservice("xcatd");
|
||||
my $cmd = "service xcatd stop";
|
||||
}
|
||||
#xCAT::Utils->runcmd($cmd, -1);
|
||||
#if ($::RUNCMD_RC !=0)
|
||||
if($retcode!=0)
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC !=0)
|
||||
{
|
||||
my $message = "can't stop xcatd";
|
||||
xCAT::MsgUtils->message("E", "$message");
|
||||
@@ -2214,17 +2198,13 @@ sub remove
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
my $cmd = "startsrc -s xcatd";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
$retcode=$::RUNCMD_RC;
|
||||
}
|
||||
else
|
||||
{
|
||||
#my $cmd = "service xcatd start";
|
||||
$retcode=xCAT::Utils->startservice("xcatd");
|
||||
my $cmd = "service xcatd start";
|
||||
}
|
||||
#xCAT::Utils->runcmd($cmd, -1);
|
||||
#if ($::RUNCMD_RC !=0)
|
||||
if($retcode!=0)
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC !=0)
|
||||
{
|
||||
my $message = "can't start xcatd";
|
||||
xCAT::MsgUtils->message("E", "$message");
|
||||
|
||||
@@ -176,8 +176,7 @@ if ((!$imagename) && (!$os)){
|
||||
my @dircontents = `ls $installdir`;
|
||||
chomp(@dircontents);
|
||||
foreach (@dircontents) {
|
||||
# SL matches Scientific Linux, sl matches sles amd sled
|
||||
if($_ =~ /(rhel|fedora|SL|centos|sl|suse)/){
|
||||
if($_ =~ /(rhel|fedora|sl|centos|suse)/){
|
||||
push @oses,$_;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
xcatclient
|
||||
+39
-79
@@ -8,9 +8,10 @@
|
||||
|
||||
|
||||
|
||||
This script automates the setup of the MySQL/MariaDB server and creates the xCAT database to run
|
||||
xCAT on MySQL/MariaDB.
|
||||
Note: it will setup an xcat database (xcatdb),a xcatadmin id , and a MySQL root password.
|
||||
This is script is called after the installation or upgrade of MySQL
|
||||
on xCAT. It will automate the setup of the MySQL and xCAT to run
|
||||
xCAT on the MySQL DB.
|
||||
Note: if will setup an xcatdb,a xcatadmin, and a MySQL root password.
|
||||
It will interact for the
|
||||
password to assign, unless the XCATMYSQLADMIN_PW and the XCATMYSQLROOT_PW
|
||||
env variables are set to the admin and mysql root password, resp.
|
||||
@@ -149,8 +150,8 @@ $::linuxos = xCAT::Utils->osver();
|
||||
|
||||
#
|
||||
# check to see if mysql is installed
|
||||
#
|
||||
my $cmd = "rpm -qa | grep -i perl-DBD-mysql";
|
||||
#
|
||||
my $cmd = "rpm -qa | grep mysql";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "dpkg -l | grep mysql-server";
|
||||
}
|
||||
@@ -158,17 +159,10 @@ xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $message =
|
||||
"\nMySQL perl DBD is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs.";
|
||||
"\nMySQL is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs.";
|
||||
xCAT::MsgUtils->message("E", " $cmd failed. $message");
|
||||
exit(1);
|
||||
}
|
||||
# is this MariaDB or MySQL
|
||||
$::MariaDB=0;
|
||||
$cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC == 0) {
|
||||
$::MariaDB=1;
|
||||
}
|
||||
|
||||
# check to see if MySQL is running
|
||||
$::mysqlrunning = 0;
|
||||
@@ -334,6 +328,7 @@ if (($::INIT) && ($::xcatrunningmysql == 0))
|
||||
# MySQL not running, then initialize the database
|
||||
if ($::mysqlrunning == 0)
|
||||
{
|
||||
|
||||
# Add mysql user and group for AIX
|
||||
# Correct directory permissions
|
||||
#
|
||||
@@ -441,7 +436,7 @@ sub usage
|
||||
{
|
||||
xCAT::MsgUtils->message(
|
||||
'I',
|
||||
"Usage:\nmysqlsetup - Performs the setup of MySQL or MariaDB for xCAT to use as its database. See man mysqlsetup for more information."
|
||||
"Usage:\nmysqlsetup - Performs the setup of MySQL for xCAT to use as its database. See man mysqlsetup for more information."
|
||||
);
|
||||
my $msg =
|
||||
"mysqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-f|hostfile] [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-u|--update> <-f|hostfile> [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]\n <-L|--LL> [-V|--verbose]";
|
||||
@@ -608,16 +603,13 @@ sub shutdownxcatd
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$xcmd = "stopsrc -s xcatd";
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#$xcmd = "service xcatd stop";
|
||||
my $ret=xCAT::Utils->stopservice("xcatd");
|
||||
return $ret;
|
||||
$xcmd = "service xcatd stop";
|
||||
}
|
||||
|
||||
system($xcmd);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -864,7 +856,6 @@ sub initmysqldb
|
||||
sub mysqlstart
|
||||
{
|
||||
my $cmd;
|
||||
my $ret=0;
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
my $hostname = `hostname`;
|
||||
@@ -876,31 +867,22 @@ sub mysqlstart
|
||||
$cmd = $cmd2;
|
||||
$cmd .=
|
||||
"$::installdir/bin/mysqld --user=mysql --basedir=$::installdir --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/$hostname.err --pid-file=/var/lib/mysql/$hostname.pid --socket=/tmp/mysql.sock --port=3306 &";
|
||||
$ret=xCAT::Utils->runcmd($cmd, 0);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($::MariaDB==1) { # running MariaDB
|
||||
#$cmd = "service mariadb start";
|
||||
$ret=xCAT::Utils->startservice("mariadb");
|
||||
|
||||
} else { # it is mysql
|
||||
|
||||
if ($::linuxos =~ /rh.*/)
|
||||
{
|
||||
$ret=xCAT::Utils->startservice("mysqld");
|
||||
}
|
||||
else
|
||||
{ # sles
|
||||
$ret=xCAT::Utils->startservice("mysql");
|
||||
}
|
||||
}
|
||||
if ($::linuxos =~ /rh.*/)
|
||||
{
|
||||
$cmd = "service mysqld start";
|
||||
}
|
||||
else
|
||||
{ # sles
|
||||
$cmd = "service mysql start";
|
||||
}
|
||||
}
|
||||
if ($ret != 0)
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("E", " failed to start mysql/mariadb.");
|
||||
xCAT::MsgUtils->message("E", " $cmd failed.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -991,21 +973,16 @@ sub mysqlreboot
|
||||
}
|
||||
else # linux
|
||||
{
|
||||
if ($::MariaDB==1 ) { # MariaDB not MySQL
|
||||
|
||||
$cmd = "chkconfig mariadb on";
|
||||
} else { # mysql
|
||||
if ($::linuxos =~ /rh.*/)
|
||||
{
|
||||
$cmd = "chkconfig mysqld on";
|
||||
}
|
||||
else
|
||||
{ # sles
|
||||
$cmd = "chkconfig mysql on";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "update-rc.d mysql defaults";
|
||||
}
|
||||
}
|
||||
if ($::linuxos =~ /rh.*/)
|
||||
{
|
||||
$cmd = "chkconfig mysqld on";
|
||||
}
|
||||
else
|
||||
{ # sles
|
||||
$cmd = "chkconfig mysql on";
|
||||
if ( $::debianflag ){
|
||||
$cmd = "update-rc.d mysql defaults";
|
||||
}
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
@@ -1081,12 +1058,7 @@ sub setupxcatdb
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $pwd_sent = 0;
|
||||
my $pwd_prompt = 'Enter password: ';
|
||||
my $mysql_prompt;
|
||||
if ($::MariaDB == 1) { # setup MariaDB
|
||||
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
|
||||
} else {
|
||||
$mysql_prompt = 'mysql> ';
|
||||
}
|
||||
my $mysql_prompt = 'mysql> ';
|
||||
my $expect_log = undef;
|
||||
my $debug = 0;
|
||||
#if ($::VERBOSE)
|
||||
@@ -1206,12 +1178,7 @@ sub setupLL
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $pwd_sent = 0;
|
||||
my $pwd_prompt = 'Enter password: ';
|
||||
my $mysql_prompt;
|
||||
if ($::MariaDB == 1) { # setup MariaDB
|
||||
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
|
||||
} else {
|
||||
$mysql_prompt = 'mysql> ';
|
||||
}
|
||||
my $mysql_prompt = 'mysql> ';
|
||||
my $expect_log = undef;
|
||||
my $debug = 0;
|
||||
#if ($::VERBOSE)
|
||||
@@ -1341,12 +1308,7 @@ sub addhosts
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $pwd_sent = 0;
|
||||
my $pwd_prompt = 'Enter password: ';
|
||||
my $mysql_prompt;
|
||||
if ($::MariaDB == 1) { # setup MariaDB
|
||||
$mysql_prompt = 'MariaDB \[\(none\)\]> ';
|
||||
} else {
|
||||
$mysql_prompt = 'mysql> ';
|
||||
}
|
||||
my $mysql_prompt = 'mysql> ';
|
||||
my $expect_log = undef;
|
||||
|
||||
foreach my $host (@hosts)
|
||||
@@ -1787,7 +1749,7 @@ sub restorexcatdb
|
||||
# restore the database
|
||||
xCAT::MsgUtils->message(
|
||||
"I",
|
||||
"Restoring the xCAT Database with $::backupdir to MySQL database.\nThis could take several minutes."
|
||||
"Restoring the xCat Database with $::backupdir to MySQL database.\nThis could take several minutes."
|
||||
);
|
||||
if (!(-d $::backupdir))
|
||||
{ # does not exist, error
|
||||
@@ -1816,14 +1778,12 @@ sub restorexcatdb
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$xcmd = "$::XCATROOT/sbin/restartxcatd";
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#$xcmd = "service xcatd restart";
|
||||
my $ret=xCAT::Utils->restartservice("xcatd");
|
||||
return $ret;
|
||||
$xcmd = "service xcatd restart";
|
||||
}
|
||||
|
||||
system($xcmd);
|
||||
}
|
||||
|
||||
|
||||
+25
-44
@@ -444,16 +444,13 @@ sub shutdownxcatd
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$xcmd = "stopsrc -s xcatd";
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
# $xcmd = "service xcatd stop";
|
||||
my $ret=xCAT::Utils->stopservice("xcatd");
|
||||
return $ret;
|
||||
$xcmd = "service xcatd stop";
|
||||
}
|
||||
|
||||
system($xcmd);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -835,7 +832,6 @@ sub initpgdb
|
||||
sub pgstart
|
||||
{
|
||||
my $cmd;
|
||||
my $ret=0;
|
||||
xCAT::MsgUtils->message("I", "Starting the PosgreSQL Server");
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
@@ -847,35 +843,27 @@ sub pgstart
|
||||
else # linux
|
||||
{
|
||||
if (defined($::postgres9)) { # set to the PTF level of postgresql 9.X
|
||||
#$cmd = "service postgresql-9.$::postgres9 start";
|
||||
$cmd = "postgresql-9.$::postgres9";
|
||||
$cmd = "service postgresql-9.$::postgres9 start";
|
||||
} else {
|
||||
#$cmd = "service postgresql start";
|
||||
$cmd = "postgresql";
|
||||
$cmd = "service postgresql start";
|
||||
}
|
||||
#system($cmd)
|
||||
#if ($? > 0) {
|
||||
$ret=xCAT::Utils->startservice($cmd);
|
||||
if ($ret != 0) {
|
||||
xCAT::MsgUtils->message("E", " failed to start $cmd.");
|
||||
system($cmd);
|
||||
if ($? > 0) {
|
||||
xCAT::MsgUtils->message("E", " $cmd failed.");
|
||||
exit(1);
|
||||
}
|
||||
# check to see if running before continuing
|
||||
my $retries =0;
|
||||
my $pgstarted =0;
|
||||
#if (defined($::postgres9)) { # set to the PTF level of postgresql 9.X
|
||||
# #$cmd = "service postgresql-9.$::postgres9 status";
|
||||
# $ret=xCAT::Utils->checkservicestatus("postgresql-9.$::postgres9");
|
||||
#} else {
|
||||
# #$cmd = "service postgresql status";
|
||||
# $ret=xCAT::Utils->checkservicestatus("postgresql");
|
||||
#}
|
||||
if (defined($::postgres9)) { # set to the PTF level of postgresql 9.X
|
||||
$cmd = "service postgresql-9.$::postgres9 status";
|
||||
} else {
|
||||
$cmd = "service postgresql status";
|
||||
}
|
||||
while ($retries < 30) {
|
||||
$retries++;
|
||||
#my @status=xCAT::Utils->runcmd($cmd, -1);
|
||||
#if (grep(/[r|R]unning/, @status)) {
|
||||
$ret=xCAT::Utils->checkservicestatus($cmd);
|
||||
if($ret == 0){
|
||||
my @status=xCAT::Utils->runcmd($cmd, -1);
|
||||
if (grep(/[r|R]unning/, @status)) {
|
||||
$pgstarted=1;
|
||||
last;
|
||||
}
|
||||
@@ -915,22 +903,18 @@ sub pgreboot
|
||||
else # linux
|
||||
{
|
||||
if (defined($::postgres9)) { # set to the postgresql ptf level
|
||||
# $cmd = "chkconfig postgresql-9.$::postgres9 on";
|
||||
$cmd = "postgresql-9.$::postgres9";
|
||||
$cmd = "chkconfig postgresql-9.$::postgres9 on";
|
||||
} else {
|
||||
#$cmd = "chkconfig postgresql on";
|
||||
$cmd = "postgresql";
|
||||
$cmd = "chkconfig postgresql on";
|
||||
}
|
||||
#if ($debianflag){
|
||||
#$cmd = "update-rc.d postgresql defaults";
|
||||
#}
|
||||
#xCAT::Utils->runcmd($cmd, 0);
|
||||
#if ($::RUNCMD_RC != 0)
|
||||
my $ret=xCAT::Utils->enableservice($cmd);
|
||||
if($cmd !=0 )
|
||||
if ($debianflag){
|
||||
$cmd = "update-rc.d postgresql defaults";
|
||||
}
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message("E",
|
||||
"enable service $cmd failed. PostgreSQL will not restart on reboot.");
|
||||
" $cmd failed. PostgreSQL will not restart on reboot.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1331,7 +1315,7 @@ sub restorexcatdb
|
||||
# restore the database
|
||||
xCAT::MsgUtils->message(
|
||||
"I",
|
||||
"Restoring the xCAT Database with $::backupdir to PostgreSQL database.\nThis could take several minutes."
|
||||
"Restoring the xCat Database with $::backupdir to PostgreSQL database.\nThis could take several minutes."
|
||||
);
|
||||
if (!(-d $::backupdir))
|
||||
{ # does not exist, error
|
||||
@@ -1363,15 +1347,12 @@ sub restorexcatdb
|
||||
if ($::osname eq 'AIX')
|
||||
{
|
||||
$xcmd = "startsrc -s xcatd";
|
||||
system($xcmd);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#$xcmd = "service xcatd start";
|
||||
my $ret=xCAT::Utils->startservice("xcatd");
|
||||
return $ret;
|
||||
$xcmd = "service xcatd start";
|
||||
}
|
||||
|
||||
system($xcmd);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ else { # the normal case of the user running the cmd - expand the noderange us
|
||||
SSL_cert_file=> xCAT::Utils->getHomeDir()."/.xcat/client-cred.pem",
|
||||
SSL_ca_file => xCAT::Utils->getHomeDir()."/.xcat/ca.pem",
|
||||
SSL_use_cert => 1,
|
||||
SSL_verify_mode => 1,
|
||||
#SSL_verify_mode => 1,
|
||||
);
|
||||
die "Connection failure: $!\n" unless ($client);
|
||||
my %cmdref = (command => 'noderange', noderange => $noderange);
|
||||
|
||||
@@ -69,7 +69,7 @@ my $client = IO::Socket::SSL->new(
|
||||
SSL_cert_file=>$homedir."/.xcat/client-cred.pem",
|
||||
SSL_ca_file => $homedir."/.xcat/ca.pem",
|
||||
SSL_use_cert => 1,
|
||||
SSL_verify_mode => 1,
|
||||
#SSL_verify_mode => 1,
|
||||
);
|
||||
die "Connection failure: $!\n" unless ($client);
|
||||
my %cmdref = (command => 'noderange', noderange => $noderange);
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ if (!GetOptions(
|
||||
"nonodecheck" => \$::NONODECHECK, #does not check the noderange, in this case, noderange need to be a list of nodes.
|
||||
'h|help' => \$help,
|
||||
) || $help || scalar(@ARGV)<2 ) {
|
||||
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] [--nonodecheck] [-t <timeout value in seconds>] <noderange> <command>\n";
|
||||
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] [--nonodecheck] <noderange> <command>\n";
|
||||
exit;
|
||||
}
|
||||
my %nodehdl;
|
||||
|
||||
+10
-17
@@ -13,7 +13,7 @@ if [ "$os" == "AIX" ]; then
|
||||
export HOME
|
||||
fi
|
||||
|
||||
if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
|
||||
if [ -z "$1" ] || [ "$1" = "-h" ]; then
|
||||
echo "rcons - remotely accesses the serial console of a node"
|
||||
echo "rcons <singlenode> [conserver] [-f]"
|
||||
echo "rcons <singlenode> [conserver] [-s]"
|
||||
@@ -66,17 +66,14 @@ if [ -f "/usr/bin/console" ] || [ -f "/bin/console" ]; then
|
||||
|
||||
#Detect console support of SSL, only fixup consolerc if encryption is detected
|
||||
if ! console -h 2>&1 | grep "encryption not compiled" > /dev/null; then
|
||||
# generate .consolerc if it does not exist or is empty
|
||||
if [ ! -s $HOME/.consolerc ]; then
|
||||
cat > $HOME/.consolerc << EOF
|
||||
config * {
|
||||
port 782;
|
||||
sslenabled yes;
|
||||
sslauthority $HOME/.xcat/ca.pem;
|
||||
sslcredentials $HOME/.xcat/client-cred.pem;
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
if [ ! -f $HOME/.consolerc ]; then
|
||||
echo 'config * {' > $HOME/.consolerc
|
||||
echo " port 782;" >> $HOME/.consolerc
|
||||
echo " sslenabled yes;" >> $HOME/.consolerc
|
||||
echo " sslauthority $HOME/.xcat/ca.pem;" >> $HOME/.consolerc
|
||||
echo " sslcredentials $HOME/.xcat/client-cred.pem;" >> $HOME/.consolerc
|
||||
echo '}' >> $HOME/.consolerc
|
||||
fi
|
||||
else
|
||||
# ssl is not enabled, comment out the ssl settings in .consolerc
|
||||
if [ -f $HOME/.consolerc ]; then
|
||||
@@ -118,11 +115,7 @@ else
|
||||
length=`expr $index2 - $index1`
|
||||
length=`expr $length - 1`
|
||||
cons_ip=`expr substr "$result" $pos $length`
|
||||
if [ "$os" == "AIX" ]; then
|
||||
ifconfig |grep "$cons_ip"
|
||||
else
|
||||
ip addr |grep "$cons_ip"
|
||||
fi
|
||||
ifconfig |grep "$cons_ip"
|
||||
if [ $? -eq 0 ]; then
|
||||
CONSERVER=""
|
||||
fi
|
||||
|
||||
+167
-55
@@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
# Used as a convience command combined of [nodech]-nodeset-rsetboot-rpower-[rcons/wcons]
|
||||
# Used as a convience command combined of [nodech]-nodeset-rpower-[rcons/wcons]
|
||||
# to make ease of node OS provision
|
||||
|
||||
# This is the client front-end to rinstall/winstall commands
|
||||
# To use this, sym link your cmd name to this script.
|
||||
|
||||
use strict;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@@ -19,69 +20,180 @@ use lib "$::XCATROOT/lib/perl";
|
||||
use File::Basename;
|
||||
use Getopt::Long;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::Utils;
|
||||
use xCAT::Client;
|
||||
use Cwd;
|
||||
use strict;
|
||||
use xCAT::Table;
|
||||
use xCAT::NodeRange;
|
||||
|
||||
# build a request to go the rinstall plugin
|
||||
my $bname = basename($0);
|
||||
my $cmdref;
|
||||
$cmdref->{command}->[0] = $bname;
|
||||
$cmdref->{cwd}->[0] = cwd();
|
||||
# allows our plugins to get the stdin of the cmd that invoked the plugin
|
||||
my $data;
|
||||
if ( (($^O =~ /^linux/i) && ($ENV{'SHELL'} =~ /\/ksh$/)) || !defined($ENV{'TERM'}) )
|
||||
{
|
||||
my $rin="";
|
||||
my $rout;
|
||||
vec($rin,fileno(STDIN),1)=1;
|
||||
my $nfound=select($rout=$rin,"","",1);
|
||||
if ($nfound)
|
||||
{
|
||||
while ( <STDIN> ) { $data.=$_; }
|
||||
$cmdref->{stdin}->[0]=$data;
|
||||
}
|
||||
|
||||
sub usage {
|
||||
print basename($0)." usage:\n";
|
||||
print " ".basename($0)." [-o|--osver] [-p|--profile] [-a|--arch] [-O|--osimage] [-c|--console] <noderange>\n"
|
||||
}
|
||||
else
|
||||
{
|
||||
if (-p STDIN) {
|
||||
while ( <STDIN> ) { $data.=$_; }
|
||||
$cmdref->{stdin}->[0]=$data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $OSVER;
|
||||
my $PROFILE;
|
||||
my $ARCH;
|
||||
my $CONSOLE;
|
||||
my $OSIMAGE;
|
||||
|
||||
Getopt::Long::Configure("bundling");
|
||||
unless (GetOptions(
|
||||
'o|osver=s' => \$OSVER,
|
||||
'p|profile=s' => \$PROFILE,
|
||||
'a|arch=s' => \$ARCH,
|
||||
'O|osimage=s' => \$OSIMAGE,
|
||||
'c|console' => \$CONSOLE
|
||||
)) {
|
||||
usage;
|
||||
exit 1;
|
||||
}
|
||||
my $arg;
|
||||
my @tmpargv = @ARGV;
|
||||
# first
|
||||
$arg=shift(@ARGV);
|
||||
# first 1st non-hyphen arg is the noderange
|
||||
while ($arg =~ /^-/) {
|
||||
push (@{$cmdref->{arg}}, $arg);
|
||||
$arg=shift(@ARGV);
|
||||
my $arraysize=@ARGV;
|
||||
if ($arraysize > 1) {
|
||||
print "noderange invalid\n";
|
||||
usage;
|
||||
exit 1;
|
||||
}
|
||||
if ($arraysize == 0) {
|
||||
print "noderange not supplied\n";
|
||||
usage;
|
||||
exit 1;
|
||||
}
|
||||
$cmdref->{noderange}->[0]=$arg;
|
||||
push (@{$cmdref->{arg}}, @ARGV);
|
||||
|
||||
my $noderange=$cmdref->{noderange}->[0]; # save the noderange
|
||||
my $noderange=@ARGV[0];
|
||||
my $rc=0;
|
||||
my %pnhash;
|
||||
my @allnodes;
|
||||
#use Data::Dumper;
|
||||
|
||||
# ok call Client to run the plugin rinstall.pm
|
||||
xCAT::Client::submit_request($cmdref,\&xCAT::Client::handle_response);
|
||||
# check and complain about the invalid combination of the options,
|
||||
# called when -O is specified or nodetype.provmethod=<osimage>,
|
||||
# ignore -o,-p and -a options and prompt a warning message
|
||||
sub checkoption{
|
||||
my $optstring=shift;
|
||||
if($OSVER) {print 'warning: "'.$optstring.'" specified, "[-o|--osver] '.$OSVER."\" ignored\n"};
|
||||
if($PROFILE) {print 'warning: "'.$optstring.'" specified, "[-p|--profile] '.$PROFILE."\" ignored\n"};
|
||||
if($ARCH) {print 'warning: "'.$optstring.'" specified, "[-a|--arch] '.$OSVER."\" ignored\n"};
|
||||
}
|
||||
|
||||
if ($xCAT::Client::EXITCODE == 0) # no errors
|
||||
|
||||
@allnodes=noderange($noderange);
|
||||
if($OSIMAGE){
|
||||
|
||||
# -O|--osimage is specified, ignore any -a,-p,-o options,
|
||||
# call "nodeset ... osimage= ..." to set the boot state of the noderange to the specified osimage,
|
||||
# "nodeset" will handle the updating of node attributes such as os,arch,profile,provmethod
|
||||
|
||||
&checkoption("[-O|--osimage] $OSIMAGE");
|
||||
$rc=system("nodeset $noderange osimage=$OSIMAGE");
|
||||
if ($rc) {
|
||||
xCAT::MsgUtils->message("E","nodeset failure");
|
||||
exit 1;
|
||||
};
|
||||
}else
|
||||
{
|
||||
my $startconsole=$cmdref->{startconsole}->[0];
|
||||
# if startconsole requested ( -c flag) for rinstall always for winstall
|
||||
# This is set in the rinstall plugin
|
||||
if ($startconsole == 1) {
|
||||
if (basename($0) =~ /rinstall/) {
|
||||
|
||||
# no osimage specified, update the node attributes specified by -a,-p,-o options thru "nodech",
|
||||
# then set the boot state of each node based on the nodetype.provmethod:
|
||||
# 1) if nodetype.provmethod = <osimage>, ignore any -p,-o,-a option, then call "nodeset ... osimage"
|
||||
# 2) if nodetype.provmethod = [install/netboot/statelite], update the node attributes specified by -a,-p,-o options thru "nodech", call "nodeset ... [install/netboot/statelite]"
|
||||
# 3) if nodetype.provmethod is not set, use 'install' as the default value
|
||||
|
||||
# group the nodes according to the nodetype.provmethod
|
||||
|
||||
foreach(@allnodes){
|
||||
my $tab=xCAT::Table->new("nodetype");
|
||||
my $nthash=$tab->getNodeAttribs($_,['provmethod']);
|
||||
$tab->close();
|
||||
if(defined($nthash) and defined($nthash->{'provmethod'}))
|
||||
{
|
||||
push(@{$pnhash{$nthash->{'provmethod'}}},$_);
|
||||
}
|
||||
else
|
||||
{
|
||||
#if nodetype.provmethod is not specified,
|
||||
push(@{$pnhash{'install'}},$_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach my $key (keys %pnhash)
|
||||
{
|
||||
my $rclocal=0;
|
||||
my $nodes=join(',',@{$pnhash{$key}});
|
||||
if($key =~ /^(install|netboot|statelite)$/)
|
||||
{
|
||||
|
||||
# nodetype.provmethod = [install|netboot|statelite]
|
||||
my $nodechline = "";
|
||||
if ($OSVER) {
|
||||
$nodechline = "nodetype.os=$OSVER";
|
||||
}
|
||||
if ($PROFILE) {
|
||||
$nodechline .= " nodetype.profile=$PROFILE";
|
||||
}
|
||||
if ($ARCH) {
|
||||
$nodechline .= " nodetype.arch=$ARCH";
|
||||
}
|
||||
if ($nodechline) {
|
||||
$rclocal=system("nodech $nodes $nodechline");
|
||||
if ($rclocal) {
|
||||
print "nodech failure\n";
|
||||
$rc=$rclocal;
|
||||
}
|
||||
}
|
||||
|
||||
unless($rc){
|
||||
$rclocal=system("nodeset $nodes $key");
|
||||
if ($rclocal) {
|
||||
print "nodeset $nodes failure\n";
|
||||
$rc=$rclocal;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# nodetype.provmethod = <osimage>
|
||||
&checkoption("nodetype.provmethod=$key");
|
||||
$rclocal=system("nodeset $nodes osimage");
|
||||
if ($rclocal) {
|
||||
print "nodeset $nodes failure\n";
|
||||
$rc=$rclocal;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($rc){
|
||||
xCAT::MsgUtils->message("E","nodeset failure");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# call "rsetboot" to set the boot order of the nodehm.mgt=ipmi nodes,for others, assume user has set the correct boot order before "rinstall"
|
||||
system("rsetboot $noderange net");
|
||||
|
||||
# call "rpower" to start the node provision process
|
||||
$rc=system("rpower $noderange boot");
|
||||
if ($rc) {
|
||||
xCAT::MsgUtils->message("E","rpower failure");
|
||||
exit 1;
|
||||
};
|
||||
|
||||
|
||||
if (basename($0) =~ /rinstall/) {
|
||||
|
||||
# for rinstall, the -c|--console option can provide the remote console for only 1 node
|
||||
if ($CONSOLE) {
|
||||
if(scalar @allnodes ne 1){
|
||||
xCAT::MsgUtils->message("E","rinstall [-c|--console] will only work if there is only one node in the noderange. See winstall(8) for consoles on multiple systems");
|
||||
exit 1;
|
||||
}
|
||||
exec("rcons $noderange");
|
||||
}
|
||||
elsif (basename($0) =~ /winstall/) {
|
||||
# winstall can commence a wcons command to the noderange for monitoring the provision cycle
|
||||
} elsif (basename($0) =~ /winstall/) {
|
||||
# winstall can commence a wcons command to the noderange for monitoring the provision cycle
|
||||
|
||||
exec("wcons $noderange");
|
||||
}
|
||||
}
|
||||
exec("wcons $noderange");
|
||||
}
|
||||
exit $xCAT::Client::EXITCODE;
|
||||
|
||||
@@ -23,10 +23,8 @@ B<chvm> I<noderange> I<--p775> B<-i id> [B<-m> I<memory_interleaving>] B<-r> I<p
|
||||
B<chvm> I<noderange> [B<lparname>={B<*>|B<name>}]
|
||||
|
||||
B<chvm> I<noderange> [B<vmcpus=min/req/max>] [B<vmmemory=min/req/max>]
|
||||
[B<vmothersetting=hugepage:N,bsr:N>]
|
||||
[B<add_physlots=drc_index1,drc_index2...>]
|
||||
[B<add_vmnics=vlan1[,vlan2..]]> [B<add_vmstorage=<N|viosnode:slotid>>] [B<--vios>]
|
||||
[B<del_physlots=drc_index1,drc_index2...>]
|
||||
[B<vmphyslots=drc_index1,drc_index2...>] [B<vmothersetting=hugepage:N,bsr:N>]
|
||||
[B<vmnics=vlan1[,vlan2..]]> [B<vmstorage=<N|viosnode:slotid>>] [B<--vios>]
|
||||
[B<del_vadapter=slotid>]
|
||||
|
||||
=head2 VMware/KVM specific:
|
||||
@@ -115,7 +113,7 @@ The administrator should use lsvm to get the profile content, and then edit the
|
||||
|
||||
For normal power machine:
|
||||
|
||||
chvm could be used to modify the resources assigned to partitions. The admin shall specify the attributes with options I<vmcpus>, I<vmmemory>, I<add_physlots>, I<vmothersetting>, I<add_vmnics> and/or I<add_vmstorage>. If nothing specified, nothing will be returned.
|
||||
chvm could be used to modify the resources assigned to partitions. The admin shall specify the attributes with options I<vmcpus>, I<vmmemory>, I<vmphyslots>, I<vmothersetting>, I<vmnics> and/or I<vmstorage>. If nothing specified, nothing will be returned.
|
||||
|
||||
=head2 VMware/KVM specific:
|
||||
|
||||
@@ -199,21 +197,17 @@ Name of I/O slots assignment profile. Shall work with option B<--p775>.
|
||||
|
||||
Set LPAR name for the specified lpars. If '*' specified, it means to get names from xCAT database and then set them for the specified lpars. If a string is specified, it only supports single node and the string will be set for the specified lpar. The user can use lsvm to check the lparnames for lpars.
|
||||
|
||||
=item B<vmcpus=value> B<vmmemory=value> B<add_physlots=value> B<vmothersetting=value>
|
||||
=item B<vmcpus=value> B<vmmemory=value> B<vmphyslots=value> B<vmothersetting=value>
|
||||
|
||||
To specify the parameters that will be modified.
|
||||
|
||||
=item B<add_vmnics=value> B<add_vmstorage=value> [B<--vios>]
|
||||
=item B<vmnics=value> B<vmstorage=value> [B<--vios>]
|
||||
|
||||
To create new virtual adapter for the specified node.
|
||||
|
||||
=item B<del_physlots=drc_index1,drc_index2...>
|
||||
=item B<del_vadapter=value>
|
||||
|
||||
To delete physical slots which are specified by the I<drc_index1,drc_index2...>.
|
||||
|
||||
=item B<del_vadapter=slotid>
|
||||
|
||||
To delete a virtual adapter specified by the I<slotid>.
|
||||
To specify the slot id of the virtual adapter will be deleted.
|
||||
|
||||
=back
|
||||
|
||||
@@ -510,7 +504,7 @@ The output is similar to:
|
||||
|
||||
To modify the resource assignment:
|
||||
|
||||
chvm lpar1 vmcpus=1/2/16 vmmemory=1G/8G/32G add_physlots=0x21010202
|
||||
chvm lpar1 vmcpus=1/2/16 vmmemory=1G/8G/32G vmphyslots=0x21010202
|
||||
|
||||
The output is similar to:
|
||||
|
||||
@@ -532,7 +526,7 @@ The resource information after modification is similar to:
|
||||
lpar1: 1/2/2
|
||||
lpar1: 128.
|
||||
|
||||
Note: The physical I/O resources specified with I<add_physlots> will be appended to the specified partition. The physical I/O resources which are not specified but belonged to the partition will not be removed. For more information about I<add_physlots>, please refer to L<lsvm(1)|lsvm.1>.
|
||||
Note: The physical I/O resources specified with I<vmphyslots> will be appended to the specified partition. The physical I/O resources which are not specified but belonged to the partition will not be removed. For more information about I<vmphyslots>, please refer to L<lsvm(1)|lsvm.1>.
|
||||
|
||||
=head2 VMware/KVM specific:
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ The B<configfpc> command discovers the FPCs and collects the MAC address. The MA
|
||||
This process is repeated until no more FPCs are discovered.
|
||||
|
||||
For more information on xCAT support of NeXtScale and configfpc see:
|
||||
XCAT_NeXtScale_Clusters
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_NeXtScale_Clusters
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ The xcatd daemon will be stopped during migration on the MN. No xCAT commands s
|
||||
|
||||
The db2sqlsetup script must be run on each Service Node, after the DB2 Client code has been installed, to setup the DB2 Client (-C). There are two postscripts that are provided ( db2install and odbcsetup) that will automatically setup you Service Node as a DB2 client.
|
||||
|
||||
For full information on the setup of DB2, see Setting_Up_DB2_as_the_xCAT_DB.
|
||||
For full information on the setup of DB2, see http://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_DB2_as_the_xCAT_DB.
|
||||
|
||||
When running of db2sqlsetup on the MN:
|
||||
One password must be supplied for the setup, a password for the xcatdb unix id which will be used as the DB2 instance id and database name. The password will be prompted for interactively or can be input with the XCATDB2PW environment variable.
|
||||
|
||||
@@ -38,7 +38,7 @@ B<osupdatename> - comma separated 'osdistroupdate' object. Each 'osdistroupdate'
|
||||
Linux distro update. When run geninitrd, 'kernel-*.rpm' will be searched from osdistroupdate.dirpath
|
||||
to get all the rpm packages and then search the drivers from the rpm packages.
|
||||
|
||||
Refer to the doc: Using_Linux_Driver_Update_Disk
|
||||
Refer to the doc: https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Using_Linux_Driver_Update_Disk
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -26,14 +26,10 @@ The getmacs command collects MAC address from a single or range of nodes.
|
||||
Note that on AIX systems, the returned MAC address is not colon-seperated (for example 8ee2245cf004), while on Linux systems the MAC address is colon-seperated (for example 8e:e2:24:5c:f0:04).
|
||||
If no ping test performed, getmacs writes the first adapter MAC to the xCAT database. If ping test performed, getmacs will write the first successfully pinged MAC to xCAT database.
|
||||
|
||||
For PPC (using Direct FSP Management) specific:
|
||||
For PPC (without HMC, using Direct FSP Management) specific:
|
||||
|
||||
Note: If network adapters are physically assigned to LPARs, getmacs cannot read the MAC addresses unless perform ping test, since there is no HMC command to read them and getmacs has to login to open formware. And if the LPARs has never been activated before, getmacs need to be performed with the option "B<-D>" to get theirs MAC addresses.
|
||||
|
||||
For PPC (using HMC) specific:
|
||||
|
||||
Note: The option "B<-D>" B<must> be used to get MAC addresses of LPARs.
|
||||
|
||||
For IBM Flex Compute Node (Compute Node for short) specific:
|
||||
|
||||
Note: If "B<-d>" is specified, all the MAC of the blades will be displayed. If no option specified, the first MAC address of the blade will be written to mac table.
|
||||
|
||||
@@ -41,8 +41,8 @@ The Memory Interleaving Mode has 3 valid options:
|
||||
1 - interleaved
|
||||
2 - non-interleaved
|
||||
|
||||
More information about this part, refer to the section Using the *vm commands to define partitions in xCAT DFM in the doc below.
|
||||
XCAT_Power_775_Hardware_Management
|
||||
More information about this part, refer to the section Using the *vm commands to define partitions in xCAT DFM in the link below.
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Power_775_Hardware_Management
|
||||
|
||||
=head2 For KVM and Vmware
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
=head1 NAME
|
||||
|
||||
B<mysqlsetup> - Sets up the MySQL or MariaDB database for xCAT to use.
|
||||
B<mysqlsetup> - Sets up the MySQL database for xCAT to use.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@@ -19,10 +19,9 @@ B<mysqlsetup> {B<-L>|B<--LL>} [-V|--verbose]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<mysqlsetup> - Sets up the MySQL or MariaDB database (linux only for MariaDB) for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code or MariaDB code has been installed. Before running the init option, the MySQL server should be stopped, if it is running. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL or MariaDB and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in
|
||||
Setting_Up_MySQL_as_the_xCAT_DB
|
||||
B<mysqlsetup> - Sets up the MySQL database for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code has been installed. Before running the init option, the MySQL server should be stopped. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_MySQL_as_the_xCAT_DB
|
||||
Two passwords must be supplied for the setup, a password for the xcatadmin id and a password for the root id in the MySQL database. These will be prompted for interactively, unless the environment variables XCATMYSQLADMIN_PW and XCATMYSQLROOT_PW are set to the passwords for the xcatadmin id and root id in the database,resp.
|
||||
Note below we refer to MySQL but it works the same for MariaDB.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
@@ -42,8 +41,8 @@ Displays verbose messages.
|
||||
|
||||
=item B<-i|--init>
|
||||
|
||||
The init option is used to setup a xCAT database on an installed MySQL or MariaDB server for xCAT to use. The mysqlsetup script will check for the installed MariaDB server rpm first and will use MariaDB if it is installed. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database.
|
||||
On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL or MariaDB rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init.
|
||||
The init option is used to setup an installed MySQL database so that xCAT can use the database. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database.
|
||||
On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init.
|
||||
|
||||
=item B<-u|--update>
|
||||
|
||||
@@ -57,13 +56,13 @@ This option runs during update, it will take all the host from the input file (p
|
||||
|
||||
This option sets up the ODBC /etc/../odbcinst.ini, /etc/../odbc.ini and the .odbc.ini file in roots home directory will be created and initialized to run off the xcatdb MySQL database.
|
||||
See "Add ODBC Support" in
|
||||
Setting_Up_MySQL_as_the_xCAT_DB
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_MySQL_as_the_xCAT_DB
|
||||
|
||||
=item B<-L|--LL>
|
||||
|
||||
Additional database configuration specifically for the LoadLeveler product.
|
||||
See "Add ODBC Support" in
|
||||
Setting_Up_MySQL_as_the_xCAT_DB
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_MySQL_as_the_xCAT_DB
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -120,7 +120,8 @@ To import nodes using a profile, follow the following steps:
|
||||
# hostinfo begin
|
||||
# This entry defines a blade.
|
||||
__hostname__:
|
||||
switches=eth0!switch1!1,eth0!switch2!1!eth1
|
||||
switch=myswitch
|
||||
switchport=9
|
||||
|
||||
Example of a node information file that specifies a CEC-based rack-mounted Power node that uses direct FSP management:
|
||||
# Node information file begins
|
||||
@@ -140,9 +141,13 @@ B<mac=<mac-address>> This is a mandatory item.
|
||||
|
||||
Description: Specify the MAC address for the NIC used by the provisionging node, where <mac-address> is the NICs MAC address.
|
||||
|
||||
B<switches=<nic-name!switch-name!switch-port>> This is a mandatory item, when define switch, switchport and node nic name relationship.
|
||||
B<switch=<switch-name>> This is a mandatory item, when define a switch auto discovery node.
|
||||
|
||||
Description: Specify nic name, switch name and switch port to define node and switch relationship. We can define multi nic-switch-port relations here, looks like: switches=eth0!switch1!1,eth1!switch1,2
|
||||
Description: Specify switch name that the provisionging node is connected, where <switch-name> is the switch name.
|
||||
|
||||
B<switchport=<switch-port>> This is a mandatory item, when define a switch auto discovery node.
|
||||
|
||||
Description: Specify switch port that the provisionging node is connected, where <switch-port> is the connected port.
|
||||
|
||||
B<slotid=<slot-id>> This is a mandatory item while define a PureFlex node.
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ The init option is used to setup an installed PostgreSQL database so that xCAT c
|
||||
On AIX, it additionally setup the xcatadm unix id and the postgres id and group. For AIX, you should be using the PostgreSQL rpms available from the xCAT website. For Linux, you should use the PostgreSQL rpms shipped with the OS. You can chose the -o option, to run after the init.
|
||||
To add additional nodes to access the PostgreSQL server, setup on the Management Node, edit the pg_hba.conf file.
|
||||
|
||||
For more documentation see:Setting_Up_PostgreSQL_as_the_xCAT_DB
|
||||
For more documentation see:https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Setting_Up_PostgreSQL_as_the_xCAT_DB
|
||||
|
||||
=item B<-N|--nostart>
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ If it outputs B<"Timeout waiting for prompt"> during the upgrade, please set the
|
||||
|
||||
In currently Direct FSP/BPA Management, our B<rflash> doesn't support B<concurrent> value of B<--activate> flag, and supports B<disruptive> and B<deferred>. The B<disruptive> option will cause any affected systems that are powered on to be powered down before installing and activating the update. So we require that the systems should be powered off before do the firmware update.
|
||||
|
||||
The B<deferred> option will load the new firmware into the T (temp) side, but will not activate it like the disruptive firmware. The customer will continue to run the Frames and CECs working with the P (perm) side and can wait for a maintenance window where they can activate and boot the Frame/CECs with new firmware levels. Refer to the doc to get more details:
|
||||
XCAT_Power_775_Hardware_Management
|
||||
The B<deferred> option will load the new firmware into the T (temp) side, but will not activate it like the disruptive firmware. The customer will continue to run the Frames and CECs working with the P (perm) side and can wait for a maintenance window where they can activate and boot the Frame/CECs with new firmware levels. Refer to the link to get more details:
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Power_775_Hardware_Management#Perform_Deferred_Firmware_upgrades_for_frame.2FCEC_on_Power_775
|
||||
|
||||
In Direct FSP/BPA Management, there is -d <data_directory> option. The default value is /tmp. When do firmware update, rflash will put some related data from rpm packages in <data_directory> directory, so the execution of rflash will require available disk space in <data_directory> for the command to properly execute:
|
||||
|
||||
@@ -71,12 +71,12 @@ For one GFW rpm package and one power code rpm package , if the GFW rpm package
|
||||
For Power 775, the rflash command takes effect on the primary and secondary FSPs or BPAs almost in parallel.
|
||||
|
||||
For more details about the Firmware Update using Direct FSP/BPA Management, refer to:
|
||||
XCAT_Power_775_Hardware_Management#Updating_the_BPA_and_FSP_firmware_using_xCAT_DFM
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Power_775_Hardware_Management#Updating_the_BPA_and_FSP_firmware_using_xCAT_DFM
|
||||
|
||||
=head2 NeXtScale FPC specific:
|
||||
|
||||
The command will update firmware for NeXtScale FPC when given an FPC node and the http information needed to access the firmware. The http imformation required includes both the MN IP address as well as the directory containing the firmware. It is recommended that the firmware be downloaded and placed in the /install directory structure as the xCAT MN /install directory is configured with the correct permissions for http. Refer to the doc to get more details:
|
||||
XCAT_NeXtScale_Clusters
|
||||
The command will update firmware for NeXtScale FPC when given an FPC node and the http information needed to access the firmware. The http imformation required includes both the MN IP address as well as the directory containing the firmware. It is recommended that the firmware be downloaded and placed in the /install directory structure as the xCAT MN /install directory is configured with the correct permissions for http. Refer to the link to get more details:
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_NeXtScale_Clusters#Update_the_FPC_firmware_.28optional.29
|
||||
|
||||
|
||||
=head1 B<Options>
|
||||
|
||||
@@ -8,8 +8,6 @@ B<rnetboot> [B<-V>|B<--verbose>] [B<-s> I<boot_device_order>] [B<-F>] [B<-f>] I<
|
||||
|
||||
B<rnetboot> [B<-h>|B<--help>] [B<-v>|B<--version>]
|
||||
|
||||
=head2 zVM specific:
|
||||
|
||||
B<rnetboot> noderange [B<ipl=> I<address>]
|
||||
|
||||
|
||||
|
||||
@@ -16,19 +16,17 @@ B<rpower> I<noderange> [B<on>|B<off>|B<softoff>|B<reset>|B<boot>|B<stat>|B<state
|
||||
|
||||
B<rpower> I<noderange> [B<--nodeps>] {B<of>}
|
||||
|
||||
=head2 CEC (with HMC) specific:
|
||||
=head2 PPC (with HMC) specific:
|
||||
|
||||
B<rpower> I<noderange> [B<on>|B<off>|B<reset>|B<boot>|B<onstandby>]
|
||||
B<rpower> I<noderange> [B<onstandby>]
|
||||
|
||||
=head2 LPAR (with HMC) specific:
|
||||
|
||||
B<rpower> I<noderange> [B<on>|B<off>|B<stat>|B<state>|B<reset>|B<boot>|B<of>|B<sms>|B<softoff>]
|
||||
B<rpower> I<noderange> [B<softoff>]
|
||||
|
||||
=head2 CEC (using Direct FSP Management) specific:
|
||||
|
||||
B<rpower> I<noderange> [B<onstandby>|B<stat>|B<state>] [B<-T tooltype>]
|
||||
|
||||
B<rpower> I<noderange> [B<on>|B<off>|B<resetsp>]
|
||||
B<rpower> I<noderange> [B<on>|B<off>|B<lowpower>|B<resetsp>]
|
||||
|
||||
=head2 Frame (using Direct FSP Management) specific:
|
||||
|
||||
@@ -70,6 +68,10 @@ Turn power on to standby state
|
||||
|
||||
The value could be B<lpar> or B<fnm>. The tooltype value B<lpar> is for xCAT and B<fnm> is for CNM. The default value is "B<lpar>". For cold start in the large cluster, it will save a lot of time if the admins use "B<rpower> I<noderange> B<onstandby> B<-T> B<fnm>" to power on all the CECs from the management node through the B<fnm> connections.
|
||||
|
||||
=item B<lowpower>
|
||||
|
||||
Turn CEC to low power state (state EOCT). This is a disruptive operation which requires the CEC to be powered off prior to entering low power mode. And we can use power off command to get out of lowepower state.
|
||||
|
||||
=item B<rackstandby>
|
||||
|
||||
Places the rack in the rack standby state. It requires that all CECs and DE be powered off before it will run.
|
||||
@@ -121,28 +123,6 @@ Wake up the target nodes which is in B<suspend> state.
|
||||
|
||||
Don't try to run B<wake> against the 'on' state node, it would cause the node gets to 'off' state.
|
||||
|
||||
For some of xCAT hardware such as NeXtScale, it may need to enable S3 before using B<wake>. The following steps can be used to enable S3. Please reference L<pasu(1)|pasu.1> for "pasu" usage.
|
||||
|
||||
[root@xcatmn home]# echo "set Power.S3Enable Enable" > power-setting
|
||||
[root@xcatmn home]# pasu -b power-setting node01
|
||||
node01: Batch mode start.
|
||||
node01: [set Power.S3Enable Enable]
|
||||
node01: Power.S3Enable=Enable
|
||||
node01:
|
||||
node01: Beginning intermediate batch update.
|
||||
node01: Waiting for command completion status.
|
||||
node01: Command completed successfully.
|
||||
node01: Completed intermediate batch update.
|
||||
node01: Batch mode completed successfully.
|
||||
|
||||
[root@xcatmn home]# pasu node01 show all|grep -i s3
|
||||
node01: IMM.Community_HostIPAddress3.1=
|
||||
node01: IMM.Community_HostIPAddress3.2=
|
||||
node01: IMM.Community_HostIPAddress3.3=
|
||||
node01: IMM.DNS_IP_Address3=0.0.0.0
|
||||
node01: IMM.IPv6DNS_IP_Address3=::
|
||||
node01: Power.S3Enable=Enable
|
||||
|
||||
=item B<stat>|B<state>
|
||||
|
||||
Print the current power state/status.
|
||||
|
||||
@@ -89,7 +89,7 @@ Files may be distributed and synchronized for both diskless and
|
||||
diskfull nodes. Syncing files to NFS-based statelite nodes is not supported.
|
||||
|
||||
More information on using the synchronization file function is in
|
||||
Using_Updatenode.
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Using_Updatenode.
|
||||
|
||||
=head3 Create the synclist file
|
||||
|
||||
@@ -100,7 +100,7 @@ and the destination location for the files on the target node.
|
||||
|
||||
For more information on creating your synclist files and where to put them, read:
|
||||
|
||||
Sync-ing_Config_Files_to_Nodes
|
||||
http://sourceforge.net/apps/mediawiki/xcat/index.php?title=Sync-ing_Config_Files_to_Nodes
|
||||
|
||||
|
||||
=head3 Run updatenode to synchronize the files
|
||||
@@ -111,7 +111,7 @@ Sync-ing_Config_Files_to_Nodes
|
||||
=head2 To install or update software
|
||||
|
||||
updatenode can be use to install or update software on the nodes. See the following documentation for setting up otherpkgs:
|
||||
Install_Additional_Packages
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Install_Additional_Packages
|
||||
|
||||
To install/update the packages, run:
|
||||
|
||||
@@ -136,14 +136,11 @@ B<For AIX systems:>
|
||||
Note: The updatenode command is used to update AIX diskfull nodes only. For updating diskless AIX nodes refer to the xCAT for AIX update documentation and use the xCAT mknimimage command.
|
||||
For information on updating software on AIX cluster:
|
||||
For diskful installs, read:
|
||||
XCAT_AIX_RTE_Diskfull_Nodes
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_AIX_RTE_Diskfull_Nodes
|
||||
For diskless installs, read:
|
||||
XCAT_AIX_Diskless_Nodes
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_AIX_Diskless_Nodes
|
||||
|
||||
updatenode can also be used in Sysclone environment to push delta changes to target node. After capturing the delta changes from the golden client to management node, just run below command to push delta changes to target nodes.
|
||||
|
||||
updatenode <targetnoderange> -S
|
||||
|
||||
=head2 To run postscripts
|
||||
|
||||
The scripts must be copied to the /install/postscripts
|
||||
@@ -365,7 +362,7 @@ be run during install. You should use updatenode <noderange> -F instead.
|
||||
|
||||
=item B<-S|--sw>
|
||||
|
||||
Specifies that node software should be updated. In Sysclone environment, specifies pushing the delta changes to target nodes.
|
||||
Specifies that node software should be updated.
|
||||
|
||||
=item B<-s|--sn>
|
||||
|
||||
@@ -570,12 +567,6 @@ See Granting_Users_xCAT_privileges for required sudo setup.
|
||||
|
||||
B<updatenode node1 -l user1 -P syslog>
|
||||
|
||||
=item 22
|
||||
|
||||
In Sysclone environment, after capturing the delta changes from golden client to management node, to run updatenode to push these delta changes to target nodes.
|
||||
|
||||
B<updatenode target-node -S>
|
||||
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ For example, your rsynclist file may look like this:
|
||||
|
||||
Note: no order can be assumed by the order that the EXECUTE,EXECUTEALWAYS and APPEND clause fall in the synclist file.
|
||||
|
||||
For more information on syncing files to node, read Sync-ing_Config_Files_to_Nodes
|
||||
For more information on syncing files to node, read https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Sync-ing_Config_Files_to_Nodes
|
||||
|
||||
On Linux rsync always uses ssh remoteshell. On AIX, ssh or rsh is used depending on the site.useSSHonAIX attribute.
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ B<makeconservercf> - creates the conserver configuration file from info in the x
|
||||
|
||||
B<makeconservercf> [B<-V|--verbose>] [B<-d|--delete>] I<noderange>
|
||||
|
||||
B<makeconservercf> [B<-V|--verbose>] [B<-l|--local>] [I<noderange>]
|
||||
B<makeconservercf> [B<-V|--verbose>] [B<-l|--local>]
|
||||
|
||||
B<makeconservercf> [B<-V|--verbose>] [B<-c|--conserver>] [I<noderange>]
|
||||
B<makeconservercf> [B<-V|--verbose>] [B<-c|--conserver>] I<noderange>
|
||||
|
||||
B<makeconservercf> [B<-V|--verbose>] I<noderange> [B<-t|--trust>] I<hosts>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ Only entries in /etc/hosts or the hosts specified by B<noderange> that have a co
|
||||
By default, B<makedns> sets up the B<named> service and updates the DNS records on the local system (management node). If the -e flag is specified, it will also update the DNS records on any external DNS server that is listed in the /etc/resolv.conf on the management node. (Assuming the external DNS server can recognize the xCAT key as authentication.)
|
||||
|
||||
For more information on Cluster Name Resolution:
|
||||
Cluster_Name_Resolution
|
||||
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Cluster_Name_Resolution
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
@@ -49,8 +49,6 @@ Remove the DNS records.
|
||||
|
||||
Update DNS records to the external DNS server listed in /etc/resolv.conf.
|
||||
|
||||
Enabling the site attribute I<externaldns> means use 'external' DNS by default. If setting I<externaldns> to 1, you need NOT use B<-e> flag in every makedns call.
|
||||
|
||||
=item B<noderange>
|
||||
|
||||
A set of comma delimited node names and/or group names. See the "noderange" man page for details on additional supported formats.
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
=head1 NAME
|
||||
|
||||
B<rescanplugins> - Notifies xcatd to rescan the plugin directory
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<rescanplugins>
|
||||
|
||||
B<rescanplugins> {B<-h>|B<--help>}
|
||||
|
||||
B<rescanplugins> {B<-v>|B<--version>}
|
||||
|
||||
B<rescanplugins> [B<-s>|B<--servicenodes>]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<rescanplugins> notifies the xcatd daemon to rescan the plugin directory and update its internal command handlers hash. This command should be used when plugins have been added or removed from the xCAT plugin directory (/opt/xcat/lib/perl/xCAT_plugin) or if the contents of the handled_commands subroutine in an existing plugin has changed.
|
||||
|
||||
If rescanplugins is called as a subrequest from another command, the xcatd command handlers hash changes will not be available to that command's process. Only subsequent command calls will see the updates.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 6
|
||||
|
||||
=item B<-h|--help>
|
||||
|
||||
Displays the usage message.
|
||||
|
||||
=item B<-v|--version>
|
||||
|
||||
Displays the release version of the code.
|
||||
|
||||
=item B<-s|--servicenodes>
|
||||
|
||||
Process the rescanplugins on the management node and on all service nodes. The rescanplugins command will be sent to the xcatd daemon on all nodes defined in the servicenode table. The default is to only run on the management node.
|
||||
|
||||
=back
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 2
|
||||
|
||||
=item *
|
||||
|
||||
To rescan the plugins only on the xCAT Management Node:
|
||||
|
||||
B<rescanplugins>
|
||||
|
||||
=item *
|
||||
|
||||
To rescan the plugins on the xCAT Management Node and on all service nodes:
|
||||
|
||||
B<rescanplugins -s>
|
||||
|
||||
=back
|
||||
@@ -4,42 +4,32 @@ B<rinstall> - Begin OS provision on a noderange
|
||||
|
||||
=head1 B<Synopsis>
|
||||
|
||||
B<rinstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<-c>|I<--console>] [I<noderange>]
|
||||
|
||||
B<rinstall> [I<-O>|I<--osimage>] [I<-c>|I<--console>] [I<noderange>]
|
||||
B<rinstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<-O>|I<--osimage>] [I<-c>|I<--console>] [I<noderange>]
|
||||
|
||||
=head1 B<Description>
|
||||
|
||||
B<rinstall> is a convenience command that will change tables as requested for operating system version, profile, and architecture, call B<nodeset> to modify the network boot configuration, call B<rsetboot> net to set the next boot over network (only support nodes with "nodetype.mgt=ipmi", for other nodes, make sure the correct boot order has been set before B<rinstall>), and B<rpower> to begin a boot cycle.
|
||||
B<rinstall> is a convience command that will change tables as requested for operating system version, profile, and architecture, call B<nodeset> to modify the network boot configuration, call B<rsetboot> net to set the next boot over network (only support nodes with "nodetype.mgt=ipmi", for other nodes, make sure the correct boot order has been set before B<rinstall>), and B<rpower> to begin a boot cycle.
|
||||
|
||||
If [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage> is set, provision the noderange with the osimage specified/configured, ignore the table change options if specified.
|
||||
|
||||
If -c is specified, it will then run rcons on the node. This is allowed only if one node in the noderange. If need consoles on multiple nodes , see L<winstall(8)|winstall.8>.
|
||||
If -c is specified, it will then become the text console of the node. If wanting consoles on multiple nodes with a similar command, see L<winstall(8)|winstall.8>.
|
||||
|
||||
=head1 B<Options>
|
||||
|
||||
=over 7
|
||||
|
||||
=item B<-h>|B<--help>
|
||||
|
||||
Display usage message.
|
||||
|
||||
=item B<-v>|B<--version>
|
||||
|
||||
Display version.
|
||||
|
||||
=item B<-o>|B<--osver>
|
||||
|
||||
Specifies which os version to provision. If unspecified, the current node os setting is used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
Specifies which os version to provision. If unspecified, the current table values are used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
|
||||
=item B<-p>|B<--profile>
|
||||
|
||||
Specifies what profile should be used of the operating system. If not specified the current node profile setting is used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
Specifies what profile should be used of the operating system. If not specified the tables are used as is. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
|
||||
|
||||
=item B<-a>|B<--arch>
|
||||
|
||||
Specifies what architecture of the OS to provision. Typically this is unneeded, but if provisioning between x86_64 and x86 frequently, this may be a useful flag. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
Specifies what architecture of the OS to provision. Typically this is unneeded, but if provisioning betweer x86_64 and x86 frequently, this may be a useful flag. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
|
||||
=item B<-O>|B<--osimage>
|
||||
|
||||
@@ -47,7 +37,7 @@ Specifies the osimage to provision.
|
||||
|
||||
=item B<-c>|B<--console>
|
||||
|
||||
Requests that rinstall runs rcons once the provision starts. This will only work if there is only one node in the noderange. See L<winstall(8)|winstall.8> for starting nsoles on multiple nodes.
|
||||
Requests that rinstall become rcons once the provision commences. This will only work if there is only one node in the noderange. See L<winstall(8)|winstall.8> for consoles on multiple systems.
|
||||
|
||||
=back
|
||||
|
||||
@@ -56,17 +46,17 @@ Requests that rinstall runs rcons once the provision starts. This will only wor
|
||||
|
||||
B<rinstall> I<node1-node20>
|
||||
|
||||
Provison nodes 1 through 20, using their current configuration.
|
||||
Provison nodes 1 through 20, using configuration as is from tables.
|
||||
|
||||
B<rinstall> I<node1-node20> -o rhels5.1 -p compute
|
||||
B<rinstall> -o rhels5.1 -p compute I<node1-node20>
|
||||
|
||||
Provision nodes 1 through 20, forcing rhels5.1 and compute profile.
|
||||
|
||||
B<rinstall> I<node1-node20> -O rhels6.4-ppc64-netboot-compute
|
||||
B<rinstall> -O rhels6.4-ppc64-netboot-compute I<node1-node20>
|
||||
|
||||
Provision nodes 1 through 20 with the osimage rhels6.4-ppc64-netboot-compute.
|
||||
|
||||
B<rinstall> I<node1> -c
|
||||
B<rinstall> -c I<node1>
|
||||
|
||||
Provisoon node1 and start a console to monitor the process.
|
||||
|
||||
|
||||
@@ -1,64 +1,53 @@
|
||||
=head1 Name
|
||||
|
||||
B<winstall> - Begin OS provision on a noderange
|
||||
B<winstall> - Begin OS provision on a noderange and display in wcons
|
||||
|
||||
=head1 B<Synopsis>
|
||||
|
||||
B<winstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<noderange>]
|
||||
|
||||
B<winstall> [I<-O>|I<--osimage>] [I<noderange>]
|
||||
B<winstall> [I<-o>|I<--osver>] [I<-p>|I<--profile>] [I<-a>|I<--arch>] [I<-O>|I<--osimage>] [I<noderange>]
|
||||
|
||||
=head1 B<Description>
|
||||
|
||||
B<winstall> is a convenience tool that will change attributes as requested for operating system version, profile, and architecture, call B<nodeset> to modify the network boot configuration, call B<rsetboot> net to set the next boot over network (only support nodes
|
||||
with "nodetype.mgt=ipmi", for other nodes, make sure the correct boot order has been set before B<winstall>), and B<rpower> to begin a boot cycle.
|
||||
B<winstall> is a convience command that will change tables as requested for operating system version, profile, and architecture, call nodeset to modify the network boot configuration, and rpower to begin a boot cycle.
|
||||
|
||||
If [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage> is set, provision the noderange with the osimage specified/configured, ignore the table change options if specified.
|
||||
If [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage> is set, provision the noderange with the osimage specified/configured, ignore the table change options if specified
|
||||
|
||||
It will then run wcons on the nodes.
|
||||
It will then commence a wcons command to the noderange for monitoring.
|
||||
|
||||
=head1 B<Options>
|
||||
|
||||
=over 7
|
||||
|
||||
=item B<-h>|B<--help>
|
||||
|
||||
Display usage message.
|
||||
|
||||
=item B<-v>|B<--version>
|
||||
|
||||
Display version.
|
||||
|
||||
=item B<-o>|B<--osver>
|
||||
|
||||
Specifies which os version to provision. If unspecified, the current node os setting is used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
Specifies which os version to provision. If unspecified, the current table values are used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
|
||||
=item B<-p>|B<--profile>
|
||||
|
||||
Specifies what profile should be used of the operating system. If not specified the current node profile setting is used. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
Specifies what profile should be used of the operating system. If not specified the tables are used as is. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
|
||||
|
||||
=item B<-a>|B<--arch>
|
||||
|
||||
Specifies what architecture of the OS to provision. Typically this is unneeded, but if provisioning between x86_64 and x86 frequently, this may be a useful flag. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
Specifies what architecture of the OS to provision. Typically this is unneeded, but if provisioning betweer x86_64 and x86 frequently, this may be a useful flag. Will be ignored if [I<-O>|I<--osimage>] is specified or nodetype.provmethod=I<osimage>.
|
||||
|
||||
=item B<-O>|B<--osimage>
|
||||
|
||||
Specifies the osimage to provision.
|
||||
Specifies the osimage to provision.
|
||||
|
||||
=back
|
||||
|
||||
=head1 B<Examples>
|
||||
|
||||
B<winstall> I<node1-node20>
|
||||
B<rinstall> I<node1-node20>
|
||||
|
||||
Provison nodes 1 through 20, using their current configuration.
|
||||
Provison nodes 1 through 20, using configuration as is from tables.
|
||||
|
||||
B<winstall> I<node1-node20> -o rhels5.1 -p compute
|
||||
B<rinstall> -o rhels5.1 -p compute I<node1-node20>
|
||||
|
||||
Provision nodes 1 through 20, forcing rhels5.1 and compute profile.
|
||||
|
||||
B<winstall> I<node1-node20> -O rhels6.4-ppc64-netboot-compute
|
||||
B<rinstall> -O rhels6.4-ppc64-netboot-compute I<node1-node20>
|
||||
|
||||
Provision nodes 1 through 20 with the osimage rhels6.4-ppc64-netboot-compute.
|
||||
|
||||
|
||||
@@ -238,7 +238,6 @@ ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/nodechprofile
|
||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/noderegenips
|
||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/noderefresh
|
||||
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/nodechmac
|
||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/sbin/rescanplugins
|
||||
|
||||
|
||||
%clean
|
||||
|
||||
@@ -13,17 +13,6 @@ DIR=`readlink -f $DIR`
|
||||
DRACUTMODDIR=/usr/share/dracut/modules.d/97xcat
|
||||
mkdir -p $DRACUTMODDIR
|
||||
cp $DIR/* $DRACUTMODDIR
|
||||
# For ppc64 platform, needs to remove some files,
|
||||
# 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
|
||||
sed -i 's/\/usr\/lib\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.13/' $DRACUTMODDIR/install
|
||||
sed -i 's/\/lib\/libgcc_s.so.1/\/lib64\/libgcc_s.so.1/' $DRACUTMODDIR/install
|
||||
sed -i 's/\/lib\/libtinfo.so.5.7/\/lib64\/libtinfo.so.5.7/' $DRACUTMODDIR/install
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
@@ -253,6 +253,9 @@ dracut_install /usr/share/zoneinfo/posix/America/Knox_IN
|
||||
dracut_install /usr/share/zoneinfo/posix/America/Goose_Bay
|
||||
dracut_install /usr/share/zoneinfo/posix/EET
|
||||
dracut_install /usr/share/zoneinfo/posix/EST5EDT
|
||||
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh89
|
||||
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh88
|
||||
dracut_install /usr/share/zoneinfo/posix/Mideast/Riyadh87
|
||||
dracut_install /usr/share/zoneinfo/posix/MST
|
||||
dracut_install /usr/share/zoneinfo/posix/Iceland
|
||||
dracut_install /usr/share/zoneinfo/posix/Atlantic/Faeroe
|
||||
@@ -393,6 +396,7 @@ dracut_install /usr/share/zoneinfo/posix/NZ-CHAT
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Istanbul
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Kuwait
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Saigon
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh89
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Urumqi
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Brunei
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Ujung_Pandang
|
||||
@@ -434,6 +438,7 @@ dracut_install /usr/share/zoneinfo/posix/Asia/Tokyo
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Macao
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Rangoon
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh88
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Jakarta
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Aden
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Calcutta
|
||||
@@ -471,6 +476,7 @@ dracut_install /usr/share/zoneinfo/posix/Asia/Tel_Aviv
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Taipei
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Kabul
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Macau
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Riyadh87
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Choibalsan
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Vientiane
|
||||
dracut_install /usr/share/zoneinfo/posix/Asia/Dacca
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#!/bin/bash
|
||||
instmods nfs sunrpc
|
||||
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
|
||||
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas 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
|
||||
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
|
||||
instmods reiserfs #reiserfs on sysclone
|
||||
instmods ibmveth # ppc64 virtual ethernet
|
||||
instmods ibmvscsic # ppc64 virtual disk
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user