Compare commits
447 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d51e0acfe | |||
| 37d53860a9 | |||
| fba0dc5518 | |||
| 26544fac91 | |||
| fa6f82b45e | |||
| 2754de946a | |||
| 1a02dbaa18 | |||
| a86152d7a3 | |||
| 5f8f907ead | |||
| 599fecd530 | |||
| 891478c649 | |||
| 797506ec8b | |||
| 16c7d16609 | |||
| e50d066c0b | |||
| c683aac291 | |||
| ea2730d251 | |||
| c9a613b258 | |||
| 4b10a30ae7 | |||
| 5fc5a13dad | |||
| 5663321c9e | |||
| 458932d0cf | |||
| abeffffccf | |||
| cc332eaa90 | |||
| d8495d188f | |||
| 727fdd1355 | |||
| 9083c12dfd | |||
| 770c42c5eb | |||
| f9dc643d03 | |||
| c8e52db261 | |||
| 1e32434db2 | |||
| 768595be98 | |||
| d83bf2204d | |||
| 23f608aa6a | |||
| dd74ef9864 | |||
| c75d5faa69 | |||
| d8dc3d2d30 | |||
| ac02f48b02 | |||
| 29dbe12954 | |||
| b77cdef661 | |||
| 39fa86cb28 | |||
| d55b923701 | |||
| 78fbcca2da | |||
| cfe62b8164 | |||
| 8392a75e94 | |||
| 4e957afe1b | |||
| 3e6f294d0f | |||
| f2b43dc313 | |||
| 7e3ccd6a52 | |||
| 55a4562ab9 | |||
| 08d8fd84d7 | |||
| 345ab8eea2 | |||
| d465521d80 | |||
| b3122827ad | |||
| 6c42d488fc | |||
| 5e482788b8 | |||
| e0bc7d22b4 | |||
| 22dc829935 | |||
| a3ebc13326 | |||
| 607364ef5d | |||
| 40d212ba32 | |||
| ede853a539 | |||
| 78028fe71d | |||
| 833b460f10 | |||
| ec93453019 | |||
| de33d65c07 | |||
| e70138abfd | |||
| b7e5ba9099 | |||
| 467b5a4177 | |||
| e7263f60a8 | |||
| f1a69b02c8 | |||
| dce9d70b14 | |||
| 4830f1704f | |||
| c12b3fee86 | |||
| 55e0df750d | |||
| 4e2919cbab | |||
| b5780548f0 | |||
| 9f8293200e | |||
| 99886eb792 | |||
| c2621cd941 | |||
| 4174cbdd65 | |||
| cc2c6a2d80 | |||
| cdb0d7a683 | |||
| 3482e6ca92 | |||
| 7f0303661f | |||
| 4156f7e7de | |||
| a0e0692fa5 | |||
| 8061e280dc | |||
| 2dcf6750fc | |||
| b1d4dc5613 | |||
| 1bf336a3f8 | |||
| 4364be67fc | |||
| 32e831629c | |||
| 9714883f52 | |||
| e74f245b7b | |||
| 800fd64640 | |||
| 0a774aea20 | |||
| 09a3a51b06 | |||
| 04fd13af5b | |||
| 41b6208cdf | |||
| 22238d9d84 | |||
| 81bd2a5861 | |||
| 5a8216703b | |||
| 957bc41fb3 | |||
| 812051a434 | |||
| b6abb7075a | |||
| 6eedeebc77 | |||
| bb31105e70 | |||
| f33baa6aba | |||
| 488140a428 | |||
| 999ffe2823 | |||
| f7e3cff5f0 | |||
| 988e00d1d6 | |||
| 0f0723592d | |||
| fd18ee0166 | |||
| 9fe321a9ba | |||
| 39e1cd10e2 | |||
| 953a306215 | |||
| 658c4af9fe | |||
| e3145dcb40 | |||
| e2adff9290 | |||
| a7ab35be04 | |||
| 2b938be82e | |||
| d14e8a3422 | |||
| 02aad8040b | |||
| 2e68e00d73 | |||
| 1048917a8b | |||
| 27359e6c08 | |||
| cba5bd906f | |||
| 6af4dc1f7d | |||
| 06618ddd32 | |||
| 03e45369f3 | |||
| b491d913c1 | |||
| 97a17e00d3 | |||
| 2d1ce8d415 | |||
| 4eb1d5571d | |||
| 7f92ce0444 | |||
| 3435d76f5e | |||
| 4be064b4cf | |||
| 127d916d34 | |||
| de6647147c | |||
| 1c1618d2fc | |||
| 8e34820345 | |||
| 8e81adb305 | |||
| 047e57f0c3 | |||
| 76223558ac | |||
| f7daa1c360 | |||
| db165108ea | |||
| 7609407917 | |||
| 8d565d3918 | |||
| 688e64e722 | |||
| 505a0aae73 | |||
| b1946e3f5c | |||
| 236b498fff | |||
| a9a7703ed5 | |||
| 3fcd955af8 | |||
| 5862e96f9d | |||
| 5c1f289122 | |||
| 7481889d00 | |||
| 2ae9e0c922 | |||
| 2fa947cd0c | |||
| 03db3ab47f | |||
| 7c5c6e163c | |||
| a176c60048 | |||
| ccc22e145b | |||
| 6bd1af764b | |||
| 0f84dd880a | |||
| 8f48a9539c | |||
| 3ffc0b2437 | |||
| db4d3824ed | |||
| d47cca6d30 | |||
| fc5c20ae0d | |||
| 708e5f143e | |||
| ec81ac9aa0 | |||
| 3b0783e351 | |||
| 82cce879ce | |||
| 3b6e0db8f4 | |||
| b963bc7ec4 | |||
| 8a7458234d | |||
| 0b7ea33179 | |||
| d76099720d | |||
| b37de511a8 | |||
| 1ed591ef0c | |||
| eadb53665c | |||
| 25d5e487ec | |||
| fd454d7ff2 | |||
| d7ae87e7ba | |||
| 4a42452208 | |||
| a40afdef5e | |||
| ae63258e0f | |||
| 687f289b78 | |||
| d097aa1deb | |||
| 15f85d6303 | |||
| 985f747691 | |||
| c1ec0439b8 | |||
| 8d6a163f5a | |||
| 5f8243a389 | |||
| 3cc995c63b | |||
| b8b5793bf4 | |||
| c947fa575f | |||
| ac6b203ea8 | |||
| 2c912a6efa | |||
| 2a295edea8 | |||
| 429a5b9076 | |||
| 571497b51c | |||
| 56ef49030a | |||
| 73c38b5152 | |||
| 3295f11ac4 | |||
| 5cb12eb3e7 | |||
| 19b42174bf | |||
| f25f6022fb | |||
| a5fa89aef2 | |||
| 640a5b5575 | |||
| d03e51ed9e | |||
| 6c6e4bd724 | |||
| 5949528172 | |||
| 9770e640d3 | |||
| e9cc31faae | |||
| 280eae743e | |||
| fbfac9405b | |||
| 9d413508e6 | |||
| b2b48b7678 | |||
| 4d5d0964d7 | |||
| eafd4a7eff | |||
| 987ca7033a | |||
| ee9e20cf9f | |||
| 93b9be9b49 | |||
| d3d9348e74 | |||
| eec0b38a2d | |||
| 4d944e385a | |||
| 1d20428352 | |||
| 6ae6ff3ec4 | |||
| ade3d19a46 | |||
| a3d37933ea | |||
| 3e6626f22d | |||
| 1eaef84651 | |||
| ffe63be973 | |||
| 5b1f6fd4da | |||
| 41860799c5 | |||
| 7ca22d39ac | |||
| 8ac9b36562 | |||
| 949b4cb086 | |||
| b1c534716b | |||
| ba190e0d9d | |||
| 7e2ff0f420 | |||
| 122240358e | |||
| d828446fd0 | |||
| 2dafc29fa5 | |||
| 9579b25806 | |||
| 24b7e62a4b | |||
| 5a0835c89e | |||
| 96fa0f6471 | |||
| 3270774658 | |||
| 3c8ad67b4a | |||
| 690b79a46e | |||
| 2048d4cbd2 | |||
| 63c23b6d20 | |||
| 7031fa292b | |||
| 5ff6f58072 | |||
| ab282e95dc | |||
| 78d63831b1 | |||
| c2642732c6 | |||
| 5fd64b4e8a | |||
| 158a08f288 | |||
| e2a44d1668 | |||
| f6295148e3 | |||
| 7d850a4889 | |||
| eae067c880 | |||
| 323fba6ed3 | |||
| 3576b6edc5 | |||
| 2911e9cb3a | |||
| 4838a4201d | |||
| 230ce41127 | |||
| e677086adc | |||
| 96d7905028 | |||
| 1a8c473ea4 | |||
| c900ba7990 | |||
| 05d60f28d3 | |||
| 5b95434d07 | |||
| 14a851b129 | |||
| 85a375d689 | |||
| b592346b68 | |||
| 29da171a6e | |||
| d73267e16b | |||
| 8034d25628 | |||
| 2d6e10f185 | |||
| 776a4347c2 | |||
| 9e5ed72181 | |||
| 6fa8c670cc | |||
| 13f7057ab8 | |||
| 545586453e | |||
| 52c78e8ef0 | |||
| f508e8d4a7 | |||
| 80a4209a56 | |||
| e140c6ecea | |||
| 185799c4af | |||
| 3d34490024 | |||
| 46719cea07 | |||
| a08819d0d1 | |||
| f0ed81dd29 | |||
| 2645befb3a | |||
| 24e52f96fe | |||
| 878cd33a3b | |||
| 1eef8bfb09 | |||
| 41e579fcd1 | |||
| b4d4194323 | |||
| ffef2c42d0 | |||
| 38cc43836c | |||
| 5236326c33 | |||
| cad30f609e | |||
| b1d341a332 | |||
| deae2fdf1e | |||
| 862fd2d095 | |||
| 3e77b5f7c1 | |||
| e3bde1a271 | |||
| a23a2096a5 | |||
| adcde47e22 | |||
| 2bd5a23a20 | |||
| 765c20d6de | |||
| 112ac2b7cc | |||
| 443115c63c | |||
| 4e5b13bbea | |||
| 83815d4147 | |||
| cf08fd0f66 | |||
| ff0a87d351 | |||
| 5610770c7e | |||
| 1687f84f1a | |||
| 7594e9d636 | |||
| ffc13f8709 | |||
| 19fd5997b2 | |||
| 43f8d9907a | |||
| f01980896c | |||
| 0e6c65680e | |||
| 0c5df40c81 | |||
| cea06ec458 | |||
| 7f109189f7 | |||
| 08d6ccb1e4 | |||
| ccf2f55f83 | |||
| 0072906ad2 | |||
| 59702b7ed8 | |||
| 9e58da04bb | |||
| 1b9d15b143 | |||
| 66edd2ec5a | |||
| 173f8ce7e2 | |||
| 4ef818ba79 | |||
| dde8390522 | |||
| ea2c6f1303 | |||
| b12793213e | |||
| e1fc3ca4cd | |||
| 65e8976a73 | |||
| 6d113545a2 | |||
| d4f4a6a5b5 | |||
| 531a326e7c | |||
| 3f452f17b7 | |||
| d719b98879 | |||
| 789dbbe9f4 | |||
| 60eba22531 | |||
| e1857b577f | |||
| 2a4aa6a4b7 | |||
| f40ed8bd74 | |||
| 206c2b4a30 | |||
| dc088cf05b | |||
| 81de935353 | |||
| 4f38ce60a7 | |||
| 209b47fe3e | |||
| 7184c5f1d1 | |||
| bf6fcac20b | |||
| 011fe6608a | |||
| 4c2b78a22d | |||
| ba1a1670ec | |||
| 4f91584ed9 | |||
| 55c4f81af6 | |||
| d653f89e87 | |||
| b269c14828 | |||
| 51ec31d4d9 | |||
| 8216370a21 | |||
| a534181da3 | |||
| 31122369a7 | |||
| a707c8a9b9 | |||
| 404f554a99 | |||
| fa0992ea09 | |||
| 6e601374b6 | |||
| c1483cc7db | |||
| 7df4643089 | |||
| e0dad7b643 | |||
| 9e96941ca3 | |||
| b303b5d01a | |||
| a3d8e0d6c4 | |||
| a1793645fe | |||
| 74f377d956 | |||
| 7a34476de2 | |||
| b197c84c81 | |||
| 9dd8c297d9 | |||
| 236d5e236a | |||
| 813ca61a72 | |||
| 32baaa1256 | |||
| feec1700ff | |||
| 0c026583a4 | |||
| cec3852ace | |||
| 940d40dc20 | |||
| 7bf773153c | |||
| 02a3edbc58 | |||
| 45ed594a42 | |||
| ec371ffc98 | |||
| 6e235884d9 | |||
| 7bdd6e6368 | |||
| 743056043d | |||
| 56e4338410 | |||
| dd46b00066 | |||
| 7b4d83793a | |||
| 428e30f98f | |||
| ce3fcef399 | |||
| bc4ff1b05f | |||
| 9570d8f83b | |||
| c56696aff3 | |||
| db8cdd11d0 | |||
| 0254709d2e | |||
| a0c6ac79c1 | |||
| fe3cc45a62 | |||
| 1a2abfc32f | |||
| c80d89c661 | |||
| b7194852a4 | |||
| 27242db435 | |||
| 29f32d3b04 | |||
| 6c6d66efe4 | |||
| 7d564cd088 | |||
| 9835df7b64 | |||
| e236c61cda | |||
| ef6b1738bc | |||
| d4de05052a | |||
| 037585d6c7 | |||
| 790199e176 | |||
| 74b07bf416 | |||
| cd882bff45 | |||
| 51e861fedc | |||
| 0ac03023e8 | |||
| fae8bdaf07 | |||
| 9a1c7d166f | |||
| f39c58662d | |||
| 053fd1611f | |||
| 6153c74606 | |||
| be78497238 | |||
| 16ac237f18 | |||
| 58a20e2b54 | |||
| ea94719691 | |||
| 3be19b1039 | |||
| 67bc1e0666 | |||
| 45712b109d |
@@ -7,8 +7,3 @@ xCAT documentation is available at: http://xcat.sourceforge.net/
|
||||
xCAT is made available as open source software under the EPL license:
|
||||
http://www.opensource.org/licenses/eclipse-1.0.php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,241 +0,0 @@
|
||||
#!/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
|
||||
#
|
||||
|
||||
# For the purpose of getting the distribution name
|
||||
|
||||
# Supported distributions
|
||||
dists="squeeze"
|
||||
|
||||
a_flag= # automatic flag - only update if repo was updated
|
||||
c_flag= # xcat-core (trunk-delvel) path
|
||||
d_flag= # xcat-dep (trunk) path
|
||||
local_flag= # build the repository localy
|
||||
|
||||
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"
|
||||
;;
|
||||
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> [-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
|
||||
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
|
||||
printf "Usage: %s -c <core_trunk_path> [-d <dep_trunk_path>] -l <local-repo_path> [-a]\n" $(basename $0) >&2
|
||||
echo "-a Automatic: update only if there's any update on repo"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
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
|
||||
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 "#################################"
|
||||
|
||||
if [ -d $repo_xcat_core_path ]; then
|
||||
rm -rf $repo_xcat_core_path
|
||||
fi
|
||||
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__ >> $repo_xcat_core_path/conf/distributions
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-core bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: amd64
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
|
||||
__EOF__
|
||||
done
|
||||
|
||||
cat << __EOF__ > $repo_xcat_core_path/conf/options
|
||||
verbose
|
||||
basedir .
|
||||
__EOF__
|
||||
|
||||
for dist in $dists; do
|
||||
for file in `ls $repo_xcat_core_path/*.deb`; do
|
||||
reprepro -b $repo_xcat_core_path includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
|
||||
mv $xcat_core_path/latest_version $repo_xcat_core_path/xcat-core_latest-build
|
||||
|
||||
cat << '__EOF__' > $repo_xcat_core_path/mklocalrepo.sh
|
||||
codename=`lsb_release -a 2>null | grep Codename | awk '{print $2}'`
|
||||
cd `dirname $0`
|
||||
echo deb file://"`pwd`" $codename main > /etc/apt/sources.list.d/xcat-core.list
|
||||
__EOF__
|
||||
|
||||
chmod 775 $repo_xcat_core_path/mklocalrepo.sh
|
||||
rm -rf $repo_xcat_core_path/*.deb
|
||||
|
||||
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" ]
|
||||
|
||||
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 \;
|
||||
|
||||
rm -rf $repo_xcat_core_path/conf/distributions
|
||||
|
||||
for dist in $dists; do
|
||||
cat << __EOF__ >> $repo_xcat_dep_path/conf/distributions
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-dep bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: i386 amd64
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
|
||||
__EOF__
|
||||
done
|
||||
|
||||
cat << __EOF__ > $repo_xcat_dep_path/conf/options
|
||||
verbose
|
||||
basedir .
|
||||
__EOF__
|
||||
|
||||
for dist in $dists; do
|
||||
for file in `ls $repo_xcat_dep_path/*.deb`; do
|
||||
reprepro -b $repo_xcat_dep_path includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
|
||||
cat << '__EOF__' > $repo_xcat_dep_path/mklocalrepo.sh
|
||||
codename=`lsb_release -a 2>null | grep Codename | awk '{print $2}'`
|
||||
cd `dirname $0`
|
||||
echo deb file://"`pwd`" $codename main > /etc/apt/sources.list.d/xcat-dep.list
|
||||
__EOF__
|
||||
|
||||
chmod 775 $repo_xcat_dep_path/mklocalrepo.sh
|
||||
rm -rf $repo_xcat_dep_path/*.deb
|
||||
|
||||
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"]
|
||||
|
||||
if [ -z "$local_flag" ] # delete the temp repo after upload is done
|
||||
then
|
||||
rm -rf ./gsa-repo_temp
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# Accepts directories to build packages from on the commandline, but defaults
|
||||
# to building: perl-xCAT and xCAT-client
|
||||
|
||||
major=`cat Version`
|
||||
lintian="" # TODO: lintian fails currently
|
||||
#lintian="--svn-lintian"
|
||||
|
||||
if [ "$1" = "-s" ]; then
|
||||
shift
|
||||
snap=true
|
||||
date="$( date +'%F' )"
|
||||
version="$major-snapshot-$( date +'%Y%m%d' )"
|
||||
fi
|
||||
|
||||
packages="${@:-perl-xCAT xCAT-client}"
|
||||
|
||||
for pkg in $packages; do
|
||||
mkdir -p debs/$pkg
|
||||
echo "*** Building Debian package for $pkg."
|
||||
cd $pkg
|
||||
if $snap; then
|
||||
debchange --distribution unstable --newversion $version "snapshot of $pkg from $date"
|
||||
fi
|
||||
svn-buildpackage --svn-ignore $lintian --svn-move-to=../debs/$pkg
|
||||
cd -
|
||||
done
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/bin/bash
|
||||
###########
|
||||
#
|
||||
# This script call make<package>deb and create the deb packages
|
||||
# for xCAT
|
||||
#
|
||||
# Author: Leonardo Tonetto <tonetto@linux.vnet.ibm.com>
|
||||
# Revisor: Adalberto Medeiros <adalbas@linux.vnet.ibm.com>
|
||||
# Revisor2: Arif Ali <aali@ocf.co.uk>
|
||||
#
|
||||
# Input:
|
||||
#
|
||||
# $1 is the build type/location
|
||||
# $2 is the string added to the debian/changelog of each package
|
||||
#
|
||||
############
|
||||
|
||||
##############
|
||||
# Get input
|
||||
##############
|
||||
|
||||
PKG_LOCATION=$1 # local | snap | alpha
|
||||
if [ -z $PKG_LOCATION ]; then
|
||||
PKG_LOCATION="local"
|
||||
fi
|
||||
BUILD_STRING=$2
|
||||
if [ -z $BUILD_STRING ]; then
|
||||
BUILD_STRING="Personal Build"
|
||||
fi
|
||||
XCAT_VERSION=`cat Version`
|
||||
TRUNK_REVISION=`svnversion | cut -d ":" -f1`
|
||||
CUR_DATE=`date +%Y%m%d`
|
||||
VERSION="${XCAT_VERSION}-${PKG_LOCATION}${CUR_DATE}"
|
||||
|
||||
function makedeb {
|
||||
SRC_ROOT=$1
|
||||
PKG_LOCATION=$2
|
||||
BUILD_STRING=$3
|
||||
VERSION=$4
|
||||
|
||||
#
|
||||
# Make DEBs
|
||||
#
|
||||
# build perl-xCAT - deps are libsoap-lite-perl, libdigest-sha1-perl, libdbi-perl
|
||||
#
|
||||
|
||||
find $SRC_ROOT -maxdepth 2 -name debian -type d | while read DEBIAN_DIR
|
||||
do
|
||||
DIR=`echo ${DEBIAN_DIR} | sed -e 's/[/]debian$//'`
|
||||
cd ${DIR}
|
||||
dch -v $VERSION -b -c debian/changelog "$BUILD_STRING"
|
||||
dpkg-buildpackage
|
||||
cd -
|
||||
RC=$?
|
||||
if [ ${RC} -gt 0 ]
|
||||
then
|
||||
echo "Warning: ${DEBIAN_DIR} failed exit code ${RC}"
|
||||
fi
|
||||
done
|
||||
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
# Eliminate unnecessary directories and debian/files made by dpkg-buildpackage
|
||||
|
||||
find $SRC_ROOT -maxdepth 3 -type d -name "xcat-*" | grep debian | xargs rm -rf
|
||||
find $SRC_ROOT -maxdepth 3 -type f -name "files" | grep debian | xargs rm -f
|
||||
}
|
||||
|
||||
# build all debian packages
|
||||
packages="xCAT-client xCAT-nbroot xCAT-nbroot2 perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-IBMhpc xCAT-rmc"
|
||||
|
||||
for file in `echo $packages`
|
||||
do
|
||||
makedeb $file $PKG_LOCATION "$BUILD_STRING" $VERSION
|
||||
done
|
||||
|
||||
if [ -d debs ]; then
|
||||
rm -rf debs
|
||||
fi
|
||||
|
||||
mkdir debs
|
||||
mv xcat* debs/
|
||||
mv perl-xcat* debs/
|
||||
|
||||
echo $VERSION > latest_version
|
||||
|
||||
exit 0
|
||||
@@ -1,264 +0,0 @@
|
||||
#!/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
|
||||
#
|
||||
|
||||
# For the purpose of getting the distribution name
|
||||
. /etc/lsb-release
|
||||
|
||||
# Supported distributions
|
||||
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
|
||||
u_flag= # gsa user-id
|
||||
p_flag= # gsa passwd
|
||||
local_flag= # build the repository localy
|
||||
|
||||
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"
|
||||
;;
|
||||
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
|
||||
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
|
||||
|
||||
repo_xcat_core_path="`pwd`/gsa-repo_temp/xcat-core"
|
||||
repo_xcat_dep_path="`pwd`/gsa-repo_temp/xcat-dep"
|
||||
fi
|
||||
|
||||
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
|
||||
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 "#################################"
|
||||
|
||||
if [ -d $repo_xcat_core_path ]; then
|
||||
rm -rf $repo_xcat_core_path
|
||||
fi
|
||||
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__ >> $repo_xcat_core_path/conf/distributions
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-core bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: amd64 i386
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
|
||||
__EOF__
|
||||
done
|
||||
|
||||
cat << __EOF__ > $repo_xcat_core_path/conf/options
|
||||
verbose
|
||||
basedir .
|
||||
__EOF__
|
||||
|
||||
for dist in $dists; do
|
||||
for file in `ls $repo_xcat_core_path/*.deb`; do
|
||||
reprepro -b $repo_xcat_core_path includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
|
||||
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 $repo_xcat_core_path/mklocalrepo.sh
|
||||
rm -rf $repo_xcat_core_path/*.deb
|
||||
|
||||
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" ]
|
||||
|
||||
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 \;
|
||||
|
||||
rm -rf $repo_xcat_core_path/conf/distributions
|
||||
|
||||
for dist in $dists; do
|
||||
cat << __EOF__ >> $repo_xcat_dep_path/conf/distributions
|
||||
Origin: xCAT internal repository
|
||||
Label: xcat-dep bazaar repository
|
||||
Codename: $dist
|
||||
Architectures: i386 amd64
|
||||
Components: main
|
||||
Description: Repository automatically genereted conf
|
||||
|
||||
__EOF__
|
||||
done
|
||||
|
||||
cat << __EOF__ > $repo_xcat_dep_path/conf/options
|
||||
verbose
|
||||
basedir .
|
||||
__EOF__
|
||||
|
||||
for dist in $dists; do
|
||||
for file in `ls $repo_xcat_dep_path/*.deb`; do
|
||||
reprepro -b $repo_xcat_dep_path includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
|
||||
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 $repo_xcat_dep_path/mklocalrepo.sh
|
||||
rm -rf $repo_xcat_dep_path/*.deb
|
||||
|
||||
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"]
|
||||
|
||||
if [ -z "$local_flag" ] # delete the temp repo after upload is done
|
||||
then
|
||||
rm -rf ./gsa-repo_temp
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -49,7 +49,7 @@ if {$force_conservative} {
|
||||
|
||||
|
||||
set timeout -1
|
||||
spawn sh -c "rpm --quiet --resign $argv"
|
||||
spawn sh -c "rpm --resign $argv"
|
||||
match_max 100000
|
||||
expect -exact "Enter pass phrase: "
|
||||
send -- "\r"
|
||||
|
||||
+97
-206
@@ -19,38 +19,19 @@
|
||||
# directories that are needed.
|
||||
|
||||
# Usage: buildcore.sh [attr=value attr=value ...]
|
||||
# Before running buildcore.sh, you must change the local git repo to the branch you want built, using: git checkout <branch>
|
||||
# PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release. This does not
|
||||
# actually build xcat, just uploads the most recent snap build to https://sourceforge.net/projects/xcat/files/xcat/ .
|
||||
# If not specified, a snap build is assumed, which uploads to https://sourceforge.net/projects/xcat/files/yum/
|
||||
# or https://sourceforge.net/projects/xcat/files/aix/.
|
||||
# PREGA=1 - use this option with PROMOTE=1 on a branch that already has a released dot release, but this build is
|
||||
# a GA candidate build, not to be released yet. This will result in the tarball being uploaded to
|
||||
# https://sourceforge.net/projects/xcat/files/yum/ or https://sourceforge.net/projects/xcat/files/aix/
|
||||
# (but the tarball file name will be like a released tarball, not a snap build). When you are ready to
|
||||
# release this build, use PROMOTE=1 without PREGA
|
||||
# BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in prep for a release.
|
||||
# PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release.
|
||||
# Otherwise, and snap build is assumed.
|
||||
# PREGA=1 - means this is a branch that has not been released yet, so during the promote, copy the
|
||||
# xcat-core tarball to the SF web site instead of the FRS area.
|
||||
# UP=0 or UP=1 - override the default upload behavior
|
||||
# SVNUP=<filename> - control which rpms get built by specifying a coresvnup file
|
||||
# GITUP=<filename> - control which rpms get built by specifying a coregitup file
|
||||
# EMBED=<embedded-environment> - the environment for which a minimal version of xcat should be built, e.g. zvm or flex
|
||||
# FRSYUM=0 - put the yum repo and snap builds in the old project web area instead of the FRS area.
|
||||
# VERBOSE=1 - to see lots of verbose output
|
||||
|
||||
# you can change this if you need to
|
||||
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"
|
||||
ZVMBUILD="perl-xCAT xCAT-server xCAT-UI"
|
||||
ZVMLINK="xCAT-client xCAT xCATsn"
|
||||
PCMBUILD="xCAT"
|
||||
PCMLINK="perl-xCAT xCAT-client xCAT-server xCAT-buildkit xCAT-genesis-scripts-x86_64"
|
||||
# Note: for FSM, the FlexCAT rpm is built separately from gsa/git
|
||||
FSMBUILD="perl-xCAT xCAT-client xCAT-server"
|
||||
FSMLINK=""
|
||||
# If you add more embed cases, also change the if [ -n "$EMBED" ]... below
|
||||
|
||||
# Process cmd line variable assignments, assigning each attr=val pair to a variable of same name
|
||||
for i in $*; do
|
||||
# upper case the variable name
|
||||
@@ -85,85 +66,56 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
export HOME=/root # This is so rpm and gpg will know home, even in sudo
|
||||
fi
|
||||
|
||||
# for the git case, query the current branch and set REL (changing master to devel if necessary)
|
||||
function setbranch {
|
||||
#git checkout $BRANCH
|
||||
#REL=`git rev-parse --abbrev-ref HEAD`
|
||||
REL=`git name-rev --name-only HEAD`
|
||||
if [ "$REL" = "master" ]; then
|
||||
REL="devel"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$REL" = "xcat-core" ]; then # using git
|
||||
GIT=1
|
||||
setbranch # this changes the REL variable
|
||||
# this is needed only when we are transitioning the yum over to frs
|
||||
if [ "$FRSYUM" != 0 ]; then
|
||||
YUMDIR=$FRS
|
||||
YUMREPOURL="https://sourceforge.net/projects/xcat/files/yum"
|
||||
else
|
||||
YUMDIR=htdocs
|
||||
YUMREPOURL="http://xcat.sourceforge.net/yum"
|
||||
fi
|
||||
|
||||
YUMDIR=$FRS
|
||||
YUMREPOURL="https://sourceforge.net/projects/xcat/files/yum"
|
||||
|
||||
# Set variables based on which type of build we are doing
|
||||
if [ -n "$EMBED" ]; then
|
||||
EMBEDDIR="/$EMBED"
|
||||
if [ "$EMBED" = "zvm" ]; then
|
||||
EMBEDBUILD=$ZVMBUILD
|
||||
EMBEDLINK=$ZVMLINK
|
||||
elif [ "$EMBED" = "pcm" ]; then
|
||||
EMBEDBUILD=$PCMBUILD
|
||||
EMBEDLINK=$PCMLINK
|
||||
elif [ "$EMBED" = "fsm" ]; then
|
||||
EMBEDBUILD=$FSMBUILD
|
||||
EMBEDLINK=$FSMLINK
|
||||
XCATCORE="xcat-core" # core-snap is a sym link to xcat-core
|
||||
echo "svn --quiet up Version"
|
||||
svn --quiet up Version
|
||||
VER=`cat Version`
|
||||
SHORTVER=`cat Version|cut -d. -f 1,2`
|
||||
SHORTSHORTVER=`cat Version|cut -d. -f 1`
|
||||
if [ "$PROMOTE" = 1 ]; then
|
||||
CORE="xcat-core"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-$VER.tar.gz
|
||||
else
|
||||
echo "Error: EMBED setting $EMBED not recognized."
|
||||
exit 2
|
||||
TARNAME=xcat-core-$VER.tar.bz2
|
||||
fi
|
||||
else
|
||||
EMBEDDIR=""
|
||||
EMBEDBUILD=$ALLBUILD
|
||||
EMBEDLINK=""
|
||||
fi
|
||||
|
||||
XCATCORE="xcat-core" # core-snap is a sym link to xcat-core
|
||||
|
||||
if [ "$GIT" = "1" ]; then # using git - need to include REL in the path where we put the built rpms
|
||||
DESTDIR=../../$REL$EMBEDDIR/$XCATCORE
|
||||
else
|
||||
DESTDIR=../..$EMBEDDIR/$XCATCORE
|
||||
CORE="core-snap"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-snap.tar.gz
|
||||
else
|
||||
TARNAME=core-rpms-snap.tar.bz2
|
||||
fi
|
||||
fi
|
||||
DESTDIR=../../$XCATCORE
|
||||
SRCD=core-snap-srpms
|
||||
|
||||
# currently aix builds ppc rpms, but someday it should build noarch
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
NOARCH=ppc
|
||||
else
|
||||
NOARCH=noarch
|
||||
fi
|
||||
|
||||
function setversionvars {
|
||||
VER=`cat Version`
|
||||
SHORTVER=`cat Version|cut -d. -f 1,2`
|
||||
SHORTSHORTVER=`cat Version|cut -d. -f 1`
|
||||
}
|
||||
|
||||
|
||||
if [ "$PROMOTE" != 1 ]; then # very long if statement to not do builds if we are promoting
|
||||
# we are doing a snap build
|
||||
CORE="core-snap"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-snap.tar.gz
|
||||
else
|
||||
TARNAME=core-rpms-snap.tar.bz2
|
||||
fi
|
||||
mkdir -p $DESTDIR
|
||||
SRCDIR=$DESTDIR/../$SRCD
|
||||
SRCDIR=../../$SRCD
|
||||
mkdir -p $SRCDIR
|
||||
if [ -n "$VERBOSEMODE" ]; then
|
||||
GREP=grep
|
||||
else
|
||||
GREP="grep -q"
|
||||
fi
|
||||
# currently aix builds ppc rpms, but someday it should build noarch
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
NOARCH=ppc
|
||||
else
|
||||
NOARCH=noarch
|
||||
fi
|
||||
UPLOAD=0
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
source=/opt/freeware/src/packages
|
||||
@@ -176,52 +128,24 @@ else
|
||||
#echo "source=$source"
|
||||
fi
|
||||
|
||||
# If they have not given us a premade update file, do an svn update or git pull and capture the results
|
||||
SOMETHINGCHANGED=0
|
||||
if [ "$GIT" = "1" ]; then # using git
|
||||
if [ -z "$GITUP" ]; then
|
||||
GITUP=../coregitup
|
||||
echo "git pull > $GITUP"
|
||||
git pull > $GITUP
|
||||
fi
|
||||
if ! $GREP 'Already up-to-date' $GITUP; then
|
||||
SOMETHINGCHANGED=1
|
||||
fi
|
||||
else # using svn
|
||||
GIT=0
|
||||
if [ -z "$SVNUP" ]; then
|
||||
SVNUP=../coresvnup
|
||||
echo "svn up > $SVNUP"
|
||||
svn up > $SVNUP
|
||||
fi
|
||||
if ! $GREP 'At revision' $SVNUP; then
|
||||
SOMETHINGCHANGED=1
|
||||
fi
|
||||
# copy the SVNUP variable to GITUP so the rest of the script doesnt have to worry whether we did svn or git
|
||||
GITUP=$SVNUP
|
||||
# If they have not given us a premade update file, do an svn update and capture the results
|
||||
if [ -z "$SVNUP" ]; then
|
||||
SVNUP=../coresvnup
|
||||
echo "svn up > $SVNUP"
|
||||
svn up > $SVNUP
|
||||
fi
|
||||
|
||||
setversionvars
|
||||
|
||||
# Function for making the noarch rpms
|
||||
function maker {
|
||||
rpmname="$1"
|
||||
./makerpm $rpmname "$EMBED"
|
||||
if [ $? -ne 0 ]; then
|
||||
FAILEDRPMS="$FAILEDRPMS $rpmname"
|
||||
else
|
||||
rm -f $DESTDIR/$rpmname*rpm
|
||||
rm -f $SRCDIR/$rpmname*rpm
|
||||
mv $source/RPMS/$NOARCH/$rpmname-$VER*rpm $DESTDIR
|
||||
mv $source/SRPMS/$rpmname-$VER*rpm $SRCDIR
|
||||
fi
|
||||
}
|
||||
|
||||
# If anything has changed, we should always rebuild perl-xCAT
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # Use to be: $GREP perl-xCAT $GITUP; then
|
||||
if [[ " $EMBEDBUILD " = *\ perl-xCAT\ * ]]; then
|
||||
UPLOAD=1
|
||||
maker perl-xCAT
|
||||
if ! $GREP 'At revision' $SVNUP; then # Use to be: $GREP perl-xCAT $SVNUP; then
|
||||
UPLOAD=1
|
||||
./makerpm perl-xCAT
|
||||
if [ $? -ne 0 ]; then
|
||||
FAILEDRPMS="perl-xCAT"
|
||||
else
|
||||
rm -f $DESTDIR/perl-xCAT*rpm
|
||||
rm -f $SRCDIR/perl-xCAT*rpm
|
||||
mv $source/RPMS/$NOARCH/perl-xCAT-$VER*rpm $DESTDIR/
|
||||
mv $source/SRPMS/perl-xCAT-$VER*rpm $SRCDIR/
|
||||
fi
|
||||
fi
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
@@ -230,13 +154,18 @@ if [ "$OSNAME" = "AIX" ]; then
|
||||
fi
|
||||
|
||||
# Build the rest of the noarch rpms
|
||||
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit; do
|
||||
#if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi # for zvm embedded env only need to build server and UI
|
||||
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
|
||||
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi # do not build xCAT-buildkit on aix
|
||||
if $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then
|
||||
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test; do
|
||||
if $GREP $rpmname $SVNUP; then
|
||||
UPLOAD=1
|
||||
maker $rpmname
|
||||
./makerpm $rpmname
|
||||
if [ $? -ne 0 ]; then
|
||||
FAILEDRPMS="$FAILEDRPMS $rpmname"
|
||||
else
|
||||
rm -f $DESTDIR/$rpmname*rpm
|
||||
rm -f $SRCDIR/$rpmname*rpm
|
||||
mv $source/RPMS/$NOARCH/$rpmname-$VER*rpm $DESTDIR/
|
||||
mv $source/SRPMS/$rpmname-$VER*rpm $SRCDIR/
|
||||
fi
|
||||
fi
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
if [ "$rpmname" = "xCAT-client" -o "$rpmname" = "xCAT-server" ]; then # we do not automatically install the rest of the rpms on AIX
|
||||
@@ -245,38 +174,34 @@ for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xC
|
||||
fi
|
||||
done
|
||||
|
||||
# Build xCAT-genesis-scripts for xcat-core. xCAT-genesis-base gets built by hand and put in xcat-dep.
|
||||
# The mknb cmd combines them at install time.
|
||||
if [ "$OSNAME" != "AIX" ]; then
|
||||
if [[ " $EMBEDBUILD " = *\ xCAT-genesis-scripts\ * ]]; then
|
||||
if $GREP xCAT-genesis-scripts $GITUP || [ "$BUILDALL" == 1 ]; then
|
||||
UPLOAD=1
|
||||
ORIGFAILEDRPMS="$FAILEDRPMS"
|
||||
./makerpm xCAT-genesis-scripts x86_64 "$EMBED"
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-x86_64"; fi
|
||||
if [ "$FAILEDRPMS" = "$ORIGFAILEDRPMS" ]; then # all succeeded
|
||||
rm -f $DESTDIR/xCAT-genesis-scripts*rpm
|
||||
rm -f $SRCDIR/xCAT-genesis-scripts*rpm
|
||||
mv $source/RPMS/noarch/xCAT-genesis-scripts-*rpm $DESTDIR
|
||||
mv $source/SRPMS/xCAT-genesis-scripts-*rpm $SRCDIR
|
||||
fi
|
||||
if $GREP xCAT-nbroot $SVNUP; then
|
||||
UPLOAD=1
|
||||
ORIGFAILEDRPMS="$FAILEDRPMS"
|
||||
for arch in x86_64 x86 ppc64; do
|
||||
./makerpm xCAT-nbroot-core $arch
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-nbroot-core-$arch"; fi
|
||||
done
|
||||
if [ "$FAILEDRPMS" = "$ORIGFAILEDRPMS" ]; then # all succeeded
|
||||
rm -f $DESTDIR/xCAT-nbroot-core*rpm
|
||||
rm -f $SRCDIR/xCAT-nbroot-core*rpm
|
||||
mv $source/RPMS/noarch/xCAT-nbroot-core-*rpm $DESTDIR
|
||||
mv $source/SRPMS/xCAT-nbroot-core-*rpm $SRCDIR
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Build the xCAT and xCATsn rpms for all platforms
|
||||
for rpmname in xCAT xCATsn; do
|
||||
#if [ "$EMBED" = "zvm" ]; then break; fi
|
||||
if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi
|
||||
if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $GITUP; then
|
||||
if $GREP -E "^[UAD] +$rpmname/" $SVNUP; then
|
||||
UPLOAD=1
|
||||
ORIGFAILEDRPMS="$FAILEDRPMS"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
./makerpm $rpmname "$EMBED"
|
||||
./makerpm $rpmname
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
|
||||
else
|
||||
for arch in x86_64 ppc64 s390x; do
|
||||
./makerpm $rpmname $arch "$EMBED"
|
||||
for arch in x86_64 i386 ppc64 s390x; do
|
||||
./makerpm $rpmname $arch
|
||||
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
|
||||
done
|
||||
fi
|
||||
@@ -288,32 +213,12 @@ for rpmname in xCAT xCATsn; do
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# no longer put in xCAT-rmc
|
||||
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
echo "rpm -Uvh xCAT-$SHORTSHORTVER*rpm" >> $DESTDIR/instxcat
|
||||
echo "rpm -Uvh xCAT-rmc-$SHORTSHORTVER*rpm" >> $DESTDIR/instxcat
|
||||
fi
|
||||
|
||||
# Make sym links in the embed subdirs for the rpms we do not have to build special
|
||||
if [ -n "$EMBED" -a -n "$EMBEDLINK" ]; then
|
||||
cd $DESTDIR
|
||||
maindir="../../$XCATCORE"
|
||||
for rpmname in $EMBEDLINK; do
|
||||
if [ "$rpmname" = "xCAT" -o "$rpmname" = "xCATsn" ]; then
|
||||
if [ "$EMBED" = "zvm" ]; then
|
||||
echo "Creating link for $rpmname-$SHORTSHORTVER"'*.s390x.rpm'
|
||||
rm -f $rpmname-$SHORTSHORTVER*rpm
|
||||
ln -s $maindir/$rpmname-$SHORTSHORTVER*.s390x.rpm .
|
||||
fi
|
||||
else
|
||||
echo "Creating link for $rpmname-$SHORTSHORTVER"'*rpm'
|
||||
rm -f $rpmname-$SHORTSHORTVER*rpm
|
||||
ln -s $maindir/$rpmname-$SHORTSHORTVER*rpm .
|
||||
fi
|
||||
done
|
||||
cd - >/dev/null
|
||||
fi
|
||||
|
||||
|
||||
# Decide if anything was built or not
|
||||
if [ -n "$FAILEDRPMS" ]; then
|
||||
echo "Error: build of the following RPMs failed: $FAILEDRPMS"
|
||||
@@ -346,10 +251,10 @@ 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 '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
build-utils/rpmsign.exp $DESTDIR/*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
|
||||
createrepo $DESTDIR
|
||||
createrepo $SRCDIR
|
||||
rm -f $SRCDIR/repodata/repomd.xml.asc
|
||||
rm -f $DESTDIR/repodata/repomd.xml.asc
|
||||
gpg -a --detach-sign $DESTDIR/repodata/repomd.xml
|
||||
@@ -378,36 +283,23 @@ chmod -R g+w $DESTDIR
|
||||
chgrp -R xcat $SRCDIR
|
||||
chmod -R g+w $SRCDIR
|
||||
|
||||
else # end of very long if-not-promote
|
||||
# we are only promoting (not building)
|
||||
setversionvars
|
||||
setbranch
|
||||
CORE="xcat-core"
|
||||
if [ "$OSNAME" = "AIX" ]; then
|
||||
TARNAME=core-aix-$VER.tar.gz
|
||||
else
|
||||
TARNAME=xcat-core-$VER.tar.bz2
|
||||
fi
|
||||
fi
|
||||
fi # end of very long if-not-promote
|
||||
|
||||
|
||||
cd $DESTDIR
|
||||
|
||||
if [ "$OSNAME" != "AIX" ]; then
|
||||
|
||||
# Modify the repo file to point to either xcat-core or core-snap
|
||||
# Always recreate it, in case the whole dir was copied from devel to 2.x
|
||||
if [ -n "$1" ]; then embed="$1/"
|
||||
else embed=""; fi
|
||||
cat >xCAT-core.repo << EOF
|
||||
[xcat-2-core]
|
||||
name=xCAT 2 Core packages
|
||||
baseurl=$YUMREPOURL/$REL$EMBEDDIR/$CORE
|
||||
baseurl=$YUMREPOURL/$REL/$CORE
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey=$YUMREPOURL/$REL$EMBEDDIR/$CORE/repodata/repomd.xml.key
|
||||
gpgkey=$YUMREPOURL/$REL/$CORE/repodata/repomd.xml.key
|
||||
EOF
|
||||
|
||||
|
||||
# Create the mklocalrepo script
|
||||
cat >mklocalrepo.sh << 'EOF2'
|
||||
#!/bin/sh
|
||||
@@ -455,33 +347,33 @@ if [ ! -e core-snap ]; then
|
||||
fi
|
||||
if [ "$REL" = "devel" -o "$PREGA" != 1 ]; then
|
||||
i=0
|
||||
echo "Uploading RPMs from $CORE to $YUMDIR/$YUM/$REL$EMBEDDIR/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $CORE $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL$EMBEDDIR/
|
||||
echo "Uploading RPMs from $CORE to $YUMDIR/$YUM/$REL/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $CORE $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL/
|
||||
do : ; done
|
||||
fi
|
||||
|
||||
# Upload the individual source RPMs to sourceforge
|
||||
i=0
|
||||
echo "Uploading src RPMs from $SRCD to $YUMDIR/$YUM/$REL$EMBEDDIR/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $SRCD $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL$EMBEDDIR/
|
||||
echo "Uploading src RPMs from $SRCD to $YUMDIR/$YUM/$REL/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $SRCD $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL/
|
||||
do : ; done
|
||||
|
||||
# Upload the tarball to sourceforge
|
||||
if [ "$PROMOTE" = 1 -a "$REL" != "devel" -a "$PREGA" != 1 ]; then
|
||||
# upload tarball to FRS area
|
||||
i=0
|
||||
echo "Uploading $TARNAME to $FRS/xcat/$REL.x_$OSNAME$EMBEDDIR/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -v $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:$FRS/xcat/$REL.x_$OSNAME$EMBEDDIR/
|
||||
echo "Uploading $TARNAME to $FRS/xcat/$REL.x_$OSNAME/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -v $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:$FRS/xcat/$REL.x_$OSNAME/
|
||||
do : ; done
|
||||
else
|
||||
i=0
|
||||
echo "Uploading $TARNAME to $YUMDIR/$YUM/$REL$EMBEDDIR/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -v $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL$EMBEDDIR/
|
||||
echo "Uploading $TARNAME to $YUMDIR/$YUM/$REL/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -v $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL/
|
||||
do : ; done
|
||||
fi
|
||||
|
||||
# Extract and upload the man pages in html format
|
||||
if [ "$OSNAME" != "AIX" -a "$REL" = "devel" -a "$PROMOTE" != 1 -a -z "$EMBED" ]; then
|
||||
if [ "$OSNAME" != "AIX" -a "$REL" = "devel" -a "$PROMOTE" != 1 ]; then
|
||||
echo "Extracting and uploading man pages to htdocs/ ..."
|
||||
mkdir -p man
|
||||
cd man
|
||||
@@ -489,7 +381,6 @@ if [ "$OSNAME" != "AIX" -a "$REL" = "devel" -a "$PROMOTE" != 1 -a -z "$EMBED" ];
|
||||
rpm2cpio ../$XCATCORE/xCAT-client-*.$NOARCH.rpm | cpio -id '*.html'
|
||||
rpm2cpio ../$XCATCORE/perl-xCAT-*.$NOARCH.rpm | cpio -id '*.html'
|
||||
rpm2cpio ../$XCATCORE/xCAT-test-*.$NOARCH.rpm | cpio -id '*.html'
|
||||
rpm2cpio ../$XCATCORE/xCAT-buildkit-*.$NOARCH.rpm | cpio -id '*.html'
|
||||
i=0
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync $verboseflag -r opt/xcat/share/doc/man1 opt/xcat/share/doc/man3 opt/xcat/share/doc/man5 opt/xcat/share/doc/man7 opt/xcat/share/doc/man8 $UPLOADUSER,xcat@web.sourceforge.net:htdocs/
|
||||
do : ; done
|
||||
|
||||
+64
-90
@@ -15,54 +15,33 @@
|
||||
# DESTDIR=<dir> - the dir to place the dep tarball in. The default is ../../../xcat-dep, relative
|
||||
# to where this script is located.
|
||||
# UP=0 or UP=1 - override the default upload behavior
|
||||
# FRSYUM=0 - put the directory of individual rpms in the project web area instead of the FRS area.
|
||||
# VERBOSE=1 - to see lots of verbose output
|
||||
|
||||
# you can change this if you need to
|
||||
UPLOADUSER=bp-sawyers
|
||||
|
||||
FRS=/home/frs/project/x/xc/xcat
|
||||
OSNAME=$(uname)
|
||||
|
||||
# Process cmd line variable assignments, assigning each attr=val pair to a variable of same name
|
||||
for i in $*; do
|
||||
# upper case the variable name
|
||||
varstring=`echo "$i"|cut -d '=' -f 1|tr [a-z] [A-Z]`=`echo "$i"|cut -d '=' -f 2`
|
||||
export $varstring
|
||||
done
|
||||
if [ "$VERBOSE" = "1" -o "$VERBOSE" = "yes" ]; then
|
||||
set -x
|
||||
VERBOSEMODE=1
|
||||
fi
|
||||
|
||||
if [ "$OSNAME" == "AIX" ]; then
|
||||
GSA=/gsa/pokgsa/projects/x/xcat/build/aix/xcat-dep
|
||||
else
|
||||
GSA=/gsa/pokgsa/projects/x/xcat/build/linux/xcat-dep
|
||||
fi
|
||||
|
||||
if [ "$OSNAME" != "AIX" ]; then
|
||||
export HOME=/root # This is so rpm and gpg will know home, even in sudo
|
||||
fi
|
||||
|
||||
# this is needed only when we are transitioning the yum over to frs
|
||||
YUMREPOURL1="http://xcat.sourceforge.net/yum"
|
||||
YUMREPOURL2="https://sourceforge.net/projects/xcat/files/yum"
|
||||
if [ "$FRSYUM" != 0 ]; then
|
||||
YUMDIR=$FRS
|
||||
YUMREPOURL="$YUMREPOURL2"
|
||||
else
|
||||
YUMDIR=htdocs
|
||||
YUMREPOURL="$YUMREPOURL1"
|
||||
fi
|
||||
|
||||
if [ -n "$VERBOSEMODE" ]; then
|
||||
GREP=grep
|
||||
else
|
||||
GREP="grep -q"
|
||||
fi
|
||||
# Process cmd line variable assignments, assigning each attr=val pair to a variable of same name
|
||||
for i in $*; do
|
||||
#declare `echo $i|cut -d '=' -f 1`=`echo $i|cut -d '=' -f 2`
|
||||
export $i
|
||||
done
|
||||
|
||||
if [ ! -d $GSA ]; then
|
||||
echo "builddep: It appears that you do not have gsa installed to access the xcat-dep pkgs."
|
||||
exit 1;
|
||||
fi
|
||||
set -x
|
||||
cd `dirname $0`
|
||||
XCATCOREDIR=`/bin/pwd`
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
@@ -71,7 +50,6 @@ fi
|
||||
|
||||
# Sync from the GSA master copy of the dep rpms
|
||||
mkdir -p $DESTDIR/xcat-dep
|
||||
echo "Syncing RPMs from $GSA/ to $DESTDIR/xcat-dep ..."
|
||||
rsync -ilrtpu --delete $GSA/ $DESTDIR/xcat-dep
|
||||
cd $DESTDIR/xcat-dep
|
||||
|
||||
@@ -96,38 +74,21 @@ if [ "$OSNAME" != "AIX" ]; then
|
||||
fi
|
||||
|
||||
# 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 '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
|
||||
$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'`
|
||||
|
||||
# Create the repodata dirs
|
||||
echo "Creating repodata directories..."
|
||||
for i in `find -mindepth 2 -maxdepth 2 -type d `; do
|
||||
if [ -n "$VERBOSEMODE" ]; then
|
||||
createrepo $i
|
||||
else
|
||||
createrepo $i >/dev/null
|
||||
fi
|
||||
createrepo $i
|
||||
rm -f $i/repodata/repomd.xml.asc
|
||||
gpg -a --detach-sign $i/repodata/repomd.xml
|
||||
if [ ! -f $i/repodata/repomd.xml.key ]; then
|
||||
cp $GSA/../keys/repomd.xml.key $i/repodata
|
||||
fi
|
||||
done
|
||||
|
||||
# Modify xCAT-dep.repo files to point to the correct place
|
||||
if [ "$FRSYUM" != 0 ]; then
|
||||
newurl="$YUMREPOURL2"
|
||||
oldurl="$YUMREPOURL1"
|
||||
else
|
||||
newurl="$YUMREPOURL1"
|
||||
oldurl="$YUMREPOURL2"
|
||||
fi
|
||||
sed -i -e "s|=$oldurl|=$newurl|g" `find . -name "xCAT-dep.repo" `
|
||||
fi
|
||||
|
||||
if [ "$OSNAME" == "AIX" ]; then
|
||||
# Build the instoss file ------------------------------------------
|
||||
|
||||
# Build the instoss file
|
||||
cat >instoss << 'EOF'
|
||||
#!/bin/ksh
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
@@ -146,25 +107,24 @@ else
|
||||
fi
|
||||
cd $OSVER
|
||||
# Have to install rpms 1 at a time, since some may be already installed.
|
||||
# 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.)
|
||||
# The only interdependency between the dep rpms so far is that net-snmp requires bash
|
||||
|
||||
# pyodbc is dependent on unixODBC
|
||||
rpm -Uvh unixODBC*
|
||||
for i in `ls *.rpm|grep -v -E '^tcl-|^tk-|^expect-|^unixODBC-|^xCAT-UI-deps|^perl-DBD-DB2Lite'`; do
|
||||
|
||||
for i in `ls *.rpm|grep -v -E '^tcl-|^tk-|^expect-|^unixODBC-|^xCAT-UI-deps'`; do
|
||||
if [ "$i" == "perl-Net-DNS-0.66-1.aix5.3.ppc.rpm" ]; then
|
||||
opts="--nodeps"
|
||||
else
|
||||
opts=""
|
||||
fi
|
||||
|
||||
# just in case we need it sometime, this next if stmt would mean: if it does not start with perl-DBD-DB2
|
||||
# this next if stmt means: if i does not start with perl-DBD-DB2
|
||||
#if [ "${i#perl-DBD-DB2}" == "$i" ]; then
|
||||
|
||||
echo rpm -Uvh $opts $i
|
||||
rpm -Uvh $opts $i
|
||||
echo rpm -Uvh $opts $i
|
||||
rpm -Uvh $opts $i
|
||||
#fi
|
||||
done
|
||||
# don't try to install tcl, tk, or expect if they are already installed!
|
||||
# this section about expect/tcl/tk can be removed once 2.8 releases, because 2.8 no longer requires expect
|
||||
lslpp -l | grep expect.base > /dev/null 2>&1
|
||||
if [ $? -gt 0 ]; then
|
||||
if [ "$OSVER" == "5.3" ]; then
|
||||
@@ -177,8 +137,41 @@ if [ $? -gt 0 ]; then
|
||||
fi
|
||||
fi
|
||||
EOF
|
||||
# end of instoss file content ---------------------------------------------
|
||||
|
||||
# this is left over from Norms original instoss
|
||||
#rpm -Uvh perl-DBI-*.rpm
|
||||
#rpm -Uvh bash-*.rpm
|
||||
#rpm -Uvh perl-DBD-SQLite-*.rpm
|
||||
#rpm -Uvh popt-*.rpm
|
||||
#rpm -Uvh rsync-*.rpm
|
||||
#rpm -Uvh wget-*.rpm
|
||||
#rpm -Uvh libxml2-*.rpm
|
||||
#rpm -Uvh curl-*.rpm
|
||||
#rpm -Uvh expat-*.rpm
|
||||
#rpm -Uvh conserver-*.rpm
|
||||
#rpm -Uvh perl-Expect-*.rpm
|
||||
#rpm -Uvh perl-IO-Tty-*.rpm
|
||||
#rpm -Uvh perl-IO-Stty-*.rpm
|
||||
#rpm -Uvh perl-IO-Socket-SSL-*.rpm
|
||||
#rpm -Uvh perl-Net_SSLeay.pm-*.rpm
|
||||
#rpm -Uvh perl-Digest-SHA1-*.rpm
|
||||
#rpm -Uvh perl-Digest-SHA-*.rpm
|
||||
#rpm -Uvh perl-Digest-HMAC-*.rpm
|
||||
#rpm -Uvh --nodeps perl-Net-DNS-*.rpm
|
||||
#rpm -Uvh perl-Net-IP-*.rpm
|
||||
#rpm -Uvh perl-Digest-MD5-*.rpm
|
||||
#rpm -Uvh fping-*.rpm
|
||||
#rpm -Uvh openslp-xcat-*.rpm
|
||||
#rpm -Uvh perl-Crypt-SSLeay-*.rpm
|
||||
#rpm -Uvh perl-Net-Telnet-*.rpm
|
||||
# this requires bash
|
||||
#rpm -Uvh net-snmp-5*.rpm
|
||||
#rpm -Uvh net-snmp-devel-*.rpm
|
||||
#rpm -Uvh net-snmp-perl-*.rpm
|
||||
#rpm -Uvh unixODBC-*.rpm
|
||||
#if [ "$OSVER" == "6.1" ]; then
|
||||
# rpm -Uvh perl-version-*.rpm
|
||||
#fi
|
||||
|
||||
chmod +x instoss
|
||||
fi
|
||||
@@ -186,13 +179,9 @@ fi
|
||||
# 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
|
||||
if ! lsgroup xcat >/dev/null 2>&1; then
|
||||
mkgroup xcat
|
||||
fi
|
||||
mkgroup xcat 2>/dev/null
|
||||
else
|
||||
if ! $GREP xcat /etc/group; then
|
||||
groupadd xcat
|
||||
fi
|
||||
groupadd -f xcat
|
||||
fi
|
||||
chgrp -R xcat *
|
||||
chmod -R g+w *
|
||||
@@ -200,24 +189,16 @@ chmod -R g+w *
|
||||
# Build the tarball
|
||||
#VER=`cat $XCATCOREDIR/Version`
|
||||
cd ..
|
||||
if [ -n "$VERBOSEMODE" ]; then
|
||||
verbosetar="-v"
|
||||
else
|
||||
verbosetar=""
|
||||
fi
|
||||
if [ "$OSNAME" == "AIX" ]; then
|
||||
DFNAME=dep-aix-`date +%Y%m%d%H%M`.tar.gz
|
||||
echo "Creating $DFNAME ..."
|
||||
tar $verbosetar -cf ${DFNAME%.gz} xcat-dep
|
||||
tar -cvf ${DFNAME%.gz} xcat-dep
|
||||
rm -f $DFNAME
|
||||
gzip ${DFNAME%.gz}
|
||||
else
|
||||
DFNAME=xcat-dep-`date +%Y%m%d%H%M`.tar.bz2
|
||||
echo "Creating $DFNAME ..."
|
||||
tar $verbosetar -jcf $DFNAME xcat-dep
|
||||
tar -jcvf $DFNAME xcat-dep
|
||||
fi
|
||||
|
||||
#cd xcat-dep <-- now we want to stay above xcat-dep, so we can rsync the whole dir
|
||||
cd xcat-dep
|
||||
|
||||
if [ "$UP" == 0 ]; then
|
||||
exit 0;
|
||||
@@ -233,18 +214,11 @@ fi
|
||||
|
||||
# Upload the dir structure to SF yum area. Currently we do not have it preserving permissions
|
||||
# because that gives errors when different users try to do it.
|
||||
i=0
|
||||
if [ "$FRSYUM" != 0 ]; then
|
||||
links="-L" # FRS does not support rsyncing sym links
|
||||
else
|
||||
links="-l"
|
||||
fi
|
||||
echo "Uploading RPMs from xcat-dep to $YUMDIR/$YUM/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync $links -ruv --delete xcat-dep $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/
|
||||
while ! rsync -rlv --delete * $UPLOADUSER,xcat@web.sourceforge.net:htdocs/$YUM/xcat-dep/
|
||||
do : ; done
|
||||
#ssh jbjohnso@shell1.sf.net "cd /home/groups/x/xc/xcat/htdocs/yum/; rm -rf dep-snap; tar jxvf $DFNAME"
|
||||
|
||||
# Upload the tarball to the SF FRS Area
|
||||
i=0
|
||||
echo "Uploading $DFNAME to $FRS/xcat-dep/$FRSDIR/ ..."
|
||||
while [ $((i+=1)) -le 5 ] && ! rsync -v $DFNAME $UPLOADUSER,xcat@web.sourceforge.net:$FRS/xcat-dep/$FRSDIR/
|
||||
#scp ../$DFNAME $UPLOADUSER@web.sourceforge.net:/home/frs/project/x/xc/xcat/xcat-dep/2.x_Linux/
|
||||
while ! rsync -v ../$DFNAME $UPLOADUSER,xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/xcat-dep/$FRSDIR/
|
||||
do : ; done
|
||||
|
||||
@@ -14,7 +14,7 @@ export DH_COMPAT=5
|
||||
|
||||
build:
|
||||
pwd
|
||||
dh_quilt_patch
|
||||
./xpod2man
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
@@ -26,7 +26,7 @@ install:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installdirs
|
||||
dh_install -X".svn"
|
||||
dh_install
|
||||
dh_link
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ binary-arch:
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
# dh_installexamples
|
||||
dh_install -X".svn"
|
||||
dh_install
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Author: Isaac Freeman
|
||||
#
|
||||
# Make some wild guesses about what debian perl modules a package requires.
|
||||
# Seems to work so far for xCAT.
|
||||
#
|
||||
# Scans the current directory.
|
||||
#
|
||||
|
||||
found=""
|
||||
|
||||
# Warning: voodoo ahead
|
||||
|
||||
find . -name .svn -prune -o -type f \
|
||||
| xargs grep -l '^#!.*perl' \
|
||||
| xargs grep -hE '^\s*(use|require) ' \
|
||||
| while read mod; do
|
||||
pkg=$( awk '{ sub(";", "", $2);
|
||||
gsub("::", "-", $2);
|
||||
print $2 }' <<<"$mod" \
|
||||
| tr '[:upper:]' '[:lower:]' )
|
||||
|
||||
pkgname="lib${pkg}-perl"
|
||||
|
||||
if apt-cache show $pkgname >/dev/null 2>&1; then
|
||||
|
||||
case "$found" in
|
||||
*$pkgname*) continue ;;
|
||||
*)
|
||||
[ -n "$found" ] && echo -n ", "
|
||||
echo -n "$pkgname"
|
||||
found="$found $pkgname"
|
||||
;;
|
||||
esac
|
||||
|
||||
elif perl <<<"$mod" >/dev/null 2>&1; then
|
||||
# Blindly assume that if perl doesn't complain about this, that its
|
||||
# built-in to or ships with perl.
|
||||
continue
|
||||
elif [ "$1" == "-w" ]; then
|
||||
echo
|
||||
echo "warning: $pkg not found and perl doesn't like \"$mod\"" >&2
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
||||
# vim: set sts=2 sw=2 et:
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
OSNAME=$(uname)
|
||||
VER=`cat Version`
|
||||
|
||||
if [ "$OSNAME" = "AIX" ]
|
||||
then
|
||||
|
||||
#source=$PWD
|
||||
#cd /opt/freeware/src/packages/SOURCES
|
||||
#rm -f xCAT-client-$VER; ln -s $source/xCAT-client xCAT-client-$VER
|
||||
#rm -f /opt/freeware/src/packages/SRPMS/xCAT-client*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-client*rpm
|
||||
#echo '.svn' > /tmp/xcat-excludes
|
||||
#tar -X /tmp/xcat-excludes -cf xCAT-client-$VER.tar xCAT-client-$VER
|
||||
#gzip -f /opt/freeware/src/packages/SOURCES/xCAT-client-$VER.tar
|
||||
#cd $source/xCAT-client
|
||||
#rpm -ba xCAT-client.spec
|
||||
|
||||
source=/opt/freeware/src/packages
|
||||
echo '.svn' > /tmp/xcat-excludes
|
||||
tar -X /tmp/xcat-excludes -cf $source/SOURCES/xCAT-client-$VER.tar xCAT-client
|
||||
gzip -f $source/SOURCES/xCAT-client-$VER.tar
|
||||
rm -f $source/SRPMS/xCAT-client*rpm $source/RPMS/ppc/xCAT-client*rpm
|
||||
rpm -ba xCAT-client/xCAT-client.spec
|
||||
#rpm -ta $source/SOURCES/xCAT-client-$VER.tar.gz
|
||||
else
|
||||
rpmbuild --version > /dev/null
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "Error: Is rpmbuild installed and working?"
|
||||
exit 1
|
||||
fi
|
||||
RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec`
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "Could not determine rpmbuild's root"
|
||||
exit 1
|
||||
fi
|
||||
echo "The location for rpm building is ${RPMROOT}"
|
||||
|
||||
set -x
|
||||
tar --exclude=.svn -czhf $RPMROOT/SOURCES/xCAT-client-$VER.tar.gz xCAT-client
|
||||
rm -f $RPMROOT/SRPMS/xCAT-client-$VER*rpm $RPMROOT/RPMS/noarch/xCAT-client-$VER*rpm
|
||||
rpmbuild -ta $RPMROOT/SOURCES/xCAT-client-$VER.tar.gz
|
||||
fi
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
OSNAME=$(uname)
|
||||
VER=`cat Version`
|
||||
|
||||
if [ "$OSNAME" = "AIX" ]
|
||||
then
|
||||
|
||||
#echo '.svn' > /tmp/xcat-excludes
|
||||
#tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/xCAT-IBMhpc-$VER.tar xCAT-IBMhpc
|
||||
#gzip -f /opt/freeware/src/packages/SOURCES/xCAT-IBMhpc-$VER.tar
|
||||
#cd ./xCAT-IBMhpc
|
||||
#rm -f /opt/freeware/src/packages/SRPMS/xCAT-IBMhpc-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-IBMhpc-$VER*rpm
|
||||
#rpm -ba xCAT-IBMhpc.spec
|
||||
#rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-IBMhpc-$VER*rpm
|
||||
|
||||
source=/opt/freeware/src/packages
|
||||
echo '.svn' > /tmp/xcat-excludes
|
||||
tar -X /tmp/xcat-excludes -cf $source/SOURCES/xCAT-IBMhpc-$VER.tar xCAT-IBMhpc
|
||||
gzip -f $source/SOURCES/xCAT-IBMhpc-$VER.tar
|
||||
rm -f $source/SRPMS/xCAT-IBMhpc-$VER*rpm $source/RPMS/ppc/xCAT-IBMhpc-$VER*rpm
|
||||
rpm -ba xCAT-IBMhpc/xCAT-IBMhpc.spec
|
||||
#rpm -ta $source/SOURCES/xCAT-IBMhpc-$VER.tar.gz
|
||||
|
||||
else
|
||||
|
||||
if [ -f /etc/redhat-release ]
|
||||
then
|
||||
pkg="redhat"
|
||||
else
|
||||
pkg="packages"
|
||||
fi
|
||||
|
||||
tar --exclude .svn -czf /usr/src/$pkg/SOURCES/xCAT-IBMhpc-$VER.tar.gz xCAT-IBMhpc
|
||||
rm -f /usr/src/$pkg/SRPMS/xCAT-IBMhpc-$VER*rpm /usr/src/$pkg/RPMS/noarch/xCAT-IBMhpc-$VER*rpm
|
||||
rpmbuild -ta /usr/src/$pkg/SOURCES/xCAT-IBMhpc-$VER.tar.gz
|
||||
#rpm -Uvh /usr/src/$pkg/RPMS/noarch/xCAT-IBMhpc-$VER*rpm
|
||||
fi
|
||||
@@ -13,11 +13,11 @@ then
|
||||
exit 1
|
||||
fi
|
||||
echo "The location for rpm building is ${RPMROOT}"
|
||||
cd `dirname $0`/xCAT-genesis-builder
|
||||
tar --exclude .svn -cjvf $RPMROOT/SOURCES/xCAT-genesis-builder.tar.bz2 .
|
||||
cd `dirname $0`/xCAT-nbroot
|
||||
tar --exclude .svn -czvf $RPMROOT/SOURCES/xcat-nbrootoverlay.tar.gz -C overlay/ .
|
||||
#mv -f *.gz $RPMROOT/SOURCES
|
||||
cp LICENSE.html $RPMROOT/BUILD
|
||||
cp xCAT-genesis-builder.spec $RPMROOT/SOURCES
|
||||
cp xcat-core-nbroot.spec $RPMROOT/SOURCES
|
||||
cd -
|
||||
rm -f $RPMROOT/SRPMS/xCAT-genesis-builder-$VER*rpm $RPMROOT/RPMS/*/xCAT-genesis-builder-$VER*rpm
|
||||
rpmbuild -ba xCAT-genesis-builder/xCAT-genesis-builder.spec
|
||||
rm -f $RPMROOT/SRPMS/xCAT-nbroot-$VER*rpm $RPMROOT/RPMS/*/xCAT-nbroot-$VER*rpm
|
||||
rpmbuild -ba xCAT-nbroot/xcat-core-nbroot.spec --target $1
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
|
||||
OSNAME=$(uname)
|
||||
VER=`cat Version`
|
||||
|
||||
if [ "$OSNAME" = "AIX" ]
|
||||
then
|
||||
|
||||
#source=$PWD
|
||||
#cd /opt/freeware/src/packages/SOURCES
|
||||
#rm -f perl-xCAT-$VER; ln -s $source/perl-xCAT perl-xCAT-$VER
|
||||
#rm -f /opt/freeware/src/packages/SRPMS/perl-xCAT*rpm /opt/freeware/src/packages/RPMS/ppc/perl-xCAT*rpm
|
||||
#echo '.svn' > /tmp/xcat-excludes
|
||||
#tar -X /tmp/xcat-excludes -cf perl-xCAT-$VER.tar perl-xCAT-$VER
|
||||
#gzip -f /opt/freeware/src/packages/SOURCES/perl-xCAT-$VER.tar
|
||||
#cd $source/perl-xCAT
|
||||
#rpm -ba perl-xCAT.spec
|
||||
|
||||
svn info > perl-xCAT/.svninfo
|
||||
source=/opt/freeware/src/packages
|
||||
echo '.svn' > /tmp/xcat-excludes
|
||||
tar -X /tmp/xcat-excludes -cf $source/SOURCES/perl-xCAT-$VER.tar perl-xCAT
|
||||
gzip -f $source/SOURCES/perl-xCAT-$VER.tar
|
||||
rm perl-xCAT/.svninfo
|
||||
rm -f $source/SRPMS/perl-xCAT*rpm $source/RPMS/ppc/perl-xCAT*rpm
|
||||
rpm -ba perl-xCAT/perl-xCAT.spec
|
||||
#rpm -ta $source/SOURCES/perl-xCAT-$VER.tar.gz
|
||||
else
|
||||
|
||||
rpmbuild --version > /dev/null
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "Error: Is rpmbuild installed and working?"
|
||||
exit 1
|
||||
fi
|
||||
RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec`
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "Could not determine rpmbuild's root"
|
||||
exit 1
|
||||
fi
|
||||
echo "The location for rpm building is ${RPMROOT}"
|
||||
|
||||
set -x
|
||||
|
||||
svn info > perl-xCAT/.svninfo
|
||||
tar --exclude .svn -czhf $RPMROOT/SOURCES/perl-xCAT-$VER.tar.gz perl-xCAT;
|
||||
rm perl-xCAT/.svninfo
|
||||
rm -f $RPMROOT/SRPMS/perl-xCAT-$VER*rpm $RPMROOT/RPMS/noarch/perl-xCAT-$VER*rpm
|
||||
rpmbuild -ta $RPMROOT/SOURCES/perl-xCAT-$VER.tar.gz
|
||||
|
||||
fi
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
OSNAME=$(uname)
|
||||
VER=`cat Version`
|
||||
|
||||
if [ "$OSNAME" = "AIX" ]
|
||||
then
|
||||
#source=$PWD
|
||||
#cd /opt/freeware/src/packages/SOURCES
|
||||
#rm -f xCAT-rmc-$VER; ln -s $source/xCAT-rmc xCAT-rmc-$VER
|
||||
#rm -f /opt/freeware/src/packages/SRPMS/xCAT-rmc*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-rmc*rpm
|
||||
#echo '.svn' > /tmp/xcat-excludes
|
||||
#tar -X /tmp/xcat-excludes -cf xCAT-rmc-$VER.tar xCAT-rmc-$VER
|
||||
#gzip -f /opt/freeware/src/packages/SOURCES/xCAT-rmc-$VER.tar
|
||||
#cd $source/xCAT-rmc
|
||||
#rpm -ba xCAT-rmc.spec
|
||||
#rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-rmc*rpm
|
||||
|
||||
source=/opt/freeware/src/packages
|
||||
echo '.svn' > /tmp/xcat-excludes
|
||||
tar -X /tmp/xcat-excludes -cf $source/SOURCES/xCAT-rmc-$VER.tar xCAT-rmc
|
||||
gzip -f $source/SOURCES/xCAT-rmc-$VER.tar
|
||||
rm -f /opt/freeware/src/packages/SRPMS/xCAT-rmc*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-rmc*rpm
|
||||
rpm -ba xCAT-rmc/xCAT-rmc.spec
|
||||
#rpm -Uvh $source/RPMS/ppc/xCAT-rmc*rpm
|
||||
|
||||
else
|
||||
if [ -f /etc/redhat-release ]
|
||||
then
|
||||
pkg="redhat"
|
||||
else
|
||||
pkg="packages"
|
||||
fi
|
||||
|
||||
set -x
|
||||
tar --exclude=.svn -czhf /usr/src/$pkg/SOURCES/xCAT-rmc-$VER.tar.gz xCAT-rmc
|
||||
rm -f /usr/src/$pkg/SRPMS/xCAT-rmc-$VER*rpm /usr/src/$pkg/RPMS/noarch/xCAT-rmc-$VER*rpm
|
||||
rpmbuild -ta /usr/src/$pkg/SOURCES/xCAT-rmc-$VER.tar.gz
|
||||
#rpm -Uvh /usr/src/$pkg/RPMS/noarch/xCAT-rmc-$VER*rpm
|
||||
fi
|
||||
@@ -1,12 +1,9 @@
|
||||
# The shell is commented out so that it will run in bash on linux and ksh on aix
|
||||
# !/bin/bash
|
||||
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
# Common script to make any one the xcat rpms. To build locally, run in the top dir of local svn repository, for example:
|
||||
# ./makerpm xCAT-server
|
||||
# ./makerpm xCAT x86_64
|
||||
# If you want verbose output: export VERBOSE=1
|
||||
|
||||
# set -x
|
||||
|
||||
@@ -18,11 +15,11 @@ function makenoarch {
|
||||
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/$RPMNAME-$VER.tar $RPMNAME
|
||||
gzip -f $RPMROOT/SOURCES/$RPMNAME-$VER.tar
|
||||
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/ppc/$RPMNAME-$VER*rpm
|
||||
echo "Building $RPMROOT/RPMS/ppc/$RPMNAME-$VER-snap*.ppc.rpm $EMBEDTXT..."
|
||||
echo "Building $RPMROOT/RPMS/ppc/$RPMNAME-$VER-snap*.ppc.rpm ..."
|
||||
rpm $QUIET -ba $RPMNAME/$RPMNAME.spec
|
||||
RC=$?
|
||||
else # linux
|
||||
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..."
|
||||
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm ..."
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
|
||||
rm -f $RPMROOT/SRPMS/xCAT-server-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
|
||||
rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz
|
||||
@@ -32,10 +29,10 @@ function makenoarch {
|
||||
|
||||
|
||||
|
||||
# Make one of the following rpms: xCAT, xCATsn, xCAT-buildkit
|
||||
# Make one of the following rpms: xCAT, xCATsn
|
||||
function makexcat {
|
||||
if [ "$OSNAME" != "AIX" -a "$1" != "xCAT-buildkit" -a -z "$2" ]; then
|
||||
echo 'Usage: makerpm <RPMname> <arch> [<embedded-system>]'
|
||||
if [ "$OSNAME" != "AIX" -a -z "$2" ]; then
|
||||
echo 'Usage: makerpm <RPMname> <arch>'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -63,39 +60,29 @@ function makexcat {
|
||||
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/ppc/$RPMNAME-$VER*rpm
|
||||
cd - >/dev/null
|
||||
|
||||
echo "Building $RPMROOT/RPMS/ppc/$RPMNAME-$VER-snap*.ppc.rpm $EMBEDTXT..."
|
||||
echo "Building $RPMROOT/RPMS/ppc/$RPMNAME-$VER-snap*.ppc.rpm ..."
|
||||
rpm $QUIET -ba $RPMNAME/$RPMNAME.spec
|
||||
RC=$?
|
||||
else # linux
|
||||
ARCH="$2"
|
||||
TARGET="--target $ARCH"
|
||||
cd `dirname $0`/$RPMNAME
|
||||
|
||||
if [ "$RPMNAME" = "xCAT" ]; then
|
||||
cd `dirname $0`/$RPMNAME
|
||||
tar --exclude .svn --exclude upflag -czf $RPMROOT/SOURCES/postscripts.tar.gz postscripts LICENSE.html
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/postscripts.tar.gz postscripts LICENSE.html
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/prescripts.tar.gz prescripts
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/templates.tar.gz templates
|
||||
cp xcat.conf $RPMROOT/SOURCES
|
||||
cp xCATMN $RPMROOT/SOURCES
|
||||
cd - >/dev/null
|
||||
elif [ "$RPMNAME" = "xCATsn" ]; then
|
||||
cd `dirname $0`/$RPMNAME
|
||||
else # xCATsn
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/license.tar.gz LICENSE.html
|
||||
cp xcat.conf $RPMROOT/SOURCES
|
||||
cp xCATSN $RPMROOT/SOURCES
|
||||
cd - >/dev/null
|
||||
elif [ "$RPMNAME" = "xCAT-buildkit" ]; then
|
||||
ARCH="noarch"
|
||||
TARGET=""
|
||||
tar --exclude .svn --exclude xCAT-buildkit.spec -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME
|
||||
else # do not recognize rpm
|
||||
echo "Unrecognized rpm: $RPMNAME"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
cd - >/dev/null
|
||||
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER*rpm
|
||||
echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..."
|
||||
rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET
|
||||
echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm ..."
|
||||
rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec --target $ARCH
|
||||
RC=$?
|
||||
fi
|
||||
}
|
||||
@@ -105,7 +92,7 @@ function makexcat {
|
||||
# Make the xCAT-nbroot-core rpm
|
||||
function makenbroot {
|
||||
if [ -z "$2" ]; then
|
||||
echo 'Usage: makerpm xCAT-nbroot-core <arch> [<embedded-system>]'
|
||||
echo 'Usage: makerpm xCAT-nbroot-core <arch>'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -119,15 +106,15 @@ function makenbroot {
|
||||
cp $SPEC.spec $RPMROOT/SOURCES
|
||||
cd - >/dev/null
|
||||
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
|
||||
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..."
|
||||
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm ..."
|
||||
rpmbuild $QUIET -ba $DIR/$SPEC.spec --target $ARCH
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Make the xCAT-genesis rpm
|
||||
# Make the xCAT-nbroot-core rpm
|
||||
function makegenesis {
|
||||
DIR="xCAT-genesis-builder"
|
||||
DIR="xCAT-nbroot2"
|
||||
RPMNAME="$1"
|
||||
cd `dirname $0`/$DIR
|
||||
tar --exclude .svn -cjf $RPMROOT/SOURCES/$RPMNAME.tar.bz2 .
|
||||
@@ -135,45 +122,16 @@ function makegenesis {
|
||||
cp $RPMNAME.spec $RPMROOT/SOURCES
|
||||
cd - >/dev/null
|
||||
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
|
||||
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..."
|
||||
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm ..."
|
||||
rpmbuild $QUIET -ba $DIR/$RPMNAME.spec
|
||||
}
|
||||
function makegenesisscripts {
|
||||
DIR="xCAT-genesis-scripts"
|
||||
if [ -z "$2" ]; then
|
||||
echo 'Usage: makerpm xCAT-genesis-scripts <arch> [<embedded-system>]'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RPMNAME="$1"
|
||||
ARCH="$2"
|
||||
TARGET="--target $ARCH"
|
||||
cd `dirname $0`/
|
||||
tar --exclude .svn -cjf $RPMROOT/SOURCES/$RPMNAME.tar.bz2 $DIR
|
||||
cp $DIR/LICENSE.html $RPMROOT/BUILD
|
||||
cp $DIR/$RPMNAME.spec $RPMROOT/SOURCES
|
||||
cd - >/dev/null
|
||||
rm -f $RPMROOT/SRPMS/$RPMNAME-$ARCH-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER*rpm
|
||||
echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER-snap*.noarch.rpm $EMBEDTXT..."
|
||||
rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET
|
||||
}
|
||||
|
||||
|
||||
# Export the name of the embedded system we are building for
|
||||
function exportEmbed {
|
||||
if [ -n "$1" ]; then
|
||||
export "$1=1"
|
||||
EMBEDTXT="for $1 "
|
||||
else
|
||||
EMBEDTXT=""
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Main code....
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo 'Usage: makerpm <RPMname> [<arch>] [<embedded-system>]'
|
||||
echo 'Usage: makerpm <RPMname> [<arch>]'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -201,21 +159,14 @@ else # linux
|
||||
fi
|
||||
|
||||
|
||||
if [ "$1" = "xCAT" -o "$1" = "xCATsn" -o "$1" = "xCAT-buildkit" ]; then
|
||||
exportEmbed $3
|
||||
makexcat $1 $2
|
||||
if [ "$1" = "xCAT" -o "$1" = "xCATsn" ]; then
|
||||
makexcat $*
|
||||
elif [ "$1" = "xCAT-nbroot" -o "$1" = "xCAT-nbroot-core" ]; then
|
||||
exportEmbed $3
|
||||
makenbroot xCAT-nbroot-core $2
|
||||
elif [ "$1" = "xCAT-genesis-builder" ]; then
|
||||
exportEmbed $2
|
||||
makegenesis $1
|
||||
elif [ "$1" = "xCAT-genesis-scripts" ]; then
|
||||
exportEmbed $3
|
||||
makegenesisscripts $1 $2
|
||||
makegenesis $*
|
||||
else # must be one of the noarch rpms
|
||||
exportEmbed $2
|
||||
makenoarch $1
|
||||
makenoarch $*
|
||||
fi
|
||||
|
||||
exit $RC
|
||||
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
OSNAME=$(uname)
|
||||
VER=`cat Version`
|
||||
|
||||
if [ "$OSNAME" = "AIX" ]
|
||||
then
|
||||
|
||||
#echo '.svn' > /tmp/xcat-excludes
|
||||
#tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/xCAT-server-$VER.tar xCAT-server
|
||||
#gzip -f /opt/freeware/src/packages/SOURCES/xCAT-server-$VER.tar
|
||||
#cd ./xCAT-server
|
||||
#rm -f /opt/freeware/src/packages/SRPMS/xCAT-server-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER*rpm
|
||||
#rpm -ba xCAT-server.spec
|
||||
#rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER*rpm
|
||||
|
||||
source=/opt/freeware/src/packages
|
||||
echo '.svn' > /tmp/xcat-excludes
|
||||
tar -X /tmp/xcat-excludes -cf $source/SOURCES/xCAT-server-$VER.tar xCAT-server
|
||||
gzip -f $source/SOURCES/xCAT-server-$VER.tar
|
||||
rm -f $source/SRPMS/xCAT-server-$VER*rpm $source/RPMS/ppc/xCAT-server-$VER*rpm
|
||||
rpm -ba xCAT-server/xCAT-server.spec
|
||||
#rpm -ta $source/SOURCES/xCAT-server-$VER.tar.gz
|
||||
|
||||
else
|
||||
|
||||
rpmbuild --version > /dev/null
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "Error: Is rpmbuild installed and working?"
|
||||
exit 1
|
||||
fi
|
||||
RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec`
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "Could not determine rpmbuild's root"
|
||||
exit 1
|
||||
fi
|
||||
echo "The location for rpm building is ${RPMROOT}"
|
||||
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/xCAT-server-$VER.tar.gz xCAT-server
|
||||
rm -f $RPMROOT/SRPMS/xCAT-server-$VER*rpm $RPMROOT/RPMS/noarch/xCAT-server-$VER*rpm
|
||||
rpmbuild -ta $RPMROOT/SOURCES/xCAT-server-$VER.tar.gz
|
||||
#rpm -Uvh $RPMROOT/RPMS/noarch/xCAT-server-$VER*rpm
|
||||
|
||||
fi
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
OSNAME=$(uname)
|
||||
VER=`cat Version`
|
||||
|
||||
if [ "$OSNAME" = "AIX" ]
|
||||
then
|
||||
source=/opt/freeware/src/packages
|
||||
echo '.svn' > /tmp/xcat-excludes
|
||||
tar -X /tmp/xcat-excludes -cf $source/SOURCES/xCAT-test-$VER.tar xCAT-test
|
||||
gzip -f $source/SOURCES/xCAT-test-$VER.tar
|
||||
rm -f $source/SRPMS/xCAT-test*rpm $source/RPMS/ppc/xCAT-test*rpm
|
||||
rpm -ba xCAT-test/xCAT-test.spec
|
||||
#rpm -ta $source/SOURCES/xCAT-test-$VER.tar.gz
|
||||
else
|
||||
if [ -f /etc/redhat-release ]
|
||||
then
|
||||
pkg="redhat"
|
||||
else
|
||||
pkg="packages"
|
||||
fi
|
||||
|
||||
set -x
|
||||
tar --exclude=.svn -czhf /usr/src/$pkg/SOURCES/xCAT-test-$VER.tar.gz xCAT-test
|
||||
rm -f /usr/src/$pkg/SRPMS/xCAT-test-$VER*rpm /usr/src/$pkg/RPMS/noarch/xCAT-test-$VER*rpm
|
||||
rpmbuild -ta /usr/src/$pkg/SOURCES/xCAT-test-$VER.tar.gz
|
||||
fi
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
OSNAME=$(uname)
|
||||
VER=`cat Version`
|
||||
|
||||
if [ "$OSNAME" = "AIX" ]
|
||||
then
|
||||
#echo '.svn' > /tmp/xcat-excludes
|
||||
#tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/xCAT-UI.tar xCAT-UI
|
||||
#gzip -f /opt/freeware/src/packages/SOURCES/xCAT-UI.tar
|
||||
#cd ./xCAT-UI
|
||||
#rm -f /opt/freeware/src/packages/SRPMS/xCAT-UI*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-UI*rpm
|
||||
#rpm -ba xCAT-UI.spec
|
||||
#rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-UI*rpm
|
||||
|
||||
source=/opt/freeware/src/packages
|
||||
echo '.svn' > /tmp/xcat-excludes
|
||||
tar -X /tmp/xcat-excludes -cf $source/SOURCES/xCAT-UI-$VER.tar xCAT-UI
|
||||
gzip -f $source/SOURCES/xCAT-UI-$VER.tar
|
||||
rm -f $source/SRPMS/xCAT-UI*rpm $source/RPMS/noarch/xCAT-UI*rpm
|
||||
rpm -ba xCAT-UI/xCAT-UI.spec
|
||||
#rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-UI*rpm
|
||||
|
||||
else
|
||||
if [ -f /etc/redhat-release ]
|
||||
then
|
||||
pkg="redhat"
|
||||
else
|
||||
pkg="packages"
|
||||
fi
|
||||
|
||||
set -x
|
||||
tar --exclude=.svn -czf /usr/src/$pkg/SOURCES/xCAT-UI-$VER.tar.gz xCAT-UI
|
||||
rm -f /usr/src/$pkg/SRPMS/xCAT-UI-$VER*rpm /usr/src/$pkg/RPMS/noarch/xCAT-UI-$VER*rpm
|
||||
rpmbuild -ta /usr/src/$pkg/SOURCES/xCAT-UI-$VER.tar.gz
|
||||
#rpm -Uvh /usr/src/$pkg/RPMS/noarch/xCAT-UI-$VER*rpm
|
||||
fi
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
|
||||
OSNAME=$(uname)
|
||||
VER=`cat Version`
|
||||
|
||||
if [ "$OSNAME" = "AIX" ]
|
||||
then
|
||||
|
||||
cd `dirname $0`/xCAT
|
||||
echo '.svn' > /tmp/xcat-excludes
|
||||
echo 'upflag' >> /tmp/xcat-excludes
|
||||
|
||||
tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/postscripts.tar postscripts LICENSE.html
|
||||
gzip -f /opt/freeware/src/packages/SOURCES/postscripts.tar
|
||||
|
||||
tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/templates.tar templates
|
||||
gzip -f /opt/freeware/src/packages/SOURCES/templates.tar
|
||||
|
||||
cp xcat.conf /opt/freeware/src/packages/SOURCES
|
||||
cp xCATMN /opt/freeware/src/packages/SOURCES
|
||||
|
||||
rm -f /opt/freeware/src/packages/SRPMS/xCAT-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER*rpm
|
||||
cd -
|
||||
|
||||
rpm -ba xCAT/xCAT.spec
|
||||
#rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER*rpm
|
||||
|
||||
else
|
||||
|
||||
rpmbuild --version > /dev/null
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "Error: Is rpmbuild installed and working?"
|
||||
exit 1
|
||||
fi
|
||||
RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec`
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "Could not determine rpmbuild's root"
|
||||
exit 1
|
||||
fi
|
||||
echo "The location for rpm building is ${RPMROOT}"
|
||||
|
||||
cd `dirname $0`/xCAT
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/postscripts.tar.gz postscripts LICENSE.html
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/prescripts.tar.gz prescripts
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/templates.tar.gz templates
|
||||
cp xcat.conf $RPMROOT/SOURCES
|
||||
cp xCATMN $RPMROOT/SOURCES
|
||||
cd -
|
||||
rm -f $RPMROOT/SRPMS/xCAT-$VER*rpm $RPMROOT/RPMS/*/xCAT-$VER*rpm
|
||||
if [ ! -z "$1" ]; then
|
||||
rpmbuild -ba xCAT/xCAT.spec --target $1
|
||||
else
|
||||
rpmbuild -ba xCAT/xCAT.spec
|
||||
fi
|
||||
|
||||
fi
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
OSNAME=$(uname)
|
||||
VER=`cat Version`
|
||||
|
||||
if [ "$OSNAME" = "AIX" ]
|
||||
then
|
||||
|
||||
cd `dirname $0`/xCATsn
|
||||
echo '.svn' > /tmp/xcat-excludes
|
||||
echo 'upflag' >> /tmp/xcat-excludes
|
||||
|
||||
tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/license.tar LICENSE.html
|
||||
gzip -f /opt/freeware/src/packages/SOURCES/license.tar
|
||||
|
||||
#cp xcat.conf /opt/freeware/src/packages/SOURCES
|
||||
#cp xCATSN /usr/src/$pkg/SOURCES
|
||||
|
||||
cp xCATSN /opt/freeware/src/packages/SOURCES
|
||||
rm -f /opt/freeware/src/packages/SRPMS/xCATsn-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER*rpm
|
||||
cd -
|
||||
|
||||
rpm -ba xCATsn/xCATsn.spec
|
||||
#rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER*rpm
|
||||
|
||||
else
|
||||
|
||||
rpmbuild --version > /dev/null
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "Error: Is rpmbuild installed and working?"
|
||||
exit 1
|
||||
fi
|
||||
RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec`
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "Could not determine rpmbuild's root"
|
||||
exit 1
|
||||
fi
|
||||
echo "The location for rpm building is ${RPMROOT}"
|
||||
|
||||
cd `dirname $0`/xCATsn
|
||||
tar --exclude .svn -czf $RPMROOT/SOURCES/license.tar.gz LICENSE.html
|
||||
cp xcat.conf $RPMROOT/SOURCES
|
||||
cp xCATSN $RPMROOT/SOURCES
|
||||
rm -f $RPMROOT/SRPMS/xCATsn-$VER*rpm $RPMROOT/RPMS/*/xCATsn-$VER*rpm
|
||||
cd -
|
||||
if [ ! -z "$1" ]; then
|
||||
rpmbuild -ba xCATsn/xCATsn.spec --target $1
|
||||
else
|
||||
rpmbuild -ba xCATsn/xCATsn.spec
|
||||
fi
|
||||
|
||||
fi
|
||||
@@ -0,0 +1,194 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script packages the AIX RPM dependencies
|
||||
# - it should be run in the ../xcat/xcat-core/trunk directory
|
||||
# - it puts everything in a aix-dep-snap subdirectory
|
||||
#
|
||||
# to upload deps gz file to FRS SourceForge location
|
||||
#scp ./dep-aix-200909241259.tar.gz nott,xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/xcat-dep/2.x_AIX/
|
||||
|
||||
BLDTOP=`pwd`
|
||||
RPMDIR=$BLDTOP/aix-dep-snap
|
||||
VER=`cat $BLDTOP/Version`
|
||||
DATE=`date +"%Y%m%d%H%M"`
|
||||
#SNAP="snap$DATE"
|
||||
SNAP="$DATE"
|
||||
|
||||
if [ -d $RPMDIR ]
|
||||
then
|
||||
# clean it up
|
||||
rm -f $RPMDIR/instoss
|
||||
rm -f $RPMDIR/instmysql
|
||||
rm -f $RPMDIR/README
|
||||
rm -f $RPMDIR/*.rpm
|
||||
rm -f $RPMDIR/*.bnd
|
||||
rm -f $RPMDIR/flist
|
||||
rm -f $RPMDIR/flist2
|
||||
rm -f $RPMDIR/*.gz
|
||||
else
|
||||
mkdir -p $RPMDIR
|
||||
fi
|
||||
|
||||
cd $RPMDIR
|
||||
|
||||
# build tar.gz for default required RPMs and a second tar.gz for mysql
|
||||
|
||||
# create a simple install script
|
||||
echo "#!/bin/sh" > $RPMDIR/instoss
|
||||
echo "# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html" >> $RPMDIR/instoss
|
||||
echo "# xCAT on AIX - prerequisite install script" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-DBI-1.55-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-DBI-1.55-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/bash-3.2-1.aix5.2.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh bash-3.2-1.aix5.2.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-DBD-SQLite-1.13-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-DBD-SQLite-1.13-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/popt-1.7-2.aix5.1.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh popt-1.7-2.aix5.1.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/rsync-3.0.6-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh rsync-3.0.6-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/wget-1.9.1-1.aix5.1.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh wget-1.9.1-1.aix5.1.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/libxml2-2.6.21-4.aix5.2.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh libxml2-2.6.21-4.aix5.2.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/curl-7.19.6-1ssl.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh curl-7.19.6-1ssl.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/expat-2.0.1-2.aix5.1.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh expat-2.0.1-2.aix5.1.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/conserver-8.1.16-2.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh conserver-8.1.16-2.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-Expect-1.21-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-Expect-1.21-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-IO-Tty-1.07-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-IO-Tty-1.07-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-IO-Stty-.02-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-IO-Stty-.02-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-IO-Socket-SSL-1.06-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-IO-Socket-SSL-1.06-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-Net_SSLeay.pm-1.30-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-Net_SSLeay.pm-1.30-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-Digest-SHA1-2.11-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-Digest-SHA1-2.11-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-Digest-SHA-5.48-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-Digest-SHA-5.48-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-Digest-HMAC-1.01-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-Digest-HMAC-1.01-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-Net-DNS-0.66-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh --nodeps perl-Net-DNS-0.66-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-Net-IP-1.25-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-Net-IP-1.25-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-Digest-MD5-2.36-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-Digest-MD5-2.36-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/fping-2.4b2_to-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh fping-2.4b2_to-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/openslp-xcat-1.2.1-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh openslp-xcat-1.2.1-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-Crypt-SSLeay-0.57-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-Crypt-SSLeay-0.57-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-Net-Telnet-3.03-1.2.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-Net-Telnet-3.03-1.2.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/net-snmp-5.4.2.1-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh net-snmp-5.4.2.1-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/net-snmp-devel-5.4.2.1-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh net-snmp-devel-5.4.2.1-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/net-snmp-perl-5.4.2.1-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh net-snmp-perl-5.4.2.1-1.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/unixODBC-2.2.15-32bit.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh unixODBC-2.2.15-32bit.aix5.3.ppc.rpm" >> $RPMDIR/instoss
|
||||
|
||||
# get the OSS README file
|
||||
cp ./../../../xcat-dep/trunk/AIX/README $RPMDIR/
|
||||
|
||||
# make the default required RPM tar.gz file
|
||||
ls *.rpm > $RPMDIR/flist
|
||||
echo "README" >> $RPMDIR/flist
|
||||
echo "instoss" >> $RPMDIR/flist
|
||||
|
||||
chmod 664 $RPMDIR/*
|
||||
chmod +x $RPMDIR/instoss
|
||||
|
||||
chgrp xcat *
|
||||
chmod g+w *
|
||||
|
||||
tar -cvf $RPMDIR/dep-aix-$SNAP.tar -L $RPMDIR/flist
|
||||
gzip $RPMDIR/dep-aix-$SNAP.tar
|
||||
|
||||
# make a second tar.gz for mysql packages
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/perl-DBD-mysql-4.007-1.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-DBD-mysql-4.007-1.aix5.3.ppc.rpm" >> $RPMDIR/instmysql
|
||||
echo "perl-DBD-mysql-4.007-1.aix5.3.ppc.rpm" > $RPMDIR/flist2
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/xcat-mysql-5.1-37.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "rpm -Uvh xcat-mysql-5.1-37.aix5.3.ppc.rpm" >> $RPMDIR/instmysql
|
||||
echo "xcat-mysql-5.1-37.aix5.3.ppc.rpm" >> $RPMDIR/flist2
|
||||
|
||||
cp /opt/freeware/src/packages/RPMS/ppc/mysql-connector-odbc-3.51.27-32bit.aix5.3.ppc.rpm $RPMDIR/
|
||||
echo "mysql-connector-odbc-3.51.27-32bit.aix5.3.ppc.rpm" >> $RPMDIR/flist2
|
||||
|
||||
|
||||
chmod +x $RPMDIR/instmysql
|
||||
echo "instmysql" >> $RPMDIR/flist2
|
||||
echo "README" >> $RPMDIR/flist2
|
||||
|
||||
chgrp xcat *
|
||||
chmod g+w *
|
||||
|
||||
tar -cvf $RPMDIR/xcat-mysql-$SNAP.tar -L $RPMDIR/flist2
|
||||
gzip $RPMDIR/xcat-mysql-$SNAP.tar
|
||||
|
||||
|
||||
# create xcat-web-dep tar ball
|
||||
cp /xcat-web-dep.tar.gz $RPMDIR/
|
||||
|
||||
# get the PHP5 readme file
|
||||
#cd ./../../../xcat-dep/trunk/AIX/php5/
|
||||
#cp README $RPMDIR/web-dep.README
|
||||
# make a third tar.gz for xcat-web-dep package
|
||||
#cp *.rpm $RPMDIR/
|
||||
#ls *.rpm > $RPMDIR/flist3
|
||||
#cd $RPMDIR
|
||||
#cp /opt/freeware/src/packages/RPMS/ppc/php-5.2.6-0.aix5.3.ppc.rpm $RPMDIR/
|
||||
#echo "rpm -Uvh php-5.2.6-0.aix5.3.ppc.rpm" >> $RPMDIR/instwebdep
|
||||
#echo "php-5.2.6-0.aix5.3.ppc.rpm" >> $RPMDIR/flist3
|
||||
|
||||
#chmod +x $RPMDIR/instwebdep
|
||||
#echo "instwebdep" >> $RPMDIR/flist3
|
||||
#echo "web-dep.README" >> $RPMDIR/flist3
|
||||
#tar -cvf $RPMDIR/xcat-web-dep-$SNAP.tar -L $RPMDIR/flist3
|
||||
#gzip $RPMDIR/xcat-web-dep-$SNAP.tar
|
||||
|
||||
cd $RPMDIR
|
||||
|
||||
chgrp xcat *
|
||||
chmod g+w *
|
||||
|
||||
exit 0;
|
||||
@@ -0,0 +1,138 @@
|
||||
#!/bin/sh
|
||||
|
||||
# mkAIXsnap
|
||||
#
|
||||
# This script can be used to extract, build, tar, compress and upload
|
||||
# the latest xCAT for AIX snapshot code.
|
||||
# - this will be the latest development snapshot
|
||||
# - the snapshot should be created as needed
|
||||
# - this script should run in the ../xcat-core/trunk directory
|
||||
# (ex. /u/ntest/svn/workspace/xcat/xcat-core/trunk)
|
||||
# - you will need SourceForge ssh access set up
|
||||
# ( get the contents of .ssh/id_rsa.pub on your local machine
|
||||
# and add it to .ssh/authorized_keys on shell1.sf.net in
|
||||
# your home dir, ex. /home/users/n/no/no/nott )
|
||||
# - the tarball goes to:
|
||||
# /home/groups/x/xc/xcat/htdocs/aix/devel
|
||||
# - the individual RPMs go to:
|
||||
# /home/groups/x/xc/xcat/htdocs/aix/devel/core-snap
|
||||
# - nothing is added to the release download area
|
||||
#
|
||||
|
||||
BLDTOP=`pwd`
|
||||
RPMDIR=$BLDTOP/aix-core-snap
|
||||
VER=`cat Version`
|
||||
|
||||
# upload to SourceForge ??
|
||||
UPLOAD=0
|
||||
if [ "$1" == "UPLOAD" -o "$1" == "upload" ]; then
|
||||
UPLOAD=1
|
||||
fi
|
||||
|
||||
if [ -d $RPMDIR ]
|
||||
then
|
||||
# clean it up
|
||||
rm -f $RPMDIR/instxcat
|
||||
rm -f $RPMDIR/*.rpm
|
||||
rm -f $RPMDIR/flist
|
||||
rm -f $RPMDIR/*.gz
|
||||
else
|
||||
mkdir -p $RPMDIR
|
||||
fi
|
||||
|
||||
#
|
||||
# do an update from the trunk directory level
|
||||
#
|
||||
#svn update | tee $BLDTOP/coresvnup
|
||||
#svn update
|
||||
|
||||
# create a simple install script
|
||||
echo "# xCAT on AIX - install script" > $RPMDIR/instxcat
|
||||
|
||||
#
|
||||
# build the RPMs
|
||||
#
|
||||
./makeperlxcatrpm
|
||||
mv /opt/freeware/src/packages/RPMS/ppc/perl-xCAT-$VER-*rpm $RPMDIR/
|
||||
echo "rpm -Uvh perl-xCAT-$VER-*rpm" >> $RPMDIR/instxcat
|
||||
|
||||
./makeclientrpm
|
||||
mv /opt/freeware/src/packages/RPMS/ppc/xCAT-client-$VER-*rpm $RPMDIR/
|
||||
echo "rpm -Uvh xCAT-client-$VER-*rpm" >> $RPMDIR/instxcat
|
||||
|
||||
./makeserverrpm
|
||||
mv /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER-*rpm $RPMDIR/
|
||||
echo "rpm -Uvh --nodeps xCAT-server-$VER-*rpm" >> $RPMDIR/instxcat
|
||||
|
||||
./makexcatrpm
|
||||
mv /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER-*rpm $RPMDIR/
|
||||
echo "rpm -Uvh xCAT-$VER-*rpm" >> $RPMDIR/instxcat
|
||||
|
||||
./makexcatsnrpm
|
||||
mv /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER-*rpm $RPMDIR/
|
||||
|
||||
./makermcrpm
|
||||
mv /opt/freeware/src/packages/RPMS/ppc/xCAT-rmc-$VER-*rpm $RPMDIR/
|
||||
echo "rpm -Uvh xCAT-rmc-$VER-*rpm" >> $RPMDIR/instxcat
|
||||
|
||||
./makeuirpm
|
||||
mv /opt/freeware/src/packages/RPMS/noarch/xCAT-UI-$VER-*rpm $RPMDIR/
|
||||
#echo "rpm -Uvh xCAT-web-$VER-*rpm" >> $RPMDIR/instxcat
|
||||
|
||||
#
|
||||
# create the tar.gz file to upload
|
||||
#
|
||||
chmod +x $RPMDIR/instxcat
|
||||
|
||||
# add to flist
|
||||
echo "instxcat" > $RPMDIR/flist
|
||||
|
||||
# add the service node bundle files
|
||||
cp $BLDTOP/xCATaixSN.bnd $RPMDIR/
|
||||
cp $BLDTOP/xCATaixSN2.bnd $RPMDIR/
|
||||
cp $BLDTOP/xCATaixSSH.bnd $RPMDIR/
|
||||
cp $BLDTOP/xCATaixSSL.bnd $RPMDIR/
|
||||
echo "xCATaixSN.bnd" >> $RPMDIR/flist
|
||||
echo "xCATaixSN2.bnd" >> $RPMDIR/flist
|
||||
echo "xCATaixSSH.bnd" >> $RPMDIR/flist
|
||||
echo "xCATaixSSL.bnd" >> $RPMDIR/flist
|
||||
|
||||
cd $RPMDIR
|
||||
ls *.rpm >> flist
|
||||
|
||||
#TIME=`date +%Y%m%d%H%M`
|
||||
tar -cvf core-aix-snap.tar -L flist
|
||||
gzip core-aix-snap.tar
|
||||
|
||||
chgrp xcat *
|
||||
chmod g+w *
|
||||
|
||||
#
|
||||
# upload the tar file and RPMs to SourceForge
|
||||
#
|
||||
if [ $UPLOAD == 1 ]; then
|
||||
|
||||
# clear out the old files - do this manually with winscp session!
|
||||
#while ! rsync -urLv --delete aix-core-snap nott,xcat@web.sourceforge.net:/home/groups/x/xc/xcat/htdocs/aix/devel/
|
||||
#do : ; done
|
||||
|
||||
# devel snapshot
|
||||
scp *.rpm nott,xcat@web.sourceforge.net:/home/groups/x/xc/xcat/htdocs/aix/devel/core-snap
|
||||
scp core-aix-snap.tar.gz nott,xcat@web.sourceforge.net:/home/groups/x/xc/xcat/htdocs/aix/devel
|
||||
|
||||
# release snapshot
|
||||
|
||||
scp *.rpm nott,xcat@web.sourceforge.net:/home/groups/x/xc/xcat/htdocs/aix/2.3/core-snap
|
||||
scp core-aix-snap.tar.gz nott,xcat@web.sourceforge.net:/home/groups/x/xc/xcat/htdocs/aix/2.3
|
||||
|
||||
|
||||
# new release
|
||||
scp core-aix-2.3.tar.gz nott,xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/xcat/2.3.x_AIX/
|
||||
|
||||
|
||||
# for dep-aix & mysql etc.
|
||||
#scp ./dep-aix-2.3-200909241259.tar.gz nott,xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/xcat-dep/2.x_AIX/
|
||||
|
||||
fi
|
||||
|
||||
exit 0;
|
||||
@@ -2,7 +2,7 @@ Source: perl-xcat
|
||||
Section: libs
|
||||
Priority: extra
|
||||
Maintainer: Arif Ali <aali@ocf.co.uk>
|
||||
Build-Depends: debhelper (>= 5), libsoap-lite-perl, libdbi-perl
|
||||
Build-Depends: debhelper (>= 5), libsoap-lite-perl
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: perl-xcat
|
||||
|
||||
@@ -1,7 +1 @@
|
||||
xCAT/* /opt/xcat/lib/perl/xCAT/
|
||||
share/man/man5/* opt/xcat/share/man/man5
|
||||
share/doc/man5/* opt/xcat/share/doc/man5
|
||||
share/man/man7/* opt/xcat/share/man/man7
|
||||
share/doc/man7/* opt/xcat/share/doc/man7
|
||||
LICENSE.html opt/xcat/share/doc/packages/perl-xCAT
|
||||
README opt/xcat/
|
||||
xCAT/* usr/lib/perl5/xCAT
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/sh
|
||||
# postrm script for perl-xcat
|
||||
#
|
||||
# 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)
|
||||
if [ -x /etc/init.d/xcatd ] && [ -f "/proc/cmdline" ]; then
|
||||
. /etc/profile.d/xcat.sh
|
||||
/etc/init.d/xcatd reload
|
||||
fi
|
||||
;;
|
||||
purge|remove|failed-upgrade|abort-install|abort-upgrade|disappear)
|
||||
;;
|
||||
|
||||
*)
|
||||
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
|
||||
+3
-11
@@ -14,7 +14,7 @@ export DH_COMPAT=5
|
||||
|
||||
build:
|
||||
dh_testdir
|
||||
./modifyUtils `cat ../Version` `svn info | grep Revision | cut -d" " -f 2`
|
||||
./modifyUtils 2.5.0
|
||||
./db2man
|
||||
|
||||
clean:
|
||||
@@ -26,7 +26,7 @@ install:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installdirs
|
||||
dh_install -X".svn"
|
||||
dh_install
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
@@ -40,15 +40,7 @@ binary-arch: build install
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
# dh_installexamples
|
||||
dh_install -X".svn"
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/lib/perl/xCAT/*
|
||||
chmod 755 `pwd`/debian/perl-xcat/opt/xcat/lib/perl/xCAT/data
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/packages/perl-xCAT/*
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/README
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/man/man5/*
|
||||
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/*
|
||||
dh_install
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
1.0
|
||||
+18
-10
@@ -1,26 +1,34 @@
|
||||
#!/bin/sh
|
||||
# Put the version, svn revision #, and build date into the Version function in Version.pm
|
||||
|
||||
if [ -z "$1" ]
|
||||
if [ -z "$2" ]
|
||||
then
|
||||
echo "modifyUtils: Error: must specify the xCAT version as an argument" >&2
|
||||
echo "modifyUtils: Error: must specify the xCAT version and svn revision number as arguments" >&2
|
||||
exit
|
||||
fi
|
||||
|
||||
VER=$1
|
||||
SVNREF="svn r$2, "
|
||||
|
||||
#SVNINFO=`svn info 2>/dev/null|grep Revision`
|
||||
#/bin/echo -e $SVNINFO
|
||||
#if [ $? -ne 0 -a -f .svninfo ]; then
|
||||
# SVNINFO=`cat .svninfo 2>/dev/null|grep Revision`
|
||||
#fi
|
||||
#if [ $? -eq 0 ]
|
||||
# then
|
||||
# SVNREF="svn r"`echo $SVNINFO|awk '{print $2}'`", "
|
||||
# else
|
||||
# SVNREF=""
|
||||
# fi
|
||||
|
||||
BUILDDATE=`date`
|
||||
#echo ". '(built $BUILDDATE)'"
|
||||
#echo ". '(${SVNREF}built $BUILDDATE)'"
|
||||
|
||||
if [ "$(uname)" = "AIX" ]
|
||||
then
|
||||
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
|
||||
sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new
|
||||
mv xCAT/Version.pm.new xCAT/Version.pm
|
||||
else
|
||||
if [ -f "/etc/debian_version" ];then
|
||||
FILENAME="debian/perl-xcat/opt/xcat/lib/perl/xCAT/Version.pm"
|
||||
else
|
||||
FILENAME="xCAT/Version.pm"
|
||||
fi
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ $FILENAME
|
||||
sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}built $BUILDDATE)'"/ xCAT/Version.pm
|
||||
fi
|
||||
|
||||
+16
-35
@@ -13,8 +13,7 @@ Prefix: /opt/xcat
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
|
||||
%ifos linux
|
||||
BuildArch: noarch
|
||||
# Do not need the SOAP rpm require, because rpm will generate it automatically if hpoa.pm is included
|
||||
#Requires: perl-SOAP-Lite
|
||||
Requires: perl-SOAP-Lite
|
||||
%endif
|
||||
|
||||
Provides: perl-xCAT = %{epoch}:%{version}
|
||||
@@ -23,8 +22,7 @@ Provides: perl-xCAT = %{epoch}:%{version}
|
||||
Provides perl xCAT libraries for core functionality. Required for all xCAT installations.
|
||||
Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
|
||||
%define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi)
|
||||
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
|
||||
%define svninfo %(svn info | grep Revision | awk '{print $2}')
|
||||
|
||||
%prep
|
||||
%setup -q -n perl-xCAT
|
||||
@@ -33,15 +31,12 @@ Includes xCAT::Table, xCAT::NodeRange, among others.
|
||||
# All of the tarball source has been unpacked there and is in the same file structure
|
||||
# as it is in svn.
|
||||
|
||||
%if %fsm
|
||||
%else
|
||||
# Modify the Version() function in xCAT/Utils.pm to automatically have the correct version
|
||||
./modifyUtils %{version}
|
||||
./modifyUtils %{version} %{svninfo}
|
||||
|
||||
# Build the pod version of the man pages for each DB table. It puts them in the man5 and man7 subdirs.
|
||||
# Then convert the pods to man pages and html pages.
|
||||
./db2man
|
||||
%endif
|
||||
|
||||
%install
|
||||
# The install phase puts all of the files in the paths they should be in when the rpm is
|
||||
@@ -57,48 +52,24 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man5
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man7
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man7
|
||||
|
||||
set +x
|
||||
cp -r xCAT/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/*
|
||||
chmod 755 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/data
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/data/*
|
||||
|
||||
|
||||
# For now, don't ship these plugins on AIX, to avoid AIX dependency error.
|
||||
# For now, don't ship these plugins - to avoid AIX dependency error.
|
||||
%ifnos linux
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/hpoa.pm
|
||||
%endif
|
||||
|
||||
# Don't ship these on zVM, to reduce dependencies
|
||||
%if %zvm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/hpoa.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/vboxService.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/FSP*.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/PPC*.pm
|
||||
# have to put PPCdb.pm back because it is needed by Postage.pm
|
||||
cp xCAT/PPCdb.pm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/PPCdb.pm
|
||||
%endif
|
||||
# Don't ship these on FSM, to reduce dependencies
|
||||
%if %fsm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/hpoa.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/vboxService.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/FSP*.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/RemoteShellExp.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/LparNetbootExp.pm
|
||||
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/PPC*.pm
|
||||
# have to put PPCdb.pm back because it is needed by Postage.pm
|
||||
cp xCAT/PPCdb.pm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/PPCdb.pm
|
||||
%endif
|
||||
|
||||
cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/perl-xCAT
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/perl-xCAT/*
|
||||
|
||||
cp README $RPM_BUILD_ROOT/%{prefix}
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/README
|
||||
|
||||
%if %fsm
|
||||
%else
|
||||
# These were built dynamically in the build phase
|
||||
cp share/man/man5/* $RPM_BUILD_ROOT/%{prefix}/share/man/man5
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/man/man5/*
|
||||
@@ -108,7 +79,7 @@ cp share/man/man7/* $RPM_BUILD_ROOT/%{prefix}/share/man/man7
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/man/man7/*
|
||||
cp share/doc/man7/* $RPM_BUILD_ROOT/%{prefix}/share/doc/man7
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/man7/*
|
||||
%endif
|
||||
set -x
|
||||
|
||||
%clean
|
||||
# This step does not happen until *after* the %files packaging below
|
||||
@@ -140,8 +111,18 @@ fi
|
||||
if [ "$1" -gt 1 ]; then #Ugrade only, restart daemon and migrate settings
|
||||
if [ -x /etc/init.d/xcatd ] && [ -f "/proc/cmdline" ]; then
|
||||
. /etc/profile.d/xcat.sh
|
||||
/etc/init.d/xcatd reload
|
||||
fi
|
||||
fi
|
||||
%else
|
||||
if [ "$1" -gt 1 ]; then #Ugrade only, restart daemon and migrate settings
|
||||
if [ -n "$INUCLIENTS" ] && [ $INUCLIENTS -eq 1 ]; then
|
||||
#Do nothing in not running system
|
||||
echo "Do not restartxcatd in not running system"
|
||||
else
|
||||
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/restartxcatd -r
|
||||
fi
|
||||
fi
|
||||
%endif
|
||||
exit 0
|
||||
|
||||
|
||||
@@ -1,826 +0,0 @@
|
||||
# IBM(c) 2012 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
package xCAT::CFMUtils;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Path;
|
||||
use File::Copy;
|
||||
use File::Find;
|
||||
use Getopt::Long;
|
||||
use Data::Dumper;
|
||||
use File::Basename;
|
||||
use xCAT::Table;
|
||||
use xCAT::Utils;
|
||||
use xCAT::MsgUtils;
|
||||
1;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 initCFMdir
|
||||
Initialize CFM directories and files. The default layout under cfmdir is:
|
||||
.
|
||||
|-- etc
|
||||
| |-- group.merge -> /etc/group.merge
|
||||
| |-- hosts -> /etc/hosts
|
||||
| |-- passwd.merge -> /etc/passwd.merge
|
||||
| |-- shadow.merge -> /etc/shadow.merge
|
||||
|-- group.OS -> /etc/group.OS
|
||||
|-- passwd.OS -> /etc/passwd.OS
|
||||
|-- shadow.OS -> /etc/shadow.OS
|
||||
Note: the *.OS files are the backups for the original /etc/passwd, shadow, group files
|
||||
|
||||
Arguments:
|
||||
$cfmdir
|
||||
Returns:
|
||||
0 - initialize successfully
|
||||
1 - initialize failed
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
xCAT::CFMUtils->initCFMdir($cfmdir);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub initCFMdir
|
||||
{
|
||||
my ($class, $cfmdir) = @_;
|
||||
|
||||
# below system files will be synced to all compute nodes
|
||||
my @sysfiles = ("/etc/hosts");
|
||||
|
||||
# the /etc/passwd, shadow, group files will be merged
|
||||
my @userfiles = ("/etc/passwd", "/etc/shadow", "/etc/group");
|
||||
|
||||
# create the cfmdir
|
||||
if (! -d $cfmdir)
|
||||
{
|
||||
mkpath $cfmdir;
|
||||
}
|
||||
|
||||
# backup the OS files and create links under cfmdir
|
||||
foreach my $file (@userfiles)
|
||||
{
|
||||
my $backup = $file.".OS";
|
||||
if (! -e $backup)
|
||||
{
|
||||
copy($file, $backup);
|
||||
}
|
||||
|
||||
if (! -e "$cfmdir/".basename($backup))
|
||||
{
|
||||
symlink($backup, "$cfmdir/".basename($backup));
|
||||
}
|
||||
}
|
||||
|
||||
# Initialize CFM directory and related files
|
||||
if (! -d "$cfmdir/etc")
|
||||
{
|
||||
mkpath "$cfmdir/etc";
|
||||
}
|
||||
|
||||
# link the system files
|
||||
foreach my $file (@sysfiles)
|
||||
{
|
||||
symlink($file, "$cfmdir/$file");
|
||||
}
|
||||
# touch and link the merge files for /etc/passwd, shadow, group
|
||||
foreach my $file (@userfiles)
|
||||
{
|
||||
my $merge = $file.".merge";
|
||||
if (! -e "$merge")
|
||||
{
|
||||
xCAT::Utils->runcmd("touch $merge", -1);
|
||||
}
|
||||
|
||||
if (! -e "$cfmdir/$merge")
|
||||
{
|
||||
symlink($merge, "$cfmdir/$merge");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 updateUserInfo
|
||||
Update the /etc/passwd, shadow, group merge files under specified CFM directory
|
||||
|
||||
Arguments:
|
||||
$cfmdir - CFM directory for osimage
|
||||
Returns:
|
||||
0 - update successfully
|
||||
1 - update failed
|
||||
Globals:
|
||||
$::CALLBACK
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $ret = xCAT::CFMUtils->updateUserInfo($cfmdir);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub updateUserInfo {
|
||||
my ($class, $cfmdir) = @_;
|
||||
|
||||
my @userfiles = ("/etc/passwd", "/etc/shadow", "/etc/group");
|
||||
|
||||
my @osfiles = glob("$cfmdir/*.OS");
|
||||
if (!@osfiles)
|
||||
{
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Skiping the update of the /etc/passwd, shadow, group merge files under the CFM directory.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
foreach my $file (@userfiles)
|
||||
{
|
||||
my @oldrecords = ();
|
||||
my @newrecords = ();
|
||||
my $backup = basename($file).".OS";
|
||||
|
||||
# get the records from /etc/passwd, shadow, group file and backup files(.OS files)
|
||||
# and all the files from /install/osimages/$imgname/cfmdir directory
|
||||
foreach my $userinfo ($file, "$cfmdir/$backup")
|
||||
{
|
||||
my $fp;
|
||||
open($fp, $userinfo);
|
||||
my @records = ();
|
||||
while (<$fp>)
|
||||
{
|
||||
my $line = xCAT::CFMUtils->trim($_);
|
||||
if (($line =~ /^#/) || ($line =~ /^\s*$/ ))
|
||||
{ #comment line or blank line
|
||||
next;
|
||||
} else
|
||||
{
|
||||
push @records, $line;
|
||||
}
|
||||
}
|
||||
close($fp);
|
||||
|
||||
# check the records from /etc/passwd, shadow, group file or backup
|
||||
if ($userinfo =~ /^\/etc/ )
|
||||
{
|
||||
@newrecords = @records;
|
||||
} else {
|
||||
@oldrecords = @records;
|
||||
}
|
||||
}
|
||||
|
||||
# update the merge file
|
||||
my $mergefile = $cfmdir."/".$file.".merge";
|
||||
my @diff = xCAT::CFMUtils->arrayops("D", \@newrecords, \@oldrecords);
|
||||
# output the diff to merge files
|
||||
my $fp;
|
||||
open($fp, '>', $mergefile);
|
||||
if (@diff)
|
||||
{
|
||||
for my $record (@diff)
|
||||
{
|
||||
print $fp "$record\n";
|
||||
}
|
||||
}
|
||||
close ($fp);
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
=head3 setCFMSynclistFile
|
||||
Set osimage synclists attribute for CFM function, the CMF synclist file is:
|
||||
/install/osimages/<imagename>/synclist.cfm
|
||||
|
||||
Arguments:
|
||||
$imagename - the specified osimage name
|
||||
Returns:
|
||||
It returns the cfmdir path if it is defined for an osimage object
|
||||
Globals:
|
||||
$::CALLBACK
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $cfmdir = xCAT::CFMUtils->setCFMSynclistFile($imagename);
|
||||
if ($cfmdir) { # update the CFM synclist file }
|
||||
=cut
|
||||
#-----------------------------------------------------------------------------
|
||||
sub setCFMSynclistFile {
|
||||
my ($class, $img) = @_;
|
||||
|
||||
my $cfmdir;
|
||||
my $synclists;
|
||||
my $cfmsynclist = "/install/osimages/$img/synclist.cfm";
|
||||
|
||||
# get the cfmdir and synclists attributes
|
||||
my $osimage_t = xCAT::Table->new('osimage');
|
||||
my $records = $osimage_t->getAttribs({imagename=>$img}, 'cfmdir', 'synclists');
|
||||
if ($records)
|
||||
{
|
||||
if ($records->{'cfmdir'}) {$cfmdir = $records->{'cfmdir'}}
|
||||
if ($records->{'synclists'}) {$synclists = $records->{'synclists'}}
|
||||
} else {
|
||||
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;
|
||||
my $index = 0;
|
||||
if ($synclists)
|
||||
{
|
||||
# the synclists is a comma separated list
|
||||
my @lists = split(/,/, $synclists);
|
||||
foreach my $synclist (@lists)
|
||||
{
|
||||
# find the synclist configuration for CFM
|
||||
if ($synclist eq $cfmsynclist)
|
||||
{
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
$index += 1;
|
||||
}
|
||||
if ($found == 0)
|
||||
{
|
||||
# the CFM synclist is not defined, append it to $synclists
|
||||
$synclists = "$synclists,$cfmsynclist";
|
||||
# set the synclists attribute
|
||||
$osimage_t->setAttribs({imagename=>$img}, {'synclists' => $synclists});
|
||||
}
|
||||
} else {
|
||||
# no synclists defined, set it to CFM synclist file
|
||||
if ($cfmdir) { $synclists = $cfmsynclist; }
|
||||
$osimage_t->setAttribs({imagename=>$img}, {'synclists' => $synclists});
|
||||
}
|
||||
|
||||
return $cfmdir;
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 updateCFMSynclistFile
|
||||
Update the synclist file(/install/osimages/<imagename>/synclist.cfm) for CFM function.
|
||||
It will recursively scan the files under cfmdir directory and then add them to CFM synclist file.
|
||||
Note:
|
||||
The files with suffix ".append" will be appended to the dest file(records in "APPEND:" section).
|
||||
The files with suffix ".merge" will be merged to the dest file(records in "MERGE:" section).
|
||||
|
||||
In addition, it will reserve the user specified records in the synclist file. The example synclist file:
|
||||
<cfmdir>/etc/hosts -> /etc/hosts
|
||||
/root/install.log -> /tmp/install.log
|
||||
...
|
||||
|
||||
APPEND:
|
||||
<cfmdir>/etc/hosts.append -> /etc/hosts
|
||||
/root/install.log.syslog -> /tmp/install.log
|
||||
...
|
||||
EXECUTE:
|
||||
...
|
||||
EXECUTEALWAYS:
|
||||
...
|
||||
MERGE:
|
||||
<cfmdir>/etc/group.merge -> /etc/group
|
||||
<cfmdir>/etc/shadow.merge -> /etc/shadow
|
||||
<cfmdir>/etc/passwd.merge -> /etc/passwd
|
||||
|
||||
Arguments:
|
||||
\@imagenames - reference to the osimage names array
|
||||
Returns:
|
||||
0 - update successfully
|
||||
1 - update failed
|
||||
Globals:
|
||||
$::CALLBACK
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $ret = CAT::CFMUtils->updateCFMSynclistFile(\@imagenames);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub updateCFMSynclistFile {
|
||||
my ($class, $imgs) = @_;
|
||||
|
||||
my @osimgs = @$imgs;
|
||||
if (!@osimgs)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "No osimage names specified to process.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
foreach my $osimg (@osimgs)
|
||||
{
|
||||
my $cfmdir;
|
||||
$cfmdir = xCAT::CFMUtils->setCFMSynclistFile($osimg);
|
||||
if ($cfmdir) # check for /install/osiamges/$osimg/cfmdir
|
||||
{
|
||||
my $cfmsynclist = "/install/osimages/$osimg/synclist.cfm";
|
||||
if (! -d $cfmdir)
|
||||
{
|
||||
# skip this one go on to the next image, nothing to do for
|
||||
# CFMUtils in this image
|
||||
next;
|
||||
}
|
||||
# create the parent directory of CFM synclist file
|
||||
if (! -d dirname($cfmsynclist))
|
||||
{
|
||||
mkpath dirname($cfmsynclist);
|
||||
}
|
||||
|
||||
# update /etc/passwd, shadow, group merge files
|
||||
my $ret = xCAT::CFMUtils->updateUserInfo($cfmdir);
|
||||
if ($ret !=0 )
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Update /etc/passwd, shadow, group merge files failed.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# recursively list the files under cfm directory
|
||||
my @files = ();
|
||||
find ( sub { push @files, $File::Find::name if (! -d) }, $cfmdir);
|
||||
if (!@files) # not files under cfm directory, skip to next loop
|
||||
{
|
||||
next;
|
||||
}
|
||||
|
||||
my $fp;
|
||||
open($fp, '>', $cfmsynclist);
|
||||
my @mergefiles = ();
|
||||
my @appendfiles = ();
|
||||
foreach my $file (@files)
|
||||
{
|
||||
my $name = basename($file);
|
||||
#TODO: find a better way to get the suffix
|
||||
my $suffix = ($name =~ m/([^.]+)$/)[0];
|
||||
my $dest = substr($file, length($cfmdir));
|
||||
if ($suffix eq "OS") # skip the backup files
|
||||
{
|
||||
next;
|
||||
} elsif ($suffix eq "merge") # merge file
|
||||
{
|
||||
push(@mergefiles, $file);
|
||||
} elsif ($suffix eq "append") { # append file
|
||||
push(@appendfiles, $file);
|
||||
} else { # output the syncing files maintained by CFM
|
||||
print $fp "$file -> $dest\n";
|
||||
}
|
||||
}
|
||||
|
||||
# output the APPEND records maintained by CFM
|
||||
if (@appendfiles) {
|
||||
print $fp "APPEND:\n";
|
||||
}
|
||||
foreach my $file (@appendfiles)
|
||||
{
|
||||
my $dest = substr($file, length($cfmdir), length($file) - length(".append") - length($cfmdir));
|
||||
print $fp "$file -> $dest\n";
|
||||
}
|
||||
|
||||
# output the MERGE records maintained by CFM
|
||||
if (@mergefiles) {
|
||||
print $fp "MERGE:\n";
|
||||
}
|
||||
foreach my $file (@mergefiles)
|
||||
{
|
||||
my @userfiles = ("/etc/passwd", "/etc/shadow", "/etc/group");
|
||||
my $dest = substr($file, length($cfmdir), length($file) - length(".merge") - length($cfmdir));
|
||||
# only /etc/passwd, /etc/shadow, /etc/groups merging is supported
|
||||
if (grep(/$dest/, @userfiles)) {
|
||||
print $fp "$file -> $dest\n";
|
||||
}
|
||||
}
|
||||
|
||||
# close the file
|
||||
close($fp);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
=head3 setCFMPkglistFile
|
||||
Set the pkglist attribute of linuximage object for CFM function
|
||||
|
||||
Arguments:
|
||||
$imagename - the specified linuximage name
|
||||
Returns:
|
||||
0 - update successfully
|
||||
1 - update failed
|
||||
Globals:
|
||||
$::CALLBACK
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $ret = xCAT::CFMUtils->setCFMPkglistFile($imagename);
|
||||
=cut
|
||||
#-----------------------------------------------------------------------------
|
||||
sub setCFMPkglistFile {
|
||||
my ($class, $img) = @_;
|
||||
|
||||
my $pkglists = "";
|
||||
my $cfmpkglist = "/install/osimages/$img/pkglist.cfm";
|
||||
|
||||
# get the pkglist files
|
||||
my $linuximage_t = xCAT::Table->new('linuximage');
|
||||
my $records = $linuximage_t->getAttribs({imagename => $img}, 'pkglist');
|
||||
if ($records)
|
||||
{
|
||||
if ($records->{'pkglist'}) { $pkglists = $records->{'pkglist'}; }
|
||||
} else
|
||||
{
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "There are no records for pkglist attribute in the linuximage:$img. There is nothing to process.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
}
|
||||
}
|
||||
|
||||
my $found = 0;
|
||||
if ($pkglists)
|
||||
{
|
||||
foreach my $pkglist (split(/,/, $pkglists))
|
||||
{
|
||||
if ($pkglist eq $cfmpkglist) # the pkglist file for CFM is found, exit the loop
|
||||
{
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
# the pkglist file for CFM is not found, append it to $pkglits
|
||||
if (!$found)
|
||||
{
|
||||
$pkglists = "$pkglists,$cfmpkglist";
|
||||
# set the pkglist attribute for linuximage
|
||||
$linuximage_t->setAttribs({imagename => $img}, {'pkglist' => $pkglists});
|
||||
}
|
||||
} else
|
||||
{
|
||||
# the pkglist file for linuximage is not defined, set it to $cfmpkglist
|
||||
$pkglists = $cfmpkglist;
|
||||
$linuximage_t->setAttribs({imagename => $img}, {'pkglist' => $pkglists});
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 updateCFMPkglistFile
|
||||
Update the ospkglist file
|
||||
|
||||
Arguments:
|
||||
$imagename - the specified linuximage name
|
||||
@curospkgs - the currently selected OS packages list
|
||||
Returns:
|
||||
0 - update successfully
|
||||
1 - update failed
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $ret = CAT::CFMUtils->updateCFMPkglistFile($imagename, @cur_selected_pkgs);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub updateCFMPkglistFile {
|
||||
my ($class, $img, $ospkgs) = @_;
|
||||
|
||||
my @cur_selected = @$ospkgs;
|
||||
my $cfmpkglist = "/install/osimages/$img/pkglist.cfm";
|
||||
|
||||
my $ret = xCAT::CFMUtils->setCFMPkglistFile($img);
|
||||
if ($ret)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "Set pkglist attribute for CFM failed.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# check the parent directory of cfmpkglist file
|
||||
if (! -d dirname($cfmpkglist))
|
||||
{
|
||||
mkpath dirname($cfmpkglist);
|
||||
}
|
||||
|
||||
# get previous selected and removed OS packages list from pkglist file
|
||||
my ($pre_selected_ref, $pre_removed_ref) = xCAT::CFMUtils->getPreOSpkgsList($cfmpkglist);
|
||||
my @pre_selected = @$pre_selected_ref;
|
||||
my @pre_removed = @$pre_removed_ref;
|
||||
|
||||
# get the #INCLUDE file from cfmpkglist file
|
||||
my @incfiles = xCAT::CFMUtils->getIncludefiles($cfmpkglist);
|
||||
# get the packages list in the #INCLUDE files
|
||||
my @basepkgs = ();
|
||||
foreach my $inc (@incfiles)
|
||||
{
|
||||
my ($selected_ref, $removed_ref) = xCAT::CFMUtils->getPreOSpkgsList($inc);
|
||||
my @selected = @$selected_ref;
|
||||
@basepkgs = xCAT::CFMUtils->arrayops("U", \@basepkgs, \@selected);
|
||||
}
|
||||
|
||||
# get diff between previous and current selected OS packages lists
|
||||
my @diff = xCAT::CFMUtils->getPkgsDiff(\@pre_selected, \@cur_selected);
|
||||
|
||||
# merge the diff to previous removed OS packages list
|
||||
my @all_removed = xCAT::CFMUtils->arrayops("U", \@pre_removed, \@diff);
|
||||
|
||||
# get the rollbacked OS packages list, the packages are existing in both removed and selected lists
|
||||
# if so, we should remove the rollbacked OS packages from removed list
|
||||
my @rollback = xCAT::CFMUtils->arrayops("I", \@all_removed, \@cur_selected);
|
||||
my @cur_removed = xCAT::CFMUtils->arrayops("D", \@all_removed, \@rollback);
|
||||
|
||||
# remove the BASE packages from selected pakages
|
||||
@basepkgs = xCAT::CFMUtils->arrayops("I", \@basepkgs, \@cur_selected);
|
||||
@cur_selected = xCAT::CFMUtils->arrayops("D", \@cur_selected, \@basepkgs);
|
||||
|
||||
# update the pkglist file
|
||||
my $fp;
|
||||
open($fp, '>', $cfmpkglist);
|
||||
foreach my $inc (@incfiles)
|
||||
{
|
||||
print $fp "#INCLUDE:$inc#\n";
|
||||
}
|
||||
# the pacakges be installed
|
||||
if (@cur_selected)
|
||||
{
|
||||
foreach my $pkg (@cur_selected)
|
||||
{
|
||||
print $fp "$pkg\n";
|
||||
}
|
||||
}
|
||||
# the packages be removed
|
||||
if (@cur_removed)
|
||||
{
|
||||
foreach my $pkg (@cur_removed)
|
||||
{
|
||||
print $fp "-$pkg\n";
|
||||
}
|
||||
}
|
||||
# close the file
|
||||
close($fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getPreOSpkgsList
|
||||
Get previously selected and removed OS packages lists from pkglist file
|
||||
|
||||
Arguments:
|
||||
$ospkglist - the path for ospkglist file
|
||||
Returns:
|
||||
refs for selected and removed OS packages arrays
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my ($pre_selected_ref, $pre_removed_ref) = xCAT::CFMUtils->getPreOSpkgsList($ospkglist);
|
||||
my @pre_selected = @$pre_selected_ref;
|
||||
my @pre_removed = @$pre_removed_ref;
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getPreOSpkgsList {
|
||||
my ($class, $pkglist) = @_;
|
||||
my @selected = ();
|
||||
my @removed = ();
|
||||
my @pkglistfiles = ();
|
||||
|
||||
# get the #INCLUDE file from cfmpkglist file
|
||||
my @incfiles = xCAT::CFMUtils->getIncludefiles($pkglist);
|
||||
foreach my $inc (@incfiles)
|
||||
{
|
||||
push @pkglistfiles, $inc;
|
||||
}
|
||||
# assume the #INCLUDE file includes the BASE packages
|
||||
push @pkglistfiles, $pkglist;
|
||||
|
||||
foreach my $file (@pkglistfiles)
|
||||
{
|
||||
my $pkglistfp;
|
||||
open($pkglistfp, xCAT::CFMUtils->trim($file));
|
||||
while (<$pkglistfp>)
|
||||
{
|
||||
my $line = xCAT::CFMUtils->trim($_);
|
||||
if (($line =~ /^#/) || ($line =~ /^\s*$/ ) || ($line =~ /^@/))
|
||||
{ #comment line or blank line
|
||||
next;
|
||||
} else
|
||||
{
|
||||
if ($line =~ /^-/)
|
||||
{ # the package be removed
|
||||
push @removed, substr($line, 1);
|
||||
} else
|
||||
{ # the package be installed
|
||||
push @selected, $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
close($pkglistfp);
|
||||
}
|
||||
|
||||
# delete the removed packages from selected list
|
||||
my @intersection = xCAT::CFMUtils->arrayops("I", \@removed, \@selected);
|
||||
@selected = xCAT::CFMUtils->arrayops("D", \@selected, \@intersection);
|
||||
|
||||
return (\@selected, \@removed);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getPkgsDiff
|
||||
Get the differences between previous and current packages list
|
||||
|
||||
Arguments:
|
||||
@pre - previous selected packages list
|
||||
@cur - current selected packages list
|
||||
Returns:
|
||||
@diff - the differencen list
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my @diff = xCAT::CFMUtils->getPkgsDiff(\@pre_selected, \@cur_selected);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getPkgsDiff {
|
||||
my ($class, $pre, $cur) = @_;
|
||||
|
||||
# get the intersection firstly
|
||||
my @tmp = xCAT::CFMUtils->arrayops("I", \@$pre, \@$cur);
|
||||
|
||||
# get the difference
|
||||
my @diff = xCAT::CFMUtils->arrayops("D", \@$pre, \@tmp);
|
||||
#print Dumper(@diff);
|
||||
|
||||
return @diff;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getIncludefiles
|
||||
Get the #INCLUDE files from the given file
|
||||
|
||||
Arguments:
|
||||
$file - the given file
|
||||
Returns:
|
||||
@files - the #INCLUDE files list
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my @diff = xCAT::CFMUtils->getIncludefiles($file);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getIncludefiles {
|
||||
my ($class, $file) = @_;
|
||||
my @files = ();
|
||||
|
||||
my $fp;
|
||||
open($fp, $file);
|
||||
while (<$fp>)
|
||||
{
|
||||
my $line = xCAT::CFMUtils->trim($_);
|
||||
if ($line =~ /^\s*$/)
|
||||
{ # blank line
|
||||
next;
|
||||
}
|
||||
# find the #INCLUDE line
|
||||
if ($line =~ /^\s*#INCLUDE:[^#^\n]+#/)
|
||||
{
|
||||
#print "The line is: [$line]\n";
|
||||
my $incfile = substr($line, length("#INCLUDE:"), length($line)-length("#INCLUDE:")-1);
|
||||
push @files, $incfile;
|
||||
}
|
||||
}
|
||||
close($fp);
|
||||
|
||||
return @files;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 trim
|
||||
Strip left and right whitspaces for a string
|
||||
|
||||
Arguments:
|
||||
$string
|
||||
Returns:
|
||||
@string
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my @new_string = xCAT::CFMUtils->trim($string);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub trim {
|
||||
my ($class, $string) = @_;
|
||||
|
||||
# trim the left whitespaces
|
||||
$string =~ s/^\s*//;
|
||||
|
||||
# trim the right whitespaces
|
||||
$string =~ s/\s*$//;
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
# Function: compute Union, Intersection or Difference of unique lists
|
||||
# Usage: arrayops ("U"/"I"/"D", @a, @b)
|
||||
# Return: @union/@intersection/@difference
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 arrayops
|
||||
Compute Union/Intersection/Difference for 2 unique lists
|
||||
|
||||
Arguments:
|
||||
$flag - "U"/"I"/"D"
|
||||
\@array1 - reference to an arrary
|
||||
\@array2 - reference to an arrary
|
||||
Returns:
|
||||
@union/@intersection/@difference
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my @array = xCAT::CFMUtils->arrayops(\@array1, \@array2);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub arrayops {
|
||||
my ($class, $ops, $array1, $array2) = @_;
|
||||
|
||||
my @union = ();
|
||||
my @intersection = ();
|
||||
my @difference = ();
|
||||
my %count = ();
|
||||
foreach my $element (@$array1, @$array2)
|
||||
{
|
||||
$count{$element}++
|
||||
}
|
||||
|
||||
foreach my $element (keys %count) {
|
||||
push @union, $element;
|
||||
push @{ $count{$element} > 1 ? \@intersection : \@difference }, $element;
|
||||
}
|
||||
|
||||
if ($ops eq "U") { return @union; }
|
||||
|
||||
if ($ops eq "I") { return @intersection; }
|
||||
|
||||
if ($ops eq "D") { return @difference; }
|
||||
|
||||
#return (\@union, \@intersection, \@difference);
|
||||
}
|
||||
+60
-165
@@ -9,7 +9,10 @@ BEGIN
|
||||
# if AIX - make sure we include perl 5.8.2 in INC path.
|
||||
# Needed to find perl dependencies shipped in deps tarball.
|
||||
if ($^O =~ /^aix/i) {
|
||||
unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2));
|
||||
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/5.8.2";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2";
|
||||
}
|
||||
|
||||
my $inet6support;
|
||||
@@ -24,15 +27,6 @@ if ($inet6support) {
|
||||
if ($inet6support) {
|
||||
$inet6support = eval { require IO::Socket::SSL; IO::Socket::SSL->import('inet6'); 1;};
|
||||
}
|
||||
|
||||
if ($^O =~ /^linux/i) {
|
||||
# Is IPv6 enabled on the MN or xcat client node at all?
|
||||
my $ipv6enabled = `ip addr | grep inet6`;
|
||||
if (!$ipv6enabled) {
|
||||
$inet6support = 0;
|
||||
}
|
||||
}
|
||||
|
||||
unless ($inet6support) {
|
||||
eval { require Socket };
|
||||
eval { require IO::Socket::INET };
|
||||
@@ -41,9 +35,6 @@ unless ($inet6support) {
|
||||
|
||||
|
||||
use XML::Simple; #smaller than libxml....
|
||||
use Fcntl;
|
||||
use POSIX qw/:errno_h/;
|
||||
use IO::Select;
|
||||
$XML::Simple::PREFERRED_PARSER='XML::Parser';
|
||||
#require Data::Dumper;
|
||||
my $xcathost='localhost:3001';
|
||||
@@ -53,30 +44,6 @@ my $EXITCODE; # save the bitmask of all exit codes returned by calls to hand
|
||||
1;
|
||||
|
||||
|
||||
sub rspclean {
|
||||
my $response = shift;
|
||||
my $callback = shift;
|
||||
my $rsps = XMLin($response,SuppressEmpty=>undef,ForceArray=>1);
|
||||
foreach my $rsp (@{$rsps->{xcatresponse}}) {
|
||||
#add ESC back
|
||||
foreach my $key (keys %$rsp) {
|
||||
if (ref($rsp->{$key}) eq 'ARRAY') {
|
||||
foreach my $text (@{$rsp->{$key}}) {
|
||||
next unless defined $text;
|
||||
$text =~ s/xxxxESCxxxx/\e/g;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$rsp->{$key} =~ s/xxxxESCxxxx/\e/g;
|
||||
}
|
||||
}
|
||||
$callback->($rsp);
|
||||
if ($rsp->{serverdone}) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#################################
|
||||
# submit_request will take an xCAT command and pass it to the xCAT
|
||||
# server for execution.
|
||||
@@ -124,23 +91,13 @@ sub submit_request {
|
||||
unless ($certfile) { $certfile = $homedir."/.xcat/client-cred.pem"; }
|
||||
unless ($cafile) { $cafile = $homedir."/.xcat/ca.pem"; }
|
||||
$xCAT::Client::EXITCODE = 0; # clear out exit code before invoking the plugin
|
||||
if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
$request->{clienttype}->[0] = "cli"; # setup clienttype for auditlog
|
||||
}
|
||||
$request->{clienttype}->[0] = "cli"; # setup clienttype for auditlog
|
||||
# If XCATBYPASS is set, invoke the plugin process_request method directly
|
||||
# without going through the socket connection to the xcatd daemon
|
||||
if ($ENV{XCATBYPASS}) {
|
||||
#add current userid to the request
|
||||
if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
if (!(defined($request->{username}))) {
|
||||
$request->{username}->[0] = getpwuid($>);
|
||||
}
|
||||
|
||||
# only allow root to run
|
||||
unless ($request->{username}->[0] =~ /root/) {
|
||||
print ("WARNING: Only allow root to run XCATBYPASS mode, your current user ID is $request->{username}->[0].\n");
|
||||
return 0;
|
||||
}
|
||||
if (!(defined($request->{username}))) {
|
||||
$request->{username}->[0] = getpwuid($>);
|
||||
}
|
||||
# Load plugins from either specified or default dir
|
||||
require xCAT::Table;
|
||||
@@ -153,16 +110,14 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
}
|
||||
} else {
|
||||
# figure out default plugins dir
|
||||
#my $sitetab=xCAT::Table->new('site');
|
||||
#unless ($sitetab) {
|
||||
# print ("ERROR: Unable to open basic site table for configuration\n");
|
||||
#}
|
||||
my $sitetab=xCAT::Table->new('site');
|
||||
unless ($sitetab) {
|
||||
print ("ERROR: Unable to open basic site table for configuration\n");
|
||||
}
|
||||
$plugins_dir=$::XCATROOT.'/lib/perl/xCAT_plugin';
|
||||
scan_plugins();
|
||||
}
|
||||
|
||||
populate_site_hash();
|
||||
|
||||
# don't do XML transformation -- assume request is well-formed
|
||||
# my $xmlreq=XMLout($request,RootName=>xcatrequest,NoAttr=>1,KeyAttr=>[]);
|
||||
# $request = XMLin($xmlreq,SuppressEmpty=>undef,ForceArray=>1) ;
|
||||
@@ -179,19 +134,23 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
if ($ENV{XCATHOST}) {
|
||||
$xcathost=$ENV{XCATHOST};
|
||||
}
|
||||
my $pclient;
|
||||
if ($inet6support) {
|
||||
$pclient = IO::Socket::INET6->new(
|
||||
my $client;
|
||||
if (-r $keyfile and -r $certfile and -r $cafile) {
|
||||
$client = IO::Socket::SSL->new(
|
||||
PeerAddr => $xcathost,
|
||||
SSL_key_file => $keyfile,
|
||||
SSL_cert_file => $certfile,
|
||||
SSL_ca_file => $cafile,
|
||||
SSL_use_cert => 1,
|
||||
Timeout => 15,
|
||||
);
|
||||
} else {
|
||||
$pclient = IO::Socket::INET->new(
|
||||
$client = IO::Socket::SSL->new(
|
||||
PeerAddr => $xcathost,
|
||||
Timeout => 15,
|
||||
);
|
||||
}
|
||||
unless ($pclient) {
|
||||
unless ($client) {
|
||||
print "Unable to open socket connection to xcatd daemon on $xcathost.\n";
|
||||
print "Verify that the xcatd daemon is running and that your SSL setup is correct.\n";
|
||||
if ($@ =~ /SSL Timeout/) {
|
||||
@@ -200,26 +159,7 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
die "Connection failure: $@"
|
||||
}
|
||||
}
|
||||
my $client;
|
||||
if (-r $keyfile and -r $certfile and -r $cafile) {
|
||||
$client = IO::Socket::SSL->start_SSL($pclient,
|
||||
SSL_key_file => $keyfile,
|
||||
SSL_cert_file => $certfile,
|
||||
SSL_ca_file => $cafile,
|
||||
SSL_use_cert => 1,
|
||||
Timeout => 0,
|
||||
);
|
||||
} else {
|
||||
$client = IO::Socket::SSL->start_SSL($pclient,
|
||||
Timeout => 0,
|
||||
);
|
||||
}
|
||||
my $msg;
|
||||
if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
$msg=XMLout($request,RootName=>'xcatrequest',NoAttr=>1,KeyAttr=>[]);
|
||||
} else { #XML
|
||||
$msg=$request;
|
||||
}
|
||||
my $msg=XMLout($request,RootName=>'xcatrequest',NoAttr=>1,KeyAttr=>[]);
|
||||
if ($ENV{XCATXMLTRACE}) { print $msg; }
|
||||
if($ENV{XCATXMLWARNING}) {
|
||||
validateXML($msg);
|
||||
@@ -229,60 +169,39 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML
|
||||
my $response;
|
||||
my $rsp;
|
||||
my $cleanexit=0;
|
||||
my $massresponse="<massresponse>";
|
||||
my $nextcoalescetime=time()+1;
|
||||
my $coalescenow=0;
|
||||
my $flags=fcntl($client,F_GETFL,0);
|
||||
$flags |= O_NONBLOCK; #select can be a bit.. fickle, make sysread work more easily...
|
||||
fcntl($client,F_SETFL,$flags);
|
||||
my $clientsel = new IO::Select;
|
||||
$clientsel->add($client);
|
||||
my $line;
|
||||
my $newdata=0;
|
||||
while (1) {
|
||||
my $shouldexit;
|
||||
if ($newdata and ($coalescenow or time() > $nextcoalescetime)) {
|
||||
$coalescenow=0;
|
||||
$newdata=0;
|
||||
$nextcoalescetime=time()+1;
|
||||
$massresponse .= "</massresponse>";
|
||||
$shouldexit = rspclean($massresponse,$callback);
|
||||
$massresponse="<massresponse>";
|
||||
}
|
||||
|
||||
if ($shouldexit) {
|
||||
$cleanexit=1;
|
||||
last;
|
||||
}
|
||||
$line = "";
|
||||
$clientsel->can_read(0.5);
|
||||
my $readbytes;
|
||||
do { $readbytes=sysread($client,$line,65535,length($line)); } while ($readbytes);
|
||||
unless (length($line)) {
|
||||
if (not defined $readbytes and $! == EAGAIN) { next; }
|
||||
last;
|
||||
}
|
||||
$newdata=1;
|
||||
$response .= $line;
|
||||
if ($line =~ m/<\/xcatresponse>\s*\z/) {
|
||||
if ($line =~ /serverdone/) { $coalescenow=1; } #if serverdone was detected, hint at coalesce code to flush things out now
|
||||
#this means that coalesce can be triggered by stray words in the output prematurely, but that's harmless
|
||||
while (<$client>) {
|
||||
$response .= $_;
|
||||
if (m/<\/xcatresponse>/) {
|
||||
#replace ESC with xxxxESCxxx because XMLin cannot handle it
|
||||
$response =~ s/\e/xxxxESCxxxx/g;
|
||||
|
||||
if ($ENV{XCATXMLTRACE}) { print $response; }
|
||||
$massresponse.=$response;
|
||||
$response='';
|
||||
$rsp = XMLin($response,SuppressEmpty=>undef,ForceArray=>1);
|
||||
if($ENV{XCATXMLWARNING}) {
|
||||
validateXML($response);
|
||||
}
|
||||
|
||||
#add ESC back
|
||||
foreach my $key (keys %$rsp) {
|
||||
if (ref($rsp->{$key}) eq 'ARRAY') {
|
||||
foreach my $text (@{$rsp->{$key}}) {
|
||||
next unless defined $text;
|
||||
$text =~ s/xxxxESCxxxx/\e/g;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$rsp->{$key} =~ s/xxxxESCxxxx/\e/g;
|
||||
}
|
||||
}
|
||||
|
||||
$response='';
|
||||
$callback->($rsp);
|
||||
if ($rsp->{serverdone}) {
|
||||
$cleanexit=1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (not $cleanexit and $massresponse ne "<massresponse>") {
|
||||
$massresponse .= "</massresponse>";
|
||||
$cleanexit = rspclean($massresponse,$callback);
|
||||
}
|
||||
$massresponse="";
|
||||
unless ($cleanexit) {
|
||||
print STDERR "ERROR/WARNING: communication with the xCAT server seems to have been ended prematurely\n";
|
||||
}
|
||||
@@ -372,6 +291,7 @@ sub plugin_command {
|
||||
my $callback = shift;
|
||||
my %handler_hash;
|
||||
my $usesiteglobal = 0;
|
||||
|
||||
# We require these only in bypass mode to reduce start up time for the normal case
|
||||
#use lib "$::XCATROOT/lib/perl";
|
||||
#use xCAT::NodeRange;
|
||||
@@ -381,12 +301,6 @@ sub plugin_command {
|
||||
require xCAT::Table;
|
||||
|
||||
$Main::resps={};
|
||||
my $xmlreq;
|
||||
if (ref($req) ne 'HASH') { # the request XML, get an array
|
||||
$xmlreq=$req; # save the original XML
|
||||
$req = XMLin($xmlreq,SuppressEmpty=>undef,ForceArray=>1) ;
|
||||
|
||||
}
|
||||
my @nodes;
|
||||
if ($req->{node}) {
|
||||
@nodes = @{$req->{node}};
|
||||
@@ -405,6 +319,11 @@ sub plugin_command {
|
||||
unless (@nodes) {
|
||||
$req->{emptynoderange} = [1];
|
||||
}
|
||||
|
||||
if(@nodes == 0 ) {
|
||||
print "No nodes or noderanges specified\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (@nodes) { $req->{node} = \@nodes; }
|
||||
my %unhandled_nodes;
|
||||
@@ -422,14 +341,13 @@ sub plugin_command {
|
||||
if ($hdlspec =~ /^site:/) { #A site entry specifies a plugin
|
||||
my $sitekey = $hdlspec;
|
||||
$sitekey =~ s/^site://;
|
||||
#$sitetab = xCAT::Table->new('site');
|
||||
#my $sent = $sitetab->getAttribs({key=>$sitekey},['value']);
|
||||
#if ($sent and $sent->{value}) { #A site style plugin specification is just like
|
||||
if ($::XCATSITEVALS{$sitekey}) { #A site style plugin specification is just like
|
||||
$sitetab = xCAT::Table->new('site');
|
||||
my $sent = $sitetab->getAttribs({key=>$sitekey},['value']);
|
||||
if ($sent and $sent->{value}) { #A site style plugin specification is just like
|
||||
#a static global, it grabs all nodes rather than some
|
||||
$useglobals = -1; #If they tried to specify anything, don't use the default global handlers at all
|
||||
unless (@nodes) {
|
||||
$handler_hash{$::XCATSITEVALS{$sitekey}} = 1;
|
||||
$handler_hash{$sent->{value}} = 1;
|
||||
$usesiteglobal = 1;
|
||||
}
|
||||
foreach (@nodes) { #Specified a specific plugin, not a table lookup
|
||||
@@ -532,8 +450,7 @@ sub plugin_command {
|
||||
}
|
||||
} #Otherwise, global handler is implicitly disabled
|
||||
} else {
|
||||
print "Error request: $req->{command}->[0] has no known plugin for it.\n";
|
||||
return 1;
|
||||
return 1; #TODO: error back that request has no known plugin for it
|
||||
}
|
||||
if ($useunhandled) {
|
||||
my $queuelist;
|
||||
@@ -718,7 +635,7 @@ sub dispatch_request {
|
||||
if (ref $_->{'_xcatdest'} and (ref $_->{'_xcatdest'}) eq 'ARRAY') {
|
||||
_->{'_xcatdest'} = $_->{'_xcatdest'}->[0];
|
||||
}
|
||||
if ($onlyone and not ($_->{'_xcatdest'} and xCAT::NetworkUtils->thishostisnot($_->{'_xcatdest'}))) {
|
||||
if ($onlyone and not ($_->{'_xcatdest'} and xCAT::Utils->thishostisnot($_->{'_xcatdest'}))) {
|
||||
$SIG{CHLD}='DEFAULT';
|
||||
${"xCAT_plugin::".$modname."::"}{process_request}->($_,$dispatch_cb,\&do_request);
|
||||
return;
|
||||
@@ -759,7 +676,7 @@ sub dispatch_request {
|
||||
my $request_satisfied=0;
|
||||
foreach $xcatdest (@xcatdests) {
|
||||
my $dlock;
|
||||
if ($xcatdest and xCAT::NetworkUtils->thishostisnot($xcatdest)) {
|
||||
if ($xcatdest and xCAT::Utils->thishostisnot($xcatdest)) {
|
||||
#----- added to Client.pm -----#
|
||||
$dispatch_cb->({warning=>['XCATBYPASS is set, skipping hierarchy call to '.$_->{'_xcatdest'}.'']});
|
||||
#----- end added to Client.pm -----#
|
||||
@@ -890,28 +807,11 @@ sub build_response {
|
||||
|
||||
} # end of submit_request()
|
||||
|
||||
####################################
|
||||
# populates all the site attributes into %::XCATSITEVALS
|
||||
# This is used with XCATBYPASS=1
|
||||
###################################
|
||||
sub populate_site_hash {
|
||||
%::XCATSITEVALS=();
|
||||
my $sitetab = xCAT::Table->new('site',-create=>0);
|
||||
unless ($sitetab) {
|
||||
print ("ERROR: Unable to open basic site table for configuration\n");
|
||||
return;
|
||||
}
|
||||
my @records = $sitetab->getAllAttribs(qw/key value/);
|
||||
foreach (@records) {
|
||||
$::XCATSITEVALS{$_->{key}}=$_->{value};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
##########################################
|
||||
# handle_response is a default callback that can be passed into submit_request()
|
||||
# It is invoked repeatedly by submit_request() to print out the data returned by
|
||||
# handle_response is a default callback that can be passed into submit_response()
|
||||
# It is invoked repeatedly by submit_response() to print out the data returned by
|
||||
# the plugin.
|
||||
#
|
||||
# The normal flow is:
|
||||
@@ -991,11 +891,6 @@ sub populate_site_hash {
|
||||
##########################################
|
||||
sub handle_response {
|
||||
my $rsp = shift;
|
||||
if ($ENV{'XCATSHOWXML'}) {
|
||||
my $xmlrec=XMLout($rsp,RootName=>'xcatresponse',NoAttr=>1,KeyAttr=>[]);
|
||||
print "$xmlrec\n";
|
||||
return;
|
||||
}
|
||||
#print "in handle_response\n";
|
||||
# Handle errors
|
||||
if ($rsp->{errorcode}) {
|
||||
|
||||
+98
-259
@@ -16,7 +16,6 @@ require xCAT::Table;
|
||||
require xCAT::Utils;
|
||||
require xCAT::MsgUtils;
|
||||
require xCAT::NetworkUtils;
|
||||
require xCAT::ServiceNodeUtils;
|
||||
use strict;
|
||||
|
||||
# IPv6 not yet implemented - need Socket6
|
||||
@@ -396,44 +395,6 @@ sub getobjdefs
|
||||
xCAT::MsgUtils->message("E", $rsp, $::callback);
|
||||
}
|
||||
}
|
||||
} elsif (($objtype eq 'auditlog') || ($objtype eq 'eventlog')) {
|
||||
# Special case for auditlog/eventlog
|
||||
# All the auditlog/eventlog attributes are in auditlog/eventlog table,
|
||||
# Do not need to read the table multiple times for each attribute.
|
||||
# The auditlog/eventlog is likely be very big over time,
|
||||
# performance is a big concern with the general logic
|
||||
my @TableRowArray = xCAT::DBobjUtils->getDBtable($objtype);
|
||||
foreach my $objname (sort @{$type_obj{$objtype}}) {
|
||||
if (@TableRowArray)
|
||||
{
|
||||
my $foundinfo = 0;
|
||||
foreach my $entry (@TableRowArray)
|
||||
{
|
||||
if ($entry->{recid} eq $objname)
|
||||
{
|
||||
foreach my $k (keys %{$entry})
|
||||
{
|
||||
# recid is the object name, do not need to be in the attributes list
|
||||
if ($k eq 'recid') { next; }
|
||||
if (defined($entry->{$k}) ) {
|
||||
$foundinfo++;
|
||||
if ($verbose == 1) {
|
||||
$objhash{$objname}{$k} = "$entry->{$k}\t(Table:$objtype - Key:$k)";
|
||||
} else {
|
||||
$objhash{$objname}{$k} = $entry->{$k};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($foundinfo)
|
||||
{
|
||||
$objhash{$objname}{'objtype'} = $objtype;
|
||||
}
|
||||
# There should not be multiple entries with the same recid
|
||||
last;
|
||||
} # end if($entry->
|
||||
} # end foreach my $entry
|
||||
} # end if(@TableTowArray
|
||||
} # end foreach my $objname
|
||||
} else {
|
||||
# get the object type decription from Schema.pm
|
||||
my $datatype = $xCAT::Schema::defspec{$objtype};
|
||||
@@ -950,8 +911,7 @@ sub setobjdefs
|
||||
my %attrlist;
|
||||
foreach my $entry (@{$datatype->{'attrs'}})
|
||||
{
|
||||
#push(@{$attrlist{$type}}, $entry->{'attr_name'});
|
||||
$attrlist{$type}{$entry->{'attr_name'}} = 1;
|
||||
push(@{$attrlist{$type}}, $entry->{'attr_name'});
|
||||
}
|
||||
|
||||
my @attrprovided=();
|
||||
@@ -971,7 +931,7 @@ sub setobjdefs
|
||||
next;
|
||||
}
|
||||
|
||||
if (!defined($attrlist{$type}{$attr}))
|
||||
if (!(grep /^$attr$/, @{$attrlist{$type}}))
|
||||
{
|
||||
if ($::verbose)
|
||||
{
|
||||
@@ -991,7 +951,7 @@ sub setobjdefs
|
||||
# And we must do this in the order given in defspec!!
|
||||
|
||||
my @setattrlist=();
|
||||
my %checkedattrs;
|
||||
my @checkedattrs;
|
||||
my $invalidattr;
|
||||
|
||||
foreach my $this_attr (@{$datatype->{'attrs'}})
|
||||
@@ -1038,7 +998,7 @@ sub setobjdefs
|
||||
if ( !($objhash{$objname}{$check_attr}) && !($DBattrvals{$objname}{$check_attr}) ) {
|
||||
# if I didn't already check for this attr
|
||||
my $rsp;
|
||||
if (!defined($checkedattrs{$attr_name})) {
|
||||
if (!grep(/^$attr_name$/, @checkedattrs)) {
|
||||
push @{$rsp->{data}}, "Cannot set the \'$attr_name\' attribute unless a value is provided for \'$check_attr\'.";
|
||||
|
||||
foreach my $tmp_attr (@{$datatype->{'attrs'}}) {
|
||||
@@ -1052,7 +1012,7 @@ sub setobjdefs
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->message("I", $rsp, $::callback);
|
||||
$checkedattrs{$attr_name} = 1;
|
||||
push(@checkedattrs, $attr_name);
|
||||
if ( $invalidattr->{$attr_name}->{valid} ne 1 ) {
|
||||
$invalidattr->{$attr_name}->{valid} = 0;
|
||||
$invalidattr->{$attr_name}->{condition} = "\'$check_attr=$check_value\'";
|
||||
@@ -1162,7 +1122,7 @@ sub setobjdefs
|
||||
xCAT::MsgUtils->message("W", $rsp, $::callback);
|
||||
} else {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "$em is not in the attribute of \'$attr_name\' for the \'$objname\' definition.";
|
||||
$rsp->{data}->[0] = "$em is not in the atrribute of \'$attr_name\' for the \'$objname\' definition.";
|
||||
xCAT::MsgUtils->message("W", $rsp, $::callback);
|
||||
}
|
||||
}
|
||||
@@ -1995,11 +1955,15 @@ sub getNetwkInfo
|
||||
if (xCAT::Utils->isMN() && !$nethash{$node}{'gateway'})
|
||||
{
|
||||
# does not have ip address in this subnet,
|
||||
# use the node attribute 'xcatmaster' or site.master
|
||||
my @nodes = ("$node");
|
||||
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes,"xcat","Node");
|
||||
my $snkey = (keys %{$sn})[0];
|
||||
$nethash{$node}{'gateway'} = xCAT::NetworkUtils->getipaddr($snkey);
|
||||
# use the node attribute 'xcatmaster'
|
||||
my $noderestab = xCAT::Table->new('noderes');
|
||||
my $et = $noderestab->getNodeAttribs($node, ['xcatmaster']);
|
||||
if ($et and defined($et->{'xcatmaster'}))
|
||||
{
|
||||
my $value = $et->{'xcatmaster'};
|
||||
$nethash{$node}{'gateway'} = xCAT::NetworkUtils->getipaddr($value);
|
||||
}
|
||||
$noderestab->close();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2220,20 +2184,15 @@ sub getchildren
|
||||
Arguments:
|
||||
An array of nodenames or 1 nodename
|
||||
Returns:
|
||||
If the input is an array, it returns a hash,
|
||||
for the nodes that can't get node type, it will be 'node' => undef;
|
||||
If the input is not an array, it returns the value of type,
|
||||
for the node that can't get node type, it will be undef;
|
||||
type of node
|
||||
Globals:
|
||||
%NODETYPEHASH
|
||||
Error:
|
||||
$::RUNCMD_RC = 1;
|
||||
Errors written to syslog
|
||||
Example:
|
||||
$type = xCAT::DBobjUtils->getnodetype($node, "ppc");
|
||||
$type = xCAT::DBobjUtils->getnodetype($node);
|
||||
$typerefer = xCAT::DBobjUtils->getnodetype(\@nodes, "PPC");
|
||||
$typerefer = xCAT::DBobjUtils->getnodetype(\@nodes);
|
||||
$type = getnodetype($node);
|
||||
$typerefer = getnodetype(\@nodes);
|
||||
Comments:
|
||||
none
|
||||
=cut
|
||||
@@ -2247,217 +2206,97 @@ sub getnodetype
|
||||
{
|
||||
$nodes = shift;
|
||||
}
|
||||
my $table = shift;
|
||||
my $rsp;
|
||||
my @tabletype = qw(ppc zvm);
|
||||
my %typehash;
|
||||
my %tablehash;
|
||||
$::RUNCMD_RC = 0;
|
||||
|
||||
my $nodetypetab = xCAT::Table->new( 'nodetype' );
|
||||
unless ($nodetypetab) { # cannot open the table return with error
|
||||
xCAT::MsgUtils->
|
||||
message('S', "getnodetype:Unable to open nodetype table.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
return undef;
|
||||
}
|
||||
|
||||
my @failnodes;
|
||||
my @failnodes1;
|
||||
######################################################################
|
||||
# if the table arg is set, go to the specified table first
|
||||
# if can't get anything from the specified table, go to nodetype table
|
||||
######################################################################
|
||||
if ($table) {
|
||||
my $nodetypetab = xCAT::Table->new( $table );
|
||||
unless ($nodetypetab) {
|
||||
xCAT::MsgUtils->message('S', "getnodetype:Unable to open $table table.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
if ( $nodes =~ /^ARRAY/) {
|
||||
foreach my $tn (@$nodes) {
|
||||
$typehash{$tn} = undef;
|
||||
my @types = ();
|
||||
my $typep;
|
||||
my $type;
|
||||
if ( $nodes =~ /^ARRAY/) {
|
||||
if (!%NODETYPEHASH) {
|
||||
my @nodetypes = $nodetypetab->getAllNodeAttribs(['node','nodetype']);
|
||||
foreach my $tn (@nodetypes) {
|
||||
$NODETYPEHASH{ $tn->{'node'} } = $tn->{'nodetype'};
|
||||
}
|
||||
}
|
||||
foreach my $nn (@$nodes) {
|
||||
$type = $NODETYPEHASH{$nn};
|
||||
if ($type) {
|
||||
my $flag = 0;
|
||||
my @tablename;
|
||||
foreach my $tt (split /,/, $type) {
|
||||
if (grep(/$tt/, @tabletype)) {
|
||||
@tablename = grep(/$tt/, @tabletype);
|
||||
$flag = 1;
|
||||
next;
|
||||
}
|
||||
}
|
||||
unless ($flag) { # find type in nodetype table
|
||||
push (@types, $type);
|
||||
} else { # use table (ppc or zvm) from attribute
|
||||
my $tablehandler = xCAT::Table->new( $tablename[0] );
|
||||
unless ($tablehandler) { # cannot open
|
||||
xCAT::MsgUtils->
|
||||
message('S', "getnodetype:Unable to open $tablename[0] table.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
return undef;
|
||||
}
|
||||
} else {
|
||||
$typehash{$nodes} = undef;
|
||||
}
|
||||
return \%typehash;
|
||||
}
|
||||
############################################
|
||||
# if the input node arg is an array,
|
||||
# query table and don't use the global hash
|
||||
############################################
|
||||
if ( $nodes =~ /^ARRAY/) {
|
||||
my $nodetypes = $nodetypetab->getNodesAttribs($nodes, ['nodetype']);
|
||||
foreach my $tn (@$nodes) {
|
||||
my $gottype = $nodetypes->{$tn}->[0]->{'nodetype'};
|
||||
if ( $gottype ) {
|
||||
$NODETYPEHASH{$tn} = $gottype;
|
||||
$typehash{$tn} = $gottype;
|
||||
# read the table
|
||||
$typep = $tablehandler->getNodeAttribs($nn, ["nodetype"]);
|
||||
if ($typep and $typep->{nodetype}) {
|
||||
$type = $typep->{nodetype};
|
||||
push (@types, $type);
|
||||
} else {
|
||||
push @failnodes, $tn;
|
||||
push (@types, undef);
|
||||
}
|
||||
} # end of processing PPC
|
||||
} else {
|
||||
push (@types, undef);
|
||||
}
|
||||
}
|
||||
return \@types;
|
||||
} else { # for one node
|
||||
$typep = $nodetypetab->getNodeAttribs($nodes, ["nodetype"]);
|
||||
if ( $typep and $typep->{nodetype} ) {
|
||||
$type = $typep->{nodetype};
|
||||
my $flag = 0;
|
||||
my @tablename;
|
||||
for my $tt ( split /,/, $type ) {
|
||||
if ( grep(/$tt/, @tabletype)) {
|
||||
@tablename = grep(/$tt/, @tabletype);
|
||||
$flag = 1;
|
||||
next;
|
||||
}
|
||||
}
|
||||
################################################
|
||||
# for the failed nodes, go to nodetype table
|
||||
################################################
|
||||
if ( @failnodes ) {
|
||||
my $typetable = xCAT::Table->new( 'nodetype' );
|
||||
unless ($typetable) { # cannot open the table return with error
|
||||
xCAT::MsgUtils->message('S', "getnodetype:Unable to open nodetype table.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
foreach my $tn (@failnodes) {
|
||||
$typehash{$tn} = undef;
|
||||
}
|
||||
unless ($flag) { # find type in nodetype table
|
||||
return $type;
|
||||
} else { # find type in ppc table
|
||||
my $tablehandler = xCAT::Table->new( $tablename[0] );
|
||||
if ( !$tablehandler ) {
|
||||
xCAT::MsgUtils->message('S', "getnodetype:Unable to open $tablename[0] table.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
return undef;
|
||||
}
|
||||
$typep = $tablehandler->getNodeAttribs($nodes, ["nodetype"]);
|
||||
if ( $typep and $typep->{nodetype} ) {
|
||||
$type = $typep->{nodetype};
|
||||
return $type;
|
||||
} else {
|
||||
my $nodetypes = $nodetypetab->getNodesAttribs(\@failnodes, ['nodetype']);
|
||||
foreach my $tn ( @failnodes ) {
|
||||
if ( $nodetypes->{$tn}->[0] ) {
|
||||
$NODETYPEHASH{$tn} = $nodetypes->{$tn}->[0]->{'nodetype'};
|
||||
$typehash{$tn} = $nodetypes->{$tn}->[0]->{'nodetype'};
|
||||
} else {
|
||||
push @failnodes1, $tn;
|
||||
$typehash{$tn} = undef;
|
||||
}
|
||||
##################################################
|
||||
# give error msg for the nodes can't get nodetype
|
||||
##################################################
|
||||
}
|
||||
if ( @failnodes1 ) {
|
||||
my $nodelist = join(",", @failnodes1);
|
||||
xCAT::MsgUtils->message('S', "getnodetype:Can't find these nodes' type: $nodelist.\n");
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
#####################
|
||||
# return the result
|
||||
#####################
|
||||
return \%typehash;
|
||||
|
||||
}
|
||||
} else {
|
||||
############################################
|
||||
# if the input node arg is not an array,
|
||||
# query table and use the global hash first
|
||||
############################################
|
||||
if ( $NODETYPEHASH{$nodes} ) {
|
||||
return $NODETYPEHASH{$nodes};
|
||||
} else {
|
||||
my $typep = $nodetypetab->getNodeAttribs($nodes, ['nodetype']);
|
||||
if ( $typep->{nodetype} ) {
|
||||
$NODETYPEHASH{$nodes} = $typep->{nodetype};
|
||||
return $typep->{nodetype};
|
||||
} else { #if not find in the specified table, go to nodetype table
|
||||
my $typetable = xCAT::Table->new( 'nodetype' );
|
||||
unless ($typetable) { # cannot open the table return with error
|
||||
xCAT::MsgUtils->message('S', "getnodetype:Unable to open nodetype table.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
return undef;
|
||||
}
|
||||
my $typep = $typetable->getNodeAttribs($nodes, ['nodetype']);
|
||||
if ( $typep->{nodetype} ) {
|
||||
$NODETYPEHASH{$nodes} = $typep->{nodetype};
|
||||
return $typep->{nodetype};
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
######################################################################
|
||||
# if the table arg is not set, go to the nodetype table first
|
||||
# if can't get anything from the specified table, go to nodetype table
|
||||
######################################################################
|
||||
my $nodetypetab = xCAT::Table->new( 'nodetype' );
|
||||
unless ($nodetypetab) {
|
||||
xCAT::MsgUtils->message('S', "getnodetype:Unable to open $table table.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
if ( $nodes =~ /^ARRAY/) {
|
||||
foreach my $tn (@$nodes) {
|
||||
$typehash{$tn} = undef;
|
||||
}
|
||||
} else {
|
||||
$typehash{$nodes} = undef;
|
||||
}
|
||||
return \%typehash;
|
||||
}
|
||||
############################################
|
||||
# if the input node arg is an array,
|
||||
# query table and don't use the global hash
|
||||
############################################
|
||||
if ( $nodes =~ /^ARRAY/) {
|
||||
my $nodetypes = $nodetypetab->getNodesAttribs($nodes, ['nodetype']);
|
||||
foreach my $tn (@$nodes) {
|
||||
my $gottype = $nodetypes->{$tn}->[0]->{'nodetype'};
|
||||
if ( $gottype) {
|
||||
if ($gottype =~ /,/) { #if find ppc,osi
|
||||
my @tbty = split /,/, $gottype;
|
||||
foreach my $ttable (@tbty){
|
||||
if (grep(/$ttable/, @tabletype)){
|
||||
$tablehash{ $tn } = $ttable;
|
||||
last;
|
||||
}
|
||||
}
|
||||
} elsif (grep(/$gottype/, @tabletype)){ #if find ppc or zvm
|
||||
$tablehash{ $tn } = $gottype;
|
||||
} else {
|
||||
$NODETYPEHASH{ $tn } = $gottype;
|
||||
$typehash{ $tn } = $gottype;
|
||||
}
|
||||
} else {
|
||||
$typehash{ $tn } = undef;
|
||||
}
|
||||
}
|
||||
################################################
|
||||
# for the failed nodes, go to related tables
|
||||
################################################
|
||||
if ( %tablehash ) {
|
||||
foreach my $ttable (@tabletype) {
|
||||
my @nodegroup;
|
||||
foreach my $fnode (keys %tablehash) {
|
||||
if ($tablehash{$fnode} eq $ttable) {
|
||||
push @nodegroup, $fnode;
|
||||
}
|
||||
}
|
||||
next unless (@nodegroup);
|
||||
my $typetable = xCAT::Table->new( $ttable);
|
||||
unless ($typetable) {
|
||||
my $failnodes = join(",", @nodegroup);
|
||||
xCAT::MsgUtils->message('S', "getnodetype:Unable to open $ttable table, can't find $failnodes type.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
foreach (@nodegroup) {
|
||||
$typehash{$_} = undef;
|
||||
}
|
||||
} else {
|
||||
my $typep = $typetable->getNodesAttribs(\@nodegroup, ['nodetype']);
|
||||
foreach my $fn (@nodegroup) {
|
||||
if ( $typep->{$fn}->[0]->{'nodetype'} ) {
|
||||
$typehash{$fn} = $typep->{$fn}->[0]->{'nodetype'};
|
||||
$NODETYPEHASH{$fn} = $typep->{$fn}->[0]->{'nodetype'};
|
||||
} else {
|
||||
$typehash{$fn} = undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%typehash;
|
||||
} else { # if not an array
|
||||
if ( $NODETYPEHASH{$nodes} ) {
|
||||
return $NODETYPEHASH{$nodes};
|
||||
} else {
|
||||
my $typep = $nodetypetab->getNodeAttribs($nodes, ["nodetype"]);
|
||||
if ( $typep->{nodetype} and !(grep(/$typep->{nodetype}/, @tabletype))) {
|
||||
$NODETYPEHASH{$nodes} = $typep->{nodetype};
|
||||
return $typep->{nodetype};
|
||||
} elsif ( grep(/$typep->{nodetype}/, @tabletype) ) {
|
||||
my $typetable = xCAT::Table->new( $typep->{nodetype} );
|
||||
unless ($typetable) {
|
||||
xCAT::MsgUtils->message('S', "getnodetype:Unable to open nodetype table.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
return undef;
|
||||
}
|
||||
my $typep = $typetable->getNodeAttribs($nodes, ["nodetype"]);
|
||||
if ( $typep->{nodetype} ) {
|
||||
$NODETYPEHASH{$nodes} = $typep->{nodetype};
|
||||
return $typep->{nodetype};
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
+342
-1492
File diff suppressed because it is too large
Load Diff
+52
-97
@@ -159,100 +159,6 @@ no strict;
|
||||
use strict;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
=head3
|
||||
fork_output_for_commands
|
||||
|
||||
Forks a process for the given command array and returns the process
|
||||
ID for the forked process and references to all I/O pipes for STDOUT
|
||||
and STDERR. In the child process, it will invoke the xCAT::DSHCore->fork_no_output()
|
||||
for the first command which is a no-output command and waitpid(). And then execute
|
||||
the left commands in the child process.
|
||||
|
||||
Arguments:
|
||||
$fork_id - unique identifer to use for tracking the forked process
|
||||
@command - command and parameter array to execute in the forkec process
|
||||
|
||||
Returns:
|
||||
$pid - process identifer for the forked process
|
||||
|
||||
Globals:
|
||||
None
|
||||
|
||||
Error:
|
||||
None
|
||||
|
||||
Example:
|
||||
$pid = xCAT::DSHCore->fork_output_for_commands('hostname1PID', @command_array);
|
||||
|
||||
Comments:
|
||||
|
||||
=cut
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
sub fork_output_for_commands
|
||||
{
|
||||
my ($class, $fork_id, @commands) = @_;
|
||||
no strict;
|
||||
my $pid;
|
||||
my %pipes = ();
|
||||
|
||||
my $rout_fh = "rout_$fork_id";
|
||||
my $rerr_fh = "rerr_$fork_id";
|
||||
my $wout_fh = "wout_$fork_id";
|
||||
my $werr_fh = "werr_$fork_id";
|
||||
|
||||
(pipe($rout_fh, $wout_fh) == -1) && return (-1, undef);
|
||||
(pipe($rerr_fh, $werr_fh) == -1) && return (-2, undef);
|
||||
|
||||
if ($pid = fork)
|
||||
{
|
||||
close($wout_fh);
|
||||
close($werr_fh);
|
||||
}
|
||||
|
||||
elsif (defined $pid)
|
||||
{
|
||||
close($rout_fh);
|
||||
close($rerr_fh);
|
||||
|
||||
!(open(STDOUT, ">&$wout_fh")) && return (-5, undef);
|
||||
!(open(STDERR, ">&$werr_fh")) && return (-6, undef);
|
||||
|
||||
select(STDOUT);
|
||||
$| = 1;
|
||||
select(STDERR);
|
||||
$| = 1;
|
||||
if ( @commands > 1 ) {
|
||||
my $command0 = shift(@commands);
|
||||
my @exe_command0_process = xCAT::DSHCore->fork_no_output($fork_id, @$command0);
|
||||
waitpid($exe_command0_process[0], undef);
|
||||
}
|
||||
|
||||
my $t_command = shift(@commands);
|
||||
my @command = @$t_command;
|
||||
if (!(exec {$command[0]} @command))
|
||||
{
|
||||
return (-4, undef);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return (-3, undef);
|
||||
}
|
||||
|
||||
return ($pid, *$rout_fh, *$rerr_fh, *$wout_fh, *$werr_fh);
|
||||
use strict;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
=head3
|
||||
@@ -490,7 +396,7 @@ sub pipe_handler
|
||||
|| print STDOUT
|
||||
"dsh> Error_file_closed $$target_properties{hostname} $output_file\n";
|
||||
my $rsp={};
|
||||
$rsp->{error}->[0] =
|
||||
$rsp->{data}->[0] =
|
||||
"Error_file_closed $$target_properties{hostname $output_file}.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
($output_file == $$target_properties{'output-fh'})
|
||||
@@ -669,6 +575,55 @@ sub pipe_handler_buffer
|
||||
return $eof_reached;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
=head3
|
||||
fping_hostnames
|
||||
|
||||
Executes fping on a given list of hostnames and returns a list of those
|
||||
hostnames that did not respond
|
||||
|
||||
Arguments:
|
||||
@hostnames - list of hostnames to execute for fping
|
||||
|
||||
Returns:
|
||||
@no_response - list of hostnames that did not respond
|
||||
undef if fping is not installed
|
||||
|
||||
Globals:
|
||||
None
|
||||
|
||||
Error:
|
||||
None
|
||||
|
||||
Example:
|
||||
@bad_hosts = xCAT::DSHCore->fping_hostnames(@host_list);
|
||||
|
||||
Comments:
|
||||
|
||||
=cut
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
sub fping_hostnames
|
||||
{
|
||||
my ($class, @hostnames) = @_;
|
||||
|
||||
my $fping = (-x '/usr/sbin/fping') || undef;
|
||||
!$fping && return undef;
|
||||
|
||||
my @output = `/usr/sbin/fping -B 1.0 -r 1 -t 50 -i 10 -p 50 @hostnames`;
|
||||
|
||||
my @no_response = ();
|
||||
foreach my $line (@output)
|
||||
{
|
||||
my ($hostname, $token, $status) = split ' ', $line;
|
||||
!(($token eq 'is') && ($status eq 'alive'))
|
||||
&& (push @no_response, $hostname);
|
||||
}
|
||||
|
||||
return @no_response;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
@@ -758,8 +713,8 @@ sub pping_hostnames
|
||||
xCAT::Utils->runcmd("$::XCATROOT/bin/pping $hostname_list", -1);
|
||||
if ($::RUNCMD_RC !=0) {
|
||||
my $rsp={};
|
||||
$rsp->{error}->[0] = "Error from pping";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
$rsp->{data}->[0] = "Error from pping";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
}
|
||||
$::RUNCMD_RC =0; # reset
|
||||
my @no_response = ();
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
package xCAT::Enabletrace;
|
||||
use Filter::Util::Call;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw(loadtrace filter);
|
||||
|
||||
sub loadtrace{
|
||||
my (undef, $filename) = caller();
|
||||
my (%args) = (
|
||||
filename => $filename,
|
||||
inside => 0,
|
||||
lineno => 0,
|
||||
);
|
||||
|
||||
filter_add(bless \%args);
|
||||
}
|
||||
|
||||
sub filter {
|
||||
my ($self) = @_;
|
||||
my $line= filter_read();
|
||||
$self->{lineno}++;
|
||||
# deal with EOF/error first
|
||||
if ($line<= 0) {
|
||||
if ($self->{inside}) {
|
||||
die "Do not find the END of the trace block. [$self->{filename}:$self->{lineno}]";
|
||||
}
|
||||
return $line;
|
||||
}
|
||||
if ($self->{inside}) {
|
||||
if (/^\s*##\s*TRACE_BEGIN/ ) {
|
||||
die "The trace block is nested. [$self->{filename}:$self->{lineno}]";
|
||||
} elsif (/^\s*##\s*TRACE_END/) {
|
||||
$self->{inside} = 0;
|
||||
} else {
|
||||
# remove the #.. at the begin of the line
|
||||
s/^\s*#+//;
|
||||
}
|
||||
} elsif ( /^\s*##\s*TRACE_BEGIN/ ) {
|
||||
$self->{inside} = 1;
|
||||
} elsif ( /^\s*##\s*TRACE_END/ ) {
|
||||
die "Do not see the BEGIN of the trace block. [$self->{filename}:$self->{lineno}]";
|
||||
} elsif ( /^\s*##\s*TRACE_LINE/ ) {
|
||||
s/^\s*##\s*TRACE_LINE//;
|
||||
}
|
||||
|
||||
return $line;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
@@ -35,7 +35,7 @@ foreach (@extSchema) {
|
||||
if ($@) {
|
||||
$warning ="Warning: The user defined database table schema file $file cannot be located or has compiling errors.\n";
|
||||
print $warning;
|
||||
`logger -p local4.warning -t xCAT $warning`;
|
||||
`logger -t xCAT $warning`;
|
||||
next;
|
||||
}
|
||||
if (${"xCAT_schema::" . "$modname" . "::"}{tabspec}) {
|
||||
@@ -44,7 +44,7 @@ foreach (@extSchema) {
|
||||
if (exists($ext_tabspec{$tabname})) {
|
||||
$warning = "Warning: File $file: the table name $tabname is used by other applications. Please rename the table.\n";
|
||||
print $warning;
|
||||
`logger -p local4.warning -t xCAT $warning`;
|
||||
`logger -t xCAT $warning`;
|
||||
} else {
|
||||
$ext_tabspec{$tabname}=$tabspec{$tabname};
|
||||
}
|
||||
@@ -52,7 +52,7 @@ foreach (@extSchema) {
|
||||
} else {
|
||||
$warning ="\n Warning: Cannot find \%tabspec variable in the user defined database table schema file $file\n";
|
||||
print $warning;
|
||||
`logger -p local4.warning -t xCAT $warning`;
|
||||
`logger -t xCAT $warning`;
|
||||
}
|
||||
|
||||
#get the defspec from each file and merge them into %ext_defspec
|
||||
@@ -74,7 +74,7 @@ foreach (@extSchema) {
|
||||
if (exists($tmp_hash{$attrname})) {
|
||||
$warning= " Warning: Conflict when adding user defined defspec from file $file. Attribute name $attrname is already defined in object $objname. \n";
|
||||
print $warning;
|
||||
`logger -p local4.warning -t xCAT $warning`;
|
||||
`logger -t xCAT $warning`;
|
||||
} else {
|
||||
#print "\ngot here objname=$objname, attrname=" . $h->{attr_name} . "\n";
|
||||
push(@{$ext_defspec{$objname}->{'attrs'}}, $h);
|
||||
|
||||
+71
-261
@@ -10,7 +10,10 @@ BEGIN
|
||||
# if AIX - make sure we include perl 5.8.2 in INC path.
|
||||
# Needed to find perl dependencies shipped in deps tarball.
|
||||
if ($^O =~ /^aix/i) {
|
||||
unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2));
|
||||
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/5.8.2";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2";
|
||||
}
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
@@ -23,211 +26,8 @@ require xCAT::InstUtils;
|
||||
require xCAT::NetworkUtils;
|
||||
require xCAT::Schema;
|
||||
require xCAT::Utils;
|
||||
require xCAT::TableUtils;
|
||||
#use Data::Dumper;
|
||||
require xCAT::NodeRange;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getHcpAttribs
|
||||
Description:
|
||||
Build 2 Hashes from ppc/vpd table
|
||||
one hash is : CEC/Frame is the Key, FSPs/BPAs are the value.
|
||||
the other is: fsp/bpa is the key, the side is the value.
|
||||
|
||||
Arguments:
|
||||
$request: this hash will be usded to store the ppc hash and vpd hash
|
||||
$tabs: the hash store the new tables for ppc and bpd.
|
||||
Returns:
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example: xCAT::FSPUtils::getPPCAttribs($request, \%tabs);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub getHcpAttribs
|
||||
{
|
||||
my $request = shift;
|
||||
my $tabs = shift;
|
||||
my %ppchash ;
|
||||
my %vpd ;
|
||||
|
||||
my @vs = $tabs->{vpd}->getAllNodeAttribs(['node', 'side']);
|
||||
for my $entry ( @vs ) {
|
||||
my $tmp_node = $entry->{node};
|
||||
my $tmp_side = $entry->{side};
|
||||
if(defined($tmp_node) && defined($tmp_side)) {
|
||||
$vpd{$tmp_node} = $tmp_side ;
|
||||
}
|
||||
}
|
||||
|
||||
my @ps = $tabs->{ppc}->getAllNodeAttribs(['node','parent','nodetype']);
|
||||
for my $entry ( @ps ) {
|
||||
my $tmp_parent = $entry->{parent};
|
||||
my $tmp_node = $entry->{node};
|
||||
my $tmp_type = $entry->{nodetype};
|
||||
if(defined($tmp_node) && defined($tmp_type) && ($tmp_type =~ /^(fsp|bpa)$/ && $tmp_parent) ) {
|
||||
push @{$ppchash{$tmp_parent}{children}}, $tmp_node;
|
||||
#push @{$ppchash{$tmp_parent}}, $tmp_node;
|
||||
}
|
||||
|
||||
#if(exists($ppchash{$tmp_node})) {
|
||||
# if( defined($tmp_type) ) {
|
||||
# #push @{$ppchash{$tmp_node}{type}}, $tmp_type;
|
||||
# } else {
|
||||
# my %output;
|
||||
# my $msg = "no type for $tmp_type in the ppc table.";
|
||||
# $output{errorcode} = 1;
|
||||
# $output{data} = $msg;
|
||||
# $request->{callback}->( \%output );
|
||||
# }
|
||||
#}
|
||||
}
|
||||
|
||||
$request->{ppc}=\%ppchash ;
|
||||
$request->{vpd}=\%vpd ;
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getIPaddress
|
||||
Description:
|
||||
Used by DFM related functions. When getting the IPs for CECs' FSPs, or
|
||||
getting the IPs for Frames' BPAs. And the IPs order is A-0,A-1,B-0,B-1.
|
||||
When getting the IP for one FSP or one BPA, if the $nodetocheck it one IP,
|
||||
it will return the IP immediately; if not, it will get the IP of the FSP or BPA.
|
||||
|
||||
Arguments:
|
||||
$request: Because getIPaddress() is always used for one node after the process fork. Avoiding to
|
||||
access the DB for each node in the subprocess, we should collect the attributs before
|
||||
process fork, and put the attributes in the $request variable. For the getIpaddress().
|
||||
The $request parameter should include the ppc hash which mapping the CEC->FSPs and
|
||||
Frames->BPAs, and vpd hash the fsp->side and the bpa->side.
|
||||
$type: the type of the $nodetocheck
|
||||
$nodetocheck: Node name, only one node at a time.
|
||||
$port: if the $nodetocheck is a fsp or bpa, it will be usde.
|
||||
Returns: ip address(s)
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example: my $c1 = xCAT::FSPUtils::getIPaddress($request, $type, $nodetocheck);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub getIPaddress
|
||||
{
|
||||
# require xCAT::Table;
|
||||
my $request = shift;
|
||||
my $type = shift;
|
||||
my $nodetocheck = shift;
|
||||
my $port = shift;
|
||||
if (xCAT::NetworkUtils::isIpaddr($nodetocheck)) {
|
||||
return $nodetocheck;
|
||||
}
|
||||
my $side = "[A|B]";
|
||||
if (!defined($port)) {
|
||||
$port = "[0|1]";
|
||||
}
|
||||
|
||||
my $ppc = $request->{ppc};
|
||||
my $vpd = $request->{vpd};
|
||||
|
||||
# only need to parse IP addresses for Frame/CEC/BPA/FSP
|
||||
|
||||
#my $type = xCAT::DBobjUtils->getnodetype($nodetocheck);
|
||||
#my $type = $$attrs[4];
|
||||
if ($type) {
|
||||
my @children;
|
||||
my %node_side_pairs = ();
|
||||
my $children_num = 0;
|
||||
my $parent;
|
||||
if ($type eq "bpa" or $type eq "fsp") {
|
||||
|
||||
push @children, $nodetocheck;
|
||||
|
||||
#my $tmp_s = $vpdtab->getNodeAttribs($nodetocheck, ['side']);
|
||||
my $tmp_s = $vpd->{$nodetocheck};
|
||||
if ($tmp_s and $tmp_s =~ /(A|B)-\d/i) {
|
||||
$side = $1; # get side for the fsp
|
||||
|
||||
} else {
|
||||
return -3;
|
||||
}
|
||||
} elsif ($type eq "frame" or $type eq "cec" or ($type =~ /lpar/i)) {
|
||||
#In DFM
|
||||
#1. when the node type is frame, its hcp( $nodetocheck ) is frame,
|
||||
#and it will get the BPAs IPs for the Frame.
|
||||
#2. when the node type is CEC, its hcp( $nodetocheck ) is CEC,
|
||||
#and it will get the FSPs IPs for the CEC.
|
||||
#3. when the node type is lpar, its hcp is the CEC.
|
||||
#the $nodetocheck is its' hcp. So set $nodetocheck to $parent variable.
|
||||
#And then get the FSPs IPs for the CEC.
|
||||
$parent = $nodetocheck;
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
if( @children == 0 ) {
|
||||
if( exists($ppc->{$parent} ) ) {
|
||||
#for cec/frame, get the FSPs/BPAs from the hash we built in getHcpAttribs() before.
|
||||
@children = @{$ppc->{$parent}->{children}};
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
foreach my $tmp_n( @children) {
|
||||
my $tmp_s = $vpd->{$tmp_n};
|
||||
if ($tmp_s and $tmp_s =~ /^$side-$port$/i) {
|
||||
$tmp_s =~ s/a/A/;
|
||||
$tmp_s =~ s/b/B/;
|
||||
if (xCAT::NetworkUtils::isIpaddr($tmp_n)) {
|
||||
$node_side_pairs{$tmp_s} = $tmp_n;
|
||||
$children_num++;
|
||||
} else {
|
||||
my $tmpip = xCAT::NetworkUtils->getipaddr($tmp_n);
|
||||
if (!$tmpip) {
|
||||
#my $hoststab = xCAT::Table->new( 'hosts' );
|
||||
#my $tmp = $hoststab->getNodeAttribs($tmp_n, ['ip']);
|
||||
#if ($tmp->{ip}) {
|
||||
# $tmpip = $tmp->{ip};
|
||||
#}
|
||||
}
|
||||
if ($tmpip) {
|
||||
$node_side_pairs{$tmp_s} = $tmpip;
|
||||
$children_num++;
|
||||
}
|
||||
} # end of parse IP address for a fsp/bpa
|
||||
} # end of parse a child's side
|
||||
} #end of loop for children
|
||||
if ($children_num == 0) {
|
||||
return undef; #no children or brothers for this node.
|
||||
}
|
||||
my @keys = qw(A-0 A-1 B-0 B-1);
|
||||
my $out_strings = undef;
|
||||
foreach my $tmp (@keys) {
|
||||
if (!$node_side_pairs{$tmp}) {
|
||||
$node_side_pairs{$tmp} = '';
|
||||
}
|
||||
}
|
||||
|
||||
$out_strings = $node_side_pairs{"A-0"}.','.$node_side_pairs{"A-1"}.','.$node_side_pairs{"B-0"}.','.$node_side_pairs{"B-1"};
|
||||
|
||||
return $out_strings;
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -256,7 +56,6 @@ sub getIPaddress
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub fsp_api_action {
|
||||
my $request = shift;
|
||||
my $node_name = shift;
|
||||
my $attrs = shift;
|
||||
my $action = shift;
|
||||
@@ -283,32 +82,32 @@ sub fsp_api_action {
|
||||
}
|
||||
$id = $$attrs[0];
|
||||
$fsp_name = $$attrs[3];
|
||||
xCAT::MsgUtils->verbose_message($request, "fsp_api_action START node:$node_name,type:$$attrs[4].");
|
||||
|
||||
if($$attrs[4] =~ /^fsp$/ || $$attrs[4] =~ /^lpar$/ || $$attrs[4] =~ /^cec$/) {
|
||||
$type = 0;
|
||||
$fsp_bpa_type="fsp";
|
||||
} elsif($$attrs[4] =~ /^bpa$/ || $$attrs[4] =~ /^frame$/) {
|
||||
$type = 1;
|
||||
$fsp_bpa_type="bpa";
|
||||
} elsif($$attrs[4] =~ /^blade$/) {
|
||||
$type = 0;
|
||||
$fsp_bpa_type = "blade";
|
||||
} else {
|
||||
$res = "$fsp_name\'s type is $$attrs[4]. Not support for $$attrs[4]";
|
||||
return ([$node_name, $res, -1]);
|
||||
}
|
||||
|
||||
if( $action =~ /^add_connection$/) {
|
||||
############################
|
||||
# Get IP address
|
||||
############################
|
||||
$fsp_ip = getIPaddress($request, $$attrs[4], $fsp_name, $parameter );
|
||||
undef($parameter);
|
||||
#$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name, $parameter );
|
||||
$fsp_ip = xCAT::Utils::getIPaddress( $fsp_name, $parameter );
|
||||
undef($parameter);
|
||||
} else {
|
||||
$fsp_ip = getIPaddress($request, $$attrs[4], $fsp_name );
|
||||
#$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name );
|
||||
$fsp_ip = xCAT::Utils::getIPaddress( $fsp_name );
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "fsp_api_action getIPaddress:$fsp_ip.");
|
||||
|
||||
if(!defined($fsp_ip)) {
|
||||
$res = "Failed to get IP address for $fsp_name or the related FSPs/BPAs.";
|
||||
$res = "Failed to get the $fsp_name\'s or the related FSPs/BPAs' ip";
|
||||
return ([$node_name, $res, -1]);
|
||||
}
|
||||
|
||||
@@ -323,35 +122,32 @@ sub fsp_api_action {
|
||||
#print "fsp name: $fsp_name\n";
|
||||
#print "fsp ip: $fsp_ip\n";
|
||||
|
||||
#In DFM, only the add_connection action need the userid/password to create the connection
|
||||
#between hdwr_svr and FSPs or BPAs.
|
||||
#get the HMC/password from passwd table or ppcdirect table.
|
||||
if( $action =~ /^add_connection$/) {
|
||||
my $tmp_node;
|
||||
if( $$attrs[4] =~ /^cec$/ || $$attrs[4] =~ /^frame$/ ) {
|
||||
$tmp_node = $node_name;
|
||||
} elsif ($$attrs[4] =~ /^blade$/) {
|
||||
$tmp_node = $$attrs[5];
|
||||
} else {
|
||||
if( $$attrs[4] =~ /^cec$/ || $$attrs[4] =~ /^frame$/ ) {
|
||||
#for redundant FSPs/BPAs, we only need to get the one node's HMC/passwd
|
||||
my $children = xCAT::DBobjUtils->getchildren($fsp_name);
|
||||
if( !defined($children) ) {
|
||||
$res = "Failed to get the $fsp_name\'s FSPs/BPAs";
|
||||
return ([$fsp_name, $res, -1]);
|
||||
}
|
||||
$tmp_node = $$children[0];
|
||||
} else {
|
||||
$tmp_node = $fsp_name;
|
||||
}
|
||||
|
||||
my $cred = $request->{$tmp_node}{cred};
|
||||
($user, $password) = @$cred ;
|
||||
#($user, $password) = xCAT::PPCdb::credentials( $tmp_node, $fsp_bpa_type,'HMC');
|
||||
if ( !$password) {
|
||||
$res = "Cannot get password of userid 'HMC'. Please check table 'passwd' or 'ppcdirect'.";
|
||||
return ([$node_name, $res, -1]);
|
||||
}
|
||||
# The userid for creating connection only is "HMC".
|
||||
$user = 'HMC';
|
||||
}
|
||||
|
||||
($user, $password) = xCAT::PPCdb::credentials( $tmp_node, $fsp_bpa_type,'HMC');
|
||||
if ( !$password) {
|
||||
$res = "Cannot get password of userid 'HMC'. Please check table 'passwd' or 'ppcdirect'.";
|
||||
return ([$node_name, $res, -1]);
|
||||
}
|
||||
}
|
||||
|
||||
my $cmd;
|
||||
my $install_dir = xCAT::TableUtils->getInstallDir();
|
||||
my $install_dir = xCAT::Utils->getInstallDir();
|
||||
if( $action =~ /^(code_update|get_compatible_version_from_rpm)$/) {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:$parameter -d $install_dir/packages_fw/";
|
||||
} elsif($action =~ /^code_updateD$/) {
|
||||
$cmd = "$fsp_api -a code_update -D -T $tooltype -t $type:$fsp_ip:$id:$node_name:$parameter -d $install_dir/packages_fw/";
|
||||
} elsif($action =~ /^add_connection$/) {
|
||||
$cmd = "$fsp_api -a $action -u $user -p $password -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
|
||||
} elsif ($action =~ /^set_frame_number$/) {
|
||||
@@ -370,20 +166,12 @@ sub fsp_api_action {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "fsp_api_action cmd:$cmd.");
|
||||
|
||||
#print "cmd: $cmd\n";
|
||||
$SIG{CHLD} = 'DEFAULT';
|
||||
# secure passwords in verbose mode
|
||||
my $tmpv = $::VERBOSE;
|
||||
if($action =~ /^add_connection$/)
|
||||
{
|
||||
# password involved
|
||||
$::VERBOSE = 0;
|
||||
}
|
||||
$res = xCAT::Utils->runcmd($cmd, -1);
|
||||
#$res = "good";
|
||||
$Rc = $::RUNCMD_RC;
|
||||
$::VERBOSE = $tmpv;
|
||||
|
||||
##################
|
||||
# output the prompt
|
||||
@@ -392,7 +180,6 @@ sub fsp_api_action {
|
||||
if(defined($res)) {
|
||||
$res =~ s/$node_name: //g;
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "fsp_api_action return:$Rc.");
|
||||
return( [$node_name,$res, $Rc] );
|
||||
}
|
||||
|
||||
@@ -421,9 +208,8 @@ sub fsp_api_action {
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub fsp_state_action {
|
||||
my $request = shift;
|
||||
my $node_name = shift;
|
||||
my $attrs = shift;
|
||||
my $type_name = shift;
|
||||
my $action = shift;
|
||||
my $tooltype = shift;
|
||||
my $fsp_api = ($::XCATROOT) ? "$::XCATROOT/sbin/fsp-api" : "/opt/xcat/sbin/fsp-api";
|
||||
@@ -444,8 +230,7 @@ sub fsp_state_action {
|
||||
$fsp_name = $node_name;
|
||||
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "fsp_state_action START node:$node_name,type:$$attrs[4].");
|
||||
if( $$attrs[4] =~ /^(fsp|lpar|cec|blade)$/) {
|
||||
if($type_name =~ /^fsp$/ || $type_name =~ /^lpar$/ || $type_name =~ /^cec$/) {
|
||||
$type = 0;
|
||||
} else {
|
||||
$type = 1;
|
||||
@@ -454,19 +239,18 @@ sub fsp_state_action {
|
||||
############################
|
||||
# Get IP address
|
||||
############################
|
||||
$fsp_ip = getIPaddress($request, $$attrs[4], $fsp_name );
|
||||
#$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name );
|
||||
$fsp_ip = xCAT::Utils::getIPaddress( $fsp_name );
|
||||
if(!defined($fsp_ip) or ($fsp_ip == -3)) {
|
||||
$res[0] = "Failed to get IP address for $fsp_name or the related FSPs/BPAs.";
|
||||
return ([-1, $res[0]]);
|
||||
$res[0] = ["Failed to get the $fsp_name\'s ip"];
|
||||
return ([-1, @res]);
|
||||
}
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "fsp_state_action getIPaddress:$fsp_ip.");
|
||||
#print "fsp name: $fsp_name\n";
|
||||
#print "fsp ip: $fsp_ip\n";
|
||||
my $cmd;
|
||||
#$cmd = "$fsp_api -a $action -u $user -p $password -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
|
||||
xCAT::MsgUtils->verbose_message($request, "fsp_state_action cmd:$cmd.");
|
||||
#print "cmd: $cmd\n";
|
||||
$SIG{CHLD} = 'DEFAULT';
|
||||
@res = xCAT::Utils->runcmd($cmd, -1);
|
||||
@@ -480,14 +264,40 @@ sub fsp_state_action {
|
||||
if( @res ) {
|
||||
$res[0] =~ s/$node_name: //g;
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "fsp_state_action return:$Rc.");
|
||||
return( [$Rc,@res] );
|
||||
}
|
||||
|
||||
sub getTypeOfNode
|
||||
{
|
||||
my $class = shift;
|
||||
my $node = shift;
|
||||
my $callback = shift;
|
||||
|
||||
my $nodetypetab = xCAT::Table->new( 'nodetype');
|
||||
|
||||
if (!$nodetypetab) {
|
||||
my $rsp;
|
||||
$rsp->{errorcode}->[0] = [1];
|
||||
$rsp->{data}->[0]= "Failed to open table 'nodetype'";
|
||||
xCAT::MsgUtils->message('E', $rsp, $callback);
|
||||
}
|
||||
my $nodetype_hash = $nodetypetab->getNodeAttribs( $node,[qw(nodetype)]);
|
||||
my $nodetype = $nodetype_hash->{nodetype};
|
||||
if ( !$nodetype) {
|
||||
my $rsp;
|
||||
$rsp->{errorcode}->[0] = [1];
|
||||
$rsp->{data}->[0]= "Not found the $node\'s nodetype";
|
||||
xCAT::MsgUtils->message('E', $rsp, $callback);
|
||||
return undef;
|
||||
}
|
||||
return $nodetype;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 fsp_api_create_partition
|
||||
=head3 fsp_api_partition_action
|
||||
Description:
|
||||
invoke the fsp_api to perform the functions
|
||||
|
||||
@@ -503,14 +313,13 @@ sub fsp_state_action {
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $res = xCAT::FSPUtils::fsp_api_create_partition($request, ... );
|
||||
my $res = xCAT::FSPUtils::fsp_api_action( $node_name, $d, "add_connection", $tooltype );
|
||||
Comments:
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub fsp_api_create_partition {
|
||||
my $request = shift;
|
||||
sub fsp_api_create_parttion {
|
||||
my $starting_lpar_id = shift;
|
||||
my $octant_cfg = shift;
|
||||
my $node_number = shift;
|
||||
@@ -548,9 +357,10 @@ sub fsp_api_create_partition {
|
||||
############################
|
||||
# Get IP address
|
||||
############################
|
||||
$fsp_ip = getIPaddress($request, $$attrs[4], $fsp_name );
|
||||
#$fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name );
|
||||
$fsp_ip = xCAT::Utils::getIPaddress( $fsp_name );
|
||||
if(!defined($fsp_ip) or ($fsp_ip == -3)) {
|
||||
$res = "Failed to get IP address for $fsp_name.";
|
||||
$res = "Failed to get the $fsp_name\'s ip";
|
||||
return ([$fsp_name, $res, -1]);
|
||||
}
|
||||
|
||||
|
||||
+56
-93
@@ -8,7 +8,6 @@ use xCAT::Usage;
|
||||
use xCAT::Utils;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::PPCboot;
|
||||
use xCAT::LparNetbootExp;
|
||||
|
||||
##########################################################################
|
||||
# Parse the command line for options and operands
|
||||
@@ -35,7 +34,6 @@ sub do_rnetboot {
|
||||
my $result = "";
|
||||
my $Rc = SUCCESS;
|
||||
my $cmd;
|
||||
my %optarg;
|
||||
|
||||
#######################################
|
||||
# Disconnect Expect session
|
||||
@@ -50,18 +48,18 @@ sub do_rnetboot {
|
||||
my $fsp = @$d[2];
|
||||
my $hcp = @$d[3];
|
||||
|
||||
########################################
|
||||
## Find Expect script
|
||||
########################################
|
||||
#$cmd = ($::XCATROOT) ? "$::XCATROOT/sbin/" : "/opt/xcat/sbin/";
|
||||
#$cmd .= "lpar_netboot.expect";
|
||||
#
|
||||
########################################
|
||||
## Check command installed
|
||||
########################################
|
||||
#if ( !-x $cmd ) {
|
||||
# return( [RC_ERROR,"Command not installed: $cmd"] );
|
||||
#}
|
||||
#######################################
|
||||
# Find Expect script
|
||||
#######################################
|
||||
$cmd = ($::XCATROOT) ? "$::XCATROOT/sbin/" : "/opt/xcat/sbin/";
|
||||
$cmd .= "lpar_netboot.expect";
|
||||
|
||||
#######################################
|
||||
# Check command installed
|
||||
#######################################
|
||||
if ( !-x $cmd ) {
|
||||
return( [RC_ERROR,"Command not installed: $cmd"] );
|
||||
}
|
||||
#######################################
|
||||
# Save user name and passwd of hcp to
|
||||
# environment variables.
|
||||
@@ -73,17 +71,14 @@ sub do_rnetboot {
|
||||
#######################################
|
||||
# Turn on verbose and debugging
|
||||
#######################################
|
||||
if ( ${$request->{arg}}[0] eq '-V' ) {
|
||||
#$cmd.= " -v -x";
|
||||
$optarg{'v'} = 1; #for verbose
|
||||
$optarg{'x'} = 1; #for debug
|
||||
if ( exists($request->{verbose}) ) {
|
||||
$cmd.= " -v -x";
|
||||
}
|
||||
#######################################
|
||||
# Force LPAR shutdown
|
||||
#######################################
|
||||
if ( exists( $opt->{f} ) || !xCAT::Utils->isAIX() ) {
|
||||
#$cmd.= " -i";
|
||||
$optarg{'i'} = 1;
|
||||
$cmd.= " -i";
|
||||
}
|
||||
|
||||
#######################################
|
||||
@@ -92,17 +87,13 @@ sub do_rnetboot {
|
||||
if ( exists( $opt->{s} )) {
|
||||
foreach ($opt->{s}) {
|
||||
if ( /^net$/ ) {
|
||||
#$cmd.= " -w 1";
|
||||
$optarg{'w'} = 1;
|
||||
$cmd.= " -w 1";
|
||||
} elsif ( /^net,hd$/ ) {
|
||||
#$cmd.= " -w 2";
|
||||
$optarg{'w'} = 2;
|
||||
$cmd.= " -w 2";
|
||||
} elsif ( /^hd,net$/ ) {
|
||||
#$cmd.= " -w 3";
|
||||
$optarg{'w'} = 3;
|
||||
$cmd.= " -w 3";
|
||||
} elsif ( /^hd$/ ) {
|
||||
#$cmd.= " -w 4";
|
||||
$optarg{'w'} = 4;
|
||||
$cmd.= " -w 4";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,26 +104,16 @@ sub do_rnetboot {
|
||||
#######################################
|
||||
# Network specified
|
||||
#######################################
|
||||
#$cmd.= " -s auto -d auto -m \"$mac\" -S $opt->{S} -G $opt->{G} -C $opt->{C}";
|
||||
$optarg{'s'} = 'auto';
|
||||
$optarg{'d'} = 'auto';
|
||||
$optarg{'m'} = $mac;
|
||||
$optarg{'S'} = $opt->{S};
|
||||
$optarg{'C'} = $opt->{C};
|
||||
$optarg{'N'} = $opt->{N};
|
||||
$optarg{'G'} = $opt->{G};
|
||||
$cmd.= " -s auto -d auto -m \"$mac\" -S $opt->{S} -G $opt->{G} -C $opt->{C}";
|
||||
if ( exists( $opt->{o} )) {
|
||||
#$cmd.= " -o";
|
||||
$optarg{'o'} = 1;
|
||||
$cmd.= " -o";
|
||||
}
|
||||
|
||||
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
|
||||
if ( grep /hf/, $client_nethash{$node}{mgtifname} ) {
|
||||
#$cmd.= " -t hfi-ent";
|
||||
$optarg{'t'} = "hfi-ent";
|
||||
$cmd.= " -t hfi-ent";
|
||||
} else {
|
||||
#$cmd.= " -t ent";
|
||||
$optarg{'t'} = "ent";
|
||||
$cmd.= " -t ent";
|
||||
}
|
||||
|
||||
$pprofile = "not_use"; #lpar_netboot.expect need pprofile for p5 & p6, but for p7 ih, we don't use this attribute.
|
||||
@@ -140,54 +121,43 @@ sub do_rnetboot {
|
||||
#######################################
|
||||
# Add command options
|
||||
#######################################
|
||||
#$cmd.= " -f \"$name\" \"$pprofile\" \"$fsp\" $id $hcp \"$node\"";
|
||||
#print "cmd: $cmd\n";
|
||||
$optarg{'f'} = 1;
|
||||
$optarg{'name'} = $name;
|
||||
$optarg{'pprofile'} = $pprofile;
|
||||
$optarg{'fsp'} = $fsp;
|
||||
$optarg{'id'} = $id;
|
||||
$optarg{'hcp'} = $hcp;
|
||||
$optarg{'node'} = $node;
|
||||
$cmd.= " -f \"$name\" \"$pprofile\" \"$fsp\" $id $hcp \"$node\"";
|
||||
print "cmd: $cmd\n";
|
||||
my $done = 0;
|
||||
while ( $done < 2 ) {
|
||||
$result = "";
|
||||
$Rc = SUCCESS;
|
||||
########################################
|
||||
## Execute command
|
||||
########################################
|
||||
#print "cmd:$cmd\n";
|
||||
#my $pid = open( OUTPUT, "$cmd 2>&1 |");
|
||||
#$SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down
|
||||
# kill 9, $pid;
|
||||
# return( [RC_ERROR,"Received INT or TERM signal"] );
|
||||
#};
|
||||
#if ( !$pid ) {
|
||||
# return( [RC_ERROR,"$cmd fork error: $!"] );
|
||||
#}
|
||||
########################################
|
||||
## Get command output
|
||||
########################################
|
||||
#while ( <OUTPUT> ) {
|
||||
# $result.=$_;
|
||||
#}
|
||||
#close OUTPUT;
|
||||
#######################################
|
||||
# Execute command
|
||||
#######################################
|
||||
print "cmd:$cmd\n";
|
||||
my $pid = open( OUTPUT, "$cmd 2>&1 |");
|
||||
$SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down
|
||||
kill 9, $pid;
|
||||
return( [RC_ERROR,"Received INT or TERM signal"] );
|
||||
};
|
||||
if ( !$pid ) {
|
||||
return( [RC_ERROR,"$cmd fork error: $!"] );
|
||||
}
|
||||
#######################################
|
||||
# Get command output
|
||||
#######################################
|
||||
while ( <OUTPUT> ) {
|
||||
$result.=$_;
|
||||
}
|
||||
close OUTPUT;
|
||||
|
||||
########################################
|
||||
## Get command exit code
|
||||
########################################
|
||||
#######################################
|
||||
# Get command exit code
|
||||
#######################################
|
||||
|
||||
foreach ( split /\n/, $result ) {
|
||||
if ( /^lpar_netboot / ) {
|
||||
$Rc = RC_ERROR;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
#foreach ( split /\n/, $result ) {
|
||||
# if ( /^lpar_netboot / ) {
|
||||
# $Rc = RC_ERROR;
|
||||
# last;
|
||||
# }
|
||||
#}
|
||||
#######################################
|
||||
# Invoke the lpar_netbootexp
|
||||
#######################################
|
||||
$result = xCAT::LparNetbootExp->lparnetbootexp(\%optarg, $request);
|
||||
$Rc = @$result[0];
|
||||
if ( $Rc == SUCCESS ) {
|
||||
$done = 2;
|
||||
} else {
|
||||
@@ -200,7 +170,7 @@ sub do_rnetboot {
|
||||
last;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
return( [$Rc,$result] );
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +185,7 @@ sub rnetboot {
|
||||
my $options = $request->{opt};
|
||||
my $hwtype = @$exp[2];
|
||||
my $result;
|
||||
my $name = $request->{node};
|
||||
my $name;
|
||||
my $callback = $request->{callback};
|
||||
#####################################
|
||||
# Get node data
|
||||
@@ -238,13 +208,6 @@ sub rnetboot {
|
||||
C => $o->{client},
|
||||
m => $o->{mac}
|
||||
);
|
||||
#####################################
|
||||
# Parse node range
|
||||
#####################################
|
||||
if ($name =~ /ARRAY/) {
|
||||
$name = join(',', @$name);
|
||||
}
|
||||
|
||||
#####################################
|
||||
# Strip colons from mac address
|
||||
#####################################
|
||||
|
||||
@@ -7,7 +7,6 @@ use Getopt::Long;
|
||||
use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT::FSPUtils;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
#use Data::Dumper;
|
||||
|
||||
##########################################################################
|
||||
@@ -47,7 +46,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt,qw(h|help V|verbose v|version ))) {
|
||||
if ( !GetOptions( \%opt,qw(h|help V|Verbose v|version ))) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@@ -98,11 +97,6 @@ sub parse_args {
|
||||
#print "in parse_args:\n";
|
||||
#print $command;
|
||||
#print Dumper(\%opt);
|
||||
|
||||
my $nodetype = xCAT::DBobjUtils->getnodetype($$node[0], "ppc");
|
||||
if( $nodetype =~ /^blade$/) {
|
||||
$request->{callback}->({data =>[ "After running rebootseq on the nodes successfully, it's required to run <rpower noderange reset> to make the setting be permanent"]});
|
||||
}
|
||||
|
||||
####################################
|
||||
# Set method to invoke
|
||||
@@ -136,32 +130,12 @@ sub rbootseq {
|
||||
#print "d";
|
||||
#print Dumper($d);
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "rbootseq START for node:$node_name, type=$$d[4].");
|
||||
if (!($$d[4] =~ /^(lpar|blade)$/)) {
|
||||
|
||||
if (!($$d[4] =~ /^lpar$/)) {
|
||||
push @output, [$node_name, "\'boot\' command not supported for CEC or BPA", -1 ];
|
||||
return (\@output);
|
||||
}
|
||||
# add checking the power state of the cec
|
||||
xCAT::MsgUtils->verbose_message($request, "rbootseq check machine state for node:$node_name.");
|
||||
my $power_state = xCAT::FSPUtils::fsp_api_action ($request, $node_name, $d, "cec_state", $tooltype);
|
||||
if ( @$power_state[2] != 0 ) {
|
||||
push @output, [$node_name, @$power_state[1], -1 ];
|
||||
return (\@output);
|
||||
}
|
||||
unless (@$power_state[1] and @$power_state[1] =~ /operating|standby/) {
|
||||
my $machine;
|
||||
my $state;
|
||||
if ($$d[4] eq 'blade') {
|
||||
$machine = "blade";
|
||||
$state = "on";
|
||||
} else {
|
||||
$machine = "CEC";
|
||||
$state = "power on";
|
||||
}
|
||||
|
||||
push @output, [$node_name, "\'boot\' command can only support while the $machine is in the \'$state\' state", -1];
|
||||
return (\@output);
|
||||
}
|
||||
|
||||
if( $opt->{net} ) {
|
||||
my $mactab = xCAT::Table->new( 'mac');
|
||||
unless($mactab) {
|
||||
@@ -207,18 +181,15 @@ sub rbootseq {
|
||||
push @output, [$node_name, "The mac address in mac table could NOT be used for rbootseq with -net. HFI mac , or other wrong format?", -1 ];
|
||||
return( \@output );
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "rbootseq <$node_name> net=$parameter");
|
||||
}
|
||||
|
||||
if( $opt->{hfi}) {
|
||||
|
||||
$parameter = "/hfi-iohub/hfi-ethernet:$o->{server},,$o->{client},$o->{gateway},$bootp_retries,$tftp_retries,$o->{netmask},$blksize";
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "rbootseq <$node_name> hfi=$parameter");
|
||||
}
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "rbootseq set_lpar_bootstring for node:$node_name.");
|
||||
my $res = xCAT::FSPUtils::fsp_api_action ($request, $node_name, $d, "set_lpar_bootstring", $tooltype, $parameter);
|
||||
my $res = xCAT::FSPUtils::fsp_api_action ($node_name, $d, "set_lpar_bootstring", $tooltype, $parameter);
|
||||
#print "In boot, state\n";
|
||||
#print Dumper($res);
|
||||
my $Rc = @$res[2];
|
||||
@@ -227,7 +198,6 @@ sub rbootseq {
|
||||
##################################
|
||||
# Output error
|
||||
##################################
|
||||
xCAT::MsgUtils->verbose_message($request, "rbootseq return:$Rc.");
|
||||
if ( $Rc != SUCCESS ) {
|
||||
push @output, [$node_name,$data,$Rc];
|
||||
} else {
|
||||
|
||||
+30
-49
@@ -5,12 +5,10 @@ use strict;
|
||||
use Getopt::Long;
|
||||
use xCAT::Usage;
|
||||
use xCAT::Utils;
|
||||
use xCAT::FSPUtils;
|
||||
use xCAT::TableUtils;
|
||||
use xCAT::PPCcfg;
|
||||
#use Data::Dumper;
|
||||
#use xCAT::PPCcli;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
|
||||
|
||||
##########################################
|
||||
# Globals
|
||||
@@ -76,7 +74,6 @@ sub parse_args {
|
||||
"general_passwd",
|
||||
"*_passwd",
|
||||
"resetnet",
|
||||
"cec_off_policy"
|
||||
);
|
||||
my @bpa = (
|
||||
"frame",
|
||||
@@ -111,18 +108,11 @@ sub parse_args {
|
||||
"pending_power_on_side"
|
||||
);
|
||||
|
||||
my @blade = (
|
||||
"cec_off_policy",
|
||||
"pending_power_on_side"
|
||||
);
|
||||
|
||||
|
||||
|
||||
my %rsp = (
|
||||
fsp => \@fsp,
|
||||
bpa => \@bpa,
|
||||
cec => \@cec,
|
||||
blade => \@blade,
|
||||
frame => \@frame,
|
||||
);
|
||||
#############################################
|
||||
@@ -143,14 +133,13 @@ sub parse_args {
|
||||
#}
|
||||
|
||||
my $nodes = $request->{node};
|
||||
my $typehash = xCAT::DBobjUtils->getnodetype($nodes, "ppc");
|
||||
foreach my $nn (@$nodes) {
|
||||
$request->{hwtype} =$$typehash{$nn};
|
||||
$request->{hwtype} = xCAT::DBobjUtils->getnodetype($nn);
|
||||
last if ($request->{hwtype});
|
||||
}
|
||||
|
||||
my $supported = $rsp{$request->{hwtype}};
|
||||
|
||||
|
||||
#############################################
|
||||
# Responds with usage statement
|
||||
#############################################
|
||||
@@ -174,7 +163,7 @@ sub parse_args {
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
$request->{method} = undef;
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose resetnet))) {
|
||||
if ( !GetOptions( \%opt, qw(V|Verbose resetnet))) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@@ -199,7 +188,7 @@ sub parse_args {
|
||||
my ($command,$value) = split( /=/, $arg );
|
||||
if ( !grep( /^$command$/, @$supported) and !$opt{resetnet}) {
|
||||
$request->{arg} = [$arg];
|
||||
my $res = xCAT::PPCcfg::parse_args($request, @_);
|
||||
my $res = xCAT::PPCcfg::parse_args($request, @_);
|
||||
if (ref($res) eq 'ARRAY') {
|
||||
my $check_cmd = &check_command($command, \%rsp);
|
||||
if (!defined($check_cmd)) {
|
||||
@@ -217,15 +206,14 @@ sub parse_args {
|
||||
return(usage( "Command multiple times: $command" ));
|
||||
}
|
||||
$cmds{$command} = $value;
|
||||
}
|
||||
|
||||
}
|
||||
$request->{arg} = \@arg_array;
|
||||
if (scalar(@fsp_cmds) && scalar(@ppc_cmds)) {
|
||||
my $fsp_cmds_string = &array_to_string(\@fsp_cmds);
|
||||
my $ppc_cmds_string = &array_to_string(\@ppc_cmds);
|
||||
return (usage("Invalid command array: $fsp_cmds_string can not execute with $ppc_cmds_string."));
|
||||
} elsif(scalar(@ppc_cmds)) {
|
||||
my @enableASMI = xCAT::TableUtils->get_site_attribute("enableASMI");
|
||||
my @enableASMI = xCAT::Utils->get_site_attribute("enableASMI");
|
||||
if (defined($enableASMI[0])) {
|
||||
$enableASMI[0] =~ tr/a-z/A-Z/; # convert to upper
|
||||
if (($enableASMI[0] eq "1") || ($enableASMI[0] eq "YES")) {
|
||||
@@ -249,7 +237,6 @@ sub parse_args {
|
||||
return( usage("No argument specified for '$_'"));
|
||||
}
|
||||
}
|
||||
|
||||
####################################
|
||||
# Return method to invoke
|
||||
####################################
|
||||
@@ -262,7 +249,7 @@ sub parse_args {
|
||||
####################################
|
||||
if ( exists($cmds{frame}) or exists($cmds{cec_off_policy})) {
|
||||
$request->{hcp} = (exists($cmds{frame})) ? "bpa" : "fsp";
|
||||
$request->{method} = "cfg";
|
||||
$request->{method} = "cfg";
|
||||
return( \%opt );
|
||||
}
|
||||
|
||||
@@ -288,6 +275,7 @@ sub parse_args {
|
||||
$request->{method} = "passwd";
|
||||
return( \%opt );
|
||||
}
|
||||
|
||||
$request->{method} = \%cmds;
|
||||
return( \%opt );
|
||||
}
|
||||
@@ -369,7 +357,7 @@ sub check_node_info {
|
||||
my $invalid_node = undef;
|
||||
while (my ($mtsm, $h) = each (%$hash)) {
|
||||
while (my ($name, $d) = each(%$h)) {
|
||||
if (@$d[4] !~ /^(cec|frame|blade)$/) {
|
||||
if (@$d[4] !~ /^(cec|frame)$/) {
|
||||
$invalid_node = $name;
|
||||
last;
|
||||
}
|
||||
@@ -392,12 +380,10 @@ my %fspapi_action = (
|
||||
pending_power_on_side => {
|
||||
query => {
|
||||
cec => "list_firmware_level",
|
||||
blade => "list_firmware_level",
|
||||
frame => "list_firmware_level"
|
||||
},
|
||||
set => {
|
||||
cec => "set_ipl_param",
|
||||
blade => "set_ipl_param",
|
||||
frame => "set_ipl_param"
|
||||
}
|
||||
},
|
||||
@@ -467,8 +453,7 @@ sub do_query {
|
||||
while (my ($mtms, $h) = each(%$hash)) {
|
||||
while (my($name, $d) = each(%$h)) {
|
||||
my $action = $fspapi_action{$cmd}{query}{@$d[4]};
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :$action for node:$name.");
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action);
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($name, $d, $action);
|
||||
&do_process_query_res($name, $cmd, \@result, $values);
|
||||
#my $res = &do_process_query_res($name, $cmd, \@result, $values);
|
||||
#if (defined($res)) {
|
||||
@@ -514,9 +499,8 @@ sub do_set {
|
||||
while (my ($mtms, $h) = each(%$hash)) {
|
||||
while (my($name, $d) = each(%$h)) {
|
||||
my $action = $fspapi_action{$cmd}{set}{@$d[4]};
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :$action for node:$name, param:$value.");
|
||||
my $para = &do_set_get_para($name, $cmd, $value);
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action, 0, $para);
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($name, $d, $action, 0, $para);
|
||||
# print Dumper($values);
|
||||
&do_process_set_res($name, $cmd, \@result, $values);
|
||||
#my $res = &do_process_set_res($name, $cmd, \@result, $values);
|
||||
@@ -598,8 +582,7 @@ sub passwd {
|
||||
while ( my ($node,$d) = each(%$h) ) {
|
||||
my $type = @$d[4];
|
||||
my $fsp_api = ($::XCATROOT) ? "$::XCATROOT/sbin/fsp-api" : "/opt/xcat/sbin/fsp-api";
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :modify password of $usr for node:$node.");
|
||||
my $cmd = xCAT::FSPcfg::fsp_api_passwd ($request, $node, $d, $usr, $passwd, $newpasswd);
|
||||
my $cmd = xCAT::FSPcfg::fsp_api_passwd ($node, $d, $usr, $passwd, $newpasswd);
|
||||
my $Rc = @$cmd[2];
|
||||
my $data = @$cmd[1];
|
||||
my $usr_back = $usr;
|
||||
@@ -611,7 +594,6 @@ sub passwd {
|
||||
# Write the new password to table
|
||||
##################################
|
||||
if ( $Rc == 0 ) {
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :update xCATdb for node:$node,ID:$usr.");
|
||||
xCAT::PPCdb::update_credentials( $node, $type, $usr, $newpasswd );
|
||||
}
|
||||
}
|
||||
@@ -682,8 +664,7 @@ sub frame {
|
||||
# Get frame number
|
||||
#################################
|
||||
#$data = xCAT::PPCcli::lssyscfg( $exp, @$d[4], @$d[2], 'frame_num' );
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :get_frame_number for node:$node.");
|
||||
$data = xCAT::FSPUtils::fsp_api_action( $request, $node, $d, "get_frame_number");
|
||||
$data = xCAT::FSPUtils::fsp_api_action( $node, $d, "get_frame_number");
|
||||
$Rc = pop(@$data);
|
||||
|
||||
#################################
|
||||
@@ -714,8 +695,7 @@ sub frame {
|
||||
return( [[$node,"Cannot find frame num in database", -1]] );
|
||||
}
|
||||
#$data = xCAT::PPCcli::chsyscfg( $exp, "bpa", $d, "frame_num=".$ent->{id} );
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :set_frame_number for node:$node,id:$ent->{id}.");
|
||||
$data = xCAT::FSPUtils::fsp_api_action( $request, $node, $d, "set_frame_number", 0, $ent->{id});
|
||||
$data = xCAT::FSPUtils::fsp_api_action( $node, $d, "set_frame_number", 0, $ent->{id});
|
||||
$Rc = pop(@$data);
|
||||
|
||||
#################################
|
||||
@@ -734,8 +714,7 @@ sub frame {
|
||||
# Read the frame number from opt
|
||||
#################################
|
||||
#$data = xCAT::PPCcli::chsyscfg( $exp, "bpa", $d, "frame_num=$value" );
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :set_frame_number for node:$node,id:$value.");
|
||||
$data = xCAT::FSPUtils::fsp_api_action( $request, $node, $d, "set_frame_number", 0, $value);
|
||||
$data = xCAT::FSPUtils::fsp_api_action( $node, $d, "set_frame_number", 0, $value);
|
||||
$Rc = pop(@$data);
|
||||
|
||||
#################################
|
||||
@@ -765,7 +744,7 @@ sub cec_off_policy {
|
||||
my $value = shift;
|
||||
my $hash = shift;
|
||||
my $arg = $request->{arg};
|
||||
|
||||
|
||||
foreach ( @$arg ) {
|
||||
my $result;
|
||||
my $Rc;
|
||||
@@ -783,8 +762,7 @@ sub cec_off_policy {
|
||||
#################################
|
||||
# Get platform IPL parameters
|
||||
#################################
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :get_phyp_cfg_power_off_policy for node:$node.");
|
||||
$data = xCAT::FSPUtils::fsp_api_action( $request, $node, $d, "get_phyp_cfg_power_off_policy");
|
||||
$data = xCAT::FSPUtils::fsp_api_action( $node, $d, "get_phyp_cfg_power_off_policy");
|
||||
$Rc = pop(@$data);
|
||||
|
||||
#################################
|
||||
@@ -803,13 +781,12 @@ sub cec_off_policy {
|
||||
#################################
|
||||
# Set cec off policy
|
||||
#################################
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :set power_off_policy for node:$node,policy:$value.");
|
||||
if( $value eq "poweroff") {
|
||||
$value = "cec_off_policy_poweroff";
|
||||
} else {
|
||||
$value = "cec_off_policy_stayon";
|
||||
}
|
||||
$data = xCAT::FSPUtils::fsp_api_action( $request, $node, $d, $value);
|
||||
$data = xCAT::FSPUtils::fsp_api_action( $node, $d, $value);
|
||||
$Rc = pop(@$data);
|
||||
|
||||
#################################
|
||||
@@ -841,7 +818,6 @@ sub cec_off_policy {
|
||||
# Invoke fsp_api to change the passwords and store updated passwd in db
|
||||
##########################################################################
|
||||
sub fsp_api_passwd {
|
||||
my $request = shift;
|
||||
my $node_name = shift;
|
||||
my $attrs = shift;
|
||||
my $user = shift;
|
||||
@@ -872,10 +848,9 @@ sub fsp_api_passwd {
|
||||
############################
|
||||
# Get IP address
|
||||
############################
|
||||
#$fsp_ip = xCAT::NetworkUtils::get_hdwr_ip($fsp_name);
|
||||
#$fsp_ip = xCAT::NetworkUtils::getNodeIPaddress($fsp_name);
|
||||
#$fsp_ip = xCAT::Utils::getIPaddress($fsp_name);
|
||||
$fsp_ip = xCAT::FSPUtils::getIPaddress($request, $$attrs[4], $fsp_name );
|
||||
#$fsp_ip = xCAT::Utils::get_hdwr_ip($fsp_name);
|
||||
#$fsp_ip = xCAT::Utils::getNodeIPaddress($fsp_name);
|
||||
$fsp_ip = xCAT::Utils::getIPaddress($fsp_name);
|
||||
if(!defined($fsp_ip) or ($fsp_ip == -3)) {
|
||||
$res = "Failed to get IP address for $fsp_name.";
|
||||
return ([$node_name, $res, -1]);
|
||||
@@ -914,8 +889,14 @@ sub fsp_api_passwd {
|
||||
##########################################################################
|
||||
sub resetnet {
|
||||
my $request = shift;
|
||||
xCAT::PPCcfg::doresetnet($request);
|
||||
return 0;
|
||||
my $hash = shift;
|
||||
my %nodehash;
|
||||
foreach ( @{$request->{noderange}}) {
|
||||
$nodehash{$_} = 1;
|
||||
}
|
||||
# go to use lsslp do_resetnet
|
||||
my $result = xCAT_plugin::lsslp::do_resetnet($request, \%nodehash);
|
||||
return [$result];
|
||||
}
|
||||
1;
|
||||
|
||||
|
||||
+31
-67
@@ -8,7 +8,6 @@ use xCAT::Usage;
|
||||
#use Data::Dumper;
|
||||
use xCAT::FSPUtils;
|
||||
use xCAT::PPCconn;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
|
||||
##############################################
|
||||
# Globals
|
||||
@@ -93,7 +92,6 @@ sub mkhwconn_parse_args
|
||||
my $vpdtab = xCAT::Table->new( 'vpd');
|
||||
my @bpa_ctrled_nodes = ();
|
||||
my @no_type_nodes = ();
|
||||
my @error_type_nodes = ();
|
||||
my @frame_members = ();
|
||||
|
||||
###########################################
|
||||
@@ -103,7 +101,7 @@ sub mkhwconn_parse_args
|
||||
{
|
||||
#my $nodetype_hash = $nodetypetab->getNodeAttribs( $opt{p},[qw(nodetype)]);
|
||||
#my $nodetype = $nodetype_hash->{nodetype};
|
||||
my $nodetype = xCAT::DBobjUtils->getnodetype($opt{p}, "ppc");
|
||||
my $nodetype = xCAT::DBobjUtils->getnodetype($opt{p});
|
||||
if( !defined($nodetype) ) {
|
||||
return(usage("Something wrong with the specified HMC (-p Option). The HMC type doesn't exist."));
|
||||
}
|
||||
@@ -116,8 +114,7 @@ sub mkhwconn_parse_args
|
||||
if ( $ppctab)
|
||||
{
|
||||
my $hcp_nodetype = undef;
|
||||
my $typehash = xCAT::DBobjUtils->getnodetype($nodes, "ppc");
|
||||
for my $node (@$nodes)
|
||||
for my $node ( @$nodes)
|
||||
{
|
||||
my $node_parent = undef;
|
||||
my $nodetype = undef;
|
||||
@@ -131,7 +128,7 @@ sub mkhwconn_parse_args
|
||||
{
|
||||
#my $node_hcp_nodetype_hash = $nodetypetab->getNodeAttribs($node_hcp_hash->{hcp},[qw(nodetype)]);
|
||||
#$node_hcp_nodetype = $node_hcp_nodetype_hash->{nodetype};
|
||||
$node_hcp_nodetype = xCAT::DBobjUtils->getnodetype($node_hcp_hash->{hcp}, "ppc");
|
||||
$node_hcp_nodetype = xCAT::DBobjUtils->getnodetype($node_hcp_hash->{hcp});
|
||||
}
|
||||
if ( defined $hcp_nodetype )
|
||||
{
|
||||
@@ -151,7 +148,7 @@ sub mkhwconn_parse_args
|
||||
|
||||
}
|
||||
#$nodetype = $nodetype_hash->{nodetype};
|
||||
$nodetype = $$typehash{$node};
|
||||
$nodetype = xCAT::DBobjUtils->getnodetype($node);
|
||||
$node_parent = $node_parent_hash->{parent};
|
||||
if ( !$nodetype )
|
||||
{
|
||||
@@ -159,10 +156,9 @@ sub mkhwconn_parse_args
|
||||
next;
|
||||
} else
|
||||
{
|
||||
unless ( $nodetype =~ /^(fsp|bpa|frame|cec|hmc|blade)$/)
|
||||
unless ( $nodetype =~ /^(fsp|bpa|frame|cec|hmc)$/)
|
||||
{
|
||||
push @error_type_nodes, $node;
|
||||
next;
|
||||
return ( usage("Node type is incorrect. \n"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,12 +187,9 @@ sub mkhwconn_parse_args
|
||||
if (scalar(@no_type_nodes))
|
||||
{
|
||||
my $tmp_nodelist = join ',', @no_type_nodes;
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist. Please define first and try again.\n"));
|
||||
}
|
||||
if (scalar(@error_type_nodes)) {
|
||||
my $tmp_nodelist = join ',', @error_type_nodes;
|
||||
return ( usage("Incorrect nodetype for nodes(s): $tmp_nodelist. Please modify first and try again.\n"));
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist"));
|
||||
}
|
||||
|
||||
#if (scalar(@bpa_ctrled_nodes))
|
||||
#{
|
||||
# my $tmp_nodelist = join ',', @bpa_ctrled_nodes;
|
||||
@@ -231,13 +224,9 @@ sub mkhwconn_parse_args
|
||||
$opt{port} = "[0|1]";
|
||||
} elsif( $opt{port} ne "0" and $opt{port} ne "1")
|
||||
{
|
||||
if ($opt{port} eq "0,1") {
|
||||
return ([0, "The option --port only be used to specify special port value, please don't specify this value if you want to use all ports."]);
|
||||
} else {
|
||||
return( usage('Wrong value of --port option. The value can only be 0 or 1.'));
|
||||
}
|
||||
return( usage('Wrong value of --port option. The value can be 0 or 1, and the default value is 0.'));
|
||||
}
|
||||
|
||||
|
||||
$ppctab->close();
|
||||
#$nodetypetab->close();
|
||||
$vpdtab->close();
|
||||
@@ -360,30 +349,23 @@ sub lshwconn_parse_args
|
||||
}
|
||||
|
||||
my $nodetype;
|
||||
my @no_typenodes = ();
|
||||
my @no_mgt_nodes = ();
|
||||
my @error_type_nodes = ();
|
||||
my $typehash = xCAT::DBobjUtils->getnodetype(\@{$request->{node}}, "ppc");
|
||||
for my $node ( @{$request->{node}})
|
||||
{
|
||||
#my $ent = $nodetypetab->getNodeAttribs( $node, [qw(nodetype)]);
|
||||
my $nodehm = $nodehmtab->getNodeAttribs( $node, [qw(mgt)]);
|
||||
if ( ! $nodehm)
|
||||
#if ( ! $ent)
|
||||
#{
|
||||
# return( ["Failed to get node type for node $node.\n"]);
|
||||
#}
|
||||
my $ttype = xCAT::DBobjUtils->getnodetype($node);
|
||||
if ( ! $ttype)
|
||||
{
|
||||
push @no_mgt_nodes, $node;
|
||||
next;
|
||||
}
|
||||
my $ttype = $$typehash{$node};
|
||||
if ( !$ttype)
|
||||
{
|
||||
push @no_typenodes, $node;
|
||||
next;
|
||||
return( ["Failed to get nodehm.mgt value for node $node.\n"]);
|
||||
}
|
||||
if ( $ttype ne 'fsp' and $ttype ne 'cec'
|
||||
and $ttype ne 'bpa' and $ttype ne 'frame' and $ttype ne 'blade')
|
||||
and $ttype ne 'bpa' and $ttype ne 'frame')
|
||||
{
|
||||
push @error_type_nodes, $node;
|
||||
next;
|
||||
return( ["Node type $ttype is not supported for this command in FSPAPI\n"]);
|
||||
}
|
||||
if ( ! $nodetype)
|
||||
{
|
||||
@@ -397,19 +379,7 @@ sub lshwconn_parse_args
|
||||
}
|
||||
}
|
||||
}
|
||||
if (scalar(@no_typenodes)) {
|
||||
my $tmp_nodelist = join ',', @no_typenodes;
|
||||
return ( ["Attribute nodetype.nodetype cannot be found for node(s): $tmp_nodelist. Please define first and try again.\n"]);
|
||||
}
|
||||
if (scalar(@no_mgt_nodes)) {
|
||||
my $tmp_nodelist = join ',', @no_mgt_nodes;
|
||||
return( ["Failed to get nodehm.mgt value for node(s) $tmp_nodelist. Please define first and try again.\n"]);
|
||||
}
|
||||
if (scalar(@error_type_nodes)) {
|
||||
my $tmp_nodelist = join ',', @error_type_nodes;
|
||||
my $link = (scalar(@error_type_nodes) == '1')? 'is':'are';
|
||||
return( ["Node type of node(s) $tmp_nodelist $link not supported for this command in FSPAPI.\n"]);
|
||||
}
|
||||
|
||||
#$nodetypetab->close();
|
||||
$nodehmtab->close();
|
||||
|
||||
@@ -485,22 +455,21 @@ sub rmhwconn_parse_args
|
||||
return( ["Failed to open table 'nodehm'.\n"]) if (! $nodehmtab);
|
||||
my @bpa_ctrled_nodes = ();
|
||||
my @no_type_nodes = ();
|
||||
my @no_mgt_nodes = ();
|
||||
my @frame_members = ();
|
||||
my $nodetype_hash = xCAT::DBobjUtils->getnodetype($nodes, "ppc");
|
||||
for my $node ( @$nodes)
|
||||
{
|
||||
my $nodehm = $nodehmtab->getNodeAttribs( $node, [qw(mgt)]);
|
||||
if ( ! $nodehm)
|
||||
{
|
||||
push @no_mgt_nodes, $node;
|
||||
next;
|
||||
return( ["Failed to get nodehm.mgt value for node $node.\n"]);
|
||||
}
|
||||
|
||||
my $node_parent = undef;
|
||||
my $nodetype = undef;
|
||||
my $node_parent_hash = $ppctab->getNodeAttribs($node,[qw(parent)]);
|
||||
$nodetype = $$nodetype_hash{$node};
|
||||
#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);
|
||||
$node_parent = $node_parent_hash->{parent};
|
||||
if ( !$nodetype)
|
||||
{
|
||||
@@ -531,12 +500,9 @@ sub rmhwconn_parse_args
|
||||
if (scalar(@no_type_nodes))
|
||||
{
|
||||
my $tmp_nodelist = join ',', @no_type_nodes;
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist. Please define first and try again.\n"));
|
||||
}
|
||||
if (scalar(@no_mgt_nodes)) {
|
||||
my $tmp_nodelist = join ',', @no_mgt_nodes;
|
||||
return( ["Failed to get nodehm.mgt value for node(s) $tmp_nodelist. Please define first and try again.\n"]);
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist"));
|
||||
}
|
||||
|
||||
$ppctab->close();
|
||||
#$nodetypetab->close();
|
||||
$vpdtab->close();
|
||||
@@ -572,7 +538,7 @@ sub mkhwconn
|
||||
my $Rc = undef;
|
||||
my $tooltype= $opt->{T};
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "mkhwconn START.");
|
||||
|
||||
for my $cec_bpa ( keys %$hash)
|
||||
{
|
||||
my $node_hash = $hash->{$cec_bpa};
|
||||
@@ -597,8 +563,7 @@ sub mkhwconn
|
||||
|
||||
#}
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "mkhwconn :add_connection for node:$node_name.");
|
||||
my $res = xCAT::FSPUtils::fsp_api_action($request, $node_name, $d, "add_connection", $tooltype, $opt->{port} );
|
||||
my $res = xCAT::FSPUtils::fsp_api_action( $node_name, $d, "add_connection", $tooltype, $opt->{port} );
|
||||
$Rc = @$res[2];
|
||||
if( @$res[1] ne "") {
|
||||
push @value, [$node_name, @$res[1], $Rc];
|
||||
@@ -606,7 +571,6 @@ sub mkhwconn
|
||||
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "mkhwconn END.");
|
||||
return \@value;
|
||||
}
|
||||
##########################################################################
|
||||
@@ -631,7 +595,7 @@ sub lshwconn
|
||||
{
|
||||
my $d = $node_hash->{$node_name};
|
||||
my $action = "query_connection";
|
||||
my $res = xCAT::FSPUtils::fsp_api_action ($request, $node_name, $d, $action, $tooltype);
|
||||
my $res = xCAT::FSPUtils::fsp_api_action ($node_name, $d, $action, $tooltype);
|
||||
#print "in lshwconn:\n";
|
||||
#print Dumper($res);
|
||||
my $Rc = @$res[2];
|
||||
@@ -700,7 +664,7 @@ sub rmhwconn
|
||||
|
||||
my ( undef,undef,undef,undef,$type) = @$d;
|
||||
|
||||
my $res = xCAT::FSPUtils::fsp_api_action($request, $node_name, $d, "rm_connection", $tooltype );
|
||||
my $res = xCAT::FSPUtils::fsp_api_action( $node_name, $d, "rm_connection", $tooltype );
|
||||
$Rc = @$res[2];
|
||||
if( @$res[1] ne "") {
|
||||
push @value, [$node_name, @$res[1], $Rc];
|
||||
|
||||
+14
-26
@@ -44,11 +44,7 @@ sub dpush {
|
||||
# Parse the command line for options and operands
|
||||
##########################################################################
|
||||
sub parse_args {
|
||||
my $req = shift;
|
||||
$req->{mgt} = __PACKAGE__;
|
||||
my $opt = xCAT::PPCrflash::parse_args($req);
|
||||
delete($req->{mgt});
|
||||
return $opt;
|
||||
xCAT::PPCrflash::parse_args(@_);
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
@@ -150,9 +146,9 @@ sub get_lic_filenames {
|
||||
# return ("", "","", $msg, -1);
|
||||
# }
|
||||
} else {
|
||||
$msg = $msg . "Upgrade $mtms!";
|
||||
if($activate !~ /^(disruptive|deferred)$/) {
|
||||
$msg = "Option --activate's value shouldn't be $activate, and it must be disruptive or deferred";
|
||||
$msg = $msg . "Upgrade $mtms disruptively!";
|
||||
if($activate ne "disruptive") {
|
||||
$msg = "Option --activate's value shouldn't be concurrent, and it must be disruptive";
|
||||
return ("", "","", $msg, -1);
|
||||
}
|
||||
}
|
||||
@@ -252,7 +248,7 @@ sub rflash {
|
||||
|
||||
if( !defined($housekeeping) && ($$d[4] =~ /^fsp$/ || $$d[4] =~ /^lpar$/ || $$d[4] =~ /^cec$/)) {
|
||||
$action = "get_compatible_version_from_rpm";
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action, 0, $request->{opt}->{d} );
|
||||
my $values = xCAT::FSPUtils::fsp_api_action( $name, $d, $action, 0, $request->{opt}->{d} );
|
||||
my $Rc = @$values[2];
|
||||
my $v = @$values[1];
|
||||
if ($Rc != 0) {
|
||||
@@ -264,12 +260,11 @@ sub rflash {
|
||||
my @levels = split(/,/, $v);
|
||||
|
||||
my $frame = $$d[5];
|
||||
my $type = xCAT::DBobjUtils->getnodetype($frame);
|
||||
if ( ( $frame ne $name ) && ( $type eq "frame" ) && $activate !~ /^deferred$/){
|
||||
if ( $frame ne $name ) {
|
||||
|
||||
my @frame_d = (0, 0, 0, $frame, "frame", 0);
|
||||
$action = "list_firmware_level";
|
||||
$values = xCAT::FSPUtils::fsp_api_action($request, $frame, \@frame_d, $action );
|
||||
$values = xCAT::FSPUtils::fsp_api_action( $frame, \@frame_d, $action );
|
||||
$Rc = @$values[2];
|
||||
my $frame_firmware_level = @$values[1];
|
||||
if ($Rc != 0) {
|
||||
@@ -304,7 +299,7 @@ sub rflash {
|
||||
}
|
||||
|
||||
if(!defined($housekeeping)) {
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "list_firmware_level");
|
||||
my $values = xCAT::FSPUtils::fsp_api_action( $name, $d, "list_firmware_level");
|
||||
my $Rc = @$values[2];
|
||||
my $level = @$values[1];
|
||||
#####################################
|
||||
@@ -331,14 +326,11 @@ sub rflash {
|
||||
|
||||
if($housekeeping =~ /^commit$/) { $action = "code_commit"}
|
||||
if($housekeeping =~ /^recover$/) { $action = "code_reject"}
|
||||
if($housekeeping =~ /^bpa_acdl$/) { $action = "acdl"}
|
||||
if($activate eq "disruptive") {
|
||||
if($activate =~ /^disruptive$/) {
|
||||
$action = "code_update";
|
||||
} elsif ($activate eq "deferred") {
|
||||
$action = "code_updateD";
|
||||
} elsif (defined($activate)){
|
||||
#if($activate =~ /^concurrent$/) {
|
||||
my $res = "\'$activate\' option not supported in FSPflash. Please use disruptive or deferred mode";
|
||||
}
|
||||
if($activate =~ /^concurrent$/) {
|
||||
my $res = "\'concurrent\' option not supported in FSPflash.Please use disruptive mode";
|
||||
push @value, [$name, $res, -1];
|
||||
next;
|
||||
}
|
||||
@@ -355,12 +347,8 @@ sub rflash {
|
||||
dpush ( \@value, [$name, $msg]);
|
||||
}
|
||||
|
||||
my $res = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action, 0, $request->{opt}->{d} );
|
||||
if ($action eq "acdl" && @$res[2] eq '0') {
|
||||
push(@value, [$name, "Success", '0']);
|
||||
} else {
|
||||
push(@value,[$name, @$res[1], @$res[2]]);
|
||||
}
|
||||
my $res = xCAT::FSPUtils::fsp_api_action( $name, $d, $action, 0, $request->{opt}->{d} );
|
||||
push(@value,[$name, @$res[1], @$res[2]]);
|
||||
return (\@value);
|
||||
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose x) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|Verbose x) )) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@@ -142,7 +142,7 @@ sub firmware {
|
||||
#####################################
|
||||
# Command only supported on FSP/BPA/LPARs
|
||||
#####################################
|
||||
if ( @$d[4] !~ /^(cec|frame|fsp|bpa|lpar|blade)$/ ) {
|
||||
if ( @$d[4] !~ /^(cec|frame|fsp|bpa|lpar)$/ ) {
|
||||
push @result,
|
||||
[$name,"Information only available for CEC/FSP/Frame/BPA/LPAR",RC_ERROR];
|
||||
next;
|
||||
@@ -154,7 +154,7 @@ sub firmware {
|
||||
@$d[4] = "fsp";
|
||||
@$d[0] = 0;
|
||||
}
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "list_firmware_level");
|
||||
my $values = xCAT::FSPUtils::fsp_api_action( $name, $d, "list_firmware_level");
|
||||
my $Rc = @$values[2];
|
||||
my $data = @$values[1];
|
||||
#print "values";
|
||||
@@ -248,7 +248,7 @@ sub deconfig {
|
||||
# @$d[4] = "fsp";
|
||||
# @$d[0] = 0;
|
||||
#}
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "get_cec_deconfigured");
|
||||
my $values = xCAT::FSPUtils::fsp_api_action( $name, $d, "get_cec_deconfigured");
|
||||
my $Rc = @$values[2];
|
||||
my $data = @$values[1];
|
||||
#print "values";
|
||||
@@ -287,21 +287,15 @@ sub deconfig {
|
||||
my $Location_code;
|
||||
my $RID;
|
||||
my $TYPE;
|
||||
my $dres;
|
||||
if (ref($node->{GARDRECORD}) eq "ARRAY") {
|
||||
$dres = $node->{GARDRECORD};
|
||||
} elsif (ref($node->{GARDRECORD}) eq "HASH") {
|
||||
push @$dres, $node->{GARDRECORD};
|
||||
} else {
|
||||
if(ref($node->{GARDRECORD}) ne "ARRAY") {
|
||||
push @result,[$name,"NO Deconfigured resources", 0];
|
||||
return( \@result );
|
||||
}
|
||||
push @result,[$name,"Deconfigured resources", 0];
|
||||
push @result,[$name,"Location_code RID Call_Out_Method Call_Out_Hardware_State TYPE", 0];
|
||||
push @result,[$name,"$node->{Location_code} $node->{RID}", 0];
|
||||
foreach my $unit(@{$node->{GARDRECORD}}) {
|
||||
|
||||
#foreach my $unit(@{$node->{GARDRECORD}}) {
|
||||
foreach my $unit(@$dres) {
|
||||
while (my ($key, $unit3) = each(%$unit) ) {
|
||||
|
||||
if($key eq "GARDUNIT") {
|
||||
|
||||
+64
-105
@@ -6,8 +6,7 @@ use strict;
|
||||
use Getopt::Long;
|
||||
use xCAT::PPCmac;
|
||||
use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
use xCAT::LparNetbootExp;
|
||||
|
||||
##########################################################################
|
||||
# Parse the command line for options and operands
|
||||
##########################################################################
|
||||
@@ -30,7 +29,6 @@ sub do_getmacs {
|
||||
my $ssh = @$exp[0];
|
||||
my $userid = @$exp[4];
|
||||
my $pw = @$exp[5];
|
||||
my %optarg;
|
||||
my $cmd;
|
||||
my $result;
|
||||
|
||||
@@ -47,18 +45,18 @@ sub do_getmacs {
|
||||
my $fsp = @$d[2];
|
||||
my $hcp = @$d[3];
|
||||
|
||||
########################################
|
||||
## Find Expect script
|
||||
########################################
|
||||
#$cmd = ($::XCATROOT) ? "$::XCATROOT/sbin/" : "/opt/xcat/sbin/";
|
||||
#$cmd .= "lpar_netboot.expect";
|
||||
#
|
||||
########################################
|
||||
## Check command installed
|
||||
########################################
|
||||
#if ( !-x $cmd ) {
|
||||
# return( [RC_ERROR,"Command not installed: $cmd"] );
|
||||
#}
|
||||
#######################################
|
||||
# Find Expect script
|
||||
#######################################
|
||||
$cmd = ($::XCATROOT) ? "$::XCATROOT/sbin/" : "/opt/xcat/sbin/";
|
||||
$cmd .= "lpar_netboot.expect";
|
||||
|
||||
#######################################
|
||||
# Check command installed
|
||||
#######################################
|
||||
if ( !-x $cmd ) {
|
||||
return( [RC_ERROR,"Command not installed: $cmd"] );
|
||||
}
|
||||
#######################################
|
||||
# Save user name and passwd of hcp to
|
||||
# environment variables.
|
||||
@@ -71,16 +69,13 @@ sub do_getmacs {
|
||||
# Turn on verbose and debugging
|
||||
#######################################
|
||||
if ( exists($request->{verbose}) ) {
|
||||
#$cmd.= " -v -x";
|
||||
$optarg{'v'} = 1; #for verbose
|
||||
$optarg{'x'} = 1; #for debug
|
||||
$cmd.= " -v -x";
|
||||
}
|
||||
#######################################
|
||||
# Force LPAR shutdown
|
||||
#######################################
|
||||
if ( exists( $opt->{f} )) {
|
||||
#$cmd.= " -i";
|
||||
$optarg{'i'} = 1;
|
||||
$cmd.= " -i";
|
||||
} else {
|
||||
#################################
|
||||
# Force LPAR shutdown if LPAR is
|
||||
@@ -96,8 +91,7 @@ sub do_getmacs {
|
||||
my $osname = "AIX";
|
||||
if ( grep(/^$node$/, @nodelist) ) {
|
||||
if ( !grep(/^$osname$/, @oslist) ) {
|
||||
#$cmd.= " -i";
|
||||
$optarg{'i'} = 1;
|
||||
$cmd.= " -i";
|
||||
}
|
||||
$intable = 1;
|
||||
last;
|
||||
@@ -110,18 +104,15 @@ sub do_getmacs {
|
||||
# but mnt node is running Linux
|
||||
#################################
|
||||
if ( xCAT::Utils->isLinux() && $intable == 0 ) {
|
||||
#$cmd.= " -i";
|
||||
$optarg{'i'} = 1;
|
||||
$cmd.= " -i";
|
||||
}
|
||||
}
|
||||
|
||||
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
|
||||
if ( grep /hf/, $client_nethash{$node}{mgtifname} ) {
|
||||
#$cmd.= " -t hfi-ent";
|
||||
$optarg{'t'} = "hfi-ent";
|
||||
$cmd .= " -t hfi-ent";
|
||||
} else {
|
||||
#$cmd.= " -t ent";
|
||||
$optarg{'t'} = "ent";
|
||||
$cmd .= " -t ent";
|
||||
}
|
||||
|
||||
#######################################
|
||||
@@ -129,67 +120,53 @@ sub do_getmacs {
|
||||
#######################################
|
||||
if ( exists( $opt->{S} )) {
|
||||
if ( exists( $opt->{o} )) {
|
||||
#$cmd .=" -o";
|
||||
$optarg{'o'} = 1;
|
||||
$cmd .=" -o";
|
||||
}
|
||||
#$cmd.= " -D -s auto -d auto -S $opt->{S} -G $opt->{G} -C $opt->{C}";
|
||||
$optarg{'D'} = 1;
|
||||
$optarg{'s'} = 'auto';
|
||||
$optarg{'d'} = 'auto';
|
||||
$optarg{'S'} = $opt->{S};
|
||||
$optarg{'C'} = $opt->{C};
|
||||
$optarg{'G'} = $opt->{G};
|
||||
$optarg{'pprofile'} = "not_use"; #lpar_netboot.expect need pprofile for p5 & p6, but for p7 ih, we don't use this attribute.
|
||||
}
|
||||
|
||||
$cmd.= " -D -s auto -d auto -S $opt->{S} -G $opt->{G} -C $opt->{C} ";
|
||||
}
|
||||
|
||||
$pprofile = "not_use"; #lpar_netboot.expect need pprofile for p5 & p6, but for p7 ih, we don't use this attribute.
|
||||
|
||||
#######################################
|
||||
# Add command options
|
||||
#######################################
|
||||
#$cmd.= " -f -M -A -n \"$name\" \"$pprofile\" \"$fsp\" $id $hcp \"$node\"";
|
||||
$optarg{'f'} = 1;
|
||||
$optarg{'M'} = 1;
|
||||
$optarg{'A'} = 1;
|
||||
$optarg{'n'} = $name;
|
||||
#$optarg{'pprofile'} = $pprofile;
|
||||
$optarg{'fsp'} = $fsp;
|
||||
$optarg{'id'} = $id;
|
||||
$optarg{'hcp'} = $hcp;
|
||||
$optarg{'node'} = $node;
|
||||
$cmd.= " -f -M -A -n \"$name\" \"$pprofile\" \"$fsp\" $id $hcp \"$node\"";
|
||||
#######################################
|
||||
# Execute command
|
||||
#######################################
|
||||
my $pid = open( OUTPUT, "$cmd 2>&1 |");
|
||||
$SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down
|
||||
kill 9, $pid;
|
||||
return( [RC_ERROR,"Received INT or TERM signal"] );
|
||||
};
|
||||
if ( !$pid ) {
|
||||
return( [RC_ERROR,"$cmd fork error: $!"] );
|
||||
}
|
||||
|
||||
########################################
|
||||
## Execute command
|
||||
########################################
|
||||
#my $pid = open( OUTPUT, "$cmd 2>&1 |");
|
||||
#$SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down
|
||||
# kill 9, $pid;
|
||||
# return( [RC_ERROR,"Received INT or TERM signal"] );
|
||||
#};
|
||||
#if ( !$pid ) {
|
||||
# return( [RC_ERROR,"$cmd fork error: $!"] );
|
||||
#}
|
||||
########################################
|
||||
## Get command output
|
||||
########################################
|
||||
#while ( <OUTPUT> ) {
|
||||
# $result.=$_;
|
||||
#}
|
||||
#close OUTPUT;
|
||||
#
|
||||
########################################
|
||||
## Get command exit code
|
||||
########################################
|
||||
#
|
||||
#foreach ( split /\n/, $result ) {
|
||||
# if ( /^lpar_netboot / ) {
|
||||
# $Rc = RC_ERROR;
|
||||
# last;
|
||||
# }
|
||||
#}
|
||||
xCAT::MsgUtils->verbose_message($request, "getmacs :lparnetbootexp for node:$node.");
|
||||
my $Rc = xCAT::LparNetbootExp->lparnetbootexp(\%optarg, $request);
|
||||
#######################################
|
||||
# Get command output
|
||||
#######################################
|
||||
while ( <OUTPUT> ) {
|
||||
$result.=$_;
|
||||
}
|
||||
close OUTPUT;
|
||||
|
||||
#######################################
|
||||
# Get command exit code
|
||||
#######################################
|
||||
my $Rc = SUCCESS;
|
||||
|
||||
foreach ( split /\n/, $result ) {
|
||||
if ( /^lpar_netboot / ) {
|
||||
$Rc = RC_ERROR;
|
||||
last;
|
||||
}
|
||||
}
|
||||
######################################
|
||||
# Split results into array
|
||||
######################################
|
||||
return $Rc;
|
||||
return( [$Rc, split( /\n/, $result)] );
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +235,7 @@ sub getmacs {
|
||||
#########################################
|
||||
for ( my $stat = 0; $stat < 3; $stat++ ) {
|
||||
#my $output = xCAT::PPCcli::lshwres( $exp, @$cmd[$stat], $hcp);
|
||||
my $output = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $cmd[$stat]);
|
||||
my $output = xCAT::FSPUtils::fsp_api_action($name, $d, $cmd[$stat]);
|
||||
my $macs;
|
||||
my $res = $$output[1];
|
||||
chomp($res);
|
||||
@@ -350,10 +327,6 @@ sub getmacs {
|
||||
if( $mac_addr ) {
|
||||
$mac_addr = format_mac($mac_addr);
|
||||
}
|
||||
if ( !exists( $opt->{M} )) {
|
||||
my @mac_addrs = split /\|/, $mac_addr;
|
||||
$mac_addr = @mac_addrs[0];
|
||||
}
|
||||
$att{'MAC_Address'} = ($mac_addr) ? $mac_addr : "N/A";
|
||||
$att{'Adapter'} = ($adapter_id) ? $adapter_id : "N/A";
|
||||
$att{'Port_Group'} = ($port_group) ? $port_group : "N/A";
|
||||
@@ -370,25 +343,14 @@ sub getmacs {
|
||||
# specified
|
||||
#########################################
|
||||
if ( defined($filter) ) {
|
||||
my $matched = 0;
|
||||
foreach my $key ( keys %$filter ) {
|
||||
if ( $key eq "MAC_Address" ) {
|
||||
my $mac = lc($att{$key});
|
||||
my $filter_mac = lc($filter->{$key});
|
||||
|
||||
$mac =~ s/://g;
|
||||
$filter_mac =~ s/://g;
|
||||
|
||||
if ( grep(/$filter_mac/, $mac) ) {
|
||||
$matched = 1;
|
||||
last;
|
||||
}
|
||||
} elsif ( grep(/$filter->{$key}/, $att{$key}) ) {
|
||||
$matched = 1;
|
||||
my $matched = 1;
|
||||
foreach ( keys %$filter ) {
|
||||
if ( $att{$_} ne $filter->{$_} ) {
|
||||
$matched = 0;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ( $matched ) {
|
||||
if ( $matched == 1 ) {
|
||||
push @$value,"$att{'Type'} $att{'Phys_Port_Loc'} $att{'MAC_Address'} $att{'Adapter'} $att{'Port_Group'} $att{'Phys_Port'} $att{'Logical_Port'} $att{'VLan'} $att{'VSwitch'} $att{'Curr_Conn_Speed'}\n";
|
||||
}
|
||||
} else {
|
||||
@@ -443,7 +405,6 @@ sub getmacs {
|
||||
#########################################
|
||||
# Connect to fsp to achieve MAC address
|
||||
#########################################
|
||||
xCAT::MsgUtils->verbose_message($request, "getmacs START.");
|
||||
my $d = $par;
|
||||
|
||||
#########################################
|
||||
@@ -503,7 +464,6 @@ sub getmacs {
|
||||
#########################################
|
||||
# Manually collect MAC addresses.
|
||||
#########################################
|
||||
xCAT::MsgUtils->verbose_message($request, "getmacs :do_getmacs for node:$node.");
|
||||
$result = do_getmacs( $request, $d, $exp, $name, $node );
|
||||
#}
|
||||
#$sitetab->close;
|
||||
@@ -578,7 +538,6 @@ sub getmacs {
|
||||
writemac( $node, $value );
|
||||
}
|
||||
#return( [[$node,$data,$Rc]] );
|
||||
xCAT::MsgUtils->verbose_message($request, "getmacs END.");
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
+22
-58
@@ -21,29 +21,22 @@ sub parse_args {
|
||||
##########################################################################
|
||||
sub enumerate {
|
||||
|
||||
my $request = shift;
|
||||
my $h = shift;
|
||||
my $mtms = shift;
|
||||
my $tooltype = shift;
|
||||
my %outhash = ();
|
||||
my %cmds = ();
|
||||
my $type = ();
|
||||
my $cec_bpa = ();
|
||||
my $tmp_d;
|
||||
my $tmp_name;
|
||||
|
||||
######################################
|
||||
# Check for CEC/LPAR/BPAs in list
|
||||
######################################
|
||||
while (my ($name,$d) = each(%$h) ) {
|
||||
$cec_bpa = @$d[3];
|
||||
$type = @$d[4];
|
||||
$tmp_d = $d;
|
||||
$tmp_name = $name;
|
||||
#$cmds{$type} = ($type=~/^lpar$/) ? "all_lpars_state" : "cec_state";
|
||||
if( $type=~/^lpar$/ ) {
|
||||
$cmds{$type} = "all_lpars_state";
|
||||
} elsif ($type=~/^(fsp|cec|blade)$/) {
|
||||
} elsif ($type=~/^(fsp|cec)$/) {
|
||||
$cmds{$type} = "cec_state";
|
||||
} else {
|
||||
$cmds{$type} = "bpa_state";
|
||||
@@ -51,8 +44,7 @@ sub enumerate {
|
||||
}
|
||||
foreach my $type ( keys %cmds ) {
|
||||
my $action = $cmds{$type};
|
||||
#my $values = xCAT::FSPUtils::fsp_state_action ($request, $cec_bpa, $type, $action, $tooltype);
|
||||
my $values = xCAT::FSPUtils::fsp_state_action ($request, $cec_bpa, $tmp_d, $action, $tooltype);
|
||||
my $values = xCAT::FSPUtils::fsp_state_action ($cec_bpa, $type, $action);;
|
||||
my $Rc = shift(@$values);
|
||||
##################################
|
||||
# Return error
|
||||
@@ -69,18 +61,7 @@ sub enumerate {
|
||||
##############################
|
||||
# No lparid for fsp/bpa
|
||||
##############################
|
||||
if ( $type =~ /^(fsp|bpa|cec|frame|blade)$/ ) {
|
||||
if ($type eq 'blade') {
|
||||
if ($state eq 'operating') {
|
||||
my $res = xCAT::FSPUtils::fsp_api_action($request, $tmp_name,$tmp_d,'state',$tooltype);
|
||||
if (@$res[2] == 0 and @$res[1] =~ /open-firmware/i) {
|
||||
$state = @$res[1];
|
||||
}
|
||||
}
|
||||
if ($state =~ /standby|operating/) {
|
||||
$state = "on";
|
||||
}
|
||||
}
|
||||
if ( $type =~ /^(fsp|bpa|cec|frame)$/ ) {
|
||||
$lparid = $type;
|
||||
}
|
||||
$outhash{ $lparid } = $state;
|
||||
@@ -130,7 +111,7 @@ sub powercmd_boot {
|
||||
next;
|
||||
}
|
||||
|
||||
my $res = xCAT::FSPUtils::fsp_api_action ($request,$node_name, $d, "state");
|
||||
my $res = xCAT::FSPUtils::fsp_api_action ($node_name, $d, "state");
|
||||
#print "In boot, state\n";
|
||||
#print Dumper($res);
|
||||
my $Rc = @$res[2];
|
||||
@@ -160,7 +141,7 @@ sub powercmd_boot {
|
||||
}
|
||||
|
||||
|
||||
$res = xCAT::FSPUtils::fsp_api_action ($request,$node_name, $d, $op);
|
||||
$res = xCAT::FSPUtils::fsp_api_action ($node_name, $d, $op);
|
||||
|
||||
# @output ...
|
||||
$Rc = @$res[2];
|
||||
@@ -184,7 +165,6 @@ sub powercmd {
|
||||
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $tooltype = $request->{opt}->{T};
|
||||
my @result = ();
|
||||
my @output;
|
||||
my $action;
|
||||
@@ -229,16 +209,14 @@ sub powercmd {
|
||||
$newnames .="$node_name,";
|
||||
$newd = $d;
|
||||
$lpar_flag = 1;
|
||||
} elsif ($$d[4] =~ /^(fsp|cec|blade)$/) {
|
||||
} elsif ($$d[4] =~ /^(fsp|cec)$/) {
|
||||
if($action =~ /^on$/) { $action = "cec_on_autostart"; }
|
||||
if($action =~ /^off$/) { $action = "cec_off"; }
|
||||
if($action =~ /^resetsp$/) { $action = "reboot_service_processor"; }
|
||||
if($action =~ /^lowpower$/) { $action = "cec_on_low_power"; }
|
||||
#if($action =~ /^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$/) {
|
||||
push @output, [$node_name, "\'$action\' command not supported for $$d[4]", -1 ];
|
||||
return (\@output);
|
||||
if($action !~ /^cec_on_autostart$/ && $action !~ /^cec_off$/ && $action !~ /^cec_on_low_power$/ && $action !~ /^onstandby$/ && $action !~ /^reboot_service_processor$/ ) {
|
||||
push @output, [$node_name, "\'$action\' command not supported for CEC", -1 ];
|
||||
next;
|
||||
}
|
||||
$newids = $$d[0];
|
||||
$newnames = $node_name;
|
||||
@@ -253,7 +231,8 @@ sub powercmd {
|
||||
$action = "reboot_service_processor";
|
||||
} else {
|
||||
push @output, [$node_name, "$node_name\'s type isn't fsp or lpar. Not allow doing this operation", -1 ];
|
||||
return (\@output);
|
||||
#return (\@output);
|
||||
next;
|
||||
}
|
||||
$newids = $$d[0];
|
||||
$newnames = $node_name;
|
||||
@@ -285,7 +264,7 @@ sub powercmd {
|
||||
|
||||
#print Dumper($newd);
|
||||
|
||||
my $res = xCAT::FSPUtils::fsp_api_action($request, $newnames, $newd, $action, $tooltype, $request->{'powerinterval'} );
|
||||
my $res = xCAT::FSPUtils::fsp_api_action($newnames, $newd, $action, 0, $request->{'powerinterval'} );
|
||||
# print "In boot, state\n";
|
||||
# print Dumper($res);
|
||||
my $Rc = @$res[2];
|
||||
@@ -305,23 +284,11 @@ sub powercmd {
|
||||
next;
|
||||
}
|
||||
}
|
||||
if ((scalar(keys %$hash) == 1) and $Rc) {
|
||||
push @output, [$node_name, $data, $Rc];
|
||||
} else {
|
||||
# check the state of the blade or CEC after cec_reboot in order to let HWS realize the destination CEC had been powerd off #
|
||||
#my $msg = "success";
|
||||
if ($action eq 'cec_reboot') {
|
||||
sleep 0.1;
|
||||
xCAT::FSPUtils::fsp_state_action ($request, @$d[3], $d, "cec_state");
|
||||
#my $state_res = xCAT::FSPUtils::fsp_state_action (@$d[3], @$d[4], "cec_state");
|
||||
#my @state_state = @$state_res[1];
|
||||
#$msg = @state_state[0];
|
||||
}
|
||||
push @output, [$node_name,"Success", 0];
|
||||
#push @output, [$node_name,$msg, 0];
|
||||
}
|
||||
push @output, [$node_name,"Success", 0];
|
||||
}
|
||||
|
||||
return( \@output );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -331,7 +298,7 @@ sub powercmd {
|
||||
sub power_status {
|
||||
my $value = shift;
|
||||
my @states = (
|
||||
"Operating|operating|on",
|
||||
"Operating|operating",
|
||||
"Running|running",
|
||||
"standby",
|
||||
"Open Firmware|open-firmware"
|
||||
@@ -355,7 +322,6 @@ sub state {
|
||||
my $prefix = shift;
|
||||
my $convert = shift;
|
||||
my @output = ();
|
||||
my $tooltype = $request->{opt}->{T};
|
||||
|
||||
|
||||
#print "------in state--------\n";
|
||||
@@ -390,7 +356,7 @@ sub state {
|
||||
######################################
|
||||
# Build CEC/LPAR information hash
|
||||
######################################
|
||||
my $stat = enumerate($request, $h, $mtms, $tooltype);
|
||||
my $stat = enumerate( $h, $mtms );
|
||||
my $Rc = shift(@$stat);
|
||||
my $data = @$stat[0];
|
||||
#if($Rc != 0) {
|
||||
@@ -402,7 +368,7 @@ sub state {
|
||||
# Look up by lparid
|
||||
##################################
|
||||
my $type = @$d[4];
|
||||
my $id = ($type=~/^(fsp|bpa|cec|frame|blade)$/) ? $type : @$d[0];
|
||||
my $id = ($type=~/^(fsp|bpa|cec|frame)$/) ? $type : @$d[0];
|
||||
|
||||
##################################
|
||||
# Output error
|
||||
@@ -419,12 +385,12 @@ sub state {
|
||||
##################################
|
||||
# Node not found
|
||||
##################################
|
||||
if ($type !~ /^blade$/ and !exists( $data->{$id} )) {
|
||||
my $res = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "state", $tooltype);
|
||||
if ( !exists( $data->{$id} )) {
|
||||
my $res = xCAT::FSPUtils::fsp_api_action($name, $d, "state");
|
||||
my $rc = @$res[2];
|
||||
my $val = @$res[1];
|
||||
if( $rc != 0) {
|
||||
#push @result, [$name, $prefix.$val,1];
|
||||
push @result, [$name, $prefix.$val,1];
|
||||
}
|
||||
|
||||
if( !defined($val) || $val =~ /^error$/ ) {
|
||||
@@ -446,8 +412,6 @@ sub state {
|
||||
if ( defined( $convert )) {
|
||||
$value = power_status( $value );
|
||||
}
|
||||
|
||||
|
||||
push @result, [$name,"$prefix$value",$Rc];
|
||||
}
|
||||
}
|
||||
@@ -508,7 +472,7 @@ sub state1 {
|
||||
if($$d[4] =~ /^fsp$/ || $$d[4] =~ /^bpa$/) {
|
||||
$action = "cec_state";
|
||||
}
|
||||
my $stat = xCAT::FSPUtils::fsp_api_action ($request, $node_name, $d, $action);
|
||||
my $stat = xCAT::FSPUtils::fsp_api_action ($node_name, $d, $action);
|
||||
my $Rc = @$stat[2];
|
||||
my $data = @$stat[1];
|
||||
my $type = @$d[4];
|
||||
|
||||
@@ -82,7 +82,6 @@ sub getshorthost {
|
||||
##########################################################################
|
||||
sub enumerate {
|
||||
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $exp = shift;
|
||||
my $hwtype = ();
|
||||
@@ -119,7 +118,7 @@ sub enumerate {
|
||||
push @values, $data;
|
||||
next;
|
||||
}
|
||||
my $stat = xCAT::FSPUtils::fsp_api_action ($request, $node_name, $d, "query_connection");
|
||||
my $stat = xCAT::FSPUtils::fsp_api_action ($node_name, $d, "query_connection");
|
||||
my $Rc = @$stat[2];
|
||||
my $data = @$stat[1];
|
||||
|
||||
@@ -184,7 +183,7 @@ sub enumerate {
|
||||
#####################################
|
||||
# Enumerate LPARs
|
||||
#####################################
|
||||
$stat = xCAT::FSPUtils::fsp_api_action ($request, $node_name, $d, "get_lpar_info");
|
||||
$stat = xCAT::FSPUtils::fsp_api_action ($node_name, $d, "get_lpar_info");
|
||||
$Rc = @$stat[2];
|
||||
$data = @$stat[1];
|
||||
|
||||
@@ -525,7 +524,7 @@ sub rscan {
|
||||
###################################
|
||||
# Enumerate all the hardware
|
||||
###################################
|
||||
my $values = enumerate($request, $hash );
|
||||
my $values = enumerate( $hash );
|
||||
#print "In rscan:\n";
|
||||
#print Dumper($values);
|
||||
if ( ref($values) ne 'ARRAY' ) {
|
||||
|
||||
+36
-121
@@ -56,89 +56,39 @@ sub enumerate_temp {
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Returns refcode ; In DFM, it will get both the LCD value and the Current Power status Value
|
||||
# Returns refcode
|
||||
##########################################################################
|
||||
sub enumerate_lcds {
|
||||
|
||||
my $request= shift;
|
||||
my $name= shift;
|
||||
my $d = shift;
|
||||
my $action = shift;
|
||||
my $only_lcds = shift;
|
||||
my $prefix = "Current LCD:";
|
||||
my $power_status_prefix = "Current Power Status:";
|
||||
my $Rc;
|
||||
my @refcode;
|
||||
my $c = 0;
|
||||
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($request, $name, $d, $action);
|
||||
my $mtms = @$d[2];
|
||||
my $Rc = undef;
|
||||
my $value = undef;
|
||||
my $nodetype = @$d[4];
|
||||
my $lpar_id = @$d[0];
|
||||
my @refcode = ();
|
||||
my $action;
|
||||
if($$d[4] =~ /^lpar$/) {
|
||||
$action = "query_lcds";
|
||||
|
||||
#} elsif($$d[4] =~ /^fsp$/) {
|
||||
# $action = "cec_query_lcds";
|
||||
} else {
|
||||
$action = "cec_query_lcds";
|
||||
}
|
||||
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($name, $d, $action);
|
||||
$Rc = @$values[2];
|
||||
my $data = @$values[1];
|
||||
my $t_n = @$values[0];
|
||||
if( $Rc != 0 ) {
|
||||
my @names = split(/,/, $t_n);
|
||||
my @t_data = split(/\n/, $data);
|
||||
foreach my $n (@names) {
|
||||
if( $data =~ /$n/ ) {
|
||||
chomp $t_data[$c];
|
||||
#push @refcode,[$n, "$prefix $t_data[$c]", $Rc];
|
||||
if($t_data[$c] =~ /Error/ ) {
|
||||
if( $only_lcds == 0) {
|
||||
push @refcode,[$n, "$power_status_prefix $t_data[$c]", $Rc];
|
||||
}
|
||||
push @refcode,[$n, "$prefix $t_data[$c]", $Rc];
|
||||
} else {
|
||||
if( $only_lcds == 0) {
|
||||
$data =~ /\|(\w*)/ ;
|
||||
my $code = $1;
|
||||
if ( ! $code) {
|
||||
push @refcode, [$Rc, "blank"];
|
||||
} else {
|
||||
push @refcode, [$Rc, $code] ;
|
||||
}
|
||||
|
||||
# get power status
|
||||
if( $data =~ /1\|/) {
|
||||
push @refcode, [$n, "$power_status_prefix on", $Rc] ;
|
||||
} else {
|
||||
push @refcode, [$n, "$power_status_prefix off", $Rc];
|
||||
}
|
||||
}
|
||||
|
||||
# get lcd value
|
||||
if( $t_data[$c] =~ /1\|(\w[\w\s]*)/) {
|
||||
push @refcode, [$n, "$prefix $1", $Rc] ;
|
||||
} else {
|
||||
push @refcode, [$n, "$prefix blank", $Rc];
|
||||
}
|
||||
}
|
||||
$c++;
|
||||
} else {
|
||||
push @refcode, [$n, "$prefix $data", $Rc];
|
||||
if( $only_lcds == 0) {
|
||||
push @refcode, [$n, "$power_status_prefix $data", $Rc];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my @array = split(/\n/, $data);
|
||||
foreach my $a (@array) {
|
||||
my @t = split(/:/, $a);
|
||||
my $name = $t[0];
|
||||
$data = $t[1];
|
||||
## it will not parse the power status if only lcds.
|
||||
# $only_lcds = 0, it will get the power status
|
||||
# $only_lcds = 0, not get the power status.
|
||||
if( $only_lcds == 0) {
|
||||
# get power status
|
||||
if( $data =~ /1\|/) {
|
||||
push @refcode, [$name, "$power_status_prefix on", $Rc] ;
|
||||
} else {
|
||||
push @refcode, [$name, "$power_status_prefix off", $Rc];
|
||||
}
|
||||
}
|
||||
|
||||
# get lcd value
|
||||
if( $data =~ /1\|(\w[\w\s]*)/) {
|
||||
push @refcode, [$name, "$prefix $1", $Rc] ;
|
||||
} else {
|
||||
push @refcode, [$name, "$prefix blank", $Rc];
|
||||
}
|
||||
}
|
||||
}
|
||||
return \@refcode;
|
||||
}
|
||||
|
||||
@@ -147,7 +97,6 @@ sub enumerate_lcds {
|
||||
##########################################################################
|
||||
sub enumerate_rackenv {
|
||||
|
||||
my $request= shift;
|
||||
my $name= shift;
|
||||
my $d = shift;
|
||||
#my $mtms = @$d[2];
|
||||
@@ -157,7 +106,7 @@ sub enumerate_rackenv {
|
||||
my %outhash = ();
|
||||
my $action = "get_rack_env";
|
||||
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($request, $name, $d, $action);
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($name, $d, $action);
|
||||
$Rc = @$values[2];
|
||||
my $data = @$values[1];
|
||||
if ( $Rc != 0 ) {
|
||||
@@ -354,7 +303,7 @@ sub rackenv {
|
||||
}
|
||||
|
||||
my $action = "get_rack_env";
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($request, $name, $d, $action);
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($name, $d, $action);
|
||||
my $Rc = @$values[2];
|
||||
my $data = @$values[1];
|
||||
if ( $Rc != 0 ) {
|
||||
@@ -386,8 +335,6 @@ sub rackenv {
|
||||
|
||||
##########################################################################
|
||||
# Returns system power status (on or off)
|
||||
# This subroutine will not be used in DFM
|
||||
# And the power status will be returned with lcds
|
||||
##########################################################################
|
||||
sub power {
|
||||
return( xCAT::FSPpower::state(@_,"Current Power Status: ",1));
|
||||
@@ -400,48 +347,9 @@ sub state {
|
||||
return( xCAT::FSPpower::state(@_,"System State: "));
|
||||
}
|
||||
###########################################################################
|
||||
# Returns system LCD status and the power status
|
||||
# Returns system LCD status (LCD1, LCD2)
|
||||
##########################################################################
|
||||
sub lcds {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $exp = shift;
|
||||
my $result;
|
||||
my $newids;
|
||||
my $newnames;
|
||||
my $newd;
|
||||
my $action;
|
||||
my $type;
|
||||
my $only_lcds;
|
||||
if( $request->{method} =~ /^lcds$/ ) {
|
||||
$only_lcds = 1;
|
||||
}
|
||||
while (my ($mtms,$h) = each(%$hash) ) {
|
||||
while(my ($name, $d) = each(%$h) ){
|
||||
$newids .="$$d[0],";
|
||||
$newnames .="$name,";
|
||||
$newd = $d;
|
||||
if( defined( $type) && $type ne $$d[4] ) {
|
||||
push @$result, [$name, "$name\'s type is $$d[4]. Please get the lcds for $type and $$d[4] seperately", -1 ];
|
||||
return $result;
|
||||
}
|
||||
$type = $$d[4];
|
||||
}
|
||||
}
|
||||
|
||||
if( $type =~ /lpar|blade/ ) {
|
||||
$action = "query_lcds";
|
||||
} else {
|
||||
$action = "cec_query_lcds";
|
||||
}
|
||||
|
||||
$$newd[0] = $newids;
|
||||
$result = enumerate_lcds($request, $newnames, $newd, $action, $only_lcds);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub lcds_orig {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $exp = shift;
|
||||
@@ -457,7 +365,12 @@ sub lcds_orig {
|
||||
|
||||
while (my ($mtms,$h) = each(%$hash) ) {
|
||||
while(my ($name, $d) = each(%$h) ){
|
||||
$refcodes = enumerate_lcds($request, $name, $d);
|
||||
#Support HMC only
|
||||
#if($hwtype ne 'hmc'){
|
||||
# push @result, [$name, "$text Not available(NO HMC)", 1];
|
||||
# next;
|
||||
#}
|
||||
$refcodes = enumerate_lcds($name, $d);
|
||||
$num = 1;
|
||||
foreach $rcode (@$refcodes){
|
||||
$Rc = shift(@$rcode);
|
||||
@@ -470,6 +383,7 @@ sub lcds_orig {
|
||||
return \@result;
|
||||
}
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Returns all vitals
|
||||
##########################################################################
|
||||
@@ -478,6 +392,7 @@ sub all {
|
||||
my @values = (
|
||||
@{rackenv(@_)},
|
||||
@{state(@_)},
|
||||
@{power(@_)},
|
||||
@{lcds(@_)},
|
||||
);
|
||||
|
||||
|
||||
+21
-40
@@ -16,7 +16,7 @@ use xCAT::Usage;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT::FSPUtils;
|
||||
#use Data::Dumper;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
|
||||
##############################################
|
||||
# Globals
|
||||
##############################################
|
||||
@@ -60,7 +60,7 @@ sub chvm_parse_extra_options {
|
||||
return "no value specified";
|
||||
}
|
||||
if ($cmd =~ /^lparname$/) {
|
||||
if ($value ne '*' && $value !~ /^[a-zA-Z0-9-_]+$/) {
|
||||
if ($value ne '*' && $value !~ /^[a-zA-Z0-9-_]$/) {
|
||||
return "'$value' invalid";
|
||||
}
|
||||
my $len = rindex $value."\$", "\$";
|
||||
@@ -644,8 +644,7 @@ sub do_op_extra_cmds {
|
||||
while (my ($mtms, $h) = each(%$hash)) {
|
||||
while (my($name, $d) = each(%$h)) {
|
||||
my $tmp_value = ($param eq '*') ? $name : $param;
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} $action for node:$name, parm:$tmp_value.");
|
||||
my $value = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action, 0, $tmp_value);
|
||||
my $value = xCAT::FSPUtils::fsp_api_action($name, $d, $action, 0, $tmp_value);
|
||||
if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) {
|
||||
return ([[$name, @$value[1], '1']]) ;
|
||||
} else {
|
||||
@@ -699,7 +698,7 @@ sub modify_by_prof {
|
||||
my %io = ();
|
||||
my %lpar_state = ();
|
||||
my @result;
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} START.");
|
||||
|
||||
if (defined( $request->{stdin} )) {
|
||||
my $p = $request->{stdin};
|
||||
my @io = split(/\n/, $p) ;
|
||||
@@ -717,14 +716,12 @@ sub modify_by_prof {
|
||||
while (my ($cec,$h) = each(%$hash) ) {
|
||||
while (my ($lpar,$d) = each(%$h) ) {
|
||||
$td = $d;
|
||||
#@$td[4] = "fsp";
|
||||
@$td[4] = "fsp";
|
||||
$cec_name = @$d[3];
|
||||
}
|
||||
$td->[4] = "cec";
|
||||
#get the current I/O slot information
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :get_io_slot_info for node:$cec_name.");
|
||||
my $action = "get_io_slot_info";
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($request, $cec_name, $td, $action);
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($cec_name, $td, $action);
|
||||
my $Rc = $$values[2];
|
||||
if ( $Rc != 0 ) {
|
||||
push @result, [$cec_name, $$values[1], $Rc];
|
||||
@@ -739,10 +736,9 @@ sub modify_by_prof {
|
||||
}
|
||||
|
||||
#get all the nodes state in the same cec
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :get all the nodes state for CEC:$cec_name.");
|
||||
$action = "all_lpars_state";
|
||||
undef($values);
|
||||
my $values = xCAT::FSPUtils::fsp_state_action ($request, $cec_name, $td, $action);
|
||||
my $values = xCAT::FSPUtils::fsp_state_action ($cec_name, "fsp", $action);
|
||||
$Rc = shift(@$values);
|
||||
if ( $Rc != 0 ) {
|
||||
push @result, [$cec_name, $$values[0], $Rc];
|
||||
@@ -774,8 +770,7 @@ sub modify_by_prof {
|
||||
return ( \@result );
|
||||
}
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :set_io_slot_owner io_slot_info:$f,owner:$lpar.");
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($request, $lpar, $d, $action, $tooltype, $drc_index);
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($lpar, $d, $action, $tooltype, $drc_index);
|
||||
#my $Rc = shift(@$values);
|
||||
my $Rc = pop(@$values);
|
||||
if ( $Rc != 0 ) {
|
||||
@@ -786,14 +781,12 @@ sub modify_by_prof {
|
||||
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} END.");
|
||||
return( \@result );
|
||||
}
|
||||
|
||||
|
||||
sub enumerate {
|
||||
|
||||
my $request = shift;
|
||||
my $h = shift;
|
||||
my $mtms = shift;
|
||||
my %outhash = ();
|
||||
@@ -801,17 +794,15 @@ sub enumerate {
|
||||
my $type;
|
||||
my @td;
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "lsvm :enumerate START for mtms:$mtms.");
|
||||
while (my ($name,$d) = each(%$h) ) {
|
||||
$cec = @$d[3];
|
||||
$type = @$d[4];
|
||||
@td = @$d;
|
||||
}
|
||||
|
||||
$td[4]="cec";
|
||||
xCAT::MsgUtils->verbose_message($request, "lsvm :enumerate get_io_slot_info for node:$cec.");
|
||||
$td[4]="fsp";
|
||||
my $action = "get_io_slot_info";
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($request, $cec, \@td, $action);
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($cec, \@td, $action);
|
||||
#my $Rc = shift(@$values);
|
||||
my $Rc = $$values[2];
|
||||
if ( $Rc != 0 ) {
|
||||
@@ -826,9 +817,8 @@ sub enumerate {
|
||||
#}
|
||||
|
||||
if( $type =~ /^(fsp|cec)$/ ) {
|
||||
xCAT::MsgUtils->verbose_message($request, "lsvm :enumerate query_octant_cfg for node:$cec.");
|
||||
$action = "query_octant_cfg";
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($request, $cec, \@td, $action);
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($cec, \@td, $action);
|
||||
my $Rc = pop(@$values);
|
||||
if ( $Rc != 0 ) {
|
||||
return( [$Rc,$$values[1]] );
|
||||
@@ -847,12 +837,10 @@ sub enumerate {
|
||||
$outhash{ $cec } = $res;
|
||||
}
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "lsvm :enumerate END for mtms:$mtms.");
|
||||
return( [0,\%outhash] );
|
||||
}
|
||||
|
||||
sub get_cec_attr_info {
|
||||
my $request = shift;
|
||||
my $name = shift;
|
||||
my $attr = shift;
|
||||
my $op = shift;
|
||||
@@ -862,7 +850,7 @@ sub get_cec_attr_info {
|
||||
huge_page => "get_huge_page"
|
||||
);
|
||||
my $action = $op_hash{$op};
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $attr, $action);
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($name, $attr, $action);
|
||||
if (@$values[1] && ((@$values[1] =~ /Error/i) && @$values[2] ne '0')) {
|
||||
return ([[$name, @$values[1], '1']]);
|
||||
}
|
||||
@@ -996,9 +984,8 @@ sub list {
|
||||
my %lpar_huges = ();
|
||||
my $l_string = "\n";
|
||||
#print Dumper($hash);
|
||||
xCAT::MsgUtils->verbose_message($request, "lsvm START");
|
||||
while (my ($mtms,$h) = each(%$hash) ) {
|
||||
my $info = enumerate($request, $h, $mtms );
|
||||
my $info = enumerate( $h, $mtms );
|
||||
my $Rc = shift(@$info);
|
||||
my $data = @$info[0];
|
||||
|
||||
@@ -1019,23 +1006,23 @@ sub list {
|
||||
# push @result, [$node_name, "Node not found",1];
|
||||
# next;
|
||||
# }
|
||||
xCAT::MsgUtils->verbose_message($request, "lsvm :parse io info for node:$node_name.");
|
||||
|
||||
if( defined($msg)) {
|
||||
push @result,[$node_name, $msg, 0];
|
||||
} else {
|
||||
# get the I/O slot information
|
||||
if($request->{opt}->{l}) {
|
||||
if ($type =~ /^(fsp|cec)$/) {
|
||||
$bsr_infos = get_cec_attr_info($request, $node_name, $d, "bsr");
|
||||
$bsr_infos = get_cec_attr_info($node_name, $d, "bsr");
|
||||
if (ref($bsr_infos) eq 'ARRAY') {
|
||||
return $bsr_infos;
|
||||
}
|
||||
$huge_infos = get_cec_attr_info($request,$node_name, $d, "huge_page");
|
||||
$huge_infos = get_cec_attr_info($node_name, $d, "huge_page");
|
||||
if (ref($huge_infos) eq 'ARRAY') {
|
||||
return $huge_infos;
|
||||
}
|
||||
}
|
||||
$lpar_infos = get_cec_attr_info($request, $node_name, $d, "lpar_info");
|
||||
$lpar_infos = get_cec_attr_info($node_name, $d, "lpar_info");
|
||||
if (ref($lpar_infos) eq 'ARRAY') {
|
||||
return $lpar_infos;
|
||||
}
|
||||
@@ -1066,7 +1053,7 @@ sub list {
|
||||
if (defined($lpar_huges{$lparid})) {
|
||||
$hugepage = $lpar_huges{$lparid};
|
||||
} else {
|
||||
$hugepage = get_cec_attr_info($request, $node_name, $d, "huge_page");
|
||||
$hugepage = get_cec_attr_info($node_name, $d, "huge_page");
|
||||
if (ref($hugepage) eq 'ARRAY') {
|
||||
return $hugepage;
|
||||
}
|
||||
@@ -1094,7 +1081,6 @@ sub list {
|
||||
|
||||
# get the octant configuration value
|
||||
if ($type=~/^(fsp|cec)$/) {
|
||||
xCAT::MsgUtils->verbose_message($request, "lsvm :parse octant info for $type:$node_name.");
|
||||
my $value = $data->{$cec};
|
||||
if ($request->{opt}->{l}) {
|
||||
my $cec_bsr = get_cec_cec_bsr($node_name, $bsr_infos);
|
||||
@@ -1112,7 +1098,6 @@ sub list {
|
||||
$l_string = "\n";
|
||||
} # end of while
|
||||
}# end of while
|
||||
xCAT::MsgUtils->verbose_message($request, "lsvm END.");
|
||||
return( \@result );
|
||||
}
|
||||
|
||||
@@ -1159,7 +1144,7 @@ sub list_orig {
|
||||
# This is a CEC
|
||||
####################################
|
||||
else {
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($request, $node_name, $d, "query_octant_cfg");
|
||||
my $values = xCAT::FSPUtils::fsp_api_action( $node_name, $d, "query_octant_cfg");
|
||||
my $Rc = @$values[2];
|
||||
my $data = @$values[1];
|
||||
if ( $Rc != SUCCESS ) {
|
||||
@@ -1206,7 +1191,6 @@ sub create {
|
||||
my %node_id = ();
|
||||
my @nodes = @{$opt->{target}};
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} START.");
|
||||
#print Dumper($request);
|
||||
#####################################
|
||||
# Get source node information
|
||||
@@ -1226,8 +1210,7 @@ sub create {
|
||||
}
|
||||
}
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :query_octant_cfg for CEC:$cec_name.");
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($request, $cec_name, $d, "query_octant_cfg");
|
||||
my $values = xCAT::FSPUtils::fsp_api_action ($cec_name, $d, "query_octant_cfg");
|
||||
my $Rc = shift(@$values);
|
||||
if ( $Rc != 0 ) {
|
||||
return( [[$cec_name,$$values[0],$Rc]] );
|
||||
@@ -1303,9 +1286,8 @@ sub create {
|
||||
|
||||
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :set_octant_cfg for CEC:$cec_name,param:$parameters.");
|
||||
#$values = xCAT::FSPUtils::fsp_api_create_parttion( $starting_lpar_id, $octant_cfg, $node_number, $d, "set_octant_cfg");
|
||||
$values = xCAT::FSPUtils::fsp_api_action ($request,$cec_name, $d, "set_octant_cfg", 0, $parameters);
|
||||
$values = xCAT::FSPUtils::fsp_api_action ($cec_name, $d, "set_octant_cfg", 0, $parameters);
|
||||
my $Rc = $$values[2];
|
||||
my $data = $$values[1];
|
||||
if ( $Rc != SUCCESS ) {
|
||||
@@ -1321,7 +1303,6 @@ sub create {
|
||||
|
||||
}
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} END.");
|
||||
return( \@result );
|
||||
}
|
||||
|
||||
|
||||
@@ -24,20 +24,11 @@ $::NODETYPE_HMC="hmc";
|
||||
$::NODETYPE_IVM="ivm";
|
||||
$::NODETYPE_FRAME="frame";
|
||||
$::NODETYPE_CEC="cec";
|
||||
$::NODETYPE_BLADE="blade";
|
||||
$::NODETYPE_CMM="cmm";
|
||||
|
||||
# valid values for nodelist.nodetype column
|
||||
$::NODETYPE_OSI="osi";
|
||||
$::NODETYPE_PPC="ppc";
|
||||
$::NODETYPE_ZVM="zvm";
|
||||
$::NODETYPE_MP="mp";
|
||||
|
||||
#valid values for nodelist.updatestatus
|
||||
$::STATUS_SYNCING="syncing";
|
||||
$::STATUS_OUT_OF_SYNC="out-of-sync";
|
||||
$::STATUS_SYNCED="synced";
|
||||
|
||||
|
||||
# valid values for nodelist.status columns or other status
|
||||
$::STATUS_ACTIVE="alive";
|
||||
@@ -54,28 +45,6 @@ $::STATUS_STANDING_BY="standingby";
|
||||
$::STATUS_SHELL="shell";
|
||||
$::STATUS_DEFINED="defined";
|
||||
$::STATUS_UNKNOWN="unknown";
|
||||
$::STATUS_FAILED="failed";
|
||||
%::VALID_STATUS_VALUES = (
|
||||
$::STATUS_ACTIVE=>1,
|
||||
$::STATUS_INACTIVE=>1,
|
||||
$::STATUS_INSTALLING=>1,
|
||||
$::STATUS_INSTALLED=>1,
|
||||
$::STATUS_BOOTING=>1,
|
||||
$::STATUS_NETBOOTING=>1,
|
||||
$::STATUS_BOOTED=>1,
|
||||
$::STATUS_POWERING_OFF=>1,
|
||||
$::STATUS_DISCOVERING=>1,
|
||||
$::STATUS_CONFIGURING=>1,
|
||||
$::STATUS_STANDING_BY=>1,
|
||||
$::STATUS_SHELL=>1,
|
||||
$::STATUS_DEFINED=>1,
|
||||
$::STATUS_UNKNOWN=>1,
|
||||
$::STATUS_FAILED=>1,
|
||||
|
||||
$::STATUS_SYNCING=>1,
|
||||
$::STATUS_OUT_OF_SYNC=>1,
|
||||
$::STATUS_SYNCED=>1,
|
||||
);
|
||||
|
||||
#defined->[discovering]->[configuring]->[standingby]->installing->[installed]->booting->alive, defined->[discovering]->[configuring]-[standingby]->netbooting->booted->alive, alive/unreachable->booting->alive, powering-off->unreachable, alive->unreachable
|
||||
%::NEXT_NODESTAT_VAL=(
|
||||
|
||||
+53
-93
@@ -9,8 +9,12 @@ BEGIN
|
||||
|
||||
# if AIX - make sure we include perl 5.8.2 in INC path.
|
||||
# Needed to find perl dependencies shipped in deps tarball.
|
||||
if ($^O =~ /^aix/i) {
|
||||
unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2));
|
||||
if ($^O =~ /^aix/i)
|
||||
{
|
||||
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/5.8.2";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2";
|
||||
}
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
@@ -23,7 +27,7 @@ use File::Path;
|
||||
use strict;
|
||||
require xCAT::Schema;
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT::TableUtils;
|
||||
|
||||
#require Data::Dumper;
|
||||
#use Data::Dumper;
|
||||
require xCAT::NodeRange;
|
||||
@@ -67,14 +71,12 @@ sub getnimprime
|
||||
# the primary NIM master is either specified in the site table
|
||||
# or it is the xCAT management node.
|
||||
|
||||
my $nimprime = xCAT::TableUtils->get_site_Master();
|
||||
#my $sitetab = xCAT::Table->new('site');
|
||||
#(my $et) = $sitetab->getAttribs({key => "nimprime"}, 'value');
|
||||
my @nimprimes = xCAT::TableUtils->get_site_attribute("nimprime");
|
||||
my $tmp = $nimprimes[0];
|
||||
if (defined($tmp))
|
||||
my $nimprime = xCAT::Utils->get_site_Master();
|
||||
my $sitetab = xCAT::Table->new('site');
|
||||
(my $et) = $sitetab->getAttribs({key => "nimprime"}, 'value');
|
||||
if ($et and $et->{value})
|
||||
{
|
||||
$nimprime = $tmp;
|
||||
$nimprime = $et->{value};
|
||||
}
|
||||
|
||||
my $hostname;
|
||||
@@ -117,52 +119,43 @@ sub myxCATname
|
||||
|
||||
# make sure xcatd is running - & db is available
|
||||
# this routine is called during initial install of xCAT
|
||||
my $cmd="lsxcatd -d > /dev/null 2>&1";
|
||||
my $outref = [];
|
||||
@$outref = `$cmd`;
|
||||
my $rc = $? >> 8;
|
||||
if ($rc == 0)
|
||||
{
|
||||
if (xCAT::Utils->isMN())
|
||||
{
|
||||
my $cmd="lsxcatd -d > /dev/null 2>&1";
|
||||
my $outref = [];
|
||||
@$outref = `$cmd`;
|
||||
my $rc = $? >> 8;
|
||||
|
||||
if ($rc == 0)
|
||||
{
|
||||
|
||||
if (xCAT::Utils->isMN())
|
||||
{
|
||||
|
||||
# read the site table, master attrib
|
||||
my $hostname = xCAT::TableUtils->get_site_Master();
|
||||
my $hostname = xCAT::Utils->get_site_Master();
|
||||
if (($hostname =~ /\d+\.\d+\.\d+\.\d+/) || ($hostname =~ /:/))
|
||||
{
|
||||
$name = xCAT::NetworkUtils->gethostname($hostname);
|
||||
$name = xCAT::NetworkUtils->gethostname($hostname);
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = $hostname;
|
||||
}
|
||||
}
|
||||
elsif (xCAT::Utils->isServiceNode())
|
||||
{
|
||||
my $filename;
|
||||
# get any files with the format myxcatpost_*
|
||||
my $lscmd = qq~/bin/ls /xcatpost/myxcatpost_* 2>/dev/null~;
|
||||
my $output = `$lscmd`;
|
||||
my $rc = $? >> 8;
|
||||
if ($rc == 0)
|
||||
{
|
||||
foreach my $line ( split(/\n/, $output)) {
|
||||
my ($junk, $hostname) = split('myxcatpost_', $line);
|
||||
if (xCAT::InstUtils->is_me($hostname)) {
|
||||
$filename="/xcatpost/myxcatpost_$hostname";
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ( -e $filename ) {
|
||||
my $catcmd = qq~/bin/cat $filename | grep '^NODE=' 2>/dev/null~;
|
||||
my $string = `$catcmd`;
|
||||
if ($rc == 0) {
|
||||
($junk, $name) = split('=', $string);
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif (xCAT::Utils->isServiceNode())
|
||||
{
|
||||
|
||||
# the myxcatpost_<nodename> file should exist on all nodes!
|
||||
my $catcmd = "cat /xcatpost/myxcatpost_* | grep '^NODE='";
|
||||
# - can't use runcmd because this routine is called by runcmd
|
||||
|
||||
my $output = `$catcmd`;
|
||||
if ($::RUNCMD_RC == 0)
|
||||
{
|
||||
($junk, $name) = split('=', $output);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$name) {
|
||||
$name = hostname();
|
||||
@@ -218,7 +211,7 @@ sub is_me
|
||||
|
||||
# get all the possible IPs for the node I'm running on
|
||||
my $ifcmd = "ifconfig -a | grep 'inet'";
|
||||
my $result = xCAT::Utils->runcmd($ifcmd, -1, 1);
|
||||
my $result = xCAT::Utils->runcmd($ifcmd, 0, 1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
@@ -232,7 +225,6 @@ sub is_me
|
||||
{
|
||||
my ($inet, $myIP, $str) = split(" ", $int);
|
||||
chomp $myIP;
|
||||
$myIP =~ s/addr://;
|
||||
$myIP =~ s/\/.*//; # ipv6 address 4000::99/64
|
||||
$myIP =~ s/\%.*//; # ipv6 address ::1%1/128
|
||||
|
||||
@@ -370,10 +362,17 @@ sub get_nim_attr_val
|
||||
xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $target, $cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
if ($::VERBOSE) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not run lsnim command: \'$cmd\'.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
# The command output may have the xdsh prefix "target:"
|
||||
#my ($junk, $junk, $junk, $loc) = split(/:/, $nout);
|
||||
#chomp $loc;
|
||||
my $loc;
|
||||
if ($nout =~ /.*$resname:(.*):$/)
|
||||
{
|
||||
@@ -750,11 +749,11 @@ sub get_server_nodes
|
||||
else
|
||||
{
|
||||
# get ip facing node
|
||||
$serv = xCAT::NetworkUtils->my_ip_facing($node);
|
||||
$serv = xCAT::Utils->my_ip_facing($node);
|
||||
}
|
||||
chomp $serv;
|
||||
|
||||
if (xCAT::NetworkUtils->validate_ip($serv)) {
|
||||
if (xCAT::Utils->validate_ip($serv)) {
|
||||
push (@{$servernodes{$serv}}, $node);
|
||||
}
|
||||
}
|
||||
@@ -799,15 +798,6 @@ sub dolitesetup
|
||||
my $Sname = xCAT::InstUtils->myxCATname();
|
||||
chomp $Sname;
|
||||
|
||||
my $nimprime = xCAT::InstUtils->getnimprime();
|
||||
|
||||
my $target;
|
||||
if (xCAT::Utils->isSN($Sname)) {
|
||||
$target=$Sname;
|
||||
} else {
|
||||
$target=$nimprime;
|
||||
}
|
||||
|
||||
my @nodelist;
|
||||
my @nodel;
|
||||
my @nl;
|
||||
@@ -856,7 +846,7 @@ sub dolitesetup
|
||||
}
|
||||
|
||||
# get spot inst_root loc
|
||||
my $spotloc = xCAT::InstUtils->get_nim_attr_val($imghash{$imagename}{spot}, 'location', $callback, $target, $subreq);
|
||||
my $spotloc = xCAT::InstUtils->get_nim_attr_val($imghash{$imagename}{spot}, 'location', $callback, $Sname, $subreq);
|
||||
|
||||
my $instrootloc = $spotloc . "/lpp/bos/inst_root";
|
||||
|
||||
@@ -1014,36 +1004,7 @@ sub dolitesetup
|
||||
}
|
||||
}
|
||||
|
||||
# need list for just this set of nodes!!!
|
||||
my $nrange;
|
||||
my @flist;
|
||||
my @litef;
|
||||
if (scalar(@nodel) > 0)
|
||||
{
|
||||
$nrange = join(',',@nodel);
|
||||
}
|
||||
|
||||
my @flist = xCAT::Utils->runcmd("/opt/xcat/bin/litefile $nrange", -1);
|
||||
if (scalar(@flist) > 0) {
|
||||
foreach my $l (@flist) {
|
||||
my ($j1, $j2, $file) = split /\s+/, $l;
|
||||
push (@litef, $file);
|
||||
}
|
||||
}
|
||||
my $foundras;
|
||||
if (scalar(@litef) > 0) {
|
||||
foreach my $f (@litef) {
|
||||
chomp $f;
|
||||
if (($f eq "/var/adm/ras/") || ($f eq "/var/adm/ras/conslog")) {
|
||||
$foundras++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($foundras) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "One or more nodes is using a persistent \/var\/adm\/ras\/ directory. \nWhen the nodes boot up you will then have to move the conslog file to a \nlocation outside of the persistent directory. (Leaving the conslog \nfile in a persistent directory can occasionally lead to a deadlock situation.) \nThis can be done by using the xdsh command to run swcons on the \ncluster nodes. \n(Ex. xdsh <noderange> \'\/usr\/sbin\/swcons -p \/tmp\/conslog\') \n";
|
||||
xCAT::MsgUtils->message("W", $rsp, $callback);
|
||||
}
|
||||
|
||||
unless (open(LITETREE, ">$litetreetable"))
|
||||
{
|
||||
@@ -1055,13 +1016,12 @@ sub dolitesetup
|
||||
my @treelist = xCAT::Utils->runcmd("/opt/xcat/bin/litetree $noderange", -1);
|
||||
if (scalar(@treelist) > 0) {
|
||||
foreach my $l (@treelist) {
|
||||
my ($p, $serv, $dir, $mopts) = split (/:/, $l);
|
||||
my ($p, $serv, $dir) = split (/:/, $l);
|
||||
$p =~ s/\s*//g;
|
||||
$serv =~ s/\s*//g;
|
||||
$dir =~ s/\s*//g;
|
||||
$mopts =~ s/\s*//g;
|
||||
my $serverIP = xCAT::NetworkUtils->getipaddr($serv);
|
||||
my $entry = "$p|$serverIP|$dir|$mopts";
|
||||
my $entry = "$p|$serverIP|$dir";
|
||||
print LITETREE $entry . "\n";
|
||||
$foundstatelite++;
|
||||
}
|
||||
@@ -1282,7 +1242,7 @@ sub dolitesetup
|
||||
|
||||
# add aixlitesetup to ..inst_root/aixlitesetup
|
||||
# this will wind up in the root dir on the node ("/")
|
||||
my $install_dir = xCAT::TableUtils->getInstallDir();
|
||||
my $install_dir = xCAT::Utils->getInstallDir();
|
||||
my $cpcmd = "/bin/cp $install_dir/postscripts/aixlitesetup $instrootloc/aixlitesetup; chmod +x $instrootloc/aixlitesetup";
|
||||
|
||||
my $out = xCAT::Utils->runcmd("$cpcmd", -1);
|
||||
|
||||
@@ -1,199 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
## IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
package xCAT::KitPluginUtils;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
require xCAT::Table;
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 get_kits_used_by_nodes
|
||||
|
||||
Get the kits used by a list of nodes. A node uses a kit
|
||||
if one or more of the kit's components are installed
|
||||
on the node.
|
||||
|
||||
Arguments: list of node names (ref)
|
||||
|
||||
Returns: Return hash table which indexes the node names
|
||||
by kitname (ref)
|
||||
e.g.,
|
||||
{ "kitname1" => ["node11","node12",...],
|
||||
"kitname2" => ["node21","node22",...]
|
||||
...
|
||||
}
|
||||
|
||||
Examples:
|
||||
my @nodes = ("node11", "node12",...);
|
||||
my $result = xCAT::KitPluginUtils->get_kits_used_by_nodes(\@nodes);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
sub get_kits_used_by_nodes {
|
||||
|
||||
my $class = shift;
|
||||
my $nodes = shift;
|
||||
|
||||
# Group the nodes by what osimage they use
|
||||
my $tablename = "nodetype";
|
||||
my $table = xCAT::Table->new($tablename);
|
||||
my $ent = $table->getNodesAttribs($nodes, ["provmethod"]);
|
||||
|
||||
my $osimage_to_nodes = {};
|
||||
foreach my $node (keys(%$ent)) {
|
||||
my $provmethod = $ent->{$node}->[0]->{"provmethod"};
|
||||
if (defined($provmethod)) {
|
||||
push(@{ $osimage_to_nodes->{$provmethod} }, $node);
|
||||
}
|
||||
}
|
||||
|
||||
# Group the osimages by what kits they use
|
||||
my @osimages = keys(%$osimage_to_nodes);
|
||||
my $kits_to_osimages = xCAT::KitPluginUtils->get_kits_used_by_osimages(\@osimages);
|
||||
|
||||
|
||||
# Group nodes by kit
|
||||
my $kits_to_nodes = {};
|
||||
foreach my $kit (keys(%$kits_to_osimages)) {
|
||||
my $tmphash = {};
|
||||
my $osimages = $kits_to_osimages->{$kit};
|
||||
foreach my $osimage (@$osimages) {
|
||||
# Store nodes as hash keys to eliminate duplicates
|
||||
my @nodes = @{ $osimage_to_nodes->{$osimage} };
|
||||
@$tmphash{@nodes} = ();
|
||||
}
|
||||
my @nodes = keys(%$tmphash);
|
||||
$kits_to_nodes->{$kit} = \@nodes;
|
||||
}
|
||||
|
||||
return $kits_to_nodes;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 get_kits_used_by_osimages
|
||||
|
||||
Get the kits used by a list of osimages. An osimage
|
||||
uses a kit if one or more of the kit's components
|
||||
are associated with the osimage.
|
||||
|
||||
Arguments: list of osimage names (ref)
|
||||
|
||||
Returns: Return hash table which indexes the osimage
|
||||
names by kitname (ref)
|
||||
e.g.,
|
||||
{ "kitname1" => ["osimage11","osimage12",...],
|
||||
"kitname2" => ["osimage21","osimage22",...]
|
||||
...
|
||||
}
|
||||
|
||||
Examples:
|
||||
my @osimages = ("osimage11","osimage12", ...);
|
||||
my $result = xCAT::KitPluginUtils->get_kits_used_by_osimages(\@osimages);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
sub get_kits_used_by_osimages {
|
||||
|
||||
my $class = shift;
|
||||
my $osimages = shift;
|
||||
|
||||
# Get the kit components used by each osimage
|
||||
my $tablename = "osimage";
|
||||
my $table = xCAT::Table->new($tablename);
|
||||
|
||||
my $osimages_str = join ",", map {'\''.$_.'\''} @$osimages;
|
||||
my $filter_stmt = sprintf("imagename in (%s)", $osimages_str);
|
||||
my @table_rows = $table->getAllAttribsWhere($filter_stmt, ("imagename", "kitcomponents"));
|
||||
|
||||
my $kitcomps_to_osimages = {};
|
||||
foreach my $row (@table_rows) {
|
||||
if (defined($row->{kitcomponents})) {
|
||||
my @kitcomps = split(/,/, $row->{kitcomponents});
|
||||
foreach my $kitcomp (@kitcomps) {
|
||||
push(@{ $kitcomps_to_osimages->{$kitcomp} }, $row->{imagename});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Get the kit for each kit component
|
||||
$tablename = "kitcomponent";
|
||||
$table = xCAT::Table->new($tablename);
|
||||
|
||||
my $kitcomps_str = join ",", map {'\''.$_.'\''} keys(%$kitcomps_to_osimages);
|
||||
$filter_stmt = sprintf("kitcompname in (%s)", $kitcomps_str);
|
||||
@table_rows = $table->getAllAttribsWhere($filter_stmt, ("kitcompname", "kitname"));
|
||||
|
||||
my $kits_to_kitcomps = {};
|
||||
foreach my $row (@table_rows) {
|
||||
my $kitname = $row->{kitname};
|
||||
my $kitcompname = $row->{kitcompname};
|
||||
push(@{ $kits_to_kitcomps->{$kitname} }, $kitcompname);
|
||||
}
|
||||
|
||||
# Match up kits to osimages
|
||||
|
||||
my $kits_to_osimages = {};
|
||||
foreach my $kit (keys(%$kits_to_kitcomps)) {
|
||||
my $tmphash = {};
|
||||
my $kitcomps = $kits_to_kitcomps->{$kit};
|
||||
foreach my $kitcomp (@$kitcomps) {
|
||||
# Store osimages as hash keys to eliminate duplicates
|
||||
my @osimages = @{ $kitcomps_to_osimages->{$kitcomp} };
|
||||
@$tmphash{@osimages} = ();
|
||||
}
|
||||
my @osimages = keys(%$tmphash);
|
||||
$kits_to_osimages->{$kit} = \@osimages;
|
||||
}
|
||||
|
||||
return $kits_to_osimages;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 get_kits_used_by_image_profiles
|
||||
|
||||
Get the kits used by a list of image profiles.
|
||||
|
||||
Arguments: list of image profile names (ref)
|
||||
|
||||
Returns: Return hash table which indexes the image
|
||||
profile names by kitname (ref)
|
||||
e.g.,
|
||||
{ "kitname1" => ["imgprofile11","imgprofile12",...],
|
||||
"kitname2" => ["imgprofile21","imgprofile22",...]
|
||||
...
|
||||
}
|
||||
|
||||
Examples:
|
||||
my @imgprofiles = ("imgprofile11","imgprofile12",...);
|
||||
my $result = xCAT::KitPluginUtils->get_kits_used_by_image_profiles(\@imgprofiles);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
sub get_kits_used_by_image_profiles {
|
||||
|
||||
my $class = shift;
|
||||
return xCAT::KitPluginUtils->get_kits_used_by_osimages(@_);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,6 @@
|
||||
#!/usr/bin/perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT::MacMap;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
|
||||
require Exporter;
|
||||
our @ISA=qw/Exporter/;
|
||||
our @EXPORT_OK=qw/walkoid/;
|
||||
@@ -15,7 +8,6 @@ use strict;
|
||||
use xCAT::Table;
|
||||
use xCAT::Utils;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::TableUtils;
|
||||
use IO::Select;
|
||||
use IO::Handle;
|
||||
use Sys::Syslog;
|
||||
@@ -125,7 +117,7 @@ OID, and have the switch table port value match exactly the format suggested by
|
||||
#at this point we know the string the user wanted does exist on this port, now we move on to non-ethernet ports that may ambiguously match the user request as well
|
||||
|
||||
#stop contemplating vlan, Nu, stacking ports, and console interfaces
|
||||
if (($namepersnmp =~ /vl/i) or ($namepersnmp =~ /Nu/) or ($namepersnmp =~ /onsole/) or ($namepersnmp =~ /Stack/) or ($namepersnmp =~ /Trunk/)) {
|
||||
if (($namepersnmp =~ /vl/i) or ($namepersnmp =~ /Nu/) or ($namepersnmp =~ /onsole/) or ($namepersnmp =~ /Stack/)) {
|
||||
return 0;
|
||||
}
|
||||
#broken up for code readablitiy, don't check port channel numbers or CPU
|
||||
@@ -173,30 +165,20 @@ sub rvlan {
|
||||
# operation => "pvid=<vid> or vlan=<vid>" for now, addvlan= and delvlan= for tagged vlans, 'pvid', vlan, or stat without = checks current value
|
||||
my $self=shift;
|
||||
my $community = "public";
|
||||
#$self->{sitetab} = xCAT::Table->new('site');
|
||||
#my $tmp = $self->{sitetab}->getAttribs({key=>'snmpc'},'value');
|
||||
my @snmpcs = xCAT::TableUtils->get_site_attribute("snmpc");
|
||||
my $tmp = $snmpcs[0];
|
||||
if ( defined($tmp) ) { $community = $tmp }
|
||||
$self->{sitetab} = xCAT::Table->new('site');
|
||||
my $tmp = $self->{sitetab}->getAttribs({key=>'snmpc'},'value');
|
||||
if ($tmp and $tmp->{value}) { $community = $tmp->{value} }
|
||||
my %args = @_;
|
||||
my $op=$args{operation};
|
||||
my $nodes=$args{nodes};
|
||||
#first order of business is to identify the target switches
|
||||
my $switchtab=xCAT::Table->new('switch',-create=>0);
|
||||
unless ($switchtab) { return; }
|
||||
my $switchents = $switchtab->getNodesAttribs($nodes,[qw/switch port interface/]);
|
||||
my $switchents = $switchtab->getNodesAttribs($nodes,[qw/switch port/]);
|
||||
my $node;
|
||||
foreach $node (keys %$switchents) {
|
||||
my $entry;
|
||||
foreach $entry (@{$switchents->{$node}}) {
|
||||
#skip the none primary interface.
|
||||
# The vlaue of the primary interface could be empty, primary or primary:ethx
|
||||
if (defined($entry->{interface})) {
|
||||
if ($entry->{interface} !~ /primary/) {
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
$self->{switches}->{$entry->{switch}}->{$entry->{port}} = $node;
|
||||
}
|
||||
}
|
||||
@@ -305,12 +287,9 @@ sub refresh_table {
|
||||
$self->{switchestab} = xCAT::Table->new('switches', -create => 1);
|
||||
my @switchentries=$self->{switchestab}->getAllNodeAttribs([qw(switch snmpversion username password privacy auth)]);
|
||||
my $community = "public";
|
||||
#$self->{sitetab} = xCAT::Table->new('site');
|
||||
#my $tmp = $self->{sitetab}->getAttribs({key=>'snmpc'},'value');
|
||||
#if ($tmp and $tmp->{value}) { $community = $tmp->{value} }
|
||||
my @snmpcs = xCAT::TableUtils->get_site_attribute("snmpc");
|
||||
my $tmp = $snmpcs[0];
|
||||
if ( defined($tmp) ) { $community = $tmp }
|
||||
$self->{sitetab} = xCAT::Table->new('site');
|
||||
my $tmp = $self->{sitetab}->getAttribs({key=>'snmpc'},'value');
|
||||
if ($tmp and $tmp->{value}) { $community = $tmp->{value} }
|
||||
else { #Would warn here..
|
||||
}
|
||||
$self->{switchparmhash}={};
|
||||
@@ -339,7 +318,6 @@ sub refresh_table {
|
||||
$self->{switches} = {};
|
||||
foreach my $entry (@entries) {
|
||||
if (defined($entry->{switch}) and $entry->{switch} ne "" and defined($entry->{port}) and $entry->{port} ne "") {
|
||||
|
||||
if ( !$self->{switches}->{$entry->{switch}}->{$entry->{port}})
|
||||
{
|
||||
$self->{switches}->{$entry->{switch}}->{$entry->{port}} = $entry->{node};
|
||||
@@ -359,9 +337,6 @@ sub refresh_table {
|
||||
if ($checked_pairs{$entry->{switch}}) {
|
||||
next;
|
||||
}
|
||||
while($children > 64) {
|
||||
$self->handle_output($inputs);
|
||||
}
|
||||
$checked_pairs{$entry->{switch}}=1;
|
||||
pipe my $child,my $parent;
|
||||
$child->autoflush(1);
|
||||
@@ -550,10 +525,6 @@ sub refresh_switch {
|
||||
}
|
||||
unless ($session) { return; }
|
||||
my $bridgetoifmap = walkoid($session,'.1.3.6.1.2.1.17.1.4.1.2',ciscowarn=>$iscisco); # Good for all switches
|
||||
if (not ref $bridgetoifmap or !keys %{$bridgetoifmap}) {
|
||||
xCAT::MsgUtils->message("S","Error communicating with ".$session->{DestHost}.": failed to get a valid response to BRIDGE-MIB request");
|
||||
return;
|
||||
}
|
||||
|
||||
# my $mactoindexmap = walkoid($session,'.1.3.6.1.2.1.17.4.3.1.2');
|
||||
my $mactoindexmap = walkoid($session,'.1.3.6.1.2.1.17.7.1.2.2.1.2',silentfail=>1);
|
||||
@@ -561,10 +532,6 @@ sub refresh_switch {
|
||||
#$mactoindexmap = walkoid($session,'.1.3.6.1.2.1.17.7.1.2.2.1.2');
|
||||
$mactoindexmap = walkoid($session,'.1.3.6.1.2.1.17.4.3.1.2',ciscowarn=>$iscisco);
|
||||
} #Ok, time to process the data
|
||||
if (not ref $mactoindexmap or !keys %{$mactoindexmap}) {
|
||||
xCAT::MsgUtils->message("S","Error communicating with ".$session->{DestHost}.": Unable to get MAC entries via either BRIDGE or Q-BRIDE MIB");
|
||||
return;
|
||||
}
|
||||
foreach my $oid (keys %$namemap) {
|
||||
#$oid =~ m/1.3.6.1.2.1.31.1.1.1.1.(.*)/;
|
||||
my $ifindex = $oid;
|
||||
|
||||
+11
-32
@@ -5,8 +5,12 @@ package xCAT::MsgUtils;
|
||||
|
||||
# if AIX - make sure we include perl 5.8.2 in INC path.
|
||||
# Needed to find perl dependencies shipped in deps tarball.
|
||||
if ($^O =~ /^aix/i) {
|
||||
unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2));
|
||||
if ($^O =~ /^aix/i)
|
||||
{
|
||||
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/5.8.2";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2";
|
||||
}
|
||||
|
||||
use strict;
|
||||
@@ -133,8 +137,7 @@ This program module file, supports the xcat messaging and logging
|
||||
|
||||
D - DATA goes to STDOUT
|
||||
E - error. This type of message will be sent to STDERR.
|
||||
si - informational status info (sinfo)
|
||||
I - informational goes to STDOUT
|
||||
I - informational goes to STDOUT
|
||||
N - Node informational goes to STDOUT
|
||||
S - Message will be logged to syslog ( severe error)
|
||||
Note S can be combined with other flags for example
|
||||
@@ -210,14 +213,12 @@ This program module file, supports the xcat messaging and logging
|
||||
$rsp->{node}->[0]->{data}->[0] ="mydata";
|
||||
xCAT::MsgUtils->message("N", $rsp, $callback);
|
||||
|
||||
|
||||
|
||||
my $rsp = {};
|
||||
$rsp->{info}->[0] = "No hosts in node list\n";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
|
||||
my $rsp = {};
|
||||
$rsp->{sinfo}->[0] = "No hosts in node list\n";
|
||||
xCAT::MsgUtils->message("IS", $rsp, $::CALLBACK);
|
||||
|
||||
|
||||
my $rsp = {};
|
||||
$rsp->{warning}->[0] = "No hosts in node list\n";
|
||||
@@ -274,7 +275,7 @@ sub message
|
||||
my $call_back = shift; # optional
|
||||
my $exitcode = shift; # optional
|
||||
|
||||
# should be I,IS, D, E, S, SA ,LS, W , L,N
|
||||
# should be I, D, E, S, SA ,LS, W , L,N
|
||||
# or S(I, D, E, S, W, L,N)
|
||||
#
|
||||
# if new SA option need to split syslog messages from auditlog entry
|
||||
@@ -356,7 +357,6 @@ sub message
|
||||
my $sevkey;
|
||||
if ($sev =~ /D/) { $sevkey = 'data'; }
|
||||
elsif ($sev =~ /N/) { $sevkey = 'node'; }
|
||||
elsif ($sev =~ /IS/) { $sevkey = 'sinfo'; }
|
||||
elsif ($sev =~ /I/) { $sevkey = 'info'; }
|
||||
elsif ($sev =~ /W/) { $sevkey = 'warning'; }
|
||||
elsif ($sev =~ /E/)
|
||||
@@ -408,7 +408,7 @@ sub message
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined($exitcode))
|
||||
if ($exitcode)
|
||||
{
|
||||
push @{$rsp->{errorcode}}, $exitcode;
|
||||
}
|
||||
@@ -616,8 +616,6 @@ sub start_logging
|
||||
$::LOG_FILE_HANDLE = \*LOGFILE;
|
||||
$::LOG_FILE_NAME = $logfile;
|
||||
|
||||
# Make the file to be unbuffered
|
||||
binmode( $::LOG_FILE_HANDLE, ":unix" );
|
||||
# Print the program name and date to the top of the logfile
|
||||
my $sdate = `/bin/date`;
|
||||
chomp $sdate;
|
||||
@@ -710,24 +708,5 @@ sub backup_logfile
|
||||
return $::OK;
|
||||
}
|
||||
|
||||
sub verbose_message
|
||||
{
|
||||
shift;
|
||||
my $req = shift;
|
||||
my $data = shift;
|
||||
if (!defined($req->{verbose})) {
|
||||
return;
|
||||
}
|
||||
my ($sec,$min,$hour,$mday,$mon,$yr,$wday,$yday,$dst) = localtime(time);
|
||||
my $time = sprintf "%04d%02d%02d.%02d:%02d:%02d", $yr+1900,$mon+1,$mday,$hour,$min,$sec;
|
||||
$data = "$time ($$) ".$data;
|
||||
if (defined($req->{callback})) {
|
||||
my %rsp;
|
||||
$rsp{data} = [$data];
|
||||
xCAT::MsgUtils->message("I", \%rsp, $req->{callback});
|
||||
} else {
|
||||
xCAT::MsgUtils->message("I", $data);
|
||||
}
|
||||
}
|
||||
1;
|
||||
|
||||
|
||||
+11
-1733
File diff suppressed because it is too large
Load Diff
+10
-18
@@ -35,9 +35,6 @@ my @allnodeset;
|
||||
my %allnodehash;
|
||||
my @grplist;
|
||||
my $didgrouplist;
|
||||
my $glstamp=0;
|
||||
my $allnodesetstamp=0;
|
||||
my $allgrphashstamp=0;
|
||||
my %allgrphash;
|
||||
my $retaincache=0;
|
||||
my $recurselevel=0;
|
||||
@@ -182,10 +179,7 @@ sub nodesbycriteria {
|
||||
|
||||
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
|
||||
$allnodesetstamp=time();
|
||||
$nodelist->_set_use_cache(1);
|
||||
unless (scalar(@allnodeset)) { #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
|
||||
@allnodeset = $nodelist->getAllAttribs('node','groups');
|
||||
%allnodehash = map { $_->{node} => 1 } @allnodeset;
|
||||
}
|
||||
@@ -211,9 +205,8 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
unless ($grptab) {
|
||||
$grptab = xCAT::Table->new('nodegroup');
|
||||
}
|
||||
if ($grptab and (($glstamp < (time()-5)) or (not $didgrouplist and not scalar @grplist))) {
|
||||
if ($grptab and not $didgrouplist and not scalar @grplist) {
|
||||
$didgrouplist = 1;
|
||||
$glstamp=time();
|
||||
@grplist = @{$grptab->getAllEntries()};
|
||||
}
|
||||
my $isdynamicgrp = 0;
|
||||
@@ -241,9 +234,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels
|
||||
# The atom is not a dynamic node group, is it a static node group???
|
||||
if(!$isdynamicgrp)
|
||||
{
|
||||
unless (scalar %allgrphash and (time() < ($allgrphashstamp+5))) { #build a group membership cache
|
||||
$allgrphashstamp=time();
|
||||
%allgrphash=();
|
||||
unless (scalar %allgrphash) { #build a group membership cache
|
||||
my $nlent;
|
||||
foreach $nlent (@allnodeset) {
|
||||
my @groups=split(/,/,$nlent->{groups});
|
||||
@@ -449,10 +440,7 @@ sub retain_cache { #A semi private operation to be used *ONLY* in the interestin
|
||||
$retaincache=shift;
|
||||
unless ($retaincache) { #take a call to retain_cache(0) to also mean that any existing
|
||||
#cache must be zapped
|
||||
if ($nodelist) { $nodelist->_build_cache(1); }
|
||||
$glstamp=0;
|
||||
$allnodesetstamp=0;
|
||||
$allgrphashstamp=0;
|
||||
if ($nodelist) { $nodelist->_clear_cache(); }
|
||||
undef $nodelist;
|
||||
@allnodeset=();
|
||||
%allnodehash=();
|
||||
@@ -484,6 +472,7 @@ sub extnoderange { #An extended noderange function. Needed as the more straight
|
||||
}
|
||||
$return->{intersectinggroups}=[sort keys %grouphash];
|
||||
}
|
||||
retain_cache(0);
|
||||
return $return;
|
||||
}
|
||||
sub abbreviate_noderange {
|
||||
@@ -537,7 +526,6 @@ sub noderange {
|
||||
$missingnodes=[];
|
||||
#We for now just do left to right operations
|
||||
my $range=shift;
|
||||
$range =~ s/['"]//g;
|
||||
my $verify = (scalar(@_) >= 1 ? shift : 1);
|
||||
|
||||
#excludenodes attribute in site table,
|
||||
@@ -548,7 +536,7 @@ sub noderange {
|
||||
$nodelist =xCAT::Table->new('nodelist',-create =>1);
|
||||
$nodelist->_set_use_cache(0); #TODO: a more proper external solution
|
||||
@cachedcolumns = ('node','groups');
|
||||
$nodelist->_build_cache(\@cachedcolumns,noincrementref=>1);
|
||||
$nodelist->_build_cache(\@cachedcolumns);
|
||||
$nodelist->_set_use_cache(1); #TODO: a more proper external solution
|
||||
}
|
||||
my %nodes = ();
|
||||
@@ -631,6 +619,10 @@ sub noderange {
|
||||
}
|
||||
if ($recurselevel) {
|
||||
$recurselevel--;
|
||||
} else {
|
||||
unless ($retaincache) {
|
||||
retain_cache(0);
|
||||
}
|
||||
}
|
||||
return sort (keys %nodes);
|
||||
|
||||
|
||||
+63
-114
@@ -1,16 +1,13 @@
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
package xCAT::PPCboot;
|
||||
use lib "/opt/xcat/lib/perl";
|
||||
use Data::Dumper;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
|
||||
use xCAT::Usage;
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::LparNetbootExp;
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Parse the command line for options and operands
|
||||
@@ -46,7 +43,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(h|help V T v|version I|iscsiboot F f o s=s m:s@ r=s t=s) )) {
|
||||
if ( !GetOptions( \%opt, qw(h|help V|Verbose v|version I|iscsiboot F f o s=s m:s@ r=s t=s) )) {
|
||||
return( usage() );
|
||||
}
|
||||
|
||||
@@ -78,17 +75,6 @@ sub parse_args {
|
||||
return(usage());
|
||||
}
|
||||
}
|
||||
#############################################
|
||||
# T is used for trace, V is used for debug
|
||||
#############################################
|
||||
if (exists($opt{T})) {
|
||||
$opt{V} = 1;
|
||||
delete $opt{T};
|
||||
|
||||
}elsif(exists($opt{V})) {
|
||||
$opt{T} = 1;
|
||||
delete $opt{V};
|
||||
}
|
||||
####################################
|
||||
# Check for "-" with no option
|
||||
####################################
|
||||
@@ -125,7 +111,6 @@ sub do_rnetboot {
|
||||
my $Rc = SUCCESS;
|
||||
my $result = "";
|
||||
my $cmd;
|
||||
my %optarg;
|
||||
|
||||
#######################################
|
||||
# Disconnect Expect session
|
||||
@@ -140,21 +125,21 @@ sub do_rnetboot {
|
||||
my $fsp = @$d[2];
|
||||
my $hcp = @$d[3];
|
||||
|
||||
########################################
|
||||
## Find Expect script
|
||||
########################################
|
||||
#$cmd = ($::XCATROOT) ? "$::XCATROOT/sbin/" : "/opt/xcat/sbin/";
|
||||
#$cmd .= "lpar_netboot.expect";
|
||||
#
|
||||
########################################
|
||||
## Check command installed
|
||||
########################################
|
||||
#if ( !-x $cmd ) {
|
||||
# return( [RC_ERROR,"Command not installed: $cmd"] );
|
||||
#}
|
||||
#if (!-x "/usr/bin/expect" ) {
|
||||
# return( [RC_ERROR,"Command not installed: /usr/bin/expect"] );
|
||||
#}
|
||||
#######################################
|
||||
# Find Expect script
|
||||
#######################################
|
||||
$cmd = ($::XCATROOT) ? "$::XCATROOT/sbin/" : "/opt/xcat/sbin/";
|
||||
$cmd .= "lpar_netboot.expect";
|
||||
|
||||
#######################################
|
||||
# Check command installed
|
||||
#######################################
|
||||
if ( !-x $cmd ) {
|
||||
return( [RC_ERROR,"Command not installed: $cmd"] );
|
||||
}
|
||||
if (!-x "/usr/bin/expect" ) {
|
||||
return( [RC_ERROR,"Command not installed: /usr/bin/expect"] );
|
||||
}
|
||||
#######################################
|
||||
# Save user name and passwd of hcp to
|
||||
# environment variables.
|
||||
@@ -166,17 +151,14 @@ sub do_rnetboot {
|
||||
#######################################
|
||||
# Turn on verbose and debugging
|
||||
#######################################
|
||||
if ( ${$request->{arg}}[0] eq '-V' ) {
|
||||
#$cmd.= " -v -x";
|
||||
$optarg{'v'} = 1; #for verbose
|
||||
$optarg{'x'} = 1; #for debug
|
||||
if ( exists($request->{verbose}) ) {
|
||||
$cmd.= " -v -x";
|
||||
}
|
||||
#######################################
|
||||
# Force LPAR shutdown
|
||||
#######################################
|
||||
if ( exists( $opt->{f} ) || !xCAT::Utils->isAIX() ) {
|
||||
#$cmd.= " -i";
|
||||
$optarg{'i'} = 1;
|
||||
$cmd.= " -i";
|
||||
}
|
||||
|
||||
#######################################
|
||||
@@ -185,24 +167,19 @@ sub do_rnetboot {
|
||||
if ( exists( $opt->{s} )) {
|
||||
foreach ($opt->{s}) {
|
||||
if ( /^net$/ ) {
|
||||
#$cmd.= " -w 1";
|
||||
$optarg{'w'} = 1;
|
||||
$cmd.= " -w 1";
|
||||
} elsif ( /^net,hd$/ ) {
|
||||
#$cmd.= " -w 2";
|
||||
$optarg{'w'} = 2;
|
||||
$cmd.= " -w 2";
|
||||
} elsif ( /^hd,net$/ ) {
|
||||
#$cmd.= " -w 3";
|
||||
$optarg{'w'} = 3;
|
||||
$cmd.= " -w 3";
|
||||
} elsif ( /^hd$/ ) {
|
||||
#$cmd.= " -w 4";
|
||||
$optarg{'w'} = 4;
|
||||
$cmd.= " -w 4";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( exists( $opt->{o} )) {
|
||||
#$cmd.= " -o";
|
||||
$optarg{'o'} = 1;
|
||||
$cmd.= " -o";
|
||||
}
|
||||
|
||||
my @macs = split /\|/, $opt->{m};
|
||||
@@ -211,18 +188,10 @@ sub do_rnetboot {
|
||||
# Network specified
|
||||
#######################################
|
||||
my $mac_a = lc($mac);
|
||||
#$cmd.= " -s auto -d auto -m $mac_a -S $opt->{S} -C $opt->{C} -N $opt->{N}";
|
||||
|
||||
$optarg{'s'} = 'auto';
|
||||
$optarg{'d'} = 'auto';
|
||||
$optarg{'m'} = $mac_a;
|
||||
$optarg{'S'} = $opt->{S};
|
||||
$optarg{'C'} = $opt->{C};
|
||||
$optarg{'N'} = $opt->{N};
|
||||
$cmd.= " -s auto -d auto -m $mac_a -S $opt->{S} -C $opt->{C} -N $opt->{N}";
|
||||
if (defined($opt->{G}))
|
||||
{
|
||||
#$cmd.= " -G $opt->{G}";
|
||||
$optarg{'G'} = $opt->{G};
|
||||
$cmd.= " -G $opt->{G}";
|
||||
}
|
||||
|
||||
|
||||
@@ -270,10 +239,7 @@ sub do_rnetboot {
|
||||
}
|
||||
}
|
||||
if ( defined($dump_target) and defined($dump_lun) and defined($dump_port) ) {
|
||||
#$cmd.= " -T \"$dump_target\" -L \"$dump_lun\" -p \"$dump_port\"";
|
||||
$optarg{'T'} = $dump_target;
|
||||
$optarg{'L'} = $dump_lun;
|
||||
$optarg{'p'} = $dump_port;
|
||||
$cmd.= " -T \"$dump_target\" -L \"$dump_lun\" -p \"$dump_port\"";
|
||||
} else {
|
||||
return( [RC_ERROR,"Unable to find DUMP_TARGET, DUMP_LUN, DUMP_PORT for iscsi dump"] );
|
||||
}
|
||||
@@ -281,64 +247,50 @@ sub do_rnetboot {
|
||||
|
||||
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
|
||||
if ( grep /hf/, $client_nethash{$node}{mgtifname} ) {
|
||||
#$cmd.= " -t hfi-ent";
|
||||
$optarg{'t'} = "hfi-ent";
|
||||
$cmd.= " -t hfi-ent";
|
||||
} else {
|
||||
#$cmd.= " -t ent";
|
||||
$optarg{'t'} = "ent";
|
||||
$cmd.= " -t ent";
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Add command options
|
||||
#######################################
|
||||
#$cmd.= " -f \"$name\" \"$pprofile\" \"$fsp\" $id $hcp \"$node\"";
|
||||
$optarg{'f'} = 1;
|
||||
$optarg{'name'} = $name;
|
||||
$optarg{'pprofile'} = $pprofile;
|
||||
$optarg{'fsp'} = $fsp;
|
||||
$optarg{'id'} = $id;
|
||||
$optarg{'hcp'} = $hcp;
|
||||
$optarg{'node'} = $node;
|
||||
$cmd.= " -f \"$name\" \"$pprofile\" \"$fsp\" $id $hcp \"$node\"";
|
||||
|
||||
my $done = 0;
|
||||
while ( $done < 2 ) {
|
||||
$result = "";
|
||||
$Rc = SUCCESS;
|
||||
########################################
|
||||
## Execute command
|
||||
########################################
|
||||
#my $pid = open( OUTPUT, "$cmd 2>&1 |");
|
||||
#$SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down
|
||||
# kill 9, $pid;
|
||||
# return( [RC_ERROR,"Received INT or TERM signal"] );
|
||||
#};
|
||||
#if ( !$pid ) {
|
||||
# return( [RC_ERROR,"$cmd fork error: $!"] );
|
||||
#}
|
||||
########################################
|
||||
## Get command output
|
||||
########################################
|
||||
#while ( <OUTPUT> ) {
|
||||
# $result.=$_;
|
||||
#}
|
||||
#close OUTPUT;
|
||||
#
|
||||
########################################
|
||||
## Get command exit code
|
||||
########################################
|
||||
#
|
||||
#foreach ( split /\n/, $result ) {
|
||||
# if ( /^lpar_netboot / ) {
|
||||
# $Rc = RC_ERROR;
|
||||
# last;
|
||||
# }
|
||||
#}
|
||||
#######################################
|
||||
# Execute command
|
||||
#######################################
|
||||
my $pid = open( OUTPUT, "$cmd 2>&1 |");
|
||||
$SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down
|
||||
kill 9, $pid;
|
||||
return( [RC_ERROR,"Received INT or TERM signal"] );
|
||||
};
|
||||
if ( !$pid ) {
|
||||
return( [RC_ERROR,"$cmd fork error: $!"] );
|
||||
}
|
||||
#######################################
|
||||
# Get command output
|
||||
#######################################
|
||||
while ( <OUTPUT> ) {
|
||||
$result.=$_;
|
||||
}
|
||||
close OUTPUT;
|
||||
|
||||
#######################################
|
||||
# Invoke the lpar_netbootexp
|
||||
# Get command exit code
|
||||
#######################################
|
||||
$result = xCAT::LparNetbootExp->lparnetbootexp(\%optarg, $request);
|
||||
$Rc = @$result[0];
|
||||
|
||||
foreach ( split /\n/, $result ) {
|
||||
if ( /^lpar_netboot / ) {
|
||||
$Rc = RC_ERROR;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $Rc == SUCCESS ) {
|
||||
$done = 2;
|
||||
} else {
|
||||
@@ -350,7 +302,7 @@ sub do_rnetboot {
|
||||
last;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
return( [$Rc,$result] );
|
||||
}
|
||||
|
||||
|
||||
@@ -468,12 +420,9 @@ sub rnetboot {
|
||||
}
|
||||
}
|
||||
|
||||
#my $sitetab = xCAT::Table->new('site');
|
||||
#my $vcon = $sitetab->getAttribs({key => "conserverondemand"}, 'value');
|
||||
my @vcons = xCAT::TableUtils->get_site_attribute("conserverondemand");
|
||||
my $vcon = $vcons[0];
|
||||
#if ($vcon and $vcon->{"value"} and $vcon->{"value"} eq "yes" ) {
|
||||
if ( defined($vcon) and $vcon eq "yes" ) {
|
||||
my $sitetab = xCAT::Table->new('site');
|
||||
my $vcon = $sitetab->getAttribs({key => "conserverondemand"}, 'value');
|
||||
if ($vcon and $vcon->{"value"} and $vcon->{"value"} eq "yes" ) {
|
||||
$result = xCAT::PPCcli::lpar_netboot(
|
||||
$exp,
|
||||
$request->{verbose},
|
||||
@@ -486,7 +435,7 @@ sub rnetboot {
|
||||
#########################################
|
||||
$result = do_rnetboot( $request, $d, $exp, $name, $node, \%opt );
|
||||
}
|
||||
#$sitetab->close;
|
||||
$sitetab->close;
|
||||
|
||||
if (defined($request->{opt}->{m})) {
|
||||
|
||||
|
||||
+17
-792
@@ -4,15 +4,9 @@ package xCAT::PPCcfg;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
|
||||
use xCAT::PPCfsp;
|
||||
use xCAT::Usage;
|
||||
use Storable qw(freeze thaw);
|
||||
use POSIX "WNOHANG";
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
|
||||
use LWP;
|
||||
use HTTP::Cookies;
|
||||
|
||||
##########################################
|
||||
# Globals
|
||||
##########################################
|
||||
@@ -22,8 +16,8 @@ my %rspconfig = (
|
||||
hostname => \&hostname
|
||||
);
|
||||
|
||||
my %rsp_result;
|
||||
my $start;
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Parse the command line for options and operands
|
||||
##########################################################################
|
||||
@@ -96,9 +90,8 @@ sub parse_args {
|
||||
#}
|
||||
|
||||
my $nodes = $request->{node};
|
||||
my $typehash = xCAT::DBobjUtils->getnodetype($nodes);
|
||||
foreach my $nn (@$nodes) {
|
||||
$request->{hwtype} = $$typehash{$nn};
|
||||
$request->{hwtype} = xCAT::DBobjUtils->getnodetype($nn);
|
||||
last if ($request->{hwtype});
|
||||
}
|
||||
|
||||
@@ -127,7 +120,7 @@ sub parse_args {
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
$request->{method} = undef;
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose resetnet))) {
|
||||
if ( !GetOptions( \%opt, qw(V|Verbose resetnet))) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@@ -364,7 +357,6 @@ sub passwd {
|
||||
while ( my ($cec,$h) = each(%$hash) ) {
|
||||
while ( my ($node,$d) = each(%$h) ) {
|
||||
my $type = @$d[4];
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :modify password of $usr for node:$node.");
|
||||
my $data = xCAT::PPCcli::chsyspwd( $exp, $usr, $type, $cec, $passwd, $newpasswd );
|
||||
my $Rc = shift(@$data);
|
||||
my $usr_back = $usr;
|
||||
@@ -375,7 +367,6 @@ sub passwd {
|
||||
# Write the new password to table
|
||||
##################################
|
||||
if ( $Rc == SUCCESS ) {
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :update xCATdb for node:$node,ID:$usr_back.");
|
||||
xCAT::PPCdb::update_credentials( $node, $type, $usr_back, $newpasswd );
|
||||
}
|
||||
}
|
||||
@@ -445,7 +436,6 @@ sub sshcfg {
|
||||
# Determine if SSH is enabled
|
||||
#####################################
|
||||
if ( !defined( $mode )) {
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :check sshcfg for user:$logon on node:$server.");
|
||||
my $result = xCAT::PPCcli::send_cmd( $exp, "cat $auth" );
|
||||
my $Rc = shift(@$result);
|
||||
|
||||
@@ -468,7 +458,6 @@ sub sshcfg {
|
||||
#####################################
|
||||
# Enable/disable SSH
|
||||
#####################################
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :sshcfg $mode for user:$logon on node:$server.");
|
||||
my $result = xCAT::PPCcli::mkauthkeys( $exp, $mode, $logon, $sshkey );
|
||||
my $Rc = shift(@$result);
|
||||
|
||||
@@ -512,7 +501,6 @@ sub frame {
|
||||
#################################
|
||||
# Get frame number
|
||||
#################################
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :get frame_num for node:$node.");
|
||||
$data = xCAT::PPCcli::lssyscfg( $exp, @$d[4], @$d[2], 'frame_num' );
|
||||
$Rc = shift(@$data);
|
||||
|
||||
@@ -543,7 +531,6 @@ sub frame {
|
||||
if ( !defined($ent) or !defined($ent->{id}) ) {
|
||||
return( [[$node,"Cannot find frame num in database",RC_ERROR]] );
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :set frame_num=".$ent->{id}." for node:$node.");
|
||||
$data = xCAT::PPCcli::chsyscfg( $exp, "bpa", $d, "frame_num=".$ent->{id} );
|
||||
$Rc = shift(@$data);
|
||||
|
||||
@@ -561,7 +548,6 @@ sub frame {
|
||||
# Set frame number
|
||||
# Read the frame number from opt
|
||||
#################################
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :set frame_num=$value for node:$node.");
|
||||
$data = xCAT::PPCcli::chsyscfg( $exp, "bpa", $d, "frame_num=$value" );
|
||||
$Rc = shift(@$data);
|
||||
|
||||
@@ -577,7 +563,6 @@ sub frame {
|
||||
#################################
|
||||
# Set frame number to database
|
||||
#################################
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig : set frame_num, update node:$node attr id=$value.");
|
||||
$tab->setNodeAttribs( $node, { id=>$value } );
|
||||
}
|
||||
}
|
||||
@@ -610,7 +595,6 @@ sub hostname {
|
||||
#################################
|
||||
# Get system name
|
||||
#################################
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :get system name for node:$node.");
|
||||
$data = xCAT::PPCcli::lssyscfg( $exp, @$d[4], @$d[2], 'name' );
|
||||
$Rc = shift(@$data);
|
||||
|
||||
@@ -623,7 +607,6 @@ sub hostname {
|
||||
|
||||
push @$result, [$node,@$data[0],SUCCESS];
|
||||
} elsif ( $value eq '*' ) {
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :set system name:$node for node:$node.");
|
||||
$data = xCAT::PPCcli::chsyscfg( $exp, @$d[4], $d, "new_name=$node" );
|
||||
$Rc = shift(@$data);
|
||||
|
||||
@@ -636,7 +619,6 @@ sub hostname {
|
||||
|
||||
push @$result, [$node,@$data[0],SUCCESS];
|
||||
} else {
|
||||
xCAT::MsgUtils->verbose_message($request, "rspconfig :set system name:$value for node:$node.");
|
||||
$data = xCAT::PPCcli::chsyscfg( $exp, @$d[4], $d, "new_name=$value" );
|
||||
$Rc = shift(@$data);
|
||||
|
||||
@@ -656,779 +638,22 @@ sub hostname {
|
||||
return( [@$result] );
|
||||
}
|
||||
##########################################################################
|
||||
# Do resetnet public entry
|
||||
# Do resetnet
|
||||
##########################################################################
|
||||
sub resetnet {
|
||||
my $request = shift;
|
||||
doresetnet($request);
|
||||
return 0;
|
||||
my $hash = shift;
|
||||
my %nodehash;
|
||||
foreach ( @{$request->{noderange}}) {
|
||||
$nodehash{$_} = 1;
|
||||
}
|
||||
# go to use lsslp do_resetnet
|
||||
my $result = xCAT_plugin::lsslp::do_resetnet($request, \%nodehash);
|
||||
return [$result];
|
||||
}
|
||||
##########################################################################
|
||||
# Reset the network interfraces if necessary
|
||||
##########################################################################
|
||||
sub doresetnet {
|
||||
|
||||
my $req = shift;
|
||||
my %iphash;
|
||||
my $targets;
|
||||
my $result;
|
||||
my %grouphash;
|
||||
my %oihash;
|
||||
my %machash;
|
||||
my %vpdhash;
|
||||
|
||||
unless ($req) {
|
||||
send_msg( $req, 1, "request is empty, return" );
|
||||
return;
|
||||
}
|
||||
###########################################
|
||||
# prepare to reset network
|
||||
###########################################
|
||||
xCAT::MsgUtils->verbose_message($req, "rspconfig :do resetnet begin to phase nodes");
|
||||
my $hoststab = xCAT::Table->new( 'hosts' );
|
||||
if ( !$hoststab ) {
|
||||
send_msg( $req, 1, "Error open hosts table" );
|
||||
return;
|
||||
} else {
|
||||
my @hostslist = $hoststab->getAllNodeAttribs(['node','otherinterfaces']);
|
||||
foreach my $otherentry ( @hostslist) {
|
||||
$oihash{$otherentry->{node}} = $otherentry->{otherinterfaces};
|
||||
}
|
||||
}
|
||||
|
||||
my $mactab = xCAT::Table->new( 'mac' );
|
||||
if ( !$mactab ) {
|
||||
send_msg( $req, 1, "Error open mac table" );
|
||||
return;
|
||||
}else{
|
||||
my @maclist = $mactab->getAllNodeAttribs(['node','mac']);
|
||||
foreach my $macentry (@maclist) {
|
||||
$machash{$macentry->{node}} = $macentry->{mac};
|
||||
}
|
||||
}
|
||||
$mactab = ();
|
||||
|
||||
my $vpdtab = xCAT::Table->new( 'vpd' );
|
||||
if ( !$vpdtab ) {
|
||||
send_msg( $req, 1, "Error open vpd table" );
|
||||
return;
|
||||
} else {
|
||||
my @vpdlist = $vpdtab->getAllNodeAttribs(['node','mtm','serial','side']);
|
||||
foreach my $vpdentry (@vpdlist) {
|
||||
if ($vpdentry->{side} =~ /(\w)\-\w/) {
|
||||
my $side = $1;
|
||||
$vpdhash{$vpdentry->{node}} = $vpdentry->{mtm}."*".$vpdentry->{serial}."*".$side;
|
||||
}
|
||||
}
|
||||
}
|
||||
$vpdtab = ();
|
||||
|
||||
unless ( $req->{node} ) {
|
||||
send_msg( $req, 0, "no node specified" );
|
||||
return;
|
||||
}
|
||||
###########################################
|
||||
# Process nodes and get network information
|
||||
###########################################
|
||||
my $nodetype = $req->{hwtype};
|
||||
if ( $nodetype =~ /^(cec|frame)$/ ) {
|
||||
# this brunch is just for the xcat 2.6(or 2.6+) database
|
||||
foreach my $nn ( @{ $req->{node}} ) {
|
||||
my $cnodep = xCAT::DBobjUtils->getchildren($nn);
|
||||
$nodetype = ( $nodetype =~ /^frame$/i ) ? "bpa" : "fsp";
|
||||
if ($cnodep) {
|
||||
foreach my $cnode (@$cnodep) {
|
||||
my $ip = xCAT::NetworkUtils::getNodeIPaddress( $cnode );
|
||||
my $oi = $oihash{$cnode};
|
||||
if(!defined $ip) {
|
||||
send_msg($req, "doresetnet: can't get $cnode ip");
|
||||
next;
|
||||
}
|
||||
if(!defined $oi) {
|
||||
send_msg($req, "doresetnet: can't get $cnode hosts.otherinterfaces");
|
||||
next;
|
||||
}
|
||||
if ( exists($oihash{$cnode}) and $ip eq $oihash{$cnode}) {
|
||||
send_msg( $req, 0, "$cnode: same ip address, skipping $nn network reset" );
|
||||
} elsif( ! exists $machash{$cnode}){
|
||||
send_msg( $req, 0, "$cnode: no mac defined, skipping $nn network reset" );
|
||||
} else {
|
||||
$iphash{$cnode}{sip} = $ip;
|
||||
$iphash{$cnode}{tip} = $oihash{$cnode};
|
||||
if(exists $grouphash{$vpdhash{$cnode}}) {
|
||||
$grouphash{$vpdhash{$cnode}} .= ",$cnode";
|
||||
} else {
|
||||
$grouphash{$vpdhash{$cnode}} = "$cnode";
|
||||
}
|
||||
$targets->{$nodetype}->{$ip}->{'args'} = "0.0.0.0,$cnode";
|
||||
$targets->{$nodetype}->{$ip}->{'mac'} = $machash{$cnode};
|
||||
$targets->{$nodetype}->{$ip}->{'name'} = $cnode;
|
||||
$targets->{$nodetype}->{$ip}->{'ip'} = $ip;
|
||||
$targets->{$nodetype}->{$ip}->{'type'} = $nodetype;
|
||||
my %netinfo = xCAT::DBobjUtils->getNetwkInfo( [$ip] );
|
||||
$targets->{$nodetype}->{$ip}->{'args'} .= ",$netinfo{$ip}{'gateway'},$netinfo{$ip}{'mask'}";
|
||||
#xCAT::MsgUtils->verbose_message($req, "doresetnet: get node $cnode info $targets->{$nodetype}->{$ip}->{'args'}, ip is $ip");
|
||||
$targets->{$nodetype}->{$oi}->{'args'} = "0.0.0.0,$cnode";
|
||||
$targets->{$nodetype}->{$oi}->{'mac'} = $machash{$cnode};
|
||||
$targets->{$nodetype}->{$oi}->{'name'} = $cnode;
|
||||
$targets->{$nodetype}->{$oi}->{'ip'} = $oi;
|
||||
$targets->{$nodetype}->{$oi}->{'type'} = $nodetype;
|
||||
%netinfo = xCAT::DBobjUtils->getNetwkInfo( [$oi] );
|
||||
$targets->{$nodetype}->{$oi}->{'args'} .= ",$netinfo{$oi}{'gateway'},$netinfo{$oi}{'mask'}";
|
||||
#xCAT::MsgUtils->verbose_message($req, "doresetnet: get node $cnode info $targets->{$nodetype}->{$oi}->{'args'}, oi is $oi");
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
send_msg( $req, 1, "Can't get the fsp/bpa nodes for the $nn" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
# this brunch is just for the xcat 2.5(or 2.5-) databse
|
||||
} elsif ( $nodetype =~ /^(fsp|bpa)$/ ) {
|
||||
foreach my $nn ( @{ $req->{node}} ) {
|
||||
my $ip = xCAT::NetworkUtils::getNodeIPaddress( $nn );
|
||||
if(!defined $ip) {
|
||||
send_msg($req, "doresetnet: can't get $nn ip");
|
||||
next;
|
||||
}
|
||||
if(!exists $oihash{$nn}) {
|
||||
send_msg($req, "doresetnet: can't get $nn hosts.otherinterfaces");
|
||||
next;
|
||||
}
|
||||
my $oi = $oihash{$nn};
|
||||
if( exists($oihash{$nn}) and $ip eq $oihash{$nn}) {
|
||||
send_msg( $req, 0, "$nn: same ip address, skipping network reset" );
|
||||
} elsif (!exists $machash{$nn}){
|
||||
send_msg( $req, 0, "$nn: no mac defined, skipping network reset" );
|
||||
} else {
|
||||
$iphash{$nn}{sip} = $ip;
|
||||
$iphash{$nn}{tip} = $oihash{$nn};
|
||||
if(exists $grouphash{$vpdhash{$nn}}) {
|
||||
$grouphash{$vpdhash{$nn}} .= ",$nn";
|
||||
} else {
|
||||
$grouphash{$vpdhash{$nn}} = "$nn";
|
||||
}
|
||||
$targets->{$nodetype}->{$ip}->{'args'} = "0.0.0.0,$nn";
|
||||
$targets->{$nodetype}->{$ip}->{'mac'} = $machash{$nn};
|
||||
$targets->{$nodetype}->{$ip}->{'name'} = $nn;
|
||||
$targets->{$nodetype}->{$ip}->{'ip'} = $ip;
|
||||
$targets->{$nodetype}->{$ip}->{'type'} = $nodetype;
|
||||
my %netinfo = xCAT::DBobjUtils->getNetwkInfo( [$ip] );
|
||||
$targets->{$nodetype}->{$ip}->{'args'} .= ",$netinfo{$ip}{'gateway'},$netinfo{$ip}{'mask'}";
|
||||
#xCAT::MsgUtils->verbose_message($req, "doresetnet: get node $nn info $targets->{$nodetype}->{$ip}->{'args'},ip is $ip");
|
||||
$targets->{$nodetype}->{$oi}->{'args'} = "0.0.0.0,$nn";
|
||||
$targets->{$nodetype}->{$oi}->{'mac'} = $machash{$nn};
|
||||
$targets->{$nodetype}->{$oi}->{'name'} = $nn;
|
||||
$targets->{$nodetype}->{$oi}->{'ip'} = $oi;
|
||||
$targets->{$nodetype}->{$oi}->{'type'} = $nodetype;
|
||||
%netinfo = xCAT::DBobjUtils->getNetwkInfo( [$oi] );
|
||||
$targets->{$nodetype}->{$oi}->{'args'} .= ",$netinfo{$oi}{'gateway'},$netinfo{$oi}{'mask'}";
|
||||
#xCAT::MsgUtils->verbose_message($req, "doresetnet: get node $nn info $targets->{$nodetype}->{$oi}->{'args'}, oi is $oi");
|
||||
}
|
||||
}
|
||||
} elsif ( !$nodetype ){
|
||||
send_msg( $req, 0, "no nodetype defined, skipping network reset" );
|
||||
return;
|
||||
} else {
|
||||
send_msg( $req, 0, "$nodetype not supported, skipping network reset" );
|
||||
return;
|
||||
}
|
||||
|
||||
unless (%grouphash) {
|
||||
send_msg( $req, 0, "Failed to group the nodes, skipping network reset" );
|
||||
return;
|
||||
}
|
||||
###########################################
|
||||
# Update target hardware w/discovery info
|
||||
###########################################
|
||||
my %rsp_dev = get_rsp_dev( $req, $targets);
|
||||
|
||||
######################################################
|
||||
# Start to reset network. Fork one process per BPA/FSP
|
||||
######################################################
|
||||
%oihash = ();
|
||||
%machash = ();
|
||||
%vpdhash = ();
|
||||
$start = Time::HiRes::gettimeofday();
|
||||
my $children = 0;
|
||||
$SIG{CHLD} = sub { while (waitpid(-1, WNOHANG) > 0) { $children--; } };
|
||||
my $fds = new IO::Select;
|
||||
my $callback = $req->{callback};
|
||||
my $ij = 0;
|
||||
foreach my $node ( keys %grouphash) {
|
||||
my %iphashfornode;
|
||||
my $gc = $grouphash{$node};
|
||||
my %rsp_devfornode;
|
||||
|
||||
foreach my $tn (split /,/, $gc) {
|
||||
$iphashfornode{$tn} = $iphash{$tn};
|
||||
for my $ti (keys %{$iphash{$tn}}){
|
||||
my $tip = $iphash{$tn}{$ti};
|
||||
$rsp_devfornode{$tip} = $rsp_dev{$tip};
|
||||
}
|
||||
}
|
||||
|
||||
xCAT::MsgUtils->verbose_message($req, "========> begin to fork process for node $node");
|
||||
######################################################
|
||||
# Begin fork
|
||||
######################################################
|
||||
my $pipe;
|
||||
my $rspdevref = \%rsp_devfornode;
|
||||
my $grouphashref = $gc;
|
||||
my $iphashref = \%iphashfornode;
|
||||
my $result;
|
||||
my @data = ("RSPCONFIG6sK4ci");
|
||||
|
||||
#######################################
|
||||
# Pipe childs output back to parent
|
||||
#######################################
|
||||
my $parent;
|
||||
my $child;
|
||||
pipe $parent, $child;
|
||||
$ij ++;
|
||||
$ij = int($ij%60);
|
||||
my $pid = xCAT::Utils->xfork();
|
||||
|
||||
if ( !defined($pid) ) {
|
||||
###################################
|
||||
# Fork error
|
||||
###################################
|
||||
send_msg( $req, 1, "Fork error: $!" );
|
||||
return undef;
|
||||
}
|
||||
elsif ( $pid == 0 ) {
|
||||
sleep $ij;
|
||||
###################################
|
||||
# Child process, clear memory first
|
||||
###################################
|
||||
%rsp_dev = ();
|
||||
%grouphash = ();
|
||||
%iphash = ();
|
||||
close( $parent );
|
||||
$req->{pipe} = $child;
|
||||
my $msgs;
|
||||
my $report;
|
||||
#try and try to avoid the fail that caused by refreshing IP when doing resetnet
|
||||
my $time = 0;
|
||||
while (1) {
|
||||
my $erflag = 0;
|
||||
$msgs = child_process($grouphashref, $iphashref, $rspdevref, $req, $node );
|
||||
foreach my $port (keys %$msgs){
|
||||
unless ($msgs->{$port} =~ /successful/) {
|
||||
$erflag = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($erflag) {
|
||||
$report = ();
|
||||
foreach my $port1 (keys %$msgs){
|
||||
$report .= $port1.":".$msgs->{$port1}.";";
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($req, "========> try again, $report");
|
||||
#send_msg( $req, 0, "========> try again, $report");
|
||||
sleep 3;
|
||||
$time++;
|
||||
} else {
|
||||
last;
|
||||
}
|
||||
last if ($time > 10);
|
||||
}
|
||||
$report = ();
|
||||
foreach my $port (keys %$msgs){
|
||||
$report .= $port.":".$msgs->{$port}.";";
|
||||
}
|
||||
send_msg( $req, 0, "Resetnet result for $node is : $report");
|
||||
####################################
|
||||
# Pass result array back to parent
|
||||
####################################
|
||||
my %data;
|
||||
$data{errorcode} = 0;
|
||||
my $out = $req->{pipe};
|
||||
print $out freeze( [\%data] );
|
||||
print $out "\nENDOFFREEZE6sK4ci\n";
|
||||
exit(0);
|
||||
} else {
|
||||
###################################
|
||||
# Parent process
|
||||
###################################
|
||||
close( $child );
|
||||
$pipe = $parent ;
|
||||
}
|
||||
|
||||
|
||||
if ( $pipe ) {
|
||||
$fds->add( $pipe );
|
||||
$children++;
|
||||
}
|
||||
}
|
||||
#############################################
|
||||
# Process responses from children
|
||||
#############################################
|
||||
while ( $children > 0 ) {
|
||||
child_response( $callback, $fds );
|
||||
}
|
||||
while (child_response($callback,$fds)) {}
|
||||
|
||||
my $elapsed = Time::HiRes::gettimeofday() - $start;
|
||||
my $msg = sprintf( "Total rspconfig Time: %.3f sec\n", $elapsed );
|
||||
xCAT::MsgUtils->verbose_message($req, $msg);
|
||||
|
||||
return undef;
|
||||
}
|
||||
##########################################################################
|
||||
# child process
|
||||
##########################################################################
|
||||
sub child_process {
|
||||
my $grouphashref = shift;
|
||||
my $iphashref = shift;
|
||||
my $rspdevref = shift;
|
||||
my $req = shift;
|
||||
my $node = shift;
|
||||
my %msginfo;
|
||||
my @ns = split /,/, $grouphashref;
|
||||
my @valid_ips;
|
||||
my @portneedreset;
|
||||
my @portsuccess;
|
||||
|
||||
##########################################################
|
||||
# ping static ip firstly, if succesufully, skip resetnet
|
||||
##########################################################
|
||||
foreach my $fspport (@ns) {
|
||||
my $ip = ${$iphashref->{$fspport}}{sip};
|
||||
my $rc = system("ping -q -n -c 1 -w 1 $ip > /dev/null");
|
||||
if ($rc == 0) {
|
||||
xCAT::MsgUtils->verbose_message( $req, "ping static $ip successfully");
|
||||
push @valid_ips, $ip; # static ip should be used first
|
||||
push @portsuccess, $fspport;
|
||||
$msginfo{$fspport} = "successful";
|
||||
} else {
|
||||
xCAT::MsgUtils->verbose_message( $req, "ping static $ip failed, need to do resetnet for $fspport");
|
||||
push @portneedreset, $fspport;
|
||||
}
|
||||
}
|
||||
if (scalar (@portneedreset) == 0) {
|
||||
return \%msginfo;
|
||||
}
|
||||
###########################################
|
||||
# ping temp ip secondary
|
||||
###########################################
|
||||
foreach my $fspport (@ns) {
|
||||
my $ip = ${$iphashref->{$fspport}}{tip};
|
||||
my $rc = system("ping -q -n -c 1 -w 1 $ip > /dev/null");
|
||||
if ($rc == 0) {
|
||||
push @valid_ips, $ip;
|
||||
xCAT::MsgUtils->verbose_message( $req, "ping temp $ip successfully");
|
||||
} else {
|
||||
xCAT::MsgUtils->verbose_message( $req, "ping temp $ip failed");
|
||||
}
|
||||
}
|
||||
if (scalar (@valid_ips) == 0) {
|
||||
foreach my $fspport (@ns) {
|
||||
$msginfo{$fspport} = "failed to find valid ip to log on";
|
||||
}
|
||||
return \%msginfo;
|
||||
}
|
||||
#########################################
|
||||
# log on, no retry here
|
||||
#########################################
|
||||
my @exp;
|
||||
my $goodip;
|
||||
my $retry = 2;
|
||||
foreach my $ip(@valid_ips) {
|
||||
@exp = xCAT::PPCcfg::connect(${$rspdevref->{$ip}}{username},${$rspdevref->{$ip}}{password}, $ip);
|
||||
####################################
|
||||
# Successfully connected
|
||||
####################################
|
||||
if ( ref($exp[0]) eq "LWP::UserAgent" ) {
|
||||
$goodip = $ip;
|
||||
xCAT::MsgUtils->verbose_message( $req, "log in successfully with $ip");
|
||||
last;
|
||||
}
|
||||
}
|
||||
my $msg = "login result is :".join(',', @exp);
|
||||
xCAT::MsgUtils->verbose_message( $req, $msg);
|
||||
|
||||
####################################
|
||||
# do resetnet
|
||||
####################################
|
||||
unless ($goodip) {
|
||||
foreach my $fspport (@ns) {
|
||||
$msginfo{$fspport} = "failed to log on with $exp[0]";
|
||||
}
|
||||
return \%msginfo;
|
||||
}
|
||||
my %handled;
|
||||
my $port;
|
||||
if (scalar(@portneedreset) == 2 ) { ## do resetnet for the other port first
|
||||
$port = $portneedreset[0];
|
||||
my $ip = ${$iphashref->{$port}}{sip};
|
||||
if ($goodip eq $ip) {
|
||||
$port = $portneedreset[1];
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message( $req, "begin to reset for port $port.. good ip is $goodip, ip is $ip....................................");
|
||||
my $rc = system("ping -q -n -c 1 -w 1 $ip > /dev/null");
|
||||
unless ($rc == 0) {
|
||||
$ip = ${$iphashref->{$port}}{tip};
|
||||
$handled{network} = $ip.",".${$rspdevref->{$ip}}{args};
|
||||
my @cmds = ("network=$ip,${$rspdevref->{$ip}}{args}");
|
||||
my %request = (
|
||||
ppcretry => 1,
|
||||
verbose => 0,
|
||||
ppcmaxp => 64,
|
||||
ppctimeout => 0,
|
||||
fsptimeout => 0,
|
||||
ppcretry => 3,
|
||||
maxssh => 8,
|
||||
arg => \@cmds,
|
||||
method => \%handled,
|
||||
command => 'rspconfig',
|
||||
hwtype => ${$rspdevref->{$ip}}{type},
|
||||
);
|
||||
xCAT::MsgUtils->verbose_message( $req, "Begin to do reset for $port, nic is $ip");
|
||||
my $result = xCAT::PPCfsp::handler($ip, \%request, \@exp, 1 );
|
||||
if ($result) {
|
||||
my $errcode = ${@$result[0]}{errorcode};
|
||||
if ( $errcode == 0) {
|
||||
$msginfo{$port} = "successful";
|
||||
} else {
|
||||
my $node = ${@$result[0]}{node};
|
||||
$msginfo{$port} = @{${@{${@$node[0]}{data}}[0]}{contents}}[0];
|
||||
}
|
||||
} else {
|
||||
$msginfo{$port} = "failed with unknown reason";
|
||||
}
|
||||
} else {
|
||||
$msginfo{$port} = "successful";
|
||||
}
|
||||
}
|
||||
if ($port) {
|
||||
if ($port eq $portneedreset[0] ) {
|
||||
$port = $portneedreset[1];
|
||||
} else {
|
||||
$port = $portneedreset[0];
|
||||
}
|
||||
} else {
|
||||
$port = $portneedreset[0];
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message( $req, "begin to reset for port $port......................................");
|
||||
my $ip = ${$iphashref->{$port}}{sip};
|
||||
my $rc = system("ping -q -n -c 1 -w 1 $ip > /dev/null");
|
||||
unless ($rc == 0) { #should be unless!!!!!!!!!!!!!
|
||||
$ip = ${$iphashref->{$port}}{tip};
|
||||
$handled{network} = $ip.",".${$rspdevref->{$ip}}{args};
|
||||
my @cmds = ("network=$ip,${$rspdevref->{$ip}}{args}");
|
||||
my %request = (
|
||||
ppcretry => 1,
|
||||
verbose => 0,
|
||||
ppcmaxp => 64,
|
||||
ppctimeout => 0,
|
||||
fsptimeout => 0,
|
||||
ppcretry => 3,
|
||||
maxssh => 8,
|
||||
arg => \@cmds,
|
||||
method => \%handled,
|
||||
command => 'rspconfig',
|
||||
hwtype => ${$rspdevref->{$ip}}{type},
|
||||
);
|
||||
xCAT::MsgUtils->verbose_message( $req, "Begin to do reset for $port, nic is $ip");
|
||||
my $result = xCAT::PPCfsp::handler($ip, \%request, \@exp);
|
||||
if ($result) {
|
||||
my $errcode = ${@$result[0]}{errorcode};
|
||||
if ( $errcode == 0) {
|
||||
$msginfo{$port} = "successful";
|
||||
} else {
|
||||
my $node = ${@$result[0]}{node};
|
||||
$msginfo{$port} = @{${@{${@$node[0]}{data}}[0]}{contents}}[0];
|
||||
}
|
||||
} else {
|
||||
$msginfo{$port} = "failed with unknown reason";
|
||||
}
|
||||
} else {
|
||||
xCAT::PPCfsp::disconnect( \@exp );
|
||||
$msginfo{$port} = "successful";
|
||||
}
|
||||
return \%msginfo;
|
||||
}
|
||||
|
||||
#############################################
|
||||
# Get rsp devices and their logon info
|
||||
#############################################
|
||||
sub get_rsp_dev
|
||||
{
|
||||
my $request = shift;
|
||||
my $targets = shift;
|
||||
|
||||
my $mm = $targets->{'mm'} ? $targets->{'mm'} : {};
|
||||
my $hmc = $targets->{'hmc'} ? $targets->{'hmc'}: {};
|
||||
my $fsp = $targets->{'fsp'} ? $targets->{'fsp'}: {};
|
||||
my $bpa = $targets->{'bpa'} ? $targets->{'bpa'}: {};
|
||||
|
||||
if (%$mm)
|
||||
{
|
||||
my $bladeuser = 'USERID';
|
||||
my $bladepass = 'PASSW0RD';
|
||||
#if ( $verbose ) {
|
||||
# trace( $request, "telneting to management-modules....." );
|
||||
#}
|
||||
#############################################
|
||||
# Check passwd table for userid/password
|
||||
#############################################
|
||||
my $passtab = xCAT::Table->new('passwd');
|
||||
if ( $passtab ) {
|
||||
#my ($ent) = $passtab->getAttribs({key=>'blade'},'username','password');
|
||||
my $ent = $passtab->getNodeAttribs('blade', ['username','password']);
|
||||
if ( defined( $ent )) {
|
||||
$bladeuser = $ent->{username};
|
||||
$bladepass = $ent->{password};
|
||||
}
|
||||
}
|
||||
#############################################
|
||||
# Get userid/password
|
||||
#############################################
|
||||
my $mpatab = xCAT::Table->new('mpa');
|
||||
for my $nd ( keys %$mm ) {
|
||||
my $user = $bladeuser;
|
||||
my $pass = $bladepass;
|
||||
|
||||
if ( defined( $mpatab )) {
|
||||
#my ($ent) = $mpatab->getAttribs({mpa=>$_},'username','password');
|
||||
my $ent = $mpatab->getNodeAttribs($nd, ['username','password']);
|
||||
if ( defined( $ent->{password} )) { $pass = $ent->{password}; }
|
||||
if ( defined( $ent->{username} )) { $user = $ent->{username}; }
|
||||
}
|
||||
$mm->{$nd}->{username} = $user;
|
||||
$mm->{$nd}->{password} = $pass;
|
||||
}
|
||||
}
|
||||
if (%$hmc )
|
||||
{
|
||||
#############################################
|
||||
# Get HMC userid/password
|
||||
#############################################
|
||||
foreach ( keys %$hmc ) {
|
||||
( $hmc->{$_}->{username}, $hmc->{$_}->{password}) = xCAT::PPCdb::credentials( $hmc->{$_}->{name}, lc($hmc->{$_}->{'type'}), "hscroot" );
|
||||
xCAT::MsgUtils->verbose_message( $request, "user/passwd for $_ is $hmc->{$_}->{username} $hmc->{$_}->{password}");
|
||||
}
|
||||
}
|
||||
|
||||
if ( %$fsp)
|
||||
{
|
||||
#############################################
|
||||
# Get FSP userid/password
|
||||
#############################################
|
||||
foreach ( keys %$fsp ) {
|
||||
( $fsp->{$_}->{username}, $fsp->{$_}->{password}) = xCAT::PPCdb::credentials( $fsp->{$_}->{name}, lc($fsp->{$_}->{'type'}), "admin");
|
||||
xCAT::MsgUtils->verbose_message( $request, "user/passwd for $_ is $fsp->{$_}->{username} $fsp->{$_}->{password}");
|
||||
}
|
||||
}
|
||||
|
||||
if ( %$bpa)
|
||||
{
|
||||
#############################################
|
||||
# Get BPA userid/password
|
||||
#############################################
|
||||
foreach ( keys %$bpa ) {
|
||||
( $bpa->{$_}->{username}, $bpa->{$_}->{password}) = xCAT::PPCdb::credentials( $bpa->{$_}->{name}, lc($bpa->{$_}->{'type'}), "admin");
|
||||
xCAT::MsgUtils->verbose_message( $request, "user/passwd for $_ is $bpa->{$_}->{username} $bpa->{$_}->{password}");
|
||||
}
|
||||
}
|
||||
|
||||
return (%$mm,%$hmc,%$fsp,%$bpa);
|
||||
}
|
||||
##########################################################################
|
||||
# Invokes the callback with the specified message
|
||||
##########################################################################
|
||||
sub send_msg {
|
||||
|
||||
my $request = shift;
|
||||
my $ecode = shift;
|
||||
my %output;
|
||||
|
||||
#################################################
|
||||
# Called from child process - send to parent
|
||||
#################################################
|
||||
if ( exists( $request->{pipe} )) {
|
||||
my $out = $request->{pipe};
|
||||
|
||||
$output{errorcode} = $ecode;
|
||||
$output{data} = \@_;
|
||||
print $out freeze( [\%output] );
|
||||
print $out "\nENDOFFREEZE6sK4ci\n";
|
||||
}
|
||||
#################################################
|
||||
# Called from parent - invoke callback directly
|
||||
#################################################
|
||||
elsif ( exists( $request->{callback} )) {
|
||||
my $callback = $request->{callback};
|
||||
$output{errorcode} = $ecode;
|
||||
$output{data} = \@_;
|
||||
$callback->( \%output );
|
||||
}
|
||||
}
|
||||
##########################################################################
|
||||
# Collect output from the child processes
|
||||
##########################################################################
|
||||
sub child_response {
|
||||
|
||||
my $callback = shift;
|
||||
my $fds = shift;
|
||||
my @ready_fds = $fds->can_read(1);
|
||||
|
||||
foreach my $rfh (@ready_fds) {
|
||||
my $data = <$rfh>;
|
||||
|
||||
#################################
|
||||
# Read from child process
|
||||
#################################
|
||||
if ( defined( $data )) {
|
||||
while ($data !~ /ENDOFFREEZE6sK4ci/) {
|
||||
$data .= <$rfh>;
|
||||
}
|
||||
my $responses = thaw($data);
|
||||
|
||||
#############################
|
||||
# rspconfig results
|
||||
#############################
|
||||
if ( @$responses[0] =~ /^RSPCONFIG6sK4ci$/ ) {
|
||||
#shift @$responses;
|
||||
#my $ip = @$responses[0];
|
||||
#my @rsp1 = (@$responses[1]);
|
||||
#$rsp_result{$ip} = \@rsp1;
|
||||
#$ip = @$responses[2];
|
||||
#if ($ip) {
|
||||
# my @rsp2 = (@$responses[3]);
|
||||
# $rsp_result{$ip} = \@rsp2;
|
||||
#}
|
||||
next;
|
||||
}
|
||||
#############################
|
||||
# Message or verbose trace
|
||||
#############################
|
||||
foreach ( @$responses ) {
|
||||
$callback->( $_ );
|
||||
}
|
||||
next;
|
||||
}
|
||||
#################################
|
||||
# Done - close handle
|
||||
#################################
|
||||
$fds->remove($rfh);
|
||||
close($rfh);
|
||||
}
|
||||
}
|
||||
##########################################################################
|
||||
# Logon through remote FSP HTTP-interface
|
||||
##########################################################################
|
||||
sub connect {
|
||||
|
||||
my $username = shift;
|
||||
my $passwd = shift;
|
||||
my $server = shift;
|
||||
my $verbose = shift;
|
||||
my $lwp_log;
|
||||
|
||||
##################################
|
||||
# Use timeout
|
||||
##################################
|
||||
my $timeout = 10;
|
||||
|
||||
##################################
|
||||
# Redirect STDERR to variable
|
||||
##################################
|
||||
if ( $verbose ) {
|
||||
close STDERR;
|
||||
if ( !open( STDERR, '>', \$lwp_log )) {
|
||||
return( "Unable to redirect STDERR: $!" );
|
||||
}
|
||||
}
|
||||
$IO::Socket::SSL::VERSION = undef;
|
||||
eval { require Net::SSL };
|
||||
|
||||
##################################
|
||||
# Turn on tracing
|
||||
##################################
|
||||
if ( $verbose ) {
|
||||
LWP::Debug::level( '+' );
|
||||
}
|
||||
##################################
|
||||
# Create cookie
|
||||
##################################
|
||||
my $cookie = HTTP::Cookies->new();
|
||||
$cookie->set_cookie( 0,'asm_session','0','cgi-bin','','443',0,0,3600,0 );
|
||||
|
||||
##################################
|
||||
# Create UserAgent
|
||||
##################################
|
||||
my $ua = LWP::UserAgent->new();
|
||||
|
||||
##################################
|
||||
# Set options
|
||||
##################################
|
||||
my $url = "https://$server/cgi-bin/cgi?form=2";
|
||||
$ua->cookie_jar( $cookie );
|
||||
$ua->timeout( $timeout );
|
||||
|
||||
##################################
|
||||
# Submit logon
|
||||
##################################
|
||||
my $res = $ua->post( $url,
|
||||
[ user => $username,
|
||||
password => $passwd,
|
||||
lang => "0",
|
||||
submit => "Log in" ]
|
||||
);
|
||||
|
||||
##################################
|
||||
# Logon failed
|
||||
##################################
|
||||
if ( !$res->is_success() ) {
|
||||
return( $lwp_log.$res->status_line );
|
||||
}
|
||||
##################################
|
||||
# To minimize number of GET/POSTs,
|
||||
# if we successfully logon, we should
|
||||
# get back a valid cookie:
|
||||
# Set-Cookie: asm_session=3038839768778613290
|
||||
#
|
||||
##################################
|
||||
if ( $res->as_string =~ /Set-Cookie: asm_session=(\d+)/ ) {
|
||||
##############################
|
||||
# Successful logon....
|
||||
# Return:
|
||||
# UserAgent
|
||||
# Server hostname
|
||||
# UserId
|
||||
# Redirected STDERR/STDOUT
|
||||
##############################
|
||||
return( $ua,
|
||||
$server,
|
||||
$username,
|
||||
\$lwp_log );
|
||||
}
|
||||
##############################
|
||||
# Logon error
|
||||
##############################
|
||||
$res = $ua->get( $url );
|
||||
##############################
|
||||
# Check for specific failures
|
||||
# $res->status_line is like "200 OK"
|
||||
# $res->content is like <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" .....Too many users......</html>
|
||||
# $res->base is like https://41.17.4.2/cgi-bin/cgi?form=2
|
||||
##############################
|
||||
my $err;
|
||||
if ( $res->content =~ /Too many users/i ) {
|
||||
$err = "Too many users";
|
||||
}elsif ( $res->content =~ /Invalid user ID or password/i ) {
|
||||
$err = "Invalid user ID or password";
|
||||
}else{
|
||||
$err = "Logon failure with unknown reason";
|
||||
}
|
||||
|
||||
return ($lwp_log.$err);
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ require Exporter;
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw(SUCCESS RC_ERROR EXPECT_ERROR NR_ERROR);
|
||||
use Expect;
|
||||
use xCAT::NetworkUtils;
|
||||
|
||||
|
||||
#############################################
|
||||
# Removes Ctrl characters from term output
|
||||
@@ -1310,7 +1310,7 @@ sub getHMCcontrolIP
|
||||
my $exp = shift;
|
||||
|
||||
#get node type first
|
||||
my $type = xCAT::DBobjUtils::getnodetype($node, "ppc");
|
||||
my $type = xCAT::DBobjUtils::getnodetype($node);
|
||||
unless ($type)
|
||||
{
|
||||
return undef;
|
||||
@@ -1335,7 +1335,7 @@ sub getHMCcontrolIP
|
||||
#my @newnodes = split(/,/, $nodes_found->[0]);
|
||||
#$Rc = shift(@newnodes);
|
||||
#for my $entry (@newnodes) {
|
||||
# if(xCAT::NetworkUtils->isIpaddr($entry)) {
|
||||
# if(xCAT::Utils->isIpaddr($entry)) {
|
||||
# push @ips,$entry;
|
||||
# }
|
||||
# $ip_result = join( ",", @ips );
|
||||
|
||||
+16
-69
@@ -5,10 +5,8 @@ use strict;
|
||||
use Getopt::Long;
|
||||
use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
|
||||
use xCAT::Usage;
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT::DBobjUtils;
|
||||
use xCAT::FSPUtils;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
|
||||
##############################################
|
||||
# Globals
|
||||
##############################################
|
||||
@@ -162,7 +160,7 @@ sub mkhwconn_parse_args
|
||||
if (scalar(@no_type_nodes))
|
||||
{
|
||||
my $tmp_nodelist = join ',', @no_type_nodes;
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist. Please define first and try again."));
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist"));
|
||||
}
|
||||
|
||||
if (scalar(@bpa_ctrled_nodes))
|
||||
@@ -189,11 +187,6 @@ sub mkhwconn_parse_args
|
||||
return( usage('Wrong value of --port option. The value can be 0 or 1, and the default value is 0.'));
|
||||
}
|
||||
$request->{method} = 'mkhwconn';
|
||||
|
||||
if ( scalar( @ARGV)) {
|
||||
return(usage( "No additional flag is support by this command" ));
|
||||
}
|
||||
|
||||
return( \%opt);
|
||||
}
|
||||
|
||||
@@ -288,9 +281,6 @@ sub lshwconn_parse_args
|
||||
}
|
||||
|
||||
my $nodetype;
|
||||
my @no_type_nodes = ();
|
||||
my @no_mgt_nodes = ();
|
||||
my @error_type_nodes = ();
|
||||
for my $node ( @{$request->{node}})
|
||||
{
|
||||
#my $ent = $nodetypetab->getNodeAttribs( $node, [qw(nodetype)]);
|
||||
@@ -298,13 +288,11 @@ sub lshwconn_parse_args
|
||||
my $nodehm = $nodehmtab->getNodeAttribs( $node, [qw(mgt)]);
|
||||
if ( ! $ttype)
|
||||
{
|
||||
push @no_type_nodes, $node;
|
||||
next;
|
||||
return( ["Failed to get node type for node $node.\n"]);
|
||||
}
|
||||
if ( ! $nodehm)
|
||||
{
|
||||
push @no_mgt_nodes, $node;
|
||||
next;
|
||||
return( ["Failed to get nodehm.mgt value for node $node.\n"]);
|
||||
}
|
||||
elsif ( $nodehm->{mgt} ne 'hmc')
|
||||
{
|
||||
@@ -314,8 +302,7 @@ sub lshwconn_parse_args
|
||||
and $ttype ne 'fsp' and $ttype ne 'cec'
|
||||
and $ttype ne 'bpa' and $ttype ne 'frame')
|
||||
{
|
||||
push @error_type_nodes, $node;
|
||||
next;
|
||||
return( ["Node type $ttype is not supported for this command.\n"]);
|
||||
}
|
||||
if ( ! $nodetype)
|
||||
{
|
||||
@@ -329,19 +316,7 @@ sub lshwconn_parse_args
|
||||
}
|
||||
}
|
||||
}
|
||||
if (scalar(@no_type_nodes)) {
|
||||
my $tmp_nodelist = join ',', @no_type_nodes;
|
||||
return( ["Failed to get node type for node(s) $tmp_nodelist. Please define first and try again\n"]);
|
||||
}
|
||||
if (scalar(@no_mgt_nodes)) {
|
||||
my $tmp_nodelist = join ',', @no_mgt_nodes;
|
||||
return( ["Failed to get nodehm.mgt value for node(s) $tmp_nodelist. Please define first and try again.\n"]);
|
||||
}
|
||||
if (scalar(@error_type_nodes)) {
|
||||
my $tmp_nodelist = join ',', @error_type_nodes;
|
||||
my $link = (scalar(@error_type_nodes) == '1')? 'is':'are';
|
||||
return( ["Node type of node(s) $tmp_nodelist $link not supported for this command.\n"]);
|
||||
}
|
||||
|
||||
$request->{nodetype} = $nodetype;
|
||||
|
||||
$request->{method} = 'lshwconn';
|
||||
@@ -400,7 +375,6 @@ sub rmhwconn_parse_args
|
||||
my $newtype = xCAT::DBobjUtils::getnodetype($node);
|
||||
unless ($newtype) {
|
||||
push @no_type_nodes, $node;
|
||||
next;
|
||||
}
|
||||
|
||||
if ($newtype =~ /^(fsp|bpa)$/ )
|
||||
@@ -444,7 +418,7 @@ sub rmhwconn_parse_args
|
||||
if (scalar(@no_type_nodes))
|
||||
{
|
||||
my $tmp_nodelist = join ',', @no_type_nodes;
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist. Please define first and try again.\n"));
|
||||
return ( usage("Attribute nodetype.nodetype cannot be found for node(s) $tmp_nodelist"));
|
||||
}
|
||||
|
||||
if (scalar(@bpa_ctrled_nodes))
|
||||
@@ -474,7 +448,6 @@ sub mkhwconn
|
||||
my @value = ();
|
||||
my $Rc = undef;
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "mkhwconn START.");
|
||||
for my $cec_bpa ( keys %$hash)
|
||||
{
|
||||
my $node_hash = $hash->{$cec_bpa};
|
||||
@@ -503,12 +476,11 @@ sub mkhwconn
|
||||
} else {
|
||||
push @newnodes,$cnode;
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "mkhwconn :mksysconn for node:$node_name.");
|
||||
for my $nn ( @newnodes )
|
||||
{
|
||||
my $node_ip;
|
||||
unless ( xCAT::NetworkUtils->isIpaddr($nn) ) {
|
||||
$node_ip = xCAT::NetworkUtils::getNodeIPaddress( $nn );
|
||||
unless ( xCAT::Utils->isIpaddr($nn) ) {
|
||||
$node_ip = xCAT::Utils::getNodeIPaddress( $nn );
|
||||
} else {
|
||||
$node_ip = $nn;
|
||||
}
|
||||
@@ -552,7 +524,6 @@ sub mkhwconn
|
||||
# }
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "mkhwconn END.");
|
||||
return \@value;
|
||||
}
|
||||
##########################################################################
|
||||
@@ -643,13 +614,11 @@ sub lshwconn
|
||||
{
|
||||
#my $node_ip_hash = $hosttab->getNodeAttribs( $node_name,[qw(ip)]);
|
||||
#$node_ip = $node_ip_hash->{ip};
|
||||
#$node_ip = xCAT::NetworkUtils::getNodeIPaddress( $node_name );
|
||||
my $d = $node_hash->{$node_name};
|
||||
$node_ip = xCAT::FSPUtils::getIPaddress($request, $$d[4], $node_name );
|
||||
$node_ip = xCAT::Utils::getNodeIPaddress( $node_name );
|
||||
}
|
||||
if (!$node_ip || ($node_ip == -3))
|
||||
if (!$node_ip)
|
||||
{
|
||||
push @value, [$node_name, "Failed to get IP address.", $Rc];
|
||||
push @value, [$node_name, $node_ip, $Rc];
|
||||
next;
|
||||
}
|
||||
|
||||
@@ -693,12 +662,6 @@ sub rmhwconn
|
||||
my @value = ();
|
||||
my $Rc = undef;
|
||||
|
||||
my $nodes_found = xCAT::PPCcli::lssysconn ($exp, "all");
|
||||
if ( @$nodes_found[0] eq SUCCESS ) {
|
||||
$Rc = shift(@$nodes_found);
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
for my $cec_bpa ( keys %$hash)
|
||||
{
|
||||
my $node_hash = $hash->{$cec_bpa};
|
||||
@@ -711,30 +674,14 @@ sub rmhwconn
|
||||
############################
|
||||
# Get IP address
|
||||
############################
|
||||
#get node ip from hmc
|
||||
#my $node_ip = xCAT::PPCcli::getHMCcontrolIP($node_name, $exp);
|
||||
my $tab = xCAT::Table->new("vpd");
|
||||
my $ent;
|
||||
if ($tab) {
|
||||
$ent = $tab->getNodeAttribs($node_name, ['serial', 'mtm']);
|
||||
}
|
||||
my $serial = $ent->{'serial'};
|
||||
my $mtm = $ent->{'mtm'};
|
||||
my $node_ip;
|
||||
|
||||
my @ips;
|
||||
foreach my $entry ( @$nodes_found ) {
|
||||
if ( $entry =~ /$mtm\*$serial/) {
|
||||
$entry =~ /ipaddr=(\d+\.\d+\.\d+\.\d+),/;
|
||||
push @ips, $1;
|
||||
}
|
||||
}
|
||||
if (!@ips)
|
||||
my $node_ip = xCAT::PPCcli::getHMCcontrolIP($node_name, $exp);
|
||||
if (!$node_ip)
|
||||
{
|
||||
push @value, [$node_name, $node_ip, $Rc];
|
||||
next;
|
||||
}
|
||||
for my $nn ( @ips )
|
||||
my @newnodes = split(/,/, $node_ip);
|
||||
for my $nn ( @newnodes )
|
||||
{
|
||||
my $res = xCAT::PPCcli::rmsysconn( $exp, $type, $nn);
|
||||
$Rc = shift @$res;
|
||||
|
||||
+25
-462
@@ -4,9 +4,7 @@ package xCAT::PPCdb;
|
||||
use strict;
|
||||
use xCAT::Table;
|
||||
use xCAT::GlobalDef;
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT_plugin::lsslp;
|
||||
|
||||
###########################################
|
||||
# Factory defaults
|
||||
@@ -30,7 +28,7 @@ my %hcptab = (
|
||||
bpa => "ppcdirect",
|
||||
frame => "ppcdirect",
|
||||
cec => "ppcdirect",
|
||||
blade => "mpa",
|
||||
|
||||
);
|
||||
|
||||
###########################################
|
||||
@@ -43,7 +41,7 @@ my %defaultgrp = (
|
||||
bpa => "bpa",
|
||||
frame => "frame",
|
||||
cec => "cec",
|
||||
blade => "blade",
|
||||
|
||||
);
|
||||
my %globlehwtype = (
|
||||
fsp => $::NODETYPE_FSP,
|
||||
@@ -281,7 +279,7 @@ sub update_ppc {
|
||||
|
||||
if ( $ttype eq 'cec' )
|
||||
{
|
||||
my $hostname = get_host($tname, "FSP", $tmtm, $tsn, "", "", $tid, "","");
|
||||
my $hostname = xCAT_plugin::lsslp::gethost_from_url_or_old($tname, "FSP", $tmtm, $tsn, "", "", $tid, "","");
|
||||
if ($hostname ne $tname)
|
||||
{
|
||||
$hostname =~ /\-(\w)$/;
|
||||
@@ -297,7 +295,7 @@ sub update_ppc {
|
||||
}
|
||||
} elsif ( $ttype eq 'frame' )
|
||||
{
|
||||
my $hostname = get_host($tname, "BPA", $tmtm, $tsn, "", "", $tid, "","");
|
||||
my $hostname = xCAT_plugin::lsslp::gethost_from_url_or_old($tname, "BPA", $tmtm, $tsn, "", "", $tid, "","");
|
||||
if ($hostname ne $tname)
|
||||
{
|
||||
$hostname =~ /\-(\w)$/;
|
||||
@@ -754,13 +752,13 @@ sub credentials {
|
||||
###########################################
|
||||
# find parent for fsp/bpa, use parent's attributes first
|
||||
###########################################
|
||||
my $ntype = xCAT::DBobjUtils->getnodetype($server, "ppc");
|
||||
my $ntype = xCAT::DBobjUtils->getnodetype($server);
|
||||
if ($ntype =~ /^(fsp|bpa)$/) {
|
||||
my $ptab = xCAT::Table->new('ppc');
|
||||
if ($ptab) {
|
||||
my $parent = $ptab->getNodeAttribs($server, ["parent"]);
|
||||
if ($parent and $parent->{parent}) {
|
||||
my $ptype = xCAT::DBobjUtils->getnodetype($parent->{parent}, "ppc");
|
||||
my $ptype = xCAT::DBobjUtils->getnodetype($parent->{parent});
|
||||
if (($ptype =~ /^cec$/ and $ntype =~ /^fsp$/) or ($ptype =~ /^frame$/ and $ntype =~ /^bpa$/))
|
||||
{
|
||||
$server = $parent->{parent};
|
||||
@@ -771,44 +769,31 @@ sub credentials {
|
||||
###########################################
|
||||
# Check passwd tab
|
||||
###########################################
|
||||
#my $tab = xCAT::Table->new( 'passwd' );
|
||||
#if ( $tab ) {
|
||||
#my $ent;
|
||||
# if ( $user_specified)
|
||||
# {
|
||||
# ($ent) = $tab->getAttribs( {key=>$hwtype,username=>$user},qw(password));
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# ($ent) = $tab->getAttribs( {key=>$hwtype}, qw(username password));
|
||||
# }
|
||||
# if ( $ent ) {
|
||||
# if (defined($ent->{password})) { $pass = $ent->{password}; }
|
||||
# if (defined($ent->{username})) { $user = $ent->{username}; }
|
||||
# }
|
||||
#}
|
||||
my ($ent) = get_usr_passwd($hwtype, $user);
|
||||
if ($ent) {
|
||||
if (defined($ent->{password})) { $pass = $ent->{password};}
|
||||
if (defined($ent->{username})) { $user = $ent->{username};}
|
||||
my $tab = xCAT::Table->new( 'passwd' );
|
||||
if ( $tab ) {
|
||||
my $ent;
|
||||
if ( $user_specified)
|
||||
{
|
||||
($ent) = $tab->getAttribs( {key=>$hwtype,username=>$user},qw(password));
|
||||
}
|
||||
else
|
||||
{
|
||||
($ent) = $tab->getAttribs( {key=>$hwtype}, qw(username password));
|
||||
}
|
||||
if ( $ent ) {
|
||||
if (defined($ent->{password})) { $pass = $ent->{password}; }
|
||||
if (defined($ent->{username})) { $user = $ent->{username}; }
|
||||
}
|
||||
}
|
||||
##########################################
|
||||
# Check table based on specific node
|
||||
##########################################
|
||||
my $tab = xCAT::Table->new( $hcptab{$hwtype} );
|
||||
$tab = xCAT::Table->new( $hcptab{$hwtype} );
|
||||
if ( $tab ) {
|
||||
my $ent;
|
||||
if ( $user_specified)
|
||||
{ # need regx
|
||||
#($ent) = $tab->getAttribs( {hcp=>$server,username=>$user},qw(password));
|
||||
#($ent) = $tab->getNodeSpecAttribs( $server, {username=>$user},qw(password));
|
||||
my @output = $tab->getNodeAttribs($server, qw(username password));
|
||||
foreach my $tmp_entry (@output) {
|
||||
if ($tmp_entry->{username} =~ /^$user$/) {
|
||||
$ent = $tmp_entry;
|
||||
last;
|
||||
}
|
||||
}
|
||||
($ent) = $tab->getAttribs( {hcp=>$server,username=>$user},qw(password));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -825,15 +810,7 @@ sub credentials {
|
||||
{
|
||||
if ( $user_specified)
|
||||
{ # need regx
|
||||
#($ent) = $tab->getAllAttribs( {hcp=>$defaultgrp{$hwtype},username=>$user},qw(password));
|
||||
#($ent) = $tab->getNodeSpecAttribs( $defaultgrp{$hwtype}, {username=>$user},qw(password));
|
||||
my @output = $tab->getNodeAttribs( $defaultgrp{$hwtype}, qw(username password));
|
||||
foreach my $tmp_entry (@output) {
|
||||
if ($tmp_entry->{username} =~ /^$user$/) {
|
||||
$ent = $tmp_entry;
|
||||
last;
|
||||
}
|
||||
}
|
||||
($ent) = $tab->getAllAttribs( {hcp=>$defaultgrp{$hwtype},username=>$user},qw(password));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -848,61 +825,6 @@ sub credentials {
|
||||
return( $user,$pass );
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Get password for user in 'passwd' table, if doesn't exist, use default
|
||||
# password for this user.
|
||||
##########################################################################
|
||||
my %power_accounts = (
|
||||
HMC => 'abc123',
|
||||
general => 'general',
|
||||
admin => 'admin',
|
||||
);
|
||||
my %default_passwd_accounts = (
|
||||
system => { root => 'cluster',},
|
||||
hmc => { hscroot => 'abc123',},
|
||||
fsp => \%power_accounts,
|
||||
bpa => \%power_accounts,
|
||||
frame => \%power_accounts,
|
||||
cec => \%power_accounts,
|
||||
blade => { USERID => 'PASSW0RD',
|
||||
HMC => 'PASSW0RD'},
|
||||
ipmi => { USERID => 'PASSW0RD',},
|
||||
ivm => { padmin => 'padmin',},
|
||||
vmware => { root => '',},
|
||||
vcenter => { Administrator => ''},
|
||||
);
|
||||
|
||||
sub get_usr_passwd {
|
||||
my $key = shift;
|
||||
if ($key && ($key =~ /xCAT::/)) {
|
||||
$key = shift;
|
||||
}
|
||||
my $user = shift;
|
||||
my $ent;
|
||||
my $passwdtab = xCAT::Table->new('passwd');
|
||||
if (!$passwdtab) {
|
||||
return undef;
|
||||
}
|
||||
if ($user) {
|
||||
($ent) = $passwdtab->getAttribs({key => $key, username => $user}, qw(password cryptmethod));
|
||||
} else {
|
||||
($ent) = $passwdtab->getNodeAttribs($key, qw(username password));
|
||||
}
|
||||
if (!$ent or !$ent->{password}) {
|
||||
my $hash = $default_passwd_accounts{$key};
|
||||
if (!$hash or ($user and !defined($hash->{$user}))) {
|
||||
return undef;
|
||||
}
|
||||
if (!$user) {
|
||||
my @tmp_keys = keys (%$hash);
|
||||
$user = $tmp_keys[0];
|
||||
}
|
||||
$ent->{username} = $user;
|
||||
$ent->{password} = $hash->{$user};
|
||||
}
|
||||
return $ent;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Set userids and passwords to tables
|
||||
##########################################################################
|
||||
@@ -925,366 +847,7 @@ sub update_credentials
|
||||
|
||||
return undef;
|
||||
}
|
||||
#############################################################################
|
||||
# used for FSP/BPA redundancy database migration
|
||||
# if return something, it means it will use the old data name
|
||||
# or new data name
|
||||
# if return undef, it means the ip is not invalid and won't make any definition
|
||||
#############################################################################
|
||||
sub get_host {
|
||||
my $nodename = shift;
|
||||
my $type = shift;
|
||||
my $mtm = shift;
|
||||
my $sn = shift;
|
||||
my $side = shift;
|
||||
my $ip = shift;
|
||||
my $cage_number = shift;
|
||||
my $parmtm = shift;
|
||||
my $parsn = shift;
|
||||
my $pname = shift;
|
||||
my $flagref = shift;
|
||||
|
||||
#######################################
|
||||
# Extract IP from URL
|
||||
#######################################
|
||||
if ($ip)
|
||||
{
|
||||
my $nets = xCAT::NetworkUtils::my_nets();
|
||||
my $avip = getip_from_iplist( $ip, $nets);
|
||||
#if ( !defined( $ip )) {
|
||||
# return undef;
|
||||
#}
|
||||
}
|
||||
# get the information of existed nodes to do the migration
|
||||
|
||||
read_from_table() unless (%::OLD_DATA_CACHE);
|
||||
|
||||
foreach my $oldnode ( keys %::OLD_DATA_CACHE )
|
||||
{
|
||||
my $tmpmtm = @{$::OLD_DATA_CACHE{$oldnode}}[0];
|
||||
my $tmpsn = @{$::OLD_DATA_CACHE{$oldnode}}[1];
|
||||
my $tmpside = @{$::OLD_DATA_CACHE{$oldnode}}[2];
|
||||
my $tmpip = @{$::OLD_DATA_CACHE{$oldnode}}[3];
|
||||
my $tmpid = @{$::OLD_DATA_CACHE{$oldnode}}[4];
|
||||
my $tmpparent = @{$::OLD_DATA_CACHE{$oldnode}}[5];
|
||||
my $tmptype = uc(@{$::OLD_DATA_CACHE{$oldnode}}[6]);
|
||||
my $unmatched = @{$::OLD_DATA_CACHE{$oldnode}}[7];
|
||||
|
||||
# used to match fsp defined by xcatsetup
|
||||
# should return fast to save time
|
||||
if (($type eq "BPA" or $type eq "FSP") and ($tmptype eq $type) and $pname and $side) {
|
||||
if ($pname eq $tmpparent and $side eq $tmpside) {
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
}
|
||||
}
|
||||
|
||||
# match the existed nodes including old data and user defined data
|
||||
if (($type eq "BPA" or $type eq "FSP") and ($tmptype eq $type)) {
|
||||
unless ($tmpmtm) {
|
||||
next;
|
||||
}
|
||||
|
||||
if ( $tmpmtm eq $mtm and $tmpsn eq $sn) {
|
||||
my $ifip = xCAT::NetworkUtils->isIpaddr($oldnode);
|
||||
if ( $ifip ) {# which means that the node is defined by the new lsslp
|
||||
if ( $tmpside eq $side ) {# match! which means that node is the same as the new one
|
||||
if ( $ip eq $tmpip ) { #which means that the ip is not changed
|
||||
# maybe we should check if the ip is invalid and send a warning
|
||||
$$flagref = 1;
|
||||
return $ip;
|
||||
} else { #which means that the ip is changed
|
||||
my $vip = check_ip($ip);
|
||||
if ( !$vip ) { #which means the ip is changed and valid
|
||||
# maybe we should check if the old ip is invalid and send a warning
|
||||
# even so we should keep the definition as before
|
||||
# because this case, we can't put check_ip in the end
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
} else {
|
||||
return $ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else { # name is not a ip
|
||||
$side =~ /(\w)\-(\w)/;
|
||||
my $slot = $1;
|
||||
if ( $tmpside and $tmpside !~ /\-/ ) {# side is like A or B
|
||||
if ( $slot eq $tmpside ) {
|
||||
if ( $oldnode =~ /^Server\-/) {#judge if need to change node's name
|
||||
if ( $ip eq $tmpip ) {
|
||||
if ( $oldnode =~ /\-(A|B)$/) {
|
||||
@{$::OLD_DATA_CACHE{$oldnode}}[7] = 0;
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
} else {
|
||||
@{$::OLD_DATA_CACHE{$oldnode}}[7] = 0;
|
||||
#change node name, need to record the node here
|
||||
$::UPDATE_CACHE{$mtm.'-'.$sn} = $oldnode;
|
||||
$$flagref = 1;
|
||||
return $oldnode.'-'.$slot;
|
||||
}
|
||||
} else {# not find a matched definition, but need to use the old node name
|
||||
if ($unmatched){
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
}
|
||||
}
|
||||
} elsif ( $tmpside =~ /\-/ ) {# end of if ( $oldnode =~ /^Server\-/)
|
||||
if ( $ip eq $tmpip ) {
|
||||
@{$::OLD_DATA_CACHE{$oldnode}}[7] = 0;
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
} else{
|
||||
if ($unmatched){
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} elsif ( $tmpside =~ /\-/ ){
|
||||
if ( $side eq $tmpside ) {
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
}
|
||||
} elsif ( !$tmpside ) {
|
||||
if ( $oldnode =~ /^Server\-/) {#judge if need to change node's name
|
||||
if ( $oldnode !~ /\-(A|B)$/ ) {
|
||||
delete $::OLD_DATA_CACHE{$oldnode};
|
||||
$$flagref = 1;
|
||||
return $oldnode."-".$slot;
|
||||
}
|
||||
}
|
||||
# if mtms could match but side not defined, we will trate
|
||||
# it as the result by rscan. And alway use its name.
|
||||
delete $::OLD_DATA_CACHE{$oldnode};
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
}
|
||||
}
|
||||
}# end of if ($tmpmtm eq $mtm and $tmpsn eq $sn)
|
||||
|
||||
|
||||
}
|
||||
if ( ($type eq "FRAME" or $type eq "CEC") and ($type eq $tmptype)){
|
||||
if ( !$tmpmtm and !$tmpid) {
|
||||
next;
|
||||
}
|
||||
# user may define cec only with parent /id /type
|
||||
# we should match this situation
|
||||
if ( ($type eq "CEC") and $parmtm and $parsn and $cage_number ) {
|
||||
my $tpparmtm = @{$::OLD_DATA_CACHE{$tmpparent}}[0];
|
||||
my $tpparsn = @{$::OLD_DATA_CACHE{$tmpparent}}[1];
|
||||
if ( ($tpparmtm eq $parmtm) and ($tpparsn eq $parsn) and ($cage_number eq $tmpid) and ($type eq $tmptype) ) {
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
}
|
||||
}
|
||||
|
||||
# user may define cec/frame only with mtms
|
||||
# but what we consider here is just the data in xCAT 2.6
|
||||
if ($tmpmtm eq $mtm and $tmpsn eq $sn and $tmptype eq $type) {
|
||||
if ( $oldnode =~ /^Server\-/) {#judge if need to change node's name
|
||||
if ( $oldnode =~ /(\-A)$/) {
|
||||
$nodename = s/(\-A)$//;
|
||||
# should send a warning here
|
||||
$$flagref = 1;
|
||||
return $nodename;
|
||||
}
|
||||
else {
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
}
|
||||
} else {
|
||||
$$flagref = 1;
|
||||
return $oldnode;
|
||||
}
|
||||
}
|
||||
} # end of foreach my $oldnode ( keys %::OLD_DATA_CACHE ), not match
|
||||
}
|
||||
|
||||
# not matched, use the new name
|
||||
my $ifip = xCAT::NetworkUtils->isIpaddr($nodename);
|
||||
unless ($ifip) {
|
||||
return $nodename;
|
||||
}else {
|
||||
my $vip = check_ip($nodename);
|
||||
if ( $vip ) {#which means the ip is a valid one
|
||||
return $nodename;
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Get correct IP from ip list in SLP Attr
|
||||
##########################################################################
|
||||
sub getip_from_iplist
|
||||
{
|
||||
my $iplist = shift;
|
||||
my $nets = shift;
|
||||
my $inc = shift;
|
||||
|
||||
my @ips = split /,/, $iplist;
|
||||
my @ips2 = split /,/, $inc;
|
||||
if ( $inc)
|
||||
{
|
||||
for my $net (keys %$nets)
|
||||
{
|
||||
my $flag = 1;
|
||||
for my $einc (@ips2) {
|
||||
if ( $nets->{$net} eq $einc) {
|
||||
$flag = 0;
|
||||
}
|
||||
}
|
||||
delete $nets->{$net} if ($flag) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for my $ip (@ips)
|
||||
{
|
||||
next if ( $ip =~ /:/); #skip IPV6 addresses
|
||||
for my $net ( keys %$nets)
|
||||
{
|
||||
my ($n,$m) = split /\//,$net;
|
||||
if ( xCAT::NetworkUtils::isInSameSubnet( $n, $ip, $m, 1) and
|
||||
xCAT::NetworkUtils::isPingable( $ip))
|
||||
{
|
||||
return $ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub read_from_table {
|
||||
my %idhash;
|
||||
my %typehash;
|
||||
my %iphash;
|
||||
my %vpdhash;
|
||||
if ( !(%::OLD_DATA_CACHE))
|
||||
{
|
||||
# find out all the existed nodes' ipaddresses
|
||||
my $hoststab = xCAT::Table->new('hosts');
|
||||
if ( $hoststab ) {
|
||||
my @ipentries = $hoststab->getAllNodeAttribs( ['node','ip'] );
|
||||
for my $ipentry ( @ipentries ) {
|
||||
$iphash{$ipentry->{node}} = $ipentry->{ip};
|
||||
}
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#find out all the existed nodes' type
|
||||
my $nodetypetab = xCAT::Table->new('nodetype');
|
||||
if ( $nodetypetab ) {
|
||||
my @typeentries = $nodetypetab->getAllNodeAttribs( ['node','nodetype'] );
|
||||
for my $typeentry ( @typeentries) {
|
||||
$typehash{$typeentry->{node}} = $typeentry->{nodetype};
|
||||
}
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
|
||||
# find out all the existed nodes' mtms and side
|
||||
my $vpdtab = xCAT::Table->new( 'vpd' );
|
||||
if ( $vpdtab ) {
|
||||
my @vpdentries = $vpdtab->getAllNodeAttribs(['node','mtm','serial','side']);
|
||||
for my $entry ( @vpdentries ) {
|
||||
@{$vpdhash{$entry->{node}}}[0] = $entry->{mtm};
|
||||
@{$vpdhash{$entry->{node}}}[1] = $entry->{serial};
|
||||
@{$vpdhash{$entry->{node}}}[2] = $entry->{side};
|
||||
}
|
||||
} else {
|
||||
return 3;
|
||||
}
|
||||
# find out all the existed nodes' attributes
|
||||
my $ppctab = xCAT::Table->new('ppc');
|
||||
if ( $ppctab ) {
|
||||
my @identries = $ppctab->getAllNodeAttribs( ['node','id','parent','nodetype'] );
|
||||
for my $entry ( @identries ) {
|
||||
next if ($entry->{nodetype} =~ /lpar/);
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[0] = @{$vpdhash{$entry->{node}}}[0];#mtm
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[1] = @{$vpdhash{$entry->{node}}}[1];#sn
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[2] = @{$vpdhash{$entry->{node}}}[2];#side
|
||||
# find node ip address, check node name first, then check hosts table
|
||||
my $ifip = xCAT::NetworkUtils->isIpaddr($entry->{node});
|
||||
if ( $ifip )
|
||||
{
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[3] = $entry->{node};#ip
|
||||
} else
|
||||
{
|
||||
if ( exists ($iphash{$entry->{node}}) ) {
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[3] = $iphash{$entry->{node}};#ip
|
||||
}
|
||||
else {
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[3] = "";#ip
|
||||
}
|
||||
}
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[4] = $entry->{id};#id
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[5] = $entry->{parent};#parent
|
||||
if ( exists $entry->{nodetype}) {
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[6] = $entry->{nodetype};#nodetype
|
||||
} else {
|
||||
if ( exists ($typehash{$entry->{node}}) ) {
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[6] = $typehash{$entry->{node}};
|
||||
} else {
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[6] = "";
|
||||
}
|
||||
}
|
||||
@{$::OLD_DATA_CACHE{$entry->{node}}}[7] = 1;
|
||||
}
|
||||
} else
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
##########################################################################
|
||||
# Makesure the ip in SLP URL is valid
|
||||
# return 1 if valid, 0 if invalid
|
||||
##########################################################################
|
||||
sub check_ip {
|
||||
my $myip = shift;
|
||||
my $firstoctet = $myip;
|
||||
my @invalidiplist = (
|
||||
"192.168.2.144",
|
||||
"192.168.2.145",
|
||||
"192.168.2.146",
|
||||
"192.168.2.147",
|
||||
"192.168.2.148",
|
||||
"192.168.2.149",
|
||||
"192.168.3.144",
|
||||
"192.168.3.145",
|
||||
"192.168.3.146",
|
||||
"192.168.3.147",
|
||||
"192.168.3.148",
|
||||
"192.168.3.149",
|
||||
"169.254.",
|
||||
"127.0.0.0",
|
||||
"127",
|
||||
0,
|
||||
);
|
||||
$firstoctet =~ s/^(\d+)\..*/$1/;
|
||||
if ($firstoctet >= 224 and $firstoctet <= 239)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
foreach (@invalidiplist)
|
||||
{
|
||||
if ( $myip =~ /^($_)/ )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
1;
|
||||
|
||||
|
||||
+29
-107
@@ -2,19 +2,12 @@
|
||||
|
||||
package xCAT::PPCenergy;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use xCAT::Usage;
|
||||
use xCAT::NodeRange;
|
||||
use xCAT::DBobjUtils;
|
||||
use xCAT::FSPUtils;
|
||||
use xCAT::TableUtils qw(get_site_Master);
|
||||
|
||||
%::QUERY_ATTRS = (
|
||||
'savingstatus' => 1,
|
||||
'dsavingstatus' => 1,
|
||||
@@ -183,11 +176,11 @@ sub parse_args {
|
||||
#}
|
||||
|
||||
#my $nodetype_v = $nodetype_tb->getNodesAttribs($nodes, ['nodetype']);
|
||||
my $nodetyperef = xCAT::DBobjUtils->getnodetype($nodes, "ppc");
|
||||
my $nodetyperef = xCAT::DBobjUtils->getnodetype($nodes);
|
||||
my $i = 0;
|
||||
foreach my $node (@{$nodes}) {
|
||||
if ($$nodetyperef{$node} ne 'fsp' &&
|
||||
$$nodetyperef{$node} ne 'cec') {
|
||||
if (@$nodetyperef[$i] ne 'fsp' &&
|
||||
@$nodetyperef[$i] ne 'cec') {
|
||||
push @notfspnodes, $node;
|
||||
}
|
||||
$i++;
|
||||
@@ -241,7 +234,7 @@ sub renergy {
|
||||
}
|
||||
|
||||
# get the user and passwd for hcp: hmc, fsp, cec
|
||||
my $hcp_type = xCAT::DBobjUtils->getnodetype($hcphost, "ppc");
|
||||
my $hcp_type = xCAT::DBobjUtils->getnodetype($hcphost);
|
||||
my $user;
|
||||
my $password;
|
||||
if ($hcp_type eq "hmc") {
|
||||
@@ -257,11 +250,7 @@ sub renergy {
|
||||
if( !defined($fsps) ) {
|
||||
return ([[$node, "Failed to get the FSPs for the cec $hcphost.", -1]]);
|
||||
}
|
||||
#my $hcp_ip = xCAT::NetworkUtils::getNodeIPaddress($hcphost);
|
||||
my $hcp_ip = xCAT::FSPUtils::getIPaddress($request, $hw_type, $hcphost);
|
||||
if (!defined($hcp_ip) or ($hcp_ip == -3)) {
|
||||
return ([[$node, "Failed to get IP address for $hcphost.", -1]]);
|
||||
}
|
||||
my $hcp_ip = xCAT::Utils::getNodeIPaddress($hcphost);
|
||||
push @hcps_ip, split(',', $hcp_ip);
|
||||
my $fsp_node = $$fsps[0];
|
||||
($user, $password) = xCAT::PPCdb::credentials( $fsp_node, "fsp",'HMC');
|
||||
@@ -270,95 +259,39 @@ sub renergy {
|
||||
}
|
||||
} else {
|
||||
# for the case that hcp is hmc or fsp
|
||||
push @hcps_ip, xCAT::NetworkUtils::getNodeIPaddress($hcphost);
|
||||
push @hcps_ip, xCAT::Utils::getNodeIPaddress($hcphost);
|
||||
}
|
||||
|
||||
if (!$user || !$password) {
|
||||
return ([[$node, "Cannot get user:password for the node. Please check table 'ppchcp' or 'ppcdirect'.", -1]]);
|
||||
}
|
||||
|
||||
# secure passwd in verbose mode
|
||||
my $tmpv = $verbose;
|
||||
$verbose = 0;
|
||||
if ($verbose) {
|
||||
push @return_msg, [$node, "Attributes of $node:\n User=$user\n Password=$password\n CEC=$cec_name\n nodetype=$hw_type\n inithcp=$hcphost\n hcps=@hcps_ip\n hcptype=$hcp_type", 0];
|
||||
}
|
||||
$verbose = $tmpv;
|
||||
|
||||
my $master = xCAT::Utils->get_site_Master();
|
||||
my $masterip = xCAT::NetworkUtils->getipaddr($master);
|
||||
if ($masterip =~ /:/) { #IPv6, needs fping6 support
|
||||
if (!-x '/usr/bin/fping6')
|
||||
{
|
||||
push @return_msg, [$node, "fping6 is not availabe for IPv6 ping.", -1];
|
||||
return \@return_msg;
|
||||
}
|
||||
open (FPING, "fping6 ".join(' ',@hcps_ip). " 2>&1 |") or die("Cannot open fping pipe: $!");
|
||||
} else {
|
||||
open (FPING, "fping ".join(' ',@hcps_ip). " 2>&1 |") or die("Cannot open fping pipe: $!");
|
||||
}
|
||||
|
||||
my @pingable_hcp;
|
||||
if (-x '/usr/bin/nmap' or -x '/usr/local/bin/nmap') { #use nmap
|
||||
#print "use nmap\n";
|
||||
if ($verbose) {
|
||||
push @return_msg, [$node, "Checking ping status using nmap for @hcps_ip", 0];
|
||||
}
|
||||
my %deadnodes;
|
||||
foreach (@hcps_ip) {
|
||||
$deadnodes{$_}=1;
|
||||
}
|
||||
open (NMAP, "nmap -PE --system-dns --send-ip -sP ". join(' ',@hcps_ip) . " 2> /dev/null|") or die("Cannot open nmap pipe: $!");
|
||||
my $node1;
|
||||
my $msg1;
|
||||
while (<NMAP>) {
|
||||
#print "$_\n";
|
||||
if (/Host (.*) \((.*)\) appears to be up/) {
|
||||
$node1=$2;
|
||||
unless ($deadnodes{$node1}) {
|
||||
foreach (keys %deadnodes) {
|
||||
if ($node1 =~ /^$_\./) {
|
||||
$node1 = $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete $deadnodes{$node1};
|
||||
if ($verbose) {
|
||||
push @return_msg, [$node, $_, 0];
|
||||
}
|
||||
push(@pingable_hcp, $node1);
|
||||
} elsif (/Nmap scan report for ([^ ]*) \((.*)\)/) {
|
||||
$node1=$2;
|
||||
$msg1=$_;
|
||||
} elsif (/Host is up./) {
|
||||
unless ($deadnodes{$node1}) {
|
||||
foreach (keys %deadnodes) {
|
||||
if ($node1 =~ /^$_\./) {
|
||||
$node1 = $_;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete $deadnodes{$node1};
|
||||
if ($verbose) {
|
||||
push @return_msg, [$node, "$msg1$_", 0];
|
||||
}
|
||||
push(@pingable_hcp, $node1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#use fping
|
||||
#print "use fping\n";
|
||||
my $master = xCAT::TableUtils->get_site_Master();
|
||||
my $masterip = xCAT::NetworkUtils->getipaddr($master);
|
||||
if ($masterip =~ /:/) { #IPv6, needs fping6 support
|
||||
if (!-x '/usr/bin/fping6')
|
||||
{
|
||||
push @return_msg, [$node, "fping6 is not availabe for IPv6 ping.", -1];
|
||||
return \@return_msg;
|
||||
}
|
||||
open (FPING, "fping6 ".join(' ',@hcps_ip). " 2>&1 |") or die("Cannot open fping pipe: $!");
|
||||
} else {
|
||||
open (FPING, "fping ".join(' ',@hcps_ip). " 2>&1 |") or die("Cannot open fping pipe: $!");
|
||||
}
|
||||
|
||||
while (<FPING>) {
|
||||
if ($verbose) {
|
||||
push @return_msg, [$node, $_, 0];
|
||||
}
|
||||
if ($_ =~ /is alive/) {
|
||||
s/ is alive//;
|
||||
push @pingable_hcp, $_;
|
||||
}
|
||||
}
|
||||
while (<FPING>) {
|
||||
if ($verbose) {
|
||||
push @return_msg, [$node, $_, 0];
|
||||
}
|
||||
if ($_ =~ /is alive/) {
|
||||
s/ is alive//;
|
||||
push @pingable_hcp, $_;
|
||||
}
|
||||
}
|
||||
|
||||
if (!@pingable_hcp) {
|
||||
@@ -377,23 +310,17 @@ sub renergy {
|
||||
# Generate the url path for CIM communication
|
||||
chomp($hcp);
|
||||
my $url_path = "https://"."$user".":"."$password"."\@"."$hcp".":5989";
|
||||
|
||||
# Not display password in command outupt.
|
||||
my $display_url_path = "https://"."$user".":"."xxxxxx"."\@"."$hcp".":5989";
|
||||
|
||||
# Execute the request
|
||||
my $cmd = "";
|
||||
my $display_cmd = "";
|
||||
if ($opt->{'set'}) {
|
||||
$cmd = "$::CIM_CLIENT_PATH $verb_arg -u $url_path -n $cec_name -o $opt->{'set'}";
|
||||
$display_cmd = "$::CIM_CLIENT_PATH $verb_arg -u $display_url_path -n $cec_name -o $opt->{'set'}";
|
||||
} elsif ($opt->{'query'}) {
|
||||
$cmd = "$::CIM_CLIENT_PATH $verb_arg -u $url_path -n $cec_name -o $opt->{'query'}";
|
||||
$display_cmd = "$::CIM_CLIENT_PATH $verb_arg -u $display_url_path -n $cec_name -o $opt->{'query'}";
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
push @noerr_msg, [$node, "Run following command: $display_cmd", 0];
|
||||
push @noerr_msg, [$node, "Run following command: $cmd", 0];
|
||||
}
|
||||
|
||||
# Disable the CHID signal before run the command. Otherwise the
|
||||
@@ -402,12 +329,7 @@ sub renergy {
|
||||
|
||||
# Call the xCAT_cim_client to query or set the energy capabilities
|
||||
$cmd .= " 2>&1";
|
||||
|
||||
# secure passwd in verbose mode
|
||||
my $tmpv = $::VERBOSE;
|
||||
$::VERBOSE = 0;
|
||||
my @result = xCAT::Utils->runcmd("$cmd", -1);
|
||||
$::VERBOSE = $tmpv;
|
||||
|
||||
foreach my $line (@result) {
|
||||
chomp($line);
|
||||
|
||||
@@ -10,10 +10,8 @@ use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
|
||||
use xCAT::Usage;
|
||||
use Socket;
|
||||
use xCAT::PPCdb;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use xCAT::NetworkUtils;
|
||||
|
||||
|
||||
##########################################
|
||||
# Globals
|
||||
##########################################
|
||||
@@ -52,7 +50,6 @@ sub handler {
|
||||
my $server = shift;
|
||||
my $request = shift;
|
||||
my $exp = shift;
|
||||
my $flag = shift;
|
||||
|
||||
#####################################
|
||||
# Convert command to correct format
|
||||
@@ -77,9 +74,7 @@ sub handler {
|
||||
#####################################
|
||||
# Disconnect from FSP
|
||||
#####################################
|
||||
unless ($flag) {
|
||||
xCAT::PPCfsp::disconnect( $exp );
|
||||
}
|
||||
return( \@outhash );
|
||||
|
||||
}
|
||||
@@ -373,10 +368,7 @@ sub process_cmd {
|
||||
# Return error
|
||||
##################################
|
||||
if ( !$res->is_success() ) {
|
||||
my @tmpres = (RC_ERROR, $res->status_line);
|
||||
my @rs;
|
||||
push @rs, \@tmpres;
|
||||
return(\@rs );
|
||||
return( [RC_ERROR,$res->status_line] );
|
||||
}
|
||||
##################################
|
||||
# Build hash of expanded menus
|
||||
@@ -392,15 +384,11 @@ sub process_cmd {
|
||||
##############################
|
||||
my $form = $menu{$cmds{$command}{$_}[0]};
|
||||
if ( !defined( $form )) {
|
||||
my @tmpres = (RC_ERROR, "Cannot find '$cmds{$command}{$_}[0]' menu");
|
||||
my @rs;
|
||||
push @rs, \@tmpres;
|
||||
return(\@rs );
|
||||
return( [RC_ERROR,"Cannot find '$cmds{$command}{$_}[0]' menu"] );
|
||||
}
|
||||
##################################
|
||||
# Run command
|
||||
##################################
|
||||
xCAT::MsgUtils->verbose_message($request, "$command :$_ for node:$server.");
|
||||
my $res = $cmds{$command}{$_}[1]($exp, $request, $form, \%menu);
|
||||
push @$res, $_;
|
||||
push @result, $res;
|
||||
@@ -1788,7 +1776,7 @@ sub get_netcfg
|
||||
# Return error
|
||||
##################################
|
||||
if ( !defined( $$form )) {
|
||||
return( [RC_ERROR,"'Network Configuration' form not found at parse"] );
|
||||
return( [RC_ERROR,"'Network Configuration' form not found"] );
|
||||
}
|
||||
|
||||
##################################
|
||||
@@ -1808,15 +1796,14 @@ sub get_netcfg
|
||||
$res = $ua->request( $data);
|
||||
$$form = HTML::Form->parse( $res->content, $res->base );
|
||||
if ( !defined( $$form )) {
|
||||
return( [RC_ERROR,"'Network Configuration' form not found at submit"] );
|
||||
return( [RC_ERROR,"'Network Configuration' form not found"] );
|
||||
}
|
||||
} elsif ( $$form->find_input('submit', 'submit', 1) ) {
|
||||
my $data = $$form->click('submit');
|
||||
sleep 5;
|
||||
$res = $ua->request( $data);
|
||||
$$form = HTML::Form->parse( $res->content, $res->base );
|
||||
if ( !defined( $$form )) {
|
||||
return( [RC_ERROR,"'Network Configuration' form not found at submit2"] );
|
||||
return( [RC_ERROR,"'Network Configuration' form not found' form not found"] );
|
||||
}
|
||||
if ( $$form->find_input('ip', 'radio', 1))
|
||||
{
|
||||
@@ -1832,7 +1819,7 @@ sub get_netcfg
|
||||
$res = $ua->request( $data);
|
||||
$$form = HTML::Form->parse( $res->content, $res->base );
|
||||
if ( !defined( $$form )) {
|
||||
return( [RC_ERROR,"'Network Configuration' form not found at submit3"] );
|
||||
return( [RC_ERROR,"'Network Configuration' form not found"] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1914,7 +1901,7 @@ sub set_netcfg
|
||||
elsif ( $inc_ip eq '*')
|
||||
{
|
||||
$inc_type = 'Static';
|
||||
($inc_ip, $inc_host, $inc_gateway, $inc_netmask) = xCAT::NetworkUtils::getNodeNetworkCfg(@$exp[1]);
|
||||
($inc_ip, $inc_host, $inc_gateway, $inc_netmask) = xCAT::Utils::getNodeNetworkCfg(@$exp[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1993,7 +1980,6 @@ sub set_netcfg
|
||||
}
|
||||
|
||||
#Click "Continue" button
|
||||
sleep 2;
|
||||
my $data = $form->click('save');
|
||||
my $res = $ua->request( $data);
|
||||
if (!$res->is_success())
|
||||
|
||||
@@ -59,7 +59,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|Verbose) )) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
|
||||
+68
-127
@@ -4,14 +4,9 @@ package xCAT::PPCmac;
|
||||
use Socket;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Data::Dumper;
|
||||
use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use xCAT::ServiceNodeUtils;
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
use xCAT::LparNetbootExp;
|
||||
|
||||
|
||||
##########################################################################
|
||||
# Parse the command line for options and operands
|
||||
@@ -49,7 +44,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt,qw(h|help V|verbose v|version C=s G=s S=s D d f M o F=s arp))) {
|
||||
if ( !GetOptions( \%opt,qw(h|help V|Verbose v|version C=s G=s S=s D d f o F=s arp))) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@@ -77,15 +72,6 @@ sub parse_args {
|
||||
return(usage( "Invalid Argument: $ARGV[0]" ));
|
||||
}
|
||||
####################################
|
||||
# Check -o argument
|
||||
####################################
|
||||
if ( exists($opt{o}) ) {
|
||||
unless (exists($opt{D})){
|
||||
return(usage( "The -o flag must be used with -D flag" ));
|
||||
}
|
||||
|
||||
}
|
||||
####################################
|
||||
# Check argument for ping test
|
||||
####################################
|
||||
if ( exists($opt{D}) ) {
|
||||
@@ -102,9 +88,9 @@ sub parse_args {
|
||||
if ( exists($opt{S}) ) {
|
||||
push @network, $_;
|
||||
} else {
|
||||
$server = xCAT::ServiceNodeUtils->getSNformattedhash( $node, "xcat", "node", "primary" );
|
||||
$server = xCAT::Utils->getSNformattedhash( $node, "xcat", "node", "primary" );
|
||||
foreach my $key ( keys %$server ) {
|
||||
my $valid_ip = xCAT::NetworkUtils->validate_ip( $key );
|
||||
my $valid_ip = xCAT::Utils->validate_ip( $key );
|
||||
if ( $valid_ip ) {
|
||||
###################################################
|
||||
# Service node is returned as hostname, Convert
|
||||
@@ -209,7 +195,7 @@ sub parse_args {
|
||||
if ( scalar(@network) != 3 ) {
|
||||
return( usage() );
|
||||
}
|
||||
my $result = xCAT::NetworkUtils->validate_ip( $opt{C}, $opt{G}, $opt{S} );
|
||||
my $result = xCAT::Utils->validate_ip( $opt{C}, $opt{G}, $opt{S} );
|
||||
if ( @$result[0] ) {
|
||||
return(usage( @$result[1] ));
|
||||
}
|
||||
@@ -253,7 +239,6 @@ sub do_getmacs {
|
||||
my $ssh = @$exp[0];
|
||||
my $userid = @$exp[4];
|
||||
my $pw = @$exp[5];
|
||||
my %optarg;
|
||||
my $cmd;
|
||||
my $result;
|
||||
|
||||
@@ -270,18 +255,18 @@ sub do_getmacs {
|
||||
my $fsp = @$d[2];
|
||||
my $hcp = @$d[3];
|
||||
|
||||
########################################
|
||||
## Find Expect script
|
||||
########################################
|
||||
#$cmd = ($::XCATROOT) ? "$::XCATROOT/sbin/" : "/opt/xcat/sbin/";
|
||||
#$cmd .= "lpar_netboot.expect";
|
||||
#
|
||||
########################################
|
||||
## Check command installed
|
||||
########################################
|
||||
#if ( !-x $cmd ) {
|
||||
# return( [RC_ERROR,"Command not installed: $cmd"] );
|
||||
#}
|
||||
#######################################
|
||||
# Find Expect script
|
||||
#######################################
|
||||
$cmd = ($::XCATROOT) ? "$::XCATROOT/sbin/" : "/opt/xcat/sbin/";
|
||||
$cmd .= "lpar_netboot.expect";
|
||||
|
||||
#######################################
|
||||
# Check command installed
|
||||
#######################################
|
||||
if ( !-x $cmd ) {
|
||||
return( [RC_ERROR,"Command not installed: $cmd"] );
|
||||
}
|
||||
#######################################
|
||||
# Save user name and passwd of hcp to
|
||||
# environment variables.
|
||||
@@ -294,16 +279,13 @@ sub do_getmacs {
|
||||
# Turn on verbose and debugging
|
||||
#######################################
|
||||
if ( exists($request->{verbose}) ) {
|
||||
#$cmd.= " -v -x";
|
||||
$optarg{'v'} = 1; #for verbose
|
||||
$optarg{'x'} = 1; #for debug
|
||||
$cmd.= " -v -x";
|
||||
}
|
||||
#######################################
|
||||
# Force LPAR shutdown
|
||||
#######################################
|
||||
if ( exists( $opt->{f} )) {
|
||||
#$cmd.= " -i";
|
||||
$optarg{'i'} = 1;
|
||||
$cmd.= " -i";
|
||||
} else {
|
||||
#################################
|
||||
# Force LPAR shutdown if LPAR is
|
||||
@@ -319,8 +301,7 @@ sub do_getmacs {
|
||||
my $osname = "AIX";
|
||||
if ( grep(/^$node$/, @nodelist) ) {
|
||||
if ( !grep(/^$osname$/, @oslist) ) {
|
||||
#$cmd.= " -i";
|
||||
$optarg{'i'} = 1;
|
||||
$cmd.= " -i";
|
||||
}
|
||||
$intable = 1;
|
||||
last;
|
||||
@@ -333,18 +314,15 @@ sub do_getmacs {
|
||||
# but mnt node is running Linux
|
||||
#################################
|
||||
if ( xCAT::Utils->isLinux() && $intable == 0 ) {
|
||||
#$cmd.= " -i";
|
||||
$optarg{'i'} = 1;
|
||||
$cmd.= " -i";
|
||||
}
|
||||
}
|
||||
|
||||
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
|
||||
if ( grep /hf/, $client_nethash{$node}{mgtifname} ) {
|
||||
#$cmd.= " -t hfi-ent";
|
||||
$optarg{'t'} = "hfi-ent";
|
||||
$cmd.= " -t hfi-ent";
|
||||
} else {
|
||||
#$cmd.= " -t ent";
|
||||
$optarg{'t'} = "ent";
|
||||
$cmd.= " -t ent";
|
||||
}
|
||||
|
||||
#######################################
|
||||
@@ -352,66 +330,50 @@ sub do_getmacs {
|
||||
#######################################
|
||||
if ( exists( $opt->{S} )) {
|
||||
if ( exists( $opt->{o} )) {
|
||||
#$cmd .=" -o";
|
||||
$optarg{'o'} = 1;
|
||||
$cmd .=" -o";
|
||||
}
|
||||
#$cmd.= " -D -s auto -d auto -S $opt->{S} -G $opt->{G} -C $opt->{C}";
|
||||
$optarg{'D'} = 1;
|
||||
$optarg{'s'} = 'auto';
|
||||
$optarg{'d'} = 'auto';
|
||||
$optarg{'S'} = $opt->{S};
|
||||
$optarg{'C'} = $opt->{C};
|
||||
$optarg{'G'} = $opt->{G};
|
||||
$cmd.= " -D -s auto -d auto -S $opt->{S} -G $opt->{G} -C $opt->{C}";
|
||||
}
|
||||
#######################################
|
||||
# Add command options
|
||||
#######################################
|
||||
#$cmd.= " -f -M -A -n \"$name\" \"$pprofile\" \"$fsp\" $id $hcp \"$node\"";
|
||||
$optarg{'f'} = 1;
|
||||
$optarg{'M'} = 1;
|
||||
$optarg{'A'} = 1;
|
||||
$optarg{'n'} = $name;
|
||||
$optarg{'pprofile'} = $pprofile;
|
||||
$optarg{'fsp'} = $fsp;
|
||||
$optarg{'id'} = $id;
|
||||
$optarg{'hcp'} = $hcp;
|
||||
$optarg{'node'} = $node;
|
||||
$cmd.= " -f -M -A -n \"$name\" \"$pprofile\" \"$fsp\" $id $hcp \"$node\"";
|
||||
|
||||
########################################
|
||||
## Execute command
|
||||
########################################
|
||||
#my $pid = open( OUTPUT, "$cmd 2>&1 |");
|
||||
#$SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down
|
||||
# kill 9, $pid;
|
||||
# return( [RC_ERROR,"Received INT or TERM signal"] );
|
||||
#};
|
||||
#if ( !$pid ) {
|
||||
# return( [RC_ERROR,"$cmd fork error: $!"] );
|
||||
#}
|
||||
########################################
|
||||
## Get command output
|
||||
########################################
|
||||
#while ( <OUTPUT> ) {
|
||||
# $result.=$_;
|
||||
#}
|
||||
#close OUTPUT;
|
||||
#
|
||||
########################################
|
||||
## Get command exit code
|
||||
########################################
|
||||
#
|
||||
#foreach ( split /\n/, $result ) {
|
||||
# if ( /^lpar_netboot / ) {
|
||||
# $Rc = RC_ERROR;
|
||||
# last;
|
||||
# }
|
||||
#}
|
||||
xCAT::MsgUtils->verbose_message($request, "getmacs :lparnetbootexp for node:$node.");
|
||||
my $Rc = xCAT::LparNetbootExp->lparnetbootexp(\%optarg, $request);
|
||||
#######################################
|
||||
# Execute command
|
||||
#######################################
|
||||
my $pid = open( OUTPUT, "$cmd 2>&1 |");
|
||||
$SIG{INT} = $SIG{TERM} = sub { #prepare to process job termination and propogate it down
|
||||
kill 9, $pid;
|
||||
return( [RC_ERROR,"Received INT or TERM signal"] );
|
||||
};
|
||||
if ( !$pid ) {
|
||||
return( [RC_ERROR,"$cmd fork error: $!"] );
|
||||
}
|
||||
|
||||
#######################################
|
||||
# Get command output
|
||||
#######################################
|
||||
while ( <OUTPUT> ) {
|
||||
$result.=$_;
|
||||
}
|
||||
close OUTPUT;
|
||||
|
||||
#######################################
|
||||
# Get command exit code
|
||||
#######################################
|
||||
my $Rc = SUCCESS;
|
||||
|
||||
foreach ( split /\n/, $result ) {
|
||||
if ( /^lpar_netboot / ) {
|
||||
$Rc = RC_ERROR;
|
||||
last;
|
||||
}
|
||||
}
|
||||
######################################
|
||||
# Split results into array
|
||||
######################################
|
||||
return $Rc;
|
||||
return( [$Rc, split( /\n/, $result)] );
|
||||
}
|
||||
|
||||
|
||||
@@ -573,25 +535,14 @@ sub getmacs {
|
||||
# specified
|
||||
#########################################
|
||||
if ( defined($filter) ) {
|
||||
my $matched = 0;
|
||||
foreach my $key ( keys %$filter ) {
|
||||
if ( $key eq "MAC_Address" ) {
|
||||
my $mac = lc($att{$key});
|
||||
my $filter_mac = lc($filter->{$key});
|
||||
|
||||
$mac =~ s/://g;
|
||||
$filter_mac =~ s/://g;
|
||||
|
||||
if ( grep(/$filter_mac/, $mac) ) {
|
||||
$matched = 1;
|
||||
last;
|
||||
}
|
||||
} elsif ( grep(/$filter->{$key}/, $att{$key}) ) {
|
||||
$matched = 1;
|
||||
my $matched = 1;
|
||||
foreach ( keys %$filter ) {
|
||||
if ( $att{$_} ne $filter->{$_} ) {
|
||||
$matched = 0;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ( $matched ) {
|
||||
if ( $matched == 1 ) {
|
||||
push @$value,"$att{'Type'} $att{'Phys_Port_Loc'} $att{'MAC_Address'} $att{'Adapter'} $att{'Port_Group'} $att{'Phys_Port'} $att{'Logical_Port'} $att{'VLan'} $att{'VSwitch'} $att{'Curr_Conn_Speed'}";
|
||||
}
|
||||
} else {
|
||||
@@ -644,7 +595,6 @@ sub getmacs {
|
||||
#########################################
|
||||
# Connect to fsp to achieve MAC address
|
||||
#########################################
|
||||
xCAT::MsgUtils->verbose_message($request, "getmacs START.");
|
||||
my $d = $par;
|
||||
|
||||
#########################################
|
||||
@@ -665,7 +615,6 @@ sub getmacs {
|
||||
# Get name known by HCP
|
||||
#########################################
|
||||
my $filter = "name,lpar_id";
|
||||
xCAT::MsgUtils->verbose_message($request, "getmacs :lssyscfg filter '$filter'.");
|
||||
my $values = xCAT::PPCcli::lssyscfg( $exp, $type, $mtms, $filter );
|
||||
my $Rc = shift(@$values);
|
||||
|
||||
@@ -691,14 +640,9 @@ sub getmacs {
|
||||
return( [[$node,"Node not found, lparid=$lparid",RC_ERROR]] );
|
||||
}
|
||||
|
||||
#my $sitetab = xCAT::Table->new('site');
|
||||
#my $vcon = $sitetab->getAttribs({key => "conserverondemand"}, 'value');
|
||||
#there may be something wrong with the conserverondemand attribute.
|
||||
# Currently, the code is not used. So not fix this time. Just keep it here.
|
||||
my @vcons = xCAT::TableUtils->get_site_attribute("conserverondemand");
|
||||
my $vcon = $vcons[0];
|
||||
#if ($vcon and $vcon->{"value"} and $vcon->{"value"} eq "yes" ) {
|
||||
if ( defined($vcon) and $vcon eq "yes" ) {
|
||||
my $sitetab = xCAT::Table->new('site');
|
||||
my $vcon = $sitetab->getAttribs({key => "conserverondemand"}, 'value');
|
||||
if ($vcon and $vcon->{"value"} and $vcon->{"value"} eq "yes" ) {
|
||||
$result = xCAT::PPCcli::lpar_netboot(
|
||||
$exp,
|
||||
$request->{verbose},
|
||||
@@ -709,12 +653,10 @@ sub getmacs {
|
||||
#########################################
|
||||
# Manually collect MAC addresses.
|
||||
#########################################
|
||||
xCAT::MsgUtils->verbose_message($request, "getmacs :do_getmacs for node:$node.");
|
||||
$result = do_getmacs( $request, $d, $exp, $name, $node );
|
||||
$Rc = shift(@$result);
|
||||
}
|
||||
#$sitetab->close;
|
||||
|
||||
$sitetab->close;
|
||||
$Rc = shift(@$result);
|
||||
|
||||
##################################
|
||||
# Form string from array results
|
||||
@@ -765,7 +707,6 @@ sub getmacs {
|
||||
if ( !exists( $opt->{d} )) {
|
||||
writemac( $node, $result );
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "getmacs END.");
|
||||
return( [[$node,$data,$Rc]] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ sub parse_args {
|
||||
my $command = $request->{command};
|
||||
my $args = $request->{arg};
|
||||
my %opt = ();
|
||||
my @rpower = qw(on onstandby off softoff stat state reset boot of sms rackstandby exit_rackstandby lowpower resetsp cycle);
|
||||
my @rpower = qw(on onstandby off softoff stat state reset boot of sms rackstandby exit_rackstandby lowpower resetsp);
|
||||
|
||||
#############################################
|
||||
# Responds with usage statement
|
||||
@@ -40,7 +40,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose m:s@ t=s T=s r=s nodeps) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|Verbose m:s@ t=s r=s nodeps) )) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@@ -83,24 +83,6 @@ sub parse_args {
|
||||
return(usage());
|
||||
}
|
||||
}
|
||||
|
||||
if( ! exists $opt{T} )
|
||||
{
|
||||
$opt{T} = "lpar"; #defaut value is lpar.
|
||||
}
|
||||
|
||||
if( $opt{T} eq "lpar") {
|
||||
$opt{T} = 0;
|
||||
} elsif($opt{T} eq "fnm") {
|
||||
$opt{T} = 1;
|
||||
if ( $request->{op} !~ /^(onstandby|state|stat)$/) {
|
||||
return(usage("The tooltype fnm only could be used with onstandby/state/stat action."));
|
||||
}
|
||||
} else {
|
||||
return( usage('Wrong value of -T option. The value can be lpar or fnm. The defaut value is lpar.'));
|
||||
}
|
||||
|
||||
|
||||
return( \%opt );
|
||||
}
|
||||
|
||||
|
||||
+17
-39
@@ -8,8 +8,6 @@ use xCAT::Usage;
|
||||
use xCAT::PPCinv;
|
||||
use xCAT::DSHCLI;
|
||||
use xCAT::Table;
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use Getopt::Long;
|
||||
use File::Spec;
|
||||
use POSIX qw(tmpnam);
|
||||
@@ -51,6 +49,7 @@ sub parse_args {
|
||||
my %opt = ();
|
||||
my $cmd = $request->{command};
|
||||
my $args = $request->{arg};
|
||||
|
||||
#############################################
|
||||
# Change CEC/Frame node into FSPs/BPAs
|
||||
#############################################
|
||||
@@ -95,7 +94,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(h|help v|version V|verbose p=s d=s activate=s commit recover bpa_acdl) )) {
|
||||
if ( !GetOptions( \%opt, qw(h|help v|version V|verbose p=s d=s activate=s commit recover) )) {
|
||||
return( usage() );
|
||||
}
|
||||
|
||||
@@ -103,10 +102,7 @@ sub parse_args {
|
||||
# Option -v for version
|
||||
####################################
|
||||
if ( exists( $opt{v} )) {
|
||||
if (!defined($::VERSION)) {
|
||||
return ([xCAT::Usage->getVersion($cmd)]);
|
||||
}
|
||||
return( [$::VERSION] );
|
||||
return( \$::VERSION );
|
||||
}
|
||||
|
||||
if ( exists( $opt{h}) || $opt{help}) {
|
||||
@@ -116,11 +112,6 @@ sub parse_args {
|
||||
#################################
|
||||
#Option --activate not valid with --commit or --recover
|
||||
#################################
|
||||
if (exists($opt{bpa_acdl}) && (exists($opt{activate}) || exists($opt{commit}) ||
|
||||
exists($opt{recover}) || exists($opt{p}) || exists($opt{d}))) {
|
||||
return ( usage("Option --bpa_acdl not valid with other options "));
|
||||
}
|
||||
|
||||
if( exists( $opt{activate} ) && (exists( $opt{commit}) || exists( $opt{recover}))) {
|
||||
return( usage("Option --activate not valid with --commit or --recover ") );
|
||||
}
|
||||
@@ -158,15 +149,10 @@ sub parse_args {
|
||||
#--activate's value only can be concurrent and disruptive
|
||||
################################
|
||||
if(exists($opt{activate})) {
|
||||
if (defined($request->{mgt}) && $request->{mgt} =~ /xCAT::FSP/i) {
|
||||
if ($opt{activate} !~ /deferred|disruptive/) {
|
||||
return (usage("--activate's value can only be deferred or disruptive."));
|
||||
}
|
||||
} else {
|
||||
if(($opt{activate} ne "disruptive") && ($opt{activate} ne "concurrent")) {
|
||||
return (usage("--activate's value can only be disruptive or concurrent."));
|
||||
}
|
||||
if( ($opt{activate} ne "concurrent") && ($opt{activate} ne "disruptive")) {
|
||||
return (usage("--activate's value can only be concurrent or disruptive"));
|
||||
}
|
||||
|
||||
if(!exists( $opt{d} )) {
|
||||
$opt{d} = "/tmp";
|
||||
}
|
||||
@@ -195,9 +181,6 @@ sub parse_args {
|
||||
} elsif( defined( $opt{ recover }) ) {
|
||||
print "recover flag\n";
|
||||
$housekeeping = "recover";
|
||||
} elsif (defined( $opt{ bpa_acdl})) {
|
||||
print "bpa_acdl flag\n";
|
||||
$housekeeping = "bpa_acdl";
|
||||
} else {
|
||||
print "no housekeeping - update mode\n";
|
||||
$housekeeping = undef;
|
||||
@@ -215,7 +198,7 @@ sub parse_args {
|
||||
####################
|
||||
#suport for "rflash", copy the rpm and xml packages from user-spcefied-directory to /install/packages_fw
|
||||
#####################
|
||||
if ( (!exists($opt{commit})) && (!exists($opt{ recover })) && (!exists($opt{bpa_acdl}))) {
|
||||
if ( (!exists($opt{commit})) && (!exists($opt{ recover }))) {
|
||||
if( preprocess_for_rflash($request, \%opt) == -1) {
|
||||
return( usage() );
|
||||
}
|
||||
@@ -288,7 +271,6 @@ sub noderange_validate {
|
||||
###########################################
|
||||
# Group nodes
|
||||
###########################################
|
||||
my $mytypehash = xCAT::DBobjUtils->getnodetype($noderange, "ppc");
|
||||
foreach my $node ( @$noderange ) {
|
||||
my $type = undef;
|
||||
#my $sitetab = xCAT::Table->new( 'nodetype' );
|
||||
@@ -298,7 +280,7 @@ sub noderange_validate {
|
||||
# $type = $ent->{nodetype};
|
||||
# }
|
||||
#}
|
||||
$type = $$mytypehash{$node};
|
||||
$type = xCAT::DBobjUtils->getnodetype($node);
|
||||
#print "type:$type\n";
|
||||
if( $type =~/(fsp|lpar|cec)/) {
|
||||
$f1 = 1;
|
||||
@@ -326,7 +308,7 @@ sub preprocess_for_rflash {
|
||||
my $request = shift;
|
||||
my $opt = shift;
|
||||
my $callback = $request->{callback};
|
||||
my $install_dir = xCAT::TableUtils->getInstallDir();
|
||||
my $install_dir = xCAT::Utils->getInstallDir();
|
||||
my $packages_fw = "$install_dir/packages_fw";
|
||||
my $c = 0;
|
||||
my $packages_d;
|
||||
@@ -534,22 +516,18 @@ sub get_lic_filenames {
|
||||
#############
|
||||
if($fff ne $2) {
|
||||
$upgrade_required = 1;
|
||||
if($activate ne "disruptive") {
|
||||
$msg = "Option --activate's value should be disruptive";
|
||||
return ("", "","", $msg, -1);
|
||||
}
|
||||
} else {
|
||||
|
||||
if(($pns eq $1) && ($3 > $active_level) &&($4 <= $active_level)) {
|
||||
$msg = $msg. "Upgrade $mtms $activate!";
|
||||
if($activate ne "concurrent") {
|
||||
$msg = "Option --actviate's value should be concurrent";
|
||||
return ("", "","", $msg, -1);
|
||||
}
|
||||
if(($pns eq $1) && ($4 <= $active_level)) {
|
||||
$msg = $msg. "Upgrade $mtms $activate!";
|
||||
# if($activate ne "concurrent") {
|
||||
# $msg = "Option --actviate's value should be disruptive";
|
||||
# return ("", "","", $msg, -1);
|
||||
# }
|
||||
} else {
|
||||
$msg = $msg . "Upgrade $mtms!";
|
||||
$msg = $msg . "Upgrade $mtms disruptively!";
|
||||
if($activate ne "disruptive") {
|
||||
$msg = "Option --activate's value should be disruptive";
|
||||
$msg = "Option --activate's value shouldn't be concurrent, and it must be disruptive";
|
||||
return ("", "","", $msg, -1);
|
||||
}
|
||||
}
|
||||
|
||||
+21
-25
@@ -74,7 +74,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose u w x z) )){
|
||||
if ( !GetOptions( \%opt, qw(V|Verbose u w x z) )){
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@@ -177,30 +177,28 @@ sub enumerate {
|
||||
#########################################
|
||||
# Save hardware connections
|
||||
#########################################
|
||||
if ( $hwtype ne "ivm" ) { #Not applicable for IVM
|
||||
$filter = "type_model_serial_num,ipaddr,sp,side";
|
||||
my $conns = xCAT::PPCcli::lssysconn( $exp, "alls", $filter );
|
||||
$Rc = shift(@$conns);
|
||||
$filter = "type_model_serial_num,ipaddr,sp,side";
|
||||
my $conns = xCAT::PPCcli::lssysconn( $exp, "alls", $filter );
|
||||
$Rc = shift(@$conns);
|
||||
|
||||
#########################################
|
||||
# Return error
|
||||
#########################################
|
||||
if ( $Rc != SUCCESS ) {
|
||||
return( @$conns[0] );
|
||||
#########################################
|
||||
# Return error
|
||||
#########################################
|
||||
if ( $Rc != SUCCESS ) {
|
||||
return( @$conns[0] );
|
||||
}
|
||||
|
||||
foreach my $con ( @$conns ) {
|
||||
my ($mtms,$ipaddr,$sp,$side) = split /,/,$con;
|
||||
my $value = undef;
|
||||
|
||||
if ( $sp =~ /^primary$/ or $side =~ /^a$/ ) {
|
||||
$value = "A";
|
||||
} elsif ($sp =~ /^secondary$/ or $side =~ /^b$/ ) {
|
||||
$value = "B";
|
||||
}
|
||||
|
||||
foreach my $con ( @$conns ) {
|
||||
my ($mtms,$ipaddr,$sp,$side) = split /,/,$con;
|
||||
my $value = undef;
|
||||
|
||||
if ( $sp =~ /^primary$/ or $side =~ /^a$/ ) {
|
||||
$value = "A";
|
||||
} elsif ($sp =~ /^secondary$/ or $side =~ /^b$/ ) {
|
||||
$value = "B";
|
||||
}
|
||||
|
||||
$hwconn{$ipaddr} = "$mtms,$value";
|
||||
}
|
||||
$hwconn{$ipaddr} = "$mtms,$value";
|
||||
}
|
||||
|
||||
#########################################
|
||||
@@ -334,9 +332,7 @@ sub enumerate {
|
||||
}
|
||||
|
||||
my $mtmss = $hwconn{$ips};
|
||||
if ( $hwtype ne "ivm" ) { #Not applicable for IVM
|
||||
my ($mtms,$side) = split /,/, $mtmss;
|
||||
}
|
||||
my ($mtms,$side) = split /,/, $mtmss;
|
||||
push @values, join( ",",
|
||||
"cec",$fsp,$cageid,$model,$serial,"",$server,$prof,$fname,"" );
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|Verbose) )) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
|
||||
+3
-29
@@ -8,7 +8,7 @@ use xCAT::PPCdb;
|
||||
use xCAT::Usage;
|
||||
use xCAT::NodeRange;
|
||||
use Data::Dumper;
|
||||
use xCAT::MsgUtils qw(verbose_message);
|
||||
|
||||
|
||||
##############################################
|
||||
# Globals
|
||||
@@ -504,7 +504,6 @@ sub clone {
|
||||
# Enumerate CECs
|
||||
#####################################
|
||||
my $filter = "type_model,serial_num";
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :lssyscfg fsps.filter:'$filter'.");
|
||||
my $cecs = xCAT::PPCcli::lssyscfg( $exp, "fsps", $filter );
|
||||
my $Rc = shift(@$cecs);
|
||||
|
||||
@@ -580,7 +579,6 @@ sub clone {
|
||||
$temp[2] = $destcec;
|
||||
$temp[4] = 'lpar';
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :mksyscfg lpar.cfg:'$cfg'.");
|
||||
my $result = xCAT::PPCcli::mksyscfg( $exp, "lpar", \@temp, $cfg );
|
||||
$Rc = shift(@$result);
|
||||
|
||||
@@ -620,7 +618,6 @@ sub remove {
|
||||
my @lpars = ();
|
||||
my @values = ();
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} START.");
|
||||
while (my ($mtms,$h) = each(%$hash) ) {
|
||||
while (my ($lpar,$d) = each(%$h) ) {
|
||||
my $lparid = @$d[0];
|
||||
@@ -644,7 +641,6 @@ sub remove {
|
||||
####################################
|
||||
else {
|
||||
my $filter = "name,lpar_id";
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :lssyscfg lpar.filter:'$filter'.");
|
||||
my $result = xCAT::PPCcli::lssyscfg(
|
||||
$exp,
|
||||
"lpar",
|
||||
@@ -677,7 +673,6 @@ sub remove {
|
||||
###############################################
|
||||
# begin to retrieve the CEC's service lpar id
|
||||
###############################################
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :lssyscfg fsp.filter:'service_lpar_id'.");
|
||||
my $service_lparid = xCAT::PPCcli::lssyscfg(
|
||||
$exp,
|
||||
"fsp",
|
||||
@@ -692,7 +687,6 @@ sub remove {
|
||||
my $cfgdata = @$service_lparid[0];
|
||||
if ( ($id == $cfgdata) && ($cfgdata !~ /none/) ) {
|
||||
$cfgdata = "service_lpar_id=none";
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :lssyscfg fsp.filter:'$cfgdata'.");
|
||||
my $result = xCAT::PPCcli::chsyscfg( $exp, "fsp", $d, $cfgdata );
|
||||
$Rc = shift(@$result);
|
||||
if ( $Rc != SUCCESS ) {
|
||||
@@ -709,7 +703,6 @@ sub remove {
|
||||
################################
|
||||
# Send remove command
|
||||
################################
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :rmsyscfg lpar.id:$id.");
|
||||
my $result = xCAT::PPCcli::rmsyscfg( $exp, \@d );
|
||||
my $Rc = shift(@$result);
|
||||
|
||||
@@ -717,7 +710,6 @@ sub remove {
|
||||
# Remove LPAR from database
|
||||
################################
|
||||
if ( $Rc == SUCCESS and !exists( $opt->{r} ) ) {
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :remove lpar:$name from xCATdb.");
|
||||
my $err = xCATdB( "rmvm", $name,"", $id,"", $type,"" , $lpar );
|
||||
if ( defined( $err )) {
|
||||
push @values, [$lpar,$err,RC_ERROR];
|
||||
@@ -728,7 +720,6 @@ sub remove {
|
||||
}
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} END.");
|
||||
return( \@values );
|
||||
}
|
||||
|
||||
@@ -800,7 +791,6 @@ sub modify_by_attr {
|
||||
my $attrstr= $opt->{a};
|
||||
my @values;
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} START.");
|
||||
# attrstr will be in stdin for "cat vmdef | chvm nodename"
|
||||
if (!defined($attrstr) && defined($request->{stdin})) {
|
||||
my $tempattr = $request->{stdin};
|
||||
@@ -846,7 +836,6 @@ sub modify_by_attr {
|
||||
###########################
|
||||
# Get current profile
|
||||
###########################
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :lssyscfg node.id:'@$d[0]'.");
|
||||
my $cfg_res = xCAT::PPCcli::lssyscfg(
|
||||
$exp,
|
||||
"node",
|
||||
@@ -879,7 +868,6 @@ sub modify_by_attr {
|
||||
}
|
||||
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :lssyscfg prof.filter:'lpar_ids=@$d[0],profile_names=@$cfg_res[0]'.");
|
||||
my $prof = xCAT::PPCcli::lssyscfg(
|
||||
$exp,
|
||||
"prof",
|
||||
@@ -905,14 +893,12 @@ sub modify_by_attr {
|
||||
push @values, [$lpar, $err_msg, $Rc];
|
||||
next;
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :chsyscfg prof.cfg:'$cfgdata'.");
|
||||
my $result = xCAT::PPCcli::chsyscfg( $exp, "prof", $d, $cfgdata );
|
||||
$Rc = shift(@$result);
|
||||
push @values, [$lpar,@$result[0],$Rc];
|
||||
}
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} END.");
|
||||
return (\@values);
|
||||
}
|
||||
|
||||
@@ -1018,7 +1004,6 @@ sub modify_by_prof {
|
||||
my $profile = $opt->{p};
|
||||
my @values;
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} START.");
|
||||
#######################################
|
||||
# -p flag, find profile specified
|
||||
#######################################
|
||||
@@ -1044,7 +1029,6 @@ sub modify_by_prof {
|
||||
###########################
|
||||
# Get LPAR profiles
|
||||
###########################
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :lssyscfg prof.filter:'lpar_ids=@$d[0],profile_names=$profile'.");
|
||||
my $prof = xCAT::PPCcli::lssyscfg(
|
||||
$exp,
|
||||
"prof",
|
||||
@@ -1116,7 +1100,6 @@ sub modify_by_prof {
|
||||
# Send command
|
||||
###############################
|
||||
if ( defined( $profile )) {
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :mksyscfg prof.cfg:'$cfg'.");
|
||||
my $result = xCAT::PPCcli::mksyscfg( $exp, "prof", $d, $cfg );
|
||||
my $Rc = shift(@$result);
|
||||
|
||||
@@ -1129,14 +1112,12 @@ sub modify_by_prof {
|
||||
push @values, [$lpar,@$result[0],$Rc];
|
||||
}
|
||||
else {
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :chsyscfg prof.cfg:'$cfg'.");
|
||||
my $result = xCAT::PPCcli::chsyscfg( $exp, "prof", $d, $cfg );
|
||||
my $Rc = shift(@$result);
|
||||
push @values, [$lpar,@$result[0],$Rc];
|
||||
}
|
||||
}
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} END.");
|
||||
return( \@values );
|
||||
}
|
||||
|
||||
@@ -1155,7 +1136,6 @@ sub list {
|
||||
my @lpars = ();
|
||||
my $result;
|
||||
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} START.");
|
||||
while (my ($mtms,$h) = each(%$hash) ) {
|
||||
while (my ($lpar,$d) = each(%$h) ) {
|
||||
my $lparid = @$d[0];
|
||||
@@ -1181,7 +1161,6 @@ sub list {
|
||||
####################################
|
||||
else {
|
||||
my $filter = "name,lpar_id";
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :lssyscfg lpar.filter:'$filter'.");
|
||||
my $result = xCAT::PPCcli::lssyscfg(
|
||||
$exp,
|
||||
"lpar",
|
||||
@@ -1212,7 +1191,6 @@ sub list {
|
||||
#################################
|
||||
# Get source LPAR profile
|
||||
#################################
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :lssyscfg prof.filter:'lpar_ids=$id'.");
|
||||
my $prof = xCAT::PPCcli::lssyscfg(
|
||||
$exp,
|
||||
"prof",
|
||||
@@ -1266,7 +1244,7 @@ sub list {
|
||||
foreach ( sort keys %$values ) {
|
||||
push @value,$values->{$_};
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} END.");
|
||||
|
||||
return( \@value );
|
||||
}
|
||||
##########################################################################
|
||||
@@ -1626,7 +1604,7 @@ sub create {
|
||||
my $mtms;
|
||||
my $type;
|
||||
my $profile;
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} START.");
|
||||
|
||||
#####################################
|
||||
# Get source node information
|
||||
#####################################
|
||||
@@ -1665,7 +1643,6 @@ sub create {
|
||||
#####################################
|
||||
# Get source LPAR profile
|
||||
#####################################
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :lssyscfg prof.filter:'lpar_ids=$lparid'.");
|
||||
my $prof = xCAT::PPCcli::lssyscfg(
|
||||
$exp,
|
||||
"prof",
|
||||
@@ -1744,7 +1721,6 @@ sub create {
|
||||
#################################
|
||||
# Create new LPAR
|
||||
#################################
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :mksyscfg lpar.cfg:'$cfgdata'.");
|
||||
$result = xCAT::PPCcli::mksyscfg( $exp, "lpar", $d, $cfgdata );
|
||||
$Rc = shift(@$result);
|
||||
|
||||
@@ -1752,7 +1728,6 @@ sub create {
|
||||
# Add new LPAR to database
|
||||
#################################
|
||||
if ( $Rc == SUCCESS ) {
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} :add lpar:$name from xCATdb.");
|
||||
my $err = xCATdB( "mkvm", $name, $profile, $id, $d, $hwtype, $lpar);
|
||||
if ( defined( $err )) {
|
||||
push @values, [$name,$err,RC_ERROR];
|
||||
@@ -1763,7 +1738,6 @@ sub create {
|
||||
push @values, [$name,@$result[0],$Rc];
|
||||
$id++;
|
||||
}
|
||||
xCAT::MsgUtils->verbose_message($request, "$request->{command} END.");
|
||||
return( \@values );
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+18
-34
@@ -5,7 +5,7 @@ package xCAT::RSYNC;
|
||||
|
||||
# cannot use strict
|
||||
use base xCAT::DSHRemoteShell;
|
||||
use xCAT::TableUtils qw(get_site_attribute);
|
||||
|
||||
# Determine if OS is AIX or Linux
|
||||
# Configure standard locations of commands based on OS
|
||||
|
||||
@@ -35,7 +35,6 @@ if ($^O eq 'linux')
|
||||
$class - Calling module name (discarded)
|
||||
$config - Reference to copy command configuration hash table
|
||||
$exec_path - Path to rsync executable
|
||||
$localhost - 1 indicates we are running on the Management Node
|
||||
|
||||
Returns:
|
||||
A command array for the rsync command with the appropriate
|
||||
@@ -69,7 +68,7 @@ if ($^O eq 'linux')
|
||||
|
||||
sub remote_copy_command
|
||||
{
|
||||
my ($class, $config, $exec_path,$localhost) = @_;
|
||||
my ($class, $config, $exec_path) = @_;
|
||||
|
||||
$exec_path || ($exec_path = $RSYNC_CMD);
|
||||
|
||||
@@ -77,7 +76,7 @@ sub remote_copy_command
|
||||
my $usersh=0;
|
||||
if ($^O eq 'aix')
|
||||
{
|
||||
my @useSSH = xCAT::TableUtils->get_site_attribute("useSSHonAIX");
|
||||
my @useSSH = xCAT::Utils->get_site_attribute("useSSHonAIX");
|
||||
if (defined($useSSH[0])) {
|
||||
$useSSH[0] =~ tr/a-z/A-Z/; # convert to upper
|
||||
if (($useSSH[0] eq "0") || ($useSSH[0] eq "NO"))
|
||||
@@ -97,13 +96,13 @@ sub remote_copy_command
|
||||
if ($^O eq 'aix')
|
||||
{
|
||||
if (-e ("/usr/bin/rsync")) {
|
||||
if (($usersh == 0) || ($localhost == 1)) { # using ssh, or local
|
||||
if ($usersh == 0) { # using ssh
|
||||
$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 ($usersh == 0) { # using ssh
|
||||
$sync_opt = '--rsync-path /usr/local/bin/rsync ';
|
||||
} else {
|
||||
$sync_opt = '--rsh /bin/rsh --rsync-path /usr/local/bin/rsync ';
|
||||
@@ -114,10 +113,9 @@ sub remote_copy_command
|
||||
{
|
||||
$sync_opt = '--rsync-path /usr/bin/rsync ';
|
||||
}
|
||||
# if only syncing the service node or
|
||||
# (no postscripts and no append lines) then do not
|
||||
# if only syncing the service node or no postscripts then do not
|
||||
# get update file notification
|
||||
if (($::SYNCSN == 1) || ((!(defined @::postscripts)) && (!(defined @::appendlines)) && (!(defined @::mergelines)))) {
|
||||
if (($::SYNCSN == 1) || (!(defined @::postscripts))) {
|
||||
$sync_opt .= '-Lprogtz ';
|
||||
} else {
|
||||
$sync_opt .= '-Liprogtz --out-format=%f%L '; # add notify of update
|
||||
@@ -142,48 +140,34 @@ sub remote_copy_command
|
||||
"$$config{'dest-user'}@" . "$$config{'dest-host'}";
|
||||
}
|
||||
print RSCYCCMDFILE "#!/bin/sh\n";
|
||||
if ($localhost == 1) { # running to the MN from the MN
|
||||
print RSCYCCMDFILE
|
||||
"/bin/mkdir -p $dest_dir_list\n";
|
||||
} else { # running to another node
|
||||
if ($usersh == 0) { # using ssh
|
||||
print RSCYCCMDFILE
|
||||
"/usr/bin/ssh $dest_user_host '/bin/mkdir -p $dest_dir_list'\n";
|
||||
} else {
|
||||
print RSCYCCMDFILE
|
||||
"/usr/bin/rsh $dest_user_host '/bin/mkdir -p $dest_dir_list'\n";
|
||||
}
|
||||
if ($usersh == 0) { # using ssh
|
||||
print RSCYCCMDFILE
|
||||
"/usr/bin/ssh $dest_user_host '/bin/mkdir -p $dest_dir_list'\n";
|
||||
} else {
|
||||
print RSCYCCMDFILE
|
||||
"/usr/bin/rsh $dest_user_host '/bin/mkdir -p $dest_dir_list'\n";
|
||||
}
|
||||
foreach my $dest_dir (keys %{$$config{'destDir_srcFile'}})
|
||||
{
|
||||
my @src_file =
|
||||
@{$$config{'destDir_srcFile'}{$dest_dir}{'same_dest_name'}};
|
||||
|
||||
#Remove a file from the list if it does not exist
|
||||
#@src_file = map { $_ if -e $_; } @src_file;
|
||||
my $src_file_list = join ' ', @src_file;
|
||||
if ($src_file_list)
|
||||
{
|
||||
if ($localhost == 1) { # running local ( on MN)
|
||||
print RSCYCCMDFILE
|
||||
"$exec_path $sync_opt $src_file_list $dest_dir\n";
|
||||
} else { # running to another node
|
||||
print RSCYCCMDFILE
|
||||
"$exec_path $sync_opt $src_file_list $dest_user_host:$dest_dir\n";
|
||||
}
|
||||
"$exec_path $sync_opt $src_file_list $dest_user_host:$dest_dir\n";
|
||||
}
|
||||
my %diff_dest_hash =
|
||||
%{$$config{'destDir_srcFile'}{$dest_dir}{'diff_dest_name'}};
|
||||
foreach my $src_file_diff_dest (keys %diff_dest_hash)
|
||||
{
|
||||
|
||||
next if !-e $src_file_diff_dest;
|
||||
my $diff_basename = $diff_dest_hash{$src_file_diff_dest};
|
||||
# if localhost do not put in hostname:
|
||||
if ($localhost == 1) { # running to the MN from the MN (local)
|
||||
print RSCYCCMDFILE
|
||||
"$exec_path $sync_opt $src_file_diff_dest $dest_dir/$diff_basename\n";
|
||||
} else { # running remote
|
||||
print RSCYCCMDFILE
|
||||
print RSCYCCMDFILE
|
||||
"$exec_path $sync_opt $src_file_diff_dest $dest_user_host:$dest_dir/$diff_basename\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,891 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
|
||||
package xCAT::RemoteShellExp;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head1 RemoteShellExp
|
||||
Uses perl Expect to set up ssh passwordless login on the input node list
|
||||
Called from xdsh <nodelist> -K command
|
||||
It works for node and devices ( such as QLogic Switch).
|
||||
See man xdsh.
|
||||
It works for root and non-root userids.
|
||||
|
||||
Environment Variables input to drive the setup:
|
||||
|
||||
DSH_REMOTE_CMD set to path to remote shell (ssh)
|
||||
root password must agree on all the nodes
|
||||
|
||||
XCAT_ROOT set to root of xCAT install
|
||||
|
||||
DSH_REMOTE_PASSWORD - to_user password for -s option required to sendkeys)
|
||||
Note this is obtained in the xdsh client frontend.
|
||||
|
||||
SSH_SETUP_COMMAND - Command to be sent to the IB switch to setup SSH.
|
||||
|
||||
DSH_FROM_USERID_HOME - The home directory of the userid from
|
||||
where the ssh keys will be obtained
|
||||
to send
|
||||
|
||||
DSH_FROM_USERID - The userid from where the ssh keys will be obtained
|
||||
to send
|
||||
to the node, or generated and then obtained to send to the
|
||||
node.
|
||||
DSH_TO_USERID - The userid on the node where the ssh keys will be updated.
|
||||
DSH_ENABLE_SSH - Node to node root passwordless ssh will be setup.
|
||||
|
||||
|
||||
Usage: remoteshellexp
|
||||
[-t node list] test ssh connection to the node
|
||||
[-k] Generates the ssh keys needed , for the user on the MN.
|
||||
[-s node list] copies the ssh keys to the nodes
|
||||
|
||||
exit 0 - good
|
||||
exit 1 - abort
|
||||
exit 2 - usage error
|
||||
|
||||
Examples:
|
||||
$rc=xCAT::RemoteShellExp->remoteshellexp("k",$callback,$remoteshellcmd);
|
||||
$rc=xCAT::RemoteShellExp->remoteshellexp("s",$callback,$remoteshellcmd,$nodes);
|
||||
$rc=xCAT::RemoteShellExp->remoteshellexp("t",$callback,$remoteshellcmd,$nodes);
|
||||
|
||||
=cut
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
$::XCATDIR = $ENV{'XCATDIR'} ? $ENV{'XCATDIR'} : '/etc/xcat';
|
||||
}
|
||||
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use xCAT::Utils;
|
||||
use Getopt::Long;
|
||||
use xCAT::MsgUtils;
|
||||
use Expect;
|
||||
use strict;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub remoteshellexp
|
||||
{
|
||||
my ($class, $flag, $callback, $remoteshell, $nodes) = @_;
|
||||
my $rc=0;
|
||||
$::CALLBACK = $callback;
|
||||
if (!($flag))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"No flag provide to remoteshellexp.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (($flag ne "k") && ($flag ne "t") && ($flag ne "s")) {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Invalid flag $flag provided.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return 2;
|
||||
|
||||
}
|
||||
|
||||
# for -s flag must have nodes and a $to_userid password
|
||||
my $to_user_password;
|
||||
if ($ENV{'DSH_REMOTE_PASSWORD'}) {
|
||||
$to_user_password=$ENV{'DSH_REMOTE_PASSWORD'};
|
||||
}
|
||||
if ($flag eq "s"){
|
||||
if (!$to_user_password) {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"The DSH_REMOTE_PASSWORD environment variable has not been set to the user id password on the node which will have their ssh keys updated (ususally root).";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return 2;
|
||||
}
|
||||
if (!$nodes) {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"No nodes were input to update the user's ssh keys.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
my $ssh_setup_cmd;
|
||||
my $from_userid;
|
||||
my $to_userid;
|
||||
my $home;
|
||||
my $remotecopy;
|
||||
# if caller input a path to ssh remote command, use it
|
||||
if ($ENV{'DSH_REMOTE_CMD'}) {
|
||||
$remoteshell=$ENV{'DSH_REMOTE_CMD'};
|
||||
} else {
|
||||
if (!$remoteshell) {
|
||||
$remoteshell="/usr/bin/ssh";
|
||||
}
|
||||
}
|
||||
# figure out path to scp
|
||||
my ($path,$ssh) = split(/ssh/,$remoteshell);
|
||||
$remotecopy=$path . "scp";
|
||||
# if caller input the ssh setup command (such as for IB Switch)
|
||||
if ($ENV{'SSH_SETUP_COMMAND'}) {
|
||||
$ssh_setup_cmd=$ENV{'SSH_SETUP_COMMAND'};
|
||||
}
|
||||
# set User on the Management node that has the ssh keys
|
||||
# this id can be a local (non-root) id as well as root
|
||||
if ($ENV{'DSH_FROM_USERID'}) {
|
||||
$from_userid=$ENV{'DSH_FROM_USERID'};
|
||||
} else {
|
||||
$from_userid="root";
|
||||
}
|
||||
# set User on the node where we will send the keys
|
||||
# this id can be a local id as well as root
|
||||
if ($ENV{'DSH_TO_USERID'}) {
|
||||
$to_userid=$ENV{'DSH_TO_USERID'};
|
||||
} else {
|
||||
$to_userid="root";
|
||||
}
|
||||
# set User home directory to find the ssh public key to send
|
||||
# For non-root ids information may not be in /etc/passwd
|
||||
# but elsewhere like LDAP
|
||||
if ($ENV{'DSH_FROM_USERID_HOME'}) {
|
||||
$home=$ENV{'DSH_FROM_USERID_HOME'};
|
||||
} else {
|
||||
$home=xCAT::Utils->getHomeDir($from_userid);
|
||||
}
|
||||
|
||||
# This indicates we will generate new ssh keys for the user,
|
||||
# if they are not already there
|
||||
my $key="$home/.ssh/id_rsa";
|
||||
my $key2="$home/.ssh/id_rsa.pub";
|
||||
# Check to see if empty
|
||||
if (-z $key) {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"The $key file is empty. Remove it and rerun the command.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return 1;
|
||||
|
||||
}
|
||||
if (-z $key2) {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"The $key2 file is empty. Remove it and rerun the command.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return 1;
|
||||
|
||||
}
|
||||
if (($flag eq "k") && (!(-e $key)))
|
||||
{
|
||||
# if the file size of the id_rsa key is 0, tell them to remove it
|
||||
# and run the command again
|
||||
$rc=xCAT::RemoteShellExp->gensshkeys;
|
||||
}
|
||||
# send ssh keys to the nodes/devices, to setup passwordless ssh
|
||||
if ($flag eq "s")
|
||||
{
|
||||
if (!($nodes)) {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"There are no nodes defined to update the ssh keys.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return 1;
|
||||
}
|
||||
if ($ssh_setup_cmd) { # setup ssh on devices
|
||||
$rc=xCAT::RemoteShellExp->senddeviceskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$ssh_setup_cmd,$nodes);
|
||||
} else { #setup ssh on nodes
|
||||
$rc=xCAT::RemoteShellExp->sendnodeskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$nodes);
|
||||
}
|
||||
}
|
||||
# test ssh setup on the node
|
||||
if ($flag eq "t")
|
||||
{
|
||||
$rc=xCAT::RemoteShellExp->testkeys($remoteshell,$to_userid,$nodes);
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 gensshkeys
|
||||
|
||||
Generates new ssh keys for the input userid on the MN, if they do not
|
||||
already exist. Test for id_rsa key existence.
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub gensshkeys
|
||||
|
||||
{
|
||||
my ($class) = @_;
|
||||
my $keygen;
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $keygen_sent = 0;
|
||||
my $prompt1 = 'Generating public/private rsa';
|
||||
my $prompt2 = 'Enter file.*:';
|
||||
my $prompt3 = 'Enter passphrase.*:';
|
||||
my $prompt4 = 'Enter same passphrase.*:';
|
||||
my $expect_log = undef;
|
||||
my $debug = 0;
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
$debug = 1;
|
||||
}
|
||||
$keygen = new Expect;
|
||||
|
||||
# run /usr/bin/ssh-keygen -t rsa
|
||||
# prompt1 = 'Generating public/private rsa';
|
||||
# prompt2 = 'Enter file.*:';
|
||||
# -re "\r"
|
||||
# prompt3 = 'Enter passphrase.*:';
|
||||
# -re "\r"
|
||||
# prompt4 = 'Enter same passphrase.*:';
|
||||
# -re "\r"
|
||||
|
||||
|
||||
# disable command echoing
|
||||
#$keygen->slave->stty(qw(sane -echo));
|
||||
|
||||
#
|
||||
# exp_internal(1) sets exp_internal debugging
|
||||
# to STDERR.
|
||||
#
|
||||
#$keygen->exp_internal(1);
|
||||
$keygen->exp_internal($debug);
|
||||
|
||||
#
|
||||
# log_stdout(0) prevent the program's output from being shown.
|
||||
# turn on if debugging error
|
||||
#$keygen->log_stdout(1);
|
||||
$keygen->log_stdout($debug);
|
||||
|
||||
# Run the ssh key gen command
|
||||
my $spawncmd = "/usr/bin/ssh-keygen -t rsa";
|
||||
unless ($keygen->spawn($spawncmd))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Unable to run $spawncmd.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#ssh-keygen prompts starts here
|
||||
#
|
||||
|
||||
my @result = $keygen->expect(
|
||||
$timeout,
|
||||
[
|
||||
$prompt1, # Generating public/private rsa
|
||||
sub {
|
||||
$keygen->send("\r");
|
||||
$keygen->clear_accum();
|
||||
$keygen->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt2, # Enter file.*:
|
||||
sub {
|
||||
$keygen->send("\r");
|
||||
$keygen->clear_accum();
|
||||
$keygen->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt3, # Enter passphrase.*
|
||||
sub {
|
||||
$keygen->send("\r");
|
||||
$keygen->clear_accum();
|
||||
$keygen->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt4, # Enter same passphrase.
|
||||
sub {
|
||||
$keygen->send("\r");
|
||||
$keygen->clear_accum();
|
||||
$keygen->exp_continue();
|
||||
}
|
||||
]
|
||||
); # end prompts
|
||||
##########################################
|
||||
# Expect error - report and quit
|
||||
##########################################
|
||||
if (defined($result[1]))
|
||||
{
|
||||
my $msg = $result[1];
|
||||
$keygen->soft_close();
|
||||
if ($msg =~ /status 0/i) { # no error
|
||||
return 0;
|
||||
} else {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = $msg;
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
$keygen->soft_close();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 testkeys
|
||||
|
||||
Test to see if the remoteshell setup worked
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub testkeys
|
||||
|
||||
{
|
||||
my ($class,$remoteshell,$to_userid,$nodes) = @_;
|
||||
my $testkeys;
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $testkeys_sent = 0;
|
||||
my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?';
|
||||
my $prompt2 = 'ssword:';
|
||||
my $prompt3 = 'Permission denied*';
|
||||
my $prompt4 = 'test.success';
|
||||
my $expect_log = undef;
|
||||
my $debug = 0;
|
||||
my $rc=1; # default to error
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
$debug = 1;
|
||||
}
|
||||
$testkeys = new Expect;
|
||||
|
||||
# run ssh <node> -l to_userid echo test.success
|
||||
# possible return
|
||||
# bad
|
||||
## Are you sure you want to continue connecting (yes/no)?
|
||||
## *ssword*
|
||||
## Permission denied.
|
||||
# Good
|
||||
## test.success
|
||||
|
||||
# disable command echoing
|
||||
#$testkeys->slave->stty(qw(sane -echo));
|
||||
|
||||
#
|
||||
# exp_internal(1) sets exp_internal debugging
|
||||
# to STDERR.
|
||||
#
|
||||
#$testkeys->exp_internal(1);
|
||||
$testkeys->exp_internal($debug);
|
||||
|
||||
#
|
||||
# log_stdout(0) prevent the program's output from being shown.
|
||||
# turn on if debugging error
|
||||
#$testkeys->log_stdout(1);
|
||||
$testkeys->log_stdout($debug);
|
||||
|
||||
# Run the ssh key gen command
|
||||
my $spawncmd = "$remoteshell $nodes -l $to_userid echo test.success";
|
||||
unless ($testkeys->spawn($spawncmd))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Unable to run $spawncmd.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#testkeys prompts starts here
|
||||
#
|
||||
|
||||
my @result = $testkeys->expect(
|
||||
$timeout,
|
||||
[
|
||||
$prompt1, # Are you sure you want to ...
|
||||
sub {
|
||||
$rc= 1;
|
||||
$testkeys->hard_close();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt2, # *ssword*
|
||||
sub {
|
||||
$rc= 1;
|
||||
$testkeys->hard_close();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt3, # Permission denied
|
||||
sub {
|
||||
$rc= 1;
|
||||
$testkeys->hard_close();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt4, # test.success
|
||||
sub {
|
||||
$rc= 0;
|
||||
}
|
||||
]
|
||||
); # end prompts
|
||||
##########################################
|
||||
# Expect error - report and quit
|
||||
##########################################
|
||||
if (defined($result[1]))
|
||||
{
|
||||
my $msg = $result[1];
|
||||
$testkeys->soft_close();
|
||||
if ($msg =~ /status 0/i) { # no error
|
||||
return 0;
|
||||
} else {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = $msg;
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
return 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
$testkeys->soft_close();
|
||||
return $rc;
|
||||
}
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 sendnodeskeys
|
||||
|
||||
Setup the ssh keys on the nodes
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub sendnodeskeys
|
||||
|
||||
{
|
||||
my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$nodes) = @_;
|
||||
my $sendkeys;
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $sendkeys_sent = 0;
|
||||
my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?';
|
||||
my $prompt2 = 'ssword:';
|
||||
my $prompt3 = 'Permission denied*';
|
||||
my $expect_log = undef;
|
||||
my $debug = 0;
|
||||
my $rc=0;
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
$debug = 1;
|
||||
}
|
||||
# For each node
|
||||
# make a temporary directory on the node
|
||||
# run scp <nodename> -l <to user> /bin/mkdir -p /tmp/$to_userid/.ssh
|
||||
# xdsh has built an authorized_keys file for the node
|
||||
# in $HOME/.ssh/tmp/authorized_keys
|
||||
# copy to the node to the temp directory
|
||||
# scp $HOME/.ssh/tmp/authorized_keys to_userid@<node>:/tmp/$to_userid/.ssh
|
||||
# If you are going to enable ssh to ssh between nodes, then
|
||||
# scp $HOME/.ssh/id_rsa to that temp directory on the node
|
||||
# copy the script $HOME/.ssh/copy.sh to the node, it will do the
|
||||
# the work of setting up the user's ssh keys and clean up
|
||||
# ssh (run) copy.sh on the node
|
||||
my @nodelist=split(/,/,$nodes);
|
||||
foreach my $node (@nodelist) {
|
||||
$sendkeys = new Expect;
|
||||
|
||||
# disable command echoing
|
||||
#$sendkeys->slave->stty(qw(sane -echo));
|
||||
#
|
||||
# exp_internal(1) sets exp_internal debugging
|
||||
# to STDERR.
|
||||
#
|
||||
#$sendkeys->exp_internal(1);
|
||||
$sendkeys->exp_internal($debug);
|
||||
#
|
||||
# log_stdout(0) prevent the program's output from being shown.
|
||||
# turn on if debugging error
|
||||
#$sendkeys->log_stdout(1);
|
||||
$sendkeys->log_stdout($debug);
|
||||
|
||||
# command to make the temp directory on the node
|
||||
my $spawnmkdir=
|
||||
"$remoteshell $node -l $to_userid /bin/mkdir -p /tmp/$to_userid/.ssh";
|
||||
# command to copy the needed files to the node
|
||||
|
||||
# send mkdir command
|
||||
unless ($sendkeys->spawn($spawnmkdir))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Unable to run $spawnmkdir on $node";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
next;
|
||||
}
|
||||
|
||||
#
|
||||
#mkdir prompts starts here
|
||||
#
|
||||
|
||||
my @result = $sendkeys->expect(
|
||||
$timeout,
|
||||
[
|
||||
$prompt1, # Are you sure you want to ...
|
||||
sub {
|
||||
$sendkeys->send("yes\r");
|
||||
$sendkeys->clear_accum();
|
||||
$sendkeys->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt2, # *ssword*
|
||||
sub {
|
||||
$sendkeys->send("$to_userpassword\r");
|
||||
$sendkeys->clear_accum();
|
||||
$sendkeys->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt3, # Permission denied
|
||||
sub {
|
||||
$rc= 1;
|
||||
$sendkeys->hard_close();
|
||||
}
|
||||
],
|
||||
); # end prompts
|
||||
##########################################
|
||||
# Expect error - report
|
||||
##########################################
|
||||
if (defined($result[1]))
|
||||
{
|
||||
my $msg = $result[1];
|
||||
if ($msg =~ /status 0/i) { # no error
|
||||
$rc=0;
|
||||
} else {
|
||||
if ($msg =~ /2:EOF/i) { # no error
|
||||
$rc=0;
|
||||
} else {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "mkdir:$node has error,$msg";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
$rc=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$sendkeys->soft_close();
|
||||
|
||||
#
|
||||
#copy files prompts starts here
|
||||
#
|
||||
|
||||
$sendkeys = new Expect;
|
||||
|
||||
# disable command echoing
|
||||
#$sendkeys->slave->stty(qw(sane -echo));
|
||||
#
|
||||
# exp_internal(1) sets exp_internal debugging
|
||||
# to STDERR.
|
||||
#
|
||||
#$sendkeys->exp_internal(1);
|
||||
$sendkeys->exp_internal($debug);
|
||||
#
|
||||
# log_stdout(0) prevent the program's output from being shown.
|
||||
# turn on if debugging error
|
||||
#$sendkeys->log_stdout(1);
|
||||
$sendkeys->log_stdout($debug);
|
||||
|
||||
my $spawncopyfiles;
|
||||
if ($ENV{'DSH_ENABLE_SSH'}) { # we will enable node to node ssh
|
||||
$spawncopyfiles=
|
||||
"$remotecopy $home/.ssh/id_rsa $home/.ssh/copy.sh $home/.ssh/tmp/authorized_keys $to_userid\@$node:/tmp/$to_userid/.ssh ";
|
||||
|
||||
} else { # no node to node ssh ( don't send private key)
|
||||
$spawncopyfiles=
|
||||
"$remotecopy $home/.ssh/copy.sh $home/.ssh/tmp/authorized_keys $to_userid\@$node:/tmp/$to_userid/.ssh ";
|
||||
}
|
||||
# send copy command
|
||||
unless ($sendkeys->spawn($spawncopyfiles))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Unable to run $spawncopyfiles on $node.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
next;
|
||||
}
|
||||
|
||||
@result = $sendkeys->expect(
|
||||
$timeout,
|
||||
[
|
||||
$prompt1, # Are you sure you want to ...
|
||||
sub {
|
||||
$sendkeys->send("yes\r");
|
||||
$sendkeys->clear_accum();
|
||||
$sendkeys->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt2, # *ssword*
|
||||
sub {
|
||||
$sendkeys->send("$to_userpassword\r");
|
||||
$sendkeys->clear_accum();
|
||||
$sendkeys->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt3, # Permission denied
|
||||
sub {
|
||||
$rc= 1;
|
||||
$sendkeys->hard_close();
|
||||
|
||||
}
|
||||
],
|
||||
); # end prompts
|
||||
##########################################
|
||||
# Expect error - report
|
||||
##########################################
|
||||
if (defined($result[1]))
|
||||
{
|
||||
my $msg = $result[1];
|
||||
if ($msg =~ /status 0/i) { # no error
|
||||
$rc=0;
|
||||
} else {
|
||||
if ($msg =~ /2:EOF/i) { # no error
|
||||
$rc=0;
|
||||
} else {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "copykeys:$node has error,$msg";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
$rc=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$sendkeys->soft_close();
|
||||
|
||||
#
|
||||
# ssh to the node to run the copy.sh to setup the keys starts here
|
||||
#
|
||||
$sendkeys = new Expect;
|
||||
|
||||
# disable command echoing
|
||||
#$sendkeys->slave->stty(qw(sane -echo));
|
||||
#
|
||||
# exp_internal(1) sets exp_internal debugging
|
||||
# to STDERR.
|
||||
#
|
||||
#$sendkeys->exp_internal(1);
|
||||
$sendkeys->exp_internal($debug);
|
||||
#
|
||||
# log_stdout(0) prevent the program's output from being shown.
|
||||
# turn on if debugging error
|
||||
#$sendkeys->log_stdout(1);
|
||||
$sendkeys->log_stdout($debug);
|
||||
|
||||
# command to run copy.sh
|
||||
my $spawnruncopy=
|
||||
"$remoteshell $node -l $to_userid /tmp/$to_userid/.ssh/copy.sh";
|
||||
|
||||
# send mkdir command
|
||||
unless ($sendkeys->spawn($spawnruncopy))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Unable to run $spawnruncopy.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
next; # go to next node
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#run copy.sh prompts starts here
|
||||
#
|
||||
|
||||
@result = $sendkeys->expect(
|
||||
$timeout,
|
||||
[
|
||||
$prompt1, # Are you sure you want to ...
|
||||
sub {
|
||||
$sendkeys->send("yes\r");
|
||||
$sendkeys->clear_accum();
|
||||
$sendkeys->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt2, # *ssword*
|
||||
sub {
|
||||
$sendkeys->send("$to_userpassword\r");
|
||||
$sendkeys->clear_accum();
|
||||
$sendkeys->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt3, # Permission denied
|
||||
sub {
|
||||
$rc= 1;
|
||||
$sendkeys->hard_close();
|
||||
}
|
||||
],
|
||||
); # end prompts
|
||||
##########################################
|
||||
# Expect error - report
|
||||
##########################################
|
||||
if (defined($result[1]))
|
||||
{
|
||||
my $msg = $result[1];
|
||||
if ($msg =~ /status 0/i) { # no error
|
||||
$rc=0;
|
||||
} else {
|
||||
if ($msg =~ /2:EOF/i) { # no error
|
||||
$rc=0;
|
||||
} else {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "copy.sh:$node has error,$msg";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
$rc=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$sendkeys->soft_close();
|
||||
|
||||
|
||||
} # end foreach node
|
||||
return $rc;
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 senddeviceskeys
|
||||
|
||||
Setup the ssh keys on the nodes
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub senddeviceskeys
|
||||
|
||||
{
|
||||
my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$ssh_setup_cmd,$nodes) = @_;
|
||||
my $sendkeys;
|
||||
my $timeout = 10; # sets Expect default timeout, 0 accepts immediately
|
||||
my $sendkeys_sent = 0;
|
||||
my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?';
|
||||
my $prompt2 = 'ssword:';
|
||||
my $prompt3 = 'Permission denied*';
|
||||
my $expect_log = undef;
|
||||
my $debug = 0;
|
||||
my $rc=0;
|
||||
if ($::VERBOSE)
|
||||
{
|
||||
$debug = 1;
|
||||
}
|
||||
|
||||
# quote the setup command and key "sshKey add \"<key\""
|
||||
my $setupcmd="\"";
|
||||
$setupcmd .= $ssh_setup_cmd;
|
||||
$setupcmd .=" ";
|
||||
|
||||
# get the public key
|
||||
my $key="\\";
|
||||
$key .="\"";
|
||||
$key .=`cat $home/.ssh/tmp/authorized_keys `;
|
||||
chop ($key);
|
||||
$key .="\\";
|
||||
$key .="\"";
|
||||
# add to the command
|
||||
$setupcmd .=$key;
|
||||
$setupcmd .="\"";
|
||||
# For each input device
|
||||
my @nodelist=split(/,/,$nodes);
|
||||
foreach my $node (@nodelist) {
|
||||
#
|
||||
# ssh to the node to run the copy.sh to setup the keys starts here
|
||||
#
|
||||
$sendkeys = new Expect;
|
||||
|
||||
# disable command echoing
|
||||
#$sendkeys->slave->stty(qw(sane -echo));
|
||||
#
|
||||
# exp_internal(1) sets exp_internal debugging
|
||||
# to STDERR.
|
||||
#
|
||||
#$sendkeys->exp_internal(1);
|
||||
$sendkeys->exp_internal($debug);
|
||||
#
|
||||
# log_stdout(0) prevent the program's output from being shown.
|
||||
# turn on if debugging error
|
||||
#$sendkeys->log_stdout(1);
|
||||
$sendkeys->log_stdout($debug);
|
||||
|
||||
# command to send key to the device
|
||||
# sshKey add "key"
|
||||
my $spawnaddkey=
|
||||
"$remoteshell $node -l $to_userid $setupcmd ";
|
||||
|
||||
# send mkdir command
|
||||
unless ($sendkeys->spawn($spawnaddkey))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"Unable to run $spawnaddkey.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
next; # go to next node
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
#run copy.sh prompts starts here
|
||||
#
|
||||
|
||||
my @result = $sendkeys->expect(
|
||||
$timeout,
|
||||
[
|
||||
$prompt1, # Are you sure you want to ...
|
||||
sub {
|
||||
$sendkeys->send("yes\r");
|
||||
$sendkeys->clear_accum();
|
||||
$sendkeys->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt2, # *ssword*
|
||||
sub {
|
||||
$sendkeys->send("$to_userpassword\r");
|
||||
$sendkeys->clear_accum();
|
||||
$sendkeys->exp_continue();
|
||||
}
|
||||
],
|
||||
[
|
||||
$prompt3, # Permission denied
|
||||
sub {
|
||||
$rc= 1;
|
||||
$sendkeys->soft_close();
|
||||
next; # go to next node
|
||||
}
|
||||
],
|
||||
); # end prompts
|
||||
##########################################
|
||||
# Expect error - report
|
||||
##########################################
|
||||
if (defined($result[1]))
|
||||
{
|
||||
my $msg = $result[1];
|
||||
if ($msg =~ /status 0/i) { # no error
|
||||
$rc=0;
|
||||
} else {
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "$node has error,$msg";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
|
||||
$rc=1;
|
||||
next; # go to next node
|
||||
}
|
||||
}
|
||||
$sendkeys->soft_close();
|
||||
} # end foreach node
|
||||
return $rc;
|
||||
}
|
||||
1;
|
||||
|
||||
+29
-35
@@ -59,11 +59,10 @@ sub usage
|
||||
my $usagemsg3 =
|
||||
" -p <template path> [-o output file ] [-t <template count>]\n";
|
||||
my $usagemsg4 = " [-r remove templates] [-s <seednode>]\n";
|
||||
my $usagemsg5 = " [-e exactmatch] [-i ignore] [-V verbose]\n";
|
||||
my $usagemsg5A = " [-l userid] [--devicetype type_of_device]\n";
|
||||
my $usagemsg5 = " [-e exactmatch] [-i ignore]\n";
|
||||
my $usagemsg6 = " {-c <command> | -f <command file>}";
|
||||
my $usagemsg .= $usagemsg1 .= $usagemsg1a .= $usagemsg3 .= $usagemsg4 .=
|
||||
$usagemsg5 .= $usagemsg5A .= $usagemsg6;
|
||||
$usagemsg5 .= $usagemsg6;
|
||||
### end usage mesage
|
||||
|
||||
my $rsp = {};
|
||||
@@ -111,8 +110,6 @@ sub parse_and_run_sinv
|
||||
's|seed=s' => \$options{'seed_node'},
|
||||
'e|exactmatch' => \$options{'exactmatch'},
|
||||
'i|ignorefirst' => \$options{'ignorefirst'},
|
||||
'l|user=s' => \$options{'user'},
|
||||
'devicetype|devicetype=s' => \$options{'devicetype'},
|
||||
'c|cmd=s' => \$options{'sinv_cmd'},
|
||||
'f|file=s' => \$options{'sinv_cmd_file'},
|
||||
'v|version' => \$options{'version'},
|
||||
@@ -201,36 +198,14 @@ sub parse_and_run_sinv
|
||||
# strip off the program and the noderange
|
||||
#
|
||||
my @nodelist = ();
|
||||
my @cmdparts = ();
|
||||
if ($options{'devicetype'}) {
|
||||
# must split different because devices have commands with spaces
|
||||
@cmdparts = split(' ', $cmd,3);
|
||||
} else {
|
||||
@cmdparts = split(' ', $cmd);
|
||||
}
|
||||
my @cmdparts = split(' ', $cmd);
|
||||
my $cmdtype = shift @cmdparts;
|
||||
my $noderange = shift @cmdparts;
|
||||
my @cmd = ();
|
||||
if ($noderange =~ /^-/) # if imageupdate not node
|
||||
if ($noderange =~ /^-/)
|
||||
{ # no noderange
|
||||
push @cmd, $noderange; # put flag back on command
|
||||
}
|
||||
# root is sending the command
|
||||
my @envs;
|
||||
# if -l user id supplied
|
||||
if ($options{'user'}) {
|
||||
push @cmd,"-l";
|
||||
push @cmd,$options{'user'};
|
||||
push @envs,"DSH_TO_USERID=$options{'user'}";
|
||||
}
|
||||
# if device type supplied
|
||||
if ($options{'devicetype'}) {
|
||||
push @cmd,"--devicetype";
|
||||
my $switchtype = $options{'devicetype'};
|
||||
$switchtype =~ s/::/\//g;
|
||||
push @cmd,$switchtype;
|
||||
}
|
||||
|
||||
foreach my $part (@cmdparts)
|
||||
{
|
||||
|
||||
@@ -496,11 +471,22 @@ sub parse_and_run_sinv
|
||||
{
|
||||
command => [$cmdtype],
|
||||
node => \@seed,
|
||||
env => [@envs],
|
||||
arg => [@cmd]
|
||||
},
|
||||
\&$cmdoutput
|
||||
);
|
||||
if ($? > 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
my $i = 0;
|
||||
foreach my $line (@cmdresult)
|
||||
{
|
||||
$rsp->{data}->[$i] = $line;
|
||||
$i++;
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# write the results to the tempfile after running through xdshcoll
|
||||
$rc = &storeresults($callback);
|
||||
@@ -526,12 +512,23 @@ sub parse_and_run_sinv
|
||||
{
|
||||
command => [$cmdtype],
|
||||
node => \@nodelist,
|
||||
env => [@envs],
|
||||
arg => [@cmd]
|
||||
},
|
||||
\&$cmdoutput
|
||||
);
|
||||
|
||||
if ($? > 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
my $i = 0;
|
||||
foreach my $line (@cmdresult)
|
||||
{
|
||||
$rsp->{data}->[$i] = $line;
|
||||
$i++;
|
||||
}
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# write the results to the tempfile after running through xdshcoll
|
||||
$rc = &storeresults($callback);
|
||||
@@ -1169,7 +1166,6 @@ sub writereport
|
||||
my $rsp = {};
|
||||
$ignorefirsttemplate =~ tr/a-z/A-Z/; # convert to upper
|
||||
my $firstpass = 0;
|
||||
my @allnodearray=();
|
||||
foreach my $template (sort keys %nodehash)
|
||||
{
|
||||
|
||||
@@ -1197,7 +1193,6 @@ sub writereport
|
||||
{
|
||||
my @shortnodename = split(/\./, $node);
|
||||
push @nodearray, $shortnodename[0]; # add to process list
|
||||
push @allnodearray, $shortnodename[0]; # add to total list
|
||||
$nodelist .= $shortnodename[0]; # add to print list
|
||||
$nodelist .= ',';
|
||||
}
|
||||
@@ -1255,8 +1250,7 @@ sub writereport
|
||||
my @shortnodename;
|
||||
chomp $dshnodename;
|
||||
$dshnodename =~ s/\s*//g; # remove blanks
|
||||
#foreach my $nodename (@nodearray)
|
||||
foreach my $nodename (@allnodearray)
|
||||
foreach my $nodename (@nodearray)
|
||||
{
|
||||
@shortdshnodename = split(/\./, $dshnodename);
|
||||
@shortnodename = split(/\./, $nodename);
|
||||
|
||||
@@ -1,657 +0,0 @@
|
||||
package xCAT::SLP;
|
||||
use Carp;
|
||||
use IO::Select;
|
||||
use strict;
|
||||
use xCAT::Utils;
|
||||
my $ip6support = eval {
|
||||
require IO::Socket::INET6;
|
||||
require Socket6;
|
||||
1;
|
||||
};
|
||||
use Socket;
|
||||
unless ($ip6support) {
|
||||
require IO::Socket::INET;
|
||||
}
|
||||
|
||||
#TODO: somehow get at system headers to get the value, put in linux's for now
|
||||
use constant IPV6_MULTICAST_IF => 17;
|
||||
use constant IP_MULTICAST_IF => 32;
|
||||
use constant REQ_INTERVAL => 1;
|
||||
my %xid_to_srvtype_map;
|
||||
my $xid;
|
||||
my $gprlist;
|
||||
my %searchmacs;
|
||||
my %ip4neigh;
|
||||
my %ip6neigh;
|
||||
|
||||
sub getmulticasthash {
|
||||
my $hash=0;
|
||||
my @nums = unpack("C*",shift);
|
||||
foreach my $num (@nums) {
|
||||
$hash *= 33;
|
||||
$hash += $num;
|
||||
$hash &= 0xffff;
|
||||
}
|
||||
$hash &= 0x3ff;
|
||||
$hash |= 0x1000;
|
||||
return sprintf("%04x",$hash);
|
||||
}
|
||||
|
||||
|
||||
sub dodiscover {
|
||||
my %args = @_;
|
||||
my $rspcount = 0;
|
||||
my $rspcount1 = 0;
|
||||
my $sendcount = 1;
|
||||
$xid = int(rand(16384))+1;
|
||||
unless ($args{'socket'}) {
|
||||
if ($ip6support) {
|
||||
$args{'socket'} = IO::Socket::INET6->new(Proto => 'udp');
|
||||
} else {
|
||||
$args{'socket'} = IO::Socket::INET->new(Proto => 'udp');
|
||||
}
|
||||
#make an extra effort to request biggest receive buffer OS is willing to give us
|
||||
if (-r "/proc/sys/net/core/rmem_max") { # we can detect the maximum allowed socket, read it.
|
||||
my $sysctl;
|
||||
open ($sysctl,"<","/proc/sys/net/core/rmem_max");
|
||||
my $maxrcvbuf=<$sysctl>;
|
||||
my $rcvbuf = $args{'socket'}->sockopt(SO_RCVBUF);
|
||||
if ($maxrcvbuf > $rcvbuf) {
|
||||
$args{'socket'}->sockopt(SO_RCVBUF,$maxrcvbuf/2);
|
||||
}
|
||||
}
|
||||
}
|
||||
unless ($args{SrvTypes}) { croak "SrvTypes argument is required for xCAT::SLP::Dodiscover"; }
|
||||
unless (xCAT::Utils->isAIX()) { # AIX bug, can't set socket with SO_BROADCAST, otherwise multicast can't work.
|
||||
setsockopt($args{'socket'},SOL_SOCKET,SO_BROADCAST,1); #allow for broadcasts to be sent, we know what we are doing
|
||||
}
|
||||
my @srvtypes;
|
||||
if (ref $args{SrvTypes}) {
|
||||
@srvtypes = @{$args{SrvTypes}};
|
||||
} else {
|
||||
@srvtypes = split /,/,$args{SrvTypes};
|
||||
}
|
||||
my $interfaces = get_interfaces(%args);
|
||||
if ($args{Ip}) {
|
||||
foreach my $nic (keys %$interfaces) {
|
||||
if (${${$interfaces->{$nic}}{ipv4addrs}}[0] =~ /(\d+\.\d+\.\d+\.\d+)/) {
|
||||
unless ($args{Ip} =~ $1) {
|
||||
delete $interfaces->{$nic};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
my @printip;
|
||||
foreach my $iface (keys %{$interfaces}) {
|
||||
foreach my $sip (@{$interfaces->{$iface}->{ipv4addrs}}) {
|
||||
my $ip = $sip;
|
||||
$ip =~ s/\/(.*)//;
|
||||
push @printip, $ip;
|
||||
}
|
||||
}
|
||||
my $printinfo = join(",", @printip);
|
||||
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);
|
||||
}
|
||||
my %rethash;
|
||||
unless ($args{NoWait}) { #in nowait, caller owns the responsibility..
|
||||
#by default, report all respondants within 3 seconds:
|
||||
my $waitforsocket = IO::Select->new();
|
||||
$waitforsocket->add($args{'socket'});
|
||||
my $retrytime = ($args{Retry}>0)?$args{Retry}+1:3;
|
||||
my $retryinterval = ($args{Retry}>0)?$args{Retry}:REQ_INTERVAL;
|
||||
my $waittime = ($args{Time}>0)?$args{Time}:20;
|
||||
my @peerarray;
|
||||
my @pkgarray;
|
||||
|
||||
my $startinterval = time();
|
||||
my $interval;
|
||||
my $deadline=time()+$waittime;
|
||||
my( $port,$flow,$ip6n,$ip4n,$scope);
|
||||
my $slppacket;
|
||||
my $peername;
|
||||
while ($deadline > time()) {
|
||||
########################################
|
||||
# receive untill there is none
|
||||
########################################
|
||||
while ($waitforsocket->can_read(0)) {
|
||||
my $peer = $args{'socket'}->recv($slppacket,3000,0);
|
||||
push @peerarray, $peer;
|
||||
push @pkgarray, $slppacket;
|
||||
}
|
||||
#######################################
|
||||
# process the packets
|
||||
#######################################
|
||||
for(my $j = 0; $j< scalar(@peerarray); $j++) {
|
||||
my $pkg = $peerarray[$j];
|
||||
my $slpkg = $pkgarray[$j];
|
||||
if ($ip6support) {
|
||||
( $port,$flow,$ip6n,$scope) = Socket6::unpack_sockaddr_in6_all($pkg);
|
||||
$peername = Socket6::inet_ntop(Socket6::AF_INET6(),$ip6n);
|
||||
} else {
|
||||
($port,$ip4n) = sockaddr_in($pkg);
|
||||
$peername = inet_ntoa($ip4n);
|
||||
}
|
||||
if ($rethash{$peername}) {
|
||||
next; #got a dupe, discard
|
||||
}
|
||||
my $result = process_slp_packet(packet=>$slpkg,sockaddr=>$pkg,'socket'=>$args{'socket'});
|
||||
if ($result) {
|
||||
if ($peername =~ /\./) { #ipv4
|
||||
$peername =~ s/::ffff://;
|
||||
}
|
||||
$result->{peername} = $peername;
|
||||
if ($gprlist) {
|
||||
$gprlist .= ','.$peername if(length($gprlist) < 1250);
|
||||
} else {
|
||||
$gprlist = $peername;
|
||||
}
|
||||
$result->{scopeid} = $scope;
|
||||
$result->{sockaddr} = $pkg;
|
||||
my $hashkey;
|
||||
if ($peername =~ /fe80/) {
|
||||
$peername .= '%'.$scope;
|
||||
}
|
||||
$rspcount++;
|
||||
$rspcount1++;
|
||||
$rethash{$peername} = $result;
|
||||
|
||||
if ($args{Callback}) {
|
||||
$args{Callback}->($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
#############################
|
||||
# check if need to return
|
||||
#############################
|
||||
@peerarray = ();
|
||||
@pkgarray = ();
|
||||
$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});
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($sendcount > $retrytime and $rspcount1 == 0) {
|
||||
send_message($args{reqcallback}, 0, "Received $rspcount1 responses.") if ($args{reqcallback});
|
||||
last;
|
||||
}
|
||||
#########################
|
||||
# send request again
|
||||
#########################
|
||||
if ( $interval > $retryinterval){#* (2**$sendcount))) { #double time
|
||||
$sendcount++;
|
||||
$startinterval = time();
|
||||
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);
|
||||
}
|
||||
$rspcount1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} #end nowait
|
||||
foreach my $entry (keys %rethash) {
|
||||
handle_new_slp_entity($rethash{$entry})
|
||||
}
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
foreach my $iface (keys %{$interfaces}) {
|
||||
foreach my $sip (@{$interfaces->{$iface}->{ipv4addrs}}) {
|
||||
my $ip = $sip;
|
||||
$ip =~ s/\/(.*)//;
|
||||
my $maskbits = $1;
|
||||
my $runcmd = `route delete 239.255.255.253 $ip`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (\%searchmacs, $sendcount, $rspcount);
|
||||
}
|
||||
|
||||
sub process_slp_packet {
|
||||
my %args = @_;
|
||||
my $sockaddy = $args{sockaddr};
|
||||
my $socket = $args{'socket'};
|
||||
my $packet = $args{packet};
|
||||
my $parsedpacket = removeslpheader($packet);
|
||||
if ($parsedpacket->{FunctionId} == 2) {#Service Reply
|
||||
parse_service_reply($parsedpacket->{payload},$parsedpacket);
|
||||
unless (ref $parsedpacket->{service_urls} and scalar @{$parsedpacket->{service_urls}}) { return undef; }
|
||||
#send_attribute_request('socket'=>$socket,url=>$parsedpacket->{service_urls}->[0],sockaddr=>$sockaddy);
|
||||
if ($parsedpacket->{attributes}) { #service reply had ext
|
||||
return $parsedpacket; #don't bother sending attrrequest, already got it in first packet
|
||||
}
|
||||
my $srvtype = $xid_to_srvtype_map{$parsedpacket->{Xid}};
|
||||
my $packet = generate_attribute_request(%args,SrvType=>$srvtype);
|
||||
$socket->send($packet,0,$sockaddy);
|
||||
return undef;
|
||||
} elsif ($parsedpacket->{FunctionId} == 7) { #attribute reply
|
||||
$parsedpacket->{SrvType} = $xid_to_srvtype_map{$parsedpacket->{Xid}};
|
||||
$parsedpacket->{attributes} = parse_attribute_reply($parsedpacket->{payload});
|
||||
#delete $parsedpacket->{payload};
|
||||
return $parsedpacket;
|
||||
} else {
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
sub parse_attribute_reply {
|
||||
my $contents = shift;
|
||||
my @payload = unpack("C*",$contents);
|
||||
if ($payload[0] != 0 or $payload[1] != 0) {
|
||||
return {};
|
||||
}
|
||||
splice (@payload,0,2);
|
||||
return parse_attribute_list(\@payload);
|
||||
}
|
||||
sub parse_attribute_list {
|
||||
my $payload = shift;
|
||||
my $attrlength = ($payload->[0]<<8)+$payload->[1];
|
||||
splice(@$payload,0,2);
|
||||
my @attributes = splice(@$payload,0,$attrlength);
|
||||
my $attrstring = pack("C*",@attributes);
|
||||
my %attribs;
|
||||
#now we have a string...
|
||||
my $lastattrstring;
|
||||
while ($attrstring) {
|
||||
if ($lastattrstring eq $attrstring) { #infinite loop
|
||||
$attribs{unparsed_attribdata}=$attrstring;
|
||||
last;
|
||||
}
|
||||
$lastattrstring=$attrstring;
|
||||
if ($attrstring =~ /^\(/) {
|
||||
$attrstring =~ s/([^)]*\)),?//;
|
||||
my $attrib = $1;
|
||||
$attrib =~ s/^\(//;
|
||||
$attrib =~ s/\),?$//;
|
||||
$attrib =~ s/=(.*)$//;
|
||||
$attribs{$attrib}=[];
|
||||
my $valstring = $1;
|
||||
if (defined $valstring) {
|
||||
foreach(split /,/,$valstring) {
|
||||
push @{$attribs{$attrib}},$_;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$attrstring =~ s/([^,]*),?//;
|
||||
$attribs{$1}=[];
|
||||
}
|
||||
}
|
||||
return \%attribs;
|
||||
}
|
||||
sub generate_attribute_request {
|
||||
my %args = @_;
|
||||
my $srvtype = $args{SrvType};
|
||||
my $scope = "DEFAULT";
|
||||
if ($args{Scopes}) { $scope = $args{Scopes}; }
|
||||
my $packet = pack("C*",0,0); #no prlist
|
||||
my $service = $srvtype;
|
||||
$service =~ s!://.*!!;
|
||||
my $length = length($service);
|
||||
$packet .= pack("C*",($length>>8),($length&0xff));
|
||||
$length = length($scope);
|
||||
$packet .= $service.pack("C*",($length>>8),($length&0xff)).$scope;
|
||||
$packet .= pack("C*",0,0,0,0);
|
||||
my $header = genslpheader($packet,FunctionId=>6);
|
||||
$xid_to_srvtype_map{$xid++}=$srvtype;
|
||||
return $header.$packet;
|
||||
# $args{'socket'}->send($header.$packet,0,$args{sockaddry});
|
||||
}
|
||||
|
||||
|
||||
sub parse_service_reply {
|
||||
my $packet = shift;
|
||||
my $parsedpacket = shift;
|
||||
my @reply = unpack("C*",$packet);
|
||||
if ($reply[0] != 0 or $reply[1] != 0) {
|
||||
return ();
|
||||
}
|
||||
if ($parsedpacket->{extoffset}) {
|
||||
my @extdata = splice(@reply,$parsedpacket->{extoffset}-$parsedpacket->{currentoffset});
|
||||
$parsedpacket->{currentoffset} = $parsedpacket->{extoffset};
|
||||
parse_extension(\@extdata,$parsedpacket);
|
||||
}
|
||||
my $numurls = ($reply[2]<<8)+$reply[3];
|
||||
splice (@reply,0,4);
|
||||
while ($numurls--) {
|
||||
push @{$parsedpacket->{service_urls}},extract_next_url(\@reply);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub parse_extension {
|
||||
my $extdata = shift;
|
||||
my $parsedpacket = shift;
|
||||
my $extid = ($extdata->[0]<<8)+$extdata->[1];
|
||||
my $nextext = (($extdata->[2])<<16)+(($extdata->[3])<<8)+$extdata->[4];
|
||||
if ($nextext) {
|
||||
my @nextext = splice(@$extdata,$nextext-$parsedpacket->{currentoffset});
|
||||
$parsedpacket->{currentoffset} = $nextext;
|
||||
parse_extension(\@nextext,$parsedpacket);
|
||||
}
|
||||
splice(@$extdata,0,5);
|
||||
if ($extid == 2) {
|
||||
#this is defined in RFC 3059, attribute list extension
|
||||
#employed by AMM for one...
|
||||
my $urllen = ((shift @$extdata)<<8)+(shift @$extdata);
|
||||
splice @$extdata,0,$urllen; #throw this out for now..
|
||||
$parsedpacket->{attributes} = parse_attribute_list($extdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub extract_next_url { #section 4.3 url entries
|
||||
my $payload = shift;
|
||||
splice (@$payload,0,3); # discard reserved and lifetime which we will not bother using
|
||||
my $urllength = ((shift @$payload)<<8)+(shift @$payload);
|
||||
my @url = splice(@$payload,0,$urllength);
|
||||
my $authblocks = shift @$payload;
|
||||
unless ($authblocks == 0) {
|
||||
$payload = []; #TODO: skip/use auth blocks if needed to get at more URLs
|
||||
}
|
||||
return pack("C*",@url);
|
||||
}
|
||||
|
||||
sub send_service_request_single {
|
||||
my %args = @_;
|
||||
my $packet = generate_service_request(%args);
|
||||
my $interfaces = $args{ifacemap}; #get_interfaces(%args);
|
||||
my $socket = $args{'socket'};
|
||||
my @v6addrs;
|
||||
my $v6addr;
|
||||
if ($ip6support) {
|
||||
my $hash=getmulticasthash($args{SrvType});
|
||||
my $target = "ff02::1:$hash";
|
||||
my ($fam, $type, $proto, $name);
|
||||
($fam, $type, $proto, $v6addr, $name) =
|
||||
Socket6::getaddrinfo($target,"svrloc",Socket6::AF_INET6(),SOCK_DGRAM,0);
|
||||
push @v6addrs,$v6addr;
|
||||
($fam, $type, $proto, $v6addr, $name) =
|
||||
Socket6::getaddrinfo("ff01::1:$hash","svrloc",Socket6::AF_INET6(),SOCK_DGRAM,0);
|
||||
push @v6addrs,$v6addr;
|
||||
}
|
||||
my $ipv4mcastaddr = inet_aton("239.255.255.253"); #per rfc 2608
|
||||
my $ipv4sockaddr = sockaddr_in(427,$ipv4mcastaddr);
|
||||
foreach my $iface (keys %{$interfaces}) {
|
||||
if ($ip6support) {
|
||||
setsockopt($socket,Socket6::IPPROTO_IPV6(),IPV6_MULTICAST_IF,pack("I",$interfaces->{$iface}->{scopeidx}));
|
||||
foreach $v6addr (@v6addrs) {
|
||||
$socket->send($packet,0,$v6addr);
|
||||
}
|
||||
}
|
||||
foreach my $sip (@{$interfaces->{$iface}->{ipv4addrs}}) {
|
||||
my $ip = $sip;
|
||||
$ip =~ s/\/(.*)//;
|
||||
my $maskbits = $1;
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
my $runcmd = `route add 239.255.255.253 $ip`;
|
||||
}
|
||||
my $ipn = inet_aton($ip); #we are ipv4 only, this is ok
|
||||
my $ipnum=unpack("N",$ipn);
|
||||
$ipnum= $ipnum | (2**(32-$maskbits))-1;
|
||||
my $bcastn = pack("N",$ipnum);
|
||||
my $bcastaddr = sockaddr_in(427,$bcastn);
|
||||
setsockopt($socket,0,IP_MULTICAST_IF,$ipn);
|
||||
$socket->send($packet,0,$ipv4sockaddr);
|
||||
$socket->send($packet,0,$bcastaddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub get_interfaces {
|
||||
#TODO: AIX tolerance, no subprocess, include/exclude interface(s)
|
||||
my %ifacemap;
|
||||
my $payingattention=0;
|
||||
my $interface;
|
||||
my $keepcurrentiface;
|
||||
# AIX part
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
$ip6support = 0;
|
||||
my $result = `ifconfig -a`;
|
||||
my @nics = $result =~ /(\w+\d+)\: flags=/g;
|
||||
my @adapter = split /\w+\d+:\s+flags=/, $result;
|
||||
for (my $i=0; $i<scalar(@adapter); $i++) {
|
||||
$_ = $adapter[$i+1];
|
||||
if ( !($_ =~ /LOOPBACK/ ) and
|
||||
$_ =~ /UP(,|>)/ and
|
||||
$_ =~ /BROADCAST/ ) {
|
||||
my @ip = split /\n/;
|
||||
for my$entry ( @ip ) {
|
||||
if ( $entry =~ /broadcast\s+/ and $entry =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/) {
|
||||
my $tmpip = $1;
|
||||
if($entry =~ /netmask\s+(0x\w+)/) {
|
||||
my $mask = hex($1);
|
||||
my $co = 31;
|
||||
my $count = 0;
|
||||
while ($co+1) {
|
||||
if((($mask&(2**$co))>>$co) == 1) {
|
||||
$count++;
|
||||
}
|
||||
$co--;
|
||||
}
|
||||
$tmpip = $tmpip.'/'.$count;
|
||||
}
|
||||
push @{$ifacemap{$nics[$i]}->{ipv4addrs}},$tmpip;
|
||||
if( $nics[$i]=~ /\w+(\d+)/){
|
||||
$ifacemap{$nics[$i]}->{scopeidx} = $1+2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
my @ipoutput = `ip addr`;
|
||||
foreach my $line (@ipoutput) {
|
||||
if ($line =~ /^\d/) { # new interface, new context..
|
||||
if ($interface and not $keepcurrentiface) {
|
||||
#don't bother reporting unusable nics
|
||||
delete $ifacemap{$interface};
|
||||
}
|
||||
$keepcurrentiface=0;
|
||||
unless ($line =~ /MULTICAST/) { #don't care if it isn't multicast capable
|
||||
$payingattention=0;
|
||||
next;
|
||||
}
|
||||
$payingattention=1;
|
||||
$line =~ /^([^:]*): ([^:]*):/;
|
||||
$interface=$2;
|
||||
$ifacemap{$interface}->{scopeidx}=$1;
|
||||
}
|
||||
unless ($payingattention) { next; } #don't think about lines unless in context of paying attention.
|
||||
if ($line =~ /inet/) {
|
||||
$keepcurrentiface=1;
|
||||
}
|
||||
if ($line =~ /\s+inet\s+(\S+)\s/) { #got an ipv4 address, store it
|
||||
push @{$ifacemap{$interface}->{ipv4addrs}},$1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%ifacemap;
|
||||
}
|
||||
# discovery is "service request", rfc 2608
|
||||
# 0 1 2 3
|
||||
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | Service Location header (function = SrvRqst = 1) |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | length of <PRList> | <PRList> String \
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | length of <service-type> | <service-type> String \
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | length of <scope-list> | <scope-list> String \
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | length of predicate string | Service Request <predicate> \
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | length of <SLP SPI> string | <SLP SPI> String \
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
sub generate_service_request {
|
||||
my %args = @_;
|
||||
my $srvtype = $args{SrvType};
|
||||
my $scope = "DEFAULT";
|
||||
if ($args{Scopes}) { $scope = $args{Scopes}; }
|
||||
my $prlist = $gprlist;
|
||||
my $prlength = length($prlist);
|
||||
my $packet = pack("C*",($prlength>>8),($prlength&0xff));
|
||||
$packet .= $prlist;
|
||||
my $length = length($srvtype);
|
||||
$packet .= pack("C*",($length>>8),($length&0xff));
|
||||
$packet .= $srvtype;
|
||||
$length = length($scope);
|
||||
$packet .= pack("C*",($length>>8),($length&0xff));
|
||||
$packet .= $scope;
|
||||
#no ldap predicates, and no auth, so zeroes..
|
||||
$packet .= pack("C*",0,0,0,0);
|
||||
$packet .= pack("C*",0,2,0,0,0,0,0,0,0,0);
|
||||
my $extoffset = length($srvtype)+length($scope)+length($prlist)+10;
|
||||
my $header = genslpheader($packet,Multicast=>1,FunctionId=>1,ExtOffset=>$extoffset);
|
||||
$xid_to_srvtype_map{$xid++}=$srvtype;
|
||||
return $packet = $header.$packet;
|
||||
}
|
||||
# SLP header from RFC 2608
|
||||
# 0 1 2 3
|
||||
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | Version | Function-ID | Length |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | Length, contd.|O|F|R| reserved |Next Ext Offset|
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | Next Extension Offset, contd.| XID |
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
# | Language Tag Length | Language Tag \
|
||||
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
sub removeslpheader {
|
||||
my $packet = shift;
|
||||
my %parsedheader;
|
||||
my @payload = unpack("C*",$packet);
|
||||
$parsedheader{Version} = shift @payload;
|
||||
$parsedheader{FunctionId} = shift @payload;
|
||||
splice(@payload,0,3); #remove length
|
||||
splice(@payload,0,2); #TODO: parse flags
|
||||
my $nextoffset = ((shift @payload)<<16)+((shift @payload)<<8)+(shift @payload);
|
||||
$parsedheader{Xid} = ((shift @payload)<<8)+(shift @payload);
|
||||
my $langlen = ((shift @payload)<<8)+(shift @payload);
|
||||
$parsedheader{lang} = pack("C*",splice(@payload,0,$langlen));
|
||||
$parsedheader{payload} = pack("C*",@payload);
|
||||
if ($nextoffset != 0) {
|
||||
#correct offset since header will be removed
|
||||
$parsedheader{currentoffset} = 14+$langlen;
|
||||
$parsedheader{extoffset}=$nextoffset;
|
||||
}
|
||||
return \%parsedheader;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub genslpheader {
|
||||
my $packet = shift;
|
||||
my %args = @_;
|
||||
my $flaghigh=0;
|
||||
my $flaglow=0; #this will probably never ever ever change
|
||||
if ($args{Multicast}) { $flaghigh |= 0x20; }
|
||||
my $extoffset=0;
|
||||
if ($args{ExtOffset}) {
|
||||
$extoffset = $args{ExtOffset}+16;
|
||||
}
|
||||
my @extoffset=(($extoffset>>16),(($extoffset>>8)&0xff),($extoffset&0xff));
|
||||
my $length = length($packet)+16; #our header is 16 bytes due to lang tag invariance
|
||||
if ($length > 1400) { die "Overflow not supported in xCAT SLP"; }
|
||||
return pack("C*",2, $args{FunctionId}, ($length >> 16), ($length >> 8)&0xff, $length&0xff, $flaghigh, $flaglow,@extoffset,$xid>>8,$xid&0xff,0,2)."en";
|
||||
}
|
||||
|
||||
unless (caller) {
|
||||
#time to provide unit testing/example usage
|
||||
#somewhat fancy invocation with multiple services and callback for
|
||||
#results on-the-fly
|
||||
require Data::Dumper;
|
||||
Data::Dumper->import();
|
||||
my $srvtypes = ["service:management-hardware.IBM:chassis-management-module","service:management-hardware.IBM:integrated-management-module2","service:management-hardware.IBM:management-module","service:management-hardware.IBM:cec-service-processor"];
|
||||
xCAT::SLP::dodiscover(SrvTypes=>$srvtypes,Callback=>sub { print Dumper(@_) });
|
||||
#example 2: simple invocation of a single service type
|
||||
$srvtypes = "service:management-hardware.IBM:chassis-management-module";
|
||||
print Dumper(xCAT::SLP::dodiscover(SrvTypes=>$srvtypes));
|
||||
#TODO: pass-in socket and not wait inside SLP.pm example
|
||||
}
|
||||
###########################################
|
||||
# Parse the slp resulte data
|
||||
###########################################
|
||||
sub handle_new_slp_entity {
|
||||
my $data = shift;
|
||||
delete $data->{sockaddr}; #won't need it
|
||||
my $mac = get_mac_for_addr($data->{peername});
|
||||
unless ($mac) { return; }
|
||||
$searchmacs{$mac} = $data;
|
||||
}
|
||||
###########################################
|
||||
# Get mac addresses
|
||||
###########################################
|
||||
sub get_mac_for_addr {
|
||||
my $neigh;
|
||||
my $addr = shift;
|
||||
if ($addr =~ /:/) {
|
||||
get_ipv6_neighbors();
|
||||
return $ip6neigh{$addr};
|
||||
} else {
|
||||
get_ipv4_neighbors();
|
||||
return $ip4neigh{$addr};
|
||||
}
|
||||
}
|
||||
|
||||
###########################################
|
||||
# Get ipv4 mac addresses
|
||||
###########################################
|
||||
sub get_ipv4_neighbors {
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
my @ipdata = `arp -a`;
|
||||
%ip6neigh=();
|
||||
for my $entry (@ipdata) {
|
||||
if ($entry =~ /(\d+\.\d+\.\d+\.\d+)/) {
|
||||
my $ip = $1;
|
||||
#if ($entry =~ /at (\w+\:\w+\:\w+\:\w+\:\w+\:\w+)/) {
|
||||
# $ip4neigh{$ip}=$1;
|
||||
if ($entry =~ /at (\w+)\:(\w+)\:(\w+)\:(\w+)\:(\w+)\:(\w+)/) {
|
||||
#$ip4neigh{$ip}=$1.$2.$3.$4.$5.$6;
|
||||
$ip4neigh{$ip}=sprintf("%02s%02s%02s%02s%02s%02s",$1,$2,$3,$4,$5,$6);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#TODO: something less 'hacky'
|
||||
my @ipdata = `ip -4 neigh`;
|
||||
%ip6neigh=();
|
||||
foreach (@ipdata) {
|
||||
if (/^(\S*)\s.*lladdr\s*(\S*)\s/) {
|
||||
$ip4neigh{$1}=$2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
###########################################
|
||||
# Get ipv6 mac addresses
|
||||
###########################################
|
||||
sub get_ipv6_neighbors {
|
||||
#TODO: something less 'hacky'
|
||||
my @ipdata = `ip -6 neigh`;
|
||||
%ip6neigh=();
|
||||
foreach (@ipdata) {
|
||||
if (/^(\S*)\s.*lladdr\s*(\S*)\s/) {
|
||||
$ip6neigh{$1}=$2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub send_message {
|
||||
my $callback = shift;
|
||||
my $ecode = shift;
|
||||
my $msg = shift;
|
||||
my %output;
|
||||
$output{errorcode} = $ecode;
|
||||
$output{data} = $msg;
|
||||
$callback->( \%output );
|
||||
}
|
||||
1;
|
||||
Executable → Regular
+1
-38
@@ -6,26 +6,6 @@ require Exporter;
|
||||
our @ISA=qw/Exporter/;
|
||||
our @EXPORT_OK=qw/decode_spd/;
|
||||
|
||||
sub do_crc16 {
|
||||
my @data = @_;
|
||||
my $crc = 0;
|
||||
while (@data) {
|
||||
my $byte = shift @data;
|
||||
$crc = $crc ^ $byte<<8;
|
||||
my $loopcount=8;
|
||||
while ($loopcount--) {
|
||||
if ($crc & 0x8000) {
|
||||
$crc = $crc <<1 ^ 0x1021;
|
||||
} else {
|
||||
$crc = $crc << 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $crc & 0xffff;;;;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub decode_manufacturer {
|
||||
my $jedec_ids = [
|
||||
{
|
||||
@@ -619,7 +599,6 @@ sub decode_manufacturer {
|
||||
}
|
||||
];
|
||||
my $arr_index = shift;
|
||||
$arr_index = $arr_index & 0x7f;
|
||||
my $code = shift;
|
||||
unless ($code) {
|
||||
return "Malformed SPD";
|
||||
@@ -741,23 +720,7 @@ sub decode_spd {
|
||||
unless ($rethash->{product}->{model}) {
|
||||
$rethash->{product}->{model}=pack("C*",@spd[128..145]);
|
||||
}
|
||||
if ($spd[0] & 0b10000000) { #crc is to exclude 117-125, crc 0 to 116
|
||||
unless (do_crc16(@spd[0..116]) == ($spd[126]+($spd[127]<<8))) {
|
||||
push @{$rethash->{product}->{extra}},"SPD CRC Invalid!";
|
||||
}
|
||||
} else { #crc for 0 to 125
|
||||
unless (do_crc16(@spd[0..125]) == ($spd[126]+($spd[127]<<8))) {
|
||||
push @{$rethash->{product}->{extra}},"CRC Invalid!";
|
||||
}
|
||||
}
|
||||
#my $rawspd="SPD Dump: ";
|
||||
#foreach (@spd) {
|
||||
# $rawspd .= sprintf("%02X ",$_);
|
||||
#}
|
||||
#push @{$rethash->{product}->{extra}},$rawspd;
|
||||
} else {
|
||||
$rethash->{product}->{model}="Unrecognized SPD";
|
||||
}
|
||||
}
|
||||
return $rethash;
|
||||
}
|
||||
|
||||
|
||||
+140
-849
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
||||
package xCAT::Scope;
|
||||
use xCAT::Utils;
|
||||
use xCAT::Table;
|
||||
use xCAT::ServiceNodeUtils qw(getSNList);
|
||||
sub get_broadcast_scope {
|
||||
my $req = shift;
|
||||
if ($req =~ /xCAT::Scope/) {
|
||||
@@ -11,8 +10,8 @@ sub get_broadcast_scope {
|
||||
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
|
||||
#Exit if the packet has been preprocessed in its history
|
||||
my @requests = ({%$req}); #Start with a straight copy to reflect local instance
|
||||
foreach (xCAT::ServiceNodeUtils->getSNList()) {
|
||||
if (xCAT::NetworkUtils->thishostisnot($_)) {
|
||||
foreach (xCAT::Utils->getSNList()) {
|
||||
if (xCAT::Utils->thishostisnot($_)) {
|
||||
my $reqcopy = {%$req};
|
||||
$reqcopy->{'_xcatdest'} = $_;
|
||||
$reqcopy->{_xcatpreprocessed}->[0] = 1;
|
||||
@@ -25,7 +24,7 @@ sub get_broadcast_scope {
|
||||
#$sitetab->close;
|
||||
#if ($ent and $ent->{value}) {
|
||||
# foreach (split /,/,$ent->{value}) {
|
||||
# if (xCAT::NetworkUtils->thishostisnot($_)) {
|
||||
# if (xCAT::Utils->thishostisnot($_)) {
|
||||
# my $reqcopy = {%$req};
|
||||
# $reqcopy->{'_xcatdest'} = $_;
|
||||
# push @requests,$reqcopy;
|
||||
|
||||
@@ -1,825 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
package xCAT::ServiceNodeUtils;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
|
||||
# if AIX - make sure we include perl 5.8.2 in INC path.
|
||||
# Needed to find perl dependencies shipped in deps tarball.
|
||||
if ($^O =~ /^aix/i) {
|
||||
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/5.8.2";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2";
|
||||
}
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use strict;
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 readSNInfo
|
||||
|
||||
Read resource, NFS server, Master node, OS an ARCH from the database
|
||||
for the service node
|
||||
|
||||
Input: service nodename
|
||||
Output: Masternode, OS and ARCH
|
||||
Example:
|
||||
xCAT::ServiceNodeUtils->readSNInfo;
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub readSNInfo
|
||||
{
|
||||
my ($class, $nodename) = @_;
|
||||
my $rc = 0;
|
||||
my $et;
|
||||
my $masternode;
|
||||
my $os;
|
||||
my $arch;
|
||||
$rc = xCAT::Utils->exportDBConfig();
|
||||
if ($rc == 0)
|
||||
{
|
||||
|
||||
if ($nodename)
|
||||
{
|
||||
$masternode = xCAT::TableUtils->GetMasterNodeName($nodename);
|
||||
if (!($masternode))
|
||||
{
|
||||
xCAT::MsgUtils->message('S',
|
||||
"Could not get Master for node $nodename\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
$et = xCAT::TableUtils->GetNodeOSARCH($nodename);
|
||||
if ($et == 1)
|
||||
{
|
||||
xCAT::MsgUtils->message('S',
|
||||
"Could not get OS/ARCH for node $nodename\n");
|
||||
return 1;
|
||||
}
|
||||
if (!($et->{'os'} || $et->{'arch'}))
|
||||
{
|
||||
xCAT::MsgUtils->message('S',
|
||||
"Could not get OS/ARCH for node $nodename\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
$et->{'master'} = $masternode;
|
||||
return $et;
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 isServiceReq
|
||||
|
||||
|
||||
Checks the service node table in the database to see
|
||||
if input Service should be setup on the
|
||||
input service node
|
||||
|
||||
Input:servicenodename,ipaddres(s) and hostnames of service node
|
||||
Output:
|
||||
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; }
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub isServiceReq
|
||||
{
|
||||
require xCAT::Table;
|
||||
my ($class, $servicenodename, $serviceip) = @_;
|
||||
|
||||
# list of all services from service node table
|
||||
# note this must be updated if more services added
|
||||
my @services = (
|
||||
"nameserver", "dhcpserver", "tftpserver", "nfsserver",
|
||||
"conserver", "monserver", "ldapserver", "ntpserver",
|
||||
"ftpserver", "ipforward"
|
||||
);
|
||||
|
||||
my @ips = @$serviceip; # list of service node ip addresses and names
|
||||
my $rc = 0;
|
||||
|
||||
$rc = xCAT::Utils->exportDBConfig(); # export DB env
|
||||
if ($rc != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message('S', "Unable export DB environment.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
# get handle to servicenode table
|
||||
my $servicenodetab = xCAT::Table->new('servicenode');
|
||||
unless ($servicenodetab)
|
||||
{
|
||||
xCAT::MsgUtils->message('S', "Unable to open servicenode table.\n");
|
||||
$::RUNCMD_RC = 1;
|
||||
return; # do not setup anything
|
||||
}
|
||||
|
||||
my @process_service_list = ();
|
||||
|
||||
# read all the nodes from the table, for each service
|
||||
foreach my $service (@services)
|
||||
{
|
||||
my @snodelist = $servicenodetab->getAllNodeAttribs([$service]);
|
||||
|
||||
foreach $serviceip (@ips) # check the table for this servicenode
|
||||
{
|
||||
foreach my $node (@snodelist)
|
||||
|
||||
{
|
||||
if ($serviceip eq $node->{'node'})
|
||||
{ # match table entry
|
||||
if ($node->{$service})
|
||||
{ # returns service, only if set
|
||||
my $value = $node->{$service};
|
||||
$value =~ tr/a-z/A-Z/; # convert to upper
|
||||
# value 1 or yes then we setup the service
|
||||
if (($value eq "1") || ($value eq "YES"))
|
||||
{
|
||||
push @process_service_list,
|
||||
$service; # found service to setup
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$servicenodetab->close;
|
||||
|
||||
$::RUNCMD_RC = 0;
|
||||
return @process_service_list;
|
||||
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getAllSN
|
||||
|
||||
Returns an array of all service nodes from service node table
|
||||
|
||||
Arguments:
|
||||
ALL" - will also return the management node in the array, if
|
||||
if has been defined in the servicenode table
|
||||
Returns:
|
||||
array of Service Nodes or empty array, if none
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
1 - error
|
||||
Example:
|
||||
@SN=xCAT::ServiceNodeUtils->getAllSN
|
||||
@allSN=xCAT::ServiceNodeUtils->getAllSN("ALL")
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getAllSN
|
||||
{
|
||||
|
||||
my ($class, $options) = @_;
|
||||
require xCAT::Table;
|
||||
# reads all nodes from the service node table
|
||||
my @servicenodes;
|
||||
my $servicenodetab = xCAT::Table->new('servicenode');
|
||||
unless ($servicenodetab) # no servicenode table
|
||||
{
|
||||
xCAT::MsgUtils->message('I', "Unable to open servicenode table.\n");
|
||||
$servicenodetab->close;
|
||||
return @servicenodes;
|
||||
|
||||
}
|
||||
my @nodes = $servicenodetab->getAllNodeAttribs(['tftpserver']);
|
||||
foreach my $nodes (@nodes)
|
||||
{
|
||||
push @servicenodes, $nodes->{node};
|
||||
}
|
||||
# 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 $nodes (@servicenodes) {
|
||||
if ($mname ne ($nodes)){
|
||||
push @newservicenodes, $nodes;
|
||||
}
|
||||
}
|
||||
$servicenodetab->close;
|
||||
return @newservicenodes; # return without the MN in the array
|
||||
}
|
||||
}
|
||||
$servicenodetab->close;
|
||||
return @servicenodes;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getSNandNodes
|
||||
|
||||
Returns an hash-array of all service nodes and the nodes they service
|
||||
|
||||
Arguments:
|
||||
none
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getSNandNodes
|
||||
|
||||
Returns an hash-array of all service nodes and the nodes they service
|
||||
|
||||
Arguments:
|
||||
none
|
||||
Returns:
|
||||
Service Nodes and the nodes they service or empty , if none
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
1 - error
|
||||
Example:
|
||||
$sn=xCAT::ServiceNodeUtils->getSNandNodes()
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getSNandNodes
|
||||
{
|
||||
|
||||
require xCAT::Table;
|
||||
# read all the nodes from the nodelist table
|
||||
# call get_ServiceNode to find which Service Node
|
||||
# the node belongs to.
|
||||
my %sn;
|
||||
my @nodes;
|
||||
my $nodelisttab = xCAT::Table->new('nodelist');
|
||||
my $recs = $nodelisttab->getAllEntries();
|
||||
foreach (@$recs)
|
||||
{
|
||||
push @nodes, $_->{node};
|
||||
}
|
||||
$nodelisttab->close;
|
||||
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN");
|
||||
return $sn;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getSNList
|
||||
|
||||
Reads the servicenode table. Will return all the enabled Service Nodes
|
||||
that will setup the input Service ( e.g tftpserver,nameserver,etc)
|
||||
If service is blank, then will return the list of all enabled Service
|
||||
Nodes.
|
||||
|
||||
Arguments:
|
||||
Servicename ( xcat,tftpserver,dhcpserver,conserver,etc)
|
||||
If no servicename, returns all Servicenodes
|
||||
"ALL" argument means you also want the MN returned. It can be in the
|
||||
servicenode list. If no "ALL", take out the MN if it is there.
|
||||
Returns:
|
||||
Array of service node names
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
1 - error
|
||||
Example:
|
||||
$sn= xCAT::ServiceNodeUtils->getSNList($servicename) { blah; }
|
||||
$sn= xCAT::ServiceNodeUtils->getSNList($servicename,"ALL") { blah; }
|
||||
$sn= xCAT::ServiceNodeUtils->getSNList() { blah; }
|
||||
$sn= xCAT::ServiceNodeUtils->getSNList("","ALL") { blah; }
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getSNList
|
||||
{
|
||||
require xCAT::Table;
|
||||
my ($class, $service,$options) = @_;
|
||||
|
||||
# reads all nodes from the service node table
|
||||
my @servicenodes;
|
||||
my $servicenodetab = xCAT::Table->new('servicenode', -create => 1);
|
||||
unless ($servicenodetab) # no servicenode table
|
||||
{
|
||||
xCAT::MsgUtils->message('I', "Unable to open servicenode table.\n");
|
||||
return ();
|
||||
}
|
||||
my @nodes = $servicenodetab->getAllNodeAttribs([$service]);
|
||||
$servicenodetab->close;
|
||||
foreach my $node (@nodes)
|
||||
{
|
||||
if ($service eq "") # want all the service nodes
|
||||
{
|
||||
push @servicenodes, $node->{node};
|
||||
}
|
||||
else
|
||||
{ # looking for a particular service
|
||||
if ($node->{$service})
|
||||
{ # if null then do not add node
|
||||
my $value = $node->{$service};
|
||||
$value =~ tr/a-z/A-Z/; # convert to upper
|
||||
# value 1 or yes or blank then we setup the service
|
||||
if (($value == 1) || ($value eq "YES"))
|
||||
{
|
||||
push @servicenodes, $node->{node};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# 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 $nodes (@servicenodes) {
|
||||
if ($mname ne ($nodes)){
|
||||
push @newservicenodes, $nodes;
|
||||
}
|
||||
}
|
||||
return @newservicenodes; # return without the MN in the array
|
||||
}
|
||||
}
|
||||
|
||||
return @servicenodes;
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 get_ServiceNode
|
||||
|
||||
Will get the Service node ( name or ipaddress) as known by the Management
|
||||
Node or Node for the input nodename or ipadress of the node
|
||||
which can be a Service Node.
|
||||
If the input node is a Service Node then it's Service node
|
||||
is always the Management Node.
|
||||
|
||||
input: list of nodenames and/or node ipaddresses (array ref)
|
||||
service name
|
||||
"MN" or "Node" determines if you want the Service node as known
|
||||
by the Management Node or by the node.
|
||||
|
||||
recognized service names: xcat,tftpserver,
|
||||
nfsserver,conserver,monserver
|
||||
|
||||
service "xcat" is used by command like xdsh that need to know the
|
||||
service node that will process the command but are not tied to a
|
||||
specific service like tftp
|
||||
|
||||
Todo: Handle dhcpserver and nameserver from the networks table
|
||||
|
||||
output: A hash ref of arrays, the key is the service node pointing to
|
||||
an array of nodes that are serviced by that service node
|
||||
|
||||
Globals:
|
||||
$::ERROR_RC
|
||||
Error:
|
||||
$::ERROR_RC=0 no error $::ERROR_RC=1 error
|
||||
|
||||
example: $sn =xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes,$service,"MN");
|
||||
$sn =xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes,$service,"Node");
|
||||
Note: this rountine is important to hierarchical support in xCAT
|
||||
and used in many places. Any changes to the logic should be
|
||||
reviewed by xCAT architecture
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub get_ServiceNode
|
||||
{
|
||||
require xCAT::Table;
|
||||
my ($class, $node, $service, $request) = @_;
|
||||
my @node_list = @$node;
|
||||
my $cmd;
|
||||
my %snhash;
|
||||
my $nodehash;
|
||||
my $sn;
|
||||
my $nodehmtab;
|
||||
my $noderestab;
|
||||
my $snattribute;
|
||||
my $oshash;
|
||||
my $nodetab;
|
||||
$::ERROR_RC = 0;
|
||||
|
||||
# determine if the request is for the service node as known by the MN
|
||||
# or the node
|
||||
|
||||
if ($request eq "MN")
|
||||
{
|
||||
$snattribute = "servicenode";
|
||||
|
||||
}
|
||||
else # Node
|
||||
{
|
||||
$snattribute = "xcatmaster";
|
||||
}
|
||||
# get site.master this will be the default
|
||||
my $master = xCAT::TableUtils->get_site_Master();
|
||||
$noderestab = xCAT::Table->new('noderes');
|
||||
|
||||
unless ($noderestab) # no noderes table, use default site.master
|
||||
{
|
||||
xCAT::MsgUtils->message('I',
|
||||
"Unable to open noderes table. Using site->Master.\n");
|
||||
|
||||
if ($master) # use site Master value
|
||||
{
|
||||
|
||||
foreach my $node (@node_list)
|
||||
{
|
||||
push @{$snhash{$master}}, $node;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xCAT::MsgUtils->message('E', "Unable to read site Master value.\n");
|
||||
$::ERROR_RC = 1;
|
||||
}
|
||||
|
||||
return \%snhash;
|
||||
}
|
||||
|
||||
if ($service eq "xcat")
|
||||
{ # find all service nodes for the nodes in the list
|
||||
|
||||
$nodehash = $noderestab->getNodesAttribs(\@node_list, [$snattribute]);
|
||||
|
||||
|
||||
foreach my $node (@node_list)
|
||||
{
|
||||
foreach my $rec (@{$nodehash->{$node}})
|
||||
{
|
||||
if ($rec and $rec->{$snattribute}) # use noderes.servicenode
|
||||
{
|
||||
my $key = $rec->{$snattribute};
|
||||
push @{$snhash{$key}}, $node;
|
||||
}
|
||||
else # use site.master
|
||||
{
|
||||
push @{$snhash{$master}}, $node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$noderestab->close;
|
||||
return \%snhash;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (
|
||||
($service eq "tftpserver") # all from noderes table
|
||||
|| ($service eq "nfsserver") || ($service eq "monserver")
|
||||
)
|
||||
{
|
||||
$nodehash =
|
||||
$noderestab->getNodesAttribs(\@node_list,
|
||||
[$service, $snattribute]);
|
||||
foreach my $node (@node_list)
|
||||
{
|
||||
foreach my $rec (@{$nodehash->{$node}})
|
||||
{
|
||||
if ($rec and $rec->{$service})
|
||||
{
|
||||
|
||||
# see if both MN and Node address in attribute
|
||||
my ($msattr, $nodeattr) = split ':', $rec->{$service};
|
||||
my $key = $msattr;
|
||||
if ($request eq "Node")
|
||||
{
|
||||
if ($nodeattr) # override with Node, if it exists
|
||||
{
|
||||
$key = $nodeattr;
|
||||
}
|
||||
}
|
||||
push @{$snhash{$key}}, $node;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($rec and $rec->{$snattribute}) # if it exists
|
||||
{
|
||||
my $key = $rec->{$snattribute};
|
||||
push @{$snhash{$key}}, $node;
|
||||
}
|
||||
else
|
||||
{ # use site.master
|
||||
push @{$snhash{$master}}, $node;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$noderestab->close;
|
||||
return \%snhash;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($service eq "conserver")
|
||||
{
|
||||
|
||||
# read the nodehm table
|
||||
$nodehmtab = xCAT::Table->new('nodehm');
|
||||
unless ($nodehmtab) # no nodehm table
|
||||
{
|
||||
xCAT::MsgUtils->message('I',
|
||||
"Unable to open nodehm table.\n");
|
||||
|
||||
# use servicenode
|
||||
$nodehash =
|
||||
$noderestab->getNodesAttribs(\@node_list, [$snattribute]);
|
||||
foreach my $node (@node_list)
|
||||
{
|
||||
foreach my $rec (@{$nodehash->{$node}})
|
||||
{
|
||||
if ($rec and $rec->{$snattribute})
|
||||
{
|
||||
my $key = $rec->{$snattribute};
|
||||
push @{$snhash{$key}}, $node;
|
||||
}
|
||||
else
|
||||
{ # use site.master
|
||||
push @{$snhash{$master}}, $node;
|
||||
}
|
||||
}
|
||||
}
|
||||
$noderestab->close;
|
||||
return \%snhash;
|
||||
}
|
||||
|
||||
# can read the nodehm table
|
||||
$nodehash =
|
||||
$nodehmtab->getNodesAttribs(\@node_list, ['conserver']);
|
||||
foreach my $node (@node_list)
|
||||
{
|
||||
foreach my $rec (@{$nodehash->{$node}})
|
||||
{
|
||||
if ($rec and $rec->{'conserver'})
|
||||
{
|
||||
|
||||
# see if both MN and Node address in attribute
|
||||
my ($msattr, $nodeattr) = split ':',
|
||||
$rec->{'conserver'};
|
||||
my $key = $msattr;
|
||||
if ($request eq "Node")
|
||||
{
|
||||
if ($nodeattr
|
||||
) # override with Node, if it exists
|
||||
{
|
||||
$key = $nodeattr;
|
||||
}
|
||||
}
|
||||
push @{$snhash{$key}}, $node;
|
||||
}
|
||||
else
|
||||
{ # use service node for this node
|
||||
$sn =
|
||||
$noderestab->getNodeAttribs($node,
|
||||
[$snattribute]);
|
||||
if ($sn and $sn->{$snattribute})
|
||||
{
|
||||
my $key = $sn->{$snattribute};
|
||||
push @{$snhash{$key}}, $node;
|
||||
}
|
||||
else
|
||||
{ # no service node use master
|
||||
push @{$snhash{$master}}, $node;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$noderestab->close;
|
||||
$nodehmtab->close;
|
||||
return \%snhash;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
xCAT::MsgUtils->message('E',
|
||||
"Invalid service=$service input.\n");
|
||||
$::ERROR_RC = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%snhash;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getSNformattedhash
|
||||
|
||||
Will call get_ServiceNode to get the Service node ( name or ipaddress)
|
||||
as known by the Management
|
||||
Server or Node for the input nodename or ipadress of the node
|
||||
It will then format the output into a single servicenode key with values
|
||||
the list of nodes service by that service node. This routine will
|
||||
break up pools of service nodes into individual node in the hash unlike
|
||||
get_ServiceNode which leaves the pool as the key.
|
||||
|
||||
input: Same as get_ServiceNode to call get_ServiceNode
|
||||
list of nodenames and/or node ipaddresses (array ref)
|
||||
service name
|
||||
"MN" or "Node" determines if you want the Service node as known
|
||||
by the Management Node or by the node.
|
||||
|
||||
recognized service names: xcat,tftpserver,
|
||||
nfsserver,conserver,monserver
|
||||
|
||||
service "xcat" is used by command like xdsh that need to know the
|
||||
service node that will process the command but are not tied to a
|
||||
specific service like tftp
|
||||
|
||||
|
||||
output: A hash ref of arrays, the key is a single service node
|
||||
pointing to
|
||||
a list of nodes that are serviced by that service node
|
||||
'rra000-m'=>['blade01', 'testnode']
|
||||
'sn1'=>['blade01', 'testnode']
|
||||
'sn2'=>['blade01']
|
||||
'sn3'=>['testnode']
|
||||
|
||||
Globals:
|
||||
$::ERROR_RC
|
||||
Error:
|
||||
$::ERROR_RC=0 no error $::ERROR_RC=1 error
|
||||
|
||||
example: $sn =xCAT::ServiceNodeUtils->getSNformattedhash(\@nodes,$service,"MN", $type);
|
||||
$sn =xCAT::ServiceNodeUtils->getSNformattedhash(\@nodes,$service,"Node", "primary");
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getSNformattedhash
|
||||
{
|
||||
my ($class, $node, $service, $request, $btype) = @_;
|
||||
my @node_list = @$node;
|
||||
my $cmd;
|
||||
my %newsnhash;
|
||||
|
||||
my $type="";
|
||||
if ($btype) {
|
||||
$type=$btype;
|
||||
}
|
||||
|
||||
# get the values of either the servicenode or xcatmaster attributes
|
||||
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@node_list, $service, $request);
|
||||
|
||||
# get the keys which are the service nodes and break apart any pool lists
|
||||
# format into individual service node keys pointing to node lists
|
||||
if ($sn)
|
||||
{
|
||||
foreach my $snkey (keys %$sn)
|
||||
{
|
||||
# split the key if pool of service nodes
|
||||
push my @tmpnodes, $sn->{$snkey};
|
||||
my @nodes;
|
||||
for my $i (0 .. $#tmpnodes) {
|
||||
for my $j ( 0 .. $#{$tmpnodes[$i]}) {
|
||||
my $check=$tmpnodes[$i][$j];
|
||||
push @nodes,$check;
|
||||
}
|
||||
}
|
||||
|
||||
# for SN backup we might only want the primary or backup
|
||||
my @servicenodes;
|
||||
my ($primary, $backup) = split /,/, $snkey;
|
||||
if (($primary) && ($type eq "primary")) {
|
||||
push @servicenodes, $primary;
|
||||
} elsif (($backup) && ($type eq "backup")) {
|
||||
push @servicenodes, $backup;
|
||||
} else {
|
||||
@servicenodes = split /,/, $snkey;
|
||||
}
|
||||
|
||||
# now build new hash of individual service nodes
|
||||
foreach my $newsnkey (@servicenodes) {
|
||||
push @{$newsnhash{$newsnkey}}, @nodes;
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%newsnhash;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head3 getAIXSNinterfaces
|
||||
|
||||
Get a list of ip addresses for each service node in a list
|
||||
|
||||
Arguments:
|
||||
list of service nodes
|
||||
Returns:
|
||||
hash of ips for each service node
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $sni = xCAT::ServiceNodeUtils->getAIXSNinterfaces(\@servlist, $callback, $subreq);
|
||||
|
||||
Comments:
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getAIXSNinterfaces
|
||||
{
|
||||
my ($class, $list, $callback, $sub_req) = @_;
|
||||
|
||||
my @snlist = @$list;
|
||||
my %SNinterfaces;
|
||||
|
||||
# get all the possible IPs for the node I'm running on
|
||||
my $ifcmd = "/usr/sbin/ifconfig -a | grep 'inet ' ";
|
||||
foreach my $sn (@snlist)
|
||||
{
|
||||
my $SNIP;
|
||||
my $out = xCAT::InstUtils->xcmd($callback, $sub_req, "xdsh", $sn, $ifcmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Could not get IP addresses from service node $sn.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
|
||||
my @result;
|
||||
foreach my $line ( split(/\n/, $out)) {
|
||||
$line =~ s/$sn:\s+//;
|
||||
push(@result, $line);
|
||||
}
|
||||
|
||||
foreach my $int (@result) {
|
||||
my ($inet, $SNIP, $str) = split(" ", $int);
|
||||
chomp $SNIP;
|
||||
$SNIP =~ s/\/.*//; # ipv6 address 4000::99/64
|
||||
$SNIP =~ s/\%.*//; # ipv6 address ::1%1/128
|
||||
push(@{$SNinterfaces{$sn}}, $SNIP);
|
||||
}
|
||||
} # end foreach SN
|
||||
return \%SNinterfaces;
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3
|
||||
|
||||
getSNandCPnodes - Take an array of nodes and returns
|
||||
an array of the service
|
||||
nodes and an array of the computenode .
|
||||
|
||||
Arguments:
|
||||
none
|
||||
Returns:
|
||||
array of Service Nodes and/or array of compute nodesarray of compute nodes empty array, if none
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
1 - error
|
||||
Example:
|
||||
xCAT::ServiceNodeUtils->getSNandCPnodes(\@nodes,\@SN,\@CN);
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getSNandCPnodes
|
||||
{
|
||||
|
||||
my ($class, $nodes,$sn,$cn) = @_;
|
||||
my @nodelist = @$nodes;
|
||||
# get the list of all Service nodes
|
||||
my @allSN=xCAT::ServiceNodeUtils->getAllSN;
|
||||
foreach my $node (@nodelist) {
|
||||
if (grep(/^$node$/, @allSN)) { # it is a SN
|
||||
push (@$sn,$node);
|
||||
} else { # a CN
|
||||
push (@$cn,$node);
|
||||
}
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
1;
|
||||
+56
-171
@@ -12,9 +12,7 @@
|
||||
# -cache to persist so long as '_build_cache' calls concurrently stack (for NodeRange interpretation mainly) (done)
|
||||
# -Allow plugins to define a staleness threshold for getNodesAttribs freshness (complicated enough to postpone...)
|
||||
# so that actions requested by disparate managed nodes may aggregate in SQL calls
|
||||
# cache lifetime is no longer determined strictly by function duration
|
||||
# now it can live up to 5 seconds. However, most calls will ignore the cache unless using a special option.
|
||||
# Hmm, potential issue, getNodesAttribs might return up to 5 second old data even if caller expects brand new data
|
||||
# reference count managed cache lifetime, if clear_cache is called, and build_chache has been called twice, decrement the counter
|
||||
# if called again, decrement again and clear cache
|
||||
# for getNodesAttribs, we can put a parameter to request allowable staleneess
|
||||
# if the cachestamp is too old, build_cache is called
|
||||
@@ -51,12 +49,14 @@ BEGIN
|
||||
# if AIX - make sure we include perl 5.8.2 in INC path.
|
||||
# Needed to find perl dependencies shipped in deps tarball.
|
||||
if ($^O =~ /^aix/i) {
|
||||
unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2));
|
||||
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/5.8.2";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2";
|
||||
}
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
my $cachethreshold=16; #How many nodes in 'getNodesAttribs' before switching to full DB retrieval
|
||||
#TODO: dynamic tracking/adjustment, the point where cache is cost effective differs based on overall db size
|
||||
|
||||
use DBI;
|
||||
$DBI::dbi_debug=9; # increase the debug output
|
||||
@@ -203,8 +203,6 @@ sub init_dbworker {
|
||||
eval { #avoid hang by allowin client to die too
|
||||
print $currcon "*XCATBUGDETECTED*:$err:*XCATBUGDETECTED*\n";
|
||||
print $currcon "*XCATBUGDETECTED*76e9b54341\n";
|
||||
$clientset->remove($currcon);
|
||||
close($currcon);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -213,10 +211,9 @@ sub init_dbworker {
|
||||
};
|
||||
if ($@) { #this should never be reached, but leave it intact just in case
|
||||
my $err=$@;
|
||||
eval { xCAT::MsgUtils->message("S","xcatd: possible BUG encountered by xCAT DB worker ".$err); };
|
||||
xCAT::MsgUtils->message("S","xcatd: possible BUG encountered by xCAT DB worker ".$err);
|
||||
}
|
||||
if ($intendedpid != $$) { #avoid redundant fork
|
||||
eval { xCAT::MsgUtils->message("S","Pid $$ shutting itself down because only pid $intendedpid is permitted to be in this area"); };
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
@@ -299,11 +296,7 @@ sub handle_dbc_request {
|
||||
$opentables{$tablename}->{$autocommit} = xCAT::Table->new(@args);
|
||||
}
|
||||
if ($opentables{$tablename}->{$autocommit}) {
|
||||
if ($opentables{$tablename}->{$autocommit^1}) {
|
||||
$opentables{$tablename}->{$autocommit}->{cachepeer}=$opentables{$tablename}->{$autocommit^1};
|
||||
$opentables{$tablename}->{$autocommit^1}->{cachepeer}=$opentables{$tablename}->{$autocommit};
|
||||
}
|
||||
return 1;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -316,10 +309,6 @@ sub handle_dbc_request {
|
||||
unless ($opentables{$tablename}->{$autocommit}) {
|
||||
return undef;
|
||||
}
|
||||
if ($opentables{$tablename}->{$autocommit^1}) {
|
||||
$opentables{$tablename}->{$autocommit}->{cachepeer}=$opentables{$tablename}->{$autocommit^1};
|
||||
$opentables{$tablename}->{$autocommit^1}->{cachepeer}=$opentables{$tablename}->{$autocommit};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($functionname eq 'getAllAttribs') {
|
||||
@@ -360,6 +349,8 @@ sub handle_dbc_request {
|
||||
return $opentables{$tablename}->{$autocommit}->_set_use_cache(@args);
|
||||
} elsif ($functionname eq '_build_cache') {
|
||||
return $opentables{$tablename}->{$autocommit}->_build_cache(@args);
|
||||
} elsif ($functionname eq '_clear_cache') {
|
||||
return $opentables{$tablename}->{$autocommit}->_clear_cache(@args);
|
||||
} else {
|
||||
die "undefined function $functionname";
|
||||
}
|
||||
@@ -745,10 +736,6 @@ sub new
|
||||
return undef;
|
||||
}
|
||||
} else { #direct db access mode
|
||||
if ($opentables{$self->{tabname}}->{$self->{autocommit}}) { #if we are inside the db worker and asked to create a new table that is already open, just return a reference to that table
|
||||
#generally speaking, this should cause a lot of nodelists to be shared
|
||||
return $opentables{$self->{tabname}}->{$self->{autocommit}};
|
||||
}
|
||||
$self->{dbuser}="";
|
||||
$self->{dbpass}="";
|
||||
|
||||
@@ -2056,7 +2043,6 @@ sub getNodesAttribs {
|
||||
return dbc_call($self,'getNodesAttribs',@_);
|
||||
}
|
||||
my $nodelist = shift;
|
||||
unless ($nodelist) { $nodelist = []; } #common to be invoked with undef seemingly
|
||||
my %options=();
|
||||
my @attribs;
|
||||
if (ref $_[0]) {
|
||||
@@ -2065,9 +2051,7 @@ sub getNodesAttribs {
|
||||
} else {
|
||||
@attribs = @_;
|
||||
}
|
||||
my @realattribs = @attribs; #store off the requester attribute list, the cached columns may end up being a superset and we shouldn't return more than asked
|
||||
#it should also be the case that cache will be used if it already is in play even if below cache threshold. This would be desired behavior
|
||||
if (scalar(@$nodelist) > $cachethreshold) {
|
||||
if (scalar($nodelist) > $cachethreshold) {
|
||||
$self->{_use_cache} = 0;
|
||||
$self->{nodelist}->{_use_cache}=0;
|
||||
if ($self->{tabname} eq 'nodelist') { #a sticky situation
|
||||
@@ -2088,11 +2072,13 @@ sub getNodesAttribs {
|
||||
}
|
||||
my $rethash;
|
||||
foreach (@$nodelist) {
|
||||
my @nodeentries=$self->getNodeAttribs($_,\@realattribs,%options);
|
||||
my @nodeentries=$self->getNodeAttribs($_,\@attribs,%options);
|
||||
$rethash->{$_} = \@nodeentries; #$self->getNodeAttribs($_,\@attribs);
|
||||
}
|
||||
$self->_clear_cache;
|
||||
$self->{_use_cache} = 0;
|
||||
if ($self->{tabname} ne 'nodelist') {
|
||||
if ($self->{tabname} ne 'nodelist') { #avoid calling clear_cache on nodelist twice
|
||||
$self->{nodelist}->_clear_cache;
|
||||
$self->{nodelist}->{_use_cache} = 0;
|
||||
}
|
||||
return $rethash;
|
||||
@@ -2100,7 +2086,6 @@ sub getNodesAttribs {
|
||||
|
||||
sub _refresh_cache { #if cache exists, force a rebuild, leaving reference counts alone
|
||||
my $self = shift; #dbworker check not currently required
|
||||
if ($self->{cachepeer}->{_cachestamp}) { $self->{cachepeer}->{_cachestamp}=0; }
|
||||
if ($self->{_use_cache}) { #only do things if cache is set up
|
||||
$self->_build_cache(1); #for now, rebuild the whole thing.
|
||||
#in the future, a faster cache update may be possible
|
||||
@@ -2113,12 +2098,30 @@ sub _refresh_cache { #if cache exists, force a rebuild, leaving reference counts
|
||||
# (uses stale nodelist data and misses new nodes, the error)
|
||||
#1st noderange finishes
|
||||
#2nd noderange finishes
|
||||
} else { #even if a cache is not in use *right this second*, we need to mark any cached data that may exist as invalid, do so by suggesting the cache is from 1970
|
||||
if ($self->{_cachestamp}) { $self->{_cachestamp}=0; }
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub _clear_cache { #PRIVATE FUNCTION TO EXPIRE CACHED DATA EXPLICITLY
|
||||
#This is no longer sufficient to do at destructor time, as Table objects actually live an indeterminite amount of time now
|
||||
#TODO: only clear cache if ref count mentioned in build_cache is 1, otherwise decrement ref count
|
||||
my $self = shift;
|
||||
if ($dbworkerpid) {
|
||||
return dbc_call($self,'_clear_cache',@_);
|
||||
}
|
||||
if ($self->{_cache_ref} > 1) { #don't clear the cache if there are still live references
|
||||
$self->{_cache_ref} -= 1;
|
||||
return;
|
||||
} elsif ($self->{_cache_ref} == 1) { #If it is 1, decrement to zero and carry on
|
||||
$self->{_cache_ref} = 0;
|
||||
}
|
||||
#it shouldn't have been zero, but whether it was 0 or 1, ensure that the cache is gone
|
||||
$self->{_use_cache}=0; # Signal slow operation to any in-flight operations that may fail with empty cache
|
||||
$self->{_cached_attriblist} = undef;
|
||||
undef $self->{_tablecache};
|
||||
undef $self->{_nodecache};
|
||||
}
|
||||
|
||||
sub _build_cache { #PRIVATE FUNCTION, PLEASE DON'T CALL DIRECTLY
|
||||
#TODO: increment a reference counter type thing to preserve current cache
|
||||
#Also, if ref count is 1 or greater, and the current cache is less than 3 seconds old, reuse the cache?
|
||||
@@ -2127,13 +2130,14 @@ sub _build_cache { #PRIVATE FUNCTION, PLEASE DON'T CALL DIRECTLY
|
||||
return dbc_call($self,'_build_cache',@_);
|
||||
}
|
||||
my $attriblist = shift;
|
||||
my %copts = @_;
|
||||
my $refresh = not ref $attriblist; #if attriblist is not a reference, it is a refresh request
|
||||
if (not ref $attriblist) {
|
||||
$attriblist = $self->{_cached_attriblist}; #need attriblist to mean something, don't know how this didn't break horribly already
|
||||
}
|
||||
|
||||
if (not $refresh and $self->{_cache_ref}) { #we have active cache reference, increment counter and return
|
||||
#TODO: ensure that the cache isn't somehow still ludirously old
|
||||
$self->{_cache_ref} += 1;
|
||||
my $currattr;
|
||||
my $cachesufficient=1;
|
||||
foreach $currattr (@$attriblist) { #if any of the requested attributes are not cached, we must rebuild
|
||||
@@ -2142,10 +2146,6 @@ sub _build_cache { #PRIVATE FUNCTION, PLEASE DON'T CALL DIRECTLY
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($self->{_cachestamp} < (time()-5)) { #NEVER use a cache older than 5 seconds
|
||||
$cachesufficient=0;
|
||||
}
|
||||
|
||||
if ($cachesufficient) { return; }
|
||||
#cache is insufficient, now we must do the converse of above
|
||||
#must add any currently cached columns to new list if not requested
|
||||
@@ -2223,9 +2223,7 @@ $evalcpt->permit('require');
|
||||
sub getNodeAttribs
|
||||
{
|
||||
my $self = shift;
|
||||
if ($dbworkerpid) { #TODO: should this be moved outside of the DB worker entirely? I'm thinking so, but I don't dare do so right now...
|
||||
#the benefit would be the potentially computationally intensive substitution logic would be moved out and less time inside limited
|
||||
#db worker scope
|
||||
if ($dbworkerpid) {
|
||||
return dbc_call($self,'getNodeAttribs',@_);
|
||||
}
|
||||
my $node = shift;
|
||||
@@ -2238,33 +2236,7 @@ sub getNodeAttribs
|
||||
@attribs = @_;
|
||||
}
|
||||
my $datum;
|
||||
my $oldusecache;
|
||||
my $nloldusecache;
|
||||
if ($options{prefetchcache}) { #TODO: If this *were* split out of DB worker, this logic would have to move *into* returnany
|
||||
if ($self->{tabname} eq 'nodelist') { #a sticky situation
|
||||
my @locattribs=@attribs;
|
||||
unless (grep(/^node$/,@locattribs)) {
|
||||
push @locattribs,'node';
|
||||
}
|
||||
unless (grep(/^groups$/,@locattribs)) {
|
||||
push @locattribs,'groups';
|
||||
}
|
||||
$self->_build_cache(\@locattribs,noincrementref=>1);
|
||||
} else {
|
||||
$self->_build_cache(\@attribs,noincrementref=>1);
|
||||
$self->{nodelist}->_build_cache(['node','groups'],noincrementref=>1);
|
||||
}
|
||||
$oldusecache=$self->{_use_cache};
|
||||
$nloldusecache=$self->{nodelist}->{_use_cache};
|
||||
$self->{_use_cache}=1;
|
||||
$self->{nodelist}->{_use_cache}=1;
|
||||
}
|
||||
my @data = $self->getNodeAttribs_nosub_returnany($node, \@attribs,%options);
|
||||
if ($options{prefetchcache}) {
|
||||
$self->{_use_cache}=$oldusecache;
|
||||
$self->{nodelist}->{_use_cache}=$nloldusecache;
|
||||
#in this case, we just let the cache live, even if it is to be ignored by most invocations
|
||||
}
|
||||
#my ($datum, $extra) = $self->getNodeAttribs_nosub($node, \@attribs);
|
||||
#if ($extra) { return undef; } # return (undef,"Ambiguous query"); }
|
||||
defined($data[0])
|
||||
@@ -2286,9 +2258,8 @@ sub getNodeAttribs
|
||||
my $exp = substr($datum->{$attrib}, 1);
|
||||
chop $exp;
|
||||
my @parts = split('/', $exp, 2);
|
||||
my $retval = $node;
|
||||
$retval =~ s/$parts[0]/$parts[1]/;
|
||||
$datum->{$attrib} = $retval;
|
||||
$node =~ s/$parts[0]/$parts[1]/;
|
||||
$datum->{$attrib} = $node;
|
||||
}
|
||||
elsif ($datum->{$attrib} =~ /^\|.*\|.*\|$/)
|
||||
{
|
||||
@@ -2348,72 +2319,6 @@ sub getNodeAttribs
|
||||
return wantarray ? @data : $data[0];
|
||||
}
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
=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
|
||||
@@ -2901,9 +2806,7 @@ sub getAllAttribsWhere
|
||||
|
||||
Arguments:
|
||||
Table handle
|
||||
Attribute list
|
||||
optional hash return style
|
||||
( changes the return hash structure format)
|
||||
Attribute list
|
||||
Returns:
|
||||
Array of attribute values
|
||||
Globals:
|
||||
@@ -2911,8 +2814,7 @@ sub getAllAttribsWhere
|
||||
Error:
|
||||
|
||||
Example:
|
||||
my @entries = $self->{switchtab}->getAllNodeAttribs(['port','switch']);
|
||||
my @entries = $self->{switchtab}->getAllNodeAttribs(['port','switch'],1);
|
||||
my @entries = $self->{switchtab}->getAllNodeAttribs(['port','switch']);
|
||||
Comments:
|
||||
none
|
||||
|
||||
@@ -2929,7 +2831,6 @@ sub getAllNodeAttribs
|
||||
}
|
||||
my $attribq = shift;
|
||||
my $hashretstyle = shift;
|
||||
my %options=@_;
|
||||
my $rethash;
|
||||
my @results = ();
|
||||
my %donenodes
|
||||
@@ -2948,10 +2849,10 @@ sub getAllNodeAttribs
|
||||
$query = $self->{dbh}->prepare($qstring);
|
||||
$query->execute();
|
||||
xCAT::NodeRange::retain_cache(1);
|
||||
unless ($options{prefetchcache}) {
|
||||
$self->{_use_cache} = 0;
|
||||
$self->{nodelist}->{_use_cache}=0;
|
||||
}
|
||||
$self->_clear_cache();
|
||||
$self->{nodelist}->_clear_cache();
|
||||
$self->_build_cache($attribq);
|
||||
$self->{nodelist}->_build_cache(['node','groups']);
|
||||
$self->{_use_cache} = 1;
|
||||
@@ -2961,14 +2862,9 @@ sub getAllNodeAttribs
|
||||
|
||||
unless ($data->{$nodekey} =~ /^$/ || !defined($data->{$nodekey}))
|
||||
{ #ignore records without node attrib, not possible?
|
||||
|
||||
my @nodes;
|
||||
unless ($self->{nrcache}->{$data->{$nodekey}} and (($self->{nrcache}->{$data->{$nodekey}}->{tstamp} + 5) > time())) {
|
||||
my @cnodes = xCAT::NodeRange::noderange($data->{$nodekey});
|
||||
$self->{nrcache}->{$data->{$nodekey}}->{value} = \@cnodes;
|
||||
$self->{nrcache}->{$data->{$nodekey}}->{tstamp} = time();
|
||||
}
|
||||
@nodes = @{$self->{nrcache}->{$data->{$nodekey}}->{value}}; #expand node entry, to make groups expand
|
||||
my @nodes =
|
||||
xCAT::NodeRange::noderange($data->{$nodekey})
|
||||
; #expand node entry, to make groups expand
|
||||
unless (@nodes) { #in the event of an entry not in nodelist, use entry value verbatim
|
||||
@nodes = ($data->{$nodekey});
|
||||
}
|
||||
@@ -3004,8 +2900,11 @@ sub getAllNodeAttribs
|
||||
}
|
||||
}
|
||||
}
|
||||
$self->_clear_cache();
|
||||
$self->{nodelist}->_clear_cache();
|
||||
$self->{_use_cache} = 0;
|
||||
$self->{nodelist}->{_use_cache} = 0;
|
||||
xCAT::NodeRange::retain_cache(0);
|
||||
$query->finish();
|
||||
if ($hashretstyle) {
|
||||
return $rethash;
|
||||
@@ -3052,9 +2951,6 @@ sub getAllAttribs
|
||||
my @attribs = @_;
|
||||
my @results = ();
|
||||
if ($self->{_use_cache}) {
|
||||
if ($self->{_cachestamp} < (time()-5)) { #NEVER use a cache older than 5 seconds
|
||||
$self->_refresh_cache();
|
||||
}
|
||||
my @results;
|
||||
my $cacheline;
|
||||
CACHELINE: foreach $cacheline (@{$self->{_tablecache}}) {
|
||||
@@ -3121,18 +3017,11 @@ sub getAllAttribs
|
||||
Error:
|
||||
|
||||
Example:
|
||||
my $table=xCAT::Table->new("nodelist");
|
||||
my %keyhash;
|
||||
$keyhash{node} = "node1";
|
||||
$keyhash{groups} = "compute1";
|
||||
$table->delEntries(\%keyhash);
|
||||
$table->commit;
|
||||
Build delete statement and'ing the elements of the hash
|
||||
DELETE FROM nodelist WHERE ("groups" = "compute1" AND "node" = "node1")
|
||||
my $table=xCAT::Table->new("notification", -create => 1,-autocommit => 0);
|
||||
my %key_col = (filename=>$fname);
|
||||
$table->delEntries(\%key_col);
|
||||
$table->commit;
|
||||
|
||||
If called with no attributes, it will delete all entries in the table.
|
||||
$table->delEntries();
|
||||
$table->commit;
|
||||
Comments:
|
||||
none
|
||||
|
||||
@@ -3230,7 +3119,6 @@ sub delEntries
|
||||
$stmt->execute(@stargs);
|
||||
$stmt->finish;
|
||||
|
||||
$self->_refresh_cache(); #cache is invalid, refresh
|
||||
#notify the interested parties
|
||||
if ($notif == 1)
|
||||
{
|
||||
@@ -3269,7 +3157,7 @@ sub getAttribs
|
||||
{
|
||||
|
||||
#Takes two arguments:
|
||||
#-Key(s) name (will be compared against the table key(s) value)
|
||||
#-Node name (will be compared against the 'Node' column)
|
||||
#-List reference of attributes for which calling code wants at least one of defined
|
||||
# (recurse argument intended only for internal use.)
|
||||
# Returns a hash reference with requested attributes defined.
|
||||
@@ -3289,9 +3177,6 @@ sub getAttribs
|
||||
}
|
||||
my @return;
|
||||
if ($self->{_use_cache}) {
|
||||
if ($self->{_cachestamp} < (time()-5)) { #NEVER use a cache older than 5 seconds
|
||||
$self->_refresh_cache();
|
||||
}
|
||||
my @results;
|
||||
my $cacheline;
|
||||
if (scalar(keys %keypairs) == 1 and $keypairs{node}) { #99.9% of queries look like this, optimized case
|
||||
@@ -3899,7 +3784,7 @@ sub writeAllEntries
|
||||
# open the file for write
|
||||
unless (open($fh," > $filename")) {
|
||||
my $msg="Unable to open $filename for write \n.";
|
||||
`logger -p local4.err -t xcat $msg`;
|
||||
`logger -t xcat $msg`;
|
||||
return 1;
|
||||
}
|
||||
my $query;
|
||||
@@ -3984,7 +3869,7 @@ sub writeAllAttribsWhere
|
||||
# open the file for write
|
||||
unless (open($fh," > $filename")) {
|
||||
my $msg="Unable to open $filename for write \n.";
|
||||
`logger -p local4.err -t xcat $msg`;
|
||||
`logger -t xcat $msg`;
|
||||
return 1;
|
||||
}
|
||||
my $header;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+23
-94
@@ -18,7 +18,6 @@ use xCAT::Utils;
|
||||
my %usage = (
|
||||
"rnetboot" =>
|
||||
"Usage: rnetboot <noderange> [-s net|hd] [-F] [-f] [-V|--verbose] [-m table.colum==expectedstatus] [-m table.colum==expectedstatus...] [-r <retrycount>] [-t <timeout>]
|
||||
rnetboot <noderange> [ipl= address]
|
||||
rnetboot [-h|--help|-v|--version]",
|
||||
"rpower" =>
|
||||
"Usage: rpower <noderange> [--nodeps] [on|onstandby|off|suspend|reset|stat|state|boot] [-V|--verbose] [-m table.colum==expectedstatus][-m table.colum==expectedstatus...] [-r <retrycount>] [-t <timeout>]
|
||||
@@ -35,12 +34,8 @@ my %usage = (
|
||||
rpower <noderange> [stat|state|rackstandby|exit_rackstandby|resetsp]
|
||||
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|off|cycle|state]
|
||||
Blade(using AMM) specific:
|
||||
Blade specific:
|
||||
rpower <noderange> [cycle|softoff] [-V|--verbose]
|
||||
zVM specific:
|
||||
rpower noderange [on|off|reset|stat|softoff]
|
||||
",
|
||||
"rbeacon" =>
|
||||
"Usage: rbeacon <noderange> [on|off|stat] [-V|--verbose]
|
||||
@@ -78,19 +73,15 @@ my %usage = (
|
||||
rinv <noderange> [deconfig [-x]]
|
||||
Blade specific:
|
||||
rinv <noderange> [mtm|serial|mac|bios|diag|mprom|mparom|firm|all]
|
||||
IBM Flex System Compute Node specific:
|
||||
rinv <noderange> [firm]
|
||||
VMware specific:
|
||||
rinv <noderange>
|
||||
zVM specific:
|
||||
rinv noderange [all|config]",
|
||||
rinv <noderange>",
|
||||
"rsetboot" =>
|
||||
"Usage: rsetboot <noderange> [net|hd|cd|floppy|def|stat] [-V|--verbose]
|
||||
rsetboot [-h|--help|-v|--version]",
|
||||
"rbootseq" =>
|
||||
"Usage:
|
||||
Common:
|
||||
rbootseq [-h|--help|-v|--version|-V|--verbose]
|
||||
rbootseq [-h|--help|-v|--version]
|
||||
Blade specific:
|
||||
rbootseq <noderange> [hd0|hd1|hd2|hd3|net|iscsi|usbflash|floppy|none],...
|
||||
PPC (using Direct FSP Management) specific:
|
||||
@@ -101,7 +92,7 @@ my %usage = (
|
||||
"rspconfig" =>
|
||||
"Usage:
|
||||
Common:
|
||||
rspconfig [-h|--help|-v|--version|-V|--verbose]
|
||||
rspconfig [-h|--help|-v|--version]
|
||||
BMC/MPA Common:
|
||||
rspconfig <noderange> [snmpdest|alert|community] [-V|--verbose]
|
||||
rspconfig <noderange> [snmpdest=<dest ip address>|alert=<on|off|en|dis|enable|disable>|community=<string>]
|
||||
@@ -115,7 +106,6 @@ my %usage = (
|
||||
rspconfig <noderange> [sshcfg|snmpcfg|pd1|pd2|network|swnet|ntp|textid|frame]
|
||||
rspconfig <singlenode> [textid=name]
|
||||
rspconfig <singlenode> [frame=number]
|
||||
rspconfig <singlenode> [USERID=passwd] [updateBMC=<y|n>]
|
||||
rspconfig <noderange> [sshcfg=<enable|disable>|
|
||||
snmpcfg=<enable|disable>|
|
||||
pd1=<nonred|redwoperf|redwperf>|
|
||||
@@ -184,10 +174,9 @@ my %usage = (
|
||||
getmacs [-h|--help|-v|--version]
|
||||
PPC specific:
|
||||
getmacs <noderange> [-F filter]
|
||||
getmacs <noderange> [-M]
|
||||
getmacs <noderange> [-V| --verbose] [-f] [-d] [--arp] | [-D [-o] [-S server] [-G gateway] [-C client]]
|
||||
getmacs <noderange> [-V| --verbose] [-f] [-d] [--arp] | [-D [-S server] [-G gateway] [-C client]]
|
||||
blade specific:
|
||||
getmacs <noderange> [-V| --verbose] [-d] [--arp] [-i ethN|enN]
|
||||
getmacs <noderange> [-V| --verbose] [-d] [--arp]
|
||||
",
|
||||
"mkvm" =>
|
||||
"Usage:
|
||||
@@ -198,10 +187,7 @@ my %usage = (
|
||||
mkvm noderange -c destcec -p profile [-V|--verbose]
|
||||
mkvm noderange --full [-V|--verbose]
|
||||
For KVM
|
||||
mkvm noderange -m|--master mastername -s|--size disksize -f|--force
|
||||
For zVM
|
||||
mkvm noderange directory_entry_file_path
|
||||
mkvm noderange source_virtual_machine pool=disk_pool pw=multi_password",
|
||||
mkvm noderange -m|--master mastername -s|--size disksize -f|--force",
|
||||
"lsvm" =>
|
||||
"Usage:
|
||||
Common:
|
||||
@@ -210,13 +196,7 @@ my %usage = (
|
||||
PPC (with HMC) specific:
|
||||
lsvm <noderange> [-a|--all]
|
||||
PPC (using Direct FSP Management) specific:
|
||||
lsvm <noderange> [-l|--long]
|
||||
zVM specific:
|
||||
lsvm noderange
|
||||
lsvm noderange --getnetworknames
|
||||
lsvm noderange --getnetwork network_name
|
||||
lsvm noderange --diskpoolnames
|
||||
lsvm noderange --diskpool pool_name",
|
||||
lsvm <noderange> [-l|--long]",
|
||||
"chvm" =>
|
||||
"Usage:
|
||||
Common:
|
||||
@@ -229,40 +209,16 @@ my %usage = (
|
||||
chvm <noderange> [lparname=<*|name>]
|
||||
chvm <noderange> -i <id> [-m <memory_interleaving>] -r <partition_rule>
|
||||
VMware specific:
|
||||
chvm <noderange> [-a size][-d disk][-p disk][--resize disk=size][--cpus count][--mem memory]
|
||||
zVM specific:
|
||||
chvm noderange [--add3390 disk_pool device_address cylinders mode read_password write_password multi_password]
|
||||
chvm noderange [--add3390active device_address mode]
|
||||
chvm noderange [--add9336 disk_pool virtual_device block_size mode blocks read_password write_password multi_password]
|
||||
chvm noderange [--adddisk2pool function region volume group]
|
||||
chvm noderange [--addnic address type device_count]
|
||||
chvm noderange [--addprocessor address]
|
||||
chvm noderange [--addprocessoractive address type]
|
||||
chvm noderange [--addvdisk userID] device_address size]
|
||||
chvm noderange [--connectnic2guestlan address lan owner]
|
||||
chvm noderange [--connectnic2vswitch address vswitch]
|
||||
chvm noderange [--copydisk target_address source_node source_address]
|
||||
chvm noderange [--dedicatedevice virtual_device real_device mode]
|
||||
chvm noderange [--deleteipl]
|
||||
chvm noderange [--formatdisk disk_address multi_password]
|
||||
chvm noderange [--disconnectnic address]
|
||||
chvm noderange [--grantvswitch VSwitch]
|
||||
chvm noderange [--removedisk virtual_device]
|
||||
chvm noderange [--resetsmapi]
|
||||
chvm noderange [--removediskfrompool function region group]
|
||||
chvm noderange [--removenic address]
|
||||
chvm noderange [--removeprocessor address]
|
||||
chvm noderange [--replacevs directory_entry]
|
||||
chvm noderange [--setipl ipl_target load_parms parms]
|
||||
chvm noderange [--setpassword password]",
|
||||
chvm <noderange> [-a size][-d disk][-p disk][--resize disk=size][--cpus count][--mem memory]",
|
||||
"rmvm" =>
|
||||
"Usage: rmvm <noderange> [--service][-V|--verbose]
|
||||
rmvm [-h|--help|-v|--version],
|
||||
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]
|
||||
[-t tries][--vpdtable][-C counts][-T timeout][--flexdiscover]",
|
||||
lsslp [<noderange>][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC][-C counts][-T timeout]
|
||||
[-t tries][-m][-e cmd][-c [timeinterval[interval,..]]][--vpdtable]
|
||||
[-M vpd|switchport][--makedhcp][--updatehost][--resetnet]",
|
||||
"rflash" =>
|
||||
"Usage:
|
||||
rflash [ -h|--help|-v|--version]
|
||||
@@ -270,9 +226,8 @@ my %usage = (
|
||||
rflash <noderange> -p <rpm_directory> [--activate concurrent | disruptive][-V|--verbose]
|
||||
rflash <noderange> [--commit | --recover] [-V|--verbose]
|
||||
PPC (using Direct FSP Management) specific:
|
||||
rflash <noderange> -p <rpm_directory> --activate <disruptive|deferred> [-d <data_directory>]
|
||||
rflash <noderange> [--commit | --recover] [-V|--verbose]
|
||||
rflash <noderange> [--bpa_acdl]",
|
||||
rflash <noderange> -p <rpm_directory> --activate disruptive [-d <data_directory>]
|
||||
rflash <noderange> [--commit | --recover] [-V|--verbose]",
|
||||
"mkhwconn" =>
|
||||
"Usage:
|
||||
mkhwconn [-h|--help]
|
||||
@@ -327,7 +282,10 @@ my %usage = (
|
||||
or
|
||||
updatenode <noderange> [-V|--verbose] [-k|--security] [-s|--sn]
|
||||
or
|
||||
updatenode <noderange> [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [-S|--sw]
|
||||
updatenode <noderange> [-V|--verbose] [-k|--security] [--user]
|
||||
[--devicetype]
|
||||
or
|
||||
updatenode <noderange> [-V|--verbose] [-F|--sync | -f|--snsync] [-S|--sw]
|
||||
[-P|--scripts [script1,script2,...]] [-s|--sn]
|
||||
[-A|--updateallsw] [-c|--cmdlineonly] [-d alt_source_dir]
|
||||
[attr=val [attr=val...]]
|
||||
@@ -340,12 +298,13 @@ Options:
|
||||
[-k|--security] Update the security keys and certificates for the
|
||||
target nodes.
|
||||
|
||||
[-k|--security] [--user] [--devicetype] Update the ssh keys for
|
||||
specific device.
|
||||
|
||||
[-F|--sync] Perform File Syncing.
|
||||
|
||||
[-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.
|
||||
|
||||
[-S|--sw] Perform Software Maintenance.
|
||||
|
||||
@@ -381,36 +340,11 @@ Options:
|
||||
"Usage:
|
||||
Common:
|
||||
nodeset [-h|--help|-v|--version]
|
||||
nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=<imagename>]|statelite|offline]",
|
||||
nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage=<imagename>|statelite]",
|
||||
"rmflexnode" =>
|
||||
"Usage:
|
||||
rmflexnode [-h|--help|-v|--version]
|
||||
rmflexnode <noderange>",
|
||||
"lsve" =>
|
||||
"Usage:
|
||||
lsve [-t type] [-m manager] [-o object]
|
||||
-t: dc - 'Data Center', cl - 'Cluster', sd - 'Storage Domain', nw - 'Network', tpl -'Template'
|
||||
-m: FQDN (Fully Qualified Domain Name) of the rhev manager
|
||||
-o: Target object to display",
|
||||
"cfgve" =>
|
||||
"Usage:
|
||||
cfgve -t dc -m manager -o object [-c -k nfs|localfs | -r]
|
||||
cfgve -t cl -m manager -o object [-c -p cpu type | -r -f]
|
||||
cfgve -t sd -m manager -o object [-c | -g | -s | -a | -b | -r -f]
|
||||
-t: sd - 'Storage Domain', nw - 'Network', tpl -'Template'
|
||||
-m: FQDN (Fully Qualified Domain Name) of the rhev manager
|
||||
-o: Target object to configure
|
||||
cfgve -t nw -m manager -o object [-c -d data center -n vlan ID | -a -l cluster| -b | -r]
|
||||
cfgve -t tpl -m manager -o object [-r]",
|
||||
"chhypervisor" =>
|
||||
"Usage:
|
||||
chhypervisor noderange [-a | -n | -p | -e | -d | -h]",
|
||||
"rmhypervisor" =>
|
||||
"Usage:
|
||||
rmhypervisor noderange [-f | -h]",
|
||||
"clonevm" =>
|
||||
"Usage:
|
||||
clonevm noderange [-t createmaster -f | -b basemaster -d | -h]",
|
||||
);
|
||||
my $vers = xCAT::Utils->Version();
|
||||
my %version = (
|
||||
@@ -435,12 +369,7 @@ my %version = (
|
||||
"lsflexnode" => "$vers",
|
||||
"mkflexnode" => "$vers",
|
||||
"rmflexnode" => "$vers",
|
||||
"nodeset" => "$vers",
|
||||
"lsve" => "$vers",
|
||||
"cfgve" => "$vers",
|
||||
"chhypervisor" => "$vers",
|
||||
"rmhypervisor" => "$vers",
|
||||
"clonevm" => "$vers",
|
||||
"nodeset" => "$vers"
|
||||
);
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
+3818
-318
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,7 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes
|
||||
if ($vpdtab) {
|
||||
$cfghash->{vpd} = $vpdtab->getNodesAttribs($noderange,['uuid']);
|
||||
}
|
||||
$cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','vidmodel','vidproto','vidpassword','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags','datacenter','guestostype','othersettings','master']);
|
||||
$cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','vidmodel','vidproto','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags','datacenter','guestostype','othersettings','master']);
|
||||
my $mactab = xCAT::Table->new("mac",-create=>1);
|
||||
my $nrtab= xCAT::Table->new("noderes",-create=>1);
|
||||
$cfghash->{mac} = $mactab->getAllNodeAttribs(['mac'],1);
|
||||
@@ -204,7 +204,7 @@ sub getMacAddresses {
|
||||
if (not $macdata) {
|
||||
$macdata = $macaddr;
|
||||
} else {
|
||||
$macdata .= "|".$macaddr."!*NOIP*";
|
||||
$macdata .= "|".$macaddr."*NOIP*";
|
||||
}
|
||||
push @macs,$macaddr;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,10 @@ BEGIN
|
||||
# if AIX - make sure we include perl 5.8.2 in INC path.
|
||||
# Needed to find perl dependencies shipped in deps tarball.
|
||||
if ($^O =~ /^aix/i) {
|
||||
unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2));
|
||||
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/5.8.2";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi";
|
||||
use lib "/usr/opt/perl5/lib/site_perl/5.8.2";
|
||||
}
|
||||
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
@@ -38,7 +41,7 @@ use strict;
|
||||
sub Version
|
||||
{
|
||||
|
||||
#The following tags tells the build script where to append build info
|
||||
#The following tag tells the build script where to append build info
|
||||
my $version = shift;
|
||||
if ($version eq 'short')
|
||||
{
|
||||
|
||||
+2
-22
@@ -18,24 +18,9 @@ sub localize_yumrepo {
|
||||
$installpfx = "$installroot/$distname/$arch";
|
||||
mkpath("$installroot/postscripts/repos/$distname/$arch/");
|
||||
open($yumrepofile,">","$installroot/postscripts/repos/$distname/$arch/local-repository.tmpl");
|
||||
my %options=(
|
||||
wanted => \&check_tofix,
|
||||
follow_fast => 1
|
||||
);
|
||||
find(\%options,$installpfx);
|
||||
close($yumrepofile);
|
||||
find(\&check_tofix,$installpfx);
|
||||
close($yumrepofile);
|
||||
}
|
||||
|
||||
|
||||
sub remove_yumrepo {
|
||||
my $self = shift;
|
||||
my $installroot = shift;
|
||||
$distname = shift;
|
||||
$arch = shift;
|
||||
|
||||
rmtree("$installroot/postscripts/repos/$distname/$arch/");
|
||||
}
|
||||
|
||||
sub check_tofix {
|
||||
if (-d $File::Find::name and $File::Find::name =~ /\/repodata$/) {
|
||||
if($distname =~ /rhels5/)
|
||||
@@ -44,12 +29,7 @@ sub check_tofix {
|
||||
}
|
||||
generate_repo($File::Find::name);
|
||||
}
|
||||
elsif($File::Find::name =~ /\/RPM-GPG-KEY/){
|
||||
qx(rpm --import $File::Find::name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub generate_repo
|
||||
{
|
||||
#write local-repository.tmpl
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
# You can get copycds to recognize new distro DVDs/ISOs (so that you do not have to specify -n and -a)
|
||||
# by adding the disc ids to the %distnames hash below. Follow the syntax carefully.
|
||||
# Reload xcatd to have it take affect (service xcatd reload).
|
||||
|
||||
package xCAT::data::discinfo;
|
||||
|
||||
require Exporter;
|
||||
@ISA=qw(Exporter);
|
||||
@EXPORT=qw();
|
||||
@EXPORT_OK=qw(distnames numdiscs);
|
||||
|
||||
|
||||
%distnames = (
|
||||
"1310229985.226287" => "centos6",
|
||||
"1323560292.885204" => "centos6.2",
|
||||
"1341569670.539525" => "centos6.3",#x86
|
||||
"1176234647.982657" => "centos5",
|
||||
"1156364963.862322" => "centos4.4",
|
||||
"1178480581.024704" => "centos4.5",
|
||||
"1195929648.203590" => "centos5.1",
|
||||
"1195929637.060433" => "centos5.1",
|
||||
"1213888991.267240" => "centos5.2",
|
||||
"1214240246.285059" => "centos5.2",
|
||||
"1237641529.260981" => "centos5.3",
|
||||
"1272326751.405938" => "centos5.5",
|
||||
"1330913492.861127" => "centos5.8",#x86_64
|
||||
"1195488871.805863" => "centos4.6",
|
||||
"1195487524.127458" => "centos4.6",
|
||||
"1301444731.448392" => "centos5.6",
|
||||
"1170973598.629055" => "rhelc5",
|
||||
"1170978545.752040" => "rhels5",
|
||||
"1192660014.052098" => "rhels5.1",
|
||||
"1192663619.181374" => "rhels5.1",
|
||||
"1209608466.515430" => "rhels5.2",
|
||||
"1209603563.756628" => "rhels5.2",
|
||||
"1209597827.293308" => "rhels5.2",
|
||||
"1231287803.932941" => "rhels5.3",
|
||||
"1231285121.960246" => "rhels5.3",
|
||||
"1250668122.507797" => "rhels5.4", #x86-64
|
||||
"1250663123.136977" => "rhels5.4", #x86
|
||||
"1250666120.105861" => "rhels5.4", #ppc
|
||||
"1269262918.904535" => "rhels5.5", #ppc
|
||||
"1269260915.992102" => "rhels5.5", #i386
|
||||
"1269263646.691048" => "rhels5.5", #x86_64
|
||||
"1328205744.315196" => "rhels5.8", #x86_64
|
||||
"1285193176.460470" => "rhels6", #x86_64
|
||||
"1285192093.430930" => "rhels6", #ppc64
|
||||
"1305068199.328169" => "rhels6.1", #x86_64
|
||||
"1305067911.467189" => "rhels6.1", #ppc64
|
||||
"1321546114.510099" => "rhels6.2", #x86_64
|
||||
"1321546739.676170" => "rhels6.2", #ppc64
|
||||
"1339641244.734735" => "rhels6.3", #ppc64
|
||||
"1339640147.274118" => "rhels6.3", #x86_64
|
||||
"1339638991.532890" => "rhels6.3", #i386
|
||||
"1285193176.593806" => "rhelhpc6", #x86_64
|
||||
"1305067719.718814" => "rhelhpc6.1",#x86_64
|
||||
"1321545261.599847" => "rhelhpc6.2",#x86_64
|
||||
"1339640148.070971" => "rhelhpc6.3",#x86_64
|
||||
"1194015916.783841" => "fedora8",
|
||||
"1194015385.299901" => "fedora8",
|
||||
"1210112435.291709" => "fedora9",
|
||||
"1210111941.792844" => "fedora9",
|
||||
"1227147467.285093" => "fedora10",
|
||||
"1227142402.812888" => "fedora10",
|
||||
"1243981097.897160" => "fedora11", #x86_64 DVD ISO
|
||||
"1257725234.740991" => "fedora12", #x86_64 DVD ISO
|
||||
"1273712675.937554" => "fedora13", #x86_64 DVD ISO
|
||||
"1287685820.403779" => "fedora14", #x86_64 DVD ISO
|
||||
"1305315870.828212" => "fedora15", #x86_64 DVD ISO
|
||||
|
||||
"1194512200.047708" => "rhas4.6",
|
||||
"1194512327.501046" => "rhas4.6",
|
||||
"1241464993.830723" => "rhas4.8", #x86-64
|
||||
|
||||
"1273608367.051780" => "SL5.5", #x86_64 DVD ISO
|
||||
"1299104542.844706" => "SL6", #x86_64 DVD ISO
|
||||
);
|
||||
my %numdiscs = (
|
||||
"1156364963.862322" => 4,
|
||||
"1178480581.024704" => 3
|
||||
);
|
||||
|
||||
|
||||
1;
|
||||
@@ -33,16 +33,12 @@ package xCAT::data::ipmisensorevents;
|
||||
"07h,07h"=>"Processor,Processor Presence Detected",
|
||||
"07h,08h"=>"Processor,Processor Disabled",
|
||||
"07h,09h"=>"Processor,Terminator Presence Detected",
|
||||
"07h,0Ah"=>"Processor Automatically Throttled (thermal or power throttling)",
|
||||
"07h,0Bh"=>"Uncorrectable Machine check exception",
|
||||
"07h,0Ch"=>"Correctable Machine check exception",
|
||||
"08h,00h"=>"Power Supply,Presence Detected",
|
||||
"08h,01h"=>"Power Supply,Power Supply Failure Detected",
|
||||
"08h,02h"=>"Power Supply,Predictive Failure Asserted",
|
||||
"08h,03h"=>"Power Supply,Power Supply AC lost",
|
||||
"08h,04h"=>"Power Supply,AC lost or out-of-range",
|
||||
"08h,05h"=>"Power Supply,AC out-of-range, but present",
|
||||
"08h,06h"=>"Power Supply,Configuration error", #TODO: event data 3 decode?
|
||||
"09h,00h"=>"Power Unit,Power Off / Power Down",
|
||||
"09h,01h"=>"Power Unit,Power Cycle",
|
||||
"09h,02h"=>"Power Unit,240VA Power Down",
|
||||
@@ -63,7 +59,6 @@ package xCAT::data::ipmisensorevents;
|
||||
"0Ch,07h"=>"Memory,Configuration Error",
|
||||
"0Ch,08h"=>"Memory,Spare",
|
||||
"0Ch,09h"=>"Memory,Throttled",
|
||||
"0Ch,0Ah"=>"Memory,Critical Overtemperature",
|
||||
"0Dh,-"=>"Drive Slot,-",
|
||||
"0Dh,00h"=>"Drive Bay,Present",
|
||||
"0Dh,01h"=>"Drive Bay,Fault",
|
||||
@@ -76,15 +71,14 @@ package xCAT::data::ipmisensorevents;
|
||||
"0Dh,08h"=>"Drive Bay,Rebuild aborted",
|
||||
"0Eh,-"=>"POST Memory Resize,-",
|
||||
"0Fh,00h"=>"System Firmware Progress,POST Error",
|
||||
"0Fh,01h"=>"System Firmware Progress,System Firmware Hung", #TODO event data 2
|
||||
"0Fh,02h"=>"System Firmware Progress,System Firmware Progress", #TODO event data 2
|
||||
"0Fh,01h"=>"System Firmware Progress,System Firmware Hung",
|
||||
"0Fh,02h"=>"System Firmware Progress,System Firmware Progress",
|
||||
"10h,00h"=>"Event Logging Disabled,Correctable Memory Error Logging Disabled",
|
||||
"10h,01h"=>"Event Logging Disabled,Event 'Type' Logging Disabled",
|
||||
"10h,02h"=>"Event Logging Disabled,Log Area Reset/Cleared",
|
||||
"10h,03h"=>"Event Logging Disabled,All Event Logging Disabled",
|
||||
"10h,04h"=>"Event Logging Disabled,SEL Full",
|
||||
"10h,05h"=>"Event Logging Status,SEL Almost Full",
|
||||
"10h,06h"=>"Event Logging Status,Correctable Machine Check Error Logging Disabled",
|
||||
"10h,05h"=>"Event Logging Status,SEL",
|
||||
"11h,00h"=>"Watchdog 1,BIOS Watchdog Reset",
|
||||
"11h,01h"=>"Watchdog 1,OS Watchdog Reset",
|
||||
"11h,02h"=>"Watchdog 1,OS Watchdog Shut Down",
|
||||
@@ -109,19 +103,14 @@ package xCAT::data::ipmisensorevents;
|
||||
"13h,07h"=>"Critical Interrupt,Bus Correctable Error",
|
||||
"13h,08h"=>"Critical Interrupt,Bus Uncorrectable Error",
|
||||
"13h,09h"=>"Critical Interrupt,Fatal NMI (port 61h, bit 7)",
|
||||
"13h,0Ah"=>"Critical Interrupt,Bus Fatal Error",
|
||||
"13h,0Bh"=>"Critical Interrupt,Bus Degraded",
|
||||
"14h,00h"=>"Button,Power Button pressed",
|
||||
"14h,01h"=>"Button,Sleep Button pressed",
|
||||
"14h,02h"=>"Button,Reset Button pressed",
|
||||
"14h,03h"=>"Button,FRU latch open",
|
||||
"14h,04h"=>"Button,FRU service request button",
|
||||
"15h,-"=>"Module / Board,-",
|
||||
"16h,-"=>"Microcontroller / Coprocessor,-",
|
||||
"17h,-"=>"Add-in Card,-",
|
||||
"18h,-"=>"Chassis,-",
|
||||
"19h,00h"=>"Chip Set,Soft Power Control Failure",
|
||||
"19h,01h"=>"Chip Set,Thermal Trip",
|
||||
"19h,-"=>"Chip Set,-",
|
||||
"1Ah,-"=>"Other FRU,-",
|
||||
"1Bh,-"=>"Cable / Interconnect,-",
|
||||
"1Bh,00h"=>"Cable/Interconnect,Connected",
|
||||
@@ -162,7 +151,6 @@ package xCAT::data::ipmisensorevents;
|
||||
"21h,06h"=>"Slot / Connector,Slot / Connector Device Removal Request",
|
||||
"21h,07h"=>"Slot / Connector,Interlock asserted",
|
||||
"21h,08h"=>"Slot / Connector,Slot is Disabled",
|
||||
"21h,09h"=>"Slot / Connector,Slot holds spare device",
|
||||
"22h,00h"=>"System ACPI Power State,S0 / G0 working",
|
||||
"22h,01h"=>"System ACPI Power State,S1 sleeping with system h/w & processor context maintained",
|
||||
"22h,02h"=>"System ACPI Power State,S2 sleeping, processor context lost",
|
||||
@@ -207,8 +195,6 @@ package xCAT::data::ipmisensorevents;
|
||||
"29h,02h"=>"Battery,battery presense detected",
|
||||
"2Ah,00h"=>"Session Audit,Session Activated",
|
||||
"2Ah,01h"=>"Session Audit,Session Deactivated",
|
||||
"2Ah,02h"=>"Session Audit,Invalid Username or Password",
|
||||
"2Ah,03h"=>"Session Audit,Account disabled",
|
||||
"2Bh,00h"=>"Version Change,Hardware Change Occurred",
|
||||
"2Bh,01h"=>"Version Change,Firmware/Software Change occurred",
|
||||
"2Bh,02h"=>"Version Change,Hardware Incompatiblitiy",
|
||||
|
||||
@@ -14,7 +14,7 @@ package xCAT::hpoa;
|
||||
|
||||
use strict;
|
||||
|
||||
#use SOAP::Lite; # hpblade.pm requires SOAP::Lite before requiring hpoa.pm, so we can check for SOAP::Lite dynamically
|
||||
use SOAP::Lite;
|
||||
use vars qw(@ISA);
|
||||
@ISA = qw(SOAP::Lite);
|
||||
|
||||
|
||||
+333
-559
File diff suppressed because it is too large
Load Diff
+632
-1676
File diff suppressed because it is too large
Load Diff
@@ -1,91 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <netdb.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <netinet/in.h>
|
||||
int main() {
|
||||
int serverfd,port;
|
||||
int getpktinfo = 1;
|
||||
struct addrinfo hint, *res;
|
||||
char cmsg[CMSG_SPACE(sizeof(struct in_pktinfo))];
|
||||
char clientpacket[1024];
|
||||
struct sockaddr_in clientaddr;
|
||||
struct msghdr msg;
|
||||
struct cmsghdr *cmsgptr;
|
||||
struct iovec iov[1];
|
||||
unsigned int myip;
|
||||
char *txtptr;
|
||||
iov[0].iov_base = clientpacket;
|
||||
iov[0].iov_len = 1024;
|
||||
memset(&msg,0,sizeof(msg));
|
||||
memset(&clientaddr,0,sizeof(clientaddr));
|
||||
msg.msg_name=&clientaddr;
|
||||
msg.msg_namelen = sizeof(clientaddr);
|
||||
msg.msg_iov = iov;
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_control=&cmsg;
|
||||
msg.msg_controllen = sizeof(cmsg);
|
||||
|
||||
|
||||
char bootpmagic[4] = {0x63,0x82,0x53,0x63};
|
||||
int pktsize;
|
||||
int doexit=0;
|
||||
port = 4011;
|
||||
memset(&hint,0,sizeof(hint));
|
||||
hint.ai_family = PF_INET; /* Would've done UNSPEC, but it doesn't work right and this is heavily v4 specific anyway */
|
||||
hint.ai_socktype = SOCK_DGRAM;
|
||||
hint.ai_flags = AI_PASSIVE;
|
||||
getaddrinfo(NULL,"4011",&hint,&res);
|
||||
serverfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||
if (!serverfd) { fprintf(stderr,"That's odd...\n"); }
|
||||
setsockopt(serverfd,IPPROTO_IP,IP_PKTINFO,&getpktinfo,sizeof(getpktinfo));
|
||||
if (bind(serverfd,res->ai_addr ,res->ai_addrlen) < 0) {
|
||||
fprintf(stderr,"Unable to bind 4011");
|
||||
exit(1);
|
||||
}
|
||||
while (!doexit) {
|
||||
pktsize = recvmsg(serverfd,&msg,0);
|
||||
if (pktsize < 320) {
|
||||
continue;
|
||||
}
|
||||
if (clientpacket[0] != 1 || memcmp(clientpacket+0xec,bootpmagic,4)) {
|
||||
continue;
|
||||
}
|
||||
for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; cmsgptr = CMSG_NXTHDR(&msg,cmsgptr)) {
|
||||
if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_PKTINFO) {
|
||||
myip = ((struct in_pktinfo*)(CMSG_DATA(cmsgptr)))->ipi_addr.s_addr;
|
||||
}
|
||||
}
|
||||
clientpacket[0] = 2; //change to a reply
|
||||
myip = htonl(myip); //endian neutral change
|
||||
clientpacket[0x14] = (myip>>24)&0xff; //maybe don't need to do this, maybe assigning the whole int would be better
|
||||
clientpacket[0x15] = (myip>>16)&0xff;
|
||||
clientpacket[0x16] = (myip>>8)&0xff;
|
||||
clientpacket[0x17] = (myip)&0xff;
|
||||
txtptr = clientpacket+0x6c;
|
||||
strncpy(txtptr,"Boot/bootmgfw.efi",128); // keeping 128 in there just in case someone changes the string
|
||||
clientpacket[0xf0]=0x35; //DHCP MSG type
|
||||
clientpacket[0xf1]=0x1; // LEN of 1
|
||||
clientpacket[0xf2]=0x5; //DHCP ACK
|
||||
clientpacket[0xf3]=0x36; //DHCP server identifier
|
||||
clientpacket[0xf4]=0x4; //DHCP server identifier length
|
||||
clientpacket[0xf5] = (myip>>24)&0xff; //maybe don't need to do this, maybe assigning the whole int would be better
|
||||
clientpacket[0xf6] = (myip>>16)&0xff;
|
||||
clientpacket[0xf7] = (myip>>8)&0xff;
|
||||
clientpacket[0xf8] = (myip)&0xff;
|
||||
clientpacket[0xf9] = 0xfc; // dhcp 252 'proxy', but coopeted by bootmgfw, it's actually suggesting the boot config file
|
||||
clientpacket[0xfa] = 9; //length of 9
|
||||
txtptr = clientpacket+0xfb;
|
||||
strncpy(txtptr,"Boot/BCD",8);
|
||||
clientpacket[0x103]=0;
|
||||
clientpacket[0x104]=0xff;
|
||||
sendto(serverfd,clientpacket,pktsize,0,(struct sockaddr*)&clientaddr,sizeof(clientaddr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
xcat-ibmhpc (2.8.0-1) stable; urgency=low
|
||||
|
||||
* Initial Release
|
||||
|
||||
-- OCF xCAT <xcat@ocf.co.uk> Tue, 03 Apr 2012 09:00:00 -0000
|
||||
@@ -1 +0,0 @@
|
||||
5
|
||||
@@ -1,15 +0,0 @@
|
||||
Source: xcat-ibmhpc
|
||||
Section: admin
|
||||
Priority: extra
|
||||
Maintainer: Arif Ali <aali@ocf.co.uk>
|
||||
Build-Depends: debhelper (>= 5)
|
||||
Standards-Version: 3.7.2
|
||||
|
||||
Package: xcat-ibmhpc
|
||||
Architecture: all
|
||||
Depends: ${perl:Depends}, perl-xcat (>= 2.8.0), xcat-client (>= 2.8.0)
|
||||
Description: Install and configuration utilities for IBM HPC products in an xCAT cluster
|
||||
xCAT-IBMhpc provides sample installation and configuration scripts for running
|
||||
the IBM HPC software stack in an xCAT cluser. Support for the following IBM
|
||||
products is provided: GPFS, LoadLeveler, Parallel Environment, ESSL and Parallel
|
||||
ESSL libraries, some compilers (vac, xlC, xlf).
|
||||
@@ -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,8 +0,0 @@
|
||||
opt/xcat/share/xcat/IBMhpc/compilers
|
||||
opt/xcat/share/xcat/IBMhpc/essl
|
||||
opt/xcat/share/xcat/IBMhpc/gpfs
|
||||
opt/xcat/share/xcat/IBMhpc/loadl
|
||||
opt/xcat/share/xcat/IBMhpc/pe
|
||||
opt/xcat/share/xcat/IBMhpc/rsct
|
||||
opt/xcat/share/xcat/IBMhpc/compilers
|
||||
opt/xcat/share/doc/packages/xCAT-IBMhpc
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user