Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 08683a45d6 | |||
| 8f920c6a2c | |||
| 4a54d2e1b9 | |||
| d561030406 | |||
| c23e0328fb | |||
| 1f2a5273e3 | |||
| 6b1c3e2bdf | |||
| 04c70de8fc | |||
| e6332ef245 | |||
| bd64e444c0 | |||
| f85b944c67 | |||
| 4b99829fdd | |||
| 92f94fda22 | |||
| d1f6a91eaf | |||
| a8c057d95e | |||
| 7af1ca3a40 | |||
| aed5820b37 | |||
| 35d0df1356 | |||
| 195e08340b | |||
| 07b4f4ed90 | |||
| 2b826284bb | |||
| e80e2c3b1e | |||
| 8815ed2f4c | |||
| 17c25d67dc | |||
| 0ca28f99e3 | |||
| 7435749032 | |||
| 124d067192 | |||
| 4a63e79f3b | |||
| 889f51726f | |||
| 7a2553d95e | |||
| 09064309b9 | |||
| afba3f2258 | |||
| fc0b17272d | |||
| a4d6f819ef | |||
| d452ee22bd | |||
| 0d5e8aee1e | |||
| 4e1e20e4f2 | |||
| 6321e8ec95 | |||
| cccae5e81f | |||
| fc52689889 |
+1
-1
@@ -197,7 +197,7 @@ then
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-dep bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: amd64
|
||||
Architectures: i386 amd64
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
|
||||
|
||||
+167
-280
@@ -1,377 +1,264 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
# Update GSA Ubuntu Repositories or create a local repository
|
||||
#
|
||||
# Author: Leonardo Tonetto (tonetto@linux.vnet.ibm.com)
|
||||
# Revisor: Arif Ali (aali@ocf.co.uk)
|
||||
#
|
||||
# After running this script, add the following line to
|
||||
# /etc/apt/sources.list for local repository
|
||||
# deb file://<core_repo_path>/xcat-core/ maverick main
|
||||
# deb file://<dep_repo_path>/xcat-dep/ maverick main
|
||||
#
|
||||
# Getting Started:
|
||||
# - Check out the xcat-core svn repository (either the trunk or a branch) into
|
||||
# a dir called <rel>/src/xcat-core, where <rel> is the same as the release dir it will be
|
||||
# uploaded to in sourceforge (e.g. devel, or 2.3).
|
||||
# - You probably also want to put root's pub key from the build machine onto sourceforge for
|
||||
# the upload user listed below, so you don't have to keep entering pw's. You can do this
|
||||
# at https://sourceforge.net/account/ssh
|
||||
# - make sure reprepro is installed on the build machine
|
||||
# - Run this script from the local svn repository you just created. It will create the other directories that are needed.
|
||||
|
||||
# Usage: attr=value attr=value ... ./build-ubunturepo { -c | -d }
|
||||
# PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release. This does not
|
||||
# actually build xcat, just uploads the most recent snap build to https://sourceforge.net/projects/xcat/files/xcat/ .
|
||||
# If not specified, a snap build is assumed, which uploads to https://sourceforge.net/projects/xcat/files/yum/
|
||||
# or https://sourceforge.net/projects/xcat/files/aix/.
|
||||
# PREGA=1 - use this option with PROMOTE=1 on a branch that already has a released dot release, but this build is
|
||||
# a GA candidate build, not to be released yet. This will result in the tarball being uploaded to
|
||||
# https://sourceforge.net/projects/xcat/files/yum/ or https://sourceforge.net/projects/xcat/files/aix/
|
||||
# (but the tarball file name will be like a released tarball, not a snap build). When you are ready to
|
||||
# release this build, use PROMOTE=1 without PREGA
|
||||
# BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in prep for a release.
|
||||
# UP=0 or UP=1 - override the default upload behavior
|
||||
#
|
||||
# For the dependency packages 1. please run the build-debs-all in xcat-dep svn first( there is usage detail in that script)
|
||||
# 2. run ./build-ubunturepo -d
|
||||
#
|
||||
############################
|
||||
printusage()
|
||||
{
|
||||
printf "Usage: %s {-c | -d} \n" $(basename $0) >&2
|
||||
echo " -c : Build the xcat core packages and create the repo"
|
||||
echo " -d : Create the xcat dep repo. Building the xcat dep packages can refer \"build-debs-all\" from svn"
|
||||
}
|
||||
# For the purpose of getting the distribution name
|
||||
. /etc/lsb-release
|
||||
|
||||
# Supported distributions
|
||||
dists="maverick natty oneiric precise"
|
||||
dists="maverick natty oneiric precise "
|
||||
|
||||
a_flag= # automatic flag - only update if repo was updated
|
||||
c_flag= # xcat-core (trunk-delvel) path
|
||||
d_flag= # xcat-dep (trunk) path
|
||||
r_flag= #genesis base rpm package path
|
||||
u_flag= # gsa user-id
|
||||
p_flag= # gsa passwd
|
||||
local_flag= # build the repository localy
|
||||
|
||||
while getopts 'cdr:' OPTION
|
||||
while getopts 'c:d:u:p:l:a' OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
c) c_flag=1
|
||||
xcat_core_path="$OPTARG"
|
||||
;;
|
||||
d) d_flag=1
|
||||
xcat_dep_path="$OPTARG"
|
||||
;;
|
||||
r) r_flag=1
|
||||
genesis_rpm_path="$OPTARG"
|
||||
;;
|
||||
?) printusage
|
||||
u) u_flag=1
|
||||
gsa_id="$OPTARG"
|
||||
;;
|
||||
p) p_flag=1
|
||||
gsa_passwd="$OPTARG"
|
||||
;;
|
||||
l) local_flag=1
|
||||
local_repo_path="$OPTARG"
|
||||
;;
|
||||
a) a_flag=1
|
||||
;;
|
||||
|
||||
?) printf "Usage: %s -c <core_trunk_path> [-d <dep_trunk_path>] { -l <local-repo_path> | [-u <gsa_id> -p <gsa_passwd>] } [-a]\n" $(basename $0) >&2
|
||||
echo "-a Automatic: update only if there's any update on repo"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
if [ -z "$c_flag" -a -z "$d_flag" ];then
|
||||
printusage
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "$c_flag" -a "$d_flag" ];then
|
||||
printusage
|
||||
exit 2
|
||||
fi
|
||||
|
||||
uploader="bp-sawyers"
|
||||
# Find where this script is located to set some build variables
|
||||
old_pwd=`pwd`
|
||||
cd `dirname $0`
|
||||
curdir=`pwd`
|
||||
|
||||
#define the dep source code path, core build target path and dep build target path
|
||||
local_core_repo_path="$curdir/../../xcat-core"
|
||||
xcat_dep_path="$curdir/../../../xcat-dep/src/xcat-dep"
|
||||
local_dep_repo_path="$curdir/../../../xcat-dep/xcat-dep"
|
||||
|
||||
#define the url used for creating the source list file
|
||||
#define the upload dir used for uploading packages
|
||||
sf_repo_url="https://sourceforge.net/projects/xcat/files/ubuntu"
|
||||
sf_dir="/home/frs/project/x/xc/xcat"
|
||||
|
||||
#use flock to only one person build at the same time
|
||||
# Get a lock, so can not do 2 builds at once
|
||||
exec 8>/var/lock/xcatbld.lock
|
||||
if ! flock -n 8; then
|
||||
echo "Can't get lock /var/lock/xcatbld.lock. Someone else must be doing a build right now. Exiting...."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export HOME=/root
|
||||
|
||||
#sync the gpg key to the build machine local
|
||||
gsa_url=http://pokgsa.ibm.com/projects/x/xcat/build/linux
|
||||
mkdir -p $HOME/.gnupg
|
||||
for key_name in pubring.gpg secring.gpg trustdb.gpg; do
|
||||
if [ ! -f $HOME/.gnupg/$key_name ] || [ `wc -c $HOME/.gnupg/$key_name|cut -f 1 -d' '` == 0 ]; then
|
||||
rm -f $HOME/.gnupg/$key_name
|
||||
wget -P $HOME/.gnupg $gsa_url/keys/$key_name
|
||||
chmod 600 $HOME/.gnupg/$key_name
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$c_flag" ]
|
||||
if [ -z "$c_flag" -a -z "$d_flag" ]
|
||||
then
|
||||
# strip the /src/xcat-core from the end of the dir to get the next dir up and use as the release
|
||||
if [ -z "$REL" ]; then
|
||||
t=${curdir%/src/xcat-core}
|
||||
REL=`basename $t`
|
||||
printf "Usage: %s -c <core_trunk_path> [-d <dep_trunk_path>] { -l <local-repo_path> | [-u <gsa_id> -p <gsa_passwd>] } [-a]\n" $(basename $0) >&2
|
||||
echo "-a Automatic: update only if there's any update on repo"
|
||||
exit 2
|
||||
fi
|
||||
if [ ! -d $xcat_core_path ]
|
||||
then
|
||||
printf "%s: No such directory\n" "$xcat_core_path" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "$d_flag" ]
|
||||
then
|
||||
if [ ! -d $xcat_dep_path ]
|
||||
then
|
||||
printf "%s: No such directory\n" "$xcat_dep_path" >&2
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$local_flag" ]
|
||||
then
|
||||
repo_xcat_core_path=$local_repo_path"/xcat-core"
|
||||
repo_xcat_dep_path=$local_repo_path"/xcat-dep"
|
||||
else
|
||||
if [ -z "$u_flag" ]
|
||||
then
|
||||
if [ "$p_flag" ]
|
||||
then
|
||||
printf "Usage: %s -c <core_trunk_path> [-d <dep_trunk_path>] { -l <local-repo_path> | [-u <gsa_id> -p <gsa_passwd>] } [-a]\n" $(basename $0) >&2
|
||||
echo "-a Automatic: update only if there's any update on repo"
|
||||
exit 2
|
||||
fi
|
||||
echo -n "GSA id: "
|
||||
read gsa_id
|
||||
echo -n "GSA password: "
|
||||
stty -echo; read gsa_passwd; stty echo;
|
||||
echo ""; echo "";
|
||||
fi
|
||||
|
||||
ver=`cat Version`
|
||||
if [ "$PROMOTE" != 1 ]; then
|
||||
#get the version
|
||||
echo "svn --quiet update Version"
|
||||
svn --quiet up Version
|
||||
ver=`cat Version`
|
||||
short_ver=`cat Version|cut -d. -f 1,2`
|
||||
short_short_ver=`cat Version|cut -d. -f 1`
|
||||
repo_xcat_core_path="`pwd`/gsa-repo_temp/xcat-core"
|
||||
repo_xcat_dep_path="`pwd`/gsa-repo_temp/xcat-dep"
|
||||
fi
|
||||
|
||||
#TODO: define the core path and tarball name
|
||||
tarball_name="core-debs-snap.tar.bz2"
|
||||
|
||||
#update the code from svn
|
||||
svn_up_log="../coresvnup"
|
||||
echo "svn update > $svn_up_log"
|
||||
svn update > $svn_up_log
|
||||
|
||||
#makesure the code change status
|
||||
code_change=0
|
||||
if ! grep -q 'At revision' $svn_up_log;then
|
||||
code_change=1
|
||||
fi
|
||||
|
||||
if [ $code_change == 0 -a "$UP" != 1 -a "$BUILDALL" != 1 ]; then
|
||||
echo "Nothing new detected"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "###############################"
|
||||
echo "# Building xcat-core packages #"
|
||||
echo "###############################"
|
||||
|
||||
#the package type: local | snap | alpha
|
||||
#the build introduce stirng
|
||||
pkg_type="snap"
|
||||
build_string="Snap_Build"
|
||||
cur_date=`date +%Y%m%d`
|
||||
pkg_version="${short_ver}-${pkg_type}${cur_date}"
|
||||
|
||||
if [ ! -d ../../debs ];then
|
||||
mkdir -p "../../debs"
|
||||
fi
|
||||
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack"
|
||||
|
||||
for file in `echo $packages`
|
||||
do
|
||||
file_low=`echo $file | tr '[A-Z]' '[a-z]'`
|
||||
if grep -q $file $svn_up_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then
|
||||
rm -f ../../debs/${file_low}_*.deb
|
||||
#only for genesis package
|
||||
rm -f ../../debs/${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
|
||||
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}* ../../debs/
|
||||
fi
|
||||
done
|
||||
|
||||
find ../../debs/* ! -name *.deb | xargs rm -f
|
||||
fi
|
||||
|
||||
if [ "$PROMOTE" = 1 ]; then
|
||||
upload_dir="xcat-core"
|
||||
tar_name="xcat-core-$ver.tar.bz2"
|
||||
if [ "$a_flag" ]
|
||||
then
|
||||
touch svcupdate.trace
|
||||
SVCUP='svcupdate.trace'
|
||||
svn update $xcat_core_path 1> $SVCUP 2>&1
|
||||
if ! grep 'Tree is up to date' $SVCUP
|
||||
then
|
||||
update_core=1
|
||||
else
|
||||
upload_dir="core-snap"
|
||||
tar_name="core-debs-snap.tar.bz2"
|
||||
update_core=
|
||||
fi
|
||||
rm -f $SVCUP
|
||||
else
|
||||
update_core=1
|
||||
fi
|
||||
if [ "$c_flag" -a "$update_core" ]
|
||||
then
|
||||
echo "###############################"
|
||||
echo "# Building xcat-core packages #"
|
||||
echo "###############################"
|
||||
|
||||
CMD_PATH=`pwd`
|
||||
cd $xcat_core_path
|
||||
./build-debs-all "snap" "Nightly_Builds"
|
||||
|
||||
echo "#################################"
|
||||
echo "# Creating xcat-core repository #"
|
||||
echo "#################################"
|
||||
|
||||
#clean the repo directory
|
||||
if [ -e $local_core_repo_path ]; then
|
||||
rm -rf $local_core_repo_path
|
||||
if [ -d $repo_xcat_core_path ]; then
|
||||
rm -rf $repo_xcat_core_path
|
||||
fi
|
||||
mkdir -p $local_core_repo_path
|
||||
cd $local_core_repo_path
|
||||
mkdir conf
|
||||
mkdir -p $repo_xcat_core_path/conf
|
||||
|
||||
find . -iname '*.deb' -exec mv {} $repo_xcat_core_path \;
|
||||
|
||||
rm -rf debs/
|
||||
cd $CMD_PATH
|
||||
|
||||
rm -rf $repo_xcat_core_path/conf/distributions
|
||||
|
||||
for dist in $dists; do
|
||||
cat << __EOF__ >> conf/distributions
|
||||
cat << __EOF__ >> $repo_xcat_core_path/conf/distributions
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-core bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: amd64
|
||||
Architectures: amd64 i386
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
SignWith: yes
|
||||
|
||||
__EOF__
|
||||
done
|
||||
|
||||
cat << __EOF__ > conf/options
|
||||
cat << __EOF__ > $repo_xcat_core_path/conf/options
|
||||
verbose
|
||||
ask-passphrase
|
||||
basedir .
|
||||
__EOF__
|
||||
|
||||
#import the deb packages into the repo
|
||||
for dist in $dists; do
|
||||
for file in `ls ../debs/*.deb`; do
|
||||
reprepro -b ./ includedeb $dist $file;
|
||||
for file in `ls $repo_xcat_core_path/*.deb`; do
|
||||
reprepro -b $repo_xcat_core_path includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
|
||||
#create the mklocalrepo script
|
||||
cat << __EOF__ > mklocalrepo.sh
|
||||
mv $xcat_core_path/latest_version $repo_xcat_core_path/xcat-core_latest-build
|
||||
|
||||
cat << '__EOF__' > $repo_xcat_core_path/mklocalrepo.sh
|
||||
. /etc/lsb-release
|
||||
cd `dirname $0`
|
||||
echo deb file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-core.list
|
||||
__EOF__
|
||||
|
||||
chmod 775 mklocalrepo.sh
|
||||
chmod 775 $repo_xcat_core_path/mklocalrepo.sh
|
||||
rm -rf $repo_xcat_core_path/*.deb
|
||||
|
||||
#create the xcat-core.list file
|
||||
#echo "deb ${sf_repo_url}/${REL}/${upload_dir}/ precise main" > xcat-core.list
|
||||
if [ -z "$local_flag" ]
|
||||
then
|
||||
echo "###############################"
|
||||
echo "# Updating GSA xcat-core repo #"
|
||||
echo "###############################"
|
||||
lftp -e "mirror -R --delete-first $repo_xcat_core_path /projects/i/ipl-xcat/ubuntu/; exit;" -u $gsa_id,$gsa_passwd -p 22 sftp://ausgsa.ibm.com
|
||||
fi ### if [ -z "$local_flag" ]
|
||||
fi ### if [ "$a_flag" ]
|
||||
|
||||
cd ../
|
||||
if ! grep xcat /etc/group ; then
|
||||
groupadd xcat
|
||||
fi
|
||||
|
||||
chgrp -R root xcat-core
|
||||
chmod -R g+w xcat-core
|
||||
|
||||
#build the tar ball
|
||||
tar -hjcf $tar_name xcat-core
|
||||
chgrp root $tar_name
|
||||
chmod g+w $tar_name
|
||||
|
||||
if [ ! -e core-snap ]; then
|
||||
ln -s xcat-core core-snap
|
||||
fi
|
||||
|
||||
# Decide whether to upload or not
|
||||
if [ -n "$UP" ] && [ "$UP" == 0 ]; then
|
||||
echo "No need to upload"
|
||||
cd $old_pwd
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#upload the deb packages
|
||||
if [ "$REL" = "devel" -o "$PREGA" != 1 ]; then
|
||||
i=0
|
||||
echo "Uploading RPMs from $upload_dir to ${sf_dir}/ubuntu/${REL}/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $upload_dir ${uploader},xcat@web.sourceforge.net:${sf_dir}/ubuntu/${REL}/
|
||||
do : ; done
|
||||
fi
|
||||
|
||||
#upload the tar ball
|
||||
#for the GA build, upload to https://sourceforge.net/projects/xcat/files/xcat/<version>.x_Ubuntu/
|
||||
#for other scenario, upload to https://sourceforge.net/projects/xcat/files/ubuntu/<version>
|
||||
if [ "$PROMOTE" = 1 -a "$REL" != "devel" -a "$PREGA" != 1 ]; then
|
||||
i=0
|
||||
echo "Uploading $tar_name to ${sf_dir}/xcat/${REL}.x_Ubuntu/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -v $tar_name ${uploader},xcat@web.sourceforge.net:${sf_dir}/xcat/${REL}.x_Ubuntu/
|
||||
do : ; done
|
||||
else
|
||||
i=0
|
||||
echo "Uploading $tar_name to ${sf_dir}/ubuntu/${REL}/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -v $tar_name ${uploader},xcat@web.sourceforge.net:${sf_dir}/ubuntu/${REL}/
|
||||
do : ; done
|
||||
fi
|
||||
|
||||
cd $old_pwd
|
||||
fi
|
||||
|
||||
if [ "$d_flag" ]
|
||||
if [ "$a_flag" -a "$d_flag" ]
|
||||
then
|
||||
touch svcupdate.trace
|
||||
SVCUP='svcupdate.trace'
|
||||
svn update $xcat_dep_path 1> $SVCUP 2>&1
|
||||
if ! grep 'Tree is up to date' $SVCUP
|
||||
then
|
||||
update_dep=1
|
||||
else
|
||||
update_dep=
|
||||
fi
|
||||
rm -f $SVCUP
|
||||
else
|
||||
update_dep=1
|
||||
fi
|
||||
if [ "$d_flag" -a "$update_dep" ]
|
||||
then
|
||||
echo "##############################"
|
||||
echo "# Building xcat-dep packages #"
|
||||
echo "##############################"
|
||||
|
||||
CMD_PATH=`pwd`
|
||||
cd $xcat_dep_path
|
||||
./build-debs-all "snap" "Nightly_Builds"
|
||||
|
||||
echo "################################"
|
||||
echo "# Creating xcat-dep repository #"
|
||||
echo "################################"
|
||||
rm -rf $repo_xcat_dep_path
|
||||
mkdir -p $repo_xcat_dep_path/conf
|
||||
find $xcat_dep_path -iname '*.deb' -exec cp {} $repo_xcat_dep_path \;
|
||||
|
||||
#clean all old files
|
||||
if [ -e $local_dep_repo_path ];then
|
||||
rm -rf $local_dep_repo_path
|
||||
fi
|
||||
mkdir -p $local_dep_repo_path
|
||||
cd $local_dep_repo_path
|
||||
mkdir conf
|
||||
rm -rf $repo_xcat_core_path/conf/distributions
|
||||
|
||||
#create the conf/distributions file
|
||||
for dist in $dists; do
|
||||
cat << __EOF__ >> conf/distributions
|
||||
cat << __EOF__ >> $repo_xcat_dep_path/conf/distributions
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-dep bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: amd64
|
||||
Architectures: i386 amd64
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
SignWith: yes
|
||||
|
||||
__EOF__
|
||||
done
|
||||
done
|
||||
|
||||
cat << __EOF__ > conf/options
|
||||
cat << __EOF__ > $repo_xcat_dep_path/conf/options
|
||||
verbose
|
||||
ask-passphrase
|
||||
basedir .
|
||||
__EOF__
|
||||
|
||||
for dist in $dists; do
|
||||
for file in `ls ../debs/*.deb`; do
|
||||
reprepro -b ./ includedeb $dist $file;
|
||||
for file in `ls $repo_xcat_dep_path/*.deb`; do
|
||||
reprepro -b $repo_xcat_dep_path includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
|
||||
cat << '__EOF__' > mklocalrepo.sh
|
||||
cat << '__EOF__' > $repo_xcat_dep_path/mklocalrepo.sh
|
||||
. /etc/lsb-release
|
||||
cd `dirname $0`
|
||||
echo deb file://"`pwd`" $DISTRIB_CODENAME main > /etc/apt/sources.list.d/xcat-dep.list
|
||||
__EOF__
|
||||
|
||||
chmod 775 mklocalrepo.sh
|
||||
chmod 775 $repo_xcat_dep_path/mklocalrepo.sh
|
||||
rm -rf $repo_xcat_dep_path/*.deb
|
||||
|
||||
#echo ""deb ${sf_repo_url}/xcat-dep/ precise main"" > xcat-dep.list
|
||||
if [ -z "$local_flag" ]
|
||||
then
|
||||
echo "##############################"
|
||||
echo "# Updating GSA xcat-dep repo #"
|
||||
echo "##############################"
|
||||
lftp -e "mirror -R --delete-first $repo_xcat_dep_path /projects/i/ipl-xcat/ubuntu/; exit;" -u $gsa_id,$gsa_passwd -p 22 sftp://ausgsa.ibm.com
|
||||
fi ### if [ -z "$local_flag" ]
|
||||
fi ### if [ "$d_flag" -a "$a_flag"]
|
||||
|
||||
cd ..
|
||||
if ! grep xcat /etc/group ; then
|
||||
groupadd xcat
|
||||
fi
|
||||
|
||||
chgrp -R root xcat-dep
|
||||
chmod -R g+w xcat-dep
|
||||
|
||||
#create the tar ball
|
||||
dep_tar_name=xcat-dep-ubuntu.tar.bz
|
||||
tar -hjcf $dep_tar_name xcat-dep
|
||||
chgrp root $dep_tar_name
|
||||
chmod g+w $dep_tar_name
|
||||
|
||||
if [ -n "$UP" ] && [ "$UP" == 0 ];then
|
||||
echo "No need to upload the dep packages"
|
||||
cd $old_pwd
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#upload the dep packages
|
||||
i=0
|
||||
echo "Uploading debs from xcat-dep to ${sf_dir}/ubuntu/xcat-dep/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete xcat-dep ${uploader},xcat@web.sourceforge.net:${sf_dir}/ubuntu/
|
||||
do : ; done
|
||||
#upload the tarball
|
||||
cd $old_pwd
|
||||
if [ -z "$local_flag" ] # delete the temp repo after upload is done
|
||||
then
|
||||
rm -rf ./gsa-repo_temp
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
+17
-28
@@ -41,7 +41,7 @@ UPLOADUSER=bp-sawyers
|
||||
FRS=/home/frs/project/x/xc/xcat
|
||||
|
||||
# These are the rpms that should be built for each kind of xcat build
|
||||
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack"
|
||||
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts"
|
||||
ZVMBUILD="perl-xCAT xCAT-server xCAT-UI"
|
||||
ZVMLINK="xCAT-client xCAT xCATsn"
|
||||
PCMBUILD="xCAT"
|
||||
@@ -137,10 +137,8 @@ SRCD=core-snap-srpms
|
||||
# currently aix builds ppc rpms, but someday it should build noarch
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
NOARCH=ppc
|
||||
SYSGRP=system
|
||||
else
|
||||
NOARCH=noarch
|
||||
SYSGRP=root
|
||||
fi
|
||||
|
||||
function setversionvars {
|
||||
@@ -185,11 +183,6 @@ if [ "$GIT" = "1" ]; then # using git
|
||||
GITUP=../coregitup
|
||||
echo "git pull > $GITUP"
|
||||
git pull > $GITUP
|
||||
if [[ $? != 0 ]]; then
|
||||
# do not continue so we do not build with old files
|
||||
echo "The 'git pull' command failed. Exiting the build."
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
if ! $GREP 'Already up-to-date' $GITUP; then
|
||||
SOMETHINGCHANGED=1
|
||||
@@ -272,19 +265,17 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
fi
|
||||
|
||||
# Build the xCAT and xCATsn rpms for all platforms
|
||||
for rpmname in xCAT xCATsn xCAT-OpenStack; do
|
||||
for rpmname in xCAT xCATsn; do
|
||||
#if [ "$EMBED" = "zvm" ]; then break; fi
|
||||
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $GITUP; then
|
||||
UPLOAD=1
|
||||
ORIGFAILEDRPMS="$FAILEDRPMS"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
if [ "$rpmname" = "xCAT-OpenStack" ]; then continue; fi # do not bld openstack on aix
|
||||
./makerpm $rpmname "$EMBED"
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
|
||||
else
|
||||
for arch in x86_64 ppc64 s390x; do
|
||||
if [ "$rpmname" = "xCAT-OpenStack" -a "$arch" != "x86_64" ]; then continue; fi # only bld openstack for x86_64 for now
|
||||
./makerpm $rpmname $arch "$EMBED"
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
|
||||
done
|
||||
@@ -355,9 +346,9 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
echo '%_gpg_name Jarrod Johnson' >> $MACROS
|
||||
fi
|
||||
echo "Signing RPMs..."
|
||||
build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
createrepo --checksum sha $DESTDIR # specifying checksum so the repo will work on rhel5
|
||||
build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
createrepo --checksum sha $DESTDIR # specifying checksum so the repo will work on rhel5
|
||||
createrepo --checksum sha $SRCDIR
|
||||
rm -f $SRCDIR/repodata/repomd.xml.asc
|
||||
rm -f $DESTDIR/repodata/repomd.xml.asc
|
||||
@@ -371,13 +362,20 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# set group and permissions correctly on the built rpms
|
||||
# make everything have a group of xcat, so anyone can manage them once they get on SF
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
if ! lsgroup xcat >/dev/null 2>&1; then
|
||||
mkgroup xcat
|
||||
fi
|
||||
chmod +x $DESTDIR/instxcat
|
||||
else # linux
|
||||
if ! $GREP xcat /etc/group; then
|
||||
groupadd xcat
|
||||
fi
|
||||
fi
|
||||
chgrp -R $SYSGRP $DESTDIR
|
||||
chgrp -R xcat $DESTDIR
|
||||
chmod -R g+w $DESTDIR
|
||||
chgrp -R $SYSGRP $SRCDIR
|
||||
chgrp -R xcat $SRCDIR
|
||||
chmod -R g+w $SRCDIR
|
||||
|
||||
else # end of very long if-not-promote
|
||||
@@ -430,17 +428,14 @@ else
|
||||
verboseflag=""
|
||||
fi
|
||||
echo "Creating $TARNAME ..."
|
||||
if [[ -e $TARNAME ]]; then
|
||||
mkdir -p previous
|
||||
mv -f $TARNAME previous
|
||||
fi
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
tar $verboseflag -hcf ${TARNAME%.gz} $XCATCORE
|
||||
rm -f $TARNAME
|
||||
gzip ${TARNAME%.gz}
|
||||
else
|
||||
tar $verboseflag -hjcf $TARNAME $XCATCORE
|
||||
fi
|
||||
chgrp $SYSGRP $TARNAME
|
||||
chgrp xcat $TARNAME
|
||||
chmod g+w $TARNAME
|
||||
|
||||
# Decide whether to upload or not
|
||||
@@ -498,11 +493,5 @@ if [ "$OSNAME" != "AIX" -a "$REL" = "devel" -a "$PROMOTE" != 1 -a -z "$EMBED" ];
|
||||
i=0
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync $verboseflag -r opt/xcat/share/doc/man1 opt/xcat/share/doc/man3 opt/xcat/share/doc/man5 opt/xcat/share/doc/man7 opt/xcat/share/doc/man8 $UPLOADUSER,xcat@web.sourceforge.net:htdocs/
|
||||
do : ; done
|
||||
|
||||
# extract and upload the tools readme
|
||||
rpm2cpio ../$XCATCORE/xCAT-server-*.$NOARCH.rpm | cpio -id ./opt/xcat/share/xcat/tools/README.html
|
||||
i=0
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync $verboseflag opt/xcat/share/xcat/tools/README.html $UPLOADUSER,xcat@web.sourceforge.net:htdocs/tools/
|
||||
do : ; done
|
||||
cd ..
|
||||
fi
|
||||
|
||||
+12
-14
@@ -97,15 +97,15 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
|
||||
# Sign the rpms that are not already signed. The "standard input reopened" warnings are normal.
|
||||
echo "Signing RPMs..."
|
||||
$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'` | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
|
||||
# Create the repodata dirs
|
||||
echo "Creating repodata directories..."
|
||||
for i in `find -mindepth 2 -maxdepth 2 -type d `; do
|
||||
if [ -n "$VERBOSEMODE" ]; then
|
||||
createrepo --checksum sha $i # specifying checksum so the repo will work on rhel5
|
||||
createrepo $i
|
||||
else
|
||||
createrepo --checksum sha $i >/dev/null
|
||||
createrepo $i >/dev/null
|
||||
fi
|
||||
rm -f $i/repodata/repomd.xml.asc
|
||||
gpg -a --detach-sign $i/repodata/repomd.xml
|
||||
@@ -149,13 +149,6 @@ cd $OSVER
|
||||
# The only interdependency between the dep rpms so far is that net-snmp requires bash, and
|
||||
# pyodbc requires unixODBC. (The bash dependency is taken care of automatically because it
|
||||
# comes earlier in the alphabet.)
|
||||
|
||||
# first run /usr/sbin/updtvpkg to make sure any installp software is
|
||||
# registered with RPM.
|
||||
echo "Running updtvpkg. This could take a few minutes."
|
||||
/usr/sbin/updtvpkg
|
||||
echo "updtvpkg has completed."
|
||||
|
||||
rpm -Uvh unixODBC*
|
||||
for i in `ls *.rpm|grep -v -E '^tcl-|^tk-|^expect-|^unixODBC-|^xCAT-UI-deps|^perl-DBD-DB2Lite'`; do
|
||||
if [ "$i" == "perl-Net-DNS-0.66-1.aix5.3.ppc.rpm" ]; then
|
||||
@@ -190,13 +183,18 @@ EOF
|
||||
chmod +x instoss
|
||||
fi
|
||||
|
||||
# Get the permissions and group correct
|
||||
# Get the permissions correct. Have to have all dirs/files with a group of xcat
|
||||
# and have them writeable by group, so any member of the xcat can build.
|
||||
if [ "$OSNAME" == "AIX" ]; then
|
||||
SYSGRP=system
|
||||
if ! lsgroup xcat >/dev/null 2>&1; then
|
||||
mkgroup xcat
|
||||
fi
|
||||
else
|
||||
SYSGRP=root
|
||||
if ! $GREP xcat /etc/group; then
|
||||
groupadd xcat
|
||||
fi
|
||||
fi
|
||||
chgrp -R $SYSGRP *
|
||||
chgrp -R xcat *
|
||||
chmod -R g+w *
|
||||
|
||||
# Build the tarball
|
||||
|
||||
@@ -24,7 +24,7 @@ function makenoarch {
|
||||
else # linux
|
||||
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..."
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
|
||||
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
|
||||
rm -f $RPMROOT/SRPMS/xCAT-server-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
|
||||
rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz
|
||||
RC=$?
|
||||
fi
|
||||
@@ -32,7 +32,7 @@ function makenoarch {
|
||||
|
||||
|
||||
|
||||
# Make one of the following rpms: xCAT, xCATsn, xCAT-buildkit, xCAT-OpenStack
|
||||
# Make one of the following rpms: xCAT, xCATsn, xCAT-buildkit
|
||||
function makexcat {
|
||||
if [ "$OSNAME" != "AIX" -a "$1" != "xCAT-buildkit" -a -z "$2" ]; then
|
||||
echo 'Usage: makerpm <RPMname> <arch> [<embedded-system>]'
|
||||
@@ -88,8 +88,6 @@ function makexcat {
|
||||
ARCH="noarch"
|
||||
TARGET=""
|
||||
tar --exclude .svn --exclude xCAT-buildkit.spec -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
|
||||
elif [ "$RPMNAME" = "xCAT-OpenStack" ]; then
|
||||
tar --exclude .svn --exclude xCAT-OpenStack.spec -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
|
||||
else # do not recognize rpm
|
||||
echo "Unrecognized rpm: $RPMNAME"
|
||||
exit 2
|
||||
@@ -203,7 +201,7 @@ else # linux
|
||||
fi
|
||||
|
||||
|
||||
if [ "$1" = "xCAT" -o "$1" = "xCATsn" -o "$1" = "xCAT-buildkit" -o "$1" = "xCAT-OpenStack" ]; then
|
||||
if [ "$1" = "xCAT" -o "$1" = "xCATsn" -o "$1" = "xCAT-buildkit" ]; then
|
||||
exportEmbed $3
|
||||
makexcat $1 $2
|
||||
elif [ "$1" = "xCAT-nbroot" -o "$1" = "xCAT-nbroot-core" ]; then
|
||||
|
||||
+51
-61
@@ -157,69 +157,61 @@ B<tabedit> or B<chtab> commands. They can be viewed using B<nodels> or B<tabdum
|
||||
|
||||
Alternatively, the xCAT database can be viewed and edited as logical objects, instead of flat tables.
|
||||
In this mode, xCAT takes care of which table each attribute should go in. To treat the database
|
||||
as logical object definitions, use the commands: B<lsdef>, B<mkdef>, B<chdef>, B<rmdef>. See Object Definitions
|
||||
as logical object definitions, use the commands: lsdef, mkdef, chdef, rmdef. See Object Definitions
|
||||
below.
|
||||
|
||||
xCAT allows the use of different database applications, depending on the needs of your cluster.
|
||||
The default database is SQLite, which is a daemonless, zero-config database. But you could instead
|
||||
choose to use something like postgresql for greater scalability and remote access in the
|
||||
hierarchical/service node case. To use a different database or a different location, create
|
||||
the file /etc/xcat/cfgloc. See the appropriate xCAT docuementation for the format of the file for the database you choose.
|
||||
The following example /etc/xcat/cfgloc file is for PostgreSQL:
|
||||
the file /etc/xcat/cfgloc.
|
||||
See the appropriate xCAT docuementation for the format of the file for the database you choose.
|
||||
The following example is for PostgreSQL:
|
||||
|
||||
Pg:dbname=xcat;host=<mgmtnode>|<pgadminuserid>|<pgadminpasswd>
|
||||
|
||||
=over 4
|
||||
|
||||
=item Pg:dbname=xcat;host=<mgmtnode>|<pgadminuserid>|<pgadminpasswd>
|
||||
|
||||
where mgmtnode is the hostname of the management node adapter on the cluster side, and the pgadminuserid and pgadminpasswd are the database admin and password.
|
||||
|
||||
=head2 GROUPS AND REGULAR EXPRESSIONS IN TABLES
|
||||
=back
|
||||
|
||||
The xCAT database has a number of tables, some with rows that are keyed by node name
|
||||
(such as noderes and nodehm) and others that are not keyed by node name (for example, the policy table).
|
||||
The tables that are keyed by node name have some extra features that enable a more
|
||||
The xCAT database spans a number of tables, some with records associated with particular nodes
|
||||
(such as nodelist and nodehm) and others that do not have a direct relationship with any given node.
|
||||
The tables not associated with a given node are straightforward, the data is stored and retrieved
|
||||
as-is from the database without interpretation, and without any generic inheritance
|
||||
(though some calling code may implement inheritance for specific fields, for example
|
||||
nodehm.power inheriting from nodehm.mgt).
|
||||
|
||||
The tables with records typically retrieved by node name have some extra features to enable a more
|
||||
template-based style to be used:
|
||||
|
||||
Any group name can be used in lieu of a node name in the node field, and that row will then
|
||||
provide "default" attribute values for any node in that group. A row with a specific node name
|
||||
can then override one or more attribute values for that specific node. For example, if the nodehm table contains:
|
||||
Any group name can be used in lieu of a node name in the node field, and that record will then
|
||||
be taken to be applicable to any node in that group. If a field is requested for a specific node,
|
||||
and either a record doesn't exist specifically for that nodename or a record exists, but has no
|
||||
definition for the requested field, that node's groups are then used to search for
|
||||
records. If multiple records could apply from two different groups, the precedence is
|
||||
the order the groups are specified in the nodelist table for that node. This is nearly identical to
|
||||
most xCAT 1.x tab file conventions. This is useful in tables such as noderes, where typical
|
||||
configurations have exactly the same field values for large sets of nodes.
|
||||
|
||||
#node,power,mgt,cons,termserver,termport,conserver,serialport,serialspeed,serialflow,getmac,cmdmapping,comments,disable
|
||||
"mygroup",,"ipmi",,,,,,"19200",,,,,
|
||||
"node1",,,,,,,,"115200",,,,,
|
||||
xCAT 2 extends the above to be made useful where a field will vary for every node with a given tag,
|
||||
but in ways that would be trivial to describe. If a field is of the format /I<pattern>/I<replacement>/,
|
||||
it is taken to be a perl regular expression, to be performed on the nodename. For example, the bmc field
|
||||
of the ipmi table might be B</\z/-bmc/> for a record with node=ipmi to specify that the BMC hostname is derived
|
||||
by appending B<-bmc> to the end of the nodename of every node in the ipmi group.
|
||||
|
||||
In the above example, the node group called mygroup sets mgt=ipmi and serialspeed=19200. Any nodes that are in this group
|
||||
will have those attribute values, unless overridden. For example, if node2 is a member of mygroup, it will automatically
|
||||
inherit these attribute values (even though it is not explicitly listed in this table). In the case of node1 above, it
|
||||
inherits mgt=ipmi, but overrides the serialspeed to be 115200, instead of 19200. A useful, typical way to use this
|
||||
capability is to create a node group for your nodes and for all the attribute values that are the same for every node,
|
||||
set them at the group level. Then you only have to set attributes for each node that vary from node to node.
|
||||
As an extension to the above, a regular expression extended with arithmetic operators is available,
|
||||
by using the format |I<pattern>|I<replacement>|. This behaves similarly to the above, but () enclosed parts
|
||||
in I<replacement> are taken to signify arithmetic operations and substituted in. All operations are integer
|
||||
arithmetic, so 5/4 would come out as 1. The typical perl positional variables are available in such expressions.
|
||||
|
||||
xCAT extends the group capability so that it can also be used for attribute values that vary from node to node
|
||||
in a very regular pattern. For example, if in the ipmi table you want the bmc attribute to be set to whatever the nodename is with
|
||||
"-bmc" appended to the end of it, then use this in the ipmi table:
|
||||
For example, if you have many blades in your cluster and their hostnames have a regular
|
||||
pattern of blade1, blade2, etc., and your BladeCenter management modules also have a hostname
|
||||
pattern of amm1, amm2, etc., then your B<mp> table could be expressed by the following single row:
|
||||
|
||||
#node,bmc,bmcport,taggedvlan,bmcid,username,password,comments,disable
|
||||
"compute","/\z/-bmc/",,,,,,,
|
||||
|
||||
In this example, "compute" is a node group that contains all of the compute nodes. The 2nd attribute (bmc) is a regular
|
||||
expression that is similar to a substitution pattern. The 1st part "\z" matches the end of the node name and substitutes "-bmc", effectively appending it to the node name.
|
||||
|
||||
Another example is if node1 is to have IP address 10.0.0.1, node2 is to have IP address 10.0.0.2, etc.,
|
||||
then this could be represented in the hosts table with the single row:
|
||||
|
||||
#node,ip,hostnames,otherinterfaces,comments,disable
|
||||
"compute","|node(\d+)|10.0.0.($1+0)|",,,,
|
||||
|
||||
In this example, the regular expression in the ip attribute uses "|" to separate the 1st and 2nd part. This means that
|
||||
xCAT will allow arithmetic operations in the 2nd part. In the 1st part, "(\d+)", will match the number part of the node
|
||||
name and put that in a variable called $1. The 2nd part
|
||||
is what value to give the ip attribute. In this case it will set it to the string "10.0.0." and the number that is
|
||||
in $1. (Zero is added to $1 just to remove any leading zeroes.)
|
||||
|
||||
A more involved example is with the mp table. If your blades have node names node01, node02, etc., and your chassis
|
||||
node names are cmm01, cmm02, etc., then you might have an mp table like:
|
||||
|
||||
#node,mpa,id,nodetype,comments,disable
|
||||
"blade","|\D+(\d+)|cmm(sprintf('%02d',($1-1)/14+1))|","|\D+(\d+)|(($1-1)%14+1)|",,
|
||||
"blade","|\D+(\d+)|amm(($1-1)/14+1)|","|\D+(\d+)|(($1-1)%14+1)|",,
|
||||
|
||||
Before you panic, let me explain each column:
|
||||
|
||||
@@ -229,34 +221,32 @@ Before you panic, let me explain each column:
|
||||
|
||||
This is a group name. In this example, we are assuming that all of your blades belong to this
|
||||
group. Each time the xCAT software accesses the B<mp> table to get the management module and slot number
|
||||
of a specific blade (e.g. B<node20>), this row will match (because B<node20> is in the B<blade> group).
|
||||
Once this row is matched for B<node20>, then the processing described in the following items will take
|
||||
of a specific blade (e.g. B<blade20>), this row will match (because B<blade20> is in the B<blade> group).
|
||||
Once this row is matched for B<blade20>, then the processing described in the following items will take
|
||||
place.
|
||||
|
||||
=item B<|\D+(\d+)|cmm(sprintf('%02d',($1-1)/14+1))|>
|
||||
=item B<|\D+(\d+)|amm(($1-1)/14+1)|>
|
||||
|
||||
This is a perl substitution pattern that will produce the value for the second column of the table (the
|
||||
management module hostname). The text B<\D+(\d+)> between the 1st two vertical bars is
|
||||
management module hostname).
|
||||
The text B<\D+(\d+)> between the 1st two vertical bars is
|
||||
a regular expression that matches the node
|
||||
name that was searched for in this table (in this example B<node20>). The text that matches
|
||||
name that was searched for in this table (in this example B<blade20>). The text that matches
|
||||
within the 1st set of parentheses is set to $1. (If there was a 2nd set of parentheses, it would
|
||||
be set to $2, and so on.) In our case, the \D+ matches the non-numeric part of the name
|
||||
(B<node>) and the B<\d+> matches the numeric part (B<20>). So $1 is set to B<20>. The text B<cmm(sprintf('%02d',($1-1)/14+1))> between the
|
||||
2nd and 3rd vertical bars produces the string that should be used as the value for the mpa attribute for node20.
|
||||
Since $1 is set to 20, the expression B<($1-1)/14+1> equals
|
||||
19/14 + 1, which equals 2. (The division is integer division,
|
||||
so 19/14 equals 1. Fourteen is used as the divisor, because there are 14 blades in each chassis.) The value of 2 is then passed into sprintf() with a format string to add a leading
|
||||
zero, if necessary, to always make the number two digits. Lastly the string B<cmm> is added to the beginning,
|
||||
making the resulting string B<cmm02>, which will be used as the hostname
|
||||
(B<blade>) and the \d+ matches the numeric part (B<20>). So $1 is set to B<20>. The text B<amm(($1-1)/14+1)> between the
|
||||
2nd and 3rd vertical bars produces the string that should be used as the value
|
||||
for this column in a hypothetical row for blade20. Since $1 is set to 20, the expression B<($1-1)/14+1> equals
|
||||
19/14 + 1, which equals 2. Therefore the whole string is B<amm2>, which will be used as the hostname
|
||||
of the management module.
|
||||
|
||||
=item B<|\D+(\d+)|(($1-1)%14+1)|>
|
||||
|
||||
This item is similar to the one above. This substituion pattern will produce the value for
|
||||
the 3rd column (the chassis slot number for this blade). Because this row was
|
||||
the match for B<node20>, the parentheses
|
||||
the 3rd column (the BladeCenter chassis slot number for this blade). Because this row was
|
||||
the match for B<blade20>, the parentheses
|
||||
within the 1st set of vertical bars will set $1 to 20. Since % means modulo division, the
|
||||
expression B<($1-1)%14+1> will evaluate to B<6>.
|
||||
expression B<($1-1)%14+1> will evaluate to 6.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Source: perl-xcat
|
||||
Section: libs
|
||||
Priority: extra
|
||||
Maintainer: xCAT <xcat-user@lists.sourceforge.net>
|
||||
Maintainer: Arif Ali <aali@ocf.co.uk>
|
||||
Build-Depends: debhelper (>= 5), libsoap-lite-perl, libdbi-perl
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ export DH_COMPAT=5
|
||||
|
||||
build:
|
||||
dh_testdir
|
||||
./modifyUtils `cat ../Version` `svn info | grep Revision | cut -d" " -f 2`
|
||||
./db2man
|
||||
|
||||
clean:
|
||||
@@ -48,7 +49,6 @@ 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` `svn info | grep Revision | cut -d" " -f 2`
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
|
||||
+18
-13
@@ -191,12 +191,7 @@ sub updateUserInfo {
|
||||
{
|
||||
for my $record (@diff)
|
||||
{
|
||||
# skip to add ROOT relative records into MERGE file
|
||||
if ($record =~ /^root/)
|
||||
{
|
||||
next;
|
||||
}
|
||||
print $fp "$record\n";
|
||||
print $fp "$record\n";
|
||||
}
|
||||
}
|
||||
close ($fp);
|
||||
@@ -235,13 +230,24 @@ sub setCFMSynclistFile {
|
||||
# get the cfmdir and synclists attributes
|
||||
my $osimage_t = xCAT::Table->new('osimage');
|
||||
my $records = $osimage_t->getAttribs({imagename=>$img}, 'cfmdir', 'synclists');
|
||||
if (defined ($records->{'cfmdir'}))
|
||||
if ($records)
|
||||
{
|
||||
$cfmdir = $records->{'cfmdir'};
|
||||
if (defined ($records->{'synclists'})) {$synclists = $records->{'synclists'}}
|
||||
if ($records->{'cfmdir'}) {$cfmdir = $records->{'cfmdir'}}
|
||||
if ($records->{'synclists'}) {$synclists = $records->{'synclists'}}
|
||||
} else {
|
||||
# no cfmdir defined, return directly
|
||||
return 0;
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "There are no records for cfmdir and synclists attribute in the osimage:$img. There is nothing to process.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
# no cfmdir defined, return directly
|
||||
if (!$cfmdir)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
my $found = 0;
|
||||
@@ -363,8 +369,7 @@ sub updateCFMSynclistFile {
|
||||
|
||||
# recursively list the files under cfm directory
|
||||
my @files = ();
|
||||
|
||||
find ( { wanted => sub { push @files, $File::Find::name if -f }, follow => 1 }, $cfmdir);
|
||||
find ( sub { push @files, $File::Find::name if (! -d) }, $cfmdir);
|
||||
if (!@files) # not files under cfm directory, skip to next loop
|
||||
{
|
||||
next;
|
||||
|
||||
@@ -179,28 +179,11 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
if ($ENV{XCATHOST}) {
|
||||
$xcathost=$ENV{XCATHOST};
|
||||
}
|
||||
my %connargs=();
|
||||
if ($xcathost =~ s/%([^\]|:]*)//) {
|
||||
$connargs{PeerScope} = $1;
|
||||
}
|
||||
$connargs{PeerAddr} = $xcathost;
|
||||
$connargs{Timeout} = 15;
|
||||
if ($connargs{PeerScope} and $connargs{PeerScope} =~ /[a-zA-Z]/) { #non-numeric, need to translate...
|
||||
my @ipdata = `ip link`;
|
||||
@ipdata = grep(/[^@]$connargs{PeerScope}(:|@)/,@ipdata);
|
||||
if (scalar(@ipdata) != 1) {
|
||||
print STDERR "Unable to identify scope ".$connargs{PeerScope}."\n";
|
||||
exit(1);
|
||||
}
|
||||
$connargs{PeerScope} = $ipdata[0];
|
||||
$connargs{PeerScope} =~ s/:.*//;
|
||||
}
|
||||
|
||||
|
||||
my $pclient;
|
||||
if ($inet6support) {
|
||||
$pclient = IO::Socket::INET6->new(
|
||||
%connargs,
|
||||
PeerAddr => $xcathost,
|
||||
Timeout => 15,
|
||||
);
|
||||
} else {
|
||||
$pclient = IO::Socket::INET->new(
|
||||
@@ -302,7 +285,6 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
$massresponse="";
|
||||
unless ($cleanexit) {
|
||||
print STDERR "ERROR/WARNING: communication with the xCAT server seems to have been ended prematurely\n";
|
||||
$xCAT::Client::EXITCODE = 1;
|
||||
}
|
||||
|
||||
sub validateXML {
|
||||
@@ -451,7 +433,7 @@ sub plugin_command {
|
||||
$usesiteglobal = 1;
|
||||
}
|
||||
foreach (@nodes) { #Specified a specific plugin, not a table lookup
|
||||
$handler_hash{$::XCATSITEVALS{$sitekey}}->{$_} = 1;
|
||||
$handler_hash{$sent->{value}}->{$_} = 1;
|
||||
}
|
||||
}
|
||||
} elsif ($hdlspec =~ /:/) { #Specificed a table lookup path for plugin name
|
||||
@@ -615,10 +597,7 @@ sub plugin_command {
|
||||
no strict "refs";
|
||||
# eval { #REMOVEEVALFORDEBUG
|
||||
# if ($dispatch_requests) {
|
||||
# backup the original req and recover it after the a run
|
||||
my $org_req = {%$req};
|
||||
dispatch_request($req,$callback,$modname);
|
||||
$req = {%$org_req};
|
||||
dispatch_request($req,$callback,$modname);
|
||||
# } else {
|
||||
# $SIG{CHLD}='DEFAULT';
|
||||
# ${"xCAT_plugin::".$modname."::"}{process_request}->($req,$callback,\&do_request);
|
||||
@@ -1019,7 +998,7 @@ sub handle_response {
|
||||
}
|
||||
#print "in handle_response\n";
|
||||
# Handle errors
|
||||
if (defined($rsp->{errorcode})) {
|
||||
if ($rsp->{errorcode}) {
|
||||
if (ref($rsp->{errorcode}) eq 'ARRAY') {
|
||||
foreach my $ecode (@{$rsp->{errorcode}}) {
|
||||
$xCAT::Client::EXITCODE |= $ecode;
|
||||
@@ -1033,38 +1012,22 @@ sub handle_response {
|
||||
#print "printing error\n";
|
||||
if (ref($rsp->{error}) eq 'ARRAY') {
|
||||
foreach my $text (@{$rsp->{error}}) {
|
||||
if ($rsp->{NoErrorPrefix}) {
|
||||
print STDERR "$text\n";
|
||||
} else {
|
||||
print STDERR "Error: $text\n";
|
||||
}
|
||||
print STDERR "Error: $text\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($rsp->{NoErrorPrefix}) {
|
||||
print STDERR ($rsp->{error}."\n");
|
||||
} else {
|
||||
print STDERR ("Error: ".$rsp->{error}."\n");
|
||||
}
|
||||
print ("Error: ".$rsp->{error}."\n");
|
||||
}
|
||||
}
|
||||
if ($rsp->{warning}) {
|
||||
#print "printing warning\n";
|
||||
if (ref($rsp->{warning}) eq 'ARRAY') {
|
||||
foreach my $text (@{$rsp->{warning}}) {
|
||||
if ($rsp->{NoWarnPrefix}) {
|
||||
print STDERR "$text\n";
|
||||
} else {
|
||||
print STDERR "Warning: $text\n";
|
||||
}
|
||||
print STDERR "Warning: $text\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($rsp->{NoWarnPrefix}) {
|
||||
print STDERR ($rsp->{warning}."\n");
|
||||
} else {
|
||||
print STDERR ("Warning: ".$rsp->{warning}."\n");
|
||||
}
|
||||
print ("Warning: ".$rsp->{warning}."\n");
|
||||
}
|
||||
}
|
||||
if ($rsp->{info}) {
|
||||
|
||||
+13
-11
@@ -8,7 +8,6 @@ use File::stat;
|
||||
use File::Copy;
|
||||
use xCAT::Usage;
|
||||
use Thread qw/yield/;
|
||||
use Storable qw/store_fd fd_retrieve/;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@@ -30,18 +29,19 @@ sub forward_data {
|
||||
my $rfh;
|
||||
my $rc = @ready_fds;
|
||||
foreach $rfh (@ready_fds) {
|
||||
my $responses;
|
||||
eval {
|
||||
$responses = fd_retrieve($rfh);
|
||||
};
|
||||
if ($@ and $@ =~ /^Magic number checking on storable file/) { #this most likely means we ran over the end of available input
|
||||
$fds->remove($rfh);
|
||||
close($rfh);
|
||||
} else {
|
||||
my $data;
|
||||
if ($data = <$rfh>) {
|
||||
while ($data !~ /ENDOFFREEZE6sK4ci/) {
|
||||
$data .= <$rfh>;
|
||||
}
|
||||
eval { print $rfh "ACK\n"; }; #Ignore ack loss due to child giving up and exiting, we don't actually explicitly care about the acks
|
||||
my $responses=thaw($data);
|
||||
foreach (@$responses) {
|
||||
$callback->($_);
|
||||
}
|
||||
} else {
|
||||
$fds->remove($rfh);
|
||||
close($rfh);
|
||||
}
|
||||
}
|
||||
yield(); #Try to avoid useless iterations as much as possible
|
||||
@@ -62,7 +62,8 @@ sub send_data {
|
||||
foreach(@_) {
|
||||
my %output;
|
||||
if (ref($_) eq HASH) {
|
||||
store_fd([$_],$out);
|
||||
print $out freeze([$_]);
|
||||
print $out "\nENDOFFREEZE6sK4ci\n";
|
||||
yield();
|
||||
waitforack($out);
|
||||
next;
|
||||
@@ -96,7 +97,8 @@ sub send_data {
|
||||
} else {
|
||||
$output{node}->[0]->{data}->[0]->{contents}->[0]=$text;
|
||||
}
|
||||
store_fd([\%output],$out);
|
||||
print $out freeze([\%output]);
|
||||
print $out "\nENDOFFREEZE6sK4ci\n";
|
||||
yield();
|
||||
waitforack($out);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ sub getObjectsOfType
|
||||
|
||||
# The database may be changed between getObjectsOfType calls
|
||||
# do not use cache %::saveObjList if --nocache is specified
|
||||
if ($::saveObjList{$type} && !$::opt_nc)
|
||||
if ($::saveObjList{$type} && !$::opt_c)
|
||||
{
|
||||
@objlist = @{$::saveObjList{$type}};
|
||||
}
|
||||
@@ -200,8 +200,7 @@ sub getobjattrs
|
||||
# list of object names
|
||||
foreach my $table (keys %tableattrs) {
|
||||
# open the table
|
||||
# with autocommit => 0, it does not work on Ubuntu running mysql
|
||||
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 1);
|
||||
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 0);
|
||||
if (!$thistable) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "Could not open the \'$table\' table.";
|
||||
@@ -607,7 +606,7 @@ sub getDBtable
|
||||
|
||||
# save this table info - in case this subr gets called multiple times
|
||||
# --nocache flag specifies not to use cahe
|
||||
if (grep(/^$table$/, @::foundTableList) && !$::opt_nc)
|
||||
if (grep(/^$table$/, @::foundTableList) && !$::opt_c)
|
||||
{
|
||||
|
||||
# already have this
|
||||
@@ -1680,14 +1679,7 @@ sub readFileInput
|
||||
|
||||
$look_for_colon = 0; # ok - we have a colon
|
||||
|
||||
# Remove any trailing whitespace
|
||||
$l =~ s/\s*$//;
|
||||
|
||||
# IPv6 network names could be something like fd59::/64
|
||||
# Use all the characters before the last ":" as the object name
|
||||
# .* means greedy regular expression
|
||||
$l =~ /^(.*):(.*?)$/;
|
||||
($objectname, $junk2) = ($1, $2);
|
||||
($objectname, $junk2) = split(/:/, $l);
|
||||
|
||||
# if $junk2 is defined or there's an =
|
||||
if ($junk2 || grep(/=/, $objectname))
|
||||
@@ -2158,7 +2150,7 @@ sub getchildren
|
||||
$::RUNCMD_RC = 1;
|
||||
return undef;
|
||||
}
|
||||
my @ps = $ppctab->getAllNodeAttribs(['node','parent','nodetype','hcp']);
|
||||
my @ps = $ppctab->getAllNodeAttribs(['node','parent','nodetype']);
|
||||
foreach my $entry ( @ps ) {
|
||||
my $p = $entry->{parent};
|
||||
my $c = $entry->{node};
|
||||
@@ -2169,19 +2161,13 @@ sub getchildren
|
||||
# build hash of ppc.parent -> ppc.node
|
||||
push @{$PPCHASH{$p}}, $c;
|
||||
}
|
||||
elsif ($t eq 'blade') {
|
||||
push @{$PPCHASH{$c}}, $entry->{hcp};
|
||||
}
|
||||
} else { # go look in the nodetype table to find nodetype
|
||||
my $type = getnodetype($c, "ppc");
|
||||
my $type = getnodetype($c);
|
||||
if ( $type eq 'fsp' or $type eq 'bpa')
|
||||
{
|
||||
# build hash of ppc.parent -> ppc.node
|
||||
push @{$PPCHASH{$p}}, $c;
|
||||
}
|
||||
elsif ($type eq "blade") {
|
||||
push @{$PPCHASH{$c}}, $entry->{hcp};
|
||||
}
|
||||
}
|
||||
} # not $p and $c
|
||||
}
|
||||
@@ -2606,170 +2592,4 @@ sub judge_node
|
||||
|
||||
return $flag;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 expandnicsattr
|
||||
Expand the nics related attributes into the readable format,
|
||||
for example, the nicsips=eth0!1.1.1.1|2.1.1.1,eth1!3.1.1.1|4.1.1.1
|
||||
expanded format:
|
||||
nicsips.eth0=1.1.1.1|2.1.1.1
|
||||
nicsips.eth1=3.1.1.1|4.1.1.1
|
||||
|
||||
Arguments:
|
||||
nicsattr value, like niccsips=eth0!1.1.1.1|2.1.1.1,eth1!3.1.1.1|4.1.1.1
|
||||
nicnames: only return the value for specific nics, like "eth0,eth1"
|
||||
Returns:
|
||||
expanded format, like:
|
||||
nicsips.eth0=1.1.1.1|2.1.1.1
|
||||
nicsips.eth1=3.1.1.1|4.1.1.1
|
||||
Error:
|
||||
none
|
||||
|
||||
Example:
|
||||
my $nicsstr = xCAT::DBobjUtils->expandnicsattr($attrval);
|
||||
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub expandnicsattr()
|
||||
{
|
||||
my $nicstr = shift;
|
||||
if (($nicstr) && ($nicstr =~ /xCAT::/))
|
||||
{
|
||||
$nicstr = shift;
|
||||
}
|
||||
my $nicnames = shift;
|
||||
|
||||
my $ret;
|
||||
|
||||
$nicstr =~ /^(.*?)=(.*?)$/;
|
||||
|
||||
#Attribute: nicips, nichostnamesuffix, etc.
|
||||
my $nicattr = $1;
|
||||
|
||||
# Value: eth0!1.1.1.1|2.1.1.1,eth1!3.1.1.1|4.1.1.1
|
||||
my $nicval=$2;
|
||||
|
||||
# $nicarr[0]: eth0!1.1.1.1|2.1.1.1
|
||||
# $nicarr[1]: eth1!3.1.1.1|4.1.1.1
|
||||
my @nicarr = split(/,/, $nicval);
|
||||
|
||||
foreach my $nicentry (@nicarr)
|
||||
{
|
||||
#nicentry: eth0!1.1.1.1|2.1.1.1
|
||||
# $nicv[0]: eth0
|
||||
# $nicv[1]: 1.1.1.1|2.1.1.1
|
||||
my @nicv = split(/!/, $nicentry);
|
||||
|
||||
# only return nic* attr for these specific nics
|
||||
if ($nicnames)
|
||||
{
|
||||
my @nics = split(/,/, $nicnames);
|
||||
if ($nicv[0])
|
||||
{
|
||||
# Do not need to return the nic attr for this nic
|
||||
if (!grep(/^$nicv[0]$/, @nics))
|
||||
{
|
||||
next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ignore the line that does not have nicname or value
|
||||
if ($nicv[0] && $nicv[1])
|
||||
{
|
||||
$ret .= " $nicattr.$nicv[0]=$nicv[1]\n";
|
||||
}
|
||||
}
|
||||
|
||||
chomp($ret);
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 collapsenicsattr
|
||||
Collapse the nics related attributes into the database format,
|
||||
for example,
|
||||
nicsips.eth0=1.1.1.1|2.1.1.1
|
||||
nicsips.eth1=3.1.1.1|4.1.1.1
|
||||
|
||||
the collapsed format:
|
||||
nicsips=eth0!1.1.1.1|2.1.1.1,eth1!3.1.1.1|4.1.1.1
|
||||
|
||||
The collapse will be done against the hash %::FILEATTRS or %::CLIATTRS,
|
||||
remove the nicips.thx attributes from %::FILEATTRS or %::CLIATTRS,
|
||||
add the collapsed info nicips into %::FILEATTRS or %::CLIATTRS.
|
||||
|
||||
Arguments:
|
||||
$::FILEATTRS{$objname} or $::CLIATTRS{$objname}
|
||||
$objname
|
||||
|
||||
Returns:
|
||||
None, update %::FILEATTRS or %::CLIATTRS directly
|
||||
|
||||
Error:
|
||||
none
|
||||
|
||||
Example:
|
||||
xCAT::DBobjUtils->collapsenicsattr($nodeattrhash);
|
||||
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub collapsenicsattr()
|
||||
{
|
||||
my $nodeattrhash = shift;
|
||||
if (($nodeattrhash) && ($nodeattrhash =~ /xCAT::/))
|
||||
{
|
||||
$nodeattrhash = shift;
|
||||
}
|
||||
my $objname = shift;
|
||||
|
||||
my %nicattrs = ();
|
||||
foreach my $nodeattr (keys %{$nodeattrhash})
|
||||
{
|
||||
# e.g nicips.eth0
|
||||
# do not need to handle nic attributes without the postfix .ethx,
|
||||
# it will be overwritten by the attributes with the postfix .ethx,
|
||||
if ($nodeattr =~ /^(nic\w+)\.(\w+)$/)
|
||||
{
|
||||
if ($1 && $2)
|
||||
{
|
||||
# chdef <noderange> nicips.eth2= to remove the definition for eth2
|
||||
# in this case, the $nodeattrhash->{'nicips.eth0'} is blank
|
||||
if ($nodeattrhash->{$nodeattr})
|
||||
{
|
||||
# $nicattrs{nicips}{eth0} = "1.1.1.1|1.2.1.1"
|
||||
$nicattrs{$1}{$2} = $nodeattrhash->{$nodeattr};
|
||||
}
|
||||
|
||||
# remove nicips.eth0 from the %::FILEATTRS
|
||||
delete $nodeattrhash->{$nodeattr};
|
||||
}
|
||||
}
|
||||
}
|
||||
# $nicattrs{'nicips'}{'eth0'} = "1.1.1.1|1.2.1.1"
|
||||
# $nicattrs{'nicips'}{'eth1'} = "2.1.1.1|2.2.1.1"
|
||||
foreach my $nicattr (keys %nicattrs)
|
||||
{
|
||||
my @tmparray = ();
|
||||
foreach my $nicname (keys %{$nicattrs{$nicattr}})
|
||||
{
|
||||
# eth0!1.1.1.1|1.2.1.1
|
||||
push @tmparray, "$nicname!$nicattrs{$nicattr}{$nicname}";
|
||||
}
|
||||
# eth0!1.1.1.1|1.2.1.1,eth1!2.1.1.1|2.2.1.1
|
||||
$nodeattrhash->{$nicattr} = join(',', @tmparray);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
+92
-171
@@ -592,7 +592,6 @@ sub _execute_dsh
|
||||
xCAT::MsgUtils->message("D", $rsp, $::CALLBACK);
|
||||
$rsp = {};
|
||||
push @{$rsp->{error}}, @{$error_buffers{$user_target}};
|
||||
$rsp->{NoErrorPrefix} = 1;
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK,0);
|
||||
}
|
||||
}
|
||||
@@ -608,7 +607,6 @@ sub _execute_dsh
|
||||
xCAT::MsgUtils->message("D", $rsp, $::CALLBACK);
|
||||
$rsp = {};
|
||||
push @{$rsp->{error}}, @{$error_buffers{$user_target}};
|
||||
$rsp->{NoErrorPrefix} = 1;
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK,0);
|
||||
|
||||
}
|
||||
@@ -817,7 +815,7 @@ sub fork_fanout_dcp
|
||||
my @dcp_command;
|
||||
my $rsyncfile;
|
||||
|
||||
if (!$$target_properties{'localhost'}) # this is to a remote host
|
||||
if (!$$target_properties{'localhost'})
|
||||
{
|
||||
my $target_type = $$target_properties{'type'};
|
||||
|
||||
@@ -839,7 +837,6 @@ sub fork_fanout_dcp
|
||||
|
||||
$rcp_config{'preserve'} = $$options{'preserve'};
|
||||
$rcp_config{'recursive'} = $$options{'recursive'};
|
||||
$rcp_config{'sudo'} = $$options{'sudo'};
|
||||
|
||||
if ($$options{'pull'})
|
||||
{
|
||||
@@ -872,25 +869,21 @@ sub fork_fanout_dcp
|
||||
my $localhost=0; # this is from the MN to another node
|
||||
@dcp_command =
|
||||
$remoteshell->remote_copy_command(\%rcp_config, $remote_copy);
|
||||
# add sudo for non-root users
|
||||
if ($$options{'sudo'}) {
|
||||
unshift (@dcp_command,'sudo');
|
||||
}
|
||||
|
||||
}
|
||||
else # this is the local host ( running on the Management Node)
|
||||
{
|
||||
if ($$options{'destDir_srcFile'}{$user_target})
|
||||
{
|
||||
my $target_type = $$target_properties{'type'};
|
||||
my $target_type = $$target_properties{'type'};
|
||||
|
||||
my %rcp_config = ();
|
||||
my %rcp_config = ();
|
||||
|
||||
my $remote_copy;
|
||||
my $rsh_extension = 'RSH';
|
||||
my $remote_copy;
|
||||
my $rsh_extension = 'RSH';
|
||||
|
||||
if ($target_type eq 'node')
|
||||
{
|
||||
if ($target_type eq 'node')
|
||||
{
|
||||
$remote_copy =
|
||||
$$options{'node-rcp'}{$$target_properties{'context'}}
|
||||
|| $$target_properties{'remote-copy'};
|
||||
@@ -898,10 +891,10 @@ sub fork_fanout_dcp
|
||||
($remote_copy =~ /\/rsync$/) && ($rsh_extension = 'RSYNC');
|
||||
$rcp_config{'options'} =
|
||||
$$options{'node-options'}{$$target_properties{'context'}};
|
||||
}
|
||||
}
|
||||
|
||||
$rcp_config{'preserve'} = $$options{'preserve'};
|
||||
$rcp_config{'recursive'} = $$options{'recursive'};
|
||||
$rcp_config{'preserve'} = $$options{'preserve'};
|
||||
$rcp_config{'recursive'} = $$options{'recursive'};
|
||||
|
||||
|
||||
$rcp_config{'src-file'} = $$options{'source'};
|
||||
@@ -912,19 +905,20 @@ sub fork_fanout_dcp
|
||||
$rcp_config{'destDir_srcFile'} =
|
||||
$$options{'destDir_srcFile'}{$user_target};
|
||||
|
||||
eval "require xCAT::$rsh_extension";
|
||||
my $remoteshell = "xCAT::$rsh_extension";
|
||||
# HERE: Build the dcp command based on the arguments
|
||||
my $localhost=1; # this is on the MN to the MN
|
||||
@dcp_command =
|
||||
#eval "require RemoteShell::$rsh_extension";
|
||||
eval "require xCAT::$rsh_extension";
|
||||
my $remoteshell = "xCAT::$rsh_extension";
|
||||
# HERE: Build the dcp command based on the arguments
|
||||
my $localhost=1; # this is on the MN to the MN
|
||||
@dcp_command =
|
||||
$remoteshell->remote_copy_command(\%rcp_config, $remote_copy,$localhost);
|
||||
|
||||
}
|
||||
else # just a copy not a sync
|
||||
{
|
||||
}
|
||||
else # just a copy not a sync
|
||||
{
|
||||
@dcp_command =
|
||||
('/bin/cp', '-r', $$options{'source'}, $$options{'target'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $rsp = {};
|
||||
@@ -1019,18 +1013,11 @@ sub fork_fanout_dsh
|
||||
}
|
||||
}
|
||||
}
|
||||
# save the original exports, we are going to add the unique node name below
|
||||
|
||||
while (@$targets_waiting
|
||||
&& (keys(%$targets_active) < $$options{'fanout'}))
|
||||
{
|
||||
my $user_target = shift @$targets_waiting;
|
||||
# now add export NODE=nodename to the pre-command, if not a device;
|
||||
my $exportnode;
|
||||
if (($$options{'devicetype'})) {
|
||||
$exportnode="";
|
||||
} else{
|
||||
$exportnode="export NODE=$user_target; ";
|
||||
}
|
||||
my $target_properties = $$resolved_targets{$user_target};
|
||||
my @commands;
|
||||
my $localShell =
|
||||
@@ -1044,39 +1031,17 @@ sub fork_fanout_dsh
|
||||
$$options{'post-command'} = "";
|
||||
$dsh_cmd_background = 1;
|
||||
}
|
||||
|
||||
if ($$options{'environment'})
|
||||
{
|
||||
# if we are on a servicenode need to get the environment file
|
||||
# from the SNsyncfiledir, not local
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
my $newenvfile;
|
||||
my $synfiledir = "/var/xcat/syncfiles"; #default
|
||||
|
||||
# get the directory on the servicenode to and add to filepath
|
||||
my @syndir= xCAT::TableUtils->get_site_attribute("SNsyncfiledir");
|
||||
if ($syndir[0])
|
||||
{
|
||||
$synfiledir = $syndir[0];
|
||||
}
|
||||
$newenvfile = $synfiledir;
|
||||
$newenvfile .= $$options{'environment'};
|
||||
$$options{'environment'} = $newenvfile;
|
||||
}
|
||||
if (!(-e $$options{'environment'}))
|
||||
{
|
||||
my $rsp={};
|
||||
$rsp->{error}->[0] = "File $$options{'environment'} does not exist";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
}
|
||||
# build the xdsh command
|
||||
push @dsh_command,
|
||||
"$exportnode$$options{'pre-command'} . $$options{'environment'} ; $$options{'command'}$$options{'post-command'}";
|
||||
"$$options{'pre-command'} . $$options{'environment'} ; $$options{'command'}$$options{'post-command'}";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
push @dsh_command,
|
||||
"$exportnode$$options{'pre-command'}$$options{'command'}$$options{'post-command'}";
|
||||
"$$options{'pre-command'}$$options{'command'}$$options{'post-command'}";
|
||||
}
|
||||
|
||||
if ($$target_properties{'localhost'})
|
||||
@@ -1144,7 +1109,7 @@ sub fork_fanout_dsh
|
||||
#eval "require RemoteShell::$rsh_extension";
|
||||
eval "require xCAT::$rsh_extension";
|
||||
|
||||
$rsh_config{'command'} = "$exportnode$$options{'pre-command'}";
|
||||
$rsh_config{'command'} = "$$options{'pre-command'}";
|
||||
my $tmp_env_file;
|
||||
# for the -E flag here we build and copy the -E env variable
|
||||
# file to the nodes
|
||||
@@ -1198,13 +1163,13 @@ sub fork_fanout_dsh
|
||||
if ($$options{'execute'})
|
||||
{
|
||||
# first build the scp command to copy the file to execute
|
||||
# down to the node into /tmp/*.dsh
|
||||
# down to the node into /tmp/*.dsh
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "TRACE: Execute option specified.";
|
||||
$dsh_trace && (xCAT::MsgUtils->message("I", $rsp, $::CALLBACK));
|
||||
|
||||
my %exe_rcp_config = ();
|
||||
$tmp_cmd_file = POSIX::tmpnam . ".dsh";
|
||||
$tmp_cmd_file = POSIX::tmpnam . ".dsh";
|
||||
|
||||
my ($exe_cmd, @args) = @{$$options{'execute'}};
|
||||
my $chmod_cmd = "";
|
||||
@@ -2345,14 +2310,10 @@ sub config_dsh
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
# if not Mellanox, it does not need a config file
|
||||
if (!($$options{'devicetype'} =~ /Mellanox/i)) {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "The config file: $devicepath is missing";
|
||||
xCAT::MsgUtils->message('E', $rsp, $::CALLBACK);
|
||||
}
|
||||
$rsp->{error}->[0] = "EMsgMISSING_DEV_CFG";
|
||||
xCAT::MsgUtils->message('E', $rsp, $::CALLBACK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3237,18 +3198,7 @@ sub bld_resolve_nodes_hash
|
||||
|
||||
# find out if we have an MN in the list, local cp and sh will be used
|
||||
# not remote shell
|
||||
my @MNnodeinfo = xCAT::NetworkUtils->determinehostname;
|
||||
my $mname = pop @MNnodeinfo; # hostname
|
||||
my $cmd="hostname";
|
||||
my $localhostname = xCAT::Utils->runcmd($cmd,0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{info}->[0] = "Command: $cmd failed. Continuing...";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
}
|
||||
|
||||
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@target_list);
|
||||
foreach my $target (@target_list)
|
||||
{
|
||||
|
||||
@@ -3257,9 +3207,11 @@ sub bld_resolve_nodes_hash
|
||||
my $localhost;
|
||||
my $user;
|
||||
my $context = "XCAT";
|
||||
# check to see if this node is the Management Node we are on, can run local commands (sh,cp)
|
||||
if (($mname eq $target) || ($localhostname eq $target)){
|
||||
# check to see if this node is the Management Node
|
||||
if ($mname) {
|
||||
if ($mname eq $target) {
|
||||
$localhost=$target;
|
||||
}
|
||||
}
|
||||
my %properties = (
|
||||
'hostname' => $hostname,
|
||||
@@ -4088,15 +4040,14 @@ sub parse_and_run_dsh
|
||||
# check if any node in the noderange is the Management Node and exit
|
||||
# with error, if the Management Node is in the Database and in the
|
||||
# noderange
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@nodelist);
|
||||
if (@mname) { # MN in the nodelist
|
||||
my $nodes=join(',', @mname);
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@nodelist);
|
||||
if ($mname) { # MN in the nodelist
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"You must not run -K option against the Management Node:$nodes.";
|
||||
"You must not run -K option against the Management Node:$mname.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
# if devicetype=Mellanox, xdsh does not setup ssh, rspconfig does
|
||||
if ($switchtype =~ /Mellanox/i) {
|
||||
my $rsp = {};
|
||||
@@ -4265,7 +4216,7 @@ sub usage_dcp
|
||||
{
|
||||
### usage message
|
||||
my $usagemsg1 = " xdcp -h \n xdcp -q\n xdcp -V \n xdcp <noderange>\n";
|
||||
my $usagemsg2 = " [-B bypass] [-c] [-f fanout] [-l user_ID] [--sudo]\n";
|
||||
my $usagemsg2 = " [-B bypass] [-c] [-f fanout] [-l user_ID]\n";
|
||||
my $usagemsg3 =
|
||||
" [-m] [-o options] [-p] [-P] [-q] [-Q] [-r node_remote_copy]\n";
|
||||
my $usagemsg4 =
|
||||
@@ -4374,8 +4325,7 @@ sub parse_and_run_dcp
|
||||
'T|trace' => \$options{'trace'},
|
||||
'V|version' => \$options{'version'},
|
||||
'devicetype=s' => \$options{'devicetype'},
|
||||
'nodestatus|nodestatus' => \$options{'nodestatus'},
|
||||
'sudo|sudo' => \$options{'sudo'},
|
||||
'nodestatus|nodestatus' => \$options{'nodestatus'},
|
||||
'X:s' => \$options{'ignore_env'}
|
||||
)
|
||||
)
|
||||
@@ -4620,8 +4570,8 @@ sub parse_and_run_dcp
|
||||
close FILE;
|
||||
# now put the original syncfile on the queue to sync to the SN's
|
||||
$rc =
|
||||
&parse_rsync_input_file_on_MN(\@nodelist, \%options,$tmpsyncfile,
|
||||
$::SYNCSN, $synfiledir,$nodesyncfiledir);
|
||||
&parse_rsync_input_file_on_MN(\@nodelist, \%options, $tmpsyncfile,
|
||||
$::SYNCSN, $synfiledir,$nodesyncfiledir);
|
||||
# cleanup
|
||||
my $cmd = "rm $tmpsyncfile";
|
||||
my @output = xCAT::Utils->runcmd($cmd, 0);
|
||||
@@ -4707,42 +4657,21 @@ sub parse_and_run_dcp
|
||||
my $ranpostscripts;
|
||||
my $ranappendscripts;
|
||||
my $ranmergescripts;
|
||||
|
||||
# if we were called with runxcmd, like by updatenode
|
||||
# need to save the runxcmd buffer
|
||||
# $::xcmd_outref
|
||||
my $save_xcmd_outref;
|
||||
if ($::xcmd_outref) { # this means we were called with runxcmd
|
||||
$save_xcmd_outref = $::xcmd_outref;
|
||||
}
|
||||
|
||||
if ((@::postscripts) && ($::SYNCSN == 0)) {
|
||||
@results2 = &run_rsync_postscripts(\@results,$synfiledir,\%options);
|
||||
@results2 = &run_rsync_postscripts(\@results,$synfiledir);
|
||||
$ranpostscripts=1;
|
||||
}
|
||||
if ((@::alwayspostscripts) && ($::SYNCSN == 0)) {
|
||||
@results3 = &run_always_rsync_postscripts(\@nodelist,$synfiledir,\%options);
|
||||
@results3 = &run_always_rsync_postscripts(\@nodelist,$synfiledir);
|
||||
}
|
||||
if (($::appendscript) && ($::SYNCSN == 0)) {
|
||||
@results4 = &bld_and_run_append(\@nodelist,\@results,$synfiledir,$nodesyncfiledir,\%options);
|
||||
@results4 = &bld_and_run_append(\@nodelist,\@results,$synfiledir,$nodesyncfiledir);
|
||||
$ranappendscripts=1;
|
||||
}
|
||||
if (($::mergescript) && ($::SYNCSN == 0)) {
|
||||
@results5 = &bld_and_run_merge(\@nodelist,\@results,$synfiledir,$nodesyncfiledir,\%options);
|
||||
@results5 = &bld_and_run_merge(\@nodelist,\@results,$synfiledir,$nodesyncfiledir);
|
||||
$ranmergescripts=1;
|
||||
}
|
||||
# restore the runxcmd buffer
|
||||
if ($save_xcmd_outref) { # this means we were called with runxcmd
|
||||
$::xcmd_outref = $save_xcmd_outref;
|
||||
}
|
||||
# TODO, will we ever need to merge
|
||||
# if we ran a postscript and we were run
|
||||
# using runxcmd, and there was previous output in the
|
||||
# runxcmd buffer and we have output from the postscript
|
||||
# then we have to merge the outputs
|
||||
#if (($ranaps == 1) && ($save_xcmd_outref) && ($::xcmd_outref) ) {
|
||||
# &mergeoutput($save_xcmd_outref);
|
||||
#}
|
||||
my @newresults;
|
||||
if (@results2) {
|
||||
@newresults = (@results2);
|
||||
@@ -4757,14 +4686,9 @@ sub parse_and_run_dcp
|
||||
@newresults = (@newresults,@results3,@results4,@results5);
|
||||
}
|
||||
if (@newresults) {
|
||||
if ($save_xcmd_outref) { # this means we were called with runxcmd
|
||||
foreach my $line (@newresults) {
|
||||
push @$::xcmd_outref,$line;
|
||||
}
|
||||
}
|
||||
return (@newresults);
|
||||
} else {
|
||||
# don't report other results for postscripts,appendscripts,mergescripts because
|
||||
# don't report results for postscripts,appendscripts,mergescripts because
|
||||
# you get all the rsync returned lines
|
||||
if (($ranpostscripts == 0 ) && ($ranappendscripts == 0)
|
||||
&& ($ranmergescripts == 0)) {
|
||||
@@ -5639,7 +5563,7 @@ sub parse_rsync_input_file_on_SN
|
||||
|
||||
sub run_rsync_postscripts
|
||||
{
|
||||
my ($rsyncoutput,$syncdir,$options) = @_;
|
||||
my ($rsyncoutput,$syncdir) = @_;
|
||||
my @rsync_output = @$rsyncoutput;
|
||||
my @newoutput= ();
|
||||
my $dshparms;
|
||||
@@ -5682,26 +5606,27 @@ sub run_rsync_postscripts
|
||||
# now if we have postscripts to run, run xdsh
|
||||
my $out;
|
||||
|
||||
# if we were called with runxcmd, like by updatenode
|
||||
# need to save the runxcmd buffer
|
||||
# $::xcmd_outref
|
||||
my $save_xcmd_outref;
|
||||
if ($::xcmd_outref) { # this means we were called with runxcmd
|
||||
$save_xcmd_outref = $::xcmd_outref;
|
||||
}
|
||||
# my $ranaps=0; # did we run a postscript
|
||||
|
||||
foreach my $ps ( keys %{$$dshparms{'postscripts'}}) {
|
||||
my @nodes;
|
||||
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
|
||||
my @args=();
|
||||
if ($$options{'nodestatus'}) {
|
||||
push @args,"--nodestatus" ;
|
||||
}
|
||||
push @args,"-e";
|
||||
# if on the service node need to add the $syncdir directory
|
||||
# to the path
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
my $tmpp=$syncdir . $ps;
|
||||
$ps=$tmpp;
|
||||
}
|
||||
push @args,$ps;
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
node => \@nodes,
|
||||
arg => \@args,
|
||||
arg => [ "-e", $ps ]
|
||||
}, $::SUBREQ, 0,1);
|
||||
foreach my $r (@$out){
|
||||
push(@newoutput, $r);
|
||||
@@ -5709,6 +5634,18 @@ sub run_rsync_postscripts
|
||||
}
|
||||
# $ranaps=1;
|
||||
}
|
||||
# restore the runxcmd buffer
|
||||
if ($save_xcmd_outref) { # this means we were called with runxcmd
|
||||
$::xcmd_outref = $save_xcmd_outref;
|
||||
}
|
||||
# TODO, will we ever need to merge
|
||||
# if we ran a postscript and we were run
|
||||
# using runxcmd, and there was previous output in the
|
||||
# runxcmd buffer and we have output from the postscript
|
||||
# then we have to merge the outputs
|
||||
#if (($ranaps == 1) && ($save_xcmd_outref) && ($::xcmd_outref) ) {
|
||||
# &mergeoutput($save_xcmd_outref);
|
||||
#}
|
||||
return @newoutput;
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -5746,7 +5683,7 @@ sub run_rsync_postscripts
|
||||
|
||||
sub bld_and_run_append
|
||||
{
|
||||
my ($hostnames,$rsyncoutput,$syncdir,$nodesyncfiledir,$options) = @_;
|
||||
my ($hostnames,$rsyncoutput,$syncdir,$nodesyncfiledir) = @_;
|
||||
my @hosts = @$hostnames;
|
||||
my @rsync_output = @$rsyncoutput;
|
||||
my @newoutput= ();
|
||||
@@ -5796,10 +5733,8 @@ sub bld_and_run_append
|
||||
# that were rsyn'd to at least one node
|
||||
if ($tmpappendfile eq $ps) {
|
||||
my $parm="$appendfile:$filetoappend ";
|
||||
# check to see if the parameter is already in the list
|
||||
if (!($::xdcpappendparms =~ /$parm/)) {
|
||||
$::xdcpappendparms .= $parm;
|
||||
}
|
||||
|
||||
$::xdcpappendparms .= $parm;
|
||||
$processappend=1;
|
||||
|
||||
}
|
||||
@@ -5820,16 +5755,10 @@ sub bld_and_run_append
|
||||
foreach my $ps ( keys %{$$dshparms{'appendscripts'}}) {
|
||||
my @nodes;
|
||||
push (@nodes, @{$$dshparms{'appendscripts'}{$ps}});
|
||||
my @args=();
|
||||
if ($$options{'nodestatus'}) {
|
||||
push @args,"--nodestatus" ;
|
||||
}
|
||||
push @args,$ps;
|
||||
push @args,$::xdcpappendparms;
|
||||
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
node => \@nodes,
|
||||
arg => \@args,
|
||||
arg => [ $ps , $::xdcpappendparms ]
|
||||
}, $::SUBREQ, 0,1);
|
||||
foreach my $r (@$out){
|
||||
push(@newoutput, $r);
|
||||
@@ -5876,7 +5805,7 @@ sub bld_and_run_append
|
||||
|
||||
sub bld_and_run_merge
|
||||
{
|
||||
my ($hostnames,$rsyncoutput,$syncdir,$nodesyncfiledir,$options) = @_;
|
||||
my ($hostnames,$rsyncoutput,$syncdir,$nodesyncfiledir) = @_;
|
||||
my @hosts = @$hostnames;
|
||||
my @rsync_output = @$rsyncoutput;
|
||||
my @newoutput= ();
|
||||
@@ -5935,10 +5864,8 @@ sub bld_and_run_merge
|
||||
# that were rsyn'd to at least one node
|
||||
if ($tmpmergefile eq $ps) {
|
||||
my $parm="$mergefile:$filetomerge ";
|
||||
# check to see if the parameter is already in the list
|
||||
if (!($::xdcpmergeparms =~ /$parm/)) {
|
||||
$::xdcpmergeparms .= $parm;
|
||||
}
|
||||
|
||||
$::xdcpmergeparms .= $parm;
|
||||
$processmerge=1;
|
||||
|
||||
}
|
||||
@@ -5960,17 +5887,9 @@ sub bld_and_run_merge
|
||||
my @nodes;
|
||||
push (@nodes, @{$$dshparms{'mergescripts'}{$ps}});
|
||||
|
||||
# build the argument list
|
||||
my @args=();
|
||||
|
||||
if ($$options{'nodestatus'}) {
|
||||
push @args,"--nodestatus" ;
|
||||
}
|
||||
push @args, $ps;
|
||||
push @args, $::xdcpmergeparms;
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
node => \@nodes,
|
||||
arg => \@args,
|
||||
arg => [ $ps , $::xdcpmergeparms ]
|
||||
}, $::SUBREQ, 0,1);
|
||||
foreach my $r (@$out){
|
||||
push(@newoutput, $r);
|
||||
@@ -5996,7 +5915,7 @@ sub bld_and_run_merge
|
||||
|
||||
sub run_always_rsync_postscripts
|
||||
{
|
||||
my ($hostnames,$syncdir,$options) = @_;
|
||||
my ($hostnames,$syncdir) = @_;
|
||||
my @hosts = @$hostnames;
|
||||
my @newoutput= ();
|
||||
my $dshparms;
|
||||
@@ -6018,28 +5937,26 @@ sub run_always_rsync_postscripts
|
||||
# now if we have postscripts to run, run xdsh
|
||||
my $out;
|
||||
|
||||
|
||||
# if we were called with runxcmd, like by updatenode
|
||||
# need to save the runxcmd buffer
|
||||
# $::xcmd_outref
|
||||
my $save_xcmd_outref;
|
||||
if ($::xcmd_outref) { # this means we were called with runxcmd
|
||||
$save_xcmd_outref = $::xcmd_outref;
|
||||
}
|
||||
foreach my $ps ( keys %{$$dshparms{'postscripts'}}) {
|
||||
my @nodes;
|
||||
# build the argument list
|
||||
my @args=();
|
||||
if ($$options{'nodestatus'}) {
|
||||
push @args,"--nodestatus" ;
|
||||
}
|
||||
push @args,"-e";
|
||||
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
|
||||
# if on the service node need to add the $syncdir directory
|
||||
# to the path
|
||||
if (xCAT::Utils->isServiceNode()) {
|
||||
my $tmpp=$syncdir . $ps;
|
||||
$ps=$tmpp;
|
||||
}
|
||||
push @args, $ps;
|
||||
|
||||
push (@nodes, @{$$dshparms{'postscripts'}{$ps}});
|
||||
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
$out=xCAT::Utils->runxcmd( { command => ['xdsh'],
|
||||
node => \@nodes,
|
||||
arg => \@args,
|
||||
arg => [ "-e", $ps ]
|
||||
}, $::SUBREQ, 0,1);
|
||||
foreach my $r (@$out){
|
||||
push(@newoutput, $r);
|
||||
@@ -6047,6 +5964,10 @@ sub run_always_rsync_postscripts
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
# restore the runxcmd buffer
|
||||
if ($save_xcmd_outref) { # this means we were called with runxcmd
|
||||
$::xcmd_outref = $save_xcmd_outref;
|
||||
}
|
||||
return @newoutput;
|
||||
}
|
||||
|
||||
@@ -754,20 +754,8 @@ sub pping_hostnames
|
||||
my ($class, @hostnames) = @_;
|
||||
|
||||
my $hostname_list = join ",", @hostnames;
|
||||
# read site table, usefping attribute
|
||||
# if set then run pping -f to use fping
|
||||
# this fixes a broken nmap in Redhat 6.2 with ip alias (3512)
|
||||
my $cmd="$::XCATROOT/bin/pping $hostname_list"; # default
|
||||
my @usefping=xCAT::TableUtils->get_site_attribute("usefping");
|
||||
if ((defined($usefping[0])) && ($usefping[0] eq "1")) {
|
||||
$cmd = "$::XCATROOT/bin/pping -f $hostname_list";
|
||||
}
|
||||
#my $rsp={};
|
||||
#$rsp->{data}->[0] = "running command $cmd";
|
||||
#xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
|
||||
my @output =
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
xCAT::Utils->runcmd("$::XCATROOT/bin/pping $hostname_list", -1);
|
||||
if ($::RUNCMD_RC !=0) {
|
||||
my $rsp={};
|
||||
$rsp->{error}->[0] = "Error from pping";
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
package xCAT::DiscoveryUtils;
|
||||
|
||||
use strict;
|
||||
use XML::Simple;
|
||||
$XML::Simple::PREFERRED_PARSER='XML::Parser';
|
||||
|
||||
use xCAT::MsgUtils;
|
||||
|
||||
=head3 update_discovery_data
|
||||
Update the discovery data from the xcat request to discoverydata table to indicate the discovery events
|
||||
arg1 - the request
|
||||
|
||||
=cut
|
||||
|
||||
sub update_discovery_data {
|
||||
my $class = shift;
|
||||
my $request = shift;
|
||||
|
||||
my %disdata;
|
||||
my %otherdata;
|
||||
|
||||
unless ($request->{'uuid'}->[0]) {
|
||||
xCAT::MsgUtils->message("S", "Discovery Error: Found a node without uuid");
|
||||
}
|
||||
|
||||
if ($request->{'discoverymethod'}->[0]) {
|
||||
$disdata{'method'} = $request->{'discoverymethod'}->[0];
|
||||
} else {
|
||||
$disdata{'method'} = "undef";
|
||||
}
|
||||
|
||||
#discoverytime
|
||||
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
|
||||
my $currtime = sprintf("%02d-%02d-%04d %02d:%02d:%02d",
|
||||
$mon + 1, $mday, $year + 1900, $hour, $min, $sec);
|
||||
$disdata{'discoverytime'} = $currtime;
|
||||
|
||||
foreach my $attr (keys %$request) {
|
||||
if ($attr =~ /^(command|discoverymethod|_xcat|cacheonly|noderange|environment|method|discoverytime|updateswitch)/) {
|
||||
next;
|
||||
} elsif ($attr =~ /^(node|uuid|arch|cpucount|cputype|memory|mtm|serial)$/) {
|
||||
$disdata{$attr} = $request->{$attr}->[0];
|
||||
} elsif ($attr eq 'nic') {
|
||||
# Set the nics attributes
|
||||
foreach my $nic (@{$request->{nic}}) {
|
||||
my $nicname = $nic->{'devname'}->[0];
|
||||
foreach my $nicattr (keys %$nic) {
|
||||
my $tbattr;
|
||||
if ($nicattr eq 'driver') {
|
||||
$tbattr = "nicdriver";
|
||||
} elsif ($nicattr eq 'ip4address') {
|
||||
$tbattr = "nicipv4";
|
||||
} elsif ($nicattr eq 'hwaddr') {
|
||||
$tbattr = "nichwaddr";
|
||||
} elsif ($nicattr eq 'pcidev') {
|
||||
$tbattr = "nicpci";
|
||||
} elsif ($nicattr eq 'location') {
|
||||
$tbattr = "nicloc";
|
||||
} elsif ($nicattr eq 'onboardeth') {
|
||||
$tbattr = "niconboard";
|
||||
} elsif ($nicattr eq 'firmdesc') {
|
||||
$tbattr = "nicfirm";
|
||||
} elsif ($nicattr =~ /^(switchname|switchaddr|switchdesc|switchport)$/) {
|
||||
$tbattr = $nicattr;
|
||||
}
|
||||
|
||||
if ($tbattr) {
|
||||
if ($disdata{$tbattr}) {
|
||||
$disdata{$tbattr} .= ','.$nicname.'!'.$nic->{$nicattr}->[0];
|
||||
} else {
|
||||
$disdata{$tbattr} = $nicname.'!'.$nic->{$nicattr}->[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# store to otherdata for the not parsed attributes
|
||||
$otherdata{$attr} = $request->{$attr};
|
||||
}
|
||||
}
|
||||
|
||||
if (keys %otherdata) {
|
||||
$disdata{'otherdata'} = XMLout(\%otherdata,RootName=>'discoveryotherdata' ,NoAttr=>1);
|
||||
}
|
||||
|
||||
my $distab = xCAT::Table->new('discoverydata');
|
||||
if ($distab) {
|
||||
$distab->setAttribs({uuid=>$request->{'uuid'}->[0]},\%disdata);
|
||||
$distab->close();
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -67,7 +67,7 @@ sub getHcpAttribs
|
||||
}
|
||||
}
|
||||
|
||||
my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype','hcp']);
|
||||
my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype']);
|
||||
for my $entry ( @ps ) {
|
||||
my $tmp_parent = $entry->{parent};
|
||||
my $tmp_node = $entry->{node};
|
||||
@@ -76,9 +76,6 @@ sub getHcpAttribs
|
||||
push @{$ppchash{$tmp_parent}{children}}, $tmp_node;
|
||||
#push @{$ppchash{$tmp_parent}}, $tmp_node;
|
||||
}
|
||||
if (defined($tmp_node) && defined($tmp_type) && ($tmp_type eq "blade") && defined($entry->{hcp})) {
|
||||
push @{$ppchash{$tmp_node}{children}}, $entry->{hcp};
|
||||
}
|
||||
|
||||
#if(exists($ppchash{$tmp_node})) {
|
||||
# if( defined($tmp_type) ) {
|
||||
@@ -176,8 +173,6 @@ sub getIPaddress
|
||||
#the $nodetocheck is its' hcp. So set $nodetocheck to $parent variable.
|
||||
#And then get the FSPs IPs for the CEC.
|
||||
$parent = $nodetocheck;
|
||||
} elsif ($type eq "blade") {
|
||||
return $ppc->{$nodetocheck}->{children}->[0];
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ sub powercmd {
|
||||
if($action =~ /^lowpower$/) { $action = "cec_on_low_power"; }
|
||||
#if($action =~ /^cycle$/) {$action = "cec_reboot";}
|
||||
if($action =~ /^cycle$/) {$action = "reset";}
|
||||
if($action !~ /^cec_on_autostart$/ && $action !~ /^cec_off$/ && $action !~ /^cec_on_low_power$/ && $action !~ /^onstandby$/ && $action !~ /^reboot_service_processor$/ && $action !~ /^reset$/ && $action !~ /^sms$/) {
|
||||
if($action !~ /^cec_on_autostart$/ && $action !~ /^cec_off$/ && $action !~ /^cec_on_low_power$/ && $action !~ /^onstandby$/ && $action !~ /^reboot_service_processor$/ && $action !~ /^reset$/) {
|
||||
push @output, [$node_name, "\'$action\' command not supported for $$d[4]", -1 ];
|
||||
return (\@output);
|
||||
}
|
||||
|
||||
@@ -116,9 +116,6 @@ sub enumerate_lcds {
|
||||
} else {
|
||||
my @array = split(/\n/, $data);
|
||||
foreach my $a (@array) {
|
||||
if ($a !~ /:\s?[^\s]*\s?[0|1]/) {
|
||||
next;
|
||||
}
|
||||
my @t = split(/:/, $a);
|
||||
my $name = $t[0];
|
||||
$data = $t[1];
|
||||
@@ -432,10 +429,8 @@ sub lcds {
|
||||
}
|
||||
}
|
||||
|
||||
if( $type eq "lpar" ) {
|
||||
if( $type =~ /lpar|blade/ ) {
|
||||
$action = "query_lcds";
|
||||
} elsif ($type eq "blade") {
|
||||
$action = "pblade_query_lcds";
|
||||
} else {
|
||||
$action = "cec_query_lcds";
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ $::NODETYPE_MP="mp";
|
||||
$::STATUS_SYNCING="syncing";
|
||||
$::STATUS_OUT_OF_SYNC="out-of-sync";
|
||||
$::STATUS_SYNCED="synced";
|
||||
$::STATUS_FAILED="failed";
|
||||
|
||||
|
||||
# valid values for nodelist.status columns or other status
|
||||
|
||||
@@ -893,12 +893,12 @@ sub dolitesetup
|
||||
}
|
||||
}
|
||||
|
||||
if (-e $litetreetable) {
|
||||
my $rc = xCAT::Utils->runcmd("rm $litetreetable", -1);
|
||||
if (-e $litetreetab) {
|
||||
my $rc = xCAT::Utils->runcmd("rm $litetreetab", -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not remove existing $litetreetable file.";
|
||||
push @{$rsp->{data}}, "Could not remove existing $litetreetab file.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return 1;
|
||||
}
|
||||
@@ -1132,11 +1132,7 @@ sub dolitesetup
|
||||
# $file could be full path file name or dir name
|
||||
# ex. /foo/bar/ or /etc/lppcfg
|
||||
my ($node, $option, $file) = split (/\|/, $line);
|
||||
|
||||
if (!$file) {
|
||||
next;
|
||||
}
|
||||
|
||||
|
||||
# ex. .../inst_root/foo/bar/ or .../inst_root/etc/lppcfg
|
||||
my $instrootfile = $instrootloc . $file;
|
||||
|
||||
|
||||
@@ -1849,14 +1849,6 @@ sub boot_network {
|
||||
$state = $newstate[$state];
|
||||
}
|
||||
],
|
||||
# For some old firmware, does not output "----"
|
||||
[qr/BOOTP/=>
|
||||
sub {
|
||||
nc_msg ($verbose, $msg[$state]);
|
||||
$rconsole->clear_accum();
|
||||
$state = $newstate[$state];
|
||||
}
|
||||
],
|
||||
[qr/]/=>
|
||||
sub {
|
||||
nc_msg($verbose, "Unexpected prompt\n");
|
||||
@@ -1925,28 +1917,7 @@ sub Boot {
|
||||
#],
|
||||
[qr/BOOTP/=> #-ex
|
||||
sub {
|
||||
nc_msg($verbose, "# Network boot proceeding - matched BOOTP, exiting.\n");
|
||||
$rconsole->clear_accum();
|
||||
}
|
||||
],
|
||||
# Welcome to AIX - some old firmware does not output BOOTP or ----
|
||||
[qr/Welcome/=> #-ex
|
||||
sub {
|
||||
nc_msg($verbose, "# Network boot proceeding - matched Welcome, exiting.\n");
|
||||
$rconsole->clear_accum();
|
||||
}
|
||||
],
|
||||
# tftp file download - some old firmware does not output BOOTP or ----
|
||||
[qr/FILE/=> #-ex
|
||||
sub {
|
||||
nc_msg($verbose, "# Network boot proceeding - matched FILE.\n");
|
||||
$rconsole->clear_accum();
|
||||
}
|
||||
],
|
||||
# some old firmware does not output BOOTP or ----
|
||||
[qr/Elapsed/=> #-ex
|
||||
sub {
|
||||
nc_msg($verbose, "# Network boot proceeding - matched Elapsed, exiting.\n");
|
||||
nc_msg($verbose, "# Network boot proceeding, exiting.\n");
|
||||
$rconsole->clear_accum();
|
||||
}
|
||||
],
|
||||
@@ -3177,12 +3148,12 @@ sub lparnetbootexp
|
||||
}
|
||||
],
|
||||
);
|
||||
return [1] if ($rc eq 1);
|
||||
nc_msg($verbose, "# bootp sent over network.\n");
|
||||
$rc = Boot($rconsole, $node, $verbose);#, @expect_out);
|
||||
unless ($rc eq 0) {
|
||||
nc_msg($verbose, "Can't boot here. \n");
|
||||
}
|
||||
return [1] if ($rc eq 1);
|
||||
}
|
||||
nc_msg($verbose, "# bootp sent over network.\n");
|
||||
$rc = Boot($rconsole, $node, $verbose);#, @expect_out);
|
||||
unless ($rc eq 0) {
|
||||
nc_msg($verbose, "Can't boot here. \n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT::NameRange;
|
||||
require xCAT::Table;
|
||||
require Exporter;
|
||||
use strict;
|
||||
|
||||
#Perl implementation of namerange
|
||||
# NOTE: This is identical to xCAT::NodeRange except that no
|
||||
# database access occurs, no nodes are verified, and
|
||||
# no nodegroups are expanded.
|
||||
# Made a new utility since NodeRange is used EVERYWHERE in
|
||||
# xCAT code and did not want to risk de-stabilizing existing code.
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(namerange);
|
||||
|
||||
my $recurselevel=0;
|
||||
|
||||
|
||||
sub subnodes (\@@) {
|
||||
#Subtract set of nodes from the first list
|
||||
my $nodes = shift;
|
||||
my $node;
|
||||
foreach $node (@_) {
|
||||
@$nodes = (grep(!/^$node$/,@$nodes));
|
||||
}
|
||||
}
|
||||
|
||||
sub expandatom {
|
||||
my $atom = shift;
|
||||
my @nodes= ();
|
||||
if ($atom =~ /^\(.*\)$/) { # handle parentheses by recursively calling namerange()
|
||||
$atom =~ s/^\((.*)\)$/$1/;
|
||||
$recurselevel++;
|
||||
return namerange($atom);
|
||||
}
|
||||
if ($atom =~ /@/) {
|
||||
$recurselevel++;
|
||||
return namerange($atom);
|
||||
}
|
||||
|
||||
if ($atom =~ m/^\//) { # A regular expression - not supported in namerange
|
||||
return ($atom);
|
||||
}
|
||||
|
||||
if ($atom =~ m/(.*)\[(.*)\](.*)/) { # square bracket range
|
||||
#for the time being, we are only going to consider one [] per atom
|
||||
#xcat 1.2 does no better
|
||||
my @subelems = split(/([\,\-\:])/,$2);
|
||||
my $subrange="";
|
||||
while (my $subelem = shift @subelems) {
|
||||
my $subop=shift @subelems;
|
||||
$subrange=$subrange."$1$subelem$3$subop";
|
||||
}
|
||||
foreach (split /,/,$subrange) {
|
||||
my @newnodes=expandatom($_);
|
||||
@nodes=(@nodes,@newnodes);
|
||||
}
|
||||
return @nodes;
|
||||
}
|
||||
|
||||
if ($atom =~ m/\+/) { # process the + operator
|
||||
$atom =~ m/^([^0-9]*)([0-9]+)([^\+]*)\+([0-9]+)/;
|
||||
my $pref=$1;
|
||||
my $startnum=$2;
|
||||
my $suf=$3;
|
||||
my $end=$4+$startnum;
|
||||
my $endnum = sprintf("%d",$end);
|
||||
if (length ($startnum) > length ($endnum)) {
|
||||
$endnum = sprintf("%0".length($startnum)."d",$end);
|
||||
}
|
||||
foreach ("$startnum".."$endnum") {
|
||||
my @addnodes=expandatom($pref.$_.$suf);
|
||||
@nodes=(@nodes,@addnodes);
|
||||
}
|
||||
return (@nodes);
|
||||
}
|
||||
|
||||
if ($atom =~ m/[-:]/) { # process the minus range operator
|
||||
my $left;
|
||||
my $right;
|
||||
if ($atom =~ m/:/) {
|
||||
($left,$right)=split /:/,$atom;
|
||||
} else {
|
||||
my $count= ($atom =~ tr/-//);
|
||||
if (($count % 2)==0) { #can't understand even numbers of - in range context
|
||||
# we might not really be in range context
|
||||
return ($atom);
|
||||
}
|
||||
my $expr="([^-]+?".("-[^-]*"x($count/2)).")-(.*)";
|
||||
$atom =~ m/$expr/;
|
||||
$left=$1;
|
||||
$right=$2;
|
||||
}
|
||||
if ($left eq $right) { #if they said node1-node1 for some strange reason
|
||||
return expandatom($left);
|
||||
}
|
||||
my @leftarr=split(/(\d+)/,$left);
|
||||
my @rightarr=split(/(\d+)/,$right);
|
||||
if (scalar(@leftarr) != scalar(@rightarr)) { #Mismatch formatting..
|
||||
# guess it's meant to be a nodename
|
||||
return ($atom);
|
||||
}
|
||||
my $prefix = "";
|
||||
my $suffix = "";
|
||||
foreach (0..$#leftarr) {
|
||||
my $idx = $_;
|
||||
if ($leftarr[$idx] =~ /^\d+$/ and $rightarr[$idx] =~ /^\d+$/) { #pure numeric component
|
||||
if ($leftarr[$idx] ne $rightarr[$idx]) { #We have found the iterator (only supporting one for now)
|
||||
my $prefix = join('',@leftarr[0..($idx-1)]); #Make a prefix of the pre-validated parts
|
||||
my $luffix; #However, the remainder must still be validated to be the same
|
||||
my $ruffix;
|
||||
if ($idx eq $#leftarr) {
|
||||
$luffix="";
|
||||
$ruffix="";
|
||||
} else {
|
||||
$ruffix = join('',@rightarr[($idx+1)..$#rightarr]);
|
||||
$luffix = join('',@leftarr[($idx+1)..$#leftarr]);
|
||||
}
|
||||
if ($luffix ne $ruffix) { #the suffixes mismatched..
|
||||
return ($atom);
|
||||
}
|
||||
foreach ($leftarr[$idx]..$rightarr[$idx]) {
|
||||
my @addnodes=expandatom($prefix.$_.$luffix);
|
||||
@nodes=(@nodes,@addnodes);
|
||||
}
|
||||
return (@nodes); #the return has been built, return, exiting loop and all
|
||||
}
|
||||
} elsif ($leftarr[$idx] ne $rightarr[$idx]) {
|
||||
return ($atom);
|
||||
}
|
||||
$prefix .= $leftarr[$idx]; #If here, it means that the pieces were the same, but more to come
|
||||
}
|
||||
#I cannot conceive how the code could possibly be here, but whatever it is, it must be questionable
|
||||
return ($atom);
|
||||
}
|
||||
|
||||
return ($atom);
|
||||
}
|
||||
|
||||
sub namerange {
|
||||
#We for now just do left to right operations
|
||||
my $range=shift;
|
||||
my %nodes = ();
|
||||
my %delnodes = ();
|
||||
my $op = ",";
|
||||
my @elems = split(/(,(?![^[]*?])(?![^\(]*?\)))/,$range); # commas outside of [] or ()
|
||||
if (scalar(@elems)==1) {
|
||||
@elems = split(/(@(?![^\(]*?\)))/,$range); # only split on @ when no , are present (inner recursion)
|
||||
}
|
||||
|
||||
while (my $atom = shift @elems) {
|
||||
if ($atom =~ /^-/) { # if this is an exclusion, strip off the minus, but remember it
|
||||
$atom = substr($atom,1);
|
||||
$op = $op."-";
|
||||
}
|
||||
|
||||
if ($atom =~ /^\^(.*)$/) { # get a list of nodes from a file
|
||||
open(NRF,$1);
|
||||
while (<NRF>) {
|
||||
my $line=$_;
|
||||
unless ($line =~ m/^[\^#]/) {
|
||||
$line =~ m/^([^: ]*)/;
|
||||
my $newrange = $1;
|
||||
chomp($newrange);
|
||||
$recurselevel++;
|
||||
my @filenodes = namerange($newrange);
|
||||
foreach (@filenodes) {
|
||||
$nodes{$_}=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(NRF);
|
||||
next;
|
||||
}
|
||||
|
||||
my %newset = map { $_ =>1 } expandatom($atom); # expand the atom and make each entry in the resulting array a key in newset
|
||||
|
||||
if ($op =~ /@/) { # compute the intersection of the current atom and the node list we have received before this
|
||||
foreach (keys %nodes) {
|
||||
unless ($newset{$_}) {
|
||||
delete $nodes{$_};
|
||||
}
|
||||
}
|
||||
} elsif ($op =~ /,-/) { # add the nodes from this atom to the exclude list
|
||||
foreach (keys %newset) {
|
||||
$delnodes{$_}=1; #delay removal to end
|
||||
}
|
||||
} else { # add the nodes from this atom to the total node list
|
||||
foreach (keys %newset) {
|
||||
$nodes{$_}=1;
|
||||
}
|
||||
}
|
||||
$op = shift @elems;
|
||||
|
||||
} # end of main while loop
|
||||
|
||||
# Now remove all the exclusion nodes
|
||||
foreach (keys %nodes) {
|
||||
if ($delnodes{$_}) {
|
||||
delete $nodes{$_};
|
||||
}
|
||||
}
|
||||
if ($recurselevel) {
|
||||
$recurselevel--;
|
||||
}
|
||||
return sort (keys %nodes);
|
||||
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
xCAT::NameRange - Perl module for xCAT namerange expansion
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use xCAT::NameRange;
|
||||
my @nodes=namerange("storage@rack1,node[1-200],^/tmp/nodelist,node300-node400,node401+10,500-550");
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
namerange interprets xCAT noderange formatted strings and returns a list of
|
||||
names. The following two operations are supported on elements, and interpreted
|
||||
left to right:
|
||||
|
||||
, union next element with everything to the left.
|
||||
|
||||
@ take intersection of element to the right with everything on the left
|
||||
(i.e. mask out anything to the left not belonging to what is described to
|
||||
the right)
|
||||
|
||||
Each element can be a number of things:
|
||||
|
||||
A node name, i.e.:
|
||||
|
||||
=item * node1
|
||||
|
||||
A hyphenated node range (only one group of numbers may differ between the left and right hand side, and those numbers will increment in a base 10 fashion):
|
||||
|
||||
node1-node200 node1-compute-node200-compute
|
||||
node1:node200 node1-compute:node200-compute
|
||||
|
||||
A namerange denoted by brackets:
|
||||
|
||||
node[1-200] node[001-200]
|
||||
|
||||
A regular expression describing the namerange:
|
||||
|
||||
/d(1.?.?|200)
|
||||
|
||||
A node plus offset (this increments the first number found in nodename):
|
||||
|
||||
node1+199
|
||||
|
||||
And most of the above substituting groupnames.
|
||||
3C
|
||||
3C
|
||||
|
||||
NameRange tries to be intelligent about detecting padding, so you can:
|
||||
node001-node200
|
||||
And it will increment according to the pattern.
|
||||
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2007 IBM Corp. All rights reserved.
|
||||
|
||||
|
||||
=cut
|
||||
@@ -422,6 +422,11 @@ sub ishostinsubnet {
|
||||
if ($ip =~ /:/) {#ipv6
|
||||
$numbits=128;
|
||||
}
|
||||
# IPv6 subnet with netmask postfix like /64
|
||||
if ($subnet && ($subnet =~ /\//))
|
||||
{
|
||||
$subnet =~ s/\/.*$//;
|
||||
}
|
||||
if ($mask) {
|
||||
if ($mask =~ /\//) {
|
||||
$mask =~ s/^\///;
|
||||
@@ -437,10 +442,6 @@ sub ishostinsubnet {
|
||||
die "ishostinsubnet must either be called with a netmask or CIDR /bits notation";
|
||||
}
|
||||
}
|
||||
if ($subnet && ($subnet =~ /\//)) #remove CIDR suffix from subnet
|
||||
{
|
||||
$subnet =~ s/\/.*$//;
|
||||
}
|
||||
$ip = getipaddr($ip,GetNumber=>1);
|
||||
$subnet = getipaddr($subnet,GetNumber=>1);
|
||||
$ip &= $mask;
|
||||
@@ -2254,26 +2255,6 @@ sub int_to_ip
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getBroadcast
|
||||
Description : Get the broadcast ips
|
||||
Arguments : ipstr - the IPv4 string ip.
|
||||
netmask - the subnet mask of network
|
||||
Returns : bcipint - the IPv4 string of broadcast ip.
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getBroadcast
|
||||
{
|
||||
my ($class, $ipstr, $netmask) = @_;
|
||||
my $ipint = xCAT::NetworkUtils->ip_to_int($ipstr);
|
||||
my $maskint = xCAT::NetworkUtils->ip_to_int($netmask);
|
||||
my $tmp = sprintf("%d", ~$maskint);
|
||||
my $bcnum = sprintf("%d", ($ipint | $tmp) & hex('0x00000000FFFFFFFF'));
|
||||
return xCAT::NetworkUtils->int_to_ip($bcnum);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_allips_in_range
|
||||
Description : Get all IPs in a IP range, return in a list.
|
||||
Arguments : $startip - start IP address
|
||||
|
||||
+31
-51
@@ -180,14 +180,7 @@ sub nodesbycriteria {
|
||||
return \%critnodes;
|
||||
}
|
||||
|
||||
# Expand one part of the noderange from the noderange() function. Initially, one part means the
|
||||
# substring between commas in the noderange. But expandatom also calls itself recursively to
|
||||
# further expand some parts.
|
||||
# Input args:
|
||||
# - atom to expand
|
||||
# - verify: whether or not to require that the resulting nodenames exist in the nodelist table
|
||||
# - options: genericrange - a purely syntactical expansion of the range, not using the db at all, e.g not expanding group names
|
||||
sub expandatom {
|
||||
sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels5.3)
|
||||
my $atom = shift;
|
||||
if ($recurselevel > 4096) { die "NodeRange seems to be hung on evaluating $atom, recursion limit hit"; }
|
||||
unless (scalar(@allnodeset) and (($allnodesetstamp+5) > time())) { #Build a cache of all nodes, some corner cases will perform worse, but by and large it will do better. We could do tests to see where the breaking points are, and predict how many atoms we have to evaluate to mitigate, for now, implement the strategy that keeps performance from going completely off the rails
|
||||
@@ -196,28 +189,25 @@ sub expandatom {
|
||||
@allnodeset = $nodelist->getAllAttribs('node','groups');
|
||||
%allnodehash = map { $_->{node} => 1 } @allnodeset;
|
||||
}
|
||||
my $verify = (scalar(@_) >= 1 ? shift : 1);
|
||||
my %options = @_; # additional options
|
||||
my $verify = (scalar(@_) == 1 ? shift : 1);
|
||||
my @nodes= ();
|
||||
#TODO: these env vars need to get passed by the client to xcatd
|
||||
my $nprefix=(defined ($ENV{'XCAT_NODE_PREFIX'}) ? $ENV{'XCAT_NODE_PREFIX'} : 'node');
|
||||
my $nsuffix=(defined ($ENV{'XCAT_NODE_SUFFIX'}) ? $ENV{'XCAT_NODE_SUFFIX'} : '');
|
||||
|
||||
if (not $options{genericrange} and $allnodehash{$atom}) { #The atom is a plain old nodename
|
||||
if ($allnodehash{$atom}) { #The atom is a plain old nodename
|
||||
return ($atom);
|
||||
}
|
||||
if ($atom =~ /^\(.*\)$/) { # handle parentheses by recursively calling noderange()
|
||||
$atom =~ s/^\((.*)\)$/$1/;
|
||||
$recurselevel++;
|
||||
return noderange($atom,$verify,1,%options);
|
||||
return noderange($atom);
|
||||
}
|
||||
if ($atom =~ /@/) {
|
||||
$recurselevel++;
|
||||
return noderange($atom,$verify,1,%options);
|
||||
return noderange($atom);
|
||||
}
|
||||
|
||||
# Try to match groups?
|
||||
unless ($options{genericrange}) {
|
||||
unless ($grptab) {
|
||||
$grptab = xCAT::Table->new('nodegroup');
|
||||
}
|
||||
@@ -279,9 +269,7 @@ sub expandatom {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# node selection based on db attribute values (nodetype.os==rhels5.3)
|
||||
if ($atom =~ m/[=~]/) { #TODO: this is the clunky, slow code path to acheive the goal. It also is the easiest to write, strange coincidence. Aggregating multiples would be nice
|
||||
my @nodes;
|
||||
foreach (@allnodeset) {
|
||||
@@ -299,7 +287,7 @@ sub expandatom {
|
||||
}
|
||||
if ($atom =~ m/^[0-9]+\z/) { # if only numbers, then add the prefix
|
||||
my $nodename=$nprefix.$atom.$nsuffix;
|
||||
return expandatom($nodename,$verify,%options);
|
||||
return expandatom($nodename,$verify);
|
||||
}
|
||||
my $nodelen=@nodes;
|
||||
if ($nodelen > 0) {
|
||||
@@ -307,7 +295,7 @@ sub expandatom {
|
||||
}
|
||||
|
||||
if ($atom =~ m/^\//) { # A regular expression
|
||||
if ($verify==0 or $options{genericrange}) { # If not in verify mode, regex makes zero possible sense
|
||||
unless ($verify) { # If not in verify mode, regex makes zero possible sense
|
||||
return ($atom);
|
||||
}
|
||||
#TODO: check against all groups
|
||||
@@ -321,29 +309,25 @@ sub expandatom {
|
||||
}
|
||||
|
||||
if ($atom =~ m/(.+?)\[(.+?)\](.*)/) { # square bracket range
|
||||
# if there is more than 1 set of [], we picked off just the 1st. If there more sets of [], we will expand
|
||||
# the 1st set and create a new set of atom by concatenating each result in the 1st expandsion with the rest
|
||||
# of the brackets. Then call expandatom() recursively on each new atom.
|
||||
my @subelems = split(/([\,\-\:])/,$2); # $2 is the range inside the 1st set of brackets
|
||||
# if there are more than 1 [], we picked off just the 1st. if there is another, we will process it later
|
||||
my @subelems = split(/([\,\-\:])/,$2);
|
||||
my $subrange="";
|
||||
my $subelem;
|
||||
my $start = $1; # the text before the 1st set of brackets
|
||||
my $ending = $3; # the text after the 1st set of brackets (could contain more brackets)
|
||||
my $morebrackets = $ending =~ /\[.+?\]/; # if there are more brackets, we have to expand just the 1st part, then add the 2nd part later
|
||||
while (scalar @subelems) { # this while loop turns something like a[1-3] into a1-a3 because another section of expand atom knows how to expand that
|
||||
my $subelem = shift @subelems;
|
||||
my $subelem;
|
||||
my $start = $1;
|
||||
my $ending = $3;
|
||||
my $morebrackets = $ending =~ /\[.+?\]/; # if there are more brackets, we have to expand just the 1st part, then add the 2nd part later
|
||||
while (scalar @subelems) {
|
||||
my $subelem = shift @subelems;
|
||||
my $subop=shift @subelems;
|
||||
$subrange=$subrange."$start$subelem" . ($morebrackets?'':$ending) . "$subop";
|
||||
}
|
||||
foreach (split /,/,$subrange) { # this foreach is in case there were commas inside the brackets originally, e.g.: a[1,3,5]b[1-2]
|
||||
# this expandatom just expands the part of the noderange that contains the 1st set of brackets
|
||||
# e.g. if noderange is a[1-2]b[1-2] it will create newnodes of a1 and a2
|
||||
my @newnodes=expandatom($_, ($morebrackets?0:$verify), genericrange=>($morebrackets||$options{genericrange}));
|
||||
foreach (split /,/,$subrange) {
|
||||
my @newnodes=expandatom($_, ($morebrackets?0:$verify));
|
||||
if (!$morebrackets) { push @nodes,@newnodes; }
|
||||
else {
|
||||
# for each of the new nodes (prefixes), add the rest of the brackets and then expand recursively
|
||||
# for each of the new nodes, add the 2nd brackets and then expand
|
||||
foreach my $n (@newnodes) {
|
||||
push @nodes, expandatom("$n$ending", $verify, %options);
|
||||
push @nodes, expandatom("$n$ending", $verify);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -365,7 +349,7 @@ sub expandatom {
|
||||
$suf=$nsuffix;
|
||||
}
|
||||
foreach ("$startnum".."$endnum") {
|
||||
my @addnodes=expandatom($pref.$_.$suf,$verify,%options);
|
||||
my @addnodes=expandatom($pref.$_.$suf,$verify);
|
||||
@nodes=(@nodes,@addnodes);
|
||||
}
|
||||
return (@nodes);
|
||||
@@ -392,7 +376,7 @@ sub expandatom {
|
||||
$right=$2;
|
||||
}
|
||||
if ($left eq $right) { #if they said node1-node1 for some strange reason
|
||||
return expandatom($left,$verify,%options);
|
||||
return expandatom($left,$verify);
|
||||
}
|
||||
my @leftarr=split(/(\d+)/,$left);
|
||||
my @rightarr=split(/(\d+)/,$right);
|
||||
@@ -429,7 +413,7 @@ sub expandatom {
|
||||
}
|
||||
}
|
||||
foreach ($leftarr[$idx]..$rightarr[$idx]) {
|
||||
my @addnodes=expandatom($prefix.$_.$luffix,$verify,%options);
|
||||
my @addnodes=expandatom($prefix.$_.$luffix,$verify);
|
||||
push @nodes,@addnodes;
|
||||
}
|
||||
return (@nodes); #the return has been built, return, exiting loop and all
|
||||
@@ -477,7 +461,7 @@ sub retain_cache { #A semi private operation to be used *ONLY* in the interestin
|
||||
%allgrphash=();
|
||||
}
|
||||
}
|
||||
sub extnoderange { #An extended noderange function. Needed by the GUI as the more straightforward function return format too simple for this.
|
||||
sub extnoderange { #An extended noderange function. Needed as the more straightforward function return format too simple for this.
|
||||
my $range = shift;
|
||||
my $namedopts = shift;
|
||||
my $verify=1;
|
||||
@@ -503,7 +487,7 @@ sub extnoderange { #An extended noderange function. Needed by the GUI as the mo
|
||||
return $return;
|
||||
}
|
||||
sub abbreviate_noderange {
|
||||
#takes a list of nodes or a string and reduces it by replacing a list of nodes that make up a group with the group name itself
|
||||
#takes a list of nodes or a string and abbreviates
|
||||
my $nodes=shift;
|
||||
my %grouphash;
|
||||
my %sizedgroups;
|
||||
@@ -549,20 +533,16 @@ sub abbreviate_noderange {
|
||||
return (join ',',keys %targetelems,keys %nodesleft);
|
||||
}
|
||||
|
||||
# Expand the given noderange
|
||||
# Input args:
|
||||
# - noderange to expand
|
||||
# - verify: whether or not to require that the resulting nodenames exist in the nodelist table
|
||||
# - exsitenode: whether or not to honor site.excludenodes to automatically exclude those nodes from all noderanges
|
||||
# - options: genericrange - a purely syntactical expansion of the range, not using the db at all, e.g not expanding group names
|
||||
sub noderange {
|
||||
$missingnodes=[];
|
||||
#We for now just do left to right operations
|
||||
my $range=shift;
|
||||
$range =~ s/['"]//g;
|
||||
my $verify = (scalar(@_) >= 1 ? shift : 1);
|
||||
my $exsitenode = (scalar(@_) >= 1 ? shift : 1); # if 1, honor site.excludenodes
|
||||
my %options = @_; # additional options
|
||||
|
||||
#excludenodes attribute in site table,
|
||||
#these nodes should be excluded for any xCAT commands
|
||||
my $exsitenode = (scalar(@_) >= 1 ? shift : 1);
|
||||
|
||||
unless ($nodelist) {
|
||||
$nodelist =xCAT::Table->new('nodelist',-create =>1);
|
||||
@@ -597,7 +577,7 @@ sub noderange {
|
||||
my $newrange = $1;
|
||||
chomp($newrange);
|
||||
$recurselevel++;
|
||||
my @filenodes = noderange($newrange,$verify,$exsitenode,%options);
|
||||
my @filenodes = noderange($newrange);
|
||||
foreach (@filenodes) {
|
||||
$nodes{$_}=1;
|
||||
}
|
||||
@@ -607,7 +587,7 @@ sub noderange {
|
||||
next;
|
||||
}
|
||||
|
||||
my %newset = map { $_ =>1 } expandatom($atom,$verify,%options); # expand the atom and make each entry in the resulting array a key in newset
|
||||
my %newset = map { $_ =>1 } expandatom($atom,$verify); # expand the atom and make each entry in the resulting array a key in newset
|
||||
|
||||
if ($op =~ /@/) { # compute the intersection of the current atom and the node list we have received before this
|
||||
foreach (keys %nodes) {
|
||||
@@ -634,7 +614,7 @@ sub noderange {
|
||||
my $badnoderange = 0;
|
||||
my @badnodes = ();
|
||||
if ($::XCATSITEVALS{excludenodes}) {
|
||||
@badnodes = noderange($::XCATSITEVALS{excludenodes}, 1, 0, %options);
|
||||
@badnodes = noderange($::XCATSITEVALS{excludenodes}, 1, 0);
|
||||
foreach my $bnode (@badnodes) {
|
||||
if (!$delnodes{$bnode}) {
|
||||
$delnodes{$bnode} = 1;
|
||||
|
||||
@@ -99,7 +99,7 @@ sub mkhwconn_parse_args
|
||||
#my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]);
|
||||
my $node_parent_hash = $ppctab->getNodeAttribs( $node,[qw(parent)]);
|
||||
#$nodetype = $nodetype_hash->{nodetype};
|
||||
$nodetype = xCAT::DBobjUtils->getnodetype($node,"ppc");
|
||||
$nodetype = xCAT::DBobjUtils->getnodetype($node);
|
||||
$node_parent = $node_parent_hash->{parent};
|
||||
if ( !$nodetype )
|
||||
{
|
||||
@@ -107,7 +107,7 @@ sub mkhwconn_parse_args
|
||||
next;
|
||||
} else
|
||||
{
|
||||
unless ( $nodetype =~ /^(blade|fsp|bpa|frame|cec|hmc)$/)
|
||||
unless ( $nodetype =~ /^(fsp|bpa|frame|cec|hmc)$/)
|
||||
{
|
||||
return ( usage("Node type is incorrect. \n"));
|
||||
}
|
||||
@@ -486,13 +486,9 @@ sub mkhwconn
|
||||
# Get IP address
|
||||
############################
|
||||
my $cnode;
|
||||
#my $ntype = xCAT::DBobjUtils::getnodetype($node_name);
|
||||
my $ntype = $$d[4];
|
||||
if ($ntype =~ /^(cec|frame|blade)$/)
|
||||
my $ntype = xCAT::DBobjUtils::getnodetype($node_name);
|
||||
if ($ntype =~ /^(cec|frame)$/)
|
||||
{
|
||||
if ($ntype eq "blade") {
|
||||
delete $opt->{port};
|
||||
}
|
||||
$cnode = xCAT::DBobjUtils::getchildren($node_name, $opt->{port});
|
||||
} else {
|
||||
$cnode = $node_name;
|
||||
@@ -522,17 +518,12 @@ sub mkhwconn
|
||||
next;
|
||||
}
|
||||
|
||||
my ( undef,undef,$mtms,undef,$type,$bpa) = @$d;
|
||||
my ( undef,undef,$mtms,undef,$type) = @$d;
|
||||
my ($user, $passwd);
|
||||
if ( exists $opt->{P})
|
||||
{
|
||||
($user, $passwd) = ('HMC', $opt->{P});
|
||||
}
|
||||
elsif ($type eq "blade") {
|
||||
$user = "USERID";
|
||||
($user, $passwd) = xCAT::PPCdb::credentials( $bpa, $type, $user);
|
||||
$type = "cec";
|
||||
}
|
||||
else
|
||||
{
|
||||
($user, $passwd) = xCAT::PPCdb::credentials( $node_name, $type,'HMC');
|
||||
@@ -716,7 +707,7 @@ sub rmhwconn
|
||||
my $d = $node_hash->{$node_name};
|
||||
|
||||
my ( undef,undef,undef,undef,$type) = @$d;
|
||||
if ($type eq "blade") {$type = "cec";}
|
||||
|
||||
############################
|
||||
# Get IP address
|
||||
############################
|
||||
@@ -733,19 +724,10 @@ sub rmhwconn
|
||||
|
||||
my @ips;
|
||||
foreach my $entry ( @$nodes_found ) {
|
||||
if ($entry =~ /type_model_serial_num=([^,]*),/) {
|
||||
my $match_mtm1 = $1;
|
||||
my $match_mtm2 = $match_mtm1;
|
||||
$match_mtm2 =~ s/\-//;
|
||||
if ($match_mtm1 =~ /$mtm\*$serial/ || $match_mtm2 =~ /$mtm\*$serial/) {
|
||||
$entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/;
|
||||
push @ips, $1;
|
||||
}
|
||||
if ( $entry =~ /$mtm\*$serial/) {
|
||||
$entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/;
|
||||
push @ips, $1;
|
||||
}
|
||||
#if ( $entry =~ /$mtm\*$serial/) {
|
||||
# $entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/;
|
||||
# push @ips, $1;
|
||||
#}
|
||||
}
|
||||
if (!@ips)
|
||||
{
|
||||
|
||||
@@ -52,21 +52,14 @@ sub get_allocable_staticips_innet
|
||||
my $netentry = ($networkstab->getAllAttribsWhere("netname = '$netname'", 'ALL'))[0];
|
||||
my ($startip, $endip) = split('-', $netentry->{'staticrange'});
|
||||
my $incremental = $netentry->{'staticrangeincrement'};
|
||||
my $netmask = $netentry->{'mask'};
|
||||
my $gateway = $netentry->{'gateway'};
|
||||
my $validipsref;
|
||||
if ($incremental and $startip and $endip){
|
||||
$validipsref = xCAT::NetworkUtils->get_allips_in_range($startip, $endip, $incremental);
|
||||
}
|
||||
|
||||
my $broadcastip = xCAT::NetworkUtils->getBroadcast($startip, $netmask);
|
||||
foreach (@$validipsref){
|
||||
#Remove ip which is broadcast ip, exclude ip, ips ended with 0, gateway ip
|
||||
if (exists($iphash{$_}) or $_ eq $broadcastip or $_ eq $gateway
|
||||
or $_ =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(0)$/){
|
||||
next;
|
||||
if (! exists($iphash{$_})){
|
||||
push @allocableips, $_;
|
||||
}
|
||||
push @allocableips, $_;
|
||||
}
|
||||
return \@allocableips;
|
||||
}
|
||||
@@ -549,7 +542,7 @@ sub get_allnode_singleattrib_hash
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
=head3 get_db_swtiches
|
||||
Description : Get all records of switch config from a table, then return a string list.
|
||||
Arguments : $tabname - the table name.
|
||||
@@ -600,46 +593,6 @@ sub get_db_switchports
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_all_cecs
|
||||
Description : Get all CEC objects name in system.
|
||||
Arguments : hashref: if not set, return a array ref.
|
||||
if set, return a hash ref.
|
||||
Returns : ref for CECs list.
|
||||
Example :
|
||||
my $arrayref = xCAT::ProfiledNodeUtils->get_all_cecs();
|
||||
my $hashref = xCAT::ProfiledNodeUtils->get_all_cecs(1);
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_all_cecs
|
||||
{
|
||||
my $hashref = shift;
|
||||
my %cecshash;
|
||||
my @cecslist;
|
||||
|
||||
my $ppctab = xCAT::Table->new('ppc');
|
||||
my @cecs = $ppctab->getAllAttribsWhere("nodetype = 'cec'", 'node');
|
||||
foreach (@cecs) {
|
||||
if($_->{'node'}) {
|
||||
if ($hashref) {
|
||||
$cecshash{$_->{'node'}} = 1;
|
||||
} else {
|
||||
push @cecslist, $_->{'node'};
|
||||
}
|
||||
}
|
||||
}
|
||||
$ppctab->close();
|
||||
|
||||
# Return the ref accordingly
|
||||
if ($hashref) {
|
||||
return \%cecshash;
|
||||
} else {
|
||||
return \@cecslist;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 is_discover_started
|
||||
Description : Judge whether profiled nodes discovering is running or not.
|
||||
Arguments : NA
|
||||
@@ -798,14 +751,7 @@ sub check_profile_consistent{
|
||||
my $mgt = undef;
|
||||
$mgt = $mgtentry->{'mgt'} if ($mgtentry->{'mgt'});
|
||||
$nodehmtab->close();
|
||||
|
||||
#Get hardwareprofile nodetype
|
||||
my $ppctab = xCAT::Table->new('ppc');
|
||||
my $ntentry = $ppctab->getNodeAttribs($hardwareprofile, ['nodetype']);
|
||||
my $nodetype = undef;
|
||||
$nodetype = $ntentry->{'nodetype'} if ($ntentry->{'nodetype'});
|
||||
$ppctab->close();
|
||||
|
||||
|
||||
# Check if exists provision network
|
||||
if (not ($installnic and exists $netprofile_nicshash{$installnic}{"network"})){
|
||||
return 0, "Provisioning network not defined for network profile."
|
||||
@@ -824,24 +770,17 @@ sub check_profile_consistent{
|
||||
return 0, "$nictype networkprofile must use with hardwareprofile.";
|
||||
}
|
||||
}
|
||||
|
||||
# For nodetype is lpar node, not need to check the nictype as it is not required for lpar node
|
||||
if (not $nictype and $mgt and $nodetype ne 'lpar' ) {
|
||||
# define hardwareprofile, not define fsp or bmc networkprofile, and the node type is not lpar
|
||||
|
||||
if (not $nictype and $mgt) {
|
||||
# define hardwareprofile, not define fsp or bmc networkprofile
|
||||
return 0, "$profile_dict{$mgt} hardwareprofile must use with $profile_dict{$mgt} networkprofile.";
|
||||
}
|
||||
|
||||
if ($profile_dict{$mgt} ne $nictype and $nodetype ne 'lpar') {
|
||||
# Networkprofile's nictype is not consistent with hadrwareprofile's mgt, and the node type is not lpar
|
||||
if ($profile_dict{$mgt} ne $nictype) {
|
||||
# Networkprofile's nictype is not consistent with hadrwareprofile's mgt
|
||||
return 0, "Networkprofile's nictype is not consistent with hardwareprofile's mgt.";
|
||||
}
|
||||
|
||||
if ($nodetype eq 'lpar' and $nictype eq 'FSP')
|
||||
{
|
||||
# can not associate FSP network if the node type is lpar
|
||||
return 0, "The node with hardware type $nodetype can not use with $nictype networkprofile.";
|
||||
}
|
||||
|
||||
|
||||
return 1, "";
|
||||
}
|
||||
|
||||
|
||||
+1
-13
@@ -98,21 +98,13 @@ sub remote_copy_command
|
||||
{
|
||||
if (-e ("/usr/bin/rsync")) {
|
||||
if (($usersh == 0) || ($localhost == 1)) { # using ssh, or local
|
||||
if ($$config{'sudo'}){
|
||||
$sync_opt = '--rsync-path=sudo /usr/bin/rsync ';
|
||||
} else {
|
||||
$sync_opt = '--rsync-path /usr/bin/rsync ';
|
||||
}
|
||||
} else {
|
||||
$sync_opt = '--rsh /bin/rsh --rsync-path /usr/bin/rsync ';
|
||||
}
|
||||
} else {
|
||||
if (($usersh == 0) || ($localhost == 1)) { # using ssh, or local
|
||||
if ($$config{'sudo'}){
|
||||
$sync_opt = '--rsync-path=sudo /usr/local/bin/rsync ';
|
||||
} else {
|
||||
$sync_opt = '--rsync-path=/usr/local/bin/rsync ';
|
||||
}
|
||||
$sync_opt = '--rsync-path /usr/local/bin/rsync ';
|
||||
} else {
|
||||
$sync_opt = '--rsh /bin/rsh --rsync-path /usr/local/bin/rsync ';
|
||||
}
|
||||
@@ -120,11 +112,7 @@ sub remote_copy_command
|
||||
}
|
||||
else #linux
|
||||
{
|
||||
if ($$config{'sudo'}) {
|
||||
$sync_opt = '--rsync-path=\'sudo /usr/bin/rsync\' ';
|
||||
} else {
|
||||
$sync_opt = '--rsync-path /usr/bin/rsync ';
|
||||
}
|
||||
}
|
||||
# if only syncing the service node or
|
||||
# (no postscripts and no append lines) then do not
|
||||
|
||||
@@ -90,7 +90,7 @@ sub dodiscover {
|
||||
}
|
||||
}
|
||||
my $printinfo = join(",", @printip);
|
||||
send_message($args{reqcallback}, 0, "Sending SLP request on interfaces: $printinfo ...") if ($args{reqcallback} and !$args{nomsg} );
|
||||
send_message($args{reqcallback}, 0, "Sending SLP request on interfaces: $printinfo ...") if ($args{reqcallback});
|
||||
foreach my $srvtype (@srvtypes) {
|
||||
send_service_request_single(%args,ifacemap=>$interfaces,SrvType=>$srvtype);
|
||||
}
|
||||
@@ -170,12 +170,12 @@ sub dodiscover {
|
||||
$interval = time() - $startinterval;
|
||||
if ($args{Time} and $args{Count}) {
|
||||
if ($rspcount >= $args{Count} or $interval >= $args{Time}) {
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback} and !$args{nomsg});
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback});
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($sendcount > $retrytime and $rspcount1 == 0) {
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback} and !$args{nomsg});
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback});
|
||||
last;
|
||||
}
|
||||
#########################
|
||||
@@ -184,8 +184,8 @@ sub dodiscover {
|
||||
if ( $interval > $retryinterval){#* (2**$sendcount))) { #double time
|
||||
$sendcount++;
|
||||
$startinterval = time();
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback} and !$args{nomsg});
|
||||
send_message($args{reqcallback}, 0, "Sending SLP request on interfaces: $printinfo ...") if ($args{reqcallback} and !$args{nomsg});
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback});
|
||||
send_message($args{reqcallback}, 0, "Sending SLP request on interfaces: $printinfo ...") if ($args{reqcallback});
|
||||
foreach my $srvtype (@srvtypes) {
|
||||
send_service_request_single(%args,ifacemap=>$interfaces,SrvType=>$srvtype);
|
||||
}
|
||||
|
||||
+46
-247
@@ -61,7 +61,7 @@ statelite => {
|
||||
#seriously evaluate wider support of multi-domain environments, will leave them
|
||||
#commented rather than tempt people to try with an expectation that it could work.
|
||||
domain => {
|
||||
cols => [qw(node ou authdomain adminuser adminpassword type comments disable)],
|
||||
cols => [qw(node ou authdomain comments disable)],
|
||||
keys => ['node'],
|
||||
table_desc => 'Mapping of nodes to domain attributes',
|
||||
descriptions => {
|
||||
@@ -70,9 +70,6 @@ domain => {
|
||||
# the above column is unimplemented by anything, so leave it out for this pass
|
||||
ou => 'For an LDAP described machine account (i.e. Active Directory), the orginaztional unit to place the system. If not set, defaults to cn=Computers,dc=your,dc=domain',
|
||||
authdomain => 'If a node should participate in an AD domain or Kerberos realm distinct from domain indicated in site, this field can be used to specify that',
|
||||
adminuser => 'Allow a node specific indication of Administrative user. Most will want to just use passwd table to indicate this once rather than by node.',
|
||||
adminpassword => 'Allow a node specific indication of Administrative user password for the domain. Most will want to ignore this in favor of passwd table.',
|
||||
type => 'Type, if any, of authentication domain to manipulate. The only recognized value at the moment is activedirectory.',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
@@ -264,25 +261,20 @@ virtsd => {
|
||||
},
|
||||
|
||||
storage => {
|
||||
cols => [qw(node osvolume size state storagepool hypervisor fcprange volumetag comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_descr => 'Node storage resources',
|
||||
descriptions => {
|
||||
node => 'The node name',
|
||||
osvolume => "Specification of what storage to place the node OS image onto. Examples include:
|
||||
localdisk (Install to first non-FC attached disk)
|
||||
usbdisk (Install to first USB mass storage device seen)
|
||||
wwn=0x50000393c813840c (Install to storage device with given WWN)",
|
||||
size => 'Size of the volume. Examples include: 10G, 1024M.',
|
||||
state => 'State of the volume. The valid values are: free, used, and allocated',
|
||||
storagepool => 'Name of storage pool where the volume is assigned.',
|
||||
hypervisor => 'Name of the hypervisor where the volume is configured.',
|
||||
fcprange => 'A range of acceptable fibre channels that the volume can use. Examples include: 3B00-3C00;4B00-4C00.',
|
||||
volumetag => 'A specific tag used to identify the volume in the autoyast or kickstart template.',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
}
|
||||
},
|
||||
cols => [qw(node osvolume comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_descr => "Node storage resources",
|
||||
descriptions => {
|
||||
'node' => 'The node name',
|
||||
osvolume => "Specification of what storage to place the node OS image onto. Examples include:
|
||||
localdisk (Install to first non-FC attached disk)
|
||||
usbdisk (Install to first USB mass storage deice seen)
|
||||
wwn=0x50000393c813840c (Install to storage device with given WWN)
|
||||
WARNING: This is as yet unimplemented by the stock OS deployment templates
|
||||
WARNING: SAS SAN devices may be considered to be 'localdisk' class.
|
||||
The default behavior if unspecified is presumed to be 'localdisk'",
|
||||
}
|
||||
},
|
||||
websrv => {
|
||||
cols => [qw(node port username password comments disable)],
|
||||
keys => [qw(node)],
|
||||
@@ -346,7 +338,7 @@ chain => {
|
||||
node => 'The node name or group name.',
|
||||
currstate => 'The current or next chain step to be executed on this node by xCAT-genesis. Set by xCAT during node discovery or as a result of nodeset.',
|
||||
currchain => 'The chain steps still left to do for this node. This attribute will be automatically adjusted by xCAT while xCAT-genesis is running on the node (either during node discovery or a special operation like firmware update). During node discovery, this attribute is initialized from the chain attribute and updated as the chain steps are executed.',
|
||||
chain => 'A comma-delimited chain of actions to be performed automatically when this node is discovered. ("Discovered" means a node booted, but xCAT and DHCP did not recognize the MAC of this node. In this situation, xCAT initiates the discovery process, the last step of which is to run the operations listed in this chain attribute, one by one.) Valid values: boot or reboot, install or netboot, runcmd=<cmd>, runimage=<URL>, shell, standby. (Default - same as no chain - it will do only the discovery.). Example, for BMC machines use: runcmd=bmcsetup,shell.',
|
||||
chain => 'A comma-delimited chain of actions to be performed automatically when this node is discovered. ("Discovered" means a node booted, but xCAT and DHCP did not recognize the MAC of this node. In this case, xCAT initiates the discovery process, the last step of which is to run the operations listed in this chain attribute.) Valid values: discover, boot or reboot, install or netboot, runcmd=<cmd>, runimage=<URL>, shell, standby. (Default - same as no chain). Example, for BMC machines use: runcmd=bmcsetup,shell.',
|
||||
ondiscover => 'This attribute is currently not used by xCAT. The "nodediscover" operation is always done during node discovery.',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
@@ -564,7 +556,7 @@ nodelist => {
|
||||
appstatustime =>'The date and time when appstatus was updated.',
|
||||
primarysn => 'Not used currently. The primary servicenode, used by this node.',
|
||||
hidden => "Used to hide fsp and bpa definitions, 1 means not show them when running lsdef and nodels",
|
||||
updatestatus => "The current node update status. Valid states are synced out-of-sync,syncing,failed.",
|
||||
updatestatus => "The current node update status. Valid states are synced and out-of-sync.",
|
||||
updatestatustime => "The date and time when the updatestatus was updated.",
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
@@ -588,7 +580,7 @@ nodepos => {
|
||||
},
|
||||
},
|
||||
noderes => {
|
||||
cols => [qw(node servicenode netboot tftpserver tftpdir nfsserver monserver nfsdir installnic primarynic discoverynics cmdinterface xcatmaster current_osimage next_osimage nimserver routenames nameservers comments disable)],
|
||||
cols => [qw(node servicenode netboot tftpserver tftpdir nfsserver monserver nfsdir installnic primarynic discoverynics cmdinterface xcatmaster current_osimage next_osimage nimserver routenames comments disable)],
|
||||
keys => [qw(node)],
|
||||
tablespace =>'XCATTBS16K',
|
||||
table_desc => 'Resources and settings to use when installing nodes.',
|
||||
@@ -610,7 +602,6 @@ noderes => {
|
||||
next_osimage => 'Not currently used. The name of the osimage data object that represents the OS image that will be installed on the node the next time it is deployed.',
|
||||
nimserver => 'Not used for now. The NIM server for this node (as known by this node).',
|
||||
routenames => 'A comma separated list of route names that refer to rows in the routes table. These are the routes that should be defined on this node when it is deployed.',
|
||||
nameservers => 'An optional node/group specific override for name server list. Most people want to stick to site or network defined nameserver configuration.',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
@@ -677,7 +668,7 @@ osimage => {
|
||||
groups => 'A comma-delimited list of image groups of which this image is a member. Image groups can be used in the litefile and litetree table instead of a single image name. Group names are arbitrary.',
|
||||
imagetype => 'The type of operating system image this definition represents (linux,AIX).',
|
||||
description => 'OS Image Description',
|
||||
provmethod => 'The provisioning method for node deployment. The valid values are install, netboot,statelite,boottarget,dualboot,sysclone. If boottarget is set, you must set linuximage.boottarget to the name of the boottarget definition. It is not used by AIX.',
|
||||
provmethod => 'The provisioning method for node deployment. The valid values are install, netboot,statelite,boottarget,dualboot. If boottarget is set, you must set linuximage.boottarget to the name of the boottarget definition. It is not used by AIX.',
|
||||
rootfstype => 'The filesystem type for the rootfs is used when the provmethod is statelite. The valid values are nfs or ramdisk. The default value is nfs',
|
||||
osdistroname => 'The name of the OS distro definition. This attribute can be used to specify which OS distro to use, instead of using the osname,osvers,and osarch attributes.',
|
||||
osupdatename => 'A comma-separated list of OS distro updates to apply to this osimage.',
|
||||
@@ -706,8 +697,8 @@ linuximage => {
|
||||
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',
|
||||
pkgdir => 'The name of the directory where the distro packages are stored. It could be set multiple paths.The multiple paths must be seperated by ",". The first path in the value of osimage.pkgdir must be the OS base pkg dir path, such as pkgdir=/install/rhels6.2/x86_64,/install/updates . In the os base pkg path, there are default repository data. And in the other pkg path(s), the users should make sure there are repository data. If not, use "createrepo" command to create them. ',
|
||||
pkglist => 'The fully qualified name of the file that stores the distro packages list that will be included in the image.',
|
||||
pkgdir => 'The name of the directory where the distro packages are stored.',
|
||||
otherpkglist => 'The fully qualified name of the file that stores non-distro package lists that will be included in the image.',
|
||||
otherpkgdir => 'The base directory where the non-distro packages are stored.',
|
||||
exlist => 'The fully qualified name of the file that stores the file names and directory names that will be excluded from the image during packimage command. It is used for diskless image only.',
|
||||
@@ -749,10 +740,10 @@ policy => {
|
||||
descriptions => {
|
||||
priority => 'The priority value for this rule. This value is used to identify this policy data object (i.e. this rule).',
|
||||
name => 'The username that is allowed to perform the commands specified by this rule. Default is "*" (all users).',
|
||||
host => 'The host from which users may issue the commands specified by this rule. Default is "*" (all hosts). Only all or one host supported. ',
|
||||
host => 'The host from which users may issue the commands specified by this rule. Default is "*" (all hosts).',
|
||||
commands => 'The list of commands that this rule applies to. Default is "*" (all commands).',
|
||||
noderange => 'The Noderange that this rule applies to. Default is "*" (all nodes). Not supported with the *def commands.',
|
||||
parameters => 'A regular expression that matches the command parameters (everything except the noderange) that this rule applies to. Default is "*" (all parameters). Not supported with the *def commands.',
|
||||
noderange => 'The Noderange that this rule applies to. Default is "*" (all nodes).',
|
||||
parameters => 'A regular expression that matches the command parameters (everything except the noderange) that this rule applies to. Default is "*" (all parameters).',
|
||||
time => 'Time ranges that this command may be executed in. This is not supported.',
|
||||
rule => 'Specifies how this rule should be applied. Valid values are: allow, accept, trusted. Allow or accept will allow the user to run the commands. Any other value will deny the user access to the commands. Trusted means that once this client has been authenticated via the certificate, all other information that is sent (e.g. the username) is believed without question. This authorization should only be given to the xcatd on the management node at this time.',
|
||||
comments => 'Any user-written notes.',
|
||||
@@ -819,7 +810,6 @@ ppchcp => {
|
||||
servicenode => {
|
||||
cols => [qw(node nameserver dhcpserver tftpserver nfsserver conserver monserver ldapserver ntpserver ftpserver nimserver ipforward dhcpinterfaces comments disable)],
|
||||
keys => [qw(node)],
|
||||
tablespace =>'XCATTBS16K',
|
||||
table_desc => 'List of all Service Nodes and services that will be set up on the Service Node.',
|
||||
descriptions => {
|
||||
node => 'The hostname of the service node as known by the Management Node.',
|
||||
@@ -899,7 +889,7 @@ site => {
|
||||
" failed nodes for any xCAT commands. See the 'noderange' manpage for\n".
|
||||
" details on supported formats.\n\n".
|
||||
" forwarders: The DNS servers at your site that can provide names outside of the\n".
|
||||
" cluster. The makedns command will configure the DNS on the management\n".
|
||||
" cluster. The makedns command will configuire the DNS on the management\n".
|
||||
" node to forward requests it does not know to these servers.\n".
|
||||
" Note that the DNS servers on the service nodes will ignore this value\n".
|
||||
" and always be configured to forward requests to the management node.\n\n".
|
||||
@@ -984,7 +974,7 @@ site => {
|
||||
" ppctimeout: The timeout, in milliseconds, to use when communicating with PPC hw\n".
|
||||
" through HMC. It only takes effect on the hardware control commands\n".
|
||||
" through HMC. Default is 0.\n\n".
|
||||
" precreatemypostscripts: (yes/1 or no/0). Default is no. If yes, it will \n".
|
||||
" precreatemypostscripts: (yes/1 or no/0, only for Linux).Default is no. If yes, it will \n".
|
||||
" instruct xCAT at nodeset and updatenode time to query the db once for\n".
|
||||
" all of the nodes passed into the cmd and create the mypostscript file\n".
|
||||
" for each node, and put them in a directory of tftpdir(such as: /tftpboot)\n".
|
||||
@@ -1024,7 +1014,7 @@ site => {
|
||||
" useNmapfromMN: When set to yes, nodestat command should obtain the node status\n".
|
||||
" using nmap (if available) from the management node instead of the\n".
|
||||
" service node. This will improve the performance in a flat network.\n\n".
|
||||
" useSSHonAIX: (yes/1 or no/0). If yes, ssh/scp will be setup and used. If no, rsh/rcp. The support for rsh/rcp is deprecated.\n".
|
||||
" useSSHonAIX: (yes/1 or no/0). If yes, ssh/scp will be setup and used. If no,\n".
|
||||
" usexhrm: Have xCAT run its xHRM script when booting up KVM guests to set the\n".
|
||||
" virtual network bridge up correctly. See\n".
|
||||
" https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Virtualization_with_KVM#Setting_up_a_network_bridge\n\n".
|
||||
@@ -1048,8 +1038,6 @@ site => {
|
||||
" and node requests, e.g. to get postscripts. Default is 64.\n\n".
|
||||
" xcatdport: The port used by the xcatd daemon for client/server communication.\n\n".
|
||||
" xcatiport: The port used by xcatd to receive install status updates from nodes.\n\n",
|
||||
" xcatsslversion: The ssl version by xcatd. Default is SSLv3.\n\n",
|
||||
" xcatsslciphers: The ssl cipher by xcatd. Default is 3DES.\n\n",
|
||||
value => 'The value of the attribute specified in the "key" column.',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
@@ -1228,7 +1216,7 @@ routes => {
|
||||
routename => 'Name used to identify this route.',
|
||||
net => 'The network address.',
|
||||
mask => 'The network mask.',
|
||||
ifname => 'The interface name that facing the gateway. It is optional for IPv4 routes, but it is required for IPv6 routes.',
|
||||
ifname => '(optional) The interface name of the management node facing the gateway.',
|
||||
gateway => 'The gateway that routes the ip traffic from the mn to the nodes. It is usually a service node.',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
@@ -1273,27 +1261,29 @@ nics => {
|
||||
nicips => 'Comma-separated list of IP addresses per NIC. To specify one ip address per NIC:
|
||||
<nic1>!<ip1>,<nic2>!<ip2>,..., for example, eth0!10.0.0.100,ib0!11.0.0.100
|
||||
To specify multiple ip addresses per NIC:
|
||||
<nic1>!<ip1>|<ip2>,<nic2>!<ip1>|<ip2>,..., for example, eth0!10.0.0.100|fd55::214:5eff:fe15:849b,ib0!11.0.0.100|2001::214:5eff:fe15:849a. The xCAT object definition commands support to use nicips.<nicname> as the sub attributes.
|
||||
<nic1>!<ip1>|<ip2>,<nic2>!<ip1>|<ip2>,..., for example, eth0!10.0.0.100|fd55::214:5eff:fe15:849b,ib0!11.0.0.100|2001::214:5eff:fe15:849a
|
||||
Note: The primary IP address must also be stored in the hosts.ip attribute. The nichostnamesuffixes should specify one hostname suffix for each ip address.',
|
||||
nichostnamesuffixes => 'Comma-separated list of hostname suffixes per NIC.
|
||||
If only one ip address is associated with each NIC:
|
||||
<nic1>!<ext1>,<nic2>!<ext2>,..., for example, eth0!-eth0,ib0!-ib0
|
||||
If multiple ip addresses are associcated with each NIC:
|
||||
<nic1>!<ext1>|<ext2>,<nic2>!<ext1>|<ext2>,..., for example, eth0!-eth0|-eth0-ipv6,ib0!-ib0|-ib0-ipv6.
|
||||
The xCAT object definition commands support to use nichostnamesuffixes.<nicname> as the sub attributes.
|
||||
Note: According to DNS rules a hostname must be a text string up to 24 characters drawn from the alphabet (A-Z), digits (0-9), minus sign (-),and period (.). When you are specifying "nichostnamesuffixes" or "nicaliases" make sure the resulting hostnames will conform to this naming convention',
|
||||
nictypes => 'Comma-separated list of NIC types per NIC. <nic1>!<type1>,<nic2>!<type2>, e.g. eth0!Ethernet,ib0!Infiniband. The xCAT object definition commands support to use nictypes.<nicname> as the sub attributes.',
|
||||
niccustomscripts => 'Comma-separated list of custom scripts per NIC. <nic1>!<script1>,<nic2>!<script2>, e.g. eth0!configeth eth0, ib0!configib ib0. The xCAT object definition commands support to use niccustomscripts.<nicname> as the sub attribute
|
||||
<nic1>!<ext1>|<ext2>,<nic2>!<ext1>|<ext2>,..., for example, eth0!-eth0|-eth0-ipv6,ib0!-ib0|-ib0-ipv6.',
|
||||
nictypes => 'Comma-separated list of NIC types per NIC. <nic1>!<type1>,<nic2>!<type2>, e.g. eth0!Ethernet,ib0!Infiniband',
|
||||
niccustomscripts => 'Comma-separated list of custom scripts per NIC. <nic1>!<script1>,<nic2>!<script2>, e.g. eth0!configeth eth0, ib0!configib ib0
|
||||
.',
|
||||
nicnetworks => 'Comma-separated list of networks connected to each NIC.
|
||||
If only one ip address is associated with each NIC:
|
||||
<nic1>!<network1>,<nic2>!<network2>, for example, eth0!10_0_0_0-255_255_0_0, ib0!11_0_0_0-255_255_0_0
|
||||
If multiple ip addresses are associated with each NIC:
|
||||
<nic1>!<network1>|<network2>,<nic2>!<network1>|<network2>, for example, eth0!10_0_0_0-255_255_0_0|fd55:faaf:e1ab:336::/64,ib0!11_0_0_0-255_255_0_0|2001:db8:1:0::/64. The xCAT object definition commands support to use nicnetworks.<nicname> as the sub attributes.',
|
||||
nicaliases => 'Comma-separated list of hostname aliases for each NIC.
|
||||
Format: eth0!<alias list>,eth1!<alias1 list>|<alias2 list>
|
||||
For multiple aliases per nic use a space-separated list.
|
||||
For example: eth0!moe larry curly,eth1!tom|jerry',
|
||||
<nic1>!<network1>|<network2>,<nic2>!<network1>|<network2>, for example, eth0!10_0_0_0-255_255_0_0|fd55:faaf:e1ab:336::/64,ib0!11_0_0_0-255_255_0_0|2001:db8:1:0::/64
|
||||
',
|
||||
nicaliases => 'NOT YET IMPLEMENTED.
|
||||
|
||||
Comma-separated list of aliases for each NIC.
|
||||
|
||||
Format: eth0!<alias>,eth1!<alias1>|<alias2>
|
||||
For example: eth0!moe,eth1!larry|curly',
|
||||
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
@@ -1342,7 +1332,7 @@ osdistroupdate => {
|
||||
},
|
||||
},
|
||||
kit => {
|
||||
cols => [qw(kitname basename description version release ostype isinternal kitdeployparams kitdir comments disable)],
|
||||
cols => [qw(kitname basename description version ostype isinternal kitdeployparams kitdir comments disable)],
|
||||
keys => [qw(kitname)],
|
||||
table_desc => 'This table stores all kits added to the xCAT cluster.',
|
||||
descriptions => {
|
||||
@@ -1350,7 +1340,6 @@ kit => {
|
||||
basename => 'The kit base name',
|
||||
description => 'The Kit description.',
|
||||
version => 'The kit version',
|
||||
release => 'The kit release',
|
||||
ostype => 'The kit OS type. Linux or AIX.',
|
||||
isinternal => 'A flag to indicated if the Kit is internally used. When set to 1, the Kit is internal. If 0 or undefined, the kit is not internal.',
|
||||
kitdeployparams => 'The file containing the default deployment parameters for this Kit. These parameters are added to the OS Image definition.s list of deployment parameters when one or more Kit Components from this Kit are added to the OS Image.',
|
||||
@@ -1377,7 +1366,7 @@ kitrepo => {
|
||||
},
|
||||
},
|
||||
kitcomponent => {
|
||||
cols => [qw(kitcompname description kitname kitreponame basename version release serverroles kitpkgdeps prerequisite driverpacks kitcompdeps postbootscripts genimage_postinstall exlist comments disable)],
|
||||
cols => [qw(kitcompname description kitname kitreponame basename version release serverroles kitpkgdeps driverpacks kitcompdeps postbootscripts genimage_postinstall exlist comments disable)],
|
||||
keys => [qw(kitcompname)],
|
||||
tablespace =>'XCATTBS16K',
|
||||
table_desc => 'This table stores all kit components added to the xCAT cluster.',
|
||||
@@ -1391,7 +1380,6 @@ kitcomponent => {
|
||||
release => 'Kit Component release.',
|
||||
serverroles => 'The types of servers that this Kit Component can install on. Valid types are: mgtnode, servicenode, compute',
|
||||
kitpkgdeps => 'Comma-separated list of packages that this kit component depends on.',
|
||||
prerequisite => 'Prerequisite for this kit component, the prerequisite includes ospkgdeps,preinstall,preupgrade,preuninstall scripts',
|
||||
driverpacks => 'Comma-separated List of driver package names. These must be full names like: pkg1-1.0-1.x86_64.rpm.',
|
||||
kitcompdeps => 'Comma-separated list of kit components that this kit component depends on.',
|
||||
postbootscripts => 'Comma-separated list of postbootscripts that will run during the node boot.',
|
||||
@@ -1401,72 +1389,6 @@ kitcomponent => {
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
discoverydata => {
|
||||
cols => [qw(uuid node method discoverytime arch cpucount cputype memory mtm serial nicdriver nicipv4 nichwaddr nicpci nicloc niconboard nicfirm switchname switchaddr switchdesc switchport otherdata comments disable)],
|
||||
keys => [qw(uuid)],
|
||||
tablespace =>'XCATTBS32K',
|
||||
table_desc => 'Discovery data which sent from genesis.',
|
||||
types => {
|
||||
otherdata => 'VARCHAR(2048)',
|
||||
},
|
||||
descriptions => {
|
||||
uuid => 'The uuid of the node which send out the discovery request.',
|
||||
node => 'The node name which assigned to the discovered node.',
|
||||
method => 'The method which handled the discovery request. The method could be one of: switch, blade, profile, sequential.',
|
||||
discoverytime => 'The last time that xCAT received the discovery message.',
|
||||
arch => 'The architecture of the discovered node. e.g. x86_64.',
|
||||
cpucount => 'The cpu number of the discovered node. e.g. 32.',
|
||||
cputype => 'The cpu type of the discovered node. e.g. Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz',
|
||||
memory => 'The memory size of the discovered node. e.g. 198460852',
|
||||
mtm => 'The machine type model of the discovered node. e.g. 786310X',
|
||||
serial => 'The serial number of the discovered node. e.g. 1052EFB',
|
||||
nicdriver => 'The driver of the nic. The value should be comma separated <nic name!driver name>. e.g. eth0!be2net,eth1!be2net',
|
||||
nicipv4 => 'The ipv4 address of the nic. The value should be comma separated <nic name!ipv4 address>. e.g. eth0!10.0.0.212/8',
|
||||
nichwaddr => 'The hardware address of the nic. The should will be comma separated <nic name!hardware address>. e.g. eth0!34:40:B5:BE:DB:B0,eth1!34:40:B5:BE:DB:B4',
|
||||
nicpci => 'The pic device of the nic. The value should be comma separated <nic name!pci device>. e.g. eth0!0000:0c:00.0,eth1!0000:0c:00.1',
|
||||
nicloc => 'The location of the nic. The value should be comma separated <nic name!nic location>. e.g. eth0!Onboard Ethernet 1,eth1!Onboard Ethernet 2',
|
||||
niconboard => 'The onboard info of the nic. The value should be comma separated <nic name!onboard info>. e.g. eth0!1,eth1!2',
|
||||
nicfirm => 'The firmware description of the nic. The value should be comma separated <nic name!fimware description>. e.g. eth0!ServerEngines BE3 Controller,eth1!ServerEngines BE3 Controller',
|
||||
switchname => 'The switch name which the nic connected to. The value should be comma separated <nic name!switch name>. e.g. eth0!c909f06sw01',
|
||||
switchaddr => 'The address of the switch which the nic connected to. The value should be comma separated <nic name!switch address>. e.g. eth0!192.168.70.120',
|
||||
switchdesc => 'The description of the switch which the nic connected to. The value should be comma separated <nic name!switch description>. e.g. eth0!IBM Flex System Fabric EN4093 10Gb Scalable Switch, flash image: version 7.2.6, boot image: version 7.2.6',
|
||||
switchport => 'The port of the switch that the nic connected to. The value should be comma separated <nic name!switch port>. e.g. eth0!INTA2',
|
||||
otherdata => 'The left data which is not parsed to specific attributes (The complete message comes from genesis)',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
cfgmgt => {
|
||||
cols => [qw(node cfgmgr cfgserver roles comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'Configuration management data for nodes used by non-xCAT osimage management services to install and configure software on a node. ',
|
||||
descriptions => {
|
||||
node => 'The node being managed by the cfgmgr service',
|
||||
cfgmgr => 'The name of the configuration manager service. Currently \'chef\' and \'puppet\' are supported services.',
|
||||
cfgserver => 'The xCAT node name of the chef server or puppet master',
|
||||
roles => 'The roles associated with this node as recognized by the cfgmgr for the software that is to be installed and configured. These role names map to chef recipes or puppet manifest classes that should be used for this node. For example, chef OpenStack cookbooks have roles such as mysql-master,keystone, glance, nova-controller, nova-conductor, cinder-all. ',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
mic => {
|
||||
cols => [qw(node host id nodetype bridge onboot vlog comments disable)],
|
||||
keys => [qw(node)],
|
||||
table_desc => 'The host, slot id and configuraton of the mic (Many Integrated Core).',
|
||||
descriptions => {
|
||||
node => 'The node name or group name.',
|
||||
host => 'The host node which the mic card installed on.',
|
||||
id => 'The device id of the mic node.',
|
||||
nodetype => 'The hardware type of the mic node. Generally, it is mic.',
|
||||
bridge => 'The virtual bridge on the host node which the mic connected to.',
|
||||
onboot => 'Set mic to autoboot when mpss start. Valid values: yes|no. Default is yes.',
|
||||
vlog => 'Set the Verbose Log to console. Valid values: yes|no. Default is no.',
|
||||
comments => 'Any user-provided notes.',
|
||||
disable => "Do not use. tabprune will not work if set to yes or 1",
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
); # end of tabspec definition
|
||||
|
||||
|
||||
@@ -1543,8 +1465,6 @@ foreach my $tabname (keys(%xCAT::ExtTab::ext_tabspec)) {
|
||||
kitcomponent => { attrs => [], attrhash => {}, objkey => 'kitcompname' },
|
||||
rack => { attrs => [], attrhash => {}, objkey => 'rackname' },
|
||||
osdistro=> { attrs => [], attrhash => {}, objkey => 'osdistroname' },
|
||||
osdistroupdate=> { attrs => [], attrhash => {}, objkey => 'osupdatename' },
|
||||
|
||||
);
|
||||
|
||||
|
||||
@@ -1645,10 +1565,6 @@ my @nodeattrs = (
|
||||
{attr_name => 'netboot',
|
||||
tabentry => 'noderes.netboot',
|
||||
access_tabentry => 'noderes.node=attr:node',
|
||||
},
|
||||
{attr_name => 'nameservers',
|
||||
tabentry => 'noderes.nameservers',
|
||||
access_tabentry => 'noderes.node=attr:node',
|
||||
},
|
||||
{attr_name => 'routenames',
|
||||
tabentry => 'noderes.routenames',
|
||||
@@ -1965,11 +1881,6 @@ my @nodeattrs = (
|
||||
tabentry => 'mp.nodetype',
|
||||
access_tabentry => 'mp.node=attr:node',
|
||||
},
|
||||
{attr_name => 'hwtype',
|
||||
only_if => 'mgt=ipmi',
|
||||
tabentry => 'mp.nodetype',
|
||||
access_tabentry => 'mp.node=attr:node',
|
||||
},
|
||||
{attr_name => 'supernode',
|
||||
tabentry => 'ppc.supernode',
|
||||
access_tabentry => 'ppc.node=attr:node',
|
||||
@@ -2088,7 +1999,7 @@ my @nodeattrs = (
|
||||
tabentry => 'mp.id',
|
||||
access_tabentry => 'mp.node=attr:node',
|
||||
},
|
||||
{attr_name => 'slotid',
|
||||
{attr_name => 'id',
|
||||
only_if => 'mgt=ipmi',
|
||||
tabentry => 'mp.id',
|
||||
access_tabentry => 'mp.node=attr:node',
|
||||
@@ -2178,36 +2089,6 @@ my @nodeattrs = (
|
||||
access_tabentry => 'nics.node=attr:node',
|
||||
},
|
||||
######################
|
||||
# prodkey table #
|
||||
######################
|
||||
{attr_name => 'productkey',
|
||||
tabentry => 'prodkey.key',
|
||||
access_tabentry => 'prodkey.node=attr:node',
|
||||
},
|
||||
######################
|
||||
# domain table #
|
||||
######################
|
||||
{attr_name => 'ou',
|
||||
tabentry => 'domain.ou',
|
||||
access_tabentry => 'domain.node=attr:node',
|
||||
},
|
||||
{attr_name => 'domainadminuser',
|
||||
tabentry => 'domain.adminuser',
|
||||
access_tabentry => 'domain.node=attr:node',
|
||||
},
|
||||
{attr_name => 'domainadminpassword',
|
||||
tabentry => 'domain.adminpassword',
|
||||
access_tabentry => 'domain.node=attr:node',
|
||||
},
|
||||
{attr_name => 'authdomain',
|
||||
tabentry => 'domain.authdomain',
|
||||
access_tabentry => 'domain.node=attr:node',
|
||||
},
|
||||
{attr_name => 'domaintype',
|
||||
tabentry => 'domain.type',
|
||||
access_tabentry => 'domain.node=attr:node',
|
||||
},
|
||||
######################
|
||||
# storage table #
|
||||
######################
|
||||
{attr_name => 'osvolume',
|
||||
@@ -2367,55 +2248,6 @@ my @nodeattrs = (
|
||||
tabentry => 'prescripts.end',
|
||||
access_tabentry => 'prescripts.node=attr:node',
|
||||
},
|
||||
#################
|
||||
# cfgmgt table #
|
||||
#################
|
||||
{attr_name => 'cfgmgr',
|
||||
tabentry => 'cfgmgt.cfgmgr',
|
||||
access_tabentry => 'cfgmgt.node=attr:node',
|
||||
},
|
||||
{attr_name => 'cfgserver',
|
||||
tabentry => 'cfgmgt.cfgserver',
|
||||
access_tabentry => 'cfgmgt.node=attr:node',
|
||||
},
|
||||
{attr_name => 'cfgmgtroles',
|
||||
tabentry => 'cfgmgt.roles',
|
||||
access_tabentry => 'cfgmgt.node=attr:node',
|
||||
},
|
||||
#####################
|
||||
## mic table #
|
||||
#####################
|
||||
{attr_name => 'michost',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.host',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'micid',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.id',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'hwtype',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.nodetype',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'micbridge',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.bridge',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'miconboot',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.onboot',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
{attr_name => 'micvlog',
|
||||
only_if => 'mgt=mic',
|
||||
tabentry => 'mic.vlog',
|
||||
access_tabentry => 'mic.node=attr:node',
|
||||
},
|
||||
|
||||
); # end of @nodeattrs that applies to both nodes and groups
|
||||
|
||||
|
||||
@@ -3261,35 +3093,6 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
},
|
||||
);
|
||||
|
||||
#############################
|
||||
# osdistroupdate object #
|
||||
#############################
|
||||
@{$defspec{osdistroupdate}->{'attrs'}} = (
|
||||
{attr_name => 'osupdatename',
|
||||
tabentry => 'osdistroupdate.osupdatename',
|
||||
access_tabentry => 'osdistroupdate.osupdatename=attr:osupdatename',
|
||||
},
|
||||
{attr_name => 'osdistroname',
|
||||
tabentry => 'osdistroupdate.osdistroname',
|
||||
access_tabentry => 'osdistroupdate.osupdatename=attr:osupdatename',
|
||||
},
|
||||
{attr_name => 'dirpath',
|
||||
tabentry => 'osdistroupdate.dirpath',
|
||||
access_tabentry => 'osdistroupdate.osupdatename=attr:osupdatename',
|
||||
},
|
||||
{attr_name => 'downloadtime',
|
||||
tabentry => 'osdistroupdate.downloadtime',
|
||||
access_tabentry => 'osdistroupdate.osupdatename=attr:osupdatename',
|
||||
},
|
||||
{attr_name => 'usercomment',
|
||||
tabentry => 'osdistroupdate.comments',
|
||||
access_tabentry => 'osdistroupdate.osupdatename=attr:osupdatename',
|
||||
},
|
||||
);
|
||||
|
||||
#############################
|
||||
# kit object #
|
||||
#############################
|
||||
#############################
|
||||
# kit object #
|
||||
#############################
|
||||
@@ -3300,8 +3103,8 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
tabentry => 'kit.kitname',
|
||||
access_tabentry => 'kit.kitname=attr:kitname',
|
||||
},
|
||||
{attr_name => 'basename',
|
||||
tabentry => 'kit.basename',
|
||||
{attr_name => 'name',
|
||||
tabentry => 'kit.name',
|
||||
access_tabentry => 'kit.kitname=attr:kitname',
|
||||
},
|
||||
{attr_name => 'description',
|
||||
@@ -3312,10 +3115,6 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
tabentry => 'kit.version',
|
||||
access_tabentry => 'kit.kitname=attr:kitname',
|
||||
},
|
||||
{attr_name => 'release',
|
||||
tabentry => 'kit.release',
|
||||
access_tabentry => 'kit.kitname=attr:kitname',
|
||||
},
|
||||
{attr_name => 'ostype',
|
||||
tabentry => 'kit.ostype',
|
||||
access_tabentry => 'kit.kitname=attr:kitname',
|
||||
|
||||
@@ -28,7 +28,7 @@ use strict;
|
||||
Input: service nodename
|
||||
Output: Masternode, OS and ARCH
|
||||
Example:
|
||||
my $retdata = xCAT::ServiceNodeUtils->readSNInfo;
|
||||
xCAT::ServiceNodeUtils->readSNInfo;
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -81,18 +81,18 @@ sub readSNInfo
|
||||
|
||||
Checks the service node table in the database to see
|
||||
if input Service should be setup on the
|
||||
input service node or Management Node (used by AAsn.pm)
|
||||
input service node
|
||||
|
||||
Input:servicenodename,ipaddres(s) and hostnames of service node
|
||||
Output:
|
||||
hash of services to setup for this service node
|
||||
array of services to setup for this service node
|
||||
Globals:
|
||||
$::RUNCMD_RC = 0; good
|
||||
$::RUNCMD_RC = 1; error
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
$servicestosetup=xCAT::ServiceNodeUtils->isServiceReq($servicenodename, @serviceip) { blah; }
|
||||
@servicestosetup=xCAT::ServiceNodeUtils->isServiceReq($servicenodename, @serviceip) { blah; }
|
||||
|
||||
=cut
|
||||
|
||||
@@ -131,14 +131,8 @@ sub isServiceReq
|
||||
return; # do not setup anything
|
||||
}
|
||||
|
||||
# Are we on the MN
|
||||
my $mname;
|
||||
if (xCAT::Utils->isMN()) {
|
||||
my @nodeinfo = xCAT::NetworkUtils->determinehostname;
|
||||
$mname = pop @nodeinfo; # get hostname
|
||||
}
|
||||
my @process_service_list = ();
|
||||
|
||||
my $servicehash;
|
||||
# read all the nodes from the table, for each service
|
||||
foreach my $service (@services)
|
||||
{
|
||||
@@ -158,36 +152,18 @@ sub isServiceReq
|
||||
# value 1 or yes then we setup the service
|
||||
if (($value eq "1") || ($value eq "YES"))
|
||||
{
|
||||
$servicehash->{$service} = "1";
|
||||
} else {
|
||||
$servicehash->{$service} = "0";
|
||||
push @process_service_list,
|
||||
$service; # found service to setup
|
||||
}
|
||||
}
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
# if the ftpserver attribute is not defined in the service node table
|
||||
# and we are on
|
||||
# the Linux management node, we need to look at site.vsftp
|
||||
# if the tftpserver attribute is not defined, then we default it 1
|
||||
if (($mname) && (xCAT::Utils->isLinux())) {
|
||||
if (!exists($servicehash->{'ftpserver'})) {
|
||||
my @tmp = xCAT::TableUtils->get_site_attribute("vsftp");
|
||||
if ($tmp[0] && ($tmp[0] !~ /0|NO|No|no|N|n/ )) {
|
||||
$servicehash->{'ftpserver'} = 1;
|
||||
}
|
||||
}
|
||||
if (!exists($servicehash->{'tftpserver'})) {
|
||||
$servicehash->{'tftpserver'} = 1;
|
||||
}
|
||||
}
|
||||
$servicenodetab->close;
|
||||
|
||||
$::RUNCMD_RC = 0;
|
||||
return $servicehash;
|
||||
return @process_service_list;
|
||||
|
||||
}
|
||||
|
||||
@@ -238,13 +214,12 @@ sub getAllSN
|
||||
# if did not input "ALL" and there is a MN, remove it
|
||||
my @newservicenodes;
|
||||
if ((!defined($options)) || ($options ne "ALL")) {
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@servicenodes);
|
||||
if (@mname) { # if there is a MN
|
||||
foreach my $node (@servicenodes) {
|
||||
# check to see if node in MN list
|
||||
if (!(grep(/^$node$/, @mname))) { # if node not in the MN array
|
||||
push @newservicenodes, $node;
|
||||
}
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@servicenodes);
|
||||
if ($mname) { # if there is a MN
|
||||
foreach my $nodes (@servicenodes) {
|
||||
if ($mname ne ($nodes)){
|
||||
push @newservicenodes, $nodes;
|
||||
}
|
||||
}
|
||||
$servicenodetab->close;
|
||||
return @newservicenodes; # return without the MN in the array
|
||||
|
||||
+102
-39
@@ -36,7 +36,7 @@
|
||||
package xCAT::Table;
|
||||
use xCAT::MsgUtils;
|
||||
use Sys::Syslog;
|
||||
use Storable qw/freeze thaw store_fd fd_retrieve/;
|
||||
use Storable qw/freeze thaw/;
|
||||
use IO::Socket;
|
||||
#use Data::Dumper;
|
||||
use POSIX qw/WNOHANG/;
|
||||
@@ -70,7 +70,7 @@ require xCAT::NotifHandler;
|
||||
|
||||
my $dbworkerpid; #The process id of the database worker
|
||||
my $dbworkersocket;
|
||||
my $dbsockpath = "/var/run/xcat/dbworker.sock.".$$;
|
||||
my $dbsockpath = "/tmp/xcat/dbworker.sock.".$$;
|
||||
my $exitdbthread;
|
||||
my $dbobjsforhandle;
|
||||
my $intendedpid;
|
||||
@@ -92,6 +92,8 @@ sub dbc_call {
|
||||
sub dbc_submit {
|
||||
my $request = shift;
|
||||
$request->{'wantarray'} = wantarray();
|
||||
my $data = freeze($request);
|
||||
$data.= "\nENDOFFREEZEQFVyo4Cj6Q0v\n";
|
||||
my $clisock;
|
||||
my $tries=300;
|
||||
while($tries and !($clisock = IO::Socket::UNIX->new(Peer => $dbsockpath, Type => SOCK_STREAM, Timeout => 120) ) ) {
|
||||
@@ -103,20 +105,22 @@ sub dbc_submit {
|
||||
use Carp qw/cluck/;
|
||||
cluck();
|
||||
}
|
||||
store_fd($request,$clisock);
|
||||
#print $clisock $data;
|
||||
my $data="";
|
||||
print $clisock $data;
|
||||
$data="";
|
||||
my $lastline="";
|
||||
my $retdata = fd_retrieve($clisock);
|
||||
while (read($clisock,$lastline,32768)) { #$lastline ne "ENDOFFREEZEQFVyo4Cj6Q0j\n" and $lastline ne "*XCATBUGDETECTED*76e9b54341\n") { #index($lastline,"ENDOFFREEZEQFVyo4Cj6Q0j") < 0) {
|
||||
# $lastline = <$clisock>;
|
||||
$data .= $lastline;
|
||||
}
|
||||
close($clisock);
|
||||
if (ref $retdata eq "SCALAR") { #bug detected
|
||||
if ($lastline =~ m/\*XCATBUGDETECTED\*76e9b54341\n\z/) { #if it was an error
|
||||
#in the midst of the operation, die like it used to die
|
||||
my $err;
|
||||
$$retdata =~ /\*XCATBUGDETECTED\*:(.*):\*XCATBUGDETECTED\*/s;
|
||||
$data =~ /\*XCATBUGDETECTED\*:(.*):\*XCATBUGDETECTED\*/s;
|
||||
$err = $1;
|
||||
die $err;
|
||||
}
|
||||
my @returndata = @{$retdata};
|
||||
my @returndata = @{thaw($data)};
|
||||
if (wantarray) {
|
||||
return @returndata;
|
||||
} else {
|
||||
@@ -159,7 +163,7 @@ sub init_dbworker {
|
||||
#This process is the database worker, it's job is to manage database queries to reduce required handles and to permit cross-process caching
|
||||
$0 = "xcatd: DB Access";
|
||||
use File::Path;
|
||||
mkpath('/var/run/xcat/');
|
||||
mkpath('/tmp/xcat/');
|
||||
use IO::Socket;
|
||||
$SIG{TERM} = $SIG{INT} = sub {
|
||||
$exitdbthread=1;
|
||||
@@ -197,7 +201,8 @@ sub init_dbworker {
|
||||
xCAT::MsgUtils->message("S","xcatd: possible BUG encountered by xCAT DB worker ".$err);
|
||||
if ($currcon) {
|
||||
eval { #avoid hang by allowin client to die too
|
||||
store_fd("*XCATBUGDETECTED*:$err:*XCATBUGDETECTED*\n",$currcon);
|
||||
print $currcon "*XCATBUGDETECTED*:$err:*XCATBUGDETECTED*\n";
|
||||
print $currcon "*XCATBUGDETECTED*76e9b54341\n";
|
||||
$clientset->remove($currcon);
|
||||
close($currcon);
|
||||
};
|
||||
@@ -225,14 +230,13 @@ sub handle_dbc_conn {
|
||||
my $client = shift;
|
||||
my $clientset = shift;
|
||||
my $data;
|
||||
my $request;
|
||||
eval {
|
||||
$request = fd_retrieve($client);
|
||||
};
|
||||
if ($@ and $@ =~ /^Magic number checking on storable file/) { #this most likely means we ran over the end of available input
|
||||
$clientset->remove($client);
|
||||
close($client);
|
||||
} elsif ($request) {
|
||||
if ($data = <$client>) {
|
||||
my $lastline;
|
||||
while ($lastline ne "ENDOFFREEZEQFVyo4Cj6Q0v\n") { #$data !~ /ENDOFFREEZEQFVyo4Cj6Q0v/) {
|
||||
$lastline = <$client>;
|
||||
$data .= $lastline;
|
||||
}
|
||||
my $request = thaw($data);
|
||||
my $response;
|
||||
my @returndata;
|
||||
if ($request->{'wantarray'}) {
|
||||
@@ -240,7 +244,12 @@ sub handle_dbc_conn {
|
||||
} else {
|
||||
@returndata = (scalar(handle_dbc_request($request)));
|
||||
}
|
||||
store_fd(\@returndata,$client);
|
||||
$response = freeze(\@returndata);
|
||||
# $response .= "\nENDOFFREEZEQFVyo4Cj6Q0j\n";
|
||||
print $client $response;
|
||||
$clientset->remove($client);
|
||||
close($client);
|
||||
} else { #Connection terminated, clean up
|
||||
$clientset->remove($client);
|
||||
close($client);
|
||||
}
|
||||
@@ -1603,7 +1612,7 @@ sub setAttribs
|
||||
# delimit the columns of the table
|
||||
my $delimitedcol = &delimitcol($col);
|
||||
$cols = $cols . $delimitedcol . " = ?,";
|
||||
push @bind, (($$elems{$col} eq "NULL") ? undef: $$elems{$col});
|
||||
push @bind, (($$elems{$col} =~ /NULL/) ? undef: $$elems{$col});
|
||||
}
|
||||
chop($cols);
|
||||
my $cmd ;
|
||||
@@ -1786,7 +1795,7 @@ sub setAttribsWhere
|
||||
# delimit the columns of the table
|
||||
my $delimitedcol = &delimitcol($col);
|
||||
$cols = $cols . $delimitedcol . " = ?,";
|
||||
push @bind, (($$elems{$col} eq "NULL") ? undef: $$elems{$col});
|
||||
push @bind, (($$elems{$col} =~ /NULL/) ? undef: $$elems{$col});
|
||||
}
|
||||
chop($cols);
|
||||
my $cmd = "UPDATE " . $self->{tabname} . " set $cols where " . $where_clause;
|
||||
@@ -2271,16 +2280,17 @@ sub getNodeAttribs
|
||||
#skip undefined values, save time
|
||||
next;
|
||||
}
|
||||
|
||||
if ($datum->{$attrib} =~ /^\/[^\/]*\/[^\/]*\/$/)
|
||||
{
|
||||
my $exp = substr($datum->{$attrib}, 1);
|
||||
chop $exp;
|
||||
my @parts = split('/', $exp, 2);
|
||||
my $retval = $node;
|
||||
my $retval = $node;
|
||||
$retval =~ s/$parts[0]/$parts[1]/;
|
||||
$datum->{$attrib} = $retval;
|
||||
}
|
||||
elsif ($datum->{$attrib} =~ /^\|.*\|$/)
|
||||
elsif ($datum->{$attrib} =~ /^\|.*\|.*\|$/)
|
||||
{
|
||||
|
||||
#Perform arithmetic and only arithmetic operations in bracketed issues on the right.
|
||||
@@ -2290,14 +2300,6 @@ sub getNodeAttribs
|
||||
my $exp = substr($datum->{$attrib}, 1);
|
||||
chop $exp;
|
||||
my @parts = split('\|', $exp, 2);
|
||||
my $arraySize = @parts;
|
||||
if ($arraySize < 2) { # easy regx, generate lhs from node
|
||||
my $lhs;
|
||||
my @numbers = $node =~ m/[\D0]*(\d+)/g;
|
||||
$lhs = '[\D0]*(\d+)' x scalar(@numbers);
|
||||
$lhs .= '.*$';
|
||||
unshift(@parts,$lhs);
|
||||
}
|
||||
my $curr;
|
||||
my $next;
|
||||
my $prev;
|
||||
@@ -2349,6 +2351,71 @@ sub getNodeAttribs
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
=head3 getNodeSpecAttribs
|
||||
Description: Retrieves the requested attributes which matching the specified options for a node
|
||||
Arguments:
|
||||
Noderange
|
||||
The specified options
|
||||
List of attributes
|
||||
Return:
|
||||
Attribute hash
|
||||
Example:
|
||||
my $tab = xCAT::Table->new('ppcdirect');
|
||||
my $ent = $tab->getNodeSpecAttribs($node, {username=>'HMC'}, qw/password/);
|
||||
Comments:
|
||||
The keys of the specified options can be given in the list of attributes or not,
|
||||
this routine will deal with them.
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
#sub getNodeSpecAttribs {
|
||||
# my $self = shift;
|
||||
# my $node = shift;
|
||||
# my %options = ();
|
||||
# my @attribs = ();
|
||||
# my @keys = ();
|
||||
# if (ref $_[0] eq 'HASH') {
|
||||
# %options = %{shift()};
|
||||
# @attribs = @_;
|
||||
# foreach my $key (keys %options) {
|
||||
# if (!grep(/^$key$/, @attribs)) {
|
||||
# push @attribs, $key;
|
||||
# }
|
||||
# }
|
||||
# } else {
|
||||
# @attribs = @_;
|
||||
# }
|
||||
# if ((keys (%options)) == 0) {
|
||||
# my $ent = $self->getNodeAttribs($node, \@attribs);
|
||||
# return $ent;
|
||||
# } else {
|
||||
# my $nodekey = "node";
|
||||
# if (defined $xCAT::Schema::tabspec{$self->{tabname}}->{nodecol}) {
|
||||
# $nodekey = $xCAT::Schema::tabspec{$self->{tabname}}->{nodecol};
|
||||
# }
|
||||
# $options{$nodekey} = $node;
|
||||
# my $ent = $self->getAttribs(\%options, \@attribs);
|
||||
# if ($ent) {
|
||||
# return $ent;
|
||||
# }
|
||||
# my ($nodeghash) = $self->{nodelist}->getAttribs({node=>$node}, "groups");
|
||||
# unless(defined($nodeghash) && defined($nodeghash->{groups})) {
|
||||
# return undef;
|
||||
# }
|
||||
# my @nodegroups = split(/,/, $nodeghash->{groups});
|
||||
# foreach my $group (@nodegroups) {
|
||||
# $options{$nodekey} = $group;
|
||||
# my $g_ret = $self->getAttribs(\%options, \@attribs);
|
||||
# if ($g_ret) {
|
||||
# return $g_ret;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# return undef;
|
||||
#}
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
=head3 getNodeAttribs_nosub
|
||||
|
||||
Description:
|
||||
@@ -2902,14 +2969,10 @@ sub getAllNodeAttribs
|
||||
$self->{nrcache}->{$data->{$nodekey}}->{tstamp} = time();
|
||||
}
|
||||
@nodes = @{$self->{nrcache}->{$data->{$nodekey}}->{value}}; #expand node entry, to make groups expand
|
||||
|
||||
#If node not in nodelist do not add to the hash (SF 3580)
|
||||
#unless (@nodes) { #in the event of an entry not in nodelist, use entry value verbatim
|
||||
# @nodes = ($data->{$nodekey});
|
||||
#} end SF 3580
|
||||
|
||||
unless (@nodes) { #in the event of an entry not in nodelist, use entry value verbatim
|
||||
@nodes = ($data->{$nodekey});
|
||||
}
|
||||
#my $localhash = $self->getNodesAttribs(\@nodes,$attribq); #NOTE: This is stupid, rebuilds the cache for every entry, FIXME
|
||||
|
||||
foreach (@nodes)
|
||||
{
|
||||
if ($donenodes{$_}) { next; }
|
||||
|
||||
@@ -19,7 +19,6 @@ if ($^O =~ /^aix/i) {
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use strict;
|
||||
require xCAT::Table;
|
||||
use File::Path;
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
=head3
|
||||
@@ -1498,10 +1497,19 @@ sub enablessh
|
||||
my ($class, $node) = @_;
|
||||
my $enablessh=1;
|
||||
|
||||
if( xCAT::Utils->isSN($node) ) {
|
||||
if( %::GLOBAL_SN_HASH ) {
|
||||
if ($::GLOBAL_SN_HASH{$node} == 1) {
|
||||
$enablessh=1; # service nodes always enabled
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
if (xCAT::Utils->isSN($node))
|
||||
{
|
||||
$enablessh=1; # service nodes always enabled
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# if not a service node we need to check, before enabling
|
||||
my $values;
|
||||
my @vals = xCAT::TableUtils->get_site_attribute("sshbetweennodes");
|
||||
@@ -1545,93 +1553,12 @@ sub enablessh
|
||||
$enablessh=1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $enablessh;
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 enableSSH
|
||||
Description:
|
||||
The function is same as enablessh() above. Before using this function,
|
||||
the $sn_hash for noderange, and $groups_hash for site.sshbetweennodes should be
|
||||
got. This is performance improvement.
|
||||
Arguments:
|
||||
$node -- node name
|
||||
$sn_hash -- if the node is one sn, key is the node name, and value is 1.
|
||||
if the node is not a sn, the key isn't in this hash
|
||||
$groups_hash -- there are two keys:
|
||||
1. Each group in the value of site.sshbetweennodes could be the key
|
||||
2. Each node in the groups from the value of site.sshbetweennodes , if the
|
||||
value isn't ALLGROUPS or NOGROUPS.
|
||||
|
||||
Returns:
|
||||
1 = enable ssh
|
||||
0 = do not enable ssh
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $enable = xCAT::TableUtils->enableSSH($node);
|
||||
Comments:
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub enableSSH
|
||||
{
|
||||
|
||||
my ($class, $node, $sn_hash, $groups_hash) = @_;
|
||||
my $enablessh=1;
|
||||
|
||||
if( defined($sn_hash) && defined($sn_hash->{node}) && $sn_hash->{$node} == 1 ) {
|
||||
$enablessh=1; # service nodes always enabled
|
||||
|
||||
} else {
|
||||
# if not a service node we need to check, before enabling
|
||||
if (defined($groups_hash)) {
|
||||
if ($groups_hash->{ALLGROUPS} == 1)
|
||||
{
|
||||
$enablessh=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($groups_hash->{NOGROUPS} == 1)
|
||||
{
|
||||
$enablessh=0;
|
||||
}
|
||||
else
|
||||
{ # check to see if the node is a member of a group
|
||||
my $ismember = 0;
|
||||
$ismember = $groups_hash->{$node};
|
||||
|
||||
if ($ismember == 1)
|
||||
{
|
||||
$enablessh=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$enablessh=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ # does not exist, set default
|
||||
$enablessh=1;
|
||||
|
||||
}
|
||||
}
|
||||
return $enablessh;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
+11
-35
@@ -36,13 +36,11 @@ my %usage = (
|
||||
LPAR(using Direct FSP Management) specific:
|
||||
rpower <noderange> [on|off|reset|stat|state|boot|of|sms]
|
||||
Blade(using Direct FSP Management) specific:
|
||||
rpower <noderange> [on|onstandby|off|cycle|state|sms]
|
||||
rpower <noderange> [on|off|cycle|state]
|
||||
Blade(using AMM) specific:
|
||||
rpower <noderange> [cycle|softoff] [-V|--verbose]
|
||||
zVM specific:
|
||||
rpower noderange [on|off|reset|stat|softoff]
|
||||
MIC specific:
|
||||
rpower noderange [stat|state|on|off|reset|boot]
|
||||
",
|
||||
"rbeacon" =>
|
||||
"Usage: rbeacon <noderange> [on|off|stat] [-V|--verbose]
|
||||
@@ -60,11 +58,9 @@ my %usage = (
|
||||
Blade specific:
|
||||
rvitals noderange {temp|wattage|fanspeed|leds|summary|all}
|
||||
BMC specific:
|
||||
rvitals noderange {temp|voltage|wattage|fanspeed|power|leds|lcds|summary|all}
|
||||
MIC specific:
|
||||
rvitals noderange {thermal|all}",
|
||||
rvitals noderange {temp|voltage|wattage|fanspeed|power|leds|lcds|summary|all}",
|
||||
"reventlog" =>
|
||||
"Usage: reventlog <noderange> [all [-s]|clear|<number of entries to retrieve> [-s]] [-V|--verbose]
|
||||
"Usage: reventlog <noderange> [all|clear|<number of entries to retrieve>] [-V|--verbose]
|
||||
reventlog [-h|--help|-v|--version]",
|
||||
"rinv" =>
|
||||
"Usage:
|
||||
@@ -87,9 +83,7 @@ my %usage = (
|
||||
VMware specific:
|
||||
rinv <noderange>
|
||||
zVM specific:
|
||||
rinv noderange [all|config]
|
||||
MIC specific:
|
||||
rinv noderange [system|ver|board|core|gddr|all]",
|
||||
rinv noderange [all|config]",
|
||||
"rsetboot" =>
|
||||
"Usage: rsetboot <noderange> [net|hd|cd|floppy|def|stat] [-V|--verbose]
|
||||
rsetboot [-h|--help|-v|--version]",
|
||||
@@ -267,8 +261,8 @@ my %usage = (
|
||||
rmvm [-p] [-f]",
|
||||
"lsslp" =>
|
||||
"Usage: lsslp [-h|--help|-v|--version]
|
||||
lsslp [<noderange>][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM|IMM2|FSP]
|
||||
[-t tries][--vpdtable][-C counts][-T timeout]",
|
||||
lsslp [<noderange>][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM]
|
||||
[-t tries][--vpdtable][-C counts][-T timeout][--flexdiscover]",
|
||||
"rflash" =>
|
||||
"Usage:
|
||||
rflash [ -h|--help|-v|--version]
|
||||
@@ -323,31 +317,17 @@ my %usage = (
|
||||
renergy noderange [-V] { all | { [savingstatus] [dsavingstatus] [cappingstatus] [cappingmaxmin] [cappingvalue] [cappingsoftmin] [averageAC] [averageDC] [ambienttemp] [exhausttemp] [CPUspeed] [syssbpower] [sysIPLtime] [fsavingstatus] [ffoMin] [ffoVmin] [ffoTurbo] [ffoNorm] [ffovalue] } }
|
||||
renergy noderange [-V] { {savingstatus}={on | off} | {dsavingstatus}={on-norm | on-maxp | off} | {fsavingstatus}={on | off} | {ffovalue}=MHZ | {cappingstatus}={on | off} | {cappingwatt}=watt | {cappingperc}=percentage }
|
||||
|
||||
BladeCenter specific :
|
||||
For Management Modules:
|
||||
renergy noderange [-V] { all | pd1all | pd2all | [pd1status] [pd2status] [pd1policy] [pd2policy] [pd1powermodule1] [pd1powermodule2] [pd2powermodule1] [pd2powermodule2] [pd1avaiablepower] [pd2avaiablepower] [pd1reservedpower] [pd2reservedpower] [pd1remainpower] [pd2remainpower] [pd1inusedpower] [pd2inusedpower] [availableDC] [averageAC] [thermaloutput] [ambienttemp] [mmtemp] }
|
||||
For a blade server nodes:
|
||||
renergy noderange [-V] { all | [averageDC] [capability] [cappingvalue] [CPUspeed] [maxCPUspeed] [savingstatus] [dsavingstatus] }
|
||||
renergy noderange [-V] { savingstatus={on | off} | dsavingstatus={on-norm | on-maxp | off} }
|
||||
|
||||
Flex specific :
|
||||
For Flex Management Modules:
|
||||
renergy noderange [-V] { all | [powerstatus] [powerpolicy] [powermodule] [avaiablepower] [reservedpower] [remainpower] [inusedpower] [availableDC] [averageAC] [thermaloutput] [ambienttemp] [mmtemp] }
|
||||
|
||||
For Flex node (power and x86):
|
||||
renergy noderange [-V] { all | [averageDC] [capability] [cappingvalue] [cappingmaxmin] [cappingmax] [cappingmin] [cappingGmin] [CPUspeed] [maxCPUspeed] [savingstatus] [dsavingstatus] }
|
||||
renergy noderange [-V] { cappingstatus={on | off} | cappingwatt=watt | cappingperc=percentage | savingstatus={on | off} | dsavingstatus={on-norm | on-maxp | off} }
|
||||
|
||||
iDataPlex specific :
|
||||
renergy noderange [-V] [ { cappingmaxmin | cappingmax | cappingmin } ] [cappingstatus] [cappingvalue] [relhistogram]
|
||||
renergy noderange [-V] { cappingstatus={on | enable | off | disable} | {cappingwatt|cappingvalue}=watt }",
|
||||
Blade specific :
|
||||
renergy noderange [-V] { all | pd1all | pd2all | { [pd1status] [pd2status] [pd1policy] [pd2policy] [pd1powermodule1] [pd1powermodule2] [pd2powermodule1] [pd2powermodule2] [pd1avaiablepower] [pd2avaiablepower] [pd1reservedpower] [pd2reservedpower] [pd1remainpower] [pd2remainpower] [pd1inusedpower] [pd2inusedpower] [availableDC] [averageAC] [thermaloutput] [ambienttemp] [mmtemp] } }
|
||||
renergy noderange [-V] { all | { [averageDC] [capability] [cappingvalue] [CPUspeed] [maxCPUspeed] [savingstatus] [dsavingstatus] } }
|
||||
renergy noderange [-V] { {savingstatus}={on | off} | {dsavingstatus}={on-norm | on-maxp | off} }",
|
||||
"updatenode" =>
|
||||
"Usage:
|
||||
updatenode [-h|--help|-v|--version]
|
||||
or
|
||||
updatenode <noderange> [-V|--verbose] [-k|--security] [-s|--sn]
|
||||
or
|
||||
updatenode <noderange> [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw]
|
||||
updatenode <noderange> [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [-S|--sw]
|
||||
[-P|--scripts [script1,script2,...]] [-s|--sn]
|
||||
[-A|--updateallsw] [-c|--cmdlineonly] [-d alt_source_dir]
|
||||
[attr=val [attr=val...]]
|
||||
@@ -362,12 +342,8 @@ Options:
|
||||
|
||||
[-F|--sync] Perform File Syncing.
|
||||
|
||||
[--fanout] Allows you to assign the fanout value for the command.
|
||||
See xdsh/xdcp fanout parameter in the man page.
|
||||
|
||||
[-f|--snsync] Performs File Syncing to the service nodes that service
|
||||
the nodes in the noderange.
|
||||
|
||||
[-l|--user] User name to run the updatenode command. It overrides the
|
||||
current user which is the default.
|
||||
|
||||
|
||||
+20
-254
@@ -1307,10 +1307,6 @@ sub runxcmd_output
|
||||
{
|
||||
push @$::xcmd_outref, @{$resp->{data}};
|
||||
}
|
||||
if (defined($resp->{status}))
|
||||
{
|
||||
push @$::xcmd_outref, @{$resp->{status}};
|
||||
}
|
||||
if (defined($resp->{node}))
|
||||
{
|
||||
my $node = $resp->{node}->[0];
|
||||
@@ -1338,6 +1334,7 @@ sub runxcmd_output
|
||||
if (defined($resp->{error}))
|
||||
{
|
||||
push @$::xcmd_outref, @{$resp->{error}};
|
||||
$::RUNCMD_RC = 1;
|
||||
}
|
||||
if (defined($resp->{errorcode}))
|
||||
{
|
||||
@@ -1382,10 +1379,6 @@ sub runxcmd_output2
|
||||
{
|
||||
push @{$::xcmd_outref_hash->{data}}, @{$resp->{data}};
|
||||
}
|
||||
if (defined($resp->{status}))
|
||||
{
|
||||
push @{$::xcmd_outref_hash->{status}}, @{$resp->{status}};
|
||||
}
|
||||
if (defined($resp->{node}))
|
||||
{
|
||||
push @{$::xcmd_outref_hash->{node}}, @{$resp->{node}};
|
||||
@@ -1393,6 +1386,7 @@ sub runxcmd_output2
|
||||
if (defined($resp->{error}))
|
||||
{
|
||||
push @{$::xcmd_outref_hash->{error}}, @{$resp->{error}};
|
||||
$::RUNCMD_RC = 1;
|
||||
}
|
||||
if (defined($resp->{errorcode}))
|
||||
{
|
||||
@@ -2074,8 +2068,7 @@ sub CheckVersion
|
||||
=head3 osver
|
||||
Returns the os and version of the System you are running on
|
||||
Arguments:
|
||||
$type: which type of os infor you want. Supported values are:
|
||||
all,os,version,release
|
||||
none
|
||||
Returns:
|
||||
0 - ok
|
||||
Globals:
|
||||
@@ -2092,16 +2085,9 @@ sub CheckVersion
|
||||
#-------------------------------------------------------------------------------
|
||||
sub osver
|
||||
{
|
||||
my $type = shift;
|
||||
if ($type =~ /xCAT::Utils/)
|
||||
{
|
||||
$type = shift;
|
||||
}
|
||||
|
||||
my $osver = "unknown";
|
||||
my $os = '';
|
||||
my $ver = '';
|
||||
my $rel = '';
|
||||
my $line = '';
|
||||
my @lines;
|
||||
my $relfile;
|
||||
@@ -2112,31 +2098,14 @@ sub osver
|
||||
close($relfile);
|
||||
chomp($line);
|
||||
$os = "rh";
|
||||
my $verrel=$line;
|
||||
$ver=$line;
|
||||
if ( $type ) {
|
||||
$verrel =~ s/[^0-9]*([0-9.]+).*/$1/;
|
||||
($ver,$rel) = split /\./, $verrel;
|
||||
} else {
|
||||
$ver=~ tr/\.//;
|
||||
$ver =~ s/[^0-9]*([0-9]+).*/$1/;
|
||||
}
|
||||
$ver=~ tr/\.//;
|
||||
$ver =~ s/[^0-9]*([0-9]+).*/$1/;
|
||||
if ($line =~ /AS/) { $os = 'rhas' }
|
||||
elsif ($line =~ /ES/) { $os = 'rhes' }
|
||||
elsif ($line =~ /WS/) { $os = 'rhws' }
|
||||
elsif ($line =~ /Server/) {
|
||||
if ( $type ) {
|
||||
$os = 'rhels';
|
||||
} else {
|
||||
$os = 'rhserver';
|
||||
}
|
||||
} elsif ($line =~ /Client/) {
|
||||
if ( $type ) {
|
||||
$os = 'rhel';
|
||||
} else {
|
||||
$os = 'rhclient';
|
||||
}
|
||||
}
|
||||
elsif ($line =~ /Server/) { $os = 'rhserver' }
|
||||
elsif ($line =~ /Client/) { $os = 'rhclient' }
|
||||
elsif (-f "/etc/fedora-release") { $os = 'rhfc' }
|
||||
}
|
||||
elsif (-f "/etc/SuSE-release")
|
||||
@@ -2151,10 +2120,6 @@ sub osver
|
||||
$ver =~ tr/\.//;
|
||||
$ver =~ s/[^0-9]*([0-9]+).*/$1/;
|
||||
|
||||
$rel = $lines[2];
|
||||
$ver =~ tr/\.//;
|
||||
$rel =~ s/[^0-9]*([0-9]+).*/$1/;
|
||||
|
||||
#print "ver: $ver\n";
|
||||
}
|
||||
elsif (-f "/etc/UnitedLinux-release")
|
||||
@@ -2212,21 +2177,8 @@ sub osver
|
||||
close($relfile);
|
||||
}
|
||||
}
|
||||
if ( $type and $type =~ /all/ ) {
|
||||
if ( $rel ) {
|
||||
return( "$os" . "," . "$ver" . ".$rel" );
|
||||
} else {
|
||||
return( "$os" . "," . "$ver" );
|
||||
}
|
||||
} elsif ( $type and $type =~ /os/ ) {
|
||||
return( $os );
|
||||
} elsif ( $type and $type =~ /version/ ) {
|
||||
return( $ver );
|
||||
} elsif ( $type and $type =~ /release/ ) {
|
||||
return( $rel );
|
||||
} else {
|
||||
return ("$os" . "$ver");
|
||||
}
|
||||
$os = "$os" . "$ver";
|
||||
return ($os);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -3125,7 +3077,7 @@ sub isSELINUX
|
||||
=head3 noderangecontainsMN
|
||||
Returns:
|
||||
returns nothing, if ManagementNode is not the input noderange
|
||||
returns array of MN, if Management Node(s) is in the input noderange
|
||||
returns name of MN, if Management Node is in the input noderange
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
@@ -3133,7 +3085,7 @@ sub isSELINUX
|
||||
Input:
|
||||
array of nodes in the noderange
|
||||
Example:
|
||||
my @mn=xCAT::Utils->noderangecontainsMN($noderange);
|
||||
my $mn=xCAT::Utils->noderangecontainsMN($noderange);
|
||||
Comments:
|
||||
=cut
|
||||
|
||||
@@ -3142,212 +3094,26 @@ sub noderangecontainsMn
|
||||
{
|
||||
my ($class, @noderange)=@_;
|
||||
# check if any node in the noderange is the Management Node return the
|
||||
# name
|
||||
my @mnames; # management node names in the database, members of __mgmtnode
|
||||
# name
|
||||
my $mname;
|
||||
my $tab = xCAT::Table->new('nodelist');
|
||||
my @nodelist=$tab->getAllNodeAttribs(['node','groups']);
|
||||
foreach my $n (@nodelist) {
|
||||
if (defined($n->{'groups'})) {
|
||||
my @groups=split(",",$n->{'groups'});
|
||||
if ((grep (/__mgmtnode/,@groups))) { # this is the MN
|
||||
push @mnames,$n->{'node'};
|
||||
$mname=$n->{'node'};
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
my @MNs; # management node names found the noderange
|
||||
if (@mnames) { # if any Management Node defined in the database
|
||||
foreach my $mn (@mnames) {
|
||||
if (grep(/^$mn$/, @noderange)) { # if MN in the noderange
|
||||
push @MNs, $mn;
|
||||
}
|
||||
}
|
||||
if (@MNs) { # management nodes in the noderange
|
||||
return @MNs;
|
||||
if ($mname) { # if Management Node defined in the database
|
||||
if (grep(/$mname/, @noderange)) { # if MN in the noderange
|
||||
return $mname;
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
}
|
||||
return; # if no MN in the noderange, return nothing
|
||||
}
|
||||
|
||||
=head3 filter_nodes
|
||||
##########################################################################
|
||||
# Fliter the nodes to specific groups
|
||||
# For specific command, figure out the node lists which should be handled by blade.pm, fsp.pm or ipmi.pm
|
||||
# mp group: the nodes will be handled by blade.pm
|
||||
# fsp group: the nodes will be handled by fsp.pm
|
||||
# bmc group: the nodes will be handled by ipmi.pm
|
||||
# For rspconfig network, the NGP ppc blade will be included in the group of mp, othewise in the fsp group
|
||||
# For getmacs -D, the NGP ppc blade will be included in the group of common fsp, otherwise in the mp group
|
||||
# For renergy command, NGP blade will be moved to mp group
|
||||
##########################################################################
|
||||
=cut
|
||||
|
||||
sub filter_nodes{
|
||||
my ($class, $req, $mpnodes, $fspnodes, $bmcnodes, $nohandle) = @_;
|
||||
|
||||
my (@nodes,@args,$cmd);
|
||||
if (defined($req->{'node'})) {
|
||||
@nodes = @{$req->{'node'}};
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
if (defined($req->{'command'})) {
|
||||
$cmd = $req->{'command'}->[0];
|
||||
}
|
||||
if (defined($req->{'arg'})) {
|
||||
@args = @{$req->{'arg'}};
|
||||
}
|
||||
# get the nodes in the mp table
|
||||
my $mptabhash;
|
||||
my $mptab = xCAT::Table->new("mp");
|
||||
if ($mptab) {
|
||||
$mptabhash = $mptab->getNodesAttribs(\@nodes, ['mpa','nodetype']);
|
||||
}
|
||||
|
||||
# get the nodes in the ppc table
|
||||
my $ppctabhash;
|
||||
my $ppctab = xCAT::Table->new("ppc");
|
||||
if ($ppctab) {
|
||||
$ppctabhash = $ppctab->getNodesAttribs(\@nodes,['hcp']);
|
||||
}
|
||||
|
||||
# get the nodes in the ipmi table
|
||||
my $ipmitabhash;
|
||||
my $ipmitab = xCAT::Table->new("ipmi");
|
||||
if ($ipmitab) {
|
||||
$ipmitabhash = $ipmitab->getNodesAttribs(\@nodes,['bmc']);
|
||||
}
|
||||
|
||||
my (@mp, @ngpfsp, @ngpbmc, @commonfsp, @commonbmc, @unknow);
|
||||
|
||||
# if existing in both 'mpa' and 'ppc', a ngp power blade
|
||||
# if existing in both 'mpa' and 'ipmi', a ngp x86 blade
|
||||
# if only in 'ppc', a common power node
|
||||
# if only in 'ipmi', a common x86 node
|
||||
foreach (@nodes) {
|
||||
if (defined ($mptabhash->{$_}->[0]) && defined ($mptabhash->{$_}->[0]->{'mpa'})) {
|
||||
if (defined ($ppctabhash->{$_}->[0]) && defined ($ppctabhash->{$_}->[0]->{'hcp'})) {
|
||||
# flex power node
|
||||
push @ngpfsp, $_;
|
||||
next;
|
||||
} elsif (defined ($ipmitabhash->{$_}->[0]) && defined ($ipmitabhash->{$_}->[0]->{'bmc'})) {
|
||||
# flex x86 node
|
||||
push @ngpbmc, $_;
|
||||
next;
|
||||
}
|
||||
else {
|
||||
# Non flex blade, but blade node
|
||||
push @mp, $_;
|
||||
next;
|
||||
}
|
||||
} elsif (defined ($ppctabhash->{$_}->[0]) && defined ($ppctabhash->{$_}->[0]->{'hcp'})) {
|
||||
# common power node
|
||||
push @commonfsp, $_;
|
||||
} elsif (defined ($ipmitabhash->{$_}->[0]) && defined ($ipmitabhash->{$_}->[0]->{'bmc'})) {
|
||||
# common bmc node
|
||||
push @commonbmc, $_;
|
||||
} else {
|
||||
push @unknow, $_;
|
||||
}
|
||||
}
|
||||
|
||||
push @{$mpnodes}, @mp;#blade.pm
|
||||
push @{$fspnodes}, @commonfsp;
|
||||
push @{$bmcnodes}, @commonbmc;
|
||||
if (@args && ($cmd eq "rspconfig")) {
|
||||
if (!(grep /^(cec_off_policy|pending_power_on_side)/, @args)) {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
} else {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
}
|
||||
if (grep /^(network|textid)/, @args) {
|
||||
push @{$mpnodes}, @ngpbmc;
|
||||
} else {
|
||||
push @{$bmcnodes}, @ngpbmc;
|
||||
}
|
||||
} elsif($cmd eq "getmacs") {
|
||||
if (@args && (grep /^-D$/,@args)) {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
} else {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
}
|
||||
} elsif ($cmd eq "rvitals") {
|
||||
if (@args && (grep /^lcds$/,@args)) {
|
||||
push @{$fspnodes},@ngpfsp;
|
||||
} else {
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
}
|
||||
} elsif ($cmd eq "renergy") {
|
||||
if (grep /^(relhistogram)/, @args) {
|
||||
push @{$bmcnodes}, @ngpbmc;
|
||||
} else {
|
||||
push @{$mpnodes}, @ngpbmc;
|
||||
}
|
||||
push @{$mpnodes}, @ngpfsp;
|
||||
} else {
|
||||
push @{$fspnodes}, @ngpfsp;
|
||||
}
|
||||
|
||||
push @{$nohandle}, @unknow;
|
||||
|
||||
## TRACE_LINE print "Nodes filter: nodetype [commp:@mp,ngpp:@ngpfsp,comfsp:@commonfsp]. mpnodes [@{$mpnodes}], fspnodes [@{$fspnodes}], bmcnodes [@{$bmcnodes}]\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 filter_nostatusupdate()
|
||||
|
||||
filter out the nodes which support provision status feedback from the status-nodes hash
|
||||
Returns:
|
||||
returns the filtered status-nodes hash
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Input:
|
||||
the ref of status-nodes hash to filter
|
||||
Example:
|
||||
my $mn=xCAT::Utils->filter_nostatusupdate(\%statusnodehash);
|
||||
Comments:
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub filter_nostatusupdate{
|
||||
|
||||
my ($class,$inref)=@_;
|
||||
my $nttabdata;
|
||||
my @allnodes=();
|
||||
#read "nodetype" table to get the "os" attribs for all the nodes with status "installing" or "netbooting"
|
||||
if(exists $inref->{$::STATUS_INSTALLING}){
|
||||
push @allnodes, @{$inref->{$::STATUS_INSTALLING}};
|
||||
}
|
||||
if(exists $inref->{$::STATUS_NETBOOTING}){
|
||||
push @allnodes, @{$inref->{$::STATUS_NETBOOTING}};
|
||||
}
|
||||
|
||||
my $nodetypetab = xCAT::Table->new('nodetype');
|
||||
if ($nodetypetab) {
|
||||
$nttabdata = $nodetypetab->getNodesAttribs(\@allnodes, ['node', 'os']);
|
||||
$nodetypetab->close();
|
||||
}
|
||||
|
||||
#filter out the nodes which support the node provision status feedback
|
||||
my @nodesfiltered=();
|
||||
if(exists $inref->{$::STATUS_INSTALLING}){
|
||||
map{ if($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|sles|ubuntu)/) {push @nodesfiltered,$_;} } @{$inref->{$::STATUS_INSTALLING}};
|
||||
delete $inref->{$::STATUS_INSTALLING};
|
||||
if(@nodesfiltered){
|
||||
@{$inref->{$::STATUS_INSTALLING}}=@nodesfiltered;
|
||||
}
|
||||
}
|
||||
|
||||
@nodesfiltered=();
|
||||
if(exists $inref->{$::STATUS_NETBOOTING}){
|
||||
map{ if($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|sles|ubuntu)/) {push @nodesfiltered,$_;} } @{$inref->{$::STATUS_NETBOOTING}};
|
||||
delete $inref->{$::STATUS_NETBOOTING};
|
||||
if(@nodesfiltered){
|
||||
@{$inref->{$::STATUS_NETBOOTING}}=@nodesfiltered;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Executable → Regular
-7
@@ -16,7 +16,6 @@ require Exporter;
|
||||
"1310229985.226287" => "centos6",
|
||||
"1323560292.885204" => "centos6.2",
|
||||
"1341569670.539525" => "centos6.3",#x86
|
||||
"1362445555.957609" => "centos6.4",#x86_64
|
||||
"1176234647.982657" => "centos5",
|
||||
"1156364963.862322" => "centos4.4",
|
||||
"1178480581.024704" => "centos4.5",
|
||||
@@ -27,7 +26,6 @@ require Exporter;
|
||||
"1237641529.260981" => "centos5.3",
|
||||
"1272326751.405938" => "centos5.5",
|
||||
"1330913492.861127" => "centos5.8",#x86_64
|
||||
"1357930415.252042" => "centos5.9",#x86_64
|
||||
"1195488871.805863" => "centos4.6",
|
||||
"1195487524.127458" => "centos4.6",
|
||||
"1301444731.448392" => "centos5.6",
|
||||
@@ -47,8 +45,6 @@ require Exporter;
|
||||
"1269260915.992102" => "rhels5.5", #i386
|
||||
"1269263646.691048" => "rhels5.5", #x86_64
|
||||
"1328205744.315196" => "rhels5.8", #x86_64
|
||||
"1354216429.587870" => "rhels5.9", #x86_64
|
||||
"1354214009.518521" => "rhels5.9", #ppc64
|
||||
"1285193176.460470" => "rhels6", #x86_64
|
||||
"1285192093.430930" => "rhels6", #ppc64
|
||||
"1305068199.328169" => "rhels6.1", #x86_64
|
||||
@@ -58,13 +54,10 @@ require Exporter;
|
||||
"1339641244.734735" => "rhels6.3", #ppc64
|
||||
"1339640147.274118" => "rhels6.3", #x86_64
|
||||
"1339638991.532890" => "rhels6.3", #i386
|
||||
"1359576752.435900" => "rhels6.4", #x86_64
|
||||
"1359576196.686790" => "rhels6.4", #ppc64
|
||||
"1285193176.593806" => "rhelhpc6", #x86_64
|
||||
"1305067719.718814" => "rhelhpc6.1",#x86_64
|
||||
"1321545261.599847" => "rhelhpc6.2",#x86_64
|
||||
"1339640148.070971" => "rhelhpc6.3",#x86_64
|
||||
"1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode
|
||||
"1194015916.783841" => "fedora8",
|
||||
"1194015385.299901" => "fedora8",
|
||||
"1210112435.291709" => "fedora9",
|
||||
|
||||
@@ -208,7 +208,7 @@ sub getNic {
|
||||
Arguments : User (root or non-root)
|
||||
Node
|
||||
Returns : Network names
|
||||
Example : my $lans = xCAT::zvmCPUtils->getNetworkNames($user, $node);
|
||||
Example : my $lans = xCAT::zvmCPUtils->getNetworkNames($node);
|
||||
|
||||
=cut
|
||||
|
||||
@@ -260,7 +260,7 @@ sub getNetworkNames {
|
||||
Arguments : User (root or non-root)
|
||||
Node
|
||||
Returns : Array of networks names
|
||||
Example : my @networks = xCAT::zvmCPUtils->getNetworkNamesArray($user, $node);
|
||||
Example : my @networks = xCAT::zvmCPUtils->getNetworkNamesArray($node);
|
||||
|
||||
=cut
|
||||
|
||||
@@ -468,7 +468,6 @@ sub grantVSwitch {
|
||||
|
||||
# Use SMAPI EXEC
|
||||
my $out = `ssh $user\@$hcp "$sudo $dir/smcli Virtual_Network_Vswitch_Set -T SYSTEM -n $vswitchId -I $userId"`;
|
||||
xCAT::zvmUtils->printSyslog("grantVSwitch- ssh $user\@$hcp $sudo $dir/smcli Virtual_Network_Vswitch_Set -T SYSTEM -n $vswitchId -I $userId");
|
||||
$out = xCAT::zvmUtils->trimStr($out);
|
||||
|
||||
# If return string contains 'Done' - Operation was successful
|
||||
@@ -565,7 +564,6 @@ sub smapiFlashCopy {
|
||||
# Use SMAPI EXEC to flash copy
|
||||
my $cmd = '\"' . "CMD=FLASHCOPY $srcId $srcAddr 0 END $tgtId $tgtAddr 0 END" . '\"';
|
||||
my $out = `ssh $user\@$hcp "$sudo $dir/smcli xCAT_Commands_IUO -T $hcpUserId -c $cmd"`;
|
||||
xCAT::zvmUtils->printSyslog("smapiFlashCopy- ssh $user\@$hcp $sudo $dir/smcli xCAT_Commands_IUO -T $hcpUserId -c $cmd");
|
||||
|
||||
$out = xCAT::zvmUtils->trimStr($out);
|
||||
|
||||
@@ -658,18 +656,14 @@ sub purgeReader {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
xCAT::zvmUtils->printSyslog("sudoer:$user zHCP:$hcp sudo:$sudo");
|
||||
|
||||
my $out;
|
||||
if (xCAT::zvmUtils->smapi4xcat($user, $hcp)) {
|
||||
# Use SMAPI EXEC to purge reader
|
||||
my $cmd = '\"' . "CMD=PURGE $userId RDR ALL" . '\"';
|
||||
$out = `ssh $user\@$hcp "$sudo $dir/smcli xCAT_Commands_IUO -T $userId -c $cmd"`;
|
||||
xCAT::zvmUtils->printSyslog("smcli xCAT_Commands_IUO -T $userId -c $cmd");
|
||||
} else {
|
||||
# Purge reader using CP
|
||||
$out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /sbin/vmcp purge $userId rdr all"`;
|
||||
xCAT::zvmUtils->printSyslog("/sbin/vmcp purge $userId rdr all");
|
||||
}
|
||||
|
||||
$out = xCAT::zvmUtils->trimStr($out);
|
||||
@@ -701,18 +695,14 @@ sub sendCPCmd {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
xCAT::zvmUtils->printSyslog("sudoer:$user zHCP:$hcp sudo:$sudo");
|
||||
|
||||
my $out;
|
||||
if (xCAT::zvmUtils->smapi4xcat($user, $hcp)) {
|
||||
# Use SMAPI EXEC to send command
|
||||
$cmd = '\"' . "CMD=SEND CP $userId " . uc($cmd) . '\"';
|
||||
$out = `ssh $user\@$hcp "$sudo $dir/smcli xCAT_Commands_IUO -T $userId -c $cmd"`;
|
||||
xCAT::zvmUtils->printSyslog("smcli xCAT_Commands_IUO -T $userId -c $cmd");
|
||||
} else {
|
||||
# Send CP command to given user
|
||||
$out = `ssh $user\@$hcp "$sudo /sbin/vmcp send cp $userId $cmd"`;
|
||||
xCAT::zvmUtils->printSyslog("/sbin/vmcp send cp $userId $cmd");
|
||||
}
|
||||
|
||||
$out = xCAT::zvmUtils->trimStr($out);
|
||||
|
||||
+43
-826
@@ -12,8 +12,6 @@ package xCAT::zvmUtils;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::Utils;
|
||||
use xCAT::Table;
|
||||
use xCAT::NetworkUtils;
|
||||
use File::Basename;
|
||||
use strict;
|
||||
use warnings;
|
||||
1;
|
||||
@@ -288,40 +286,8 @@ sub printLn {
|
||||
|
||||
# Print string
|
||||
my $rsp;
|
||||
my $type = "I";
|
||||
if ($str =~ m/error/i) { # Set to print error if the string contains error
|
||||
$type = "E";
|
||||
}
|
||||
|
||||
$rsp->{data}->[0] = "$str";
|
||||
xCAT::MsgUtils->message( $type, $rsp, $callback );
|
||||
# xCAT::MsgUtils->message( "S", $str ); # Print to syslog
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 printSyslog
|
||||
|
||||
Description : Print a string to syslog
|
||||
Arguments : String
|
||||
Returns : Nothing
|
||||
Example : xCAT::zvmUtils->printSyslog($str);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub printSyslog {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $str ) = @_;
|
||||
|
||||
# Prepend where this message came from
|
||||
$str = $class . " " . $str;
|
||||
|
||||
# Print string
|
||||
xCAT::MsgUtils->message( "S", $str );
|
||||
xCAT::MsgUtils->message( "I", $rsp, $callback );
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -517,7 +483,7 @@ sub getIfcfgByNic {
|
||||
foreach (@parms) {
|
||||
|
||||
# If the network file contains the NIC address
|
||||
$out = `ssh -o ConnectTimeout=5 $user\@$node "$sudo cat $_" | egrep -i "$nic"`;
|
||||
$out = `ssh -o ConnectTimeout=5 $user\@$node "$sudo cat $_" | grep "$nic"`;
|
||||
if ($out) {
|
||||
|
||||
# Return network file path
|
||||
@@ -872,36 +838,6 @@ sub checkOutput {
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 checkOutputExtractReason
|
||||
|
||||
Description : Check the return of given output. If bad, extract the reason.
|
||||
Arguments : Output string
|
||||
Reason (passed as a reference)
|
||||
Returns : 0 Good output
|
||||
-1 Bad output
|
||||
Example : my $rtn = xCAT::zvmUtils->checkOutput($callback, $out, \$reason);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub checkOutputExtractReason {
|
||||
my ( $class, $callback, $out, $reason ) = @_;
|
||||
|
||||
# Check output string
|
||||
my @outLn = split("\n", $out);
|
||||
foreach (@outLn) {
|
||||
# If output contains 'ERROR: ', return -1 and pass back the reason.
|
||||
if ($_ =~ /(.*?ERROR: )/) {
|
||||
$$reason = substr($_, index($_, "ERROR: ") + length("ERROR: "));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getDeviceNode
|
||||
|
||||
Description : Get the device node for a given address
|
||||
@@ -924,14 +860,14 @@ sub getDeviceNode {
|
||||
|
||||
# Determine device node
|
||||
my $out = `ssh $user\@$node "$sudo cat /proc/dasd/devices" | grep ".$tgtAddr("`;
|
||||
my @words = split(' ', $out);
|
||||
my @words = split( ' ', $out );
|
||||
my $tgtDevNode;
|
||||
|
||||
# /proc/dasd/devices look similar to this:
|
||||
# 0.0.0100(ECKD) at ( 94: 0) is dasda : active at blocksize: 4096, 1802880 blocks, 7042 MB
|
||||
# Look for the string 'is'
|
||||
my $i = 0;
|
||||
while ($tgtDevNode ne 'is') {
|
||||
while ( $tgtDevNode ne 'is' ) {
|
||||
$tgtDevNode = $words[$i];
|
||||
$i++;
|
||||
}
|
||||
@@ -941,39 +877,6 @@ sub getDeviceNode {
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getDeviceNodeAddr
|
||||
|
||||
Description : Get the virtual device address for a given device node
|
||||
Arguments : User (root or non-root)
|
||||
Node
|
||||
Device node
|
||||
Returns : Virtual device address
|
||||
Example : my $addr = xCAT::zvmUtils->getDeviceNodeAddr($user, $node, $deviceNode);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getDeviceNodeAddr {
|
||||
my ( $class, $user, $node, $deviceNode ) = @_;
|
||||
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Find device node and determine virtual address
|
||||
# /proc/dasd/devices look similar to this:
|
||||
# 0.0.0100(ECKD) at ( 94: 0) is dasda : active at blocksize: 4096, 1802880 blocks, 7042 MB
|
||||
my $addr = `ssh $user\@$node "$sudo cat /proc/dasd/devices" | grep -i "is $deviceNode"`;
|
||||
$addr =~ s/ +/ /g;
|
||||
$addr =~ s/^0.0.([0-9a-f]*).*/$1/;
|
||||
chomp($addr);
|
||||
|
||||
return $addr;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 isAddressUsed
|
||||
|
||||
Description : Check if a given address is used
|
||||
@@ -1155,23 +1058,16 @@ sub createMacAddr {
|
||||
return -1;
|
||||
}
|
||||
|
||||
# Get USER Prefix
|
||||
my $prefix = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /sbin/vmcp q vmlan" | egrep -i "USER Prefix:"`;
|
||||
$prefix =~ s/(.*?)USER Prefix:(.*)/$2/;
|
||||
$prefix =~ s/^\s+//;
|
||||
$prefix =~ s/\s+$//;
|
||||
|
||||
# Get MACADDR Prefix instead if USER Prefix is not defined
|
||||
if (!$prefix) {
|
||||
$prefix = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /sbin/vmcp q vmlan" | egrep -i "MACADDR Prefix:"`;
|
||||
$prefix =~ s/(.*?)MACADDR Prefix:(.*)/$2/;
|
||||
$prefix =~ s/^\s+//;
|
||||
$prefix =~ s/\s+$//;
|
||||
|
||||
if (!$prefix) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
# Get HCP MAC address
|
||||
# Get the first MAC address found
|
||||
my $out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /sbin/vmcp q v nic" | grep "MAC:"`;
|
||||
my @lines = split( "\n", $out );
|
||||
my @vars = split( " ", $lines[0] );
|
||||
|
||||
# Extract MAC prefix
|
||||
my $prefix = $vars[1];
|
||||
$prefix = xCAT::zvmUtils->replaceStr( $prefix, "-", "" );
|
||||
$prefix = substr( $prefix, 0, 6 );
|
||||
|
||||
# Generate MAC address of source node
|
||||
my $mac = $prefix . $suffix;
|
||||
@@ -1572,7 +1468,7 @@ sub getFreeAddress {
|
||||
} else {
|
||||
# When the node is down, use zHCP to get its user directory entry
|
||||
# Get HCP
|
||||
my @propNames = ('hcp', 'userid');
|
||||
my @propNames = ( 'hcp', 'userid' );
|
||||
my $propVals = xCAT::zvmUtils->getNodeProps( 'zvm', $node, @propNames );
|
||||
my $hcp = $propVals->{'hcp'};
|
||||
|
||||
@@ -1590,9 +1486,9 @@ sub getFreeAddress {
|
||||
}
|
||||
|
||||
# Get all defined device address
|
||||
$allUsedAddr = `cat $userDirEntry | awk '$1 ~/^($deviceTypesUserDir)/ {print $2}' | sort`;
|
||||
$allUsedAddr = `cat $allUsedAddr | awk '$1 ~/^($deviceTypesUserDir)/ {print $2}' | sort`;
|
||||
# Get all linked device address
|
||||
$allUsedAddr .= `cat $userDirEntry | awk '$1 ~/^(LINK)/ {print $4}' | sort`;
|
||||
$allUsedAddr .= `cat $allUsedAddr | awk '$1 ~/^(LINK)/ {print $4}' | sort`;
|
||||
}
|
||||
|
||||
# Loop to get the lowest free address
|
||||
@@ -1642,7 +1538,7 @@ sub getUsedCpuTime {
|
||||
$time =~ s/^\s+//;
|
||||
$time =~ s/\s+$//;
|
||||
if (!$time) {
|
||||
$time = 0;
|
||||
$time = 0;
|
||||
}
|
||||
|
||||
# Not found, return 0
|
||||
@@ -2136,7 +2032,7 @@ sub smapi4xcat {
|
||||
my $out = `ssh $user\@$hcp "$sudo $dir/smcli Query_API_Functional_Level -T $hcpUserId"`;
|
||||
$out = xCAT::zvmUtils->trimStr($out);
|
||||
if ( !($out =~ m/V6.2/i || $out =~ m/V6.1/i || $out =~ m/V5.4/i) ) {
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Check if SMAPI EXEC exists
|
||||
@@ -2237,20 +2133,20 @@ sub querySSI {
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub rExecute {
|
||||
my ( $class, $user, $node, $cmd ) = @_;
|
||||
|
||||
my $out;
|
||||
my $sudo = "sudo";
|
||||
my ( $class, $user, $node, $cmd ) = @_;
|
||||
|
||||
my $out;
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
# Just execute the command if root
|
||||
# Just execute the command if root
|
||||
$out = `ssh $user\@$node "$cmd"`;
|
||||
return $out;
|
||||
}
|
||||
|
||||
# Encapsulate command in single quotes
|
||||
$cmd = "'" . $cmd . "'";
|
||||
$out = `ssh $user\@$node "$sudo sh -c $cmd"`;
|
||||
return $out;
|
||||
# Encapsulate command in single quotes
|
||||
$cmd = "'" . $cmd . "'";
|
||||
$out = `ssh $user\@$node "$sudo sh -c $cmd"`;
|
||||
return $out;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
@@ -2267,8 +2163,8 @@ sub rExecute {
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getUsedFcpDevices {
|
||||
my ( $class, $user, $hcp ) = @_;
|
||||
|
||||
my ( $class, $user, $hcp ) = @_;
|
||||
|
||||
# Directory where zFCP pools are
|
||||
my $pool = "/var/opt/zhcp/zfcp";
|
||||
|
||||
@@ -2276,15 +2172,15 @@ sub getUsedFcpDevices {
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Grep the pools for used or allocated zFCP devices
|
||||
my %usedDevices;
|
||||
my @args;
|
||||
my @devices = split("\n", `ssh $user\@$hcp "$sudo cat $pool/*.conf" | egrep -i "used|allocated"`);
|
||||
foreach (@devices) {
|
||||
@args = split(",", $_);
|
||||
|
||||
# Sample pool configuration file:
|
||||
|
||||
# Grep the pools for used or allocated zFCP devices
|
||||
my %usedDevices;
|
||||
my @args;
|
||||
my @devices = split("\n", `ssh $user\@$hcp "$sudo cat $pool/*.conf" | egrep -i "used|allocated"`);
|
||||
foreach (@devices) {
|
||||
@args = split(",", $_);
|
||||
|
||||
# Sample pool configuration file:
|
||||
# #status,wwpn,lun,size,range,owner,channel,tag
|
||||
# used,1000000000000000,2000000000000110,8g,3B00-3B3F,ihost1,1a23,$root_device$
|
||||
# free,1000000000000000,2000000000000111,,3B00-3B3F,,,
|
||||
@@ -2293,688 +2189,9 @@ sub getUsedFcpDevices {
|
||||
|
||||
# Push used or allocated devices into hash
|
||||
if ($args[6]) {
|
||||
$usedDevices{uc($args[6])} = 1;
|
||||
$usedDevices{uc($args[6])} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return %usedDevices;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 establishMount
|
||||
|
||||
Description : Establish an NFS mount point on a zHCP system.
|
||||
Arguments : Sudoer user name
|
||||
Sudo keyword
|
||||
zHCP hostname
|
||||
Local directory to remotely mount
|
||||
Mount access ('ro' for read only, 'rw' for read write)
|
||||
Directory as known to zHCP (out)
|
||||
Returns : 0 - Mounted, or zHCP and MN are on the same system
|
||||
1 - Mount failed
|
||||
Example : establishMount( $callback, $::SUDOER, $::SUDO, $hcp, "$installRoot/$provMethod", "ro", \$remoteDeployDir );
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub establishMount {
|
||||
# Get inputs
|
||||
my ($class, $callback, $sudoer, $sudo, $hcp, $localDir, $access, $mountedPt) = @_;
|
||||
my $out;
|
||||
|
||||
# If the target system is not on this system then establish the NFS mount point.
|
||||
my $hcpIP = xCAT::NetworkUtils->getipaddr( $hcp );
|
||||
if (! defined $hcpIP) {
|
||||
xCAT::zvmUtils->printLn( $callback, "(Error) Unable to obtain the IP address of the hcp node" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
my $masterIp = xCAT::TableUtils->get_site_Master();
|
||||
if (! defined $masterIp) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$hcp: (Error) Unable to obtain the management node IP address from the site table" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($masterIp eq $hcpIP) {
|
||||
# xCAT MN and zHCP are on the same box and will use the same directory without the need for an NFS mount.
|
||||
$$mountedPt = $localDir;
|
||||
} else {
|
||||
# Determine the hostname for this management node
|
||||
my $masterHostname = Sys::Hostname::hostname();
|
||||
if (! defined $masterHostname) {
|
||||
# For some reason, the xCAT MN's hostname is not known. We pass along the IP address instead.
|
||||
$masterHostname = $masterIp;
|
||||
}
|
||||
|
||||
xCAT::zvmUtils->printSyslog( "establishMount() Preparing the NFS mount point on zHCP ($hcpIP) to xCAT MN $masterHostname($masterIp) for $localDir" );
|
||||
|
||||
# Prepare the staging mount point on zHCP, if they need to be established
|
||||
$$mountedPt = "/mnt/$masterHostname$localDir";
|
||||
my $rc = `ssh $sudoer\@$hcp "$sudo mkdir -p $$mountedPt && mount -t nfs -o $access $masterIp:$localDir $$mountedPt; echo \\\$?"`;
|
||||
|
||||
# Return code = 0 (mount succeeded) or 32 (mount already exists)
|
||||
if ($rc != '0' && $rc != '32') {
|
||||
xCAT::zvmUtils->printLn( $callback, "$hcp: (Error) Unable to establish zHCP mount point: $$mountedPt" );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getFreeRepoSpace
|
||||
|
||||
Description : Get the free space of image repository under /install
|
||||
Arguments : Node
|
||||
Returns : The available space for /install
|
||||
Example : my $free = getFreeRepoSpace($callback, $node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getFreeRepoSpace {
|
||||
# Get inputs
|
||||
my ($class, $user, $node) = @_;
|
||||
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Check if node is the management node
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("master");
|
||||
my $master = xCAT::zvmUtils->trimStr($entries[0]);
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
$ip = xCAT::zvmUtils->trimStr($ip);
|
||||
my $mn = 0;
|
||||
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`;
|
||||
$out =~ s/\h+/ /g;
|
||||
my @results = split(' ', $out);
|
||||
return ($results[3]);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 findAndUpdatezFcpPool
|
||||
|
||||
Description : Find and update a SCSI/FCP device in a given storage pool.
|
||||
xCAT will find and update the SCSI/FCP device in all known pools based on the unique WWPN/LUN combo.
|
||||
Arguments : Message header
|
||||
User (root or non-root)
|
||||
zHCP
|
||||
Storage pool
|
||||
Criteria hash including:
|
||||
- Status (free, reserved, or used)
|
||||
- zFCP channel
|
||||
- WWPN
|
||||
- LUN
|
||||
- Size requested
|
||||
- Owner
|
||||
- Tag
|
||||
Returns : Results hash including:
|
||||
- Return code (0 = Success, -1 = Failure)
|
||||
- zFCP device (if one is requested)
|
||||
- WWPN
|
||||
- LUN
|
||||
Example : my $resultsRef = xCAT::zvmUtils->findAndUpdatezFcpPool($callback, $header, $user, $hcp, $pool, $criteriaRef);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub findAndUpdatezFcpPool {
|
||||
# Get inputs
|
||||
my ($class, $callback, $header, $user, $hcp, $pool, $criteriaRef) = @_;
|
||||
|
||||
# Determine if sudo is used
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Directory where executables are on zHCP
|
||||
my $dir = "/opt/zhcp/bin";
|
||||
|
||||
# Directory where FCP disk pools are on zHCP
|
||||
my $zfcpDir = "/var/opt/zhcp/zfcp";
|
||||
|
||||
my %results = ('rc' => -1); # Default to error
|
||||
|
||||
# Extract criteria
|
||||
my %criteria = %$criteriaRef;
|
||||
my $status = defined($criteria{status}) ? $criteria{status} : "";
|
||||
my $fcpDevice = defined($criteria{fcp}) ? $criteria{fcp} : "";
|
||||
my $wwpn = defined($criteria{wwpn}) ? $criteria{wwpn} : "";
|
||||
my $lun = defined($criteria{lun}) ? $criteria{lun} : "";
|
||||
my $size = defined($criteria{size}) ? $criteria{size} : "";
|
||||
my $owner = defined($criteria{owner}) ? $criteria{owner} : "";
|
||||
my $tag = defined($criteria{tag}) ? $criteria{tag} : "";
|
||||
|
||||
# Check required arguments: pool, status
|
||||
# If you do not know what to update, why update!
|
||||
if (!$pool && !$status) {
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Check status
|
||||
if ($status !~ m/^(free|used|reserved)$/i) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) Status not recognized. Status can be free, used, or reserved.");
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Check FCP device syntax
|
||||
if ($fcpDevice && ($fcpDevice !~ /^auto/i) && ($fcpDevice =~ /[^0-9a-f]/i)) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) Invalid FCP channel address $fcpDevice.");
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Check WWPN and LUN syntax
|
||||
if ( $wwpn && ($wwpn =~ /[^0-9a-f;"]/i) ) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$header: (Error) Invalid world wide portname $wwpn." );
|
||||
return \%results;
|
||||
} if ( $lun && ($lun =~ /[^0-9a-f]/i) ) {
|
||||
xCAT::zvmUtils->printLn( $callback, "$header: (Error) Invalid logical unit number $lun." );
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Size can be M(egabytes) or G(igabytes). Convert size into MB.
|
||||
my $originSize = $size;
|
||||
if ($size) {
|
||||
if ($size =~ m/G/i) {
|
||||
# Convert to MegaBytes
|
||||
$size =~ s/\D//g;
|
||||
$size = int($size) * 1024
|
||||
} elsif ($size =~ m/M/i || !$size) {
|
||||
# Do nothing
|
||||
} else {
|
||||
xCAT::zvmUtils->printLn( $callback, "$header: (Error) Size not recognized. Size can be M(egabytes) or G(igabytes)." );
|
||||
return \%results;
|
||||
}
|
||||
}
|
||||
|
||||
# Check if WWPN and LUN are given
|
||||
# WWPN can be given as a semi-colon separated list (multipathing)
|
||||
my $useWwpnLun = 0;
|
||||
if ($wwpn && $lun) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: Using given WWPN and LUN");
|
||||
$useWwpnLun = 1;
|
||||
|
||||
# Make sure WWPN and LUN do not have 0x prefix
|
||||
$wwpn = xCAT::zvmUtils->replaceStr($wwpn, "0x", "");
|
||||
$lun = xCAT::zvmUtils->replaceStr($lun, "0x", "");
|
||||
}
|
||||
|
||||
# Find disk pool (create one if non-existent)
|
||||
my $out;
|
||||
if (!(`ssh $user\@$hcp "$sudo test -d $zfcpDir && echo Exists"`)) {
|
||||
# Create pool directory
|
||||
$out = `ssh $user\@$hcp "$sudo mkdir -p $zfcpDir"`;
|
||||
}
|
||||
|
||||
# Find if disk pool exists
|
||||
if (!(`ssh $user\@$hcp "$sudo test -e $zfcpDir/$pool.conf && echo Exists"`)) {
|
||||
# Return if xCAT is expected to find a FCP device, but no disk pool exists.
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) FCP storage pool does not exist");
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Find a free disk in the pool
|
||||
# FCP devices are contained in /var/opt/zhcp/zfcp/<pool-name>.conf
|
||||
my $range = "";
|
||||
my $sizeFound = "*";
|
||||
my @info;
|
||||
if (!$useWwpnLun) {
|
||||
# Find a suitable pair of WWPN and LUN in device pool based on requested size
|
||||
# Sample pool configuration file:
|
||||
# #status,wwpn,lun,size,range,owner,channel,tag
|
||||
# used,1000000000000000,2000000000000110,8g,3B00-3B3F,ihost1,1a23,$root_device$
|
||||
# free,1000000000000000,2000000000000111,,3B00-3B3F,,,
|
||||
# free,1230000000000000;4560000000000000,2000000000000112,,3B00-3B3F,,,
|
||||
my @devices = split("\n", `ssh $user\@$hcp "$sudo cat $zfcpDir/$pool.conf" | egrep -i ^free`);
|
||||
$sizeFound = 0;
|
||||
foreach (@devices) {
|
||||
@info = split(',', $_);
|
||||
|
||||
# Check if the size is sufficient. Convert size into MB.
|
||||
if ($info[3] =~ m/G/i) {
|
||||
# Convert to MegaBytes
|
||||
$info[3] =~ s/\D//g;
|
||||
$info[3] = int($info[3]) * 1024
|
||||
} elsif ($info[3] =~ m/M/i) {
|
||||
# Do nothing
|
||||
$info[3] =~ s/\D//g;
|
||||
} else {
|
||||
next;
|
||||
}
|
||||
|
||||
# Find optimal disk based on requested size
|
||||
if ($sizeFound && $info[3] >= $size && $info[3] < $sizeFound) {
|
||||
$sizeFound = $info[3];
|
||||
$wwpn = $info[1];
|
||||
$lun = $info[2];
|
||||
$range = $info[4];
|
||||
} elsif (!$sizeFound && $info[3] >= $size) {
|
||||
$sizeFound = $info[3];
|
||||
$wwpn = $info[1];
|
||||
$lun = $info[2];
|
||||
$range = $info[4];
|
||||
}
|
||||
}
|
||||
|
||||
# Do not continue if no devices can be found
|
||||
if (!$wwpn && !$lun) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) A suitable device of $size" . "M or larger could not be found");
|
||||
return \%results;
|
||||
}
|
||||
} else {
|
||||
# Find given WWPN and LUN. Do not continue if device is used
|
||||
my $select = `ssh $user\@$hcp "$sudo cat $zfcpDir/$pool.conf" | grep -i "$wwpn,$lun"`;
|
||||
chomp($select);
|
||||
|
||||
@info = split(',', $select);
|
||||
|
||||
if ($size) {
|
||||
if ($info[3] =~ m/G/i) {
|
||||
# Convert to MegaBytes
|
||||
$info[3] =~ s/\D//g;
|
||||
$info[3] = int($info[3]) * 1024
|
||||
} elsif ($info[3] =~ m/M/i) {
|
||||
# Do nothing
|
||||
$info[3] =~ s/\D//g;
|
||||
} else {
|
||||
next;
|
||||
}
|
||||
|
||||
# Do not continue if specified device does not have enough capacity
|
||||
if ($info[3] < $size) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) FCP device $wwpn/$lun is not large enough");
|
||||
return \%results;
|
||||
}
|
||||
}
|
||||
|
||||
# Find range of the specified disk
|
||||
$range = $info[4];
|
||||
}
|
||||
|
||||
# If there are multiple paths, take the 1st one
|
||||
# Handle multi-pathing in postscript because autoyast/kickstart does not support it.
|
||||
my $origWwpn = $wwpn;
|
||||
if ($wwpn =~ m/;/i) {
|
||||
@info = split(';', $wwpn);
|
||||
$wwpn = xCAT::zvmUtils->trimStr($info[0]);
|
||||
}
|
||||
|
||||
xCAT::zvmUtils->printLn($callback, "$header: Found FCP device 0x$wwpn/0x$lun");
|
||||
|
||||
# Find a free FCP device based on the given range
|
||||
if ($fcpDevice =~ m/^auto/i) {
|
||||
my @ranges;
|
||||
my $min;
|
||||
my $max;
|
||||
my $found = 0;
|
||||
|
||||
if ($range =~ m/;/i) {
|
||||
@ranges = split(';', $range);
|
||||
} else {
|
||||
push(@ranges, $range);
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
# If the node has an eligible FCP device, use it
|
||||
my @deviceList = xCAT::zvmUtils->getDedicates($callback, $user, $owner);
|
||||
foreach (@deviceList) {
|
||||
# Check if this devide is eligible (among the range specified for disk $lun)
|
||||
@info = split(' ', $_);
|
||||
my $candidate = $info[2];
|
||||
foreach (@ranges) {
|
||||
($min, $max) = split('-', $_);
|
||||
if (hex($candidate) >= hex($min) && hex($candidate) <= hex($max)) {
|
||||
$found = 1;
|
||||
$fcpDevice = uc($candidate);
|
||||
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ($found) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: Found eligible FCP channel $fcpDevice");
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
# If the node has no eligible FCP device, find a free one for it.
|
||||
my %usedDevices = xCAT::zvmUtils->getUsedFcpDevices($user, $hcp);
|
||||
|
||||
my $hcpUserId = xCAT::zvmCPUtils->getUserId($user, $hcp);
|
||||
$hcpUserId =~ tr/a-z/A-Z/;
|
||||
|
||||
# Find a free FCP channel
|
||||
$out = `ssh $user\@$hcp "$sudo $dir/smcli System_WWPN_Query -T $hcpUserId" | egrep -i "FCP device number|Status"`;
|
||||
my @devices = split( "\n", $out );
|
||||
for (my $i = 0; $i < @devices; $i++) {
|
||||
# Extract the device number and status
|
||||
$fcpDevice = $devices[$i];
|
||||
$fcpDevice =~ s/^FCP device number:(.*)/$1/;
|
||||
$fcpDevice =~ s/^\s+//;
|
||||
$fcpDevice =~ s/\s+$//;
|
||||
|
||||
$i++;
|
||||
my $fcpStatus = $devices[$i];
|
||||
$fcpStatus =~ s/^Status:(.*)/$1/;
|
||||
$fcpStatus =~ s/^\s+//;
|
||||
$fcpStatus =~ s/\s+$//;
|
||||
|
||||
# Only look at free FCP devices
|
||||
if ($fcpStatus =~ m/free/i) {
|
||||
# If the device number is within the specified range, exit out of loop
|
||||
# Range: 3B00-3C00;4B00-4C00;5E12-5E12
|
||||
foreach (@ranges) {
|
||||
($min, $max) = split('-', $_);
|
||||
if (hex($fcpDevice) >= hex($min) && hex($fcpDevice) <= hex($max)) {
|
||||
$fcpDevice = uc($fcpDevice);
|
||||
|
||||
# Used found FCP channel if not in use or allocated
|
||||
if (!$usedDevices{$fcpDevice}) {
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Break out of loop if FCP channel is found
|
||||
if ($found) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: Found FCP channel within acceptable range $fcpDevice");
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Do not continue if no FCP channel is found
|
||||
if (!$found) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) A suitable FCP channel could not be found");
|
||||
return \%results;
|
||||
}
|
||||
}
|
||||
|
||||
# If there are multiple devices (multipathing), take the 1st one
|
||||
if ($fcpDevice) {
|
||||
if ($fcpDevice =~ m/;/i) {
|
||||
@info = split(';', $fcpDevice);
|
||||
$fcpDevice = xCAT::zvmUtils->trimStr($info[0]);
|
||||
}
|
||||
|
||||
# Make sure channel has a length of 4
|
||||
while (length($fcpDevice) < 4) {
|
||||
$fcpDevice = "0" . $fcpDevice;
|
||||
}
|
||||
}
|
||||
|
||||
# Mark WWPN and LUN as used, free, or reserved and set the owner/channel appropriately
|
||||
# This config file keeps track of the owner of each device, which is useful in nodeset
|
||||
$size = $size . "M";
|
||||
my $select = `ssh $user\@$hcp "$sudo cat $zfcpDir/$pool.conf" | grep -i "$lun" | grep -i "$wwpn"`;
|
||||
chomp($select);
|
||||
if ($select) {
|
||||
@info = split(',', $select);
|
||||
|
||||
if (!$info[3]) {
|
||||
$info[3] = $size;
|
||||
}
|
||||
|
||||
# Do not update if WWPN/LUN pair is specified but the pair does not exist
|
||||
if (!($info[1] =~ m/$wwpn/i)) {
|
||||
xCAT::zvmUtils->printLn($callback, "$header: (Error) FCP device $wwpn/$lun does not exists");
|
||||
return \%results;
|
||||
}
|
||||
|
||||
# Entry order: status,wwpn,lun,size,range,owner,channel,tag
|
||||
# The following are never updated: wwpn, lun, size, and range
|
||||
my $update = "$status,$info[1],$info[2],$info[3],$info[4],$owner,$fcpDevice,$tag";
|
||||
my $expression = "'s#" . $select . "#" .$update . "#i'";
|
||||
$out = `ssh $user\@$hcp "$sudo sed --in-place -e $expression $zfcpDir/$pool.conf"`;
|
||||
} else {
|
||||
# Insert device entry into file
|
||||
$out = `ssh $user\@$hcp "$sudo echo \"$status,$origWwpn,$lun,$size,,$owner,$fcpDevice,$tag\" >> $zfcpDir/$pool.conf"`;
|
||||
}
|
||||
|
||||
# Generate results hash
|
||||
%results = (
|
||||
'rc' => 0,
|
||||
'fcp' => $fcpDevice,
|
||||
'wwpn' => $wwpn,
|
||||
'lun' => $lun
|
||||
);
|
||||
return \%results;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 findzFcpDevicePool
|
||||
|
||||
Description : Find the zFCP storage pool that contains the given zFCP device
|
||||
Arguments : User (root or non-root)
|
||||
zHCP
|
||||
WWPN
|
||||
LUN
|
||||
Returns : Storage pool where zFCP device resides
|
||||
Example : my $pool = xCAT::zvmUtils->findzFcpDevicePool($user, $hcp, $wwpn, $lun);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub findzFcpDevicePool {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $user, $hcp, $wwpn, $lun ) = @_;
|
||||
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Directory where FCP disk pools are on zHCP
|
||||
my $zfcpDir = "/var/opt/zhcp/zfcp";
|
||||
|
||||
# Find the pool that contains the SCSI/FCP device
|
||||
my @pools = split("\n", `ssh $user\@$hcp "$sudo grep -i -l \"$wwpn,$lun\" $zfcpDir/*.conf"`);
|
||||
my $pool = "";
|
||||
if (scalar(@pools)) {
|
||||
$pool = basename($pools[0]);
|
||||
$pool =~ s/\.[^.]+$//; # Do not use extension
|
||||
}
|
||||
|
||||
return $pool;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 findzFcpDeviceAttr
|
||||
|
||||
Description : Find the zFCP device attributes
|
||||
Arguments : User (root or non-root)
|
||||
zHCP
|
||||
Storage pool
|
||||
WWPN
|
||||
LUN
|
||||
Returns : Architecture of node
|
||||
Example : my $deviceRef = xCAT::zvmUtils->findzFcpDeviceAttr($user, $hcp, $wwpn, $lun);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub findzFcpDeviceAttr {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $user, $hcp, $pool, $wwpn, $lun ) = @_;
|
||||
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
# Directory where FCP disk pools are on zHCP
|
||||
my $zfcpDir = "/var/opt/zhcp/zfcp";
|
||||
|
||||
# Find the SCSI/FCP device
|
||||
# Entry order: status,wwpn,lun,size,range,owner,channel,tag
|
||||
my @info = split("\n", `ssh $user\@$hcp "$sudo grep \"$wwpn,$lun\" $zfcpDir/$pool.conf"`);
|
||||
my $entry = $info[0];
|
||||
chomp($entry);
|
||||
|
||||
# Do not continue if no device is found
|
||||
my %attrs = ();
|
||||
if (!$entry) {
|
||||
return \%attrs;
|
||||
}
|
||||
|
||||
@info = split(',', $entry);
|
||||
%attrs = (
|
||||
'status' => $info[0],
|
||||
'wwpn' => $info[1],
|
||||
'lun' => $info[2],
|
||||
'size' => $info[3],
|
||||
'range' => $info[4],
|
||||
'owner' => $info[5],
|
||||
'fcp' => $info[6],
|
||||
'tag' => $info[7]
|
||||
);
|
||||
|
||||
return \%attrs;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 findUsablezHcpNetwork
|
||||
|
||||
Description : Find a useable NIC shared with the zHCP for a given user Id
|
||||
Arguments : User (root or non-root)
|
||||
zHCP
|
||||
User Id to find a useable NIC on
|
||||
DHCP is used or not (0 or 1)
|
||||
Returns : NIC, device channel, and layer (2 or 3)
|
||||
Example : my ($nic, $channel, $layer) = xCAT::zvmUtils->findUsablezHcpNetwork($user, $hcp, $userId, $dhcp);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub findUsablezHcpNetwork {
|
||||
# Get inputs
|
||||
my ( $class, $user, $hcp, $userId, $dhcp ) = @_;
|
||||
|
||||
my $sudo = "sudo";
|
||||
if ($user eq "root") {
|
||||
$sudo = "";
|
||||
}
|
||||
|
||||
my $nic = ''; # Usuable NIC on zHCP
|
||||
my $channel = ''; # Device channel where NIC is attached
|
||||
my $layer;
|
||||
my $i;
|
||||
my @words;
|
||||
|
||||
# Get the networks used by the zHCP
|
||||
my @hcpNetworks = xCAT::zvmCPUtils->getNetworkNamesArray($user, $hcp);
|
||||
|
||||
# Search directory entry for network name
|
||||
my $userEntry = `ssh $user\@$hcp "$sudo $::DIR/smcli Image_Query_DM -T $userId" | sed '\$d'`;
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() smcli Image_Query_DM -T $userId");
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() $userEntry");
|
||||
|
||||
my $out = `echo "$userEntry" | grep "NICDEF"`;
|
||||
my @lines = split('\n', $out);
|
||||
|
||||
# Go through each line
|
||||
for ($i = 0; $i < @lines; $i++) {
|
||||
# Go through each network device attached to zHCP
|
||||
foreach (@hcpNetworks) {
|
||||
|
||||
# If network device is found
|
||||
if ($lines[$i] =~ m/ $_/i) {
|
||||
# Get network layer
|
||||
$layer = xCAT::zvmCPUtils->getNetworkLayer($user, $hcp, $_);
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() NIC:$_ layer:$layer");
|
||||
|
||||
# If template using DHCP, layer must be 2
|
||||
if ((!$dhcp && $layer != 2) || (!$dhcp && $layer == 2) || ($dhcp && $layer == 2)) {
|
||||
# Save network name
|
||||
$nic = $_;
|
||||
|
||||
# Get network virtual address
|
||||
@words = split(' ', $lines[$i]);
|
||||
|
||||
# Get virtual address (channel)
|
||||
# Convert subchannel to decimal
|
||||
$channel = sprintf('%d', hex($words[1]));
|
||||
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() Candidate found NIC:$nic channel:$channel layer:$layer");
|
||||
return ($nic, $channel, $layer);
|
||||
} else {
|
||||
# Go to next network available
|
||||
$nic = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# If network device is not found
|
||||
if (!$nic) {
|
||||
# Check for user profile
|
||||
my $profileName = `echo "$userEntry" | grep "INCLUDE"`;
|
||||
if ($profileName) {
|
||||
@words = split(' ', xCAT::zvmUtils->trimStr($profileName));
|
||||
|
||||
# Get user profile
|
||||
my $userProfile = xCAT::zvmUtils->getUserProfile($user, $hcp, $words[1]);
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() $userProfile");
|
||||
|
||||
# Get the NICDEF statement containing the HCP network
|
||||
$out = `echo "$userProfile" | grep "NICDEF"`;
|
||||
@lines = split('\n', $out);
|
||||
|
||||
# Go through each line
|
||||
for ($i = 0; $i < @lines; $i++) {
|
||||
# Go through each network device attached to zHCP
|
||||
foreach (@hcpNetworks) {
|
||||
|
||||
# If network device is found
|
||||
if ($lines[$i] =~ m/ $_/i) {
|
||||
# Get network layer
|
||||
$layer = xCAT::zvmCPUtils->getNetworkLayer($user, $hcp, $_);
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() NIC:$_ layer:$layer");
|
||||
|
||||
# If template using DHCP, layer must be 2
|
||||
if ((!$dhcp && $layer != 2) || (!$dhcp && $layer == 2) || ($dhcp && $layer == 2)) {
|
||||
# Save network name
|
||||
$nic = $_;
|
||||
|
||||
# Get network virtual address
|
||||
@words = split(' ', $lines[$i]);
|
||||
|
||||
# Get virtual address (channel)
|
||||
# Convert subchannel to decimal
|
||||
$channel = sprintf('%d', hex($words[1]));
|
||||
|
||||
xCAT::zvmUtils->printSyslog("findUsablezHcpNetwork() Candidate found NIC:$nic channel:$channel layer:$layer");
|
||||
return ($nic, $channel, $layer);
|
||||
} else {
|
||||
# Go to next network available
|
||||
$nic = '';
|
||||
}
|
||||
}
|
||||
} # End of foreach
|
||||
} # End of for
|
||||
} # End of if
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return %usedDevices;
|
||||
}
|
||||
@@ -1,326 +0,0 @@
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<meta name=ProgId content=Word.Document>
|
||||
<meta name=Generator content="Microsoft Word 9">
|
||||
<meta name=Originator content="Microsoft Word 9">
|
||||
<title>Eclipse Public License - Version 1.0</title>
|
||||
<!--[if gte mso 9]><xml>
|
||||
<o:DocumentProperties>
|
||||
<o:Revision>2</o:Revision>
|
||||
<o:TotalTime>3</o:TotalTime>
|
||||
<o:Created>2004-03-05T23:03:00Z</o:Created>
|
||||
<o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
|
||||
<o:Pages>4</o:Pages>
|
||||
<o:Words>1626</o:Words>
|
||||
<o:Characters>9270</o:Characters>
|
||||
<o:Lines>77</o:Lines>
|
||||
<o:Paragraphs>18</o:Paragraphs>
|
||||
<o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
|
||||
<o:Version>9.4402</o:Version>
|
||||
</o:DocumentProperties>
|
||||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||||
<w:WordDocument>
|
||||
<w:TrackRevisions/>
|
||||
</w:WordDocument>
|
||||
</xml><![endif]-->
|
||||
<style>
|
||||
<!--
|
||||
/* Font Definitions */
|
||||
@font-face
|
||||
{font-family:Tahoma;
|
||||
panose-1:2 11 6 4 3 5 4 4 2 4;
|
||||
mso-font-charset:0;
|
||||
mso-generic-font-family:swiss;
|
||||
mso-font-pitch:variable;
|
||||
mso-font-signature:553679495 -2147483648 8 0 66047 0;}
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p
|
||||
{margin-right:0in;
|
||||
mso-margin-top-alt:auto;
|
||||
mso-margin-bottom-alt:auto;
|
||||
margin-left:0in;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p.BalloonText, li.BalloonText, div.BalloonText
|
||||
{mso-style-name:"Balloon Text";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:8.0pt;
|
||||
font-family:Tahoma;
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body lang=EN-US style='tab-interval:.5in'>
|
||||
|
||||
<div class=Section1>
|
||||
|
||||
<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
|
||||
</p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
|
||||
THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
|
||||
REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
|
||||
OF THIS AGREEMENT.</span> </p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
|
||||
in the case of the initial Contributor, the initial code and documentation
|
||||
distributed under this Agreement, and<br clear=left>
|
||||
b) in the case of each subsequent Contributor:</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
|
||||
changes to the Program, and</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
|
||||
additions to the Program;</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
|
||||
such changes and/or additions to the Program originate from and are distributed
|
||||
by that particular Contributor. A Contribution 'originates' from a Contributor
|
||||
if it was added to the Program by such Contributor itself or anyone acting on
|
||||
such Contributor's behalf. Contributions do not include additions to the
|
||||
Program which: (i) are separate modules of software distributed in conjunction
|
||||
with the Program under their own license agreement, and (ii) are not derivative
|
||||
works of the Program. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>"Contributor" means any person or
|
||||
entity that distributes the Program.</span> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
|
||||
claims licensable by a Contributor which are necessarily infringed by the use
|
||||
or sale of its Contribution alone or when combined with the Program. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>"Program" means the Contributions
|
||||
distributed in accordance with this Agreement.</span> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>"Recipient" means anyone who
|
||||
receives the Program under this Agreement, including all Contributors.</span> </p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
|
||||
Subject to the terms of this Agreement, each Contributor hereby grants Recipient
|
||||
a non-exclusive, worldwide, royalty-free copyright license to<span
|
||||
style='color:red'> </span>reproduce, prepare derivative works of, publicly
|
||||
display, publicly perform, distribute and sublicense the Contribution of such
|
||||
Contributor, if any, and such derivative works, in source code and object code
|
||||
form.</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
|
||||
Subject to the terms of this Agreement, each Contributor hereby grants
|
||||
Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
|
||||
patent license under Licensed Patents to make, use, sell, offer to sell, import
|
||||
and otherwise transfer the Contribution of such Contributor, if any, in source
|
||||
code and object code form. This patent license shall apply to the combination
|
||||
of the Contribution and the Program if, at the time the Contribution is added
|
||||
by the Contributor, such addition of the Contribution causes such combination
|
||||
to be covered by the Licensed Patents. The patent license shall not apply to
|
||||
any other combinations which include the Contribution. No hardware per se is
|
||||
licensed hereunder. </span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
|
||||
Recipient understands that although each Contributor grants the licenses to its
|
||||
Contributions set forth herein, no assurances are provided by any Contributor
|
||||
that the Program does not infringe the patent or other intellectual property
|
||||
rights of any other entity. Each Contributor disclaims any liability to Recipient
|
||||
for claims brought by any other entity based on infringement of intellectual
|
||||
property rights or otherwise. As a condition to exercising the rights and
|
||||
licenses granted hereunder, each Recipient hereby assumes sole responsibility
|
||||
to secure any other intellectual property rights needed, if any. For example,
|
||||
if a third party patent license is required to allow Recipient to distribute
|
||||
the Program, it is Recipient's responsibility to acquire that license before
|
||||
distributing the Program.</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
|
||||
Each Contributor represents that to its knowledge it has sufficient copyright
|
||||
rights in its Contribution, if any, to grant the copyright license set forth in
|
||||
this Agreement. </span></p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
|
||||
Program in object code form under its own license agreement, provided that:</span>
|
||||
</p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
|
||||
it complies with the terms and conditions of this Agreement; and</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
|
||||
its license agreement:</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
|
||||
effectively disclaims on behalf of all Contributors all warranties and
|
||||
conditions, express and implied, including warranties or conditions of title
|
||||
and non-infringement, and implied warranties or conditions of merchantability
|
||||
and fitness for a particular purpose; </span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
|
||||
effectively excludes on behalf of all Contributors all liability for damages,
|
||||
including direct, indirect, special, incidental and consequential damages, such
|
||||
as lost profits; </span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
|
||||
states that any provisions which differ from this Agreement are offered by that
|
||||
Contributor alone and not by any other party; and</span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
|
||||
states that source code for the Program is available from such Contributor, and
|
||||
informs licensees how to obtain it in a reasonable manner on or through a
|
||||
medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>When the Program is made available in source
|
||||
code form:</span> </p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
|
||||
it must be made available under this Agreement; and </span></p>
|
||||
|
||||
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
|
||||
copy of this Agreement must be included with each copy of the Program. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
|
||||
copyright notices contained within the Program. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
|
||||
originator of its Contribution, if any, in a manner that reasonably allows
|
||||
subsequent Recipients to identify the originator of the Contribution. </span></p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>Commercial distributors of software may
|
||||
accept certain responsibilities with respect to end users, business partners
|
||||
and the like. While this license is intended to facilitate the commercial use
|
||||
of the Program, the Contributor who includes the Program in a commercial
|
||||
product offering should do so in a manner which does not create potential
|
||||
liability for other Contributors. Therefore, if a Contributor includes the
|
||||
Program in a commercial product offering, such Contributor ("Commercial
|
||||
Contributor") hereby agrees to defend and indemnify every other
|
||||
Contributor ("Indemnified Contributor") against any losses, damages and
|
||||
costs (collectively "Losses") arising from claims, lawsuits and other
|
||||
legal actions brought by a third party against the Indemnified Contributor to
|
||||
the extent caused by the acts or omissions of such Commercial Contributor in
|
||||
connection with its distribution of the Program in a commercial product
|
||||
offering. The obligations in this section do not apply to any claims or Losses
|
||||
relating to any actual or alleged intellectual property infringement. In order
|
||||
to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
|
||||
Contributor in writing of such claim, and b) allow the Commercial Contributor
|
||||
to control, and cooperate with the Commercial Contributor in, the defense and
|
||||
any related settlement negotiations. The Indemnified Contributor may participate
|
||||
in any such claim at its own expense.</span> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>For example, a Contributor might include the
|
||||
Program in a commercial product offering, Product X. That Contributor is then a
|
||||
Commercial Contributor. If that Commercial Contributor then makes performance
|
||||
claims, or offers warranties related to Product X, those performance claims and
|
||||
warranties are such Commercial Contributor's responsibility alone. Under this
|
||||
section, the Commercial Contributor would have to defend claims against the
|
||||
other Contributors related to those performance claims and warranties, and if a
|
||||
court requires any other Contributor to pay any damages as a result, the
|
||||
Commercial Contributor must pay those damages.</span> </p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
|
||||
AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
|
||||
WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
|
||||
responsible for determining the appropriateness of using and distributing the
|
||||
Program and assumes all risks associated with its exercise of rights under this
|
||||
Agreement , including but not limited to the risks and costs of program errors,
|
||||
compliance with applicable laws, damage to or loss of data, programs or
|
||||
equipment, and unavailability or interruption of operations. </span></p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
|
||||
AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
|
||||
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
|
||||
THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
|
||||
|
||||
<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
|
||||
or unenforceable under applicable law, it shall not affect the validity or
|
||||
enforceability of the remainder of the terms of this Agreement, and without
|
||||
further action by the parties hereto, such provision shall be reformed to the
|
||||
minimum extent necessary to make such provision valid and enforceable.</span> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
|
||||
against any entity (including a cross-claim or counterclaim in a lawsuit)
|
||||
alleging that the Program itself (excluding combinations of the Program with
|
||||
other software or hardware) infringes such Recipient's patent(s), then such
|
||||
Recipient's rights granted under Section 2(b) shall terminate as of the date
|
||||
such litigation is filed. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
|
||||
shall terminate if it fails to comply with any of the material terms or
|
||||
conditions of this Agreement and does not cure such failure in a reasonable
|
||||
period of time after becoming aware of such noncompliance. If all Recipient's
|
||||
rights under this Agreement terminate, Recipient agrees to cease use and
|
||||
distribution of the Program as soon as reasonably practicable. However,
|
||||
Recipient's obligations under this Agreement and any licenses granted by
|
||||
Recipient relating to the Program shall continue and survive. </span></p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
|
||||
copies of this Agreement, but in order to avoid inconsistency the Agreement is
|
||||
copyrighted and may only be modified in the following manner. The Agreement
|
||||
Steward reserves the right to publish new versions (including revisions) of
|
||||
this Agreement from time to time. No one other than the Agreement Steward has
|
||||
the right to modify this Agreement. The Eclipse Foundation is the initial
|
||||
Agreement Steward. The Eclipse Foundation may assign the responsibility to
|
||||
serve as the Agreement Steward to a suitable separate entity. Each new version
|
||||
of the Agreement will be given a distinguishing version number. The Program
|
||||
(including Contributions) may always be distributed subject to the version of
|
||||
the Agreement under which it was received. In addition, after a new version of
|
||||
the Agreement is published, Contributor may elect to distribute the Program
|
||||
(including its Contributions) under the new version. Except as expressly stated
|
||||
in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
|
||||
the intellectual property of any Contributor under this Agreement, whether
|
||||
expressly, by implication, estoppel or otherwise. All rights in the Program not
|
||||
expressly granted under this Agreement are reserved.</span> </p>
|
||||
|
||||
<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
|
||||
State of New York and the intellectual property laws of the United States of
|
||||
America. No party to this Agreement will bring a legal action under this
|
||||
Agreement more than one year after the cause of action arose. Each party waives
|
||||
its rights to a jury trial in any resulting litigation.</span> </p>
|
||||
|
||||
<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,5 +0,0 @@
|
||||
xcat-openstack (2.9) unstable; urgency=low
|
||||
|
||||
* Initial release
|
||||
|
||||
-- root <root@unknown> Mon, 01 Jul 2013 15:04:41 +0800
|
||||
@@ -1 +0,0 @@
|
||||
8
|
||||
@@ -1,14 +0,0 @@
|
||||
Source: xcat-openstack
|
||||
Section: admin
|
||||
Priority: extra
|
||||
Maintainer: xCAT <xcat-user@lists.sourceforge.net>
|
||||
Build-Depends: debhelper (>= 8.0.0)
|
||||
Standards-Version: 3.9.2
|
||||
#Vcs-Git: git://git.debian.org/collab-maint/xcat-openstack.git
|
||||
#Vcs-Browser: http://git.debian.org/?p=collab-maint/xcat-openstack.git;a=summary
|
||||
|
||||
Package: xcat-openstack
|
||||
Architecture: all
|
||||
Depends: xcat
|
||||
Description: Meta-Metapackage for a common, default xCAT management node setup with OpenStack
|
||||
xCAT-OpenStack is an xCAT management node package intended for at-scale management with OpenStack, including hardware management and software management.
|
||||
@@ -1,88 +0,0 @@
|
||||
Eclipse Public License - v 1.0
|
||||
|
||||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||
|
||||
1. DEFINITIONS
|
||||
|
||||
"Contribution" means:
|
||||
|
||||
a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
|
||||
b) in the case of each subsequent Contributor:
|
||||
|
||||
i) changes to the Program, and
|
||||
|
||||
ii) additions to the Program;
|
||||
|
||||
where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
|
||||
|
||||
"Contributor" means any person or entity that distributes the Program.
|
||||
|
||||
"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
|
||||
|
||||
"Program" means the Contributions distributed in accordance with this Agreement.
|
||||
|
||||
"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
|
||||
|
||||
2. GRANT OF RIGHTS
|
||||
|
||||
a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
|
||||
|
||||
b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
|
||||
|
||||
c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
|
||||
|
||||
d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
|
||||
|
||||
3. REQUIREMENTS
|
||||
|
||||
A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
|
||||
|
||||
a) it complies with the terms and conditions of this Agreement; and
|
||||
|
||||
b) its license agreement:
|
||||
|
||||
i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
|
||||
|
||||
ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
|
||||
|
||||
iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
|
||||
|
||||
iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
|
||||
|
||||
When the Program is made available in source code form:
|
||||
|
||||
a) it must be made available under this Agreement; and
|
||||
|
||||
b) a copy of this Agreement must be included with each copy of the Program.
|
||||
|
||||
Contributors may not remove or alter any copyright notices contained within the Program.
|
||||
|
||||
Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
|
||||
|
||||
4. COMMERCIAL DISTRIBUTION
|
||||
|
||||
Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
|
||||
|
||||
For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
|
||||
|
||||
5. NO WARRANTY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
|
||||
|
||||
6. DISCLAIMER OF LIABILITY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
7. GENERAL
|
||||
|
||||
If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
|
||||
|
||||
If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
|
||||
|
||||
All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
|
||||
|
||||
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
|
||||
|
||||
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
opt/xcat/lib/perl/xCAT_schema
|
||||
@@ -1 +0,0 @@
|
||||
lib/perl/xCAT_schema/* opt/xcat/lib/perl/xCAT_schema/
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# This file was originally written by Joey Hess and Craig Small.
|
||||
# As a special exception, when this file is copied by dh-make into a
|
||||
# dh-make output file, you may use that output file without restriction.
|
||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
build:
|
||||
pwd
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -d
|
||||
|
||||
install:
|
||||
pwd
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installdirs
|
||||
dh_install -X".svn"
|
||||
chmod 755 `pwd`/debian/xcat-openstack/opt/xcat/lib/perl/xCAT_schema
|
||||
chmod 644 `pwd`/debian/xcat-openstack/opt/xcat/lib/perl/xCAT_schema/*
|
||||
dh_link
|
||||
|
||||
binary-indep: build install
|
||||
pwd
|
||||
export
|
||||
dh_installman
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary-arch:
|
||||
pwd
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||
@@ -1 +0,0 @@
|
||||
1.0
|
||||
@@ -1,106 +0,0 @@
|
||||
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT_schema::Clouds;
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# xCAT database Schema for representing OpenStack clouds in an xCAT cluster
|
||||
#
|
||||
################################################################################
|
||||
%tabspec = (
|
||||
clouds => {
|
||||
cols => [qw(name controller publicnet novanet mgtnet vmnet adminpw dbpwcomments disable)], #do not change 'disable' and 'comments', it is required by xCAT
|
||||
keys => [qw(name)],
|
||||
required => [qw(name)],
|
||||
table_desc => 'OpenStack clouds managed by this xCAT cluster',
|
||||
descriptions => {
|
||||
name => 'The name of this cloud',
|
||||
controller => 'The xCAT node name of the controller node',
|
||||
publicnet => 'The name of the network in the xCAT networks table to be used for the OpenStack public network',
|
||||
novanet => 'The name of the network in the xCAT networks table to be used for the OpenStack Nova network',
|
||||
mgtnet => 'The name of the network in the xCAT networks table to be used for the OpenStack management network',
|
||||
vmnet => 'The name of the network in the xCAT networks table to be used for the OpenStack virtual machine network',
|
||||
adminpw => 'The administrative password',
|
||||
dbpw => 'The database password',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
cloud => {
|
||||
cols => [qw(node cloudname comments disable)],
|
||||
keys => [qw(node)],
|
||||
required => [qw(node cloudname)],
|
||||
table_desc => 'xCAT nodes that are used in OpenStack clouds',
|
||||
descriptions => {
|
||||
node=> 'The xCAT node name',
|
||||
cloudname => 'The name of the cloud in the xCAT clouds table that is using this node',
|
||||
comments => 'Any user-written notes.',
|
||||
disable => "Set to 'yes' or '1' to comment out this row.",
|
||||
},
|
||||
},
|
||||
); # end of tabspec definition
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
##################################################################
|
||||
#
|
||||
# Cloud object and attributes for *def commands
|
||||
#
|
||||
##################################################################
|
||||
|
||||
# cloud object
|
||||
%defspec = (
|
||||
cloud => { attrs => [], attrhash => {}, objkey => 'name' },
|
||||
);
|
||||
|
||||
# cloud attributes
|
||||
@{$defspec{cloud}->{'attrs'}} =
|
||||
(
|
||||
{ attr_name => 'name',
|
||||
tabentry => 'clouds.name',
|
||||
access_tabentry => 'clouds.name=attr:name',
|
||||
},
|
||||
{ attr_name => 'controller',
|
||||
tabentry => 'clouds.controller',
|
||||
access_tabentry => 'clouds.name=attr:name',
|
||||
},
|
||||
{ attr_name => 'publicnet',
|
||||
tabentry => 'clouds.publicnet',
|
||||
access_tabentry => 'clouds.name=attr:name',
|
||||
},
|
||||
{ attr_name => 'novanet',
|
||||
tabentry => 'clouds.novanet',
|
||||
access_tabentry => 'clouds.name=attr:name',
|
||||
},
|
||||
{ attr_name => 'mgtnet',
|
||||
tabentry => 'clouds.mgtnet',
|
||||
access_tabentry => 'clouds.name=attr:name',
|
||||
},
|
||||
{ attr_name => 'vmnet',
|
||||
tabentry => 'clouds.vmnet',
|
||||
access_tabentry => 'clouds.name=attr:name',
|
||||
},
|
||||
{ attr_name => 'adminpw',
|
||||
tabentry => 'clouds.adminpw',
|
||||
access_tabentry => 'clouds.name=attr:name',
|
||||
},
|
||||
{ attr_name => 'dbpw',
|
||||
tabentry => 'clouds.dbpw',
|
||||
access_tabentry => 'clouds.name=attr:name',
|
||||
},
|
||||
);
|
||||
|
||||
# node attributes for clouds
|
||||
@{$defspec{node}->{'attrs'}} =
|
||||
(
|
||||
{ attr_name => 'cloud',
|
||||
tabentry => 'cloud.cloudname',
|
||||
access_tabentry => 'cloud.node=attr:node',
|
||||
},
|
||||
);
|
||||
1;
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
Summary: Meta-Metapackage for a common, default xCAT management node setup with OpenStack
|
||||
Name: xCAT-OpenStack
|
||||
Version: %(cat Version)
|
||||
Release: snap%(date +"%Y%m%d%H%M")
|
||||
License: EPL
|
||||
Group: Applications/System
|
||||
Vendor: IBM Corp.
|
||||
Packager: IBM Corp.
|
||||
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
|
||||
Prefix: /opt/xcat
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
|
||||
#BuildArch: noarch
|
||||
Source: xCAT-OpenStack-%(cat Version).tar.gz
|
||||
|
||||
Provides: xCAT-OpenStack = %{version}
|
||||
Requires: xCAT
|
||||
|
||||
%description
|
||||
xCAT-OpenStack is an xCAT management node package intended for at-scale
|
||||
management with OpenStack, including hardware management and software
|
||||
management.
|
||||
|
||||
%prep
|
||||
%setup -q -n xCAT-OpenStack
|
||||
|
||||
%build
|
||||
|
||||
|
||||
%install
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema
|
||||
|
||||
cp -a lib/perl/xCAT_schema/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema
|
||||
find $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema -type d -exec chmod 755 {} \;
|
||||
find $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema -type f -exec chmod 644 {} \;
|
||||
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%{prefix}
|
||||
%defattr(-,root,root)
|
||||
|
||||
|
||||
%post
|
||||
%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 reload
|
||||
fi
|
||||
fi
|
||||
%endif
|
||||
exit 0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Source: xcat-ui
|
||||
Section: admin
|
||||
Priority: extra
|
||||
Maintainer: xCAT <xcat-user@lists.sourceforge.net>
|
||||
Maintainer: Arif Ali <aali@ocf.co.uk>
|
||||
Build-Depends: debhelper (>= 5)
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ function loadConfigPage() {
|
||||
tab.add('discoverTab', 'Discover', '', false);
|
||||
|
||||
// Add the self-service tab
|
||||
tab.add('serviceTab', 'Service', '', false);
|
||||
tab.add('serviceTab', 'Service', '', false);
|
||||
|
||||
// Get list of tables and their descriptions
|
||||
$.ajax({
|
||||
@@ -98,7 +98,7 @@ function loadConfigPage() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui.index == 1) {
|
||||
if (ui.index == 1) {
|
||||
loadUpdatePage();
|
||||
} else if (ui.index == 2) {
|
||||
loadUserPage();
|
||||
|
||||
+34
-114
@@ -19,9 +19,9 @@ function loadServicePage(tabId) {
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" disabled/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm" disabled/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm" checked/>z\/VM</li>');
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
@@ -315,7 +315,7 @@ function configImagePanel(data) {
|
||||
});
|
||||
|
||||
// Create an action menu
|
||||
var actionsMenu = createMenu([refreshLnk, createLnk, editLnk, deleteLnk]);
|
||||
var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]);
|
||||
actionsMenu.superfish();
|
||||
actionsMenu.css('display', 'inline-block');
|
||||
actionBar.append(actionsMenu);
|
||||
@@ -731,7 +731,7 @@ function configGroupPanel(data) {
|
||||
// Create table
|
||||
var tableId = panelId + 'Datatable';
|
||||
var table = new DataTable(tableId);
|
||||
table.init(['<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">', 'Name', 'Selectable', 'IP', 'Hostname', 'Description']);
|
||||
table.init(['<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">', 'Name', 'Selectable', 'IP', 'Hostname', 'Network', 'Description']);
|
||||
|
||||
// Insert groups into table
|
||||
var nodePos = 0;
|
||||
@@ -787,6 +787,12 @@ function configGroupPanel(data) {
|
||||
desc = jQuery.trim(desc);
|
||||
}
|
||||
|
||||
// Save network
|
||||
if (tmp[j].indexOf('network:') > -1) {
|
||||
network = tmp[j].replace('network:', '');
|
||||
network = jQuery.trim(network);
|
||||
}
|
||||
|
||||
// Is the group selectable?
|
||||
if (tmp[j].indexOf('selectable:') > -1) {
|
||||
selectable = tmp[j].replace('selectable:', '');
|
||||
@@ -796,7 +802,7 @@ function configGroupPanel(data) {
|
||||
}
|
||||
|
||||
// Columns are: name, selectable, network, and description
|
||||
var cols = new Array(name, selectable, ip, hostname, desc);
|
||||
var cols = new Array(name, selectable, ip, hostname, network, desc);
|
||||
|
||||
// Add remove button where id = user name
|
||||
cols.unshift('<input type="checkbox" name="' + name + '"/>');
|
||||
@@ -845,9 +851,10 @@ function configGroupPanel(data) {
|
||||
var selectable = cols.eq(2).text();
|
||||
var ip = cols.eq(3).text();
|
||||
var hostnames = cols.eq(4).text();
|
||||
var description = cols.eq(5).text();
|
||||
var network = cols.eq(5).text();
|
||||
var description = cols.eq(6).text();
|
||||
|
||||
editGroupDialog(group, selectable, ip, hostnames, description);
|
||||
editGroupDialog(group, selectable, ip, hostnames, network, description);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -868,7 +875,7 @@ function configGroupPanel(data) {
|
||||
});
|
||||
|
||||
// Create an action menu
|
||||
var actionsMenu = createMenu([refreshLnk, createLnk, editLnk, deleteLnk]);
|
||||
var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]);
|
||||
actionsMenu.superfish();
|
||||
actionsMenu.css('display', 'inline-block');
|
||||
actionBar.append(actionsMenu);
|
||||
@@ -906,10 +913,9 @@ function groupDialog() {
|
||||
var selectable = $('<div><label>Selectable:</label><input type="checkbox" name="selectable" title="Select if you want this group to appear on the self service portal"/></div>');
|
||||
var ip = $('<div><label>IP:</label><input type="text" name="ip" title="The IP address of the nodes, usually given as a regular expression, e.g. |ihost(\d+)|10.1.1.($1+0)|"/></div>');
|
||||
var hostnames = $('<div><label>Hostnames:</label><input type="text" name="hostnames" title="The hostname of the nodes, usually given as a regular expression, e.g. |(.*)|($1).sourceforge.net|"/></div>');
|
||||
var network = $('<div><label>Network:</label><input type="text" name="network" title="The groups network and its subnet mask, e.g. 10.1.1.0/24"/></div>');
|
||||
var comments = $('<div><label>Description:</label><input type="text" name="comments" title="A description of the group"/></div>');
|
||||
var ipPool = $('<div><label style="vertical-align: top;">IP pool:</label><textarea name="ip_pool" title="A pool of node names, IP addresses, and hostnames that can be chosen from for a newly provisioned virtual machine. An entry in the pool could be: ihost12,10.1.2.12,ihost12.endicott.ibm.com. A newline separates each entry."/></div>');
|
||||
|
||||
groupForm.append(group, selectable, ip, hostnames, comments, ipPool);
|
||||
groupForm.append(group, selectable, ip, hostnames, network, comments);
|
||||
|
||||
// Generate tooltips
|
||||
groupForm.find('div input[title],textarea[title],select[title]').tooltip({
|
||||
@@ -939,7 +945,7 @@ function groupDialog() {
|
||||
close: function(){
|
||||
$(this).remove();
|
||||
},
|
||||
width: 600,
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Ok": function() {
|
||||
// Remove any warning messages
|
||||
@@ -950,12 +956,12 @@ function groupDialog() {
|
||||
var selectable = $(this).find('input[name="selectable"]');
|
||||
var ip = $(this).find('input[name="ip"]');
|
||||
var hostnames = $(this).find('input[name="hostnames"]');
|
||||
var network = $(this).find('input[name="network"]');
|
||||
var comments = $(this).find('input[name="comments"]');
|
||||
var ipPool = $(this).find('textarea[name=ip_pool]').val();
|
||||
|
||||
// Check that group attributes are provided before continuing
|
||||
var ready = 1;
|
||||
var inputs = new Array(group);
|
||||
var inputs = new Array(group, ip, hostnames, network);
|
||||
for (var i in inputs) {
|
||||
if (!inputs[i].val()) {
|
||||
inputs[i].css('border-color', 'red');
|
||||
@@ -974,10 +980,6 @@ function groupDialog() {
|
||||
'Close': function() {$(this).dialog("close");}
|
||||
});
|
||||
|
||||
// A newline at the end of IP pool is needed
|
||||
ipPool = ipPool.replace(/^\s+|\s+$/g, '');
|
||||
ipPool += '\n';
|
||||
|
||||
// Set default description
|
||||
if (!comments.val())
|
||||
comments.val('No description');
|
||||
@@ -986,12 +988,12 @@ function groupDialog() {
|
||||
var args = "updategroup;" + group.val() + ";'" + ip.val() + "';'" + hostnames.val() + "';";
|
||||
|
||||
if (selectable.attr("checked"))
|
||||
args += "'description:" + comments.val() + "|selectable:yes";
|
||||
args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:yes";
|
||||
else
|
||||
args += "'description:" + comments.val() + "|selectable:no";
|
||||
args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:no";
|
||||
|
||||
// Add image to xCAT
|
||||
$.ajax({
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
@@ -1003,37 +1005,6 @@ function groupDialog() {
|
||||
|
||||
success : updatePanel
|
||||
});
|
||||
|
||||
// Write IP pool file to /var/tmp
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'write',
|
||||
tgt : '/var/tmp/' + group.val() + '.pool',
|
||||
args : '',
|
||||
cont : ipPool,
|
||||
msg : dialogId + ';' + group.val()
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
var args = data.msg.split(';');
|
||||
|
||||
// Create profile in xCAT
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'mkippool;' + args[1],
|
||||
msg : args[0]
|
||||
},
|
||||
|
||||
success: updatePanel
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
"Cancel": function() {
|
||||
@@ -1050,9 +1021,10 @@ function groupDialog() {
|
||||
* @param iSelectable Is group selectable from the service page
|
||||
* @param iIp Group IP regex
|
||||
* @param iHostnames Group hostnames regex
|
||||
* @param iNetwork Group network, e.g. 10.1.2.0/24
|
||||
* @param iComments Group description
|
||||
*/
|
||||
function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iComments) {
|
||||
function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iNetwork, iComments) {
|
||||
// Create form to add profile
|
||||
var dialogId = 'createGroup-' + iGroup;
|
||||
var groupForm = $('<div id="' + dialogId + '" class="form"></div>');
|
||||
@@ -1065,32 +1037,15 @@ function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iComments) {
|
||||
var selectable = $('<div><label>Selectable:</label><input type="checkbox" name="selectable" title="Select if you want this group to appear on the self service portal"/></div>');
|
||||
var ip = $('<div><label>IP:</label><input type="text" name="ip" title="The IP address for the group, usually given as a regular expression, e.g. |ihost(\d+)|10.1.1.($1+0)|"/></div>');
|
||||
var hostnames = $('<div><label>Hostnames:</label><input type="text" name="hostnames" title="The hostname for the group, usually given as a regular expression, e.g. |(.*)|($1).sourceforge.net|"/></div>');
|
||||
var network = $('<div><label>Network:</label><input type="text" name="network" title="The groups network and its subnet mask, e.g. 10.1.1.0/24"/></div>');
|
||||
var comments = $('<div><label>Description:</label><input type="text" name="comments" title="A description of the group"/></div>');
|
||||
var ipPool = $('<div><label style="vertical-align: top;">IP pool:</label><textarea name="ip_pool" title="A pool of node names, IP addresses, and hostnames that can be chosen from for a newly provisioned virtual machine."/></div>');
|
||||
|
||||
groupForm.append(group, selectable, ip, hostnames, comments, ipPool);
|
||||
|
||||
// Query IP pool based on group name
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'lsippool;' + iGroup,
|
||||
msg : dialogId
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
// Populate textarea with IP pool entries
|
||||
$('#' + data.msg).find('textarea[name="ip_pool"]').val(data.rsp[0]);
|
||||
}
|
||||
});
|
||||
groupForm.append(group, selectable, ip, hostnames, network, comments);
|
||||
|
||||
// Fill in group attributes
|
||||
groupForm.find('input[name="group"]').val(iGroup);
|
||||
groupForm.find('input[name="ip"]').val(iIp);
|
||||
groupForm.find('input[name="hostnames"]').val(iHostnames);
|
||||
groupForm.find('input[name="network"]').val(iNetwork);
|
||||
groupForm.find('input[name="comments"]').val(iComments);
|
||||
if (iSelectable == "yes")
|
||||
groupForm.find('input[name="selectable"]').attr('checked', 'checked');
|
||||
@@ -1123,7 +1078,7 @@ function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iComments) {
|
||||
close: function(){
|
||||
$(this).remove();
|
||||
},
|
||||
width: 600,
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Ok": function() {
|
||||
// Remove any warning messages
|
||||
@@ -1134,12 +1089,12 @@ function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iComments) {
|
||||
var selectable = $(this).find('input[name="selectable"]');
|
||||
var ip = $(this).find('input[name="ip"]');
|
||||
var hostnames = $(this).find('input[name="hostnames"]');
|
||||
var network = $(this).find('input[name="network"]');
|
||||
var comments = $(this).find('input[name="comments"]');
|
||||
var ipPool = $(this).find('textarea[name=ip_pool]').val();
|
||||
|
||||
// Check that group attributes are provided before continuing
|
||||
var ready = 1;
|
||||
var inputs = new Array(group);
|
||||
var inputs = new Array(group, ip, hostnames, network);
|
||||
for (var i in inputs) {
|
||||
if (!inputs[i].val()) {
|
||||
inputs[i].css('border-color', 'red');
|
||||
@@ -1158,10 +1113,6 @@ function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iComments) {
|
||||
'Close': function() {$(this).dialog("close");}
|
||||
});
|
||||
|
||||
// A newline at the end of IP pool is needed
|
||||
ipPool = ipPool.replace(/^\s+|\s+$/g, '');
|
||||
ipPool += '\n';
|
||||
|
||||
// Set default description
|
||||
if (!comments.val())
|
||||
comments.val('No description');
|
||||
@@ -1170,9 +1121,9 @@ function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iComments) {
|
||||
var args = "updategroup;" + group.val() + ";'" + ip.val() + "';'" + hostnames.val() + "';";
|
||||
|
||||
if (selectable.attr("checked"))
|
||||
args += "'description:" + comments.val() + "|selectable:yes";
|
||||
args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:yes";
|
||||
else
|
||||
args += "'description:" + comments.val() + "|selectable:no";
|
||||
args += "'description:" + comments.val() + "|network:" + network.val() + "|selectable:no";
|
||||
|
||||
// Add image to xCAT
|
||||
$.ajax( {
|
||||
@@ -1187,37 +1138,6 @@ function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iComments) {
|
||||
|
||||
success : updatePanel
|
||||
});
|
||||
|
||||
// Write IP pool file to /var/tmp
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'write',
|
||||
tgt : '/var/tmp/' + group.val() + '.pool',
|
||||
args : '',
|
||||
cont : ipPool,
|
||||
msg : dialogId + ';' + group.val()
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
var args = data.msg.split(';');
|
||||
|
||||
// Create profile in xCAT
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'mkippool;' + args[1],
|
||||
msg : args[0]
|
||||
},
|
||||
|
||||
success: updatePanel
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
"Cancel": function() {
|
||||
|
||||
@@ -84,35 +84,26 @@ function loadUserTable(data){
|
||||
// Add table rows
|
||||
// Start with the 2nd row (1st row is the headers)
|
||||
for (var i = 1; i < data.rsp.length; i++) {
|
||||
// Split into columns
|
||||
var cols = data.rsp[i].split(',');
|
||||
|
||||
// Trim returned data
|
||||
data.rsp[i] = jQuery.trim(data.rsp[i]);
|
||||
// Split data into columns
|
||||
var cols = data.rsp[i].split(',');
|
||||
|
||||
// Go through each column
|
||||
// Column names are: priority, name, host, commands, noderange, parameters, time, rule, comments, disable
|
||||
for (var j = 0; j < cols.length; j++) {
|
||||
|
||||
// If the column is not complete
|
||||
if (cols[j].count('"') == 1) {
|
||||
while (cols[j].count('"') != 2) {
|
||||
// Merge this column with the adjacent one
|
||||
cols[j] = cols[j] + "," + cols[j + 1];
|
||||
|
||||
// Remove merged row
|
||||
cols.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace quote
|
||||
cols[j] = cols[j].replace(new RegExp('"', 'g'), '');
|
||||
cols[j] = cols[j].replace(/"/g, '');
|
||||
}
|
||||
|
||||
// Set the highest priority
|
||||
priority = cols[0];
|
||||
if (priority > topPriority)
|
||||
topPriority = priority;
|
||||
|
||||
|
||||
// Add check box where name = user name
|
||||
cols.unshift('<input type="checkbox" name="' + cols[0] + '"/>');
|
||||
|
||||
|
||||
// Add row
|
||||
table.add(cols);
|
||||
}
|
||||
@@ -178,7 +169,7 @@ function loadUserTable(data){
|
||||
});
|
||||
|
||||
// Create an action menu
|
||||
var actionsMenu = createMenu([refreshLnk, createLnk, editLnk, deleteLnk]);
|
||||
var actionsMenu = createMenu([createLnk, editLnk, deleteLnk, refreshLnk]);
|
||||
actionsMenu.superfish();
|
||||
actionsMenu.css('display', 'inline-block');
|
||||
actionBar.append(actionsMenu);
|
||||
@@ -235,16 +226,8 @@ function openCreateUserDialog(data) {
|
||||
|
||||
userAttr.append($('<div><label>Priority:</label><input type="text" name="priority" disabled="disabled" value="' + priority + '" title="The priority value for this user"/></div>'));
|
||||
userAttr.append($('<div><label>User name:</label><input type="text" name="name" title="The user name to log into xCAT with"/></div>'));
|
||||
var type = $('<div><label>Type:</label></div>');
|
||||
var typeSelect = $('<select name="user_type" title="Specifies the type of user.">' +
|
||||
'<option value="guest">Guest</option>' +
|
||||
'<option value="admin">Administrator</option>' +
|
||||
'</select>');
|
||||
type.append(typeSelect);
|
||||
userAttr.append(type);
|
||||
userAttr.append($('<div><label>Password:</label><input name="password" type="password" title="The user password that will be used to log into xCAT"></div>'));
|
||||
userAttr.append($('<div><label>Confirm password:</label><input name="confirm_password" type="password" title="The user password that will be used to log into xCAT"></div>'));
|
||||
|
||||
optionAttr.append($('<div><label>Host:</label><input type="text" name="host" title="The host from which users may issue the commands specified by this rule. By default, it is all hosts."/></div>'));
|
||||
optionAttr.append($('<div><label>Commands:</label><input type="text" name="commands" title="The list of commands that this rule applies to. By default, it is all commands."/></div>'));
|
||||
optionAttr.append($('<div><label>Parameters:</label><input type="text" name="parameters" title="A regular expression that matches the command parameters (everything except the noderange) that this rule applies to. By default, it is all parameters."/></div>'));
|
||||
@@ -255,6 +238,10 @@ function openCreateUserDialog(data) {
|
||||
'<option value="trusted">Trusted</option>' +
|
||||
'<option value="deny">Deny</option>' +
|
||||
'</select></div>'));
|
||||
var rootPrivilege = $('<div><label>Root privilege:</label></div>');
|
||||
var accessCheckbox = $('<input type="checkbox" name="rootprivilege"/>');
|
||||
optionAttr.append(rootPrivilege);
|
||||
rootPrivilege.append(accessCheckbox);
|
||||
|
||||
optionAttr.append($('<div><label>Comments:</label><input type="text" name="comments" style="width: 250px;" title="Any user written notes"/></div>'));
|
||||
optionAttr.append($('<div><label>Disable:</label><select name="disable" title="Set to yes to disable the user">' +
|
||||
@@ -326,41 +313,20 @@ function openCreateUserDialog(data) {
|
||||
var args = "";
|
||||
if (usrName) {
|
||||
args += ' policy.name=' + usrName;
|
||||
} if (host) {
|
||||
args += " policy.host='" + host + "'";
|
||||
} if (commands) {
|
||||
args += " policy.commands='" + commands + "'";
|
||||
} if (parameters) {
|
||||
args += " policy.parameters='" + parameters + "'";
|
||||
} if (nodeRange) {
|
||||
args += " policy.noderange='" + nodeRange + "'";
|
||||
} if (rule) {
|
||||
args += ' policy.rule=' + rule;
|
||||
} if (disable) {
|
||||
args += ' policy.disable=' + disable;
|
||||
}
|
||||
|
||||
// Handle cases where there are value or no value
|
||||
if (host) {
|
||||
args += " policy.host='" + host + "'";
|
||||
} else {
|
||||
args += " policy.host=''";
|
||||
}
|
||||
|
||||
if (parameters) {
|
||||
args += " policy.parameters='" + parameters + "'";
|
||||
} else {
|
||||
args += " policy.parameters=''";
|
||||
}
|
||||
|
||||
if (nodeRange) {
|
||||
args += " policy.noderange='" + nodeRange + "'";
|
||||
} else {
|
||||
args += " policy.noderange=''";
|
||||
}
|
||||
|
||||
if (comments) {
|
||||
} if (comments) {
|
||||
args += " policy.comments='" + comments + "'";
|
||||
} else {
|
||||
args += " policy.comments=''";
|
||||
}
|
||||
|
||||
if (commands) {
|
||||
args += " policy.commands='" + commands + "'";
|
||||
} else {
|
||||
args += " policy.commands=''";
|
||||
}
|
||||
|
||||
// Trim any extra spaces
|
||||
@@ -410,32 +376,23 @@ function openCreateUserDialog(data) {
|
||||
});
|
||||
|
||||
// Change comments if access checkbox is checked
|
||||
typeSelect.change(function() {
|
||||
accessCheckbox.click( function(){
|
||||
var comments = createUserForm.find('input[name=comments]').val();
|
||||
var cmds = createUserForm.find('input[name=commands]').val();
|
||||
comments = jQuery.trim(comments);
|
||||
cmds = jQuery.trim(cmds);
|
||||
|
||||
var tag = "privilege:root";
|
||||
comments = jQuery.trim(comments);
|
||||
|
||||
// The list of every command used by the self-service page
|
||||
// Every command must be separated by a comma
|
||||
var authorizedCmds = "authcheck,lsdef,nodestat,tabdump,rinv,rpower,rmvm,webportal,webrun";
|
||||
|
||||
// Append tag to commands and comments
|
||||
if (typeSelect.val().indexOf("admin") > -1) {
|
||||
// Append tag to comments
|
||||
if (accessCheckbox.is(':checked')) {
|
||||
if (comments && comments.charAt(comments.length - 1) != ";") {
|
||||
comments += ";";
|
||||
}
|
||||
|
||||
comments += tag;
|
||||
createUserForm.find('input[name=comments]').val(comments);
|
||||
createUserForm.find('input[name=commands]').val("");
|
||||
createUserForm.find('input[name=comments]').val(comments);
|
||||
} else {
|
||||
comments = comments.replace(tag, "");
|
||||
comments = comments.replace(";;", ";");
|
||||
createUserForm.find('input[name=comments]').val(comments);
|
||||
createUserForm.find('input[name=commands]').val(authorizedCmds);
|
||||
createUserForm.find('input[name=comments]').val(comments);
|
||||
}
|
||||
|
||||
// Strip off leading semi-colon
|
||||
@@ -476,11 +433,8 @@ function openCreateUserDialog(data) {
|
||||
createUserForm.find('select[name=disable]').val(disable);
|
||||
|
||||
if (comments.indexOf("privilege:root") > -1) {
|
||||
typeSelect.val("admin");
|
||||
accessCheckbox.attr("checked", true);
|
||||
}
|
||||
} else {
|
||||
// Default user type to guest
|
||||
typeSelect.val("guest").change();
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -367,7 +367,7 @@ function addAmmNode(){
|
||||
$('#addBladeCenter').prepend(createInfoBar('AMM node was successfully added'));
|
||||
$('#addBladeCenter').dialog("option", "buttons", {
|
||||
"Close" : function() {
|
||||
$('#addBladeCenter').dialog('destroy').remove();
|
||||
$('#addBladeCenter').dialog('close');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -547,7 +547,7 @@ function addMmScanNode(){
|
||||
msg : ''
|
||||
},
|
||||
success : function(data){
|
||||
$('#addBladeCenter').dialog('destroy').remove();
|
||||
$('#addBladeCenter').dialog('close');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -546,10 +546,10 @@ esxPlugin.prototype.addNode = function() {
|
||||
title: 'Add node',
|
||||
modal: true,
|
||||
width: 400,
|
||||
close: function() {$(this).remove();},
|
||||
close: function(){$(this).remove();},
|
||||
buttons: {
|
||||
"OK" : function() {addEsxNode();},
|
||||
"Cancel": function() {$(this).dialog('destroy').remove();}
|
||||
"OK" : function(){addEsxNode();},
|
||||
"Cancel": function(){$(this).dialog('close');}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -587,8 +587,8 @@ function addEsxNode(){
|
||||
|
||||
// Change dialog buttons
|
||||
$('#addEsx').dialog('option', 'buttons', {
|
||||
'Close':function() {
|
||||
$('#addEsx').dialog('destroy').remove();
|
||||
'Close':function(){
|
||||
$('#addEsx').dialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ hmcPlugin.prototype.addNode = function() {
|
||||
addHmcNode();
|
||||
},
|
||||
'Cancel' : function() {
|
||||
$('#addHmc').dialog('destroy').remove();
|
||||
$('#addHmc').dialog('close');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -227,7 +227,7 @@ hmcPlugin.prototype.addNode = function() {
|
||||
// Change dialog buttons
|
||||
$('#addHmc').dialog('option', 'buttons', {
|
||||
'Cancel' : function() {
|
||||
$('#addHmc').dialog('destroy').remove();
|
||||
$('#addHmc').dialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -295,7 +295,7 @@ function addHmcNode() {
|
||||
msg : ''
|
||||
},
|
||||
success : function(data) {
|
||||
$('#addHmc').dialog('destroy').remove();
|
||||
$('#addHmc').dialog('close');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -349,7 +349,7 @@ function drawHmcSelector(hmcs) {
|
||||
addPNode();
|
||||
},
|
||||
'Cancel' : function() {
|
||||
$('#addHmc').dialog('destroy').remove();
|
||||
$('#addHmc').dialog('close');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -466,7 +466,7 @@ function addPNode() {
|
||||
},
|
||||
success : function(data) {
|
||||
// Refresh the area on the right side
|
||||
$('#addHmc').dialog('destroy').remove();
|
||||
$('#addHmc').dialog('close');
|
||||
$('.selectgroup').trigger('click');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -207,7 +207,7 @@ ipmiPlugin.prototype.addNode = function() {
|
||||
addIdataplex();
|
||||
},
|
||||
"Cancel" : function() {
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -247,7 +247,7 @@ function addIdataplex() {
|
||||
// Change dialog buttons
|
||||
$('#addIdplx').dialog('option', 'buttons', {
|
||||
'Close' : function() {
|
||||
$('#addIdplx').dialog('destroy').remove();
|
||||
$('#addIdplx').dialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -544,7 +544,7 @@ kvmPlugin.prototype.addNode = function() {
|
||||
close: function(){$(this).remove();},
|
||||
buttons: {
|
||||
"OK" : function(){addKvmNode();},
|
||||
"Cancel": function(){$(this).dialog('destroy').remove();}
|
||||
"Cancel": function(){$(this).dialog('close');}
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -583,7 +583,7 @@ function addKvmNode(){
|
||||
// Change dialog buttons
|
||||
$('#addKvm').dialog('option', 'buttons', {
|
||||
'Close':function(){
|
||||
$('#addKvm').dialog('destroy').remove();
|
||||
$('#addKvm').dialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+28
-44
@@ -33,7 +33,7 @@ zvmPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
|
||||
// Create accordion panel for images
|
||||
var imgSection = $('<div id="zvmConfigImages"></div>');
|
||||
var imgLnk = $('<h3><a href="#">Templates</a></h3>').click(function () {
|
||||
var imgLnk = $('<h3><a href="#">Images</a></h3>').click(function () {
|
||||
// Do not load panel again if it is already loaded
|
||||
if ($('#zvmConfigImages').find('.dataTables_wrapper').length)
|
||||
return;
|
||||
@@ -67,7 +67,7 @@ zvmPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
*
|
||||
* @param node Node to clone
|
||||
*/
|
||||
zvmPlugin.prototype.serviceClone = function(node) {
|
||||
zvmPlugin.prototype.serviceClone = function(node) {
|
||||
var owner = $.cookie('xcat_username');
|
||||
var group = getUserNodeAttr(node, 'groups');
|
||||
|
||||
@@ -95,7 +95,7 @@ zvmPlugin.prototype.loadServiceProvisionPage = function(tabId) {
|
||||
|
||||
// Create provision table
|
||||
var provTable = $('<table id="select-table" style="margin: 10px;"></table');
|
||||
var provHeader = $('<thead class="ui-widget-header"> <th>zVM</th> <th>Group</th> <th>Template</th> <th>Image</th></thead>');
|
||||
var provHeader = $('<thead class="ui-widget-header"> <th>zVM</th> <th>Group</th> <th>Image</th></thead>');
|
||||
var provBody = $('<tbody></tbody>');
|
||||
var provFooter = $('<tfoot></tfoot>');
|
||||
provTable.append(provHeader, provBody, provFooter);
|
||||
@@ -108,18 +108,16 @@ zvmPlugin.prototype.loadServiceProvisionPage = function(tabId) {
|
||||
// Create row to contain selections
|
||||
var provRow = $('<tr></tr>');
|
||||
provBody.append(provRow);
|
||||
// Create columns for zVM, group, template, and image
|
||||
// Create columns for zVM, group, and image
|
||||
var zvmCol = $('<td style="vertical-align: top;"></td>');
|
||||
provRow.append(zvmCol);
|
||||
var groupCol = $('<td style="vertical-align: top;"></td>');
|
||||
provRow.append(groupCol);
|
||||
var tmplCol = $('<td style="vertical-align: top;"></td>');
|
||||
provRow.append(tmplCol);
|
||||
var imgCol = $('<td style="vertical-align: top;"></td>');
|
||||
provRow.append(imgCol);
|
||||
var imageCol = $('<td style="vertical-align: top;"></td>');
|
||||
provRow.append(imageCol);
|
||||
|
||||
provRow.children('td').css({
|
||||
'min-width': '200px'
|
||||
'min-width': '250px'
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -132,38 +130,23 @@ zvmPlugin.prototype.loadServiceProvisionPage = function(tabId) {
|
||||
|
||||
var hcp = $('#select-table tbody tr:eq(0) td:eq(0) input[name="hcp"]:checked').val();
|
||||
var group = $('#select-table tbody tr:eq(0) td:eq(1) input[name="group"]:checked').val();
|
||||
var tmpl = $('#select-table tbody tr:eq(0) td:eq(2) input[name="image"]:checked').val();
|
||||
var img = $('#select-table tbody tr:eq(0) td:eq(3) input[name="master"]:checked').val();
|
||||
var img = $('#select-table tbody tr:eq(0) td:eq(2) input[name="image"]:checked').val();
|
||||
var owner = $.cookie('xcat_username');
|
||||
|
||||
if (img && !group) {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You need to select a group');
|
||||
warn.prependTo($(this).parent());
|
||||
} else if (!img && (!hcp || !group || !tmpl)) {
|
||||
if (!hcp || !group || !img) {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You need to select a zHCP, group, and image');
|
||||
var warn = createWarnBar('You need to select an option for each column');
|
||||
warn.prependTo($(this).parent());
|
||||
} else {
|
||||
if (img) {
|
||||
// Begin by clonning VM
|
||||
|
||||
// Submit request to clone VM
|
||||
// webportal clonezlinux [src node] [group] [owner]
|
||||
var iframe = createIFrame('lib/srv_cmd.php?cmd=webportal&tgt=&args=clonezlinux;' + img + ';' + group + ';' + owner + '&msg=&opts=flush');
|
||||
iframe.prependTo($('#zvmProvisionTab'));
|
||||
} else {
|
||||
// Begin by creating VM
|
||||
createzVM(tabId, group, hcp, tmpl, owner);
|
||||
}
|
||||
// Begin by creating VM
|
||||
createzVM(tabId, group, hcp, img, owner);
|
||||
}
|
||||
});
|
||||
provForm.append(provisionBtn);
|
||||
|
||||
// Load zVMs, groups, template, and image into their respective columns
|
||||
// Load zVMs, groups, and images into their respective columns
|
||||
loadSrvGroups(groupCol);
|
||||
loadOSImages(tmplCol);
|
||||
loadGoldenImages(imgCol);
|
||||
loadOSImages(imageCol);
|
||||
|
||||
// Get zVM host names
|
||||
if (!$.cookie('zvms')){
|
||||
@@ -1854,6 +1837,7 @@ zvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
*/
|
||||
zvmPlugin.prototype.loadResources = function() {
|
||||
// Reset resource table
|
||||
setDiskDataTable('');
|
||||
setNetworkDataTable('');
|
||||
|
||||
// Get hardware control points
|
||||
@@ -2034,12 +2018,12 @@ zvmPlugin.prototype.addNode = function() {
|
||||
|
||||
// If there are no errors
|
||||
if (ready) {
|
||||
$('#addZvm').append(createLoader());
|
||||
$('#addZvm').append(createLoader());
|
||||
|
||||
// Change dialog buttons
|
||||
$('#addZvm').dialog('option', 'buttons', {
|
||||
'Close':function() {
|
||||
$('#addZvm').dialog('destroy').remove();
|
||||
'Close':function(){
|
||||
$('#addZvm').dialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2084,12 +2068,12 @@ zvmPlugin.prototype.addNode = function() {
|
||||
var args = "";
|
||||
if (type == 'host') {
|
||||
args = node + ';zvm.hcp=' + hcp
|
||||
+ ';nodehm.mgt=zvm;nodetype.arch=s390x;hypervisor.type=zvm;groups=' + group
|
||||
+ ';nodehm.mgt=zvm;hypervisor.type=zvm;groups=' + group
|
||||
+ ';nodetype.os=' + os;
|
||||
} else {
|
||||
args = node + ';zvm.hcp=' + hcp
|
||||
+ ';zvm.userid=' + userId
|
||||
+ ';nodehm.mgt=zvm' + ';nodetype.arch=s390x' + ';groups=' + group;
|
||||
+ ';nodehm.mgt=zvm' + ';groups=' + group;
|
||||
}
|
||||
|
||||
if (ipRange != "" && ipRange != null) {
|
||||
@@ -2163,12 +2147,12 @@ zvmPlugin.prototype.addNode = function() {
|
||||
var args = "";
|
||||
if (type == 'host') {
|
||||
args = nodeRange + ';zvm.hcp=' + hcp
|
||||
+ ';nodehm.mgt=zvm;nodetype.arch=s390x;hypervisor.type=zvm;groups=' + group
|
||||
+ ';nodehm.mgt=zvm;hypervisor.type=zvm;groups=' + group
|
||||
+ ';nodetype.os=' + os;
|
||||
} else {
|
||||
args = nodeRange + ';zvm.hcp=' + hcp
|
||||
+ ';zvm.userid=' + userIdRange
|
||||
+ ';nodehm.mgt=zvm' + ';nodetype.arch=s390x' + ';groups=' + group;
|
||||
+ ';nodehm.mgt=zvm' + ';groups=' + group;
|
||||
}
|
||||
|
||||
if (ipRange)
|
||||
@@ -2232,7 +2216,7 @@ zvmPlugin.prototype.addNode = function() {
|
||||
}
|
||||
},
|
||||
"Cancel": function(){
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog( "close" );
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -2558,7 +2542,7 @@ zvmPlugin.prototype.loadLogPage = function(node) {
|
||||
logAttr.append(optsList);
|
||||
|
||||
// Create retrieve log checkbox
|
||||
var retrieveChkBox = $('<li><input type="checkbox" name="t"/></li>');
|
||||
var retrieveChkBox = $('<li><input type="checkbox" name="s"/></li>');
|
||||
optsList.append(retrieveChkBox);
|
||||
retrieveChkBox.append('Retrieve log');
|
||||
|
||||
@@ -2573,7 +2557,7 @@ zvmPlugin.prototype.loadLogPage = function(node) {
|
||||
setChkBox.append('Set options');
|
||||
|
||||
// Create log options input
|
||||
var logOpt = $('<li><label style="width: 80px; vertical-align: top;">Log options:</label><textarea name="logOpt"></textarea></li>');
|
||||
var logOpt = $('<li><label>Log options:</label><input type="text" name="logOpt"/></li>');
|
||||
logOpt.hide();
|
||||
optsList.append(logOpt);
|
||||
|
||||
@@ -2586,7 +2570,7 @@ zvmPlugin.prototype.loadLogPage = function(node) {
|
||||
tgtLog.toggle();
|
||||
});
|
||||
|
||||
setChkBox.find('input').bind('click', function(event) {
|
||||
setChkBox.bind('click', function(event) {
|
||||
logOpt.toggle();
|
||||
});
|
||||
|
||||
@@ -2645,7 +2629,7 @@ zvmPlugin.prototype.loadLogPage = function(node) {
|
||||
optStr += '-' + opt;
|
||||
|
||||
// If it is the retrieve log
|
||||
if (opt == 't') {
|
||||
if (opt == 's') {
|
||||
// Append log destination
|
||||
optStr += ';' + $('#' + newTabId + ' input[name=tgtLog]').val();
|
||||
}
|
||||
@@ -2653,7 +2637,7 @@ zvmPlugin.prototype.loadLogPage = function(node) {
|
||||
// If it is set options
|
||||
if (opt == 'o') {
|
||||
// Append options
|
||||
optStr += ';' + $('#' + newTabId + ' textarea[name=logOpt]').val();
|
||||
optStr += ';' + $('#' + newTabId + ' input[name=logOpt]').val();
|
||||
}
|
||||
|
||||
// Append ; to end of string
|
||||
|
||||
+507
-1145
File diff suppressed because it is too large
Load Diff
@@ -828,10 +828,10 @@ function mkCondRespDia() {
|
||||
}
|
||||
});
|
||||
}
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog('close');
|
||||
},
|
||||
'Cancel' : function() {
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -920,7 +920,7 @@ function chCondScopeDia() {
|
||||
});
|
||||
},
|
||||
'Cancel' : function() {
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -941,10 +941,10 @@ function mkResponseDia() {
|
||||
},
|
||||
buttons : {
|
||||
'Ok' : function() {
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog('close');
|
||||
},
|
||||
'Cancel' : function() {
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -994,7 +994,7 @@ function startStopCondRespDia() {
|
||||
},
|
||||
buttons : {
|
||||
'Close' : function() {
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1122,10 +1122,10 @@ function stopCondRespDia() {
|
||||
$('#rmcEventStatus div').empty().append(data.rsp[0]);
|
||||
}
|
||||
});
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog('close');
|
||||
},
|
||||
'Cancel' : function() {
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
+112
-129
@@ -400,7 +400,7 @@ function mkAddNodeLink() {
|
||||
});
|
||||
|
||||
// Close dialog
|
||||
addNodeForm.dialog('destroy').remove();
|
||||
addNodeForm.dialog('close');
|
||||
});
|
||||
advanced.append(advancedLnk);
|
||||
addNodeForm.append(advanced);
|
||||
@@ -410,39 +410,39 @@ function mkAddNodeLink() {
|
||||
modal: true,
|
||||
width: 400,
|
||||
title:'Add node',
|
||||
close: function() {$(this).remove();},
|
||||
close: function(){$(this).remove();},
|
||||
buttons: {
|
||||
'Ok': function() {
|
||||
'Ok': function(){
|
||||
// Get hardware management
|
||||
var mgt = $(this).find('select[name=mgt]').val();
|
||||
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
}
|
||||
|
||||
$(this).dialog('destroy').remove();
|
||||
plugin.addNode();
|
||||
$(this).dialog('close');
|
||||
},
|
||||
'Cancel': function(){
|
||||
$(this).dialog('destroy').remove();
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -658,15 +658,6 @@ function loadNodes(data) {
|
||||
}
|
||||
});
|
||||
|
||||
// Power softoff
|
||||
var powerSoftoffLnk = $('<a>Shutdown</a>');
|
||||
powerSoftoffLnk.click(function() {
|
||||
var tgtNodes = getNodesChecked(nodesTableId);
|
||||
if (tgtNodes) {
|
||||
powerNode(tgtNodes, 'softoff');
|
||||
}
|
||||
});
|
||||
|
||||
// Turn monitoring on
|
||||
var monitorOnLnk = $('<a>Monitor on</a>');
|
||||
monitorOnLnk.click(function() {
|
||||
@@ -695,15 +686,15 @@ function loadNodes(data) {
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
}
|
||||
|
||||
plugin.loadClonePage(tgtNodes[i]);
|
||||
@@ -732,7 +723,7 @@ function loadNodes(data) {
|
||||
var scriptLnk = $('<a>Run script</a>');
|
||||
scriptLnk.click(function() {
|
||||
var tgtNodes = getNodesChecked(nodesTableId);
|
||||
if (tgtNodes) {
|
||||
if (tgtNodes) {
|
||||
loadScriptPage(tgtNodes);
|
||||
}
|
||||
});
|
||||
@@ -740,21 +731,21 @@ function loadNodes(data) {
|
||||
// Migrate VM
|
||||
var migrateLnk = $('<a>Migrate</a>');
|
||||
migrateLnk.click(function() {
|
||||
var tgtNodes = getNodesChecked(nodesTableId).split(',');
|
||||
var mgt = "", tmp = "";
|
||||
var tgtNodes = getNodesChecked(nodesTableId).split(',');
|
||||
var mgt = "", tmp = "";
|
||||
for (var i in tgtNodes) {
|
||||
tmp = getNodeAttr(tgtNodes[i], 'mgt');
|
||||
tmp = getNodeAttr(tgtNodes[i], 'mgt');
|
||||
if (!mgt) {
|
||||
mgt = tmp
|
||||
mgt = tmp
|
||||
} else {
|
||||
if (tmp != mgt) {
|
||||
openDialog('warn', "You can pick only one type (mgt) of node to migrate!");
|
||||
return;
|
||||
}
|
||||
if (tmp != mgt) {
|
||||
openDialog('warn', "You can pick only one type (mgt) of node to migrate!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create an instance of the plugin
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
// Only hypervisors support migration
|
||||
@@ -855,24 +846,24 @@ function loadNodes(data) {
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
}
|
||||
|
||||
plugin.loadLogPage(tgtNodes[i]);
|
||||
@@ -881,7 +872,7 @@ function loadNodes(data) {
|
||||
|
||||
// Actions
|
||||
var actionsLnk = '<a>Actions</a>';
|
||||
var actsMenu = createMenu([cloneLnk, deleteLnk, migrateLnk, monitorOnLnk, monitorOffLnk, powerOnLnk, powerOffLnk, scriptLnk, powerSoftoffLnk]);
|
||||
var actsMenu = createMenu([cloneLnk, deleteLnk, migrateLnk, monitorOnLnk, monitorOffLnk, powerOnLnk, powerOffLnk, scriptLnk]);
|
||||
|
||||
// Configurations
|
||||
var configLnk = '<a>Configuration</a>';
|
||||
@@ -1355,7 +1346,7 @@ function addNodes2Table(data) {
|
||||
$('.node').bind('click', loadNode);
|
||||
|
||||
// Close dialog for updating table
|
||||
$('.ui-dialog-content').dialog('destroy').remove();
|
||||
$('.ui-dialog-content').dialog('close');
|
||||
|
||||
/**
|
||||
* Enable editable columns
|
||||
@@ -1363,8 +1354,8 @@ function addNodes2Table(data) {
|
||||
// Do not make 1st, 2nd, 3rd, 4th, 5th, or 6th column editable
|
||||
$('#' + nodesTableId + ' td:not(td:nth-child(1),td:nth-child(2),td:nth-child(3),td:nth-child(4),td:nth-child(5),td:nth-child(6))').editable(
|
||||
function(value, settings) {
|
||||
// If users did not do changes, return the value directly
|
||||
// jeditable save the old value in this.revert
|
||||
//if users did not do changes, return the value directly
|
||||
//jeditable save the old value in this.revert
|
||||
if ($(this).attr('revert') == value){
|
||||
return value;
|
||||
}
|
||||
@@ -1636,24 +1627,24 @@ function loadNode(e) {
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
switch(mgt) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
break;
|
||||
}
|
||||
|
||||
// Get tab area where a new tab will be inserted
|
||||
@@ -1758,13 +1749,13 @@ function loadUnlockPage(tgtNodes) {
|
||||
*/
|
||||
var unlockBtn = createButton('Unlock');
|
||||
unlockBtn.css({
|
||||
'width': '80px',
|
||||
'display': 'block'
|
||||
'width': '80px',
|
||||
'display': 'block'
|
||||
});
|
||||
unlockBtn.click(function() {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
// If a password is given
|
||||
var password = $('#' + newTabId + ' input[name=password]').css('border', 'solid #BDBDBD 1px');
|
||||
if (password.val()) {
|
||||
@@ -1822,7 +1813,7 @@ function loadScriptPage(tgtNodes) {
|
||||
// Create remote script form
|
||||
var scriptForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
// Create status bar
|
||||
var barId = 'scriptStatusBar' + inst;
|
||||
var statBar = createStatusBar(barId);
|
||||
statBar.hide();
|
||||
@@ -1896,12 +1887,12 @@ function loadScriptPage(tgtNodes) {
|
||||
*/
|
||||
var runBtn = createButton('Run');
|
||||
runBtn.css({
|
||||
'width': '80px'
|
||||
'width': '80px'
|
||||
});
|
||||
runBtn.click(function() {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
// Get script to run
|
||||
var textarea = $('#' + newTabId + ' textarea').css('border', 'solid #BDBDBD 1px');
|
||||
|
||||
@@ -2010,7 +2001,7 @@ function loadDeletePage(tgtNodes) {
|
||||
// Create delete form
|
||||
var deleteForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar, hide on load
|
||||
// Create status bar, hide on load
|
||||
var statBarId = 'deleteStatusBar' + inst;
|
||||
var statBar = createStatusBar(statBarId).hide();
|
||||
|
||||
@@ -2032,30 +2023,22 @@ function loadDeletePage(tgtNodes) {
|
||||
|
||||
// Confirm delete
|
||||
var instr = $('<p>Are you sure you want to delete <b>' + tgtNodesStr + '</b>?</p>').css('word-wrap', 'break-word');
|
||||
var dbOnly = $('<div><input type="checkbox" name="db-only"/>Only delete entries in database</div>');
|
||||
confirmAttr.append(instr);
|
||||
confirmAttr.append(dbOnly);
|
||||
|
||||
/**
|
||||
* Delete
|
||||
*/
|
||||
var deleteBtn = createButton('Delete');
|
||||
deleteBtn.click(function() {
|
||||
var cmd = "rmvm";
|
||||
// Only delete entries in database if checked
|
||||
if ($("#" + newTabId + " input[name='db-only']").attr('checked')) {
|
||||
cmd = "noderm";
|
||||
}
|
||||
|
||||
// Delete the virtual server
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : cmd,
|
||||
cmd : 'rmvm',
|
||||
tgt : tgtNodes,
|
||||
args : '',
|
||||
msg : 'out=' + statBarId + ';cmd=' + cmd + ';tgt=' + tgtNodes
|
||||
msg : 'out=' + statBarId + ';cmd=rmvm;tgt=' + tgtNodes
|
||||
},
|
||||
|
||||
success : updateStatusBar
|
||||
@@ -2118,6 +2101,18 @@ function updateStatusBar(data) {
|
||||
if (prg.html().indexOf('Error') > -1) {
|
||||
failed = true;
|
||||
}
|
||||
|
||||
// Update data table
|
||||
var rowPos;
|
||||
for (var i in tgts) {
|
||||
if (!failed) {
|
||||
// Get row containing the node link and delete it
|
||||
rowPos = findRow(tgts[i], '#' + nodesTableId, 1);
|
||||
dTable.fnDeleteRow(rowPos);
|
||||
}
|
||||
}
|
||||
|
||||
adjustColumnSize(nodesTableId);
|
||||
} else if (cmd == 'xdsh') {
|
||||
// Hide loader
|
||||
$('#' + statBarId).find('img').hide();
|
||||
@@ -2140,13 +2135,6 @@ function updateStatusBar(data) {
|
||||
|
||||
// Enable buttons
|
||||
$('#' + statBarId).parent().find('button').removeAttr('disabled');
|
||||
} else if (cmd == 'noderm') {
|
||||
// Hide loader
|
||||
$('#' + statBarId).find('img').hide();
|
||||
|
||||
// Write ajax response to status bar
|
||||
var prg = $('<pre>Entries deleted in database</pre>');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
} else {
|
||||
// Hide loader
|
||||
$('#' + statBarId).find('img').hide();
|
||||
@@ -2164,7 +2152,7 @@ function updateStatusBar(data) {
|
||||
*/
|
||||
function updatePowerStatus(data) {
|
||||
// Hide power loader
|
||||
var powerCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(3)');
|
||||
var powerCol = $('#' + nodesTableId + '_wrapper .dataTables_scrollHead .datatable thead tr th:eq(3)');
|
||||
powerCol.find('img').hide();
|
||||
|
||||
// Get datatable
|
||||
@@ -2218,8 +2206,8 @@ function runScript(inst) {
|
||||
|
||||
var statBarId = 'scriptStatusBar' + inst;
|
||||
$('#' + statBarId).show(); // Show status bar
|
||||
$('#' + statBarId + ' img').show(); // Show loader
|
||||
$('#' + statBarId + ' p').remove(); // Clear status bar
|
||||
$('#' + statBarId + ' img').show(); // Show loader
|
||||
$('#' + statBarId + ' p').remove(); // Clear status bar
|
||||
|
||||
// Disable all fields
|
||||
$('#' + tabId + ' input').attr('disabled', 'true');
|
||||
@@ -3250,16 +3238,14 @@ function advancedLoad(group){
|
||||
}
|
||||
|
||||
var args;
|
||||
var shortzHcps = new Array();
|
||||
for (var h in hcps) {
|
||||
// Get node without domain name
|
||||
args = h.split('.');
|
||||
shortzHcps.push(args[0]);
|
||||
|
||||
// If there are no disk pools or network names cookie for this hcp
|
||||
if (!$.cookie(args[0] + 'diskpools') || !$.cookie(args[0] + 'networks')) {
|
||||
// Check if SMAPI is online
|
||||
$.ajax({
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
@@ -3272,13 +3258,10 @@ function advancedLoad(group){
|
||||
// Load hardware control point specific info
|
||||
// Get disk pools and network names
|
||||
success : loadHcpInfo
|
||||
});
|
||||
});
|
||||
}
|
||||
} // End of for
|
||||
|
||||
// Save zHCPs as a cookie
|
||||
setzHcpCookies(shortzHcps);
|
||||
|
||||
// Retrieve z/VM hypervisors and their zHCPs
|
||||
if (!$.cookie('zvms')) {
|
||||
$.ajax( {
|
||||
|
||||
+77
-21
@@ -68,7 +68,21 @@ function loadNodesetPage(tgtNodes) {
|
||||
// Create target node or group
|
||||
var tgt = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to set the boot state for"/></div>');
|
||||
vmAttr.append(tgt);
|
||||
|
||||
|
||||
// Create boot method drop down
|
||||
var method = $('<div></div>');
|
||||
var methodLabel = $('<label>Boot method:</label>');
|
||||
var methodSelect = $('<select id="bootMethod" name="bootMethod" title="The method for node deployment"></select>');
|
||||
methodSelect.append('<option value="boot">boot</option>'
|
||||
+ '<option value="install">install</option>'
|
||||
+ '<option value="iscsiboot">iscsiboot</option>'
|
||||
+ '<option value="netboot">netboot</option>'
|
||||
+ '<option value="statelite">statelite</option>'
|
||||
);
|
||||
method.append(methodLabel);
|
||||
method.append(methodSelect);
|
||||
imageAttr.append(method);
|
||||
|
||||
// Create boot type drop down
|
||||
var type = $('<div></div>');
|
||||
var typeLabel = $('<label>Boot type:</label>');
|
||||
@@ -80,24 +94,58 @@ function loadNodesetPage(tgtNodes) {
|
||||
type.append(typeLabel);
|
||||
type.append(typeSelect);
|
||||
imageAttr.append(type);
|
||||
|
||||
// Create operating system image input
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label>Operating system image:</label>');
|
||||
var osSelect = $('<select name="os" title="The operating system image to be installed on this node"></select>');
|
||||
osSelect.append($('<option value=""></option>'));
|
||||
|
||||
var imageNames = $.cookie('imagenames').split(',');
|
||||
if (imageNames) {
|
||||
imageNames.sort();
|
||||
for (var i in imageNames) {
|
||||
osSelect.append($('<option value="' + imageNames[i] + '">' + imageNames[i] + '</option>'));
|
||||
var osLabel = $('<label>Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os" title="You must give the operating system of this node or node range, e.g. rhel5.5"/>');
|
||||
osInput.one('focus', function(){
|
||||
var tmp = $.cookie('osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osSelect);
|
||||
os.append(osInput);
|
||||
imageAttr.append(os);
|
||||
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
var archLabel = $('<label>Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch" title="You must give the architecture of this node or node range, e.g. s390x"/>');
|
||||
archInput.one('focus', function(){
|
||||
var tmp = $.cookie('osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
imageAttr.append(arch);
|
||||
|
||||
// Create profiles input
|
||||
var profile = $('<div></div>');
|
||||
var profileLabel = $('<label>Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile" title="You must give the profile for this node or node range. The typical default profile is: compute."/>');
|
||||
profileInput.one('focus', function(){
|
||||
tmp = $.cookie('profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
imageAttr.append(profile);
|
||||
|
||||
// Generate tooltips
|
||||
nodesetForm.find('div input[title],select').tooltip({
|
||||
position: "center right",
|
||||
@@ -139,11 +187,16 @@ function loadNodesetPage(tgtNodes) {
|
||||
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
// Get boot method
|
||||
var method = $('#' + tabId + ' select[id=bootMethod]').val();
|
||||
// Get boot type
|
||||
var type = $('#' + tabId + ' select[id=bootType]').val();
|
||||
// Get operating system image
|
||||
var os = $('#' + tabId + ' select[name=os]').val();
|
||||
|
||||
// Get OS, arch, and profile
|
||||
var os = $('#' + tabId + ' input[name=os]').val();
|
||||
var arch = $('#' + tabId + ' input[name=arch]').val();
|
||||
var profile = $('#' + tabId + ' input[name=profile]').val();
|
||||
|
||||
// Disable all inputs, selects, and Ok button
|
||||
inputs.attr('disabled', 'disabled');
|
||||
@@ -159,7 +212,10 @@ function loadNodesetPage(tgtNodes) {
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : tgts + ';noderes.netboot=' + type,
|
||||
args : tgts + ';noderes.netboot=' + type
|
||||
+ ';nodetype.os=' + os
|
||||
+ ';nodetype.arch=' + arch
|
||||
+ ';nodetype.profile=' + profile,
|
||||
msg : 'cmd=nodeadd;inst=' + inst
|
||||
},
|
||||
|
||||
@@ -203,8 +259,8 @@ function updateNodesetStatus(data) {
|
||||
|
||||
// Get nodes
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
// Get operating system image
|
||||
var os = $('#' + tabId + ' select[name=os]').val();
|
||||
// Get boot method
|
||||
var method = $('#' + tabId + ' select[id=bootMethod]').val();
|
||||
|
||||
/**
|
||||
* (2) Update /etc/hosts
|
||||
@@ -320,7 +376,7 @@ function updateNodesetStatus(data) {
|
||||
data : {
|
||||
cmd : 'nodeset',
|
||||
tgt : tgts,
|
||||
args : 'osimage=' + os,
|
||||
args : method,
|
||||
msg : 'cmd=nodeset;inst=' + inst
|
||||
},
|
||||
|
||||
|
||||
@@ -47,10 +47,6 @@ function loadImagesPage() {
|
||||
function loadImages(data) {
|
||||
// Data returned
|
||||
var rsp = data.rsp;
|
||||
if (rsp[0].indexOf('Could not find any object definitions') > -1) {
|
||||
rsp = new Array();
|
||||
}
|
||||
|
||||
// Image attributes hash
|
||||
var attrs = new Object();
|
||||
// Image attributes
|
||||
|
||||
@@ -155,27 +155,27 @@ function loadProvisionPage() {
|
||||
resrcPg.append(resrcInfoBar);
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var rsrcHwList = $('<ol>Platforms available:</ol>');
|
||||
esx = $('<li><input type="radio" name="rsrcHw" value="esx" checked/>ESX</li>');
|
||||
kvm = $('<li><input type="radio" name="rsrcHw" value="kvm"/>KVM</li>');
|
||||
zvm = $('<li><input type="radio" name="rsrcHw" value="zvm"/>z\/VM</li>');
|
||||
ipmi = $('<li><input type="radio" name="rsrcHw" value="ipmi"/>iDataPlex</li>');
|
||||
blade = $('<li><input type="radio" name="rsrcHw" value="blade"/>BladeCenter</li>');
|
||||
hmc = $('<li><input type="radio" name="rsrcHw" value="hmc"/>System p</li>');
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" disabled/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm" disabled/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm" checked/>z\/VM</li>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi" disabled/>iDataPlex</li>');
|
||||
var blade = $('<li><input type="radio" name="hw" value="blade" disabled/>BladeCenter</li>');
|
||||
var hmc = $('<li><input type="radio" name="hw" value="hmc" disabled/>System p</li>');
|
||||
|
||||
rsrcHwList.append(esx);
|
||||
rsrcHwList.append(kvm);
|
||||
rsrcHwList.append(zvm);
|
||||
rsrcHwList.append(blade);
|
||||
rsrcHwList.append(ipmi);
|
||||
rsrcHwList.append(hmc);
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(zvm);
|
||||
hwList.append(blade);
|
||||
hwList.append(ipmi);
|
||||
hwList.append(hmc);
|
||||
|
||||
resrcPg.append(rsrcHwList);
|
||||
resrcPg.append(hwList);
|
||||
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="rsrcHw"]:checked').val();
|
||||
var hw = $(this).parent().find('input[name="hw"]:checked').val();
|
||||
|
||||
// Generate new tab ID
|
||||
var newTabId = hw + 'ResourceTab';
|
||||
|
||||
@@ -170,9 +170,9 @@ function loadServiceProvisionPage(tabId) {
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" disabled/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm" disabled/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm" checked/>z\/VM</li>');
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
@@ -239,38 +239,22 @@ function loadServiceProvisionPage(tabId) {
|
||||
title = 'z/VM';
|
||||
|
||||
// Get zVM host names
|
||||
$.ajax({
|
||||
url : 'lib/srv_cmd.php',
|
||||
dataType : 'json',
|
||||
async : false,
|
||||
data : {
|
||||
cmd : 'webportal',
|
||||
tgt : '',
|
||||
args : 'lszvm',
|
||||
msg : ''
|
||||
},
|
||||
if (!$.cookie('zvms')){
|
||||
$.ajax( {
|
||||
url : 'lib/srv_cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webportal',
|
||||
tgt : '',
|
||||
args : 'lszvm',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
setzVMCookies(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Get master copies for clone
|
||||
$.ajax({
|
||||
url : 'lib/srv_cmd.php',
|
||||
dataType : 'json',
|
||||
async : false,
|
||||
data : {
|
||||
cmd : 'webportal',
|
||||
tgt : '',
|
||||
args : 'lsgoldenimages',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
setGoldenImagesCookies(data);
|
||||
}
|
||||
});
|
||||
success : function(data) {
|
||||
setzVMCookies(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -536,15 +520,6 @@ function loadNodesTable(data) {
|
||||
}
|
||||
});
|
||||
|
||||
// Power softoff
|
||||
var powerSoftoffLnk = $('<a>Shutdown</a>');
|
||||
powerSoftoffLnk.click(function() {
|
||||
var tgtNodes = getNodesChecked(nodesDTId);
|
||||
if (tgtNodes) {
|
||||
powerNode(tgtNodes, 'softoff');
|
||||
}
|
||||
});
|
||||
|
||||
// Turn monitoring on
|
||||
var monitorOnLnk = $('<a>Monitor on</a>');
|
||||
monitorOnLnk.click(function() {
|
||||
@@ -639,7 +614,7 @@ function loadNodesTable(data) {
|
||||
});
|
||||
});
|
||||
|
||||
var actionMenu = createMenu([cloneLnk, deleteLnk, monitorOnLnk, monitorOffLnk, powerOnLnk, powerOffLnk, powerSoftoffLnk, unlockLnk]);
|
||||
var actionMenu = createMenu([cloneLnk, deleteLnk, monitorOnLnk, monitorOffLnk, powerOnLnk, powerOffLnk, unlockLnk]);
|
||||
var menu = createMenu([[actionsLnk, actionMenu], refreshLnk]);
|
||||
menu.superfish();
|
||||
actionBar.append(menu);
|
||||
@@ -1102,27 +1077,11 @@ function setUserNodes(data) {
|
||||
// where column names are: node, os, arch, profile, provmethod, supportedarchs, nodetype, comments, disable
|
||||
var cols = data.rsp[i].split(',');
|
||||
var node = cols[0].replace(new RegExp('"', 'g'), '');
|
||||
var owner = cols[7].replace(new RegExp('"', 'g'), '');
|
||||
owner = owner.replace('owner:', '');
|
||||
|
||||
// Comments can contain the owner and description
|
||||
var comments = new Array();
|
||||
if (cols[7].indexOf(';') > -1) {
|
||||
comments = cols[7].replace(new RegExp('"', 'g'), '').split(';');
|
||||
} else {
|
||||
comments.push(cols[7].replace(new RegExp('"', 'g'), ''));
|
||||
}
|
||||
|
||||
// Extract the owner
|
||||
var owner;
|
||||
for (var j in comments) {
|
||||
if (comments[j].indexOf('owner:') > -1) {
|
||||
owner = comments[j].replace('owner:', '');
|
||||
|
||||
if (owner == userName) {
|
||||
usrNodes.push(node);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
if (owner == userName) {
|
||||
usrNodes.push(node);
|
||||
}
|
||||
} // End of for
|
||||
|
||||
@@ -1398,10 +1357,24 @@ function deleteNode(tgtNodes) {
|
||||
}
|
||||
}
|
||||
|
||||
// Confirm delete of node
|
||||
// Confirm delete
|
||||
var confirmMsg = $('<p>Are you sure you want to delete ' + tgtNodesStr + '?</p>').css({
|
||||
'display': 'inline',
|
||||
'margin': '5px',
|
||||
'vertical-align': 'middle',
|
||||
'word-wrap': 'break-word'
|
||||
});
|
||||
|
||||
var style = {
|
||||
'display': 'inline-block',
|
||||
'margin': '5px',
|
||||
'vertical-align': 'middle'
|
||||
};
|
||||
|
||||
var dialog = $('<div></div>');
|
||||
var warn = createWarnBar('Are you sure you want to delete ' + tgtNodesStr + '?');
|
||||
dialog.append(warn);
|
||||
var icon = $('<span class="ui-icon ui-icon-alert"></span>').css(style);
|
||||
dialog.append(icon);
|
||||
dialog.append(confirmMsg);
|
||||
|
||||
// Open dialog
|
||||
dialog.dialog({
|
||||
|
||||
+14
-13
@@ -1,8 +1,11 @@
|
||||
/**
|
||||
* Tab constructor
|
||||
*
|
||||
* @param tabId Tab ID
|
||||
* @param tabName Tab name
|
||||
* @param tabId
|
||||
* Tab ID
|
||||
* @param tabName
|
||||
* Tab name
|
||||
* @return Nothing
|
||||
*/
|
||||
var Tab = function(tabId) {
|
||||
this.tabId = tabId;
|
||||
@@ -160,7 +163,7 @@ Table.prototype.init = function(headers) {
|
||||
var headRow = $('<tr></tr>');
|
||||
|
||||
// Append headers
|
||||
for (var i in headers) {
|
||||
for ( var i in headers) {
|
||||
headRow.append('<th>' + headers[i] + '</th>');
|
||||
}
|
||||
|
||||
@@ -192,7 +195,7 @@ Table.prototype.add = function(rowCont) {
|
||||
|
||||
// Create a column for each content
|
||||
var tableCol;
|
||||
for (var i in rowCont) {
|
||||
for ( var i in rowCont) {
|
||||
tableCol = $('<td></td>');
|
||||
tableCol.append(rowCont[i]);
|
||||
tableRow.append(tableCol);
|
||||
@@ -246,7 +249,7 @@ DataTable.prototype.init = function(headers) {
|
||||
var headRow = $('<tr></tr>');
|
||||
|
||||
// Append headers
|
||||
for (var i in headers) {
|
||||
for ( var i in headers) {
|
||||
headRow.append('<th>' + headers[i] + '</th>');
|
||||
}
|
||||
|
||||
@@ -278,7 +281,7 @@ DataTable.prototype.add = function(rowCont) {
|
||||
|
||||
// Create a column for each content
|
||||
var tableCol;
|
||||
for (var i in rowCont) {
|
||||
for ( var i in rowCont) {
|
||||
tableCol = $('<td></td>');
|
||||
tableCol.append(rowCont[i]);
|
||||
tableRow.append(tableCol);
|
||||
@@ -321,6 +324,7 @@ function createStatusBar(barId) {
|
||||
var hide = $('<span class="ui-icon ui-icon-minus"></span>').css({
|
||||
'display': 'inline-block',
|
||||
'float': 'right',
|
||||
'margin': '10px 5px',
|
||||
'cursor': 'pointer'
|
||||
}).click(function() {
|
||||
// Remove info box on-click
|
||||
@@ -467,11 +471,11 @@ function initPage() {
|
||||
// Load jQuery stylesheets
|
||||
includeCss("css/jquery.dataTables.css");
|
||||
includeCss("css/superfish.css");
|
||||
// includeCss("css/jstree.css");
|
||||
includeCss("css/jstree.css");
|
||||
includeCss("css/jquery.jqplot.css");
|
||||
|
||||
// Load custom stylesheet
|
||||
includeCss("css/style.css");
|
||||
includeCss("css/style.css");
|
||||
|
||||
// JQuery plugins
|
||||
includeJs("js/jquery/jquery.dataTables.min.js");
|
||||
@@ -480,14 +484,11 @@ function initPage() {
|
||||
includeJs("js/jquery/jquery.contextmenu.min.js");
|
||||
includeJs("js/jquery/superfish.min.js");
|
||||
includeJs("js/jquery/hoverIntent.min.js");
|
||||
// includeJs("js/jquery/jquery.jstree.min.js");
|
||||
includeJs("js/jquery/jquery.jstree.min.js");
|
||||
includeJs("js/jquery/tooltip.min.js");
|
||||
includeJs("js/jquery/jquery.serverBrowser.min.js");
|
||||
includeJs("js/jquery/jquery.jqplot.min.js");
|
||||
includeJs("js/jquery/jqplot.pieRenderer.min.js");
|
||||
includeJs("js/jquery/jqplot.barRenderer.min.js");
|
||||
includeJs("js/jquery/jqplot.pointLabels.min.js");
|
||||
includeJs("js/jquery/jqplot.categoryAxisRenderer.min.js");
|
||||
includeJs("js/jquery/jqplot.dateAxisRenderer.min.js");
|
||||
includeJs("js/jquery/jquery.topzindex.min.js");
|
||||
|
||||
@@ -913,7 +914,7 @@ function changePassword() {
|
||||
// Change dialog buttons
|
||||
$('#changePassword').dialog('option', 'buttons', {
|
||||
'Close':function(){
|
||||
$('#changePassword').dialog('destroy').remove();
|
||||
$('#changePassword').dialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(3600); // Set 15 minutes timeout (for long running requests)
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
// Turn on output buffering
|
||||
@@ -327,7 +327,7 @@ function isRootAcess() {
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp($_SESSION["username"], 'root') == 0 || strcmp($_SESSION["username"], 'admin') == 0) {
|
||||
if (strcmp($_SESSION["username"], 'root') == 0) {
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(3600); // Set 15 minutes timeout (for long running requests)
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
// Turn on output buffering
|
||||
|
||||
+33
-93
@@ -70,9 +70,6 @@ sub process_request {
|
||||
'deleteuser' => \&web_deleteuser,
|
||||
'mkzprofile' => \&web_mkzprofile,
|
||||
'rmzprofile' => \&web_rmzprofile,
|
||||
'mkippool' => \&web_mkippool,
|
||||
'rmippool' => \&web_rmippool,
|
||||
'lsippool' => \&web_lsippool,
|
||||
'updateosimage' => \&web_updateosimage,
|
||||
'rmosimage' => \&web_rmosimage,
|
||||
'updategroup' => \&web_updategroup,
|
||||
@@ -419,7 +416,7 @@ sub web_unlock {
|
||||
my $password = $request->{arg}->[2];
|
||||
|
||||
# Unlock a node by setting up the SSH keys
|
||||
my $out = `DSH_REMOTE_PASSWORD=$password /opt/xcat/bin/xdsh $node -K`;
|
||||
my $out = `DSH_REMOTE_PASSWORD=$password xdsh $node -K`;
|
||||
|
||||
$callback->( { data => $out } );
|
||||
}
|
||||
@@ -429,7 +426,7 @@ sub web_gangliastatus {
|
||||
|
||||
# Get node range
|
||||
my $nr = $request->{arg}->[1];
|
||||
my $out = `/opt/xcat/bin/xdsh $nr "service gmond status"`;
|
||||
my $out = `xdsh $nr "service gmond status"`;
|
||||
|
||||
# Parse output, and use $callback to send back to the web interface
|
||||
# Output looks like:
|
||||
@@ -466,21 +463,21 @@ sub web_gangliaconf() {
|
||||
my $output;
|
||||
|
||||
# Add gangliamon to the monitoring table (if not already)
|
||||
$output = `/opt/xcat/bin/monadd gangliamon`;
|
||||
$output = `monadd gangliamon`;
|
||||
|
||||
# Run the ganglia configuration script on node
|
||||
if ($nr) {
|
||||
$output = `/opt/xcat/bin/moncfg gangliamon $nr -r`;
|
||||
$output = `moncfg gangliamon $nr -r`;
|
||||
}
|
||||
else {
|
||||
|
||||
# If no node range is given, then assume all nodes
|
||||
|
||||
# Handle localhost (this needs to be 1st)
|
||||
$output = `/opt/xcat/bin/moncfg gangliamon`;
|
||||
$output = `moncfg gangliamon`;
|
||||
|
||||
# Handle remote nodes
|
||||
$output .= `/opt/xcat/bin/moncfg gangliamon -r`;
|
||||
$output .= `moncfg gangliamon -r`;
|
||||
}
|
||||
|
||||
my @lines = split( '\n', $output );
|
||||
@@ -504,28 +501,28 @@ sub web_gangliastart() {
|
||||
my $output;
|
||||
|
||||
# Add gangliamon to the monitoring table (if not already)
|
||||
$output = `/opt/xcat/bin/monadd gangliamon`;
|
||||
$output = `monadd gangliamon`;
|
||||
|
||||
# Start the gmond daemon on node
|
||||
if ($nr) {
|
||||
$output = `/opt/xcat/bin/moncfg gangliamon $nr -r`;
|
||||
$output .= `/opt/xcat/bin/monstart gangliamon $nr -r`;
|
||||
$output = `moncfg gangliamon $nr -r`;
|
||||
$output .= `monstart gangliamon $nr -r`;
|
||||
}
|
||||
else {
|
||||
|
||||
# If no node range is given, then assume all nodes
|
||||
|
||||
# Handle localhost (this needs to be 1st)
|
||||
$output = `/opt/xcat/bin/moncfg gangliamon`;
|
||||
$output = `moncfg gangliamon`;
|
||||
|
||||
# Handle remote nodes
|
||||
$output .= `/opt/xcat/bin/moncfg gangliamon -r`;
|
||||
$output .= `moncfg gangliamon -r`;
|
||||
|
||||
# Handle localhost (this needs to be 1st)
|
||||
$output .= `/opt/xcat/bin/monstart gangliamon`;
|
||||
$output .= `monstart gangliamon`;
|
||||
|
||||
# Handle remote nodes
|
||||
$output .= `/opt/xcat/bin/monstart gangliamon -r`;
|
||||
$output .= `monstart gangliamon -r`;
|
||||
}
|
||||
|
||||
my @lines = split( '\n', $output );
|
||||
@@ -550,17 +547,17 @@ sub web_gangliastop() {
|
||||
|
||||
# Stop the gmond daemon on node
|
||||
if ($nr) {
|
||||
$output = `/opt/xcat/bin/monstop gangliamon $nr -r`;
|
||||
$output = `monstop gangliamon $nr -r`;
|
||||
}
|
||||
else {
|
||||
|
||||
# If no node range is given, then assume all nodes
|
||||
|
||||
# Handle localhost (this needs to be 1st)
|
||||
$output = `/opt/xcat/bin/monstop gangliamon`;
|
||||
$output = `monstop gangliamon`;
|
||||
|
||||
# Handle remote nodes
|
||||
$output .= `/opt/xcat/bin/monstop gangliamon -r`;
|
||||
$output .= `monstop gangliamon -r`;
|
||||
}
|
||||
|
||||
my @lines = split( '\n', $output );
|
||||
@@ -585,7 +582,7 @@ sub web_gangliacheck() {
|
||||
|
||||
# Check if ganglia RPMs are installed
|
||||
my $info;
|
||||
my $info = `/opt/xcat/bin/xdsh $nr "rpm -q ganglia-gmond libganglia libconfuse"`;
|
||||
my $info = `xdsh $nr "rpm -q ganglia-gmond libganglia libconfuse"`;
|
||||
$callback->( { info => $info } );
|
||||
return;
|
||||
}
|
||||
@@ -686,7 +683,7 @@ sub web_installganglia() {
|
||||
|
||||
# Install Ganglia RPMs using updatenode
|
||||
$callback->( { info => "$_: Installing Ganglia..." } );
|
||||
$info = `/opt/xcat/bin/updatenode $_ -S`;
|
||||
$info = `updatenode $_ -S`;
|
||||
$callback->( { info => "$info" } );
|
||||
}
|
||||
|
||||
@@ -2032,9 +2029,9 @@ sub web_addnode {
|
||||
}
|
||||
|
||||
if ( 'hmc' eq $nodetype ) {
|
||||
`/opt/xcat/bin/chdef -t node -o $hcpname username=$username password=$passwd mgt=hmc nodetype=$nodetype ip=$ip groups=all`;
|
||||
`chdef -t node -o $hcpname username=$username password=$passwd mgt=hmc nodetype=$nodetype ip=$ip groups=all`;
|
||||
} else {
|
||||
`/opt/xcat/bin/chdef -t node -o $hcpname username=$username password=$passwd mgt=blade mpa=$hcpname nodetype=$nodetype id=0 groups=mm,all`;
|
||||
`chdef -t node -o $hcpname username=$username password=$passwd mgt=blade mpa=$hcpname nodetype=$nodetype id=0 groups=mm,all`;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2052,7 +2049,7 @@ sub web_addnode {
|
||||
$temphash{ $tempArray[$i] } = $tempArray[ $i + 1 ];
|
||||
}
|
||||
|
||||
`/opt/xcat/bin/rscan $hcpname -z > /tmp/rscanall.tmp`;
|
||||
`rscan $hcpname -z > /tmp/rscanall.tmp`;
|
||||
|
||||
unless ( -e '/tmp/rscanall.tmp' ) {
|
||||
return;
|
||||
@@ -2244,11 +2241,10 @@ sub web_graphinfo {
|
||||
}
|
||||
}
|
||||
|
||||
@missinfoarray = (@missinfoarray, @unsupportarray);
|
||||
foreach (@missinfoarray) {
|
||||
$missretstr = $missretstr . $_ . ':linux:other;';
|
||||
}
|
||||
|
||||
|
||||
# Combine all information into a string
|
||||
my $retstr = $pretstr . $bladeretstr . $xretstr . $missretstr;
|
||||
if ($retstr) {
|
||||
@@ -2292,7 +2288,7 @@ sub web_passwd() {
|
||||
my $encrypted = `perl -e "print crypt($password, $random)"`;
|
||||
|
||||
# Save in xCAT passwd table
|
||||
`/opt/xcat/sbin/chtab username=$user passwd.key=xcat passwd.password=$encrypted`;
|
||||
`chtab username=$user passwd.key=xcat passwd.password=$encrypted`;
|
||||
|
||||
my $info = "User password successfully updated";
|
||||
$callback->( { info => $info } );
|
||||
@@ -2307,7 +2303,7 @@ sub web_policy() {
|
||||
my $args = $request->{arg}->[2];
|
||||
|
||||
# Save in xCAT passwd and policy tables
|
||||
my $out = `/opt/xcat/sbin/chtab priority=$priority $args`;
|
||||
my $out = `chtab priority=$priority $args`;
|
||||
|
||||
my $info = "User policy successfully updated";
|
||||
$callback->( { info => $info } );
|
||||
@@ -2323,8 +2319,8 @@ sub web_deleteuser() {
|
||||
|
||||
# Delete user from xCAT passwd and policy tables
|
||||
foreach (@users) {
|
||||
`/opt/xcat/sbin/chtab -d username=$_ passwd`;
|
||||
`/opt/xcat/sbin/chtab -d name=$_ policy`;
|
||||
`chtab -d username=$_ passwd`;
|
||||
`chtab -d name=$_ policy`;
|
||||
}
|
||||
|
||||
my $info = "User successfully deleted";
|
||||
@@ -2365,7 +2361,6 @@ sub web_mkzprofile() {
|
||||
my $size = $request->{arg}->[3];
|
||||
|
||||
# Create profile under /var/opt/xcat/profiles
|
||||
`mkdir -p /var/opt/xcat/profiles`;
|
||||
my $var = "";
|
||||
`echo "# Configuration for virtual machines" > /var/opt/xcat/profiles/$profile.conf`;
|
||||
$var = $profile . "_diskpool";
|
||||
@@ -2373,7 +2368,7 @@ sub web_mkzprofile() {
|
||||
$var = $profile . "_eckd_size";
|
||||
`echo "$var=$size" >> /var/opt/xcat/profiles/$profile.conf`;
|
||||
|
||||
# Move directory entry into /var/opt/xcat/profiles from /var/tmp
|
||||
# Move directory entry into /var/opt/xcat/profiles from /var/tmp
|
||||
`mv /var/tmp/$profile.direct /var/opt/xcat/profiles`;
|
||||
|
||||
my $info = "Profile successfully created/updated";
|
||||
@@ -2399,60 +2394,6 @@ sub web_rmzprofile() {
|
||||
$callback->( { info => $info } );
|
||||
}
|
||||
|
||||
sub web_mkippool() {
|
||||
|
||||
# Create group IP pool
|
||||
my ( $request, $callback, $sub_req ) = @_;
|
||||
|
||||
# Get profile
|
||||
my $group = $request->{arg}->[1];
|
||||
|
||||
# Move directory entry into /var/opt/xcat/ippool from /var/tmp
|
||||
`mkdir -p /var/opt/xcat/ippool`;
|
||||
`mv /var/tmp/$group.pool /var/opt/xcat/ippool`;
|
||||
|
||||
my $info = "IP pool successfully created/updated";
|
||||
$callback->( { info => $info } );
|
||||
}
|
||||
|
||||
sub web_rmippool() {
|
||||
|
||||
# Delete group IP pool
|
||||
my ( $request, $callback, $sub_req ) = @_;
|
||||
|
||||
# Get profile
|
||||
my $group = $request->{arg}->[1];
|
||||
my @groups = split( ',', $group );
|
||||
|
||||
# Delete IP pool under /var/opt/xcat/ippool
|
||||
foreach (@groups) {
|
||||
`rm -rf /var/opt/xcat/ippool/$_.pool`;
|
||||
}
|
||||
|
||||
my $info = "IP pool successfully deleted";
|
||||
$callback->( { info => $info } );
|
||||
}
|
||||
|
||||
sub web_lsippool() {
|
||||
|
||||
# List IP pool
|
||||
my ( $request, $callback, $sub_req ) = @_;
|
||||
|
||||
# Get profile
|
||||
my $group = $request->{arg}->[1];
|
||||
|
||||
# IP pool contained in /var/opt/xcat/ippool where a file exists per group
|
||||
my $entries;
|
||||
if ( !(`test -e /var/opt/xcat/ippool/$group.pool && echo Exists`) ) {
|
||||
$entries = "No IP pool found!";
|
||||
} else {
|
||||
# List IP pool under /var/opt/xcat/ippool
|
||||
$entries = `cat /var/opt/xcat/ippool/$group.pool`;
|
||||
}
|
||||
|
||||
$callback->( { info => $entries } );
|
||||
}
|
||||
|
||||
sub web_updateosimage() {
|
||||
|
||||
# Add OS image to xCAT table
|
||||
@@ -2467,8 +2408,8 @@ sub web_updateosimage() {
|
||||
my $provMethod = $request->{arg}->[7];
|
||||
my $comments = $request->{arg}->[8];
|
||||
|
||||
`/opt/xcat/sbin/chtab -d imagename=$name osimage`;
|
||||
`/opt/xcat/sbin/chtab osimage.imagename=$name osimage.imagetype=$type osimage.osarch=$arch osimage.osname=$osName osimage.osvers=$osVersion osimage.profile=$profile osimage.provmethod=$provMethod osimage.comments=$comments`;
|
||||
`chtab -d imagename=$name osimage`;
|
||||
`chtab osimage.imagename=$name osimage.imagetype=$type osimage.osarch=$arch osimage.osname=$osName osimage.osvers=$osVersion osimage.profile=$profile osimage.provmethod=$provMethod osimage.comments=$comments`;
|
||||
my $info = "Image successfully updated";
|
||||
$callback->( { info => $info } );
|
||||
}
|
||||
@@ -2483,7 +2424,7 @@ sub web_rmosimage() {
|
||||
|
||||
# Delete user from xCAT passwd and policy tables
|
||||
foreach (@names) {
|
||||
`/opt/xcat/sbin/chtab -d imagename=$_ osimage`;
|
||||
`chtab -d imagename=$_ osimage`;
|
||||
}
|
||||
|
||||
my $info = "Image successfully deleted";
|
||||
@@ -2505,8 +2446,8 @@ sub web_updategroup() {
|
||||
my $comments = $request->{arg}->[4];
|
||||
$comments =~ s/'//g;
|
||||
|
||||
`/opt/xcat/sbin/chtab -d node=$name hosts`;
|
||||
`/opt/xcat/sbin/chtab node=$name hosts.ip="$ip" hosts.hostnames="$hostnames" hosts.comments="$comments"`;
|
||||
`chtab -d node=$name hosts`;
|
||||
`chtab node=$name hosts.ip="$ip" hosts.hostnames="$hostnames" hosts.comments="$comments"`;
|
||||
|
||||
my $info = "Group successfully updated";
|
||||
$callback->( { info => $info } );
|
||||
@@ -2522,8 +2463,7 @@ sub web_rmgroup() {
|
||||
|
||||
# Delete user from xCAT passwd and policy tables
|
||||
foreach (@names) {
|
||||
`/opt/xcat/sbin/chtab -d node=$_ hosts`;
|
||||
`rm -rf /var/opt/xcat/ippool/$_.pool`;
|
||||
`chtab -d node=$_ hosts`;
|
||||
}
|
||||
|
||||
my $info = "Group successfully deleted";
|
||||
|
||||
@@ -40,8 +40,7 @@ sub process_request {
|
||||
'clonezlinux' => \&clonezlinux,
|
||||
'genhostip' => \&genhostip,
|
||||
'getmaxvm' => \&getmaxvm,
|
||||
'getuserprivilege' => \&getuserprivilege,
|
||||
'lsgoldenimages' => \&lsgoldenimages
|
||||
'getuserprivilege' => \&getuserprivilege
|
||||
);
|
||||
|
||||
# Check if the request is authorized
|
||||
@@ -105,11 +104,11 @@ sub provzlinux {
|
||||
}
|
||||
|
||||
# Check the max # of virtual machines allowed
|
||||
my $out = `/opt/xcat/sbin/tabdump nodetype -w nodetype.comments=~"owner:$owner"`;
|
||||
my $out = `tabdump nodetype -w nodetype.comments=~"owner:$owner"`;
|
||||
my @tmp = split( /\n/, $out );
|
||||
my $usrVM = scalar(@tmp) - 1;
|
||||
|
||||
$out = `/opt/xcat/bin/webportal getmaxvm $owner`;
|
||||
$out = `webportal getmaxvm $owner`;
|
||||
$out =~ s/Max allowed: //g;
|
||||
my $maxVM = int($out);
|
||||
|
||||
@@ -137,7 +136,6 @@ sub provzlinux {
|
||||
my $disk_pool;
|
||||
my $eckd_size;
|
||||
my $fba_size;
|
||||
my $profile_conf = $profile;
|
||||
my $default_conf = "/var/opt/xcat/profiles/$profile.conf";
|
||||
my $default_direct = "/var/opt/xcat/profiles/$profile.direct";
|
||||
|
||||
@@ -146,24 +144,22 @@ sub provzlinux {
|
||||
println( $callback, "$profile.direct does not exist. Using default.direct to generate directory entry." );
|
||||
|
||||
# Exit if default.direct does not exist
|
||||
$default_direct = "/var/opt/xcat/profiles/default.direct";
|
||||
$default_conf = "/var/opt/xcat/profiles/default.conf";
|
||||
$profile_conf = "default";
|
||||
if ( !(`test -e $default_direct && echo Exists`) ) {
|
||||
println( $callback, "(Error) $default_direct does not exists" );
|
||||
$default_direct = '/var/opt/xcat/profiles/default.direct';
|
||||
if ( !(`test -e /var/opt/xcat/profiles/default.direct && echo Exists`) ) {
|
||||
println( $callback, '(Error) $default_direct does not exists' );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# Exit if default.conf does not exist
|
||||
if ( !(`test -e $default_conf && echo Exists`) ) {
|
||||
println( $callback, "(Error) $default_conf does not exists" );
|
||||
println( $callback, '(Error) $default_conf does not exists' );
|
||||
return;
|
||||
}
|
||||
|
||||
# Exit if default.direct does not exist
|
||||
if ( !(`test -e $default_direct && echo Exists`) ) {
|
||||
println( $callback, "(Error) $default_direct does not exists" );
|
||||
println( $callback, '(Error) $default_direct does not exists' );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -174,9 +170,9 @@ sub provzlinux {
|
||||
# Configuration for virtual machines
|
||||
# default_diskpool=POOL3
|
||||
# default_eckd_size=10016
|
||||
my $profile_diskpool_parm = $profile_conf . "_diskpool";
|
||||
my $profile_eckd_size_parm = $profile_conf . "_eckd_size";
|
||||
my $profile_fba_size_parm = $profile_conf . "_fba_size";
|
||||
my $profile_diskpool_parm = $profile . "_diskpool";
|
||||
my $profile_eckd_size_parm = $profile . "_eckd_size";
|
||||
my $profile_fba_size_parm = $profile . "_fba_size";
|
||||
my $default_disk_pool;
|
||||
my $default_eckd_size;
|
||||
my $default_fba_size;
|
||||
@@ -199,7 +195,7 @@ sub provzlinux {
|
||||
|
||||
# Use default configuration if profile configuration does not exist
|
||||
if (!$disk_pool && (!$eckd_size || !$fba_size)) {
|
||||
println( $callback, "(Error) $profile_conf configuration for disk pool and size does not exist" );
|
||||
println( $callback, "(Error) $profile configuration for disk pool and size does not exist" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -218,27 +214,26 @@ sub provzlinux {
|
||||
|
||||
# Create VM
|
||||
# e.g. webportal provzlinux [group] [hcp] [image]
|
||||
# my ($node, $ip, $base_digit) = gennodename( $callback, $group );
|
||||
my ($node, $ip, $hostname) = findfreenode( $callback, $group );
|
||||
if (!$node) {
|
||||
println( $callback, "Unable to find a free node, IP, and hostname for $group from the IP pool" );
|
||||
my ($node, $ip, $base_digit) = gennodename( $callback, $group );
|
||||
if (!$base_digit) {
|
||||
println( $callback, "(Error) Failed to generate node name" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
my $userid = $node;
|
||||
|
||||
# Set node definitions
|
||||
# Also put node into all group
|
||||
if ($group eq 'all') {
|
||||
$out = `/opt/xcat/bin/mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
|
||||
$out = `mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
|
||||
} else {
|
||||
# Put node in all group
|
||||
$out = `/opt/xcat/bin/mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
|
||||
$out = `mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group,all`;
|
||||
}
|
||||
println( $callback, "$out" );
|
||||
|
||||
|
||||
# Set nodetype definitions
|
||||
$out = `/opt/xcat/sbin/chtab node=$node hosts.ip=$ip hosts.hostnames=$hostname noderes.netboot=zvm nodetype.nodetype=osi nodetype.provmethod=install nodetype.os=$os nodetype.arch=$arch nodetype.profile=$profile nodetype.comments="owner:$owner"`;
|
||||
$out = `chtab node=$node noderes.netboot=zvm nodetype.nodetype=osi nodetype.provmethod=install nodetype.os=$os nodetype.arch=$arch nodetype.profile=$profile nodetype.comments="owner:$owner"`;
|
||||
|
||||
# Create user directory entry replacing LXUSR with user ID
|
||||
# Use /opt/zhcp/conf/default.direct on zHCP as the template
|
||||
@@ -246,7 +241,7 @@ sub provzlinux {
|
||||
# INCLUDE LNXDFLT
|
||||
# COMMAND SET VSWITCH VSW2 GRANT LXUSR
|
||||
$out = `sed $default_direct -e s/LXUSR/$userid/g > /tmp/$node-direct.txt`;
|
||||
$out = `/opt/xcat/bin/mkvm $node /tmp/$node-direct.txt`;
|
||||
$out = `mkvm $node /tmp/$node-direct.txt`;
|
||||
`rm -rf /tmp/$node-direct.txt`;
|
||||
println( $callback, "$out" );
|
||||
if ( $out =~ m/Error/i ) {
|
||||
@@ -286,7 +281,7 @@ sub provzlinux {
|
||||
foreach (@$type) {
|
||||
# Add ECKD disk
|
||||
if ( $_ =~ m/dasd_eckd_mod/i ) {
|
||||
$out = `/opt/xcat/bin/chvm $node --add3390 $disk_pool $virt_addr $eckd_size MR`;
|
||||
$out = `chvm $node --add3390 $disk_pool $virt_addr $eckd_size MR`;
|
||||
println( $callback, "$out" );
|
||||
if ( $out =~ m/Error/i ) {
|
||||
return;
|
||||
@@ -317,7 +312,7 @@ sub provzlinux {
|
||||
|
||||
# Add ECKD disk for each device found
|
||||
for $dev ( keys %devices ) {
|
||||
$out = `/opt/xcat/bin/chvm $node --add3390 $disk_pool $virt_addr $eckd_size MR`;
|
||||
$out = `chvm $node --add3390 $disk_pool $virt_addr $eckd_size MR`;
|
||||
println( $callback, "$out" );
|
||||
if ( $out =~ m/Error/i ) {
|
||||
return;
|
||||
@@ -328,35 +323,36 @@ sub provzlinux {
|
||||
}
|
||||
}
|
||||
|
||||
# Update hosts table
|
||||
`/opt/xcat/sbin/makehosts`;
|
||||
# Update hosts table and DNS
|
||||
`makehosts`;
|
||||
`makedns`;
|
||||
|
||||
# Update DHCP
|
||||
`makedhcp -a`;
|
||||
|
||||
# Toggle node power so COMMAND SET will get executed
|
||||
`/opt/xcat/bin/rpower $node on`;
|
||||
`/opt/xcat/bin/rpower $node off`;
|
||||
`rpower $node on`;
|
||||
`rpower $node off`;
|
||||
|
||||
# Punch kernel, initrd, and ramdisk to node reader
|
||||
$out = `/opt/xcat/sbin/nodeset $node install`;
|
||||
$out = `nodeset $node install`;
|
||||
println( $callback, "$out" );
|
||||
if ( $out =~ m/Error/i ) {
|
||||
return;
|
||||
}
|
||||
|
||||
# IPL reader and begin installation
|
||||
$out = `/opt/xcat/bin/rnetboot $node ipl=00C`;
|
||||
$out = `rnetboot $node ipl=00C`;
|
||||
println( $callback, "$out" );
|
||||
if ( $out =~ m/Error/i ) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Configure Ganglia monitoring
|
||||
$out = `/opt/xcat/bin/moncfg gangliamon $node -r`;
|
||||
$out = `moncfg gangliamon $node -r`;
|
||||
|
||||
# Show node information, e.g. IP, hostname, and root password
|
||||
$out = `/opt/xcat/bin/lsdef $node -i ip,hostnames | egrep "ip=|hostnames="`;
|
||||
$out = `lsdef $node -i ip,hostnames | egrep "ip=|hostnames="`;
|
||||
my $rootpw = getsysrootpw();
|
||||
println( $callback, "Your virtual machine is ready. It may take a few minutes before you can logon using VNC ($node:1). Below is your VM attributes." );
|
||||
println( $callback, "$out" );
|
||||
@@ -568,7 +564,7 @@ sub gennodename {
|
||||
}
|
||||
|
||||
# Check xCAT tables, /etc/hosts, and ping to see if hostname is already used
|
||||
while (`/opt/xcat/bin/nodels $hostname` || `cat /etc/hosts | grep "$ipaddr "` || !(`ping -c 4 $ipaddr` =~ m/100% packet loss/)) {
|
||||
while (`nodels $hostname` || `cat /etc/hosts | grep "$ipaddr "` || !(`ping -c 4 $ipaddr` =~ m/100% packet loss/)) {
|
||||
# Base digit invalid if over 254
|
||||
if ($base_digit > $range_high) {
|
||||
last;
|
||||
@@ -602,11 +598,11 @@ sub clonezlinux {
|
||||
my $owner = $request->{arg}->[3];
|
||||
|
||||
# Check the max # of virtual machines allowed
|
||||
my $out = `/opt/xcat/sbin/tabdump nodetype -w nodetype.comments=~"owner:$owner"`;
|
||||
my $out = `tabdump nodetype -w nodetype.comments=~"owner:$owner"`;
|
||||
my @tmp = split( /\n/, $out );
|
||||
my $usrVM = scalar(@tmp) - 1;
|
||||
|
||||
$out = `/opt/xcat/bin/webportal getmaxvm $owner`;
|
||||
$out = `webportal getmaxvm $owner`;
|
||||
$out =~ s/Max allowed: //g;
|
||||
my $maxVM = int($out);
|
||||
|
||||
@@ -635,13 +631,13 @@ sub clonezlinux {
|
||||
|
||||
# Exit if default.conf does not exist
|
||||
if ( !(`test -e $default_conf && echo Exists`) ) {
|
||||
println( $callback, "(Error) $default_conf does not exists" );
|
||||
println( $callback, '(Error) $default_conf does not exists' );
|
||||
return;
|
||||
}
|
||||
|
||||
# Exit if default.direct does not exist
|
||||
if ( !(`test -e $default_direct && echo Exists`) ) {
|
||||
println( $callback, "(Error) $default_direct does not exists" );
|
||||
println( $callback, '(Error) $default_direct does not exists' );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -677,44 +673,38 @@ sub clonezlinux {
|
||||
|
||||
# Create VM
|
||||
# e.g. webportal provzlinux [group] [hcp] [image]
|
||||
# my ($node, $ip, $base_digit) = gennodename( $callback, $group );
|
||||
my ($node, $ip, $hostname) = findfreenode( $callback, $group );
|
||||
if (!$node) {
|
||||
println( $callback, "Unable to find a free node, IP, and hostname for $group from the IP pool" );
|
||||
return;
|
||||
}
|
||||
|
||||
my ($node, $ip, $base_digit) = gennodename( $callback, $group );
|
||||
my $userid = $node;
|
||||
|
||||
# Set node definitions
|
||||
$out = `/opt/xcat/bin/mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
|
||||
$out = `mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
|
||||
println( $callback, "$out" );
|
||||
|
||||
# Set nodetype definitions
|
||||
$out = `/opt/xcat/sbin/chtab node=$node hosts.ip=$ip hosts.hostnames=$hostname noderes.netboot=zvm nodetype.nodetype=osi nodetype.provmethod=install nodetype.os=$os nodetype.arch=$arch nodetype.profile=$profile nodetype.comments="owner:$owner"`;
|
||||
$out = `chtab node=$node noderes.netboot=zvm nodetype.nodetype=osi nodetype.provmethod=install nodetype.os=$os nodetype.arch=$arch nodetype.profile=$profile nodetype.comments="owner:$owner"`;
|
||||
|
||||
# Update hosts table
|
||||
# Update hosts table and DNS
|
||||
sleep(5); # Time needed to update /etc/hosts
|
||||
`/opt/xcat/sbin/makehosts`;
|
||||
`/opt/xcat/sbin/makedns`;
|
||||
`makehosts`;
|
||||
`makedns`;
|
||||
|
||||
# Update DHCP
|
||||
`/opt/xcat/sbin/makedhcp -a`;
|
||||
`makedhcp -a`;
|
||||
println( $callback, "hosts table, DHCP, and DNS updated" );
|
||||
|
||||
# Clone virtual machine
|
||||
sleep(5); # Time needed to update /etc/hosts
|
||||
$out = `/opt/xcat/bin/mkvm $node $src_node pool=$disk_pool`;
|
||||
$out = `mkvm $node $src_node pool=$disk_pool`;
|
||||
println( $callback, "$out" );
|
||||
if ( $out =~ m/Error/i || $out =~ m/Failed/i ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Configure Ganglia monitoring
|
||||
$out = `/opt/xcat/bin/moncfg gangliamon $node -r`;
|
||||
$out = `moncfg gangliamon $node -r`;
|
||||
|
||||
# Show node information, e.g. IP, hostname, and root password
|
||||
$out = `/opt/xcat/bin/lsdef $node | egrep "ip=|hostnames="`;
|
||||
$out = `lsdef $node | egrep "ip=|hostnames="`;
|
||||
my $rootpw = getsysrootpw();
|
||||
println( $callback, "Your virtual machine is ready. It may take a few minutes before you can logon. Below is your VM attributes." );
|
||||
println( $callback, "$out" );
|
||||
@@ -725,9 +715,8 @@ sub genhostip {
|
||||
my ( $request, $callback, $sub_req ) = @_;
|
||||
my $group = $request->{arg}->[1];
|
||||
|
||||
# my ($node, $ip, $base_digit) = gennodename( $callback, $group );
|
||||
my ($node, $ip, $hostname) = findfreenode( $callback, $group );
|
||||
println( $callback, "$node: $ip, $hostname" );
|
||||
my ($node, $ip, $base_digit) = gennodename( $callback, $group );
|
||||
println( $callback, "$node: $ip" );
|
||||
}
|
||||
|
||||
sub getmaxvm {
|
||||
@@ -792,86 +781,4 @@ sub getuserprivilege {
|
||||
|
||||
$callback->( { data => "Privilege: $privilege" } );
|
||||
}
|
||||
|
||||
sub lsgoldenimages {
|
||||
my ( $request, $callback, $sub_req ) = @_;
|
||||
|
||||
# Find the golden image that can be cloned by searching nodetype table for nodetype.provmethod=clone
|
||||
my $clones = "";
|
||||
my $comments = "";
|
||||
my $description = "";
|
||||
my @args;
|
||||
|
||||
# Look in 'policy' table
|
||||
my $tab = xCAT::Table->new( 'nodetype', -create => 1, -autocommit => 0 );
|
||||
my @results = $tab->getAllAttribsWhere( "provmethod='clone'", 'node', 'comments' );
|
||||
foreach (@results) {
|
||||
if ($_->{'node'}) {
|
||||
$clones .= $_->{'node'} . ": ";
|
||||
|
||||
$comments = $_->{'comments'};
|
||||
@args = split(';', $comments);
|
||||
foreach (@args) {
|
||||
if ($_ =~ m/description:/i) {
|
||||
$description = $_;
|
||||
$description =~ s/description://g;
|
||||
$description =~ s/\s*$//; # Trim right
|
||||
$description =~ s/^\s*//; # Trim left
|
||||
} else {
|
||||
$description = "No comments";
|
||||
}
|
||||
}
|
||||
|
||||
$clones .= $description . ",";
|
||||
}
|
||||
}
|
||||
|
||||
# Delete last comma
|
||||
$clones = substr($clones, 0, -1);
|
||||
|
||||
$callback->( { data => $clones } );
|
||||
}
|
||||
|
||||
sub findfreenode {
|
||||
# Generate node name based on given group
|
||||
my ( $callback, $group ) = @_;
|
||||
|
||||
# IP pool contained in /var/opt/xcat/ippool where a file exists per group
|
||||
if ( !(`test -e /var/opt/xcat/ippool/$group.pool && echo Exists`) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
# IP pool group format: node, IP, hostname
|
||||
# It would look similar to:
|
||||
# ihost10,10.1.136.10,ihost10.endicott.ibm.com
|
||||
# ihost11,10.1.136.11,ihost11.endicott.ibm.com
|
||||
# ihost12,10.1.136.12,ihost12.endicott.ibm.com
|
||||
my $node;
|
||||
my $ipaddr;
|
||||
my $hostname;
|
||||
|
||||
my $out = `cat /var/opt/xcat/ippool/$group.pool | grep -v "#"`;
|
||||
my @entries = split( /\n/, $out );
|
||||
if (@entries < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
my $found = 0;
|
||||
foreach(@entries) {
|
||||
# Grab the 1st free entry found
|
||||
($node, $ipaddr, $hostname) = split(/,/, $_);
|
||||
if ($node && $ipaddr && $hostname) {
|
||||
|
||||
# Check against xCAT tables, /etc/hosts, and ping to see if hostname is already used
|
||||
if (`/opt/xcat/bin/nodels $node` || `cat /etc/hosts | grep "$ipaddr "` || !(`ping -c 4 $ipaddr` =~ m/100% packet loss/)) {
|
||||
next;
|
||||
} else {
|
||||
$found = 1;
|
||||
return ($node, $ipaddr, $hostname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
1;
|
||||
+420
-1479
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
||||
xcat-buildkit (2.9) precise; urgency=low
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- root <root@ubuntu> Fri, 01 Mar 2013 14:05:43 +0800
|
||||
@@ -1 +0,0 @@
|
||||
5
|
||||
@@ -1,11 +0,0 @@
|
||||
Source: xcat-buildkit
|
||||
Section: admin
|
||||
Priority: extra
|
||||
Maintainer: xu qing <qxuqxu@cn.ibm.com>
|
||||
Build-Depends: debhelper (>= 5)
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: xcat-buildkit
|
||||
Architecture: all
|
||||
Depends: dpkg-dev, devscripts, debhelper
|
||||
Description: xCAT-buildkit provides the buildkit tool and sample kit files to build an xCAT kit.
|
||||
@@ -1,88 +0,0 @@
|
||||
Eclipse Public License - v 1.0
|
||||
|
||||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||
|
||||
1. DEFINITIONS
|
||||
|
||||
"Contribution" means:
|
||||
|
||||
a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
|
||||
b) in the case of each subsequent Contributor:
|
||||
|
||||
i) changes to the Program, and
|
||||
|
||||
ii) additions to the Program;
|
||||
|
||||
where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
|
||||
|
||||
"Contributor" means any person or entity that distributes the Program.
|
||||
|
||||
"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
|
||||
|
||||
"Program" means the Contributions distributed in accordance with this Agreement.
|
||||
|
||||
"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
|
||||
|
||||
2. GRANT OF RIGHTS
|
||||
|
||||
a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
|
||||
|
||||
b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
|
||||
|
||||
c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
|
||||
|
||||
d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
|
||||
|
||||
3. REQUIREMENTS
|
||||
|
||||
A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
|
||||
|
||||
a) it complies with the terms and conditions of this Agreement; and
|
||||
|
||||
b) its license agreement:
|
||||
|
||||
i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
|
||||
|
||||
ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
|
||||
|
||||
iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
|
||||
|
||||
iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
|
||||
|
||||
When the Program is made available in source code form:
|
||||
|
||||
a) it must be made available under this Agreement; and
|
||||
|
||||
b) a copy of this Agreement must be included with each copy of the Program.
|
||||
|
||||
Contributors may not remove or alter any copyright notices contained within the Program.
|
||||
|
||||
Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
|
||||
|
||||
4. COMMERCIAL DISTRIBUTION
|
||||
|
||||
Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
|
||||
|
||||
For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
|
||||
|
||||
5. NO WARRANTY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
|
||||
|
||||
6. DISCLAIMER OF LIABILITY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
7. GENERAL
|
||||
|
||||
If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
|
||||
|
||||
If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
|
||||
|
||||
All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
|
||||
|
||||
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
|
||||
|
||||
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
opt/xcat/share/xcat/kits/kit_template
|
||||
opt/xcat/share/xcat/kits/debian_template
|
||||
opt/xcat/bin
|
||||
opt/xcat/lib/perl/xCAT
|
||||
opt/xcat/share/man/man1
|
||||
opt/xcat/share/doc/man1
|
||||
opt/xcat/share/doc/packages/xCAT-buildkit
|
||||
@@ -1 +0,0 @@
|
||||
LICENSE.html
|
||||
@@ -1,7 +0,0 @@
|
||||
share/man/man1/* opt/xcat/share/man/man1/
|
||||
share/doc/man1/* opt/xcat/share/doc/man1/
|
||||
share/xcat/kits/kit_template/* opt/xcat/share/xcat/kits/kit_template/
|
||||
share/xcat/kits/debian_template/* opt/xcat/share/xcat/kits/debian_template/
|
||||
lib/perl/xCAT/* opt/xcat/lib/perl/xCAT/
|
||||
bin/* opt/xcat/bin/
|
||||
LICENSE.html opt/xcat/share/doc/packages/xCAT-buildkit/
|
||||
@@ -1,60 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# This file was originally written by Joey Hess and Craig Small.
|
||||
# As a special exception, when this file is copied by dh-make into a
|
||||
# dh-make output file, you may use that output file without restriction.
|
||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
export DH_COMPAT=5
|
||||
|
||||
|
||||
build:
|
||||
pwd
|
||||
mkdir -p share/man/man1
|
||||
mkdir -p share/doc/man1
|
||||
pod2man pods/man1/buildkit.1.pod > share/man/man1/buildkit.1
|
||||
pod2html pods/man1/buildkit.1.pod > share/doc/man1/buildkit.1.html
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -d
|
||||
|
||||
install:
|
||||
pwd
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installdirs
|
||||
dh_install -X".svn"
|
||||
chmod 444 debian/xcat-buildkit/opt/xcat/share/man/man1/*
|
||||
chmod 644 debian/xcat-buildkit/opt/xcat/share/doc/man1/*
|
||||
find debian/xcat-buildkit/opt/xcat/share/xcat/kits -type d -exec chmod 755 {} \;
|
||||
find debian/xcat-buildkit/opt/xcat/share/xcat/kits -type f -exec chmod 644 {} \;
|
||||
find debian/xcat-buildkit/opt/xcat/lib/perl/xCAT -type d -exec chmod 755 {} \;
|
||||
find debian/xcat-buildkit/opt/xcat/lib/perl/xCAT -type f -exec chmod 644 {} \;
|
||||
chmod -R 755 debian/xcat-buildkit/opt/xcat/bin/*
|
||||
find debian/xcat-buildkit/opt/xcat/share/doc/packages/xCAT-buildkit -type f -exec chmod 644 {} \;
|
||||
dh_link
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
dh_installchangelogs
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch:
|
||||
pwd
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||
@@ -1 +0,0 @@
|
||||
1.0
|
||||
@@ -25,11 +25,23 @@ my $sha1support = eval {
|
||||
};
|
||||
use IPC::Open3;
|
||||
use IO::Select;
|
||||
use xCAT::GlobalDef;
|
||||
eval {
|
||||
require xCAT::RemoteShellExp;
|
||||
};
|
||||
use warnings "all";
|
||||
require xCAT::InstUtils;
|
||||
#require xCAT::NetworkUtils;
|
||||
require xCAT::Schema;
|
||||
#require Data::Dumper;
|
||||
require xCAT::NodeRange;
|
||||
require xCAT::Version;
|
||||
require DBI;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw(genpassword runcmd3);
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head1 xCAT::BuildKitUtils
|
||||
|
||||
@@ -278,6 +290,205 @@ sub close_delete_file
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 runcmd3
|
||||
Run the specified command with optional input and return stderr, stdout, and exit code
|
||||
|
||||
Arguments:
|
||||
command=>[] - Array reference of command to run
|
||||
input=>[] or string - Data to send to stdin of process like piping input
|
||||
Returns:
|
||||
{ exitcode => number, output=> $string, errors => string }
|
||||
=cut
|
||||
sub runcmd3 { #a proper runcmd that indpendently returns stdout, stderr, pid and accepts a stdin
|
||||
my %args = @_;
|
||||
my @indata;
|
||||
my $output;
|
||||
my $errors;
|
||||
if ($args{input}) {
|
||||
if (ref $args{input}) { #array ref
|
||||
@indata = @{$args{input}};
|
||||
} else { #just a string
|
||||
@indata=($args{input});
|
||||
}
|
||||
}
|
||||
my @cmd;
|
||||
if (ref $args{command}) {
|
||||
@cmd = @{$args{command}};
|
||||
} else {
|
||||
@cmd = ($args{command});
|
||||
}
|
||||
my $cmdin;
|
||||
my $cmdout;
|
||||
my $cmderr = gensym;
|
||||
my $cmdpid = open3($cmdin,$cmdout,$cmderr,@cmd);
|
||||
my $cmdsel = IO::Select->new($cmdout,$cmderr);
|
||||
foreach (@indata) {
|
||||
print $cmdin $_;
|
||||
}
|
||||
close($cmdin);
|
||||
my @handles;
|
||||
while ($cmdsel->count()) {
|
||||
@handles = $cmdsel->can_read();
|
||||
foreach (@handles) {
|
||||
my $line;
|
||||
my $done = sysread $_,$line,180;
|
||||
if ($done) {
|
||||
if ($_ eq $cmdout) {
|
||||
$output .= $line;
|
||||
} else {
|
||||
$errors .= $line;
|
||||
}
|
||||
} else {
|
||||
$cmdsel->remove($_);
|
||||
close($_);
|
||||
}
|
||||
}
|
||||
}
|
||||
waitpid($cmdpid,0);
|
||||
my $exitcode = $? >> 8;
|
||||
return { 'exitcode' => $exitcode, 'output' => $output, 'errors' => $errors }
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 runcmd
|
||||
Run the given cmd and return the output in an array (already chopped).
|
||||
Alternately, if this function is used in a scalar context, the output
|
||||
is joined into a single string with the newlines separating the lines.
|
||||
|
||||
Arguments:
|
||||
command, exitcode, reference to output, streaming mode
|
||||
Returns:
|
||||
see below
|
||||
Globals:
|
||||
$::RUNCMD_RC , $::CALLBACK
|
||||
Error:
|
||||
Normally, if there is an error running the cmd,it will display the
|
||||
error and exit with the cmds exit code, unless exitcode
|
||||
is given one of the following values:
|
||||
0: display error msg, DO NOT exit on error, but set
|
||||
$::RUNCMD_RC to the exit code.
|
||||
-1: DO NOT display error msg and DO NOT exit on error, but set
|
||||
$::RUNCMD_RC to the exit code.
|
||||
-2: DO the default behavior (display error msg and exit with cmds
|
||||
exit code.
|
||||
number > 0: Display error msg and exit with the given code
|
||||
|
||||
Example:
|
||||
my $outref = xCAT::BuildKitUtils->runcmd($cmd, -2, 1);
|
||||
$::CALLBACK= your callback (required for streaming from plugins)
|
||||
my $outref = xCAT::BuildKitUtils->runcmd($cmd,-2, 1, 1); streaming
|
||||
|
||||
Comments:
|
||||
If refoutput is true, then the output will be returned as a
|
||||
reference to an array for efficiency.
|
||||
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub runcmd
|
||||
|
||||
{
|
||||
|
||||
my ($class, $cmd, $exitcode, $refoutput, $stream) = @_;
|
||||
$::RUNCMD_RC = 0;
|
||||
# redirect stderr to stdout
|
||||
if (!($cmd =~ /2>&1$/)) { $cmd .= ' 2>&1'; }
|
||||
|
||||
my $outref = [];
|
||||
if (!defined($stream) || (length($stream) == 0)) { # do not stream
|
||||
@$outref = `$cmd`;
|
||||
} else { # streaming mode
|
||||
my @cmd;
|
||||
push @cmd,$cmd;
|
||||
my $rsp = {};
|
||||
my $output;
|
||||
my $errout;
|
||||
open (PIPE, "$cmd |");
|
||||
while (<PIPE>) {
|
||||
if ($::CALLBACK){
|
||||
$rsp->{data}->[0] = $_;
|
||||
$::CALLBACK->($rsp);
|
||||
} else {
|
||||
xCAT::MsgUtils->message("D", "$_");
|
||||
}
|
||||
$output .= $_;
|
||||
}
|
||||
# store the return string
|
||||
push @$outref,$output;
|
||||
}
|
||||
|
||||
# now if not streaming process errors
|
||||
if (($?) && (!defined($stream)))
|
||||
{
|
||||
$::RUNCMD_RC = $? >> 8;
|
||||
my $displayerror = 1;
|
||||
my $rc;
|
||||
if (defined($exitcode) && length($exitcode) && $exitcode != -2)
|
||||
{
|
||||
if ($exitcode > 0)
|
||||
{
|
||||
$rc = $exitcode;
|
||||
} # if not zero, exit with specified code
|
||||
elsif ($exitcode <= 0)
|
||||
{
|
||||
$rc = ''; # if zero or negative, do not exit
|
||||
if ($exitcode < 0) { $displayerror = 0; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$rc = $::RUNCMD_RC;
|
||||
} # if exitcode not specified, use cmd exit code
|
||||
if ($displayerror)
|
||||
{
|
||||
my $rsp = {};
|
||||
my $errmsg = '';
|
||||
if (xCAT::BuildKitUtils->isLinux() && $::RUNCMD_RC == 139)
|
||||
{
|
||||
$errmsg = "Segmentation fault $errmsg";
|
||||
}
|
||||
else
|
||||
{
|
||||
$errmsg = join('', @$outref);
|
||||
chomp $errmsg;
|
||||
|
||||
}
|
||||
if ($::CALLBACK)
|
||||
{
|
||||
$rsp->{data}->[0] =
|
||||
"Command failed: $cmd. Error message: $errmsg.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
xCAT::MsgUtils->message("E",
|
||||
"Command failed: $cmd. Error message: $errmsg.\n");
|
||||
}
|
||||
$xCAT::BuildKitUtils::errno = 29;
|
||||
}
|
||||
}
|
||||
if ($refoutput)
|
||||
{
|
||||
chomp(@$outref);
|
||||
return $outref;
|
||||
}
|
||||
elsif (wantarray)
|
||||
{
|
||||
chomp(@$outref);
|
||||
return @$outref;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $line = join('', @$outref);
|
||||
chomp $line;
|
||||
return $line;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@@ -378,15 +589,12 @@ sub osver
|
||||
$ver = $lines[0];
|
||||
$ver =~ s/\.//;
|
||||
$ver =~ s/[^0-9]*([0-9]+).*/$1/;
|
||||
my $minorver;
|
||||
if (grep /PATCHLEVEL/, $lines[2]) {
|
||||
$minorver = $lines[2];
|
||||
$minorver =~ s/PATCHLEVEL[^0-9]*([0-9]+).*/$1/;
|
||||
}
|
||||
$ver = $ver . ".$minorver" if ( $minorver );
|
||||
|
||||
#print "ver: $ver\n";
|
||||
}
|
||||
elsif (-f "/etc/UnitedLinux-release")
|
||||
{
|
||||
|
||||
$os = "ul";
|
||||
open($relfile,"<","/etc/UnitedLinux-release");
|
||||
$ver = <$relfile>;
|
||||
@@ -425,20 +633,6 @@ sub osver
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif (-f "/etc/debian_version") #possible debian
|
||||
{
|
||||
if (open($relfile, "<", "/etc/issue")){
|
||||
$line = <$relfile>;
|
||||
if ( $line =~ /debian.*/i){
|
||||
$os = "debian";
|
||||
my $relfile1;
|
||||
open($relfile1, "<", "/etc/debian_version");
|
||||
$ver = <$relfile1>;
|
||||
close($relfile1);
|
||||
}
|
||||
close($relfile);
|
||||
}
|
||||
}
|
||||
$os = "$os" . "," . "$ver";
|
||||
return ($os);
|
||||
}
|
||||
@@ -452,7 +646,7 @@ sub osver
|
||||
false on failure
|
||||
A reference for the lock being held.
|
||||
=cut
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub acquire_lock {
|
||||
my $lock_name = shift;
|
||||
use File::Path;
|
||||
@@ -474,7 +668,7 @@ sub acquire_lock {
|
||||
Returns:
|
||||
false on failure, true on success
|
||||
=cut
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub release_lock {
|
||||
my $tlock = shift;
|
||||
unlink($tlock->{path});
|
||||
@@ -482,6 +676,7 @@ sub release_lock {
|
||||
close($tlock->{fd});
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_unique_members
|
||||
@@ -552,4 +747,6 @@ sub full_path
|
||||
return $fullpath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
@@ -2,79 +2,59 @@
|
||||
|
||||
B<buildkit> - build a product Kit to package software for installation in an xCAT cluster.
|
||||
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<buildkit> [B<-?>|B<-h>|B<--help>] [B<-v>|B<--version>]
|
||||
B<buildkit> [B<-V> | B<--verbose>] B<create> I<kit_basename>
|
||||
|
||||
To build a new Kit
|
||||
B<buildkit> [B<-V> | B<--verbose>] B<chkconfig>
|
||||
|
||||
B<buildkit> [B<-V>|B<--verbose]> I<subcommand> [I<kit_name>] [I<repo_name>|B<all>] [B<-l>|B<--kitloc> I<kit_location>]
|
||||
B<buildkit> [B<-V> | B<--verbose>] B<listrepo>
|
||||
|
||||
To add packages to an existing Kit.
|
||||
B<buildkit> [B<-V> | B<--verbose>] B<buildrepo> {I<repo_name> | B<all>}
|
||||
|
||||
B<buildkit> [B<-V> | B<--verbose>] B<cleanrepo> {I<repo_name> | B<all>}
|
||||
|
||||
B<buildkit> [B<-V> | B<--verbose>] B<buildtar>
|
||||
|
||||
B<buildkit> [B<-V> | B<--verbose>] B<cleantar>
|
||||
|
||||
B<buildkit> [B<-V> | B<--verbose>] B<cleanall>
|
||||
|
||||
B<buildkit> [B<-V> | B<--verbose>] B<addpkgs> I<kit_tarfile> {B<-p> | B<--pkgdir>} I<package_directory>
|
||||
|
||||
B<command> [B<-?> | B<-h> | B<--help> | B<-v> | B<--version>]
|
||||
|
||||
B<buildkit> [B<-V>|B<--verbose>] I<addpkgs> I<kit_tarfile> [B<-p>|B<--pkgdir> I<package_directory>] [B<-k>|B<--kitversion> I<version>] [B<-r>|B<--kitrelease> I<release>] [B<-l>|B<--kitloc> I<kit_location>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The B<buildkit> command provides a collection of utilities that may be used to package a software product as a Kit tarfile that can be used to install software on the nodes of an xCAT cluster. A Kit contains the product software packages, configuration and control information, and install and customization scripts.
|
||||
The B<buildkit> command is a collection of utilities to package a product as a Kit that can be installed on an xCAT cluster. A Kit is a tarfile containing the product software packages, configuration and control information, and install and customization scripts.
|
||||
|
||||
You will need to run the B<buildkit> command several times with different subcommands to step through the process of building a kit:
|
||||
|
||||
By default the B<buildkit> subcommands will operate in the current working directory, (ie. look for files, create directories etc.). You could specify a different location by using the "B<-l | --kitloc> I<kit_location>" option.
|
||||
|
||||
The I<kit_location> is the full path name of the directory that contains the kit files. You would use the same location value for all the buildkit subcommands.
|
||||
|
||||
For example, to create a new kit named "prodkit" in the directory /home/mykits/ I<either> run:
|
||||
You will need to run the buildkit command several times with different subcommands to step through the process of building a kit:
|
||||
|
||||
=over 4
|
||||
|
||||
=item 1.
|
||||
|
||||
If no location is provided then the command will create a subdirectory called "prodkit" in the current directory "/home/mykits" and the new kit files will be created there.
|
||||
|
||||
B<cd /home/mykits>
|
||||
|
||||
B<buildkit create prodkit>
|
||||
|
||||
or
|
||||
|
||||
=item 2.
|
||||
|
||||
If a location is provided then the Kit files will be created there. Note that the Kit name does not necessarily have to be the directory name where the kit files are located.
|
||||
|
||||
B<buidkit create prodkit -l /home/mykits/prodkit>
|
||||
|
||||
=back
|
||||
|
||||
In both cases the /home/mykits/prodkit directory is created and the inital files for the kit are created in that directory.
|
||||
|
||||
The following example illustrates the basic process for building a new Kit. In this example we are building a Kit named "mytstkit".
|
||||
|
||||
=over 4
|
||||
|
||||
=item 1.
|
||||
|
||||
Change to the directory where you wish to create the Kit.
|
||||
cd to your work directory
|
||||
|
||||
=item 2.
|
||||
|
||||
Create a template directory for your kit:
|
||||
|
||||
B<buildkit create mytstkit>
|
||||
buildkit create kit_basename
|
||||
|
||||
=item 3.
|
||||
|
||||
Change directory to the new "mytstkit" subdirectory that was just created.
|
||||
cd to the new template directory:
|
||||
|
||||
B<cd mytstkit>
|
||||
cd kit_basename
|
||||
|
||||
=item 4.
|
||||
|
||||
Edit the buildkit configuration file for your kit:
|
||||
|
||||
B<vi buildkit.conf>
|
||||
|
||||
(See xCAT Kit documentation for details.)
|
||||
vi buildkit.conf
|
||||
|
||||
=item 5.
|
||||
|
||||
@@ -82,31 +62,28 @@ Create all required files, scripts, plugins, and packages for your kit.
|
||||
|
||||
=item 6.
|
||||
|
||||
Validate your kit build configuration and fix any errors that are reported:
|
||||
Validate your kit build configuration, fixing any errors that are reported:
|
||||
|
||||
B<buildkit chkconfig>
|
||||
buildkit chkconfig
|
||||
|
||||
=item 7.
|
||||
|
||||
List the repos defined in your buildkit configuration file:
|
||||
|
||||
B<buildkit listrepo>
|
||||
buildkit listrepo
|
||||
|
||||
=item 8.
|
||||
|
||||
For each repo name listed, build the repository. Note that if you need to build repositories for OS distributions, versions, or architectures that do not match the current system, you may need to copy your kit template directory to an appropriate server to build that repository, and then copy the results back to your main build server. For example, to build a repo named "rhels6.3" you would run the following command.
|
||||
For each reponame listed, build the repository. Note that if you need to build repositories for OS distributions or versions that do not match the current system, you may need to copy your kit template directory to an appropriate server to build that repository, and then copy the results back to your main build server.
|
||||
|
||||
B<buildkit buildrepo rhels6.3>
|
||||
|
||||
or, you can build all of the repos at one time if there are no OS or architecture dependencies for kitcomponent package builds or kitpackage builds:
|
||||
|
||||
B<buildkit buildrepo all>
|
||||
buildkit buildrepo repo_name
|
||||
|
||||
=item 9.
|
||||
|
||||
Build the kit tar file:
|
||||
|
||||
B<buildkit buildtar>
|
||||
buildkit buildtar
|
||||
|
||||
|
||||
=back
|
||||
|
||||
@@ -114,29 +91,9 @@ B<buildkit buildtar>
|
||||
|
||||
=over 10
|
||||
|
||||
=item B<-h |--help>
|
||||
|
||||
Display usage message.
|
||||
|
||||
=item B<-k|--kitversion> I<version>
|
||||
|
||||
Product version.
|
||||
|
||||
=item B<-l|--kitloc> I<kit_location>
|
||||
|
||||
The directory location of the Kit files.
|
||||
|
||||
=item B<-r|--kitrelease> I<release>
|
||||
|
||||
Product release.
|
||||
|
||||
=item B<-V |--verbose>
|
||||
|
||||
Verbose mode.
|
||||
|
||||
=item B<-v|--version>
|
||||
|
||||
Command version.
|
||||
Command Version.
|
||||
|
||||
=back
|
||||
|
||||
@@ -146,60 +103,43 @@ Command version.
|
||||
|
||||
=item B<create> I<kit_basename>
|
||||
|
||||
Creates a new kit build directory structure for kit I<kit_basename> using the location specified on the command line or the current directory. The sample kit files from /opt/xcat/share/xcat/kits/kit_template are copied over, and the buildkit.conf file is modified for the specified I<kit_basename>.
|
||||
Creates a new kit build directory structure for kit I<kit_basename> in the current directory. The sample kit files from /opt/xcat/share/xcat/kits/kit_template are copied over, and the <cwd>/I<kit_basename>/buildkit.conf is modified for the specified I<kit_basename>.
|
||||
|
||||
=item B<chkconfig>
|
||||
|
||||
Reads the buildkit.conf file, verifies that the file syntax is correct and that all specified files exist.
|
||||
Reads the buildkit.conf file from the current directory, verifies that the file syntax is correct and that all specified files exist.
|
||||
|
||||
=item B<listrepo>
|
||||
|
||||
Reads the buildkit.conf file, lists all Kit package repositories listed in the file, and reports the build status for each repository.
|
||||
Reads the buildkit.conf file from the current directory, lists all Kit package repositories listed in the file, and reports the build status for each repository.
|
||||
|
||||
=item B<buildrepo> {I<repo_name> | B<all>}
|
||||
|
||||
Reads the buildkit.conf file, and builds the specified Kit package repository. The built packages are placed in the directory <kit_location>/build/kit_repodir/I<repo_name>. If B<all> is specified, all kit repositories are built.
|
||||
Reads the buildkit.conf file from the current directory, and builds the specified Kit package repository. The built packages are placed in the directory <cwd>/build/kit_repodir/I<repo_name>. If B<all> is specified, all kit repositories are built.
|
||||
|
||||
=item B<cleanrepo> {I<repo_name> | B<all>}
|
||||
|
||||
Reads the buildkit.conf file, and deletes all the package files and package meta data files from the <kit_location>/build/kit_repodir/I<repo_name> directory. If B<all> is specified, all kit repository files are deleted.
|
||||
Reads the buildkit.conf file from the current directory, and deletes all the package files and package meta data files from the <cwd>/build/kit_repodir/I<repo_name> directory. If B<all> is specified, all kit repository files are deleted.
|
||||
|
||||
=item B<buildtar>
|
||||
|
||||
Reads the buildkit.conf file, validates that all kit repositories have been built, and builds the Kit tar file <kit_location>/I<kitname>.tar.bz2.
|
||||
Reads the buildkit.conf file from the current directory, validates that all kit repositories have been built, and builds the Kit tar file <cwd>/build/I<kitname>.tar.bz2.
|
||||
|
||||
=item B<cleantar>
|
||||
|
||||
Reads the <kit_location>/buildkit.conf file and I<deletes> the following:
|
||||
|
||||
=over 4
|
||||
|
||||
- Kit tar files matching <kit_location>/I<kit_name*.tar.bz2>.
|
||||
|
||||
- <kit_location>/build/I<kit_name>
|
||||
|
||||
- <kit_location>/rpmbuild
|
||||
|
||||
- <kit_location>/tmp
|
||||
|
||||
- <kit_location>/debbuild
|
||||
|
||||
=back
|
||||
|
||||
Caution: Make sure you back up any tar files you would like to keep before running this subcommand.
|
||||
Reads the buildkit.conf file from the current directory, deletes the Kit tar <cwd>/build/I<kitname>.tar.bz2, and deletes all files in the build work directory <cwd>/build/I<kitname>.
|
||||
|
||||
=item B<cleanall>
|
||||
|
||||
Equivalent to running B<buildkit cleanrepo all> and B<buildkit cleantar>.
|
||||
|
||||
=item B<addpkgs>
|
||||
=item B<addpkgs> I<kit_tarfile> {B<-p> | B<--pkgdir>} I<package_directory>
|
||||
|
||||
I<kit_tarfile> {B<-p> | B<--pkgdir> I<package_directory>} [B<-k> | B<--kitversion> I<version>] [B<-r> | B<--kitrelease> I<release>]
|
||||
|
||||
Add product package rpms to a previously built kit tar file. This is used for partial product kits that are built and shipped separately from the product packages, and are identified with a I<kit_tarfile> name of I<kitname>.B<NEED_PRODUCT_PKGS.tar.bz2>. Optionally, change the kit release and version values when building the new kit tarfile. If kitcomponent version and/or release values are defaulted to the kit values, those will also be changed and new kitcomponent rpms will be built. If kit or kitcomponent scripts, plugins, or other files specify name, release, or version substitution strings, these will all be replaced with the new values when built into the new complete kit tarfile I<kit_location>/I<new_kitname>.B<tar.bz2>.
|
||||
Add product package rpms to a previously built kit tar file. This is used for product kits that are built and shipped separately from the product packages.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
=over 3
|
||||
@@ -214,6 +154,7 @@ An error has occurred.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 3
|
||||
@@ -222,42 +163,30 @@ An error has occurred.
|
||||
|
||||
To create the sample kit shipped with the xCAT-buildkit rpm on a RHELS 6.3 server and naming it B<mykit>, run the following commands:
|
||||
|
||||
B<cd /home/myuserid/kits>
|
||||
|
||||
B<buildkit create mykit>
|
||||
|
||||
B<cd mykit>
|
||||
|
||||
B<vi buildkit.conf>
|
||||
|
||||
B<buildkit chkconfig>
|
||||
|
||||
B<buildkit listrepo>
|
||||
|
||||
B<buildkit buildrepo all >
|
||||
|
||||
B<buildkit buildtar>
|
||||
cd /home/myuserid/kits
|
||||
buildkit create mykit
|
||||
cd mykit
|
||||
vi buildkit.conf
|
||||
buildkit chkconfig
|
||||
buildkit listrepo
|
||||
buildkit buildrepo rhels6.3
|
||||
buildkit buildtar
|
||||
|
||||
=item 2.
|
||||
|
||||
To clean up a kit repository directory after build failures on a RHELS 6.3 server to prepare for a new kit repository build, run:
|
||||
|
||||
B<buildkit cleanrepo rhels6.3>
|
||||
buildkit cleanrepo rhels6.3
|
||||
|
||||
=item 3.
|
||||
|
||||
To clean up all kit build files, including a previously built kit tar file, run
|
||||
|
||||
B<buildkit cleanall>
|
||||
|
||||
=item 4.
|
||||
|
||||
To create a kit named "tstkit" located in /home/foobar/tstkit instead of the current working directory.
|
||||
|
||||
B<buildkit create tstkit -l /home/foobar/tstkit>
|
||||
buildkit cleanall
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/buildkit
|
||||
@@ -266,14 +195,14 @@ B<buildkit create tstkit -l /home/foobar/tstkit>
|
||||
|
||||
/opt/xcat/share/xcat/kits/kitcomponent.spec.template
|
||||
|
||||
<kit location>/buildkit.conf
|
||||
<cwd>/buildkit.conf
|
||||
|
||||
<kit location>/build/I<kitname>/kit.conf
|
||||
<cwd>/build/I<kitname>/kit.conf
|
||||
|
||||
<kit location>/I<kitname>.tar.bz2
|
||||
<cwd>/build/I<kitname>.tar.bz2
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
addkit(1), lskit(1), rmkit(1), addkitcomp(1), rmkitcomp(1), chkkitcomp(1)
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<<<INSERT_kitcomponent_basename_HERE>>> (1.0) precise; urgency=low
|
||||
|
||||
* Kit component package build.
|
||||
|
||||
-- root <root@ubuntu> Fri, 01 Mar 2013 14:05:43 +0800
|
||||
@@ -1 +0,0 @@
|
||||
5
|
||||
@@ -1,11 +0,0 @@
|
||||
Source: <<<INSERT_kitcomponent_basename_HERE>>>
|
||||
Section: admin
|
||||
Priority: extra
|
||||
Maintainer: xcatkit <root@ubuntu>
|
||||
Build-Depends: debhelper (>= 5)
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: <<<INSERT_kitcomponent_basename_HERE>>>
|
||||
Architecture: all
|
||||
Depends: <<<INSERT_kitcomponent_ospkgdeps_HERE>>>,<<<INSERT_kitcomponent_kitpkgdeps_HERE>>>,<<<INSERT_kitcomponent_kitcompdeps_HERE>>>
|
||||
Description: <<<INSERT_kitcomponent_desc_HERE>>>
|
||||
@@ -1,41 +0,0 @@
|
||||
#!/bin/sh
|
||||
# postrm script for aaa
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postrm> `remove'
|
||||
# * <postrm> `purge'
|
||||
# * <old-postrm> `upgrade' <new-version>
|
||||
# * <new-postrm> `failed-upgrade' <old-version>
|
||||
# * <new-postrm> `abort-install'
|
||||
# * <new-postrm> `abort-install' <old-version>
|
||||
# * <new-postrm> `abort-upgrade' <old-version>
|
||||
# * <disappearer's-postrm> `disappear' <overwriter>
|
||||
# <overwriter-version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
||||
;;
|
||||
|
||||
remove|purge)
|
||||
<<<INSERT_kitcomponent_postuninstall_script_HERE>>>
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postrm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts.
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/bin/sh
|
||||
# preinst script for aaa
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <new-preinst> `install'
|
||||
# * <new-preinst> `install' <old-version>
|
||||
# * <new-preinst> `upgrade' <old-version>
|
||||
# * <old-preinst> `abort-upgrade' <new-version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
install)
|
||||
<<<INSERT_kitcomponent_preinstall_script_HERE>>>
|
||||
;;
|
||||
|
||||
upgrade)
|
||||
if [ -f /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>> ]
|
||||
<<<INSERT_kitcomponent_preupgrade_script_HERE>>>
|
||||
fi
|
||||
;;
|
||||
|
||||
abort-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "preinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts.
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/bin/sh
|
||||
# prerm script for aaa
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <prerm> `remove'
|
||||
# * <old-prerm> `upgrade' <new-version>
|
||||
# * <new-prerm> `failed-upgrade' <old-version>
|
||||
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
|
||||
# * <deconfigured's-prerm> `deconfigure' `in-favour'
|
||||
# <package-being-installed> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
|
||||
case "$1" in
|
||||
remove)
|
||||
<<<INSERT_kitcomponent_preuninstall_script_HERE>>>
|
||||
;;
|
||||
|
||||
upgrade)
|
||||
touch /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>>
|
||||
;;
|
||||
|
||||
deconfigure)
|
||||
;;
|
||||
|
||||
failed-upgrade)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "prerm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# dh_installdeb will replace this with shell code automatically
|
||||
# generated by other debhelper scripts.
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
export DH_COMPAT=5
|
||||
|
||||
build:
|
||||
pwd
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -d
|
||||
|
||||
install:
|
||||
pwd
|
||||
dh_install
|
||||
|
||||
binary-indep: build install
|
||||
dh_installchangelogs
|
||||
dh_compress
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary-arch:
|
||||
pwd
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||
@@ -1 +0,0 @@
|
||||
1.0
|
||||
@@ -1,219 +0,0 @@
|
||||
# Kit Build File
|
||||
#
|
||||
# This file was initially auto-generated by the buildkit CLI command.
|
||||
# To create a new kit, the user should modify this file accordingly.
|
||||
# Refer to the buildkit manpage for further details.
|
||||
#
|
||||
|
||||
# kit: This section defines general info for the Kit.
|
||||
# There must be exactly one kit section in a kit build file.
|
||||
#
|
||||
# kit attributes:
|
||||
# basename (mandatory) Kit base name. e.g., kit-lsf
|
||||
# description (optional) Kit description.
|
||||
# version (mandatory) Kit version. e.g., 1.0
|
||||
# release (optional) Kit release. e.g., 1
|
||||
# ostype (mandatory) Kit OS type. Must be Linux.
|
||||
# AIX is currently not supported.
|
||||
# isinternal (optional) PCM use only.
|
||||
# Indicate if Kit is for internal use.
|
||||
# Use 1 for yes, 0 for no. Default: 0
|
||||
# kitdeployparams (optional) Filename containing a list of kit deployment
|
||||
# parameters, relative to
|
||||
# <Kit Build Directory>/other_files
|
||||
# kitlicense (mandatory) Kit license string to be built into all
|
||||
# kitcomponent packages
|
||||
# kittarfilename (optional) Filename.tar.bz2 to be used for the generated
|
||||
# kit. Default is <basename>-<version>-<ostype>.tar.bz2
|
||||
kit:
|
||||
basename=chef
|
||||
description=Kit for installing chef server, client and workstation
|
||||
version=11.4.0
|
||||
release=1
|
||||
ostype=Linux
|
||||
kitlicense=EPL
|
||||
|
||||
|
||||
# kitrepo: This section defines a Kit Package Repository.
|
||||
# There must be at least one kitrepo section in a kit build file.
|
||||
# If you want to support multiple OSes, you should create a separate
|
||||
# repo for each OS. Also, no two repos can be defined with the same
|
||||
# OS name, major/minor version and arch. For example, you cannot have
|
||||
# two repos for RHEL 6.2 x86_64 in the same kit.
|
||||
#
|
||||
# kitrepo attributes:
|
||||
# kitrepoid (mandatory) Kit package repository ID.
|
||||
# Must be unique within this file.
|
||||
# osbasename (mandatory) OS distro base name. e.g., rhels.
|
||||
# osmajorversion (mandatory) OS major version. e.g., 6
|
||||
# osminorversion (optional) OS minor version.
|
||||
# osarch (mandatory) OS architecture. e.g., x86_64
|
||||
# compat_osbasenames (optional) Comma-separated list of compatible
|
||||
# OS distro base names. e.g., centos
|
||||
|
||||
kitrepo:
|
||||
kitrepoid=rhels6_x86_64
|
||||
osbasename=rhels
|
||||
osmajorversion=6
|
||||
#osminorversion=
|
||||
osarch=x86_64
|
||||
|
||||
#compat_osbasenames=
|
||||
|
||||
|
||||
# kitcomponent: This section defines one Kit Component.
|
||||
# There can be zero or more kitcomponent sections.
|
||||
# If you want to build a component which supports multiple OSes,
|
||||
# you should create one kitcomponent section for each OS.
|
||||
# Also, no two components in a kit can be defined with the same
|
||||
# base name.
|
||||
# You can define multiple kit components with the same base name
|
||||
# only if each kit component using this base name meets these
|
||||
# requirements:
|
||||
# - Each kit component must be defined with the same version
|
||||
# and release number
|
||||
# - Each kit component must be defined with a unique kitrepoid
|
||||
|
||||
#
|
||||
# kitcomponent attributes:
|
||||
# basename (mandatory) Kit component base name
|
||||
# description (optional) Kit component description
|
||||
# version (optional) Kit component version. If not set, defaults
|
||||
# to kit version
|
||||
# release (optional) Kit component release. If not set, defaults
|
||||
# to kit release. Error if both are not set.
|
||||
# serverroles (mandatory) Comma-separated list of servers that this
|
||||
# component can install on. Valid values:
|
||||
# mgtnode,servicenode,compute,login,storage,utility
|
||||
# kitrepoid (mandatory) The ID of the kit package repository this
|
||||
# component belongs to
|
||||
# kitcompdeps (optional) Comma-separated list of kit component
|
||||
# dependencies. These kit components can be included in
|
||||
# this kit or in other kits.
|
||||
# ospkgdeps (optional) Comma-separated list of OS package dependencies
|
||||
# These packages must be shipped with the OS distro.
|
||||
# kitpkgdeps (optional) Comma-separated list of kit package names that
|
||||
# will be listed as "REQUIRES" when building this kit
|
||||
# component. Each package must be defined in a separate
|
||||
# kitpackage section. Each package must be in the same
|
||||
# kitrepo as this kit component.
|
||||
# non_native_pkgs (optional)
|
||||
# Comma-separated list of non-native package
|
||||
# paths that will be included as files in this kit
|
||||
# component. All filenames are relative to
|
||||
# <Kit Build Directory>/source_packages and may contain
|
||||
# wildcards. If a filename is prefixed by 'EXTERNALPKGS:'
|
||||
# the file will not be built into the kit tarfile, but
|
||||
# will need to be added later with a 'buildkit addpkgs'
|
||||
# command.
|
||||
# Files will be placed in
|
||||
# /opt/xcat/kits/<kitbasename>/<kitcomponent_name>
|
||||
# when the kitcomponent package is deployed to an
|
||||
# OS image.
|
||||
# Kit component deployment scripts must be specified
|
||||
# to manage these files.
|
||||
# driverpacks (optional) Comma-separated list of driver package filenames
|
||||
# Each driverpack must be defined in a separate kitpackage
|
||||
# section.
|
||||
# exlist (optional) Exclude list file for stateless image, relative
|
||||
# to <Kit Build Directory>/other_files
|
||||
# Kit component deployment scripts (optional) Each attribute specifies
|
||||
# script path relative to <Kit Build Directory>/scripts
|
||||
# Script attributes:
|
||||
# preinstall, postinstall, preuninstall, postuninstall,
|
||||
# preupgrade, postupgrade, postbootscripts,
|
||||
# genimage_postinstall
|
||||
kitcomponent:
|
||||
basename=chef_server_kit
|
||||
description=For installing chef server
|
||||
version=11.0.6
|
||||
release=1
|
||||
serverroles=mgtnode
|
||||
kitrepoid=rhels6_x86_64
|
||||
kitpkgdeps=chef-server
|
||||
postinstall=server.rpm_post
|
||||
postbootscripts=server.post
|
||||
|
||||
kitcomponent:
|
||||
basename=chef_client_kit
|
||||
description=For installing chef client
|
||||
version=11.4.0
|
||||
release=1
|
||||
serverroles=compute
|
||||
kitrepoid=rhels6_x86_64
|
||||
kitpkgdeps=chef
|
||||
postinstall=client.rpm_post
|
||||
postbootscripts=client.post
|
||||
|
||||
kitcomponent:
|
||||
basename=chef_workstation_kit
|
||||
description=For installing chef workstation
|
||||
version=11.4.0
|
||||
release=1
|
||||
serverroles=compute
|
||||
kitrepoid=rhels6_x86_64
|
||||
kitpkgdeps=chef
|
||||
postinstall=workstation.rpm_post
|
||||
postbootscripts=workstation.post
|
||||
|
||||
|
||||
|
||||
# kitpackage: This section defines one Kit Package, and how to build it.
|
||||
# There can be zero or more kitpackage sections.
|
||||
# All filenames should be relative paths to
|
||||
# <Kit Build Directory>/source_packages
|
||||
# If you want to build a package which can run on multiple OSes,
|
||||
# you have two options:
|
||||
# 1. Build a separate package for each OS you want to support.
|
||||
# For this option, you need to define one kitpackage section
|
||||
# per supported OS.
|
||||
# 2. Build one package that can run on multiple OSes.
|
||||
# If you are building an RPM package, you are responsible for
|
||||
# creating an RPM spec file that can run on multiple OSes.
|
||||
# For this option, you need to define one kitpackage section
|
||||
# which contains multiple kitrepoid lines.
|
||||
#
|
||||
# kitpackage attributes:
|
||||
# filename (mandatory) Package filename.
|
||||
# kitrepoid (mandatory) A comma-separated list of kit reponames this package
|
||||
# belongs to. If multiple repos are defined, the package will
|
||||
# be built for the first repo only. For the other repos,
|
||||
# a symlink is created to the package built for the first repo.
|
||||
# Package build methods (optional)
|
||||
# Define how to build the packages.
|
||||
# If you don't specify a build method, the default behavior is
|
||||
# to assume the package is pre-built under
|
||||
# <Kit Build Directory>/source_packages
|
||||
# All files in this section are relative to
|
||||
# <Kit Build Directory>/source_packages
|
||||
# There are four methods to build packages.
|
||||
# 1. Use pre-built RPM package
|
||||
# The filename may contain wildcards to avoid needing to
|
||||
# specify an explicit package version-release filename.
|
||||
# isexternalpkg: 'no'|'0', 'yes'|'1' (default: 'no')
|
||||
# Indicates whether the RPM package will be added to the
|
||||
# the kit tar file now as part of the kit build process,
|
||||
# or whether the customer will need to separately
|
||||
# obtain the RPM pacakage and add it to the kit tar file
|
||||
# using 'buildkit addpkgs'
|
||||
# rpm_prebuiltdir: If isexternalpkg=no, path to directory
|
||||
# containing pre-built RPM package
|
||||
# 2. Build RPM from spec + src dir
|
||||
# rpm_spec: Path to spec file.
|
||||
# rpm_srcdir: Path to source directory.
|
||||
# 3. Build RPM from spec + src tarball
|
||||
# rpm_spec: Path to spec file.
|
||||
# rpm_srctarball: Path to source tarball.
|
||||
# 4. Build RPM from source RPM
|
||||
# rpm_srpm: Path to source RPM package.
|
||||
kitpackage:
|
||||
filename=chef-server-*
|
||||
kitrepoid=rhels6_x86_64
|
||||
isexternalpkg=no
|
||||
rpm_prebuiltdir=rhels6/x86_64
|
||||
|
||||
kitpackage:
|
||||
filename=chef-11*
|
||||
kitrepoid=rhels6_x86_64
|
||||
isexternalpkg=no
|
||||
rpm_prebuiltdir=rhels6/x86_64
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#=head1 client.post
|
||||
#=head2 This command configures the chef client on a xCAT node. It is used
|
||||
# as a postbootscript for chef_client kit
|
||||
#=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
if [ "$NODESETSTATE" = "install" ]; then
|
||||
#prevent getting called during full install bootup
|
||||
#because the function will be called in the rpm %post section instead
|
||||
exit 0
|
||||
else
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
#configure the chef client configuration files
|
||||
/xcatpost/config_chef_client "$@"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#=head1 client.post
|
||||
#=head2 This command configures the chef client on a xCAT node. It is used
|
||||
# as a post installation script for chef_client_kit.rpm
|
||||
#=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
#configure the chef client configuration files
|
||||
/xcatpost/config_chef_client "$@"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/sh
|
||||
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#=head1 server.post
|
||||
#=head2 This command configures the chef server on a xCAT server or node.
|
||||
# It is used as a postbootscript for chef_server kit
|
||||
#=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
if [ "$NODESETSTATE" = "install" ]; then
|
||||
#prevent getting called during full install bootup
|
||||
#because the function will be called in the rpm %post section instead
|
||||
exit 0
|
||||
else
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
#Now configure the chef server
|
||||
/xcatpost/config_chef_server
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#=head1 server.post
|
||||
#=head2 This command configures the chef server on a xCAT server or node.
|
||||
# It is used as a post install script for chef_server_kit.rpm
|
||||
#=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
#Now configure the chef server
|
||||
/xcatpost/config_chef_server
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#=head1 workstation.post
|
||||
#=head2 This command configures the chef workstation on a xCAT node. It is used
|
||||
# as a postbootscript for chef_workstation kit
|
||||
#=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
if [ "$NODESETSTATE" = "install" ]; then
|
||||
#prevent getting called during full install bootup
|
||||
#because the function will be called in the rpm %post section instead
|
||||
exit 0
|
||||
else
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
#configure the chef workstation configuration files
|
||||
/xcatpost/config_chef_workstation "$@"
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#=head1 workstation.post
|
||||
#=head2 This command configures the chef workstation on a xCAT node. It is used
|
||||
# as a post installation script for chef_workstation_kit.rpm
|
||||
#=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
#configure the chef workstation configuration files
|
||||
/xcatpost/config_chef_workstation "$@"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,205 +0,0 @@
|
||||
# Kit Build File
|
||||
#
|
||||
# This file was initially auto-generated by the buildkit CLI command.
|
||||
# To create a new kit, the user should modify this file accordingly.
|
||||
# Refer to the buildkit manpage for further details.
|
||||
#
|
||||
|
||||
# kit: This section defines general info for the Kit.
|
||||
# There must be exactly one kit section in a kit build file.
|
||||
#
|
||||
# kit attributes:
|
||||
# basename (mandatory) Kit base name. e.g., kit-lsf
|
||||
# description (optional) Kit description.
|
||||
# version (mandatory) Kit version. e.g., 1.0
|
||||
# ostype (mandatory) Kit OS type. Must be Linux.
|
||||
# AIX is currently not supported.
|
||||
# isinternal (optional) PCM use only.
|
||||
# Indicate if Kit is for internal use.
|
||||
# Use 1 for yes, 0 for no. Default: 0
|
||||
# kitdeployparams (optional) Filename containing a list of kit deployment
|
||||
# parameters, relative to
|
||||
# <Kit Build Directory>/other_files
|
||||
# kitlicense (mandatory) Kit license string to be built into all
|
||||
# kitcomponent packages
|
||||
# kittarfilename (optional) Filename.tar.bz2 to be used for the generated
|
||||
# kit. Default is <basename>-<version>-<ostype>.tar.bz2
|
||||
kit:
|
||||
basename=puppet
|
||||
description=Kit for installing puppet server and client
|
||||
version=3.1.1
|
||||
release=1
|
||||
ostype=Linux
|
||||
kitlicense=EPL
|
||||
osbasename=rhels
|
||||
osmajorversion=6
|
||||
#osminorversion=3
|
||||
osarch=x86_64
|
||||
|
||||
|
||||
# kitrepo: This section defines a Kit Package Repository.
|
||||
# There must be at least one kitrepo section in a kit build file.
|
||||
# If you want to support multiple OSes, you should create a separate
|
||||
# repo for each OS. Also, no two repos can be defined with the same
|
||||
# OS name, major/minor version and arch. For example, you cannot have
|
||||
# two repos for RHEL 6.2 x86_64 in the same kit.
|
||||
#
|
||||
# kitrepo attributes:
|
||||
# kitrepoid (mandatory) Kit package repository ID.
|
||||
# Must be unique within this file.
|
||||
# osbasename (mandatory) OS distro base name. e.g., rhels.
|
||||
# osmajorversion (mandatory) OS major version. e.g., 6
|
||||
# osminorversion (optional) OS minor version.
|
||||
# osarch (mandatory) OS architecture. e.g., x86_64
|
||||
# compat_osbasenames (optional) Comma-separated list of compatible
|
||||
# OS distro base names. e.g., centos
|
||||
|
||||
kitrepo:
|
||||
kitrepoid=rhels6_x86_64
|
||||
osbasename=rhels
|
||||
osmajorversion=6
|
||||
#osminorversion=
|
||||
osarch=x86_64
|
||||
|
||||
#compat_osbasenames=
|
||||
|
||||
|
||||
# kitcomponent: This section defines one Kit Component.
|
||||
# There can be zero or more kitcomponent sections.
|
||||
# If you want to build a component which supports multiple OSes,
|
||||
# you should create one kitcomponent section for each OS.
|
||||
# Also, no two components in a kit can be defined with the same
|
||||
# base name.
|
||||
# You can define multiple kit components with the same base name
|
||||
# only if each kit component using this base name meets these
|
||||
# requirements:
|
||||
# - Each kit component must be defined with the same version
|
||||
# and release number
|
||||
# - Each kit component must be defined with a unique kitrepoid
|
||||
|
||||
#
|
||||
# kitcomponent attributes:
|
||||
# basename (mandatory) Kit component base name
|
||||
# description (optional) Kit component description
|
||||
# version (mandatory) Kit component version
|
||||
# release (mandatory) Kit component release
|
||||
# serverroles (mandatory) Comma-separated list of servers that this
|
||||
# component can install on. Valid values:
|
||||
# mgtnode,servicenode,compute,login,storage,utility
|
||||
# kitrepoid (mandatory) The ID of the kit package repository this
|
||||
# component belongs to
|
||||
# kitcompdeps (optional) Comma-separated list of kit component
|
||||
# dependencies. These kit components can be included in
|
||||
# this kit or in other kits.
|
||||
# ospkgdeps (optional) Comma-separated list of OS package dependencies
|
||||
# These packages must be shipped with the OS distro.
|
||||
# kitpkgdeps (optional) Comma-separated list of kit package names that
|
||||
# will be listed as "REQUIRES" when building this kit
|
||||
# component. Each package must be defined in a separate
|
||||
# kitpackage section. Each package must be in the same
|
||||
# kitrepo as this kit component.
|
||||
# non_native_pkgs (optional) TBD -- NOT SUPPORTED YET!
|
||||
# Comma-separated list of non-native package
|
||||
# paths that will be included as files in this kit
|
||||
# component. All filenames are relative to
|
||||
# <Kit Build Directory>/source_packages
|
||||
# Kit component deployment scripts must be specified
|
||||
# to manage these files.
|
||||
# driverpacks (optional) Comma-separated list of driver package filenames
|
||||
# Each driverpack must be defined in a separate kitpackage
|
||||
# section.
|
||||
# exlist (optional) Exclude list file for stateless image, relative
|
||||
# to <Kit Build Directory>/other_files
|
||||
# Kit component deployment scripts (optional) Each attribute specifies
|
||||
# script path relative to <Kit Build Directory>/scripts
|
||||
# Script attributes:
|
||||
# preinstall, postinstall, preuninstall, postuninstall,
|
||||
# preupgrade, postupgrade, postbootscripts,
|
||||
# genimage_postinstall
|
||||
kitcomponent:
|
||||
basename=puppet_client_kit
|
||||
description=For installing puppet client
|
||||
version=3.1.1
|
||||
release=1
|
||||
serverroles=servicenode,compute
|
||||
kitrepoid=rhels6_x86_64
|
||||
kitpkgdeps=puppet
|
||||
postinstall=client.rpm_post
|
||||
postbootscripts=client.post
|
||||
|
||||
kitcomponent:
|
||||
basename=puppet_server_kit
|
||||
description=For installing puppet server
|
||||
version=3.1.1
|
||||
release=1
|
||||
serverroles=mgtnode
|
||||
kitrepoid=rhels6_x86_64
|
||||
kitpkgdeps=puppet-server
|
||||
postinstall=server.rpm_post
|
||||
postbootscripts=server.post
|
||||
|
||||
|
||||
# kitpackage: This section defines one Kit Package, and how to build it.
|
||||
# There can be zero or more kitpackage sections.
|
||||
# All filenames should be relative paths to
|
||||
# <Kit Build Directory>/source_packages
|
||||
# If you want to build a package which can run on multiple OSes,
|
||||
# you have two options:
|
||||
# 1. Build a separate package for each OS you want to support.
|
||||
# For this option, you need to define one kitpackage section
|
||||
# per supported OS.
|
||||
# 2. Build one package that can run on multiple OSes.
|
||||
# If you are building an RPM package, you are responsible for
|
||||
# creating an RPM spec file that can run on multiple OSes.
|
||||
# For this option, you need to define one kitpackage section
|
||||
# which contains multiple kitrepoid lines.
|
||||
#
|
||||
# kitpackage attributes:
|
||||
# filename (mandatory) Package filename
|
||||
# kitrepoid (mandatory) The repo(s) this package belongs to.
|
||||
# If multiple repos are defined, the package will be built for
|
||||
# the first repo only. For the other repos, a symlink is created
|
||||
# to the package built for the first repo.
|
||||
# Package build methods (optional)
|
||||
# Define how to build the packages.
|
||||
# If you don't specify a build method, the default behavior is
|
||||
# to assume the package is pre-built under
|
||||
# <Kit Build Directory>/source_packages
|
||||
# All files in this section are relative to
|
||||
# <Kit Build Directory>/source_packages
|
||||
# There are four methods to build packages.
|
||||
# 1. Use pre-built RPM package
|
||||
# isexternalpkg: 'no'|'0', 'yes'|'1' (default: 'no')
|
||||
# Indicates whether the RPM package will be added to the
|
||||
# the kit tar file now as part of the kit build process,
|
||||
# or whether the customer will need to separately
|
||||
# obtain the RPM pacakage and add it to the kit tar file
|
||||
# using 'buildkit addpkgs'
|
||||
# rpm_prebuiltdir: If isexternalpkg=no, path to directory
|
||||
# containing pre-built RPM package
|
||||
# 2. Build RPM from spec + src dir
|
||||
# rpm_spec: Path to spec file.
|
||||
# rpm_srcdir: Path to source directory.
|
||||
# 3. Build RPM from spec + src tarball
|
||||
# rpm_spec: Path to spec file.
|
||||
# rpm_srctarball: Path to source tarball.
|
||||
# 4. Build RPM from source RPM
|
||||
# rpm_srpm: Path to source RPM package.
|
||||
kitpackage:
|
||||
filename=puppet-3*
|
||||
kitrepoid=rhels6_x86_64
|
||||
isexternalpkg=no
|
||||
rpm_prebuiltdir=rhels6/x86_64
|
||||
|
||||
kitpackage:
|
||||
filename=puppet-server-*
|
||||
kitrepoid=rhels6_x86_64
|
||||
isexternalpkg=no
|
||||
rpm_prebuiltdir=rhels6/x86_64
|
||||
|
||||
kitpackage:
|
||||
filename=*
|
||||
kitrepoid=rhels6_x86_64
|
||||
isexternalpkg=no
|
||||
rpm_prebuiltdir=rhels6/x86_64
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user