67 Commits

Author SHA1 Message Date
qyin
96d759dc2f fix the nodeset - noupdate initrd issue 2014-05-21 14:52:10 +08:00
ligc
2023ae7907 fix for bug 4002, configib replaces /etc/sysctl.conf 2014-04-08 11:22:15 -05:00
ligc
bf27b031ee xCAT-genesis-base.spec: do not modify /, it does not work on RHEL 7 2014-04-03 23:30:44 -04:00
ligc
24b2fdd2e5 fix xCAT-genesis-builder/buildrpm for latest mcp version 2014-03-25 14:57:10 -05:00
ligc
df943e4dd8 add compute.rhelhpc6.pkglist for diskful install and diskless netboot 2014-02-11 13:34:03 -06:00
daniceexi
2b8f1e3f1c Change the man pages of nodeset,genimage and geninitrd commands for adding --ignorekernelchk option 2013-11-19 07:10:12 -05:00
immarvin
0989d32770 fix defect #3900 [pcm] Provision RHEL 6.4 node failed after associate os distro update to osimage 2013-11-18 23:04:26 -08:00
daniceexi
9574253194 Code drop for new requirement: Add a new flag --ignorekernelchk for nodeset, geninitrd and genimage commands to skip the kernel version checking when injecting drivers from osimage.driverupdatesrc 2013-11-19 05:48:40 -05:00
lissav
b91d11daef Defect 3906 2013-11-18 06:49:06 -05:00
Bruce Potter
cb3912b678 automatically save previous bld 2013-11-07 12:14:06 -05:00
Bruce Potter
afc66fb781 fix chgrp problem in build scripts on aix 2013-11-06 10:26:19 -05:00
Bruce Potter
9d1af0696f add check for git pull success to build script 2013-10-31 13:12:21 -04:00
yinle
a8030c4cf2 Bug #3763 "confignics -s" doesn't setup hostname and default gateway on SLES 11.2 node 2013-10-31 04:59:55 -07:00
lissav
d3b37b2f13 3865,3864 2013-10-29 11:11:46 -04:00
lissav
fb61328178 defect 3851, updates for 2.8.2-pcm 2013-10-24 08:59:53 -04:00
wanghuaz
322a84494e fixing bug 3848: add prerequisite component as dependency of kit component meta rpm 2013-10-24 14:50:51 +08:00
Sheng Feng Xing
d1db4cde23 Fix getmacs issue in profilednodes.pm to import Power rack mount node 2013-10-23 11:32:30 +08:00
Jia Zhao
811277473b fix nodeimport rscan error on PPC64 2013-10-22 15:54:50 +08:00
Bruce Potter
93ab2207d3 remove xcat.1.pod, it is generated by xpod2man 2013-10-15 21:10:06 -04:00
Bruce Potter
8092a8fee9 require perl-IO-Stty on x86_64 too, in case managing ppc64 nodes 2013-10-15 20:46:32 -04:00
Qi Li
3469f644b6 Merge branch '2.8.2-pcm' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8.2-pcm 2013-10-14 16:05:19 +08:00
Qi Li
6c68d3c8cc #223868: [7R2][Usability]Hard to get MACs for 7R2 CNs. 2013-10-14 15:58:44 +08:00
yinqing
73dd6d73ec [Drive patch] The initrd and kernel files are rebuilt by nodeset during auto-discovering a node 2013-10-14 15:13:41 +08:00
Bruce Potter
6de247254f filter out signing msg in build script 2013-10-11 17:43:20 -04:00
Bruce Potter
2d3d3606ee set group for files/dirs to root instead of xcat, because the xcat group does not exist on users mn 2013-10-11 17:29:31 -04:00
Jia Zhao
ce8e4176cc fix nodeimport message problem 2013-10-10 15:21:41 +08:00
Bruce Potter
61f8b6a75d fix setversionvars command not found problem during promote 2013-10-09 20:08:56 -04:00
jjhua
75259db4ef fixed bug 3796. At the end of genimage, remove the repositories of zypper. 2013-10-08 16:35:20 -04:00
John Simpson
15ee3704f3 Add support for missing NeXtScale sensors 2013-09-30 17:03:24 -04:00
Sheng Feng Xing
8d621ddc55 Do not import lpar node if FSP network associated with it 2013-09-30 11:47:22 +08:00
ligc
62bf6ca650 add RHEL ComputeNode 6.4 support 2013-09-27 11:48:19 +08:00
yinqing
c7caaf635f Merge branch '2.8.2-pcm' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8.2-pcm 2013-09-26 14:41:17 +08:00
daniceexi
b84251a03f Code drop for the enhancement of driver enjection to initrd (port back from 2.8 branch) 1. support both stateful and stateless; 2. support to take drivers from osupdatedistro; 3. support the allupdate and updateonly in netdrivers attribute 2013-09-26 05:47:22 -04:00
yinqing
753183fc7d #222977 driver patch project 2013-09-26 14:38:04 +08:00
lissav
b892b556d3 defect 3799 2013-09-24 10:37:46 -04:00
Sheng Feng Xing
74b1345437 Update nodeimport man page for Power rack-mount node 2013-09-23 15:24:43 +08:00
Lei Ai
011643f364 do not use def command in xCAT plugin 2013-09-23 11:49:50 +08:00
wanghuaz
7778cd8864 Fixing bug 3406, using md5 hash algorithm for centos 5.x during createrepo 2013-09-23 10:59:54 +08:00
wanghuaz
53599a891c Fixing bug 3406, using md5 hash algorithm for centos 5.x during createrepo 2013-09-23 10:50:54 +08:00
wanghuaz
5be4960ffe fixing bug 3473: add minor os version 2013-09-22 15:54:01 +08:00
Sheng Feng Xing
0a1a6180ef Merge #3784 and #3793 patches into 2.8.2-pcm branch 2013-09-22 14:40:43 +08:00
lissav
a196055c61 defect 3785 2013-09-19 07:33:49 -04:00
lissav
026a1365df defect 3785 2013-09-18 13:35:53 -04:00
Jarrod Johnson
df9037d6d1 Implement rflash support for NeXtScale Enclosure manager 2013-09-18 11:03:54 -04:00
Jarrod Johnson
fc074472f1 Provide rpower reseat for NeXTScale 2013-09-18 11:03:25 -04:00
lissav
1f5e0fde43 update database immediately for defect 3785 2013-09-18 06:40:32 -04:00
lissav
f91600c359 fix defect 3785 2013-09-17 11:33:20 -04:00
yinqing
96968d3646 #212726 The image profile kit plugins are not getting called by pcmimageprofile.pm 2013-09-12 13:48:16 +08:00
lissav
70c01a58e1 defect 3766 2013-09-11 14:18:23 -04:00
lissav
04c19abeb6 defect 3778 2013-09-11 07:17:42 -04:00
Bruce Potter
393e222cab specify --checksum for createrepo so the repo will work on rhel5 2013-08-31 11:11:59 -04:00
Bruce Potter
979cca1397 fix bld script change 2013-08-27 12:49:54 -04:00
Bruce Potter
35e2937b5a change git cmd used to get current branch 2013-08-27 11:25:46 -04:00
Bruce Potter
e27c46c31d chg bld to put rpms in subdir for each branch 2013-08-14 15:17:48 -04:00
Bruce Potter
0181ed0f59 update build script in 2.8.2-pcm branch to latest from master 2013-08-13 11:23:00 -04:00
jjhua
dd25c44e0b fixed bug 3732, centos 5.x needs the url rpository 2013-08-08 14:31:33 -04:00
yinqing
58d19e79ec #221180 There is no mechanism to prevent error message printed in kitimagepostdelete when disassociated kit with the image profile 2013-08-07 11:27:16 +08:00
root
f7bc702491 fixed bug 3706. When genimage, it generated the CentOS-Base.repo in the /etc/yum.repos.d, but the internet repositories were not enabled=0. disable it 2013-08-06 16:35:59 -04:00
immarvin
ed76737d32 fix defect 3245 2.8:return value of nodeset does not equal to 0 on ppc64 2013-08-06 00:46:06 -07:00
lissav
2a45c2bb48 Merge branch '2.8.2-pcm' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8.2-pcm 2013-08-05 09:37:09 -04:00
Jia Zhao
3922c7f0a7 fix noderegenips scalability problem 2013-08-05 19:24:52 +08:00
lissav
374145b2b9 Merge branch '2.8.2-pcm' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8.2-pcm 2013-08-05 07:10:11 -04:00
lissav
aa527ff1e4 fix for defect 3717 2013-08-05 07:07:57 -04:00
AsirXing
2663406636 Merge branch '2.8.2-pcm' of ssh://git.code.sf.net/p/xcat/xcat-core into xcat-2.8.2-pcm 2013-08-05 18:25:38 +08:00
yinqing
d5df537479 Fix case #220993 Can not import node by auto discovery switch and switch
port
2013-08-05 18:01:09 +08:00
AsirXing
32d25ec846 support to import CEC-based rack-mount Power nodes by nodeimport command 2013-08-05 17:41:37 +08:00
Lei Ai
b3d39468ef initialize global variables to avoid Cannot re-provision the node which has been removed 2013-08-05 14:45:29 +08:00
45 changed files with 1962 additions and 1212 deletions

View File

@@ -251,12 +251,12 @@ __EOF__
groupadd xcat
fi
chgrp -R xcat xcat-core
chgrp -R root xcat-core
chmod -R g+w xcat-core
#build the tar ball
tar -hjcf $tar_name xcat-core
chgrp xcat $tar_name
chgrp root $tar_name
chmod g+w $tar_name
if [ ! -e core-snap ]; then
@@ -351,13 +351,13 @@ __EOF__
groupadd xcat
fi
chgrp -R xcat xcat-dep
chgrp -R root xcat-dep
chmod -R g+w xcat-dep
#create the tar ball
dep_tar_name=xcat-dep-ubuntu.tar.bz
tar -hjcf $dep_tar_name xcat-dep
chgrp xcat $dep_tar_name
chgrp root $dep_tar_name
chmod g+w $dep_tar_name
if [ -n "$UP" ] && [ "$UP" == 0 ];then

View File

@@ -18,8 +18,8 @@
# - Run this script from the local svn repository you just created. It will create the other
# directories that are needed.
# Usage: buildcore.sh BRANCH=<branch> [attr=value attr=value ...]
# BRANCH=<branch> - the branch within the git repo that should be built. This arg is required for git.
# 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/
@@ -70,10 +70,6 @@ if [ -z "$REL" ]; then
D=${curdir%/src/xcat-core}
REL=`basename $D`
fi
if [ "$REL" = "xcat-core" -a -z "$BRANCH" ]; then # using git but they didnt specify BRANCH
echo "Error: must specify BRANCH=<branch> when building a git repository. Exiting...."
exit 1
fi
OSNAME=$(uname)
if [ "$OSNAME" != "AIX" ]; then
@@ -89,6 +85,21 @@ 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
fi
YUMDIR=$FRS
YUMREPOURL="https://sourceforge.net/projects/xcat/files/yum"
@@ -116,16 +127,28 @@ fi
XCATCORE="xcat-core" # core-snap is a sym link to xcat-core
DESTDIR=../..$EMBEDDIR/$XCATCORE
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
fi
SRCD=core-snap-srpms
# currently aix builds ppc rpms, but someday it should build noarch
if [ "$OSNAME" = "AIX" ]; then
NOARCH=ppc
SYSGRP=system
else
NOARCH=noarch
SYSGRP=root
fi
function setversionvars {
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
@@ -155,25 +178,18 @@ else
#echo "source=$source"
fi
# for the git case, set the current branch and also set REL (changing master to devel if necessary)
function setbranch {
git checkout $BRANCH
#REL=`git rev-parse --abbrev-ref HEAD`
REL=$BRANCH
if [ "$REL" = "master" ]; then
REL="devel"
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 [ "$REL" = "xcat-core" ]; then # using git
GIT=1
setbranch
if [ "$GIT" = "1" ]; then # using git
if [ -z "$GITUP" ]; then
GITUP=../coregitup
echo "git pull > $GITUP"
git pull > $GITUP
if [[ $? != 0 ]]; then
# do not continue so we do not build with old files
echo "The 'git pull' command failed. Exiting the build."
exit 3
fi
fi
if ! $GREP 'Already up-to-date' $GITUP; then
SOMETHINGCHANGED=1
@@ -192,12 +208,6 @@ else # using svn
GITUP=$SVNUP
fi
function setversionvars {
VER=`cat Version`
SHORTVER=`cat Version|cut -d. -f 1,2`
SHORTSHORTVER=`cat Version|cut -d. -f 1`
}
setversionvars
# Function for making the noarch rpms
@@ -345,10 +355,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 $SRCDIR/*rpm | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
createrepo $DESTDIR
createrepo $SRCDIR
build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
createrepo --checksum sha $DESTDIR # specifying checksum so the repo will work on rhel5
createrepo --checksum sha $SRCDIR
rm -f $SRCDIR/repodata/repomd.xml.asc
rm -f $DESTDIR/repodata/repomd.xml.asc
gpg -a --detach-sign $DESTDIR/repodata/repomd.xml
@@ -361,20 +371,13 @@ if [ "$OSNAME" != "AIX" ]; then
fi
fi
# make everything have a group of xcat, so anyone can manage them once they get on SF
# set group and permissions correctly on the built rpms
if [ "$OSNAME" = "AIX" ]; then
if ! lsgroup xcat >/dev/null 2>&1; then
mkgroup xcat
fi
chmod +x $DESTDIR/instxcat
else # linux
if ! $GREP xcat /etc/group; then
groupadd xcat
fi
fi
chgrp -R xcat $DESTDIR
chgrp -R $SYSGRP $DESTDIR
chmod -R g+w $DESTDIR
chgrp -R xcat $SRCDIR
chgrp -R $SYSGRP $SRCDIR
chmod -R g+w $SRCDIR
else # end of very long if-not-promote
@@ -427,14 +430,17 @@ else
verboseflag=""
fi
echo "Creating $TARNAME ..."
if [[ -e $TARNAME ]]; then
mkdir -p previous
mv -f $TARNAME previous
fi
if [ "$OSNAME" = "AIX" ]; then
tar $verboseflag -hcf ${TARNAME%.gz} $XCATCORE
rm -f $TARNAME
gzip ${TARNAME%.gz}
else
tar $verboseflag -hjcf $TARNAME $XCATCORE
fi
chgrp xcat $TARNAME
chgrp $SYSGRP $TARNAME
chmod g+w $TARNAME
# Decide whether to upload or not

View File

@@ -97,15 +97,15 @@ if [ "$OSNAME" != "AIX" ]; then
# Sign the rpms that are not already signed. The "standard input reopened" warnings are normal.
echo "Signing RPMs..."
$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'` | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
# 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
createrepo --checksum sha $i # specifying checksum so the repo will work on rhel5
else
createrepo $i >/dev/null
createrepo --checksum sha $i >/dev/null
fi
rm -f $i/repodata/repomd.xml.asc
gpg -a --detach-sign $i/repodata/repomd.xml
@@ -190,18 +190,13 @@ EOF
chmod +x instoss
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.
# Get the permissions and group correct
if [ "$OSNAME" == "AIX" ]; then
if ! lsgroup xcat >/dev/null 2>&1; then
mkgroup xcat
fi
SYSGRP=system
else
if ! $GREP xcat /etc/group; then
groupadd xcat
fi
SYSGRP=root
fi
chgrp -R xcat *
chgrp -R $SYSGRP *
chmod -R g+w *
# Build the tarball

View File

@@ -235,24 +235,13 @@ sub setCFMSynclistFile {
# get the cfmdir and synclists attributes
my $osimage_t = xCAT::Table->new('osimage');
my $records = $osimage_t->getAttribs({imagename=>$img}, 'cfmdir', 'synclists');
if ($records)
if (defined ($records->{'cfmdir'}))
{
if ($records->{'cfmdir'}) {$cfmdir = $records->{'cfmdir'}}
if ($records->{'synclists'}) {$synclists = $records->{'synclists'}}
$cfmdir = $records->{'cfmdir'};
if (defined ($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;
# no cfmdir defined, return directly
return 0;
}
my $found = 0;
@@ -374,7 +363,8 @@ sub updateCFMSynclistFile {
# recursively list the files under cfm directory
my @files = ();
find ( sub { push @files, $File::Find::name if (! -d) }, $cfmdir);
find ( { wanted => sub { push @files, $File::Find::name if -f }, follow => 1 }, $cfmdir);
if (!@files) # not files under cfm directory, skip to next loop
{
next;

View File

@@ -1024,7 +1024,7 @@ sub fork_fanout_dsh
&& (keys(%$targets_active) < $$options{'fanout'}))
{
my $user_target = shift @$targets_waiting;
# now add export NODE=nodename to the pre-command if not a device;
# now add export NODE=nodename to the pre-command, if not a device;
my $exportnode;
if (($$options{'devicetype'})) {
$exportnode="";
@@ -2345,10 +2345,14 @@ sub config_dsh
}
}
else
{
# if not Mellanox, it does not need a config file
if (!($$options{'devicetype'} =~ /Mellanox/i)) {
my $rsp = {};
$rsp->{error}->[0] = "EMsgMISSING_DEV_CFG";
xCAT::MsgUtils->message('E', $rsp, $::CALLBACK);
$rsp->{error}->[0] = "The config file: $devicepath is missing";
xCAT::MsgUtils->message('E', $rsp, $::CALLBACK);
}
}
}
@@ -3233,7 +3237,18 @@ sub bld_resolve_nodes_hash
# find out if we have an MN in the list, local cp and sh will be used
# not remote shell
my $mname = xCAT::Utils->noderangecontainsMn(@target_list);
my @MNnodeinfo = xCAT::NetworkUtils->determinehostname;
my $mname = pop @MNnodeinfo; # hostname
my $cmd="hostname";
my $localhostname = xCAT::Utils->runcmd($cmd,0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{info}->[0] = "Command: $cmd failed. Continuing...";
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
}
foreach my $target (@target_list)
{
@@ -3242,11 +3257,9 @@ sub bld_resolve_nodes_hash
my $localhost;
my $user;
my $context = "XCAT";
# check to see if this node is the Management Node
if ($mname) {
if ($mname eq $target) {
# check to see if this node is the Management Node we are on, can run local commands (sh,cp)
if (($mname eq $target) || ($localhostname eq $target)){
$localhost=$target;
}
}
my %properties = (
'hostname' => $hostname,
@@ -4075,14 +4088,15 @@ sub parse_and_run_dsh
# check if any node in the noderange is the Management Node and exit
# with error, if the Management Node is in the Database and in the
# noderange
my $mname = xCAT::Utils->noderangecontainsMn(@nodelist);
if ($mname) { # MN in the nodelist
my @mname = xCAT::Utils->noderangecontainsMn(@nodelist);
if (@mname) { # MN in the nodelist
my $nodes=join(',', @mname);
my $rsp = {};
$rsp->{error}->[0] =
"You must not run -K option against the Management Node:$mname.";
"You must not run -K option against the Management Node:$nodes.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
return;
}
}
# if devicetype=Mellanox, xdsh does not setup ssh, rspconfig does
if ($switchtype =~ /Mellanox/i) {
my $rsp = {};
@@ -5782,8 +5796,10 @@ sub bld_and_run_append
# that were rsyn'd to at least one node
if ($tmpappendfile eq $ps) {
my $parm="$appendfile:$filetoappend ";
$::xdcpappendparms .= $parm;
# check to see if the parameter is already in the list
if (!($::xdcpappendparms =~ /$parm/)) {
$::xdcpappendparms .= $parm;
}
$processappend=1;
}
@@ -5919,8 +5935,10 @@ sub bld_and_run_merge
# that were rsyn'd to at least one node
if ($tmpmergefile eq $ps) {
my $parm="$mergefile:$filetomerge ";
$::xdcpmergeparms .= $parm;
# check to see if the parameter is already in the list
if (!($::xdcpmergeparms =~ /$parm/)) {
$::xdcpmergeparms .= $parm;
}
$processmerge=1;
}

View File

@@ -550,6 +550,32 @@ sub get_allnode_singleattrib_hash
#-------------------------------------------------------------------------------
=head3 get_db_swtiches
Description : Get all records of switch config from a table, then return a string list.
Arguments : $tabname - the table name.
Returns : Reference of the records hash.
=cut
#-------------------------------------------------------------------------------
sub get_db_switches
{
my $class = shift;
my $table = xCAT::Table->new("switches");
my @attribs = ("switch");
my @entries = $table->getAllAttribs(@attribs);
$table->close();
my %allrecords;
foreach (@entries)
{
if ($_->{'switch'}){
$allrecords{$_->{'switch'}} = 0;
}
}
return \%allrecords;
}
#-------------------------------------------------------------------------------
=head3 get_db_swtichports
Description : Get all records of switch config from a table, then return a string list.
Arguments : $tabname - the table name.
@@ -563,6 +589,7 @@ sub get_db_switchports
my $table = xCAT::Table->new("switch");
my @attribs = ("switch", "port");
my @entries = $table->getAllAttribs(@attribs);
$table->close();
my %allrecords;
foreach (@entries)
{
@@ -573,6 +600,46 @@ sub get_db_switchports
#-------------------------------------------------------------------------------
=head3 get_all_cecs
Description : Get all CEC objects name in system.
Arguments : hashref: if not set, return a array ref.
if set, return a hash ref.
Returns : ref for CECs list.
Example :
my $arrayref = xCAT::ProfiledNodeUtils->get_all_cecs();
my $hashref = xCAT::ProfiledNodeUtils->get_all_cecs(1);
=cut
#-------------------------------------------------------------------------------
sub get_all_cecs
{
my $hashref = shift;
my %cecshash;
my @cecslist;
my $ppctab = xCAT::Table->new('ppc');
my @cecs = $ppctab->getAllAttribsWhere("nodetype = 'cec'", 'node');
foreach (@cecs) {
if($_->{'node'}) {
if ($hashref) {
$cecshash{$_->{'node'}} = 1;
} else {
push @cecslist, $_->{'node'};
}
}
}
$ppctab->close();
# Return the ref accordingly
if ($hashref) {
return \%cecshash;
} else {
return \@cecslist;
}
}
#-------------------------------------------------------------------------------
=head3 is_discover_started
Description : Judge whether profiled nodes discovering is running or not.
Arguments : NA
@@ -731,7 +798,14 @@ sub check_profile_consistent{
my $mgt = undef;
$mgt = $mgtentry->{'mgt'} if ($mgtentry->{'mgt'});
$nodehmtab->close();
#Get hardwareprofile nodetype
my $ppctab = xCAT::Table->new('ppc');
my $ntentry = $ppctab->getNodeAttribs($hardwareprofile, ['nodetype']);
my $nodetype = undef;
$nodetype = $ntentry->{'nodetype'} if ($ntentry->{'nodetype'});
$ppctab->close();
# Check if exists provision network
if (not ($installnic and exists $netprofile_nicshash{$installnic}{"network"})){
return 0, "Provisioning network not defined for network profile."
@@ -750,17 +824,24 @@ sub check_profile_consistent{
return 0, "$nictype networkprofile must use with hardwareprofile.";
}
}
if (not $nictype and $mgt) {
# define hardwareprofile, not define fsp or bmc networkprofile
# For nodetype is lpar node, not need to check the nictype as it is not required for lpar node
if (not $nictype and $mgt and $nodetype ne 'lpar' ) {
# define hardwareprofile, not define fsp or bmc networkprofile, and the node type is not lpar
return 0, "$profile_dict{$mgt} hardwareprofile must use with $profile_dict{$mgt} networkprofile.";
}
if ($profile_dict{$mgt} ne $nictype) {
# Networkprofile's nictype is not consistent with hadrwareprofile's mgt
if ($profile_dict{$mgt} ne $nictype and $nodetype ne 'lpar') {
# Networkprofile's nictype is not consistent with hadrwareprofile's mgt, and the node type is not lpar
return 0, "Networkprofile's nictype is not consistent with hardwareprofile's mgt.";
}
if ($nodetype eq 'lpar' and $nictype eq 'FSP')
{
# can not associate FSP network if the node type is lpar
return 0, "The node with hardware type $nodetype can not use with $nictype networkprofile.";
}
return 1, "";
}

View File

@@ -238,12 +238,13 @@ sub getAllSN
# if did not input "ALL" and there is a MN, remove it
my @newservicenodes;
if ((!defined($options)) || ($options ne "ALL")) {
my $mname = xCAT::Utils->noderangecontainsMn(@servicenodes);
if ($mname) { # if there is a MN
foreach my $nodes (@servicenodes) {
if ($mname ne ($nodes)){
push @newservicenodes, $nodes;
}
my @mname = xCAT::Utils->noderangecontainsMn(@servicenodes);
if (@mname) { # if there is a MN
foreach my $node (@servicenodes) {
# check to see if node in MN list
if (!(grep(/^$node$/, @mname))) { # if node not in the MN array
push @newservicenodes, $node;
}
}
$servicenodetab->close;
return @newservicenodes; # return without the MN in the array

View File

@@ -3125,7 +3125,7 @@ sub isSELINUX
=head3 noderangecontainsMN
Returns:
returns nothing, if ManagementNode is not the input noderange
returns name of MN, if Management Node is in the input noderange
returns array of MN, if Management Node(s) is in the input noderange
Globals:
none
Error:
@@ -3133,7 +3133,7 @@ sub isSELINUX
Input:
array of nodes in the noderange
Example:
my $mn=xCAT::Utils->noderangecontainsMN($noderange);
my @mn=xCAT::Utils->noderangecontainsMN($noderange);
Comments:
=cut
@@ -3142,26 +3142,30 @@ sub noderangecontainsMn
{
my ($class, @noderange)=@_;
# check if any node in the noderange is the Management Node return the
# name
my $mname;
# name
my @mnames; # management node names in the database, members of __mgmtnode
my $tab = xCAT::Table->new('nodelist');
my @nodelist=$tab->getAllNodeAttribs(['node','groups']);
foreach my $n (@nodelist) {
if (defined($n->{'groups'})) {
my @groups=split(",",$n->{'groups'});
if ((grep (/__mgmtnode/,@groups))) { # this is the MN
$mname=$n->{'node'};
last;
push @mnames,$n->{'node'};
}
}
}
if ($mname) { # if Management Node defined in the database
if (grep(/$mname/, @noderange)) { # if MN in the noderange
return $mname;
} else {
return ;
my @MNs; # management node names found the noderange
if (@mnames) { # if any Management Node defined in the database
foreach my $mn (@mnames) {
if (grep(/^$mn$/, @noderange)) { # if MN in the noderange
push @MNs, $mn;
}
}
if (@MNs) { # management nodes in the noderange
return @MNs;
}
}
return; # if no MN in the noderange, return nothing
}
=head3 filter_nodes

1
perl-xCAT/xCAT/data/discinfo.pm Normal file → Executable file
View File

@@ -64,6 +64,7 @@ require Exporter;
"1305067719.718814" => "rhelhpc6.1",#x86_64
"1321545261.599847" => "rhelhpc6.2",#x86_64
"1339640148.070971" => "rhelhpc6.3",#x86_64
"1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode
"1194015916.783841" => "fedora8",
"1194015385.299901" => "fedora8",
"1210112435.291709" => "fedora9",

View File

@@ -808,7 +808,7 @@ sub kit_buildrepo1
# run createrepo
my $cr_opts = '';
if (( $repo->{osbasename} =~ m/rh|RH/ ) &&
if (( $repo->{osbasename} =~ m/rh|RH|centos|CentOS/ ) &&
( $repo->{osmajorversion} eq '5') ) {
$cr_opts = '-s md5';
}
@@ -1920,6 +1920,8 @@ sub build_kitcomp
# specifically reference it's version-release
if ( &update_kitcomp_kitpkgdeps($comp,$repodir) ) { return 1; }
$::VALID_PRER_COMPONENT = 0;
if ( !$::PREREQUISITE ) {
if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) {
if ( &gen_kitcomp_spec($comp,\%repo, 'PREREQUISITE') ) { return 1; }
@@ -1959,6 +1961,8 @@ sub build_kitcomp
}
}
$::VALID_PRER_COMPONENT = 1;
}
if ( &gen_kitcomp_spec($comp,\%repo, 'METARPM') ) { return 1; }
@@ -2246,7 +2250,12 @@ sub gen_kitcomp_spec
s/<<<INSERT_url_HERE>>>/$::bldkit_config->{kit}{entries}[0]->{url}/;
s/<<<INSERT_kitcomponent_ospkgdeps_HERE>>>//;
s/<<<INSERT_kitcomponent_kitpkgdeps_HERE>>>/$comp->{kitpkgdeps}/;
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps}/;
#Update kitcompdeps for prep_<kitcomponent>
if ( $::VALID_PRER_COMPONENT ) {
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps},prep_$comp->{basename}/;
} else {
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps}/;
}
s/<<<INSERT_kitcomponent_desc_HERE>>>/$comp->{description}/;
s/<<<INSERT_kitcomponent_non_native_pkgs_HERE>>>/$nonnativepkgs/;
s/<<<INSERT_kitcomponent_sourcetar_HERE>>>/$sourcetar/;
@@ -3557,7 +3566,7 @@ sub NEW_kit_addpkgs
my $repodir = "$::base_repodir/$kr->{kitreponame}";
if ( -d $repodir ) {
my $cr_opts = '';
if (( $kr->{osbasename} =~ m/rh|RH/ ) &&
if (( $kr->{osbasename} =~ m/rh|RH|centos|CentOS/ ) &&
( $kr->{osmajorversion} eq '5') ) {
$cr_opts = '-s md5';
}

View File

@@ -378,6 +378,12 @@ sub osver
$ver = $lines[0];
$ver =~ s/\.//;
$ver =~ s/[^0-9]*([0-9]+).*/$1/;
my $minorver;
if (grep /PATCHLEVEL/, $lines[2]) {
$minorver = $lines[2];
$minorver =~ s/PATCHLEVEL[^0-9]*([0-9]+).*/$1/;
}
$ver = $ver . ".$minorver" if ( $minorver );
}
elsif (-f "/etc/UnitedLinux-release")
{

View File

@@ -164,15 +164,20 @@ sub process_request {
# image profile is using the kit which this plugin belongs to.
if ($PLUGIN_KITNAME eq "TESTMODE") {
# Don't do the check in test mode
# Don't do the check in test mode
} elsif ($command eq 'kitimagepregenerate' || $command eq 'kitimageprecopy') {
# Also, don't do the check if the image profile doesn't yet exist
} else {
# Do the check
my $imageprofile = parse_str_arg($request->{arg}->[0]);
my $kitdata = $request->{kitdata};
if (! defined($kitdata)) {
my $kitdata = undef;
if(exists($request->{kitdata}))
{
$kitdata = $request->{kitdata};
}
if (! defined($kitdata) && ! ($command eq 'kitimagepostdelete')) {
$kitdata = xCAT::KitPluginUtils->get_kits_used_by_image_profiles([$imageprofile]);
$request->{kitdata} = $kitdata;
}
@@ -187,7 +192,7 @@ sub process_request {
# Run the command
if($command eq 'kitimagepregenerate') {
kitimagepregenerate($callback, $args);
}
@@ -742,4 +747,4 @@ sub parse_list_arg {
}
1;
1;

View File

@@ -42,6 +42,7 @@ my $mode;
my $interactive;
my $onlyinitrd;
my $dryrun;
my $ignorekernelchk;
#-----------------------------------------------------------------------------
=head3 print_usage - usage message
@@ -55,7 +56,7 @@ sub print_usage
print " genimage\n\n";
print " genimage --dryrun\n\n";
print ' genimage -o <osver> [-a <arch>] -p <profile> -i <nodebootif> -n <nodenetdrivers> [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] [--dryrun]'."\n\n";
print ' genimage [-o <osver>] [-a <arch>] [-p <profile>] [-i <nodebootif>] [-n <nodenetdrivers>] [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] [--dryrun] <imagename>'."\n\n";
print ' genimage [-o <osver>] [-a <arch>] [-p <profile>] [-i <nodebootif>] [-n <nodenetdrivers>] [--onlyinitrd] [-r <otherifaces>] [-k <kernelver>] [-g <krpmver>] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission <permission>] [--interactive] [--dryrun] [--ignorekernelchk] <imagename>'."\n\n";
print " --permission is used for statelite only\n";
print " -g is used for SLES only\n\n";
print " -m is used for urbuntu, debian and fedora12 only\n\n";
@@ -88,6 +89,7 @@ if (!GetOptions(
'interactive' => \$interactive,
'onlyinitrd' => \$onlyinitrd,
'dryrun' => \$dryrun,
'ignorekernelchk' => \$ignorekernelchk,
'h|help' => \$help,
'v|version' => \$version,
)) {
@@ -404,6 +406,10 @@ if ($dryrun) {
push @arg, "--dryrun";
}
if ($ignorekernelchk) {
push @arg, "--ignorekernelchk";
}
my $cmdref;
push (@{$cmdref->{arg}}, @arg);
$cmdref->{command}->[0] = "genimage";

View File

@@ -573,8 +573,8 @@ sub backupxcatdb
}
}
# back it up
my $cmd = "dumpxCATdb -p $::backupdir";
# back it up in bypass mode ( do not require the xcatd running)
my $cmd = "XCATBYPASS=y dumpxCATdb -p $::backupdir";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{

View File

@@ -8,7 +8,7 @@ B<genimage>
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>]
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] I<imagename>
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] [B<--ignorekernelchk>] I<imagename>
B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
@@ -151,6 +151,9 @@ This flag shows the underlying call to the os specific genimage function. The us
(Deprecated) This flag allows the user to setup the /tmp and the /var/tmp file system sizes. This flag is no longer supported. You can overwrite any file system size using the .postinstall script where you can create a new /etc/fstab file.
=item B<--ignorekernelchk>
Skip the kernel version checking when injecting drivers from osimage.driverupdatesrc. That means all drivers from osimage.driverupdatesrc will be injected to initrd for the specific target kernel.
=item B<-v|--version>

View File

@@ -0,0 +1,107 @@
=head1 NAME
B<genimage> - Generate an initrd (initial ramfs) which to be used for statefull install or stateless netboot.
=head1 SYNOPSIS
B<geninitrd> I<imagename> [B<--ignorekernelchk>]
B<geninitrd> [B<-h> | B<--help>]
=head1 DESCRIPTION
Generate the initrd for the osimage: B<imagename> which is an xCAT object of I<osimage> type.
B<Diskfull Osimage>
=over 2
If the B<imagename> is a statefull one (The provmethod attribute for the osimage is 'install'),
this command is used to rebuild the initrd to inject the new drivers from driver rpms or
'update distro' and copy the rebuilt initrd and new kernel (If there's new kernel in 'update
distro') to the directory I</tftpboot/xcat/<imagename>>.
If the initrd has been rebuilt by geninitrd, when run nodeset, the I<--noupdateinitrd> option
should be used to skip the rebuilding of initrd to improve the performance.
Three attributes of osimage object can be used to specify the Driver RPM location and Driver names
for injecting new drviers to initrd.
B<netdrivers> - comma separated driver names that need to be injected to the initrd.
The postfix '.ko' can be ignored. The netdrivers attribute must be set to specify the new driver list.
If you want to load all the drivers from the driver rpms, using the keyword allupdate.
B<driverupdatesrc> - comma separated driver rpm packages (full path should be specified)
B<osupdatename> - comma separated 'osdistroupdate' object. Each 'osdistroupdate' object specifies a
Linux distro update. When run geninitrd, 'kernel-*.rpm' will be searched from osdistroupdate.dirpath
to get all the rpm packages and then search the drivers from the rpm packages.
Refer to the doc: https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Using_Linux_Driver_Update_Disk
=back
B<Stateless Osimage>
=over 2
If the B<imagename> is a stateless one (The provmethod attribute for the osimage is 'netboot'),
this command is used to generate the initrd from the rootimg which generated by 'genimage' command.
So the 'genimage' must be run once before running the geninitrd command.
Two attributes of osimage object can be used to specify the Driver RPM location and Driver names
for injecting new drviers to initrd.
B<netdrivers> - comma separated driver names that need to be injected to the initrd.
The postfix '.ko' can be ignored. The netdrivers attribute must be set to specify the new driver list.
If you want to load all the drivers from the driver rpms, using the keyword allupdate.
B<driverupdatesrc> - comma separated driver rpm packages (full path should be specified)
=back
=head1 Parameters
I<imagename> specifies the name of an os image definition to be used. The specification for the image is storted in the I<osimage> table and I<linuximage> table.
=over 12
=item B<--ignorekernelchk>
Skip the kernel version checking when injecting drivers from osimage.driverupdatesrc. That means all drivers from osimage.driverupdatesrc will be injected to initrd for the specific target kernel.
=back
=head1 RETURN VALUE
0 The command completed successfully.
1 An error has occurred.
=head1 EXAMPLES
=over 3
=item 1
To generate initrd for the osimage B<myimagename>:
geninitrd myimagename
=back
=head1 FILES
/opt/xcat/bin/geninitrd
/opt/xcat/bin/genimage
/opt/xcat/share/xcat/netboot/<OS>/genimage
=head1 SEE ALSO
L<geninitrd(1)|geninitrd.1>, L<genimage(1)|genimage.1>

View File

@@ -123,6 +123,14 @@ To import nodes using a profile, follow the following steps:
switch=myswitch
switchport=9
Example of a node information file that specifies a CEC-based rack-mounted Power node that uses direct FSP management:
# Node information file begins
# This entry defines a Power rack-mount node.
__hostname__:
mac=b8:ac:6f:37:59:28
cec=mycec
# Node information file ends.
The node information file includes the following items:
B<__hostname__:> This is a mandatory item.
@@ -145,6 +153,10 @@ B<slotid=<slot-id>> This is a mandatory item while define a PureFlex node.
Description: The node position in the PureFlex Chassis.
B<cec=<cec-name>> This is a mandatory option for defining Power rack-mounted nodes.
Description: Specifies the name of a Power rack-mount central electronic complex (CEC).
B<ip=<ip-address>> This is an optional item.
Description: Specify the IP address used for provisioning a node, where <ip-address> is in the form xxx.xxx.xxx.xxx. If this item is not included, the IP address used to provision the node is generated automatically according to the Network Profile used by the node.

View File

@@ -1,657 +0,0 @@
=head1 NAME
B<xcat> - extreme Cluster Administration Tool.
=head1 DESCRIPTION
Extreme Cluster Administration Toolkit (xCAT). xCAT is a scalable distributed computing management
and provisioning tool that provides a unified interface for hardware control, discovery, and
OS diskful/diskfree deployment.
=head1 XCAT DATABASE
All of the cluster configuration information is in the xCAT database. See L<xcatdb(5)|xcatdb.5> for
descriptions of every table in the database.
=head1 XCAT COMMANDS
What follows is a short description of each xCAT command. To get more information about a particular
command, see its man page. Note that the commands are listed in alphabetical order B<within each section>,
i.e. all the commands in section 1, then the commands in section 3, etc.
=over 12
=item L<addkit(1)|addkit.1>
Install a kit on the xCAT management node
=item L<addkitcomp(1)|addkitcomp.1>
Assign kit components to osimage.
=item L<cfgve(1)|cfgve.1>
Configure the elements for a virtual environment.
=item L<cfm2xcat(1)|cfm2xcat.1>
Migrates the CFM setup in CSM to the xdcp rsync setup in xCAT.
=item L<chdef(1)|chdef.1>
Change xCAT data object definitions.
=item L<chhypervisor(1)|chhypervisor.1>
Configure the virtualization hosts.
=item L<chkkitcomp(1)|chkkitcomp.1>
Check if kit component fits to osimage.
=item L<chkosimage(1)|chkosimage.1>
Use this xCAT command to check an xCAT osimage.
=item L<chvm(1)|chvm.1>
Changes HMC-, IVM-, and zVM-managed partition profiles or virtual machines. For Power 775, chvm could be used to change the octant configuration values for generating LPARs; change the I/O slots assignment to LPARs within the same CEC.
=item L<clonevm(1)|clonevm.1>
Create masters from virtual machines and virtual machines from masters.
=item L<csm2xcat(1)|csm2xcat.1>
Allows the migration of a CSM database to an xCAT database.
=item L<db2sqlsetup(1)|db2sqlsetup.1>
Sets up the IBM DB2 for xCAT to use.
=item L<dumpxCATdb(1)|dumpxCATdb.1>
dumps the xCAT db tables .
=item L<genimage(1)|genimage.1>
Generates a stateless image to be used for a diskless install.
=item L<getmacs(1)|getmacs.1>
Collects node MAC address.
=item L<gettab(1)|gettab.1>
select table rows, based on attribute criteria, and display specific attributes.
=item L<getxcatdocs(1)|getxcatdocs.1>
downloads the xCAT documentation and converts to HTML and PDF
=item L<groupfiles4dsh(1)|groupfiles4dsh.1>
Builds a directory of files for each defined nodegroup in xCAT.
=item L<imgcapture(1)|imgcapture.1>
Captures an image from a Linux diskful node and create a diskless image on the management node.
=item L<imgexport(1)|imgexport.1>
Exports an xCAT image.
=item L<imgimport(1)|imgimport.1>
Imports an xCAT image or configuration file into the xCAT tables so that you can immediately begin deploying with it.
=item L<liteimg(1)|liteimg.1>
Modify statelite image by creating a series of links.
=item L<lsdef(1)|lsdef.1>
Use this command to list xCAT data object definitions.
=item L<lsflexnode(1)|lsflexnode.1>
Display the information of flexible node
=item L<lshwconn(1)|lshwconn.1>
Use this command to display the connection status for CEC and Frame nodes.
=item L<lskmodules(1)|lskmodules.1>
list kernel driver modules in rpms or driver disk image files
=item L<lslite(1)|lslite.1>
Display a summary of the statelite information.
=item L<lsslp(1)|lsslp.1>
Discovers selected networked services information within the same subnet.
=item L<lstree(1)|lstree.1>
Display the tree of service node hierarchy, hardware hierarchy, or VM hierarchy.
=item L<lsve(1)|lsve.1>
Lists detail attributes for a virtual environment.
=item L<lsvm(1)|lsvm.1>
Lists partition profile information for HMC-, IVM-, KVM-, Vmware- and zVM-managed nodes. For Power 775, it lists the LPARs' I/O slots information and CEC configuration.
=item L<lsxcatd(1)|lsxcatd.1>
lists xCAT daemon information.
=item L<mkdef(1)|mkdef.1>
Use this command to create xCAT data object definitions.
=item L<mkdsklsnode(1)|mkdsklsnode.1>
Use this xCAT command to define and initialize AIX/NIM diskless machines.
=item L<mkflexnode(1)|mkflexnode.1>
Create a flexible node.
=item L<mkhwconn(1)|mkhwconn.1>
Sets up connections for CEC and Frame nodes to HMC nodes or hardware server.
=item L<mknimimage(1)|mknimimage.1>
Use this xCAT command to create xCAT osimage definitions and related AIX/NIM resources. The command can also be used to update an existing AIX diskless image(SPOT).
=item L<mkvm(1)|mkvm.1>
Creates HMC-, IVM-, and zVM-managed partitions or other virtual machines.
=item L<monadd(1)|monadd.1>
Registers a monitoring plug-in to the xCAT cluster.
=item L<moncfg(1)|moncfg.1>
Configures a 3rd party monitoring software to monitor the xCAT cluster.
=item L<mondecfg(1)|mondecfg.1>
Deconfigures a 3rd party monitoring software from monitoring the xCAT cluster.
=item L<monls(1)|monls.1>
Lists monitoring plug-in modules that can be used to monitor the xCAT cluster.
=item L<monrm(1)|monrm.1>
Unregisters a monitoring plug-in module from the xCAT cluster.
=item L<monshow(1)|monshow.1>
Shows event data for monitoring.
=item L<monstart(1)|monstart.1>
Starts a plug-in module to monitor the xCAT cluster.
=item L<monstop(1)|monstop.1>
Stops a monitoring plug-in module to monitor the xCAT cluster.
=item L<mysqlsetup(1)|mysqlsetup.1>
Sets up the MySQL database for xCAT to use.
=item L<nimnodecust(1)|nimnodecust.1>
Use this xCAT command to customize AIX/NIM standalone machines.
=item L<nimnodeset(1)|nimnodeset.1>
Use this xCAT command to initialize AIX/NIM standalone machines.
=item L<nodeaddunmged(1)|nodeaddunmged.1>
Create a unmanaged node.
=item L<nodech(1)|nodech.1>
Changes nodes' attributes in the xCAT cluster database.
=item L<nodechmac(1)|nodechmac.1>
Updates the MAC address for a node.
=item L<nodechprofile(1)|nodechprofile.1>
updates a profile used by a node
=item L<nodediscoverls(1)|nodediscoverls.1>
List all discovered nodes
=item L<nodediscoverstart(1)|nodediscoverstart.1>
starts the node discovery process
=item L<nodediscoverstatus(1)|nodediscoverstatus.1>
gets the node discovery process status
=item L<nodediscoverstop(1)|nodediscoverstop.1>
stops the node discovery process.
=item L<nodegrpch(1)|nodegrpch.1>
Changes attributes at the group level in the xCAT cluster database.
=item L<nodeimport(1)|nodeimport.1>
Create profiled nodes by importing hostinfo file.
=item L<nodels(1)|nodels.1>
lists the nodes, and their attributes, from the xCAT database.
=item L<nodepurge(1)|nodepurge.1>
Removes nodes.
=item L<noderefresh(1)|noderefresh.1>
Update nodes configurations by running associated kit plugins.
=item L<noderm(1)|noderm.1>
Removes the nodes in the noderange from all database table.
=item L<nodestat(1)|nodestat.1>
display the running status of each node in a noderange
=item L<packimage(1)|packimage.1>
Packs the stateless image from the chroot file system.
=item L<pasu(1)|pasu.1>
run the ASU to many nodes in parallel
=item L<pcons(1)|pcons.1>
Runs a command on the noderange using the out-of-band console.
=item L<pgsqlsetup(1)|pgsqlsetup.1>
Sets up the PostgreSQL database for xCAT to use.
=item L<pping(1)|pping.1>
parallel ping the nodes.
=item L<ppping(1)|ppping.1>
parallel ping from nodes to other nodes in the cluster.
=item L<prsync(1)|prsync.1>
parallel rsync
=item L<pscp(1)|pscp.1>
parallel remote copy
=item L<psh(1)|psh.1>
parallel remote shell
=item L<rbeacon(1)|rbeacon.1>
Turns beacon on/off/blink or gives status of a node or noderange.
=item L<rbootseq(1)|rbootseq.1>
Persistently sets the order of boot devices for BladeCenter blades or PPC LPARs using Direct FSP Management (DFM).
=item L<rcons(1)|rcons.1>
remotely accesses the serial console of a node
=item L<regnotif(1)|regnotif.1>
Registers a Perl module or a command that will get called when changes occur in the desired xCAT database tables.
=item L<renergy(1)|renergy.1>
remote energy management tool
=item L<replaycons(1)|replaycons.1>
replay the console output for a node
=item L<restartxcatd(1)|restartxcatd.1>
Restart the xCAT daemon (xcatd) on AIX.
=item L<restorexCATdb(1)|restorexCATdb.1>
restores the xCAT db tables .
=item L<reventlog(1)|reventlog.1>
retrieve or clear remote hardware event logs
=item L<rflash(1)|rflash.1>
Performs Licensed Internal Code (LIC) update support for HMC-attached POWER5 and POWER6 Systems, and POWER7 systems using Direct FSP management.
=item L<rinv(1)|rinv.1>
Remote hardware inventory
=item L<rmdef(1)|rmdef.1>
Use this command to remove xCAT data object definitions.
=item L<rmdsklsnode(1)|rmdsklsnode.1>
Use this xCAT command to remove AIX/NIM diskless machine definitions.
=item L<rmflexnode(1)|rmflexnode.1>
Delete a flexible node.
=item L<rmhwconn(1)|rmhwconn.1>
Use this command to remove connections from CEC and Frame nodes to HMC nodes.
=item L<rmhypervisor(1)|rmhypervisor.1>
Remove the virtualization hosts.
=item L<rmigrate(1)|rmigrate.1>
Execute migration of a guest VM between hosts/hypervisors
=item L<rmimage(1)|rmimage.1>
Removes the Linux stateless or statelite image from the file system.
=item L<rmkit(1)|rmkit.1>
Remove Kits from xCAT
=item L<rmkitcomp(1)|rmkitcomp.1>
Remove kit components from osimage.
=item L<rmnimimage(1)|rmnimimage.1>
Use this xCAT command to remove NIM resources specified in an xCAT osimage definition.
=item L<rmvm(1)|rmvm.1>
Removes HMC-, IVM-, KVM-, Vmware- and zVM-managed partitions or virtual machines.
=item L<rnetboot(1)|rnetboot.1>
Cause the range of nodes to boot to network.
=item L<rollupdate(1)|rollupdate.1>
performs cluster rolling update
=item L<rpower(1)|rpower.1>
remote power control of nodes
=item L<rscan(1)|rscan.1>
Collects node information from one or more hardware control points.
=item L<rsetboot(1)|rsetboot.1>
Sets the boot device to be used for BMC-based servers for the next boot only.
=item L<rspconfig(1)|rspconfig.1>
Configures nodes' service processors
=item L<rspreset(1)|rspreset.1>
resets the service processors associated with the specified nodes
=item L<rvitals(1)|rvitals.1>
remote hardware vitals
=item L<sinv(1)|sinv.1>
Checks the software configuration of the nodes in the cluster.
=item L<snmove(1)|snmove.1>
Move xCAT compute nodes to a different xCAT service node.
=item L<swapnodes(1)|swapnodes.1>
swap the location info in the db (all the attributes in the ppc table and the nodepos table) between 2 nodes. If swapping within a cec, it will assign the IO adapters that were assigned to the defective node to the available node.
=item L<switchblade(1)|switchblade.1>
reassign the BladeCenter media tray and/or KVM to the specified blade
=item L<tabgrep(1)|tabgrep.1>
list table names in which an entry for the given node appears.
=item L<unregnotif(1)|unregnotif.1>
unregister a Perl module or a command that was watching for the changes of the desired xCAT database tables.
=item L<updateSNimage(1)|updateSNimage.1>
Adds the needed Service Node configuration files to the install image.
=item L<updatenode(1)|updatenode.1>
Update nodes in an xCAT cluster environment.
=item L<wcons(1)|wcons.1>
windowed remote console
=item L<wkill(1)|wkill.1>
kill windowed remote consoles
=item L<wvid(1)|wvid.1>
windowed remote video console for nodes
=item L<xCATWorld(1)|xCATWorld.1>
Sample client program for xCAT.
=item L<xcat(1)|xcat.1>
extreme Cluster Administration Tool.
=item L<xcat2nim(1)|xcat2nim.1>
Use this command to create and manage AIX NIM definitions based on xCAT node, group and network object definitions.
=item L<xcatchroot(1)|xcatchroot.1>
Use this xCAT command to modify an xCAT AIX diskless operating system image.
=item L<xcoll(1)|xcoll.1>
Formats and consolidates the output of the B<psh>, B<rinv> commands.
=item L<xdcp(1)|xdcp.1>
Concurrently copies files to or from multiple nodes. In addition, provides an option to use rsync to update the files on the nodes, or to an installation image on the local node.
=item L<xdsh(1)|xdsh.1>
Concurrently runs remote commands on multiple nodes (Management Node, Service Nodes, compute nodes), or an install image.
=item L<xdshbak(1)|xdshbak.1>
Formats the output of the B<xdsh> command.
=item L<xdshcoll(1)|xdshcoll.1>
Formats and consolidates the output of the B<xdsh,sinv> commands.
=item L<xpbsnodes(1)|xpbsnodes.1>
PBS pbsnodes front-end for a noderange.
=item L<noderange(3)|noderange.3>
syntax for compactly expressing a list of node names
=item L<xcatstanzafile(5)|xcatstanzafile.5>
Format of a stanza file that can be used with xCAT data object definition commands.
=item L<chtab(8)|chtab.8>
Add, delete or update rows in the database tables.
=item L<copycds-cdrom(8)|copycds-cdrom.8>
Client side wrapper for copycds supporting physical drives.
=item L<copycds(8)|copycds.8>
Copies Linux distributions and service levels from DVDs/ISOs to the xCAT /install directory.
=item L<makeconservercf(8)|makeconservercf.8>
creates the conserver configuration file from info in the xCAT database
=item L<makedhcp(8)|makedhcp.8>
Creates and updates DHCP configuration files.
=item L<makedns(8)|makedns.8>
sets up domain name services (DNS).
=item L<makehosts(8)|makehosts.8>
sets up /etc/hosts from the xCAT hosts table.
=item L<makeknownhosts(8)|makeknownhosts.8>
Make a known_hosts file under $ROOTHOME/.ssh for input noderange.
=item L<makenetworks(8)|makenetworks.8>
Gather cluster network information and add it to the xCAT database.
=item L<makeroutes(8)|makeroutes.8>
add or delete routes to/from the os route table on nodes.
=item L<mknb(8)|mknb.8>
creates a network boot root image for node discovery and flashing
=item L<mkrrbc(8)|mkrrbc.8>
Adds or deletes BladeCenter management module and switch node definitions in the xCAT cluster database.
=item L<mkrrnodes(8)|mkrrnodes.8>
Adds or deletes nodes in the xCAT cluster database.
=item L<nodeadd(8)|nodeadd.8>
Adds nodes to the xCAT cluster database.
=item L<nodeset(8)|nodeset.8>
set the boot state for a noderange
=item L<rinstall(8)|rinstall.8>
Begin installation on a noderange
=item L<rmosdistro(8)|rmosdistro.8>
remove OS Distro
=item L<runsqlcmd(8)|runsqlcmd.8>
Runs sql command files against the current xCAT database.
=item L<setupiscsidev(8)|setupiscsidev.8>
creates a LUN for a node to boot up with, using iSCSI
=item L<tabch(8)|tabch.8>
Add, delete or update rows in the database tables.
=item L<tabdump(8)|tabdump.8>
display an xCAT database table in CSV format.
=item L<tabedit(8)|tabedit.8>
view an xCAT database table in an editor and make changes.
=item L<tabprune(8)|tabprune.8>
Deletes records from the eventlog,auditlog,isnm_perf,isnm_perf_sum tables.
=item L<tabrestore(8)|tabrestore.8>
replaces the contents of an xCAT database table with the contents in a csv file.
=item L<winstall(8)|winstall.8>
Begin installation on a noderange and display in wcons
=item L<xcatconfig(8)|xcatconfig.8>
Sets up the Management Node during the xCAT install.
=item L<xcatd(8)|xcatd.8>
The xCAT daemon
=item L<xcatdebug(8)|xcatdebug.8>
Enable or disable the trace facilities for xCAT. (Only supports Linux Operating System)
=item L<xcatsetup(8)|xcatsetup.8>
Prime the xCAT database using naming conventions specified in a config file.
=item L<xcatsnap(8)|xcatsnap.8>
Gathers information for service about the current running xCAT environment.
=item L<xcattest(1)|xcattest.1>
Run automated xCAT test cases.
=item L<buildkit(1)|buildkit.1>
Build product software kits to be installed in an xCAT cluster.
=back

View File

@@ -6,6 +6,8 @@ B<nodeset> - set the boot state for a noderange
B<nodeset> [I<noderange>] [I<boot>|I<install>|I<stat>|I<iscsiboot>|I<netboot>|I<statelite>|I<offline>|I<runcmd=bmcsetup>|I<osimage[=<imagename>>]]
B<nodeset> I<noderange> I<osimage=<imagename>> [I<--noupdateinitrd>] [I<--ignorekernelchk>]
B<nodeset> [I<-h>|I<--help>|I<-v>|I<--version>]
=head1 B<Description>
@@ -67,6 +69,15 @@ Cleanup the current pxe/tftp boot configuration files for the nodes requested
Prepare server for installing a node using the specified os image. The os image is defined in the I<osimage> table and I<linuximage> table. If the <imagename> is omitted, the os image name will be obtained from I<nodetype.provmethod> for the node.
=item B<--noupdateinitrd>
Skip the rebuilding of initrd when the 'netdrivers', 'drvierupdatesrc' or 'osupdatename' were set for injecting new drviers to initrd. But, the geninitrd command
should be run to rebuild the initrd for new drivers injecting. This is used to improve the performance of nodeset command.
=item B<--ignorekernelchk>
Skip the kernel version checking when injecting drivers from osimage.driverupdatesrc. That means all drivers from osimage.driverupdatesrc will be injected to initrd for the specific target kernel.
=item B<runimage>=<task>>
If you would like to run a task after deployment, you can define that task with this attribute.

View File

@@ -25,6 +25,14 @@ if [ "$HOSTOS" = "mcp" ]; then
sed -i 's/ kexec//' $DRACUTMODDIR/install
sed -i 's/ klogd//' $DRACUTMODDIR/install
sed -i 's/ mdadm//' $DRACUTMODDIR/install
# These timezone files are not available in the latest mcp build
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh87//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh88//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh89//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh87//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh88//' $DRACUTMODDIR/install
sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Mideast\/Riyadh89//' $DRACUTMODDIR/install
fi
mkdir -p /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs

View File

@@ -59,4 +59,4 @@ fi
%Files
%defattr(-,root,root)
/
/opt/xcat/share/xcat/netboot/genesis/%{tarch}

View File

@@ -211,7 +211,7 @@ sub makescript {
return;
}
$mn = xCAT::Utils->noderangecontainsMn(@$nodes);
@::mn = xCAT::Utils->noderangecontainsMn(@$nodes);
my $inc;
my $t_inc;
@@ -609,7 +609,7 @@ sub getNodeType
my $node = shift;
my $result;
if ( $node =~ /^$mn$/) {
if (grep(/^$node$/, @::mn)) { # is it in the Management Node array
$result="MN";
return $result;
}

View File

@@ -178,7 +178,7 @@ sub subvars {
my $source_in_pre;
my $c = 0;
foreach my $pkgdir(@pkgdirs) {
if( $platform =~ /^(rh|SL)$/ ) {
if( $platform =~ /^(rh|SL|centos)$/ ) {
if ( $c == 0 ) {
# After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x
# the rhels5.9 will not be installed successfully. So put in kickstart directly.

View File

@@ -75,28 +75,66 @@ sub process_request {
my $nodelist = $request->{node};
my $retref;
my $rsp;
if($command eq 'kitnodeadd')
{
setrsp_progress("Updating hosts entries");
$retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Updating DNS entries");
$retref = xCAT::Utils->runxcmd({command=>["makedns"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
if($macflag)
{
setrsp_progress("Update DHCP entries");
$retref = xCAT::Utils->runxcmd({command=>["makedhcp"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
# Get nodes profile
my $profileref = xCAT::ProfiledNodeUtils->get_nodes_profiles($nodelist);
my %profilehash = %$profileref;
# Check whetehr we need to run makeconservercf
# If one node has hardwareprofile, we need to run makeconservercf
my $runconservercmd = 0;
foreach (keys %profilehash) {
if (exists $profilehash{$_}{'HardwareProfile'}) {
$runconservercmd = 1;
last;
}
setrsp_progress("Update known hosts");
$retref = xCAT::Utils->runxcmd({command=>["makeknownhosts"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
}
my @commandslist;
my %argslist;
my $noupdate_flag = 0;
my %msghash = ( "makehosts" => "Updating hosts entries",
"makedns" => "Updating DNS entries",
"makedhcp" => "Update DHCP entries",
"makeknownhosts" => "Update known hosts",
"makeconservercf" => "Updating conserver configuration files",
"kitnoderemove" => "Remove nodes entries from system configuration files first.",
"nodeset" => "Update nodes' boot settings",
"rspconfig" => "Updating FSP's IP address",
"rscan" => "Update node's some attributes through 'rscan -u'",
"mkhwconn" => "Sets up connections for nodes to FSP",
);
# Stage1: pre-run
if ($command eq 'kitnoderefresh') {
# This is due to once update nicips table, we need remove node's records first and then re-create by run make* commands. If not, old records can't be removed.
push @commandslist, ['makedns', '-d'];
push @commandslist, ['makehosts', '-d'];
}
# Stage2: run xcat commands
if ($command eq 'kitnodeadd' or $command eq 'kitnodeupdate' or $command eq 'kitnoderefresh') {
push @commandslist, ['makehosts', ''];
push @commandslist, ['makedns', ''];
if ($macflag) {
push @commandslist, ['makedhcp', ''];
}
push @commandslist, ['makeknownhosts', ''];
if ($runconservercmd) {
push @commandslist, ['makeconservercf', ''];
}
}elsif ($command eq 'kitnoderemove') {
if ($runconservercmd) {
push @commandslist, ['makeconservercf', '-d'];
}
push @commandslist, ['makeknownhosts', '-r'];
if ($macflag) {
push @commandslist, ['makedhcp', '-d'];
}
}
# Stage3: post-run
if ($command eq 'kitnodeadd') {
my $firstnode = (@$nodelist)[0];
my $chaintab = xCAT::Table->new("chain");
my $chainref = $chaintab->getNodeAttribs($firstnode, ['chain']);
@@ -106,107 +144,56 @@ sub process_request {
if($macflag)
{
if ($chainarray[0]){
setrsp_progress("Update nodes' boot settings");
$retref = xCAT::Utils->runxcmd({command=>["nodeset"], node=>$nodelist, arg=>[$chainarray[0]]}, $request_command, 0, 2);
log_cmd_return($retref);
if($chainarray[0] =~ m/^osimage=/)
{
$noupdate_flag = 1;
}
push @commandslist, ['nodeset', $chainarray[0]];
}
}
my $isfsp = xCAT::ProfiledNodeUtils->is_fsp_node([$firstnode]);
if ($isfsp) {
setrsp_progress("Updating FSP's IP address");
$retref = xCAT::Utils->runxcmd({command=>["rspconfig"], node=>$nodelist, arg=>['network=*']}, $request_command, 0, 2);
log_cmd_return($retref);
my $cmmref = xCAT::ProfiledNodeUtils->get_nodes_cmm($nodelist);
my @cmmchassis = keys %$cmmref;
setrsp_progress("Update node's some attributes through 'rscan -u'");
$retref = xCAT::Utils->runxcmd({command=>["rscan"], node=>\@cmmchassis, arg=>['-u']}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Sets up connections for nodes to FSP");
$retref = xCAT::Utils->runxcmd({command=>["mkhwconn"], node=>$nodelist, arg=>['-t']}, $request_command, 0, 2);
log_cmd_return($retref);
push @commandslist, ['rspconfig', 'network=*'];
push @commandslist, ['rscan', '-u', \@cmmchassis];
push @commandslist, ['rmhwconn', ''];
push @commandslist, ['mkhwconn', '-t'];
}
setrsp_progress("Updating conserver configuration files");
$retref = xCAT::Utils->runxcmd({command=>["makeconservercf"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
}
elsif ($command eq 'kitnoderemove'){
setrsp_progress("Updating conserver configuration files");
$retref = xCAT::Utils->runxcmd({command=>["makeconservercf"], node=>$nodelist, arg=>['-d']}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Update nodes' boot settings");
$retref = xCAT::Utils->runxcmd({command=>["nodeset"], node=>$nodelist, arg=>['offline']}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Update known hosts");
$retref = xCAT::Utils->runxcmd({command=>["makeknownhosts"], node=>$nodelist, arg=>['-r']}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Update DHCP entries");
$retref = xCAT::Utils->runxcmd({command=>["makedhcp"], node=>$nodelist, arg=>['-d']}, $request_command, 0, 2);
log_cmd_return($retref);
}
elsif ($command eq 'kitnodeupdate'){
setrsp_progress("Updating hosts entries");
$retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Updating DNS entries");
$retref = xCAT::Utils->runxcmd({command=>["makedns"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Update DHCP entries");
$retref = xCAT::Utils->runxcmd({command=>["makedhcp"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Update known hosts");
$retref = xCAT::Utils->runxcmd({command=>["makeknownhosts"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
}elsif ($command eq 'kitnoderemove') {
push @commandslist, ['nodeset', 'offline'];
}elsif ($command eq 'kitnodeupdate') {
my $firstnode = (@$nodelist)[0];
my $profileref = xCAT::ProfiledNodeUtils->get_nodes_profiles([$firstnode]);
my %profilehash = %$profileref;
if (exists $profilehash{$firstnode}{"ImageProfile"}){
setrsp_progress("Update nodes' boot settings");
$retref = xCAT::Utils->runxcmd({command=>["nodeset"], node=>$nodelist, arg=>['osimage='.$profilehash{$firstnode}{"ImageProfile"}]}, $request_command, 0, 2);
log_cmd_return($retref);
my $osimage = 'osimage='.$profilehash{$firstnode}{"ImageProfile"};
$noupdate_flag = 1;
push @commandslist, ['nodeset', $osimage];
}
}
setrsp_progress("Updating conserver configuration files");
$retref = xCAT::Utils->runxcmd({command=>["makeconservercf"], node=>$nodelist}, $request_command, 0, 2);
# Run commands
foreach (@commandslist) {
my $current_cmd = $_->[0];
my $current_args = $_->[1];
setrsp_progress($msghash{$current_cmd});
$retref = "";
if(($current_cmd eq "nodeset") && $noupdate_flag)
{
$retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args, "--noupdateinitrd"]}, $request_command, 0, 2);
}
elsif($current_cmd eq "rscan")
{
my $current_nodelist = $_->[2];
$retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$current_nodelist, arg=>[$current_args]}, $request_command, 0, 2);
}
else
{
$retref = xCAT::Utils->runxcmd({command=>[$current_cmd], node=>$nodelist, arg=>[$current_args]}, $request_command, 0, 2);
}
log_cmd_return($retref);
}
elsif ($command eq 'kitnoderefresh'){
# This is due to once update nicips table, we need remove node's records first and then re-create by run make* commands.
setrsp_progress("Remove nodes entries from system configuration files first.");
$retref = xCAT::Utils->runxcmd({command=>["kitnoderemove"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Updating hosts entries");
$retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Updating DNS entries");
$retref = xCAT::Utils->runxcmd({command=>["makedns"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Update DHCP entries");
$retref = xCAT::Utils->runxcmd({command=>["makedhcp"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Update known hosts");
$retref = xCAT::Utils->runxcmd({command=>["makeknownhosts"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
setrsp_progress("Updating conserver configuration files");
$retref = xCAT::Utils->runxcmd({command=>["makeconservercf"], node=>$nodelist}, $request_command, 0, 2);
log_cmd_return($retref);
}
else
{
}
}
#-------------------------------------------------------

View File

@@ -172,6 +172,8 @@ sub mknetboot
my $nodes = @{$req->{node}};
my @args = @{$req->{arg}} if(exists($req->{arg}));
my @nodes = @{$req->{node}};
my $noupdateinitrd = $req->{'noupdateinitrd'};
my $ignorekernelchk = $req->{'ignorekernelchk'};
my $ostab = xCAT::Table->new('nodetype');
#my $sitetab = xCAT::Table->new('site');
my $linuximagetab;
@@ -520,7 +522,7 @@ sub mknetboot
}
}
if ($docopy) {
if ($docopy && !$noupdateinitrd) {
mkpath("$tftppath");
if (-f "$rootimgdir/hypervisor") {
copy("$rootimgdir/hypervisor", "$tftppath");
@@ -934,6 +936,7 @@ sub mkinstall
my $doreq = shift;
my @nodes = @{$request->{node}};
my $noupdateinitrd = $request->{'noupdateinitrd'};
my $ignorekernelchk = $request->{'ignorekernelchk'};
#my $sitetab = xCAT::Table->new('site');
my $linuximagetab;
my $osimagetab;
@@ -1346,7 +1349,7 @@ sub mkinstall
unless ($noupdateinitrd) {
copy($kernpath,"$tftppath");
copy($initrdpath,"$tftppath/initrd.img");
&insert_dd($callback, $os, $arch, "$tftppath/initrd.img", "$tftppath/vmlinuz", $driverupdatesrc, $netdrivers, $osupdir);
&insert_dd($callback, $os, $arch, "$tftppath/initrd.img", "$tftppath/vmlinuz", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
}
}
}
@@ -1576,7 +1579,8 @@ sub mksysclone
}
}
# copy postscripts
# copy postscripts, the xCAT scripts may update, but the image is captured long time ago
# should update the scripts at each nodeset
my $script1 = "configefi";
my $script2 = "updatenetwork";
my $pspath = "$installroot/sysclone/scripts/post-install/";
@@ -2416,6 +2420,7 @@ sub insert_dd {
my $driverupdatesrc = shift;
my $drivers = shift;
my $osupdirlist = shift;
my $ignorekernelchk = shift;
my $install_dir = xCAT::TableUtils->getInstallDir();
@@ -2426,8 +2431,10 @@ sub insert_dd {
my @dd_list;
my @rpm_list;
my @vendor_rpm; # the rpms from driverupdatesrc attribute
my @driver_list;
my $Injectalldriver;
my $updatealldriver;
my @rpm_drivers;
@@ -2454,8 +2461,10 @@ sub insert_dd {
push @dd_list, $1;
} elsif ($src =~ /rpm:(.*)/i) {
push @rpm_list, $1;
push @vendor_rpm, $1;
} else {
push @rpm_list, $src;
push @vendor_rpm, $src;
}
}
}
@@ -2472,6 +2481,9 @@ sub insert_dd {
if (/^allupdate$/) {
$Injectalldriver = 1;
next;
} elsif (/^updateonly$/) {
$updatealldriver = 1;
next;
}
unless (/\.ko$/) {
s/$/.ko/;
@@ -2481,8 +2493,9 @@ sub insert_dd {
chomp(@dd_list);
chomp(@rpm_list);
chomp(@vendor_rpm);
unless (@dd_list || (@rpm_list && ($Injectalldriver || @driver_list))) {
unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
return ();
}
@@ -2493,7 +2506,7 @@ sub insert_dd {
# dracut + drvier rpm
# !dracut + driver rpm
# !dracut + driver disk
if (!<$install_dir/$os/$arch/Packages/dracut*> || (@rpm_list && ($Injectalldriver || @driver_list))) {
if (!<$install_dir/$os/$arch/Packages/dracut*> || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
mkpath "$dd_dir/initrd_img"; # The dir for the new initrd
# unzip the initrd image
@@ -2512,19 +2525,26 @@ sub insert_dd {
} elsif ( grep (/LZMA compressed data/, @format)) {
$initrdfmt = "lzma";
} else {
my $rsp;
push @{$rsp->{data}}, "Could not handle the format of the initrd.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
# check whether it can be handled by xz
$cmd = "xz -t $img";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Could not handle the format of the initrd.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
} else {
$initrdfmt = "lzma";
}
}
if ($initrdfmt eq "gzip") {
$cmd = "gunzip -c $img > $dd_dir/initrd";
} elsif ($initrdfmt eq "lzma") {
if (! -x "/usr/bin/lzma") {
if (! -x "/usr/bin/xz") {
my $rsp;
push @{$rsp->{data}}, "The format of initrd for the target node is \'lzma\', but this management node has not lzma command.";
push @{$rsp->{data}}, "The format of initrd for the target node is \'lzma\', but this management node has not xz command.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
}
@@ -2549,13 +2569,12 @@ sub insert_dd {
}
my $new_kernel_ver;
if (@rpm_list && ($Injectalldriver || @driver_list)) {
if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) {
# Extract the files from rpm to the tmp dir
mkpath "$dd_dir/rpm";
foreach my $rpm (@rpm_list) {
if (-r $rpm) {
$cmd = "cd $dd_dir/rpm; rpm2cpio $rpm | cpio -idum";
#$cmd = "rpm -i --quiet --nodeps --force --ignorearch --ignoreos --nosignature --root $dd_dir/rpm $rpm";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
@@ -2572,33 +2591,57 @@ sub insert_dd {
# and copy it to the /tftpboot
my @new_kernels = <$dd_dir/rpm/boot/vmlinuz*>;
foreach my $new_kernel (@new_kernels) {
if (-r $new_kernel && $new_kernel =~ /\/vmlinuz-(.*(x86_64|ppc64))$/) {
$new_kernel_ver = $1;
$cmd = "/bin/mv -f $new_kernel $kernelpath";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
if (-r $new_kernel && $new_kernel =~ /\/vmlinuz-(.*(x86_64|ppc64|el\d+))$/) {
$new_kernel_ver = $1;
$cmd = "/bin/mv -f $new_kernel $kernelpath";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $kernelpath.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
}
# Extract files from vendor rpm when $ignorekernelchk is specified
if ($ignorekernelchk) {
mkpath "$dd_dir/vendor_rpm";
foreach my $rpm (@vendor_rpm) {
if (-r $rpm) {
$cmd = "cd $dd_dir/vendor_rpm; rpm2cpio $rpm | cpio -idum";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not extract files from the rpm $rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
} else {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $kernelpath.";
push @{$rsp->{data}}, "Handle the driver update failed. Could not read the rpm $rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
# Change it back to xxx.ko here
$driver_name = "\*ko.new";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/*>);
foreach my $file (@all_real_path) {
my $newname = $file;
$newname =~ s/\.new$//;
$cmd = "/bin/mv -f $file $newname";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $file.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
# Change it back to xxx.ko here
$driver_name = "\*ko.new";
@all_real_path = ();
my @rpmfiles = <$dd_dir/rpm/*>;
if ($ignorekernelchk) {
push @rpmfiles, <$dd_dir/vendor_rpm/*>;
}
find(\&get_all_path, @rpmfiles);
foreach my $file (@all_real_path) {
my $newname = $file;
$newname =~ s/\.new$//;
$cmd = "/bin/mv -f $file $newname";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $file.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
@@ -2613,7 +2656,7 @@ sub insert_dd {
# For dracut mode, only copy the drivers from rpm packages to the /lib/modules/<kernel>
# The driver disk will be handled that append the whole disk to the orignial initrd
if (@rpm_list && ($Injectalldriver || @driver_list)) {
if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) {
# Copy the firmware to the rootimage
if (-d "$dd_dir/rpm/lib/firmware") {
if (! -d "$dd_dir/initrd_img/lib/firmware") {
@@ -2628,14 +2671,15 @@ sub insert_dd {
}
}
# if the new kernel from update distro is not existed in initrd, copy all the modules for the new kernel to initrd
if ((! -r "$dd_dir/initrd_img/lib/modules/$new_kernel_ver") && (-r "$dd_dir/rpm/lib/modules/$new_kernel_ver")) {
$cmd = "/bin/cp -rf $dd_dir/rpm/lib/modules/$new_kernel_ver $dd_dir/initrd_img/lib/modules/";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy $dd_dir/rpm/lib/modules/$new_kernel_ver to $dd_dir/initrd_img/lib/modules.";
xCAT::MsgUtils->message("E", $rsp, $callback);
# get the name list for all drivers in the original initrd if 'netdrivers=updateonly'
# then only the drivers in this list will be updated from the drvier rpms
if ($updatealldriver) {
$driver_name = "\*\.ko";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/initrd_img/lib/modules/*>);
foreach my $real_path (@all_real_path) {
my $driver = basename($real_path);
push @driver_list, $driver;
}
}
@@ -2643,18 +2687,47 @@ sub insert_dd {
# Figure out the kernel version
my @kernelpaths = <$dd_dir/initrd_img/lib/modules/*>;
my @kernelvers;
if ($new_kernel_ver) {
push @kernelvers, $new_kernel_ver;
}
# if new kernel is used, remove all the original kernel directories
foreach (@kernelpaths) {
if (basename($_) =~ /^[\d\.]+/) {
push @kernelvers, basename($_);
my $kernelv = basename($_);
if ($kernelv =~ /^[\d\.]+/) {
if ($new_kernel_ver) {
rmtree ("$dd_dir/initrd_img/lib/modules/$kernelv");
} else {
push @kernelvers, $kernelv;
}
}
}
foreach my $kernelver (@kernelvers) {
# if $ignorekernelchk is specified, copy all files from vendor_rpm dir to target kernel dir
if ($ignorekernelchk) {
my @kernelpath4vrpm = <$dd_dir/vendor_rpm/lib/modules/*>;
foreach my $path (@kernelpath4vrpm) {
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
}
$cmd = "/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy driver $path from vendor rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
next;
}
if (@driver_list) {
foreach my $driver (@driver_list) {
$driver =~ s/\.gz$//;
$driver_name = $driver;
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
@@ -2698,7 +2771,7 @@ sub insert_dd {
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not generate the depdency for the drivers in the initrd.";
push @{$rsp->{data}}, "Handle the driver update failed. Could not generate the drivers depdency for $kernelver in the initrd.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
@@ -2817,7 +2890,7 @@ sub insert_dd {
}
# Merge the drviers from rpm packages to the initrd
if (@rpm_list && ($Injectalldriver || @driver_list)) {
if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) {
# Copy the firmware to the rootimage
if (-d "$dd_dir/rpm/lib/firmware") {
if (! -d "$dd_dir/initrd_img/lib") {
@@ -2837,18 +2910,62 @@ sub insert_dd {
mkpath ("$dd_dir/modules/$new_kernel_ver/$arch/");
}
# get the name list for all drivers in the original initrd if 'netdrivers=updateonly'
# then only the drivers in this list will be updated from the drvier rpms
if ($updatealldriver) {
$driver_name = "\*\.ko";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/modules/*>);
foreach my $real_path (@all_real_path) {
my $driver = basename($real_path);
push @driver_list, $driver;
}
}
# Copy the drivers to the initrd
# Figure out the kernel version
my @kernelpaths = <$dd_dir/modules/*>;
my @kernelvers;
if ($new_kernel_ver) {
push @kernelvers, $new_kernel_ver;
}
foreach (@kernelpaths) {
push @kernelvers, basename($_);
my $kernelv = basename($_);
if ($kernelv =~ /^[\d\.]+/) {
if ($new_kernel_ver) {
rmtree ("$dd_dir/modules/$kernelv");
} else {
push @kernelvers, $kernelv;
}
}
}
foreach my $kernelver (@kernelvers) {
# if $ignorekernelchk is specified, copy all files from vendor_rpm dir to target kernel dir
if ($ignorekernelchk) {
my @kernelpath4vrpm = <$dd_dir/vendor_rpm/lib/modules/*>;
foreach my $path (@kernelpath4vrpm) {
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
}
$cmd = "/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy driver $path from vendor rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
next;
}
# create path for the new kernel in the modules package
unless (-d "$dd_dir/modules/$kernelver") {
mkpath ("$dd_dir/modules/$kernelver/$arch/");
}
# find the $kernelver/$arch dir in the $dd_dir/modules
my $arch4modules;
foreach (<$dd_dir/modules/$kernelver/*>) {
@@ -2924,13 +3041,23 @@ sub insert_dd {
if (-d $ma) {
mkpath "$dd_dir/depmod/lib/modules/$mk";
xCAT::Utils->runcmd("/bin/cp -rf $ma/* $dd_dir/depmod/lib/modules/$mk", -1);
$cmd = "depmod -b $dd_dir/depmod/";
$cmd = "depmod -b $dd_dir/depmod/ $mk";
#$cmd = "depmod -b $dd_dir/depmod/";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not generate the depdency for the drivers in the initrd.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
# remove the .ko postfix from the driver name for rh5
$cmd = "/bin/sed ".'s/\.ko//g'." $dd_dir/depmod/lib/modules/$mk/modules.dep > $dd_dir/depmod/lib/modules/$mk/modules.dep1; mv -f $dd_dir/depmod/lib/modules/$mk/modules.dep1 $dd_dir/depmod/lib/modules/$mk/modules.dep";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not generate the depdency for the drivers in the initrd.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
if (-f "$dd_dir/depmod/lib/modules/$mk/modules.dep") {
copy ("$dd_dir/depmod/lib/modules/$mk/modules.dep", "$dd_dir/initrd_img/modules/modules.dep");
}
@@ -3004,7 +3131,7 @@ sub insert_dd {
if ($initrdfmt eq "gzip") {
$cmd = "cd $dd_dir/initrd_img; find .|cpio -H newc -o|gzip -9 -c - > $dd_dir/initrd.img";
} elsif ($initrdfmt eq "lzma") {
$cmd = "cd $dd_dir/initrd_img; find .|cpio -H newc -o|lzma -C crc32 -9 > $dd_dir/initrd.img";
$cmd = "cd $dd_dir/initrd_img; find .|cpio -H newc -o|xz --format=lzma -C crc32 -9 > $dd_dir/initrd.img";
}
xCAT::Utils->runcmd($cmd, -1);
@@ -3072,13 +3199,25 @@ sub insert_dd {
my $rsp;
if (@dd_list) {
push @{$rsp->{data}}, "Inserted the driver update disk:".join(',',@inserted_dd).".";
push @{$rsp->{data}}, "The driver update disk:".join(',',@inserted_dd)." have been injected to initrd.";
}
if (@driver_list) {
push @{$rsp->{data}}, "Inserted the drivers:".join(',', sort(@rpm_drivers))." from driver packages.";
} elsif (@rpm_list && ($Injectalldriver || @driver_list)) {
push @{$rsp->{data}}, "Inserted the drivers from driver packages:".join(',', sort(@rpm_list)).".";
# remove the duplicated names
my %dnhash;
foreach (@rpm_drivers) {
$dnhash{$_} = 1;
}
@rpm_drivers = keys %dnhash;
if (@rpm_list) {
if (@rpm_drivers) {
push @{$rsp->{data}}, "The drivers:".join(',', sort(@rpm_drivers))." from ".join(',', sort(@rpm_list))." have been injected to initrd.";
} elsif ($Injectalldriver) {
push @{$rsp->{data}}, "All the drivers from: ".join(',', sort(@rpm_list))." have been injected to initrd.";
} else {
push @{$rsp->{data}}, "No driver was injected to initrd.";
}
}
xCAT::MsgUtils->message("I", $rsp, $callback);
return @inserted_dd;

View File

@@ -93,7 +93,9 @@ sub setdestiny {
@ARGV = @{$req->{arg}};
my $noupdateinitrd;
GetOptions('noupdateinitrd' => \$noupdateinitrd,);
my $ignorekernelchk;
GetOptions('noupdateinitrd' => \$noupdateinitrd,
'ignorekernelchk' => \$ignorekernelchk,);
my $state = $ARGV[0];
my $reststates;
@@ -304,7 +306,8 @@ sub setdestiny {
$errored=0;
$subreq->({command=>["mk$tempstate"],
node=>$samestatenodes,
noupdateinitrd=>$noupdateinitrd}, \&relay_response);
noupdateinitrd=>$noupdateinitrd,
ignorekernelchk=>$ignorekernelchk,}, \&relay_response);
if ($errored) {
$callback->({error=>"Some nodes failed to set up $state resources, aborting"});
return;
@@ -549,6 +552,7 @@ sub nextdestiny {
}
my $node;
my $noupdate_flag = 0;
$chaintab = xCAT::Table->new('chain');
my $chainents = $chaintab->getNodesAttribs(\@nodes,[qw(currstate currchain chain)]);
foreach $node (@nodes) {
@@ -576,13 +580,28 @@ sub nextdestiny {
my %requ;
$requ{node}=[$node];
$requ{arg}=[$ref->{currstate}];
if($ref->{currstate} =~ /noupdateinitrd$/)
{
my @items = split /[:]/,$ref->{currstate};
$requ{arg}= \@items;
$noupdate_flag = 1;
}
setdestiny(\%requ, $flag+1);
}
if ($callnodeset) {
my $args;
if ($noupdate_flag)
{
$args = ['enact', '--noupdateinitrd'];
}
else
{
$args = ['enact'];
}
$subreq->({command=>['nodeset'],
node=> \@nodes,
arg=>['enact']});
arg=>$args});
}
}

View File

@@ -10,6 +10,7 @@ use xCAT::SvrUtils;
use xCAT::Table;
#use Data::Dumper;
use File::Path;
use File::Copy;
use Getopt::Long;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
@@ -68,6 +69,7 @@ sub process_request {
my $onlyinitrd;
my $tempfile;
my $dryrun;
my $ignorekernelchk;
GetOptions(
'a=s' => \$arch,
@@ -87,6 +89,7 @@ sub process_request {
'onlyinitrd' => \$onlyinitrd,
'tempfile=s' => \$tempfile,
'dryrun' => \$dryrun,
'ignorekernelchk' => \$ignorekernelchk,
);
my $osimagetab;
@@ -169,6 +172,7 @@ sub process_request {
$otherpkglist = $ref_linuximage_tab->{'otherpkglist'};
$postinstall_filename = $ref_linuximage_tab->{'postinstall'};
$destdir = $ref_linuximage_tab->{'rootimgdir'};
$rootimg_dir = $ref_linuximage_tab->{'rootimgdir'};
$driverupdatesrc = $ref_linuximage_tab->{'driverupdatesrc'};
# TODO: how can we do if the user specifies one wrong value to the following attributes?
@@ -304,6 +308,7 @@ sub process_request {
if (!$dryrun) { $cmd .= " --tempfile $tempfile"; }
}
if ($driverupdatesrc) { $cmd .= " --driverupdatesrc $driverupdatesrc"; }
if ($ignorekernelchk) { $cmd .= " --ignorekernelchk $ignorekernelchk"; }
if($osfamily eq "sles") {
my @entries = xCAT::TableUtils->get_site_attribute("timezone");
@@ -363,6 +368,31 @@ sub process_request {
# print FILE "\n";
#}
#close FILE;
# update the generated initrd to /tftpboot/xcat so that don't need to rerun nodeset to update them
if (($::RUNCMD_RC == 0) && $imagename) {
my $tftpdir = "/tftpboot";
my @siteents = xCAT::TableUtils->get_site_attribute("tftpdir");
if ($#siteents >= 0)
{
$tftpdir = $siteents[0];
}
my $tftppath = "$tftpdir/xcat/osimage/$imagename";
my $installdir = "/install";
@siteents = xCAT::TableUtils->get_site_attribute("installdir");
if ($#siteents >= 0)
{
$installdir = $siteents[0];
}
unless (-d $tftppath) {
mkpath $tftppath;
}
copy("$rootimg_dir/initrd-stateless.gz", "$tftppath");
copy("$rootimg_dir/initrd-statelite.gz", "$tftppath");
copy("$rootimg_dir/kernel", "$tftppath");
}
#parse the output and save the image data to osimage and linuximage table
save_image_data($callback, $doreq, $tempfile);

View File

@@ -7,6 +7,7 @@ BEGIN
use strict;
use lib "$::XCATROOT/lib/perl";
use File::Path;
use File::Copy;
use xCAT::MsgUtils;
use xCAT::TableUtils;
@@ -25,16 +26,43 @@ sub preprocess_request
my $req = shift;
my $callback = shift;
unless (defined ($req->{arg}) && $req->{arg}->[0]) {
xCAT::MsgUtils->message("E", {error=>["An osimage name needs to be specified."], errorcode=>["1"]}, $callback);
my $usage = sub {
my $callback = shift;
xCAT::MsgUtils->message("I", {data=>["Usage: geninitrd <imagename> [--ignorekernelchk] [-h | --help]"]}, $callback);
};
my $osimage;
my $ignorekernelchk;
if (defined ($req->{arg})) {
foreach (@{$req->{arg}}) {
if (/^-/) {
if (/--ignorekernelchk/) {
$ignorekernelchk = 1;
} else {
$usage->($callback);
return;
}
}else {
$osimage = $_;
}
}
} else {
$usage->($callback);
return;
}
unless ($osimage) {
$usage->($callback);
return;
}
$req->{'ignorekernelchk'} = [$ignorekernelchk];
#if tftpshared is not set, dispatch this command to all the service nodes
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
$req->{'_disparatetftp'}=[1];
$req->{'_disparatetftp'} = [1];
return xCAT::Scope->get_broadcast_scope($req,@_);
}
return [$req];
@@ -45,10 +73,11 @@ sub process_request
{
my $req = shift;
my $callback = shift;
my $doreq = shift;
if ($req->{command}->[0] eq 'geninitrd')
{
return geninitrd($req, $callback);
return geninitrd($req, $callback, $doreq);
}
}
@@ -56,8 +85,13 @@ sub process_request
sub geninitrd {
my $req = shift;
my $callback = shift;
my $doreq = shift;
my $osimage = $req->{arg}->[0];
my $ignorekernelchk;
if (defined ($req->{'ignorekernelchk'}) && $req->{'ignorekernelchk'}->[0]) {
$ignorekernelchk = $req->{'ignorekernelchk'}->[0];
}
my ($osvers, $arch, $pkgdir, $driverupdatesrc, $netdrivers, $osdisupdir);
@@ -68,7 +102,7 @@ sub geninitrd {
return;
}
my $oient = $osimagetab->getAttribs({imagename => $osimage}, 'osvers', 'osarch', 'osupdatename');
my $oient = $osimagetab->getAttribs({imagename => $osimage}, 'provmethod', 'osvers', 'osarch', 'osupdatename');
unless ($oient && $oient->{'osvers'} && $oient->{'osarch'} ) {
xCAT::MsgUtils->message("E", {error=>["The osimage [$osimage] was not defined or [osvers, osarch] attributes were not set."], errorcode=>["1"]}, $callback);
return;
@@ -83,7 +117,7 @@ sub geninitrd {
return;
}
my $lient = $linuximagetab->getAttribs({imagename => $osimage}, 'pkgdir', 'driverupdatesrc', 'netdrivers');
my $lient = $linuximagetab->getAttribs({imagename => $osimage}, 'rootimgdir', 'pkgdir', 'driverupdatesrc', 'netdrivers');
unless ($lient && $lient->{'pkgdir'}) {
xCAT::MsgUtils->message("E", {error=>["The osimage [$osimage] was not defined or [pkgdir] attribute was not set."], errorcode=>["1"]}, $callback);
return;
@@ -92,6 +126,27 @@ sub geninitrd {
$driverupdatesrc = $lient->{'driverupdatesrc'};
$netdrivers = $lient->{'netdrivers'};
# if the provmethod equals 'netboot', call the genimage --onlyinitrd directly
if ($oient->{'provmethod'} && ($oient->{'provmethod'} eq "netboot" || $oient->{'provmethod'} eq "statelite")) {
if ($lient->{'rootimgdir'}) {
unless (-d $lient->{'rootimgdir'}."/rootimg/lib/modules") {
xCAT::MsgUtils->message("E", {error=>["The genimage should be run before running geninitrd."], errorcode=>["1"]}, $callback);
return;
}
} else {
xCAT::MsgUtils->message("E", {error=>["The rootimgdir attribute for the osimage should be set."], errorcode=>["1"]}, $callback);
return;
}
my @output = `genimage $osimage --onlyinitrd`;
xCAT::MsgUtils->message("I", {data=>\@output}, $callback);
#$doreq->({ command => ['genimage'],
# arg => [$osimage, '--onlyinitrd'] }, $callback);
return;
} elsif (!$oient->{'provmethod'} || $oient->{'provmethod'} ne "install") {
xCAT::MsgUtils->message("E", {error=>["The attribute [provmethod] for osimage [$osimage] must be set to install, netboot or statelite."], errorcode=>["1"]}, $callback);
return;
}
# get the path list of the osdistroupdate
if ($oient->{'osupdatename'}) {
my @osupdatenames = split (/,/, $oient->{'osupdatename'});
@@ -127,6 +182,9 @@ sub geninitrd {
$tftpdir = $t_entry;
}
my $tftppath = "$tftpdir/xcat/osimage/$osimage";
unless (-d $tftppath) {
mkpath $tftppath;
}
if ($arch =~ /x86/) {
if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)/) {
$kernelpath = "$tftppath/vmlinuz";
@@ -171,10 +229,10 @@ sub geninitrd {
# 2. Inject the drivers to initrd in /tftpboot base on the new kernel ver
if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)/) {
require xCAT_plugin::anaconda;
xCAT_plugin::anaconda->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir);
xCAT_plugin::anaconda->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir, $ignorekernelchk);
} elsif ($osvers =~ /(sles.*)|(suse.*)/) {
require xCAT_plugin::sles;
xCAT_plugin::sles->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir);
xCAT_plugin::sles->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir, $ignorekernelchk);
}
}

View File

@@ -55,6 +55,7 @@ sub handled_commands {
rspreset => 'nodehm:mgt', #done
rvitals => 'nodehm:mgt', #done
rinv => 'nodehm:mgt', #done
rflash => 'nodehm:mgt', #done
rsetboot => 'nodehm:mgt', #done
rbeacon => 'nodehm:mgt', #done
reventlog => 'nodehm:mgt',
@@ -466,12 +467,16 @@ sub on_bmc_connect {
}
#ok, detect some common prereqs here, notably:
#getdevid
if ($command eq "getrvidparms") {
if ($command eq "getrvidparms" or $command eq "rflash") {
unless (defined $sessdata->{device_id}) {
$sessdata->{ipmisession}->subcmd(netfn=>6,command=>1,data=>[],callback=>\&gotdevid,callback_args=>$sessdata);
return;
}
getrvidparms($sessdata);
if ($command eq "getrvidparms") {
getrvidparms($sessdata);
} else {
rflash($sessdata);
}
}
#initsdr
if ($command eq "rinv" or $command eq "reventlog" or $command eq "rvitals") {
@@ -1209,6 +1214,174 @@ sub ripmi_callback {
xCAT::SvrUtils::sendmsg($output,$callback,$sessdata->{node},%allerrornodes);
}
sub isfpc {
my $sessdata = shift;
return 1
}
sub rflash {
my $sessdata = shift;
if (isfpc($sessdata)) {
#first, start a fpc firmware transaction
$sessdata->{firmpath} = $sessdata->{subcommand};
$sessdata->{firmctx} = "init";
$sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x17,
data=>[0,0,1,0,0,0,0],
callback=>\&fpc_firmup_config,
callback_args=>$sessdata);
} else {
die "Unimplemented";
}
}
sub fpc_firmup_config {
if (check_rsp_errors(@_)) {
abort_fpc_update($_[1]);
return;
}
my $rsp = shift;
my $sessdata = shift;
unless ($sessdata->{firmupxid}) {
$sessdata->{firmupxid} = $rsp->{data}->[0];
}
my $data;
if ($sessdata->{firmctx} eq 'init') {
$data =[0, $sessdata->{firmupxid}, 1, 0, 1, 0, 0, 0,
length($sessdata->{firmpath}),
unpack("C*",$sessdata->{firmpath})];
$sessdata->{firmctx} = 'p1';
} elsif ($sessdata->{firmctx} eq 'p1') {
$data = [0, $sessdata->{firmupxid}, 3, 0, 5];
$sessdata->{firmctx} = 'p2';
} elsif ($sessdata->{firmctx} eq 'p2') {
$data = [0, $sessdata->{firmupxid}, 4, 0, 0xa];
$sessdata->{firmctx} = 'p3';
} elsif ($sessdata->{firmctx} eq 'p3') {
$data = [0, $sessdata->{firmupxid}, 5, 0, 3];
$sessdata->{firmctx} = 'p4';
} elsif ($sessdata->{firmctx} eq 'p4') {
$data = [0, $sessdata->{firmupxid}, 6, 0, 1];
$sessdata->{firmctx} = 'xfer';
xCAT::SvrUtils::sendmsg("Transferring firmware",$callback,$sessdata->{node},%allerrornodes);
$sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x19,
data=>[0, $sessdata->{firmupxid}],
callback=>\&fpc_firmxfer_watch,
callback_args=>$sessdata);
return;
}
$sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x18,
data=>$data,
callback=>\&fpc_firmup_config,
callback_args=>$sessdata);
}
sub abort_fpc_update {
my $sessdata = shift;
$sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x15, data=>[], callback=>\&fpc_update_aborted, callback_args=>$sessdata);
}
sub fpc_update_aborted {
check_rsp_errors(@_);
return;
}
sub fpc_firmxfer_watch {
if ($_[0]->{code} == 0x89) {
xCAT::SvrUtils::sendmsg([1,"Transfer failed (wrong url?)"],$callback,$_[1]->{node},%allerrornodes);
abort_fpc_update($_[1]);
return;
}
if (check_rsp_errors(@_)) {
abort_fpc_update($_[1]);
return;
}
my $rsp = shift;
my $sessdata = shift;
my $delay=1;
my $watch=2;
if ($sessdata->{firmctx} eq 'apply') { $delay = 15; $watch = 1;}
if (check_rsp_errors(@_)) {
return;
}
my $percent = 0;
if ($rsp->{data} and (length(@{$rsp->{data}}) > 0)) {
$percent = $rsp->{data}->[0];
}
#$callback->({sinfo=>"$percent%"});
if ($percent == 100) {
if ($sessdata->{firmctx} eq 'xfer') {
xCAT::SvrUtils::sendmsg("Applying firmware",$callback,$sessdata->{node},%allerrornodes);
$sessdata->{firmctx} = "apply";
$sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x20,
data=>[0, $sessdata->{firmupxid}],
callback=>\&fpc_firmxfer_watch,
callback_args=>$sessdata);
return;
} else {
xCAT::SvrUtils::sendmsg("Resetting FPC",$callback,$sessdata->{node},%allerrornodes);
resetbmc($sessdata);
}
} else {
$sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x12,
data=>[$watch],
delayxmit=>$delay,
callback=>\&fpc_firmxfer_watch,
callback_args=>$sessdata);
}
}
sub reseat_node {
my $sessdata = shift;
if (1) { # TODO: FPC path checked for
my $mptab = xCAT::Table->new('mp', -create=>0);
unless ($mptab) {
xCAT::SvrUtils::sendmsg([1,"mp table must be configured for reseat"],$callback,$sessdata->{node},%allerrornodes);
return;
}
my $mpent = $mptab->getNodeAttribs($sessdata->{node},[qw/mpa id/]);
unless ($mpent and $mpent->{mpa} and $mpent->{id}) {
xCAT::SvrUtils::sendmsg([1,"mp table must be configured for reseat"],$callback,$sessdata->{node},%allerrornodes);
return;
}
my $fpc = $mpent->{mpa};
my $ipmitab = xCAT::Table->new("ipmi");
my $ipmihash = $ipmitab->getNodesAttribs([$fpc],['bmc','username','password']) ;
my $authdata = xCAT::PasswordUtils::getIPMIAuth(noderange=>[$fpc],ipmihash=>$ipmihash);
my $nodeuser=$authdata->{$fpc}->{username};
my $nodepass=$authdata->{$fpc}->{password};
$sessdata->{slotnumber} = $mpent->{id};
$sessdata->{fpcipmisession} = xCAT::IPMI->new(bmc=>$mpent->{mpa},userid=>$nodeuser,password=>$nodepass);
$sessdata->{fpcipmisession}->login(callback=>\&fpc_node_reseat,callback_args=>$sessdata);
}
}
sub fpc_node_reseat {
my $status = shift;
my $sessdata = shift;
if ($status =~ /ERROR:/) {
xCAT::SvrUtils::sendmsg([1,$status],$callback,$sessdata->{node},%allerrornodes);
return;
}
$sessdata->{fpcipmisession}->subcmd(netfn=>0x32, command=>0xa4,
data=>[$sessdata->{slotnumber}, 2],
callback=>\&fpc_node_reseat_complete, callback_args=>$sessdata);
}
sub fpc_node_reseat_complete {
my $rsp = shift;
my $sessdata = shift;
if ($rsp->{error}) {
xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes);
return;
}
if ($rsp->{code} == 0) {
xCAT::SvrUtils::sendmsg("reseat",$callback,$sessdata->{node},%allerrornodes);
} elsif ($rsp->{code} == 0xd5) {
xCAT::SvrUtils::sendmsg([1,"No node in slot"],$callback,$sessdata->{node},%allerrornodes);
} else {
xCAT::SvrUtils::sendmsg([1,"Unknown error code ".$rsp->{code}],$callback,$sessdata->{node},%allerrornodes);
}
}
sub power {
my $sessdata = shift;
@@ -1219,7 +1392,9 @@ sub power {
my $rc = 0;
my $text;
my $code;
if (not $sessdata->{acpistate} and $sessdata->{mfg_id} == 20301) { #Only implemented for IBM servers
if ($sessdata->{subcommand} eq "reseat") {
reseat_node($sessdata);
} elsif (not $sessdata->{acpistate} and $sessdata->{mfg_id} == 20301) { #Only implemented for IBM servers
$sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0x1d,data=>[1],callback=>\&power_with_acpi,callback_args=>$sessdata);
} else {
$sessdata->{ipmisession}->subcmd(netfn=>0,command=>1,data=>[],callback=>\&power_with_context,callback_args=>$sessdata);
@@ -5177,6 +5352,57 @@ sub sensor_was_read {
if (@exparts) {
$extext = join(",",@exparts);
}
} elsif ($sdr->sensor_type == 0x28) {
if ($exdata1 & 1) {
push @exparts,"Degraded or unavailable";
}
if ($exdata1 & 1<<1) {
push @exparts,"Degraded or unavailable";
}
if ($exdata1 & 1<<2) {
push @exparts,"Offline";
}
if ($exdata1 & 1<<3) {
push @exparts,"Unavailable";
}
if ($exdata1 & 1<<4) {
push @exparts,"Failure";
}
if ($exdata1 & 1<<5) {
push @exparts,"FRU Failure";
}
} elsif ($sdr->sensor_type == 0x2b) {
if ($exdata1 & 1) {
push @exparts,"Change detected";
}
if ($exdata1 & 1<<1) {
push @exparts,"Firmware change detected";
}
if ($exdata1 & 1<<2) {
push @exparts,"Hardware incompatibility detected";
}
if ($exdata1 & 1<<3) {
push @exparts,"Firmware incompatibility detected";
}
if ($exdata1 & 1<<4) {
push @exparts,"Unsupported hardware version";
}
if ($exdata1 & 1<<5) {
push @exparts,"Unsupported firmware verion";
}
if ($exdata1 & 1<<6) {
push @exparts,"Hardware change successful";
}
if ($exdata1 & 1<<7) {
push @exparts,"Firmware change successful";
}
} elsif ($sdr->sensor_type == 0x1b) {
if ($exdata1 & 1) {
push @exparts,"Cable connected";
}
if ($exdata1 & 1<<1) {
push @exparts,"Incorrect cable connection";
}
} else {
$extext = "xCAT needs to add support for ".$sdr->sensor_type;
}
@@ -5975,7 +6201,7 @@ sub preprocess_request {
return 0;
}
if ( ($subcmd ne 'stat') && ($subcmd ne 'state') && ($subcmd ne 'status') && ($subcmd ne 'on') && ($subcmd ne 'off') && ($subcmd ne 'softoff') && ($subcmd ne 'nmi')&& ($subcmd ne 'cycle') && ($subcmd ne 'reset') && ($subcmd ne 'boot') && ($subcmd ne 'wake') && ($subcmd ne 'suspend')) {
if ( ($subcmd ne 'reseat') && ($subcmd ne 'stat') && ($subcmd ne 'state') && ($subcmd ne 'status') && ($subcmd ne 'on') && ($subcmd ne 'off') && ($subcmd ne 'softoff') && ($subcmd ne 'nmi')&& ($subcmd ne 'cycle') && ($subcmd ne 'reset') && ($subcmd ne 'boot') && ($subcmd ne 'wake') && ($subcmd ne 'suspend')) {
$callback->({data=>["Unsupported command: $command $subcmd", $usage_string]});
$request = {};
return;

View File

@@ -19,6 +19,7 @@ require xCAT::Utils;
require xCAT::TableUtils;
require xCAT::NetworkUtils;
require xCAT::MsgUtils;
require xCAT::CFMUtils;
require xCAT::ProfiledNodeUtils;
# Globals.
@@ -31,6 +32,7 @@ require xCAT::ProfiledNodeUtils;
my %allhostnames;
my %allbmcips;
my %allmacs;
my %allcecs;
my %allmacsupper;
my %allips;
my %allinstallips;
@@ -370,7 +372,7 @@ Usage:
my %allfspips = %$recordsref;
# Get all switches name
$recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('switches', 'switch');
$recordsref = xCAT::ProfiledNodeUtils->get_db_switches();
%allswitches = %$recordsref;
# Get all switches_switchport
@@ -385,6 +387,7 @@ Usage:
$allmacs{$macstr} = 0;
}
}
%allmacsupper = ();
foreach (keys %allmacs){
$allmacsupper{uc($_)} = 0;
}
@@ -397,6 +400,10 @@ Usage:
# Merge all BMC IPs and install IPs into allips.
%allips = (%allips, %allbmcips, %allinstallips, %allfspips);
# Get all CEC names
$recordsref = xCAT::ProfiledNodeUtils->get_all_cecs(1);
%allcecs = %$recordsref;
#TODO: can not use getallnode to get rack infos.
$recordsref = xCAT::ProfiledNodeUtils->get_all_rack(1);
%allracks = %$recordsref;
@@ -459,32 +466,36 @@ Usage:
}
}
# Create the real hostinfo string in stanza file format.
# Get no mac address nodes when user only defined CEC in NIF for 7R2 support.
my @nomacnodes = ();
foreach my $nomacnode(@nodelist){
if(defined($hostinfo_dict{$nomacnode}{'cec'}) &&
not (defined($hostinfo_dict{$nomacnode}{'mac'})) &&
not (defined($hostinfo_dict{$nomacnode}{'switch'}))){
push @nomacnodes, $nomacnode;
}
}
# Create the full hostinfo dict.
xCAT::MsgUtils->message('S', "Generating new hostinfo string.");
my ($retcode_gen, $retstr_gen) = gen_new_hostinfo_string(\%hostinfo_dict);
my ($retcode_gen, $retstr_gen) = gen_new_hostinfo_dict(\%hostinfo_dict);
unless ($retcode_gen){
setrsp_progress("Failed to validate node information file.");
setrsp_errormsg($retstr_gen);
return;
}
# call mkdef to create hosts and then call nodemgmt for node management plugins.
# create hosts and then call nodemgmt for node management plugins.
setrsp_progress("Importing nodes...");
setrsp_progress("Creating nodes...");
my $warnstr = "";
my $retref = xCAT::Utils->runxcmd({command=>["mkdef"], stdin=>[$retstr_gen], arg=>['-z']}, $request_command, 0, 2);
my $retstrref = parse_runxcmd_ret($retref);
# runxcmd failed.
if ($::RUNCMD_RC != 0){
if (xCAT::DBobjUtils->setobjdefs(\%hostinfo_dict) != 0){
$warnstr = "Warning: failed to import some nodes.";
setrsp_progress($warnstr);
if ($retstrref->[1]) {
$warnstr .= "Details: $retstrref->[1]";
}
setrsp_progress($warnstr);
}
setrsp_progress("Configuring nodes...");
$retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>\@nodelist, sequential=>[1], macflag=>[$mac_addr_mode]}, $request_command, 0, 2);
$retstrref = parse_runxcmd_ret($retref);
my $retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>\@nodelist, sequential=>[1], macflag=>[$mac_addr_mode]}, $request_command, 0, 2);
my $retstrref = parse_runxcmd_ret($retref);
if ($::RUNCMD_RC != 0){
$warnstr .= "Warning: failed to run command kitnodeadd.";
if ($retstrref->[1]) {
@@ -492,6 +503,71 @@ Usage:
}
}
# Use xcat command: getmacs <noderanges> -D to automatically get node mac address
# If some of nodes can not get mac address, then finally remove them with warning msg.
if(@nomacnodes){
# Sleep 10 seconds to ensure the basic node attributes are effected
sleep 10;
$retref = xCAT::Utils->runxcmd({command=>["getmacs"], node=>\@nomacnodes, arg=>['-D']}, $request_command, 0, 2);
$retstrref = parse_runxcmd_ret($retref);
if($::RUNCMD_RC != 0){
$warnstr .= "Warning: Can not discover MAC address by getmacs command for some node(s).";
}
# Parse the output of "getmacs <noderange> -D" to filter success and failed nodes.
my @successnodes = ();
my @failednodes = ();
my $nodelistref = $retref->{'node'};
my $index = 0;
my $name = '';
my $contents = '';
if($nodelistref){
foreach(@$nodelistref){
# Get node name.
if($nodelistref->[$index]->{'name'}){
$name = $nodelistref->[$index]->{'name'}->[0];
}
# Get node data contents.
if($nodelistref->[$index]->{'data'}->[0]->{'contents'}){
$contents = $nodelistref->[$index]->{'data'}->[0]->{'contents'}->[0];
}
# Get success and failed nodes list.
if(defined($name) and $contents =~ /[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}/){
push @successnodes, $name;
}else{
push @failednodes, $name;
}
$index++;
}
}
# Reconfigure the nodes that MAC address discovered by getmacs command
$mac_addr_mode = 1;
my $retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>\@successnodes, sequential=>[1], macflag=>[$mac_addr_mode]}, $request_command, 0, 2);
my $retstrref = parse_runxcmd_ret($retref);
if ($::RUNCMD_RC != 0){
$warnstr .= "Warning: failed to run command kitnodeadd.";
if ($retstrref->[1]) {
$warnstr .= "Details: $retstrref->[1]";
}
}
# Remove these nodes that can not get mac address by xcat command: getmacs <noderange> -D.
my $nodermretref = xCAT::Utils->runxcmd({command=>["noderm"], node=>\@failednodes}, $request_command, 0, 2);
my $nodermretstrref = parse_runxcmd_ret($nodermretref);
if($::RUNCMD_RC != 0){
$warnstr .= "Warning: Cannot remove some of nodes that not MAC address discovered by getmacs command.";
if($nodermretstrref->[1]){
$warnstr .= "Details: $nodermretstrref->[1]";
}
}
# Push the success nodes to nodelist and remove the failed nodes from nodelist.
@nodelist = xCAT::CFMUtils->arrayops("U", \@nodelist, \@successnodes);
@failednodes = xCAT::CFMUtils->arrayops("I", \@nodelist, \@failednodes);
@nodelist = xCAT::CFMUtils->arrayops("D", \@nodelist, \@failednodes);
}
setrsp_progress("Imported nodes.");
#TODO: get the real nodelist here.
setrsp_success(\@nodelist, $warnstr);
@@ -541,12 +617,15 @@ Usage:
}
setrsp_progress("Updating DNS entries");
$retref = "";
$retref = xCAT::Utils->runxcmd({command=>["makedns"], node=>$nodes, arg=>['-d']}, $request_command, 0, 2);
setrsp_progress("Updating hosts entries");
$retref = "";
$retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>$nodes, arg=>['-d']}, $request_command, 0, 2);
setrsp_progress("Removing nodes...");
$retref = "";
$retref = xCAT::Utils->runxcmd({command=>["noderm"], node=>$nodes}, $request_command, 0, 2);
$retstrref = parse_runxcmd_ret($retref);
if ($::RUNCMD_RC != 0){
@@ -738,6 +817,7 @@ Usage:
# Call update plugins first.
if(exists $args_dict{'hardwareprofile'} || exists $args_dict{'imageprofile'}){
setrsp_progress("Configuring nodes...");
$retref = "";
$retref = xCAT::Utils->runxcmd({command=>["kitnodeupdate"], node=>$nodes, sequential=>[1]}, $request_command, 0, 2);
$retstrref = parse_runxcmd_ret($retref);
if ($::RUNCMD_RC != 0){
@@ -748,6 +828,7 @@ Usage:
# If network profile specified. Need re-generate IPs for all nodess again.
if(exists $args_dict{'networkprofile'}){
setrsp_progress("Regenerate IP addresses for nodes...");
$retref = "";
$retref = xCAT::Utils->runxcmd({command=>["noderegenips"], node=>$nodes, sequential=>[1]}, $request_command, 0, 2);
$retstrref = parse_runxcmd_ret($retref);
if ($::RUNCMD_RC != 0){
@@ -957,13 +1038,13 @@ Usage:
$chaintab->close();
# Remove all nodes information
push(@kitcommands, "kitnoderemove");
push(@kitcommands, "removenodes");
# Add all nodes information back
push(@kitcommands, "kitnodeadd");
} elsif ( $fsp_flag ) {
# Remove all nodes information
push(@kitcommands, "kitnoderemove");
push(@kitcommands, "removenodes");
# Add all nodes information back
push(@kitcommands, "kitnodeadd");
} else {
@@ -972,7 +1053,19 @@ Usage:
#10. Call plugins.
foreach my $command (@kitcommands) {
my $retref = xCAT::Utils->runxcmd({command=>[$command], node=>$nodes, sequential=>[1]}, $request_command, 0, 2);
my $retref;
if ($command eq 'removenodes'){
# Not run makedns -d as it costs too much time
#setrsp_progress("Updating DNS entries");
#$retref = xCAT::Utils->runxcmd({command=>["makedns"], node=>$nodes, arg=>['-d']}, $request_command, 0, 2);
#setrsp_progress("Updating hosts entries");
$retref = "";
$retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>$nodes, arg=>['-d']}, $request_command, 0, 2);
next;
}
$retref = "";
$retref = xCAT::Utils->runxcmd({command=>[$command], node=>$nodes, sequential=>[1]}, $request_command, 0, 2);
my $retstrref = parse_runxcmd_ret($retref);
if ($::RUNCMD_RC != 0){
setrsp_progress("Warning: failed to call kit commands.");
@@ -1059,6 +1152,7 @@ Usage:
setrsp_progress("Warning: failed to update /etc/hosts for unmanaged node.");
}
$retref = "";
$retref = xCAT::Utils->runxcmd({command=>["makedns"], node=>[$args_dict{"hostname"}]}, $request_command, 0, 2);
$retstrref = parse_runxcmd_ret($retref);
if ($::RUNCMD_RC != 0){
@@ -1107,6 +1201,7 @@ Usage:
$allmacs{$macstr} = 0;
}
}
%allmacsupper = ();
foreach (keys %allmacs){
$allmacsupper{uc($_)} = 0;
}
@@ -1508,6 +1603,7 @@ sub findme{
$allmacs{$macstr} = 0;
}
}
%allmacsupper = ();
foreach (keys %allmacs){
$allmacsupper{uc($_)} = 0;
}
@@ -1588,22 +1684,20 @@ sub findme{
my ($hostinfo_dict_ref, $invalid_records_ref) = validate_node_entries();
my %hostinfo_dict = %$hostinfo_dict_ref;
# Create the real hostinfo string in stanza file format.
# Create the full hostinfo dict
xCAT::MsgUtils->message('S', "Profiled nodes discover: Generating new hostinfo string.\n");
my ($retcode_gen, $retstr_gen) = gen_new_hostinfo_string($hostinfo_dict_ref);
my ($retcode_gen, $retstr_gen) = gen_new_hostinfo_dict($hostinfo_dict_ref);
unless ($retcode_gen){
setrsp_errormsg($retstr_gen);
return;
}
# call mkdef to create hosts and then call nodemgmt for node management plugins.
xCAT::MsgUtils->message('S', "Call mkdef to create nodes.\n");
my $retref = xCAT::Utils->runxcmd({command=>["mkdef"], stdin=>[$retstr_gen], arg=>['-z']}, $request_command, 0, 2);
my $retstrref = parse_runxcmd_ret($retref);
# runxcmd failed.
if ($::RUNCMD_RC != 0){
setrsp_errormsg($retstr_gen);
return;
# Create hosts and then call nodemgmt for node management plugins.
xCAT::MsgUtils->message('S', "Creating nodes...\n");
my $warnstr;
if (xCAT::DBobjUtils->setobjdefs(\%hostinfo_dict) != 0){
$warnstr = "Warning: failed to import node.";
setrsp_progress($warnstr);
}
my @nodelist = keys %hostinfo_dict;
@@ -1613,10 +1707,11 @@ sub findme{
$request->{"command"} = ["discovered"];
$request->{"node"} = \@nodelist;
$request->{discoverymethod} = ['profile'];
$retref = xCAT::Utils->runxcmd($request, $request_command, 0, 2);
$retstrref = parse_runxcmd_ret($retref);
my $retref = xCAT::Utils->runxcmd($request, $request_command, 0, 2);
my $retstrref = parse_runxcmd_ret($retref);
xCAT::MsgUtils->message('S', "Call nodemgmt plugins.\n");
$retref = "";
$retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>\@nodelist, sequential=>[1]}, $request_command, 0, 2);
$retstrref = parse_runxcmd_ret($retref);
@@ -1629,19 +1724,19 @@ sub findme{
#-------------------------------------------------------
=head3 gen_new_hostinfo_string
=head3 gen_new_hostinfo_dict
Description : Generate a stanza file format string used for 'mkdef' to create nodes.
Description : Generate full hostinfo dict
Arguments : hostinfo_dict_ref - The reference of hostinfo dict.
Returns : (returnvalue, returnmsg)
returnvalue - 0, stands for generate new hostinfo string failed.
1, stands for generate new hostinfo string OK.
returnvalue - 0, stands for generate new hostinfo dict failed.
1, stands for generate new hostinfo dict OK.
returnnmsg - error messages if generate failed.
- the new hostinfo string if generate OK.
- OK for success cases.
=cut
#-------------------------------------------------------
sub gen_new_hostinfo_string{
sub gen_new_hostinfo_dict{
my $hostinfo_dict_ref = shift;
my %hostinfo_dict = %$hostinfo_dict_ref;
@@ -1670,9 +1765,9 @@ sub gen_new_hostinfo_string{
# Check whether this is Power env.
my $is_fsp = xCAT::ProfiledNodeUtils->is_fsp_node($args_dict{'networkprofile'});
# compose the stanza string for hostinfo file.
my $hostsinfostr = "";
foreach my $item (sort(keys %hostinfo_dict)){
# Set Nodes's type:
$hostinfo_dict{$item}{"objtype"} = 'node';
# Generate IPs for other interfaces defined in MAC file.
my %ipshash;
foreach (keys %netprofileattr){
@@ -1747,6 +1842,22 @@ sub gen_new_hostinfo_string{
$hostinfo_dict{$item}{"mpa"} = $chassisname;
}
}
# generate CEC-based rack-mount Power nodes' attributes
# lparid is optional, if not set, set it to 1
if ((exists $hostinfo_dict{$item}{"cec"}) && (! $is_fsp) ){
$hostinfo_dict{$item}{"hcp"} = $hostinfo_dict{$item}{"cec"};
$hostinfo_dict{$item}{"parent"} = $hostinfo_dict{$item}{"cec"};
delete($hostinfo_dict{$item}{"cec"});
if (exists $hostinfo_dict{$item}{"lparid"}) {
$hostinfo_dict{$item}{"id"} = $hostinfo_dict{$item}{"lparid"};
delete($hostinfo_dict{$item}{"lparid"});
} else {
$hostinfo_dict{$item}{"id"} = 1;
}
$hostinfo_dict{$item}{"mgt"} = "fsp";
}
# get the chain attribute from hardwareprofile and insert it to node.
my $chaintab = xCAT::Table->new('chain');
@@ -1755,11 +1866,11 @@ sub gen_new_hostinfo_string{
if (exists $chain->{'chain'}) {
my $hardwareprofile_chain = $chain->{'chain'};
$hostinfo_dict{$item}{"chain"} = $hardwareprofile_chain.',osimage='.$provmethod;
$hostinfo_dict{$item}{"chain"} = $hardwareprofile_chain.',osimage='.$provmethod.":--noupdateinitrd";
}
else {
$hostinfo_dict{$item}{"chain"} = 'osimage='.$provmethod;
$hostinfo_dict{$item}{"chain"} = 'osimage='.$provmethod.":--noupdateinitrd";
}
if (exists $netprofileattr{"bmc"}){ # Update BMC records.
@@ -1787,15 +1898,8 @@ sub gen_new_hostinfo_string{
}
}
# Generate the hostinfo string.
$hostsinfostr = "$hostsinfostr$item:\n";
my $itemdictref = $hostinfo_dict{$item};
my %itemdict = %$itemdictref;
foreach (keys %itemdict){
$hostsinfostr = "$hostsinfostr $_=\"$itemdict{$_}\"\n";
}
}
return 1, $hostsinfostr;
return 1, "OK";
}
#-------------------------------------------------------
@@ -2027,11 +2131,12 @@ sub validate_node_entry{
if (exists $allhostnames{$node_name}) {
$errmsg .= "Node name $node_name already exists. You must use a new node name.\n";
}
# Must specify either MAC or switch + port.
if (exists $node_entry{"mac"} ||
exists $node_entry{"switch"} && exists $node_entry{"switchport"}){
# Must specify either MAC, CEC or switch + port.
if (exists $node_entry{"mac"} ||
exists $node_entry{"switch"} && exists $node_entry{"switchport"} ||
exists $node_entry{"cec"}){
} else{
$errmsg .= "MAC address, switch and port is not specified. You must specify the MAC address or switch and port.\n";
$errmsg .= "MAC address, cec, switch and port is not specified. You must specify the MAC address, CEC name or switch and port.\n";
}
if (! xCAT::NetworkUtils->isValidHostname($node_name)){
@@ -2092,7 +2197,7 @@ sub validate_node_entry{
$errmsg .= "Specified rack cannot be used with chassis.\n";
} elsif (exists $node_entry{"height"} and exists $node_entry{"unit"}){
} else {
$errmsg .= "Specified rack must also specify the chassis or the height and unit.\n";
$errmsg .= "Specified rack must also specify the height and unit.\n";
}
}elsif ($_ eq "chassis"){
if (! exists $allchassis{$node_entry{$_}}){
@@ -2137,6 +2242,15 @@ sub validate_node_entry{
if (!($node_entry{$_} =~ /^[1-9]\d*$/)){
$errmsg .= "Specified slotid $node_entry{$_} is invalid";
}
}elsif ($_ eq "lparid"){
if (not exists $node_entry{"cec"}){
$errmsg .= "The lparid option must be used with the cec option.\n";
}
}elsif ($_ eq "cec"){
# Check the specified CEC is existing
if (! exists $allcecs{$node_entry{$_}}){
$errmsg .= "The CEC name $node_entry{$_} that is specified in the node information file is not defined in the system.\n";
}
}elsif ($_ eq "nicips"){
# Check Multi-Nic's ip
my $othernics = $node_entry{$_};

View File

@@ -55,6 +55,8 @@ sub mknetboot
my $globaltftpdir = "/tftpboot";
my $nodes = @{$req->{node}};
my @nodes = @{$req->{node}};
my $noupdateinitrd = $req->{'noupdateinitrd'};
my $ignorekernelchk = $req->{'ignorekernelchk'};
my $ostab = xCAT::Table->new('nodetype');
#my $sitetab = xCAT::Table->new('site');
my $linuximagetab;
@@ -404,7 +406,7 @@ sub mknetboot
}
}
if ($docopy) {
if ($docopy && !$noupdateinitrd) {
mkpath("$tftppath");
copy("$rootimgdir/kernel", "$tftppath");
if ($statelite) {
@@ -700,6 +702,7 @@ sub mkinstall
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
my $noupdateinitrd = $request->{'noupdateinitrd'};
my $ignorekernelchk = $request->{'ignorekernelchk'};
my @nodes = @{$request->{node}};
my $node;
my $ostab = xCAT::Table->new('nodetype');
@@ -1028,20 +1031,20 @@ sub mkinstall
unless ($noupdateinitrd) {
copy("$pkgdir/1/boot/$arch/loader/linux", "$tftppath");
copy("$pkgdir/1/boot/$arch/loader/initrd", "$tftppath");
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir);
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
}
} elsif ($arch =~ /x86/) {
unless ($noupdateinitrd) {
copy("$pkgdir/1/boot/i386/loader/linux", "$tftppath");
copy("$pkgdir/1/boot/i386/loader/initrd", "$tftppath");
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir);
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
}
}
elsif ($arch =~ /ppc/)
{
unless ($noupdateinitrd) {
copy("$pkgdir/1/suseboot/inst64", "$tftppath");
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/inst64", undef, $driverupdatesrc, $netdrivers, $osupdir);
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/inst64", undef, $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
}
}
}
@@ -1680,6 +1683,7 @@ sub insert_dd () {
my $driverupdatesrc = shift;
my $drivers = shift;
my $osupdirlist = shift;
my $ignorekernelchk = shift;
my $install_dir = xCAT::TableUtils->getInstallDir();
@@ -1687,8 +1691,10 @@ sub insert_dd () {
my @dd_list;
my @rpm_list;
my @vendor_rpm; # the rpms from driverupdatesrc attribute
my @driver_list;
my $Injectalldriver;
my $updatealldriver;
my @rpm_drivers;
@@ -1716,8 +1722,10 @@ sub insert_dd () {
push @dd_list, $1;
} elsif ($src =~ /rpm:(.*)/i) {
push @rpm_list, $1;
push @vendor_rpm, $1;
} else {
push @rpm_list, $src;
push @vendor_rpm, $src;
}
}
}
@@ -1734,6 +1742,9 @@ sub insert_dd () {
if (/^allupdate$/) {
$Injectalldriver = 1;
next;
} elsif (/^updateonly$/) {
$updatealldriver = 1;
next;
}
unless (/\.ko$/) {
s/$/.ko/;
@@ -1743,8 +1754,9 @@ sub insert_dd () {
chomp(@dd_list);
chomp(@rpm_list);
chomp(@vendor_rpm);
unless (@dd_list || (@rpm_list && ($Injectalldriver || @driver_list))) {
unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
return ();
}
@@ -1757,7 +1769,7 @@ sub insert_dd () {
# Unzip the original initrd
# This only needs to be done for ppc or handling the driver rpm
# For the driver disk against x86, append the driver disk to initrd directly
if ($arch =~/ppc/ || (@rpm_list && ($Injectalldriver || @driver_list))) {
if ($arch =~/ppc/ || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
if ($arch =~ /ppc/) {
$cmd = "gunzip --quiet -c $pkgdir/1/suseboot/initrd64 > $dd_dir/initrd";
} elsif ($arch =~ /x86/) {
@@ -1782,7 +1794,7 @@ sub insert_dd () {
}
# Start to load the drivers from rpm packages
if (@rpm_list && ($Injectalldriver || @driver_list)) {
if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) {
# Extract the files from rpm to the tmp dir
mkpath "$dd_dir/rpm";
my $new_kernel_ver;
@@ -1802,38 +1814,62 @@ sub insert_dd () {
}
# get the new kernel if it exists in the update distro
my @new_kernels = <$dd_dir/rpm/boot/vmlinuz*>;
my @new_kernels = <$dd_dir/rpm/boot/vmlinu*>;
foreach my $new_kernel (@new_kernels) {
if (-r $new_kernel && $new_kernel =~ /\/vmlinuz-(.*(x86_64|ppc64))$/) {
$new_kernel_ver = $1;
$cmd = "/bin/mv -f $new_kernel $dd_dir/rpm/newkernel";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $dd_dir/rpm/newkernel.";
xCAT::MsgUtils->message("I", $rsp, $callback);
if (-r $new_kernel && $new_kernel =~ /\/vmlinu[zx]-(.*(x86_64|ppc64|default))$/) {
$new_kernel_ver = $1;
$cmd = "/bin/mv -f $new_kernel $dd_dir/rpm/newkernel";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $dd_dir/rpm/newkernel.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
}
}
}
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
# Change it back to xxx.ko here
$driver_name = "\*ko.new";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/*>);
foreach my $file (@all_real_path) {
my $newname = $file;
$newname =~ s/\.new$//;
$cmd = "mv -f $file $newname";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
# Extract files from vendor rpm when $ignorekernelchk is specified
if ($ignorekernelchk) {
mkpath "$dd_dir/vendor_rpm";
foreach my $rpm (@vendor_rpm) {
if (-r $rpm) {
$cmd = "cd $dd_dir/vendor_rpm; rpm2cpio $rpm | cpio -idum";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not extract files from the rpm $rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
} else {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not rename $file.";
push @{$rsp->{data}}, "Handle the driver update failed. Could not read the rpm $rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
# Change it back to xxx.ko here
$driver_name = "\*ko.new";
@all_real_path = ();
my @rpmfiles = <$dd_dir/rpm/*>;
if ($ignorekernelchk) {
push @rpmfiles, <$dd_dir/vendor_rpm/*>;
}
find(\&get_all_path, @rpmfiles);
foreach my $file (@all_real_path) {
my $newname = $file;
$newname =~ s/\.new$//;
$cmd = "mv -f $file $newname";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not rename $file.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
# Copy the firmware to the rootimage
if (-d "$dd_dir/rpm/lib/firmware") {
if (! -d "$dd_dir/initrd_img/lib") {
@@ -1851,27 +1887,75 @@ sub insert_dd () {
# if the new kernel from update distro is not existed in initrd, create the path for it
if (! -r "$dd_dir/initrd_img/lib/modules/$new_kernel_ver/") {
mkpath ("$dd_dir/initrd_img/lib/modules/$new_kernel_ver/");
# link the /modules to this new kernel dir
unlink "$dd_dir/initrd_img/modules";
$cmd = "/bin/ln -sf lib/modules/$new_kernel_ver/initrd $dd_dir/initrd_img/modules";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not create link to the new kernel dir.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
# get the name list for all drivers in the original initrd if 'netdrivers=updateonly'
# then only the drivers in this list will be updated from the drvier rpms
if ($updatealldriver) {
$driver_name = "\*\.ko";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/initrd_img/lib/modules/*>);
foreach my $real_path (@all_real_path) {
my $driver = basename($real_path);
push @driver_list, $driver;
}
}
# Copy the drivers to the rootimage
# Figure out the kernel version
my @kernelpaths = <$dd_dir/initrd_img/lib/modules/*>;
my @kernelvers;
if ($new_kernel_ver) {
push @kernelvers, $new_kernel_ver;
}
foreach (@kernelpaths) {
push @kernelvers, basename($_);
my $kernelv = basename($_);
if ($kernelv =~ /^[\d\.]+/) {
if ($new_kernel_ver) {
rmtree ("$dd_dir/initrd_img/lib/modules/$kernelv");
} else {
push @kernelvers, $kernelv;
}
}
}
foreach my $kernelver (@kernelvers) {
# if $ignorekernelchk is specified, copy all files from vendor_rpm dir to target kernel dir
if ($ignorekernelchk) {
my @kernelpath4vrpm = <$dd_dir/vendor_rpm/lib/modules/*>;
foreach my $path (@kernelpath4vrpm) {
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
}
$cmd = "/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy driver $path from vendor rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
next;
}
if (@driver_list) {
# copy the specific drivers to initrd
foreach my $driver (@driver_list) {
$driver_name = $driver;
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
#if ($real_path && $real_path =~ m!$dd_dir/rpm(/lib/modules/$kernelver/.*?)[^\/]*$!) {
# NOTE: for the initrd of sles that the drivers are put in the /lib/modules/$kernelver/initrd/
foreach my $real_path (@all_real_path) {
if ($real_path && $real_path =~ m!$dd_dir/rpm/lib/modules/$kernelver/!) {
@@ -1895,8 +1979,7 @@ sub insert_dd () {
$driver_name = "\*\.ko";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
foreach $real_path (@all_real_path) {
#if ($real_path && $real_path =~ m!$dd_dir/rpm(/lib/modules/$kernelver/.*?)[^\/]*$!) {
foreach my $real_path (@all_real_path) {
# NOTE: for the initrd of sles that the drivers are put in the /lib/modules/$kernelver/initrd/
if ($real_path && $real_path =~ m!$dd_dir/rpm/lib/modules/$kernelver/!) {
if (! -d "$dd_dir/initrd_img/lib/modules/$kernelver/initrd") {
@@ -1928,34 +2011,32 @@ sub insert_dd () {
}
}
} # end of loading drivers from rpm packages
}
# Create the dir for driver update disk
mkpath("$dd_dir/initrd_img/cus_driverdisk");
# Create the dir for driver update disk
mkpath("$dd_dir/initrd_img/cus_driverdisk");
# insert the driver update disk into the cus_driverdisk dir
foreach my $dd (@dd_list) {
copy($dd, "$dd_dir/initrd_img/cus_driverdisk");
}
# insert the driver update disk into the cus_driverdisk dir
foreach my $dd (@dd_list) {
copy($dd, "$dd_dir/initrd_img/cus_driverdisk");
}
# Repack the initrd
# In order to avoid the runcmd add the '2>&1' at end of the cpio
# cmd, the echo cmd is added at the end
$cmd = "cd $dd_dir/initrd_img; find . -print | cpio -H newc -o > $dd_dir/initrd | echo";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update disk failed. Could not pack the hacked initrd.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
}
# Repack the initrd
# In order to avoid the runcmd add the '2>&1' at end of the cpio
# cmd, the echo cmd is added at the end
$cmd = "cd $dd_dir/initrd_img; find . -print | cpio -H newc -o > $dd_dir/initrd | echo";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update disk failed. Could not pack the hacked initrd.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
}
# zip the initrd
#move ("$dd_dir/initrd.new", "$dd_dir/initrd");
$cmd = "gzip -f $dd_dir/initrd";
xCAT::Utils->runcmd($cmd, -1);
# zip the initrd
#move ("$dd_dir/initrd.new", "$dd_dir/initrd");
$cmd = "gzip -f $dd_dir/initrd";
xCAT::Utils->runcmd($cmd, -1);
if ($arch =~/ppc/ || (@rpm_list && ($Injectalldriver || @driver_list))) {
if ($arch =~/ppc/) {
if (-r "$dd_dir/rpm/newkernel") {
# if there's new kernel from update distro, then use it
@@ -1999,12 +2080,21 @@ sub insert_dd () {
my $rsp;
if (@dd_list) {
push @{$rsp->{data}}, "Inserted the driver update disk:".join(',', sort(@dd_list)).".";
push @{$rsp->{data}}, "The driver update disk:".join(',',@dd_list)." have been injected to initrd.";
}
if (@driver_list) {
push @{$rsp->{data}}, "Inserted the drivers:".join(',', sort(@rpm_drivers))." from driver packages.";
} elsif (@rpm_list && ($Injectalldriver || @driver_list)) {
push @{$rsp->{data}}, "Inserted the drivers from driver packages:".join(',', sort(@rpm_list)).".";
# remove the duplicated names
my %dnhash;
foreach (@rpm_drivers) {
$dnhash{$_} = 1;
}
@rpm_drivers = keys %dnhash;
if (@rpm_list) {
if (@rpm_drivers) {
push @{$rsp->{data}}, "The drivers:".join(',', sort(@rpm_drivers))." from ".join(',', sort(@rpm_list))." have been injected to initrd.";
} else {
push @{$rsp->{data}}, "No driver was injected to initrd.";
}
}
xCAT::MsgUtils->message("I", $rsp, $callback);

View File

@@ -359,16 +359,16 @@ sub preprocess_updatenode
# check to see if the Management Node is in the noderange and
# if it is abort
my $mname = xCAT::Utils->noderangecontainsMn(@$nodes);
if ($mname)
my @mname = xCAT::Utils->noderangecontainsMn(@$nodes);
if (@mname)
{ # MN in the nodelist
my $nodes=join(',', @mname);
my $rsp = {};
$rsp->{error}->[0] =
"You must not run -k option against the Management Node:$mname.";
"You must not run -k option against a management node: $nodes.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return;
}
# now build a list of all service nodes that are either in the
# noderange or a service node of a node in the noderange
# and update there ssh keys and credentials
@@ -878,11 +878,8 @@ sub updatenode
@::FAILEDNODES=();
#print Dumper($request);
my $nodes = $request->{node};
# $request->{status}= "yes"; for testing
my $requeststatus;
if (defined($request->{status})) {
$requeststatus = $request->{status};
}
#$request->{status}= "yes"; # for testing
$::CALLERCALLBACK=$callback;
my $localhostname = hostname();
# if status return requested
@@ -890,7 +887,7 @@ sub updatenode
# This is an internal call from another plugin requesting status
# currently this is not displayed is only returned and not displayed
# by updatenode.
if (defined($requeststatus) && ($requeststatus eq "yes")) {
if ((defined($request->{status})) && ($request->{status} eq "yes")) {
$numberofnodes = @$nodes;
my $rsp = {};
$rsp->{status}->[0] = "TOTAL NODES: $numberofnodes";
@@ -1061,13 +1058,14 @@ sub updatenode
# check to see if the Management Node is in the noderange and
# if it is abort
my $mname = xCAT::Utils->noderangecontainsMn(@$nodes);
if ($mname)
my @mname = xCAT::Utils->noderangecontainsMn(@$nodes);
if (@mname)
{ # MN in the nodelist
my $nodes=join(',', @mname);
my $rsp = {};
$rsp->{error}->[0] =
"You must not run -k option against the Management Node:$mname.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
"You must not run -k option against a management node: $nodes.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return;
}
@@ -1134,39 +1132,27 @@ sub updatenode
waitpid($_, 0);
}
}
# update the node status, this is done when -F -S -P are run
# make sure the nodes only appear in one array good or bad
&cleanstatusarrays;
if(@::SUCCESSFULLNODES)
{
# if immediate return of status not requested (PCM), then update the DB here
# in one transaction, otherwise it is updated in getdata callback and buildnodestatus
if (!(defined($request->{status})) || ($request->{status} ne "yes")) {
# update the node status, this is done when -F -S -P are run
# make sure the nodes only appear in one array good or bad
&cleanstatusarrays;
if(@::SUCCESSFULLNODES)
{
my $stat="synced";
xCAT::TableUtils->setUpdateStatus(\@::SUCCESSFULLNODES, $stat);
}
if(@::FAILEDNODES)
{
}
if(@::FAILEDNODES)
{
my $stat="failed";
xCAT::TableUtils->setUpdateStatus(\@::FAILEDNODES, $stat);
}
}
# internal call request for status, not output to CLI
if (defined($requeststatus) && ($requeststatus eq "yes")) {
foreach my $n (@::SUCCESSFULLNODES) {
my $rsp = {};
$rsp->{status}->[0] = "$n: SUCCEEDED";
$callback->($rsp);
}
foreach my $n (@::FAILEDNODES) {
my $rsp = {};
$rsp->{status}->[0] = "$n: FAILED";
$callback->($rsp);
}
}
# if site.precreatemypostscripts = not 1 or yes or undefined,
# remove all the
# node files in the noderange in /tftpboot/mypostscripts
@@ -1225,8 +1211,13 @@ sub updatenoderunps
} else {
$nfsv4 = "no";
}
# if running postscript report status here, if requested.
if ((defined($request->{status})) && ($request->{status} eq "yes")) {
$::REPORTSTATUS="Y";
}
# this drives getdata to report status complete for postscripts
$::TYPECALL ="P";
if (($request->{postscripts}) && ($request->{postscripts}->[0]))
{
$orig_postscripts = $request->{postscripts}->[0];
@@ -1334,7 +1325,12 @@ sub updatenoderunps
$subreq, 0, 1
);
}
# report final status PCM
if ((defined($request->{status})) && ($request->{status} eq "yes")) {
my $rsp = {};
$rsp->{status}->[0] = "Running of postscripts has completed.";
$callback->($rsp);
}
return;
}
@@ -1359,6 +1355,16 @@ sub updatenodesyncfiles
my $localhostname = hostname();
my %syncfile_node = ();
my %syncfile_rootimage = ();
# if running -P or -S do not report or no status requested
if ((defined($request->{status})) && ($request->{status} eq "yes")) { # status requested
if (($request->{rerunps} && $request->{rerunps}->[0] eq "yes") ||
($request->{swmaintenance} && $request->{swmaintenance}->[0] eq "yes")){
$::REPORTSTATUS="N";
} else { # report at sync time (-F)
$::REPORTSTATUS="Y";
}
}
my $node_syncfile = xCAT::SvrUtils->getsynclistfile($nodes);
foreach my $node (@$nodes)
{
@@ -1459,6 +1465,12 @@ sub updatenodesyncfiles
xCAT::TableUtils->setUpdateStatus(\@$nodes, $stat);
}
# report final status PCM
if ((defined($request->{status})) && ($request->{status} eq "yes")) {
my $rsp = {};
$rsp->{status}->[0] = "File synchronization has completed.";
$callback->($rsp);
}
return;
}
@@ -1469,6 +1481,7 @@ sub updatenodesyncfiles
Arguments: output,callback
Globals @::SUCCESSFULLNODES, @::FAILEDNODES
$::REPORTSTATUS if "Y" then imediately return status in $::CALLERCALLBACK (PCM)
=cut
@@ -1484,12 +1497,51 @@ sub buildnodestatus
if($line =~ /^\s*(\S+)\s*:\s*Remote_command_successful/)
{
my ($node,$info) = split (/:/, $line);
push(@::SUCCESSFULLNODES,$node);
if ($::REPORTSTATUS eq "Y" ) { # return status NOW
if (grep(/^$node$/, @::FAILEDNODES)) { # already on the fail buffer
my $rsp2 = {}; # report failed
$rsp2->{status}->[0] = "$node: FAILED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="failed";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
} else { # completely successful
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: SUCCEEDED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="synced";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
}
}
if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer
next;
} else {
push(@::SUCCESSFULLNODES,$node);
}
}
elsif($line =~ /^\s*(\S+)\s*:\s*Remote_command_failed/)
{
my ($node,$info)= split (/:/, $line);
push(@::FAILEDNODES,$node);
if ($::REPORTSTATUS eq "Y" ) { # return status NOW
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: FAILED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="failed";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
}
if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer
next;
} else {
push(@::FAILEDNODES,$node);
}
}
else
{
@@ -1557,6 +1609,18 @@ sub updatenodesoftware
my $tftpdir = xCAT::TableUtils->getTftpDir();
my $localhostname = hostname();
my $rsp;
# Determine when to report status, do not report it here if -P is to run
if ((defined($request->{status})) && ($request->{status} eq "yes")) { # if status requested
if ($request->{rerunps} && $request->{rerunps}->[0] eq "yes") { # (-P) running postscripts
$::REPORTSTATUS="N";
} else {
$::REPORTSTATUS="Y";
}
}
# this drives getdata to report status complete for software updatees
$::TYPECALL ="S";
$CALLBACK = $callback;
push @{$rsp->{data}},
"Performing software maintenance operations. This could take a while, if there are packages to install.\n";
@@ -1630,7 +1694,7 @@ sub updatenodesoftware
arg => $args1,
_xcatpreprocessed => [1]
},
\&getdata2
\&getdata
);
@@ -1660,13 +1724,23 @@ sub updatenodesoftware
return 1;
}
}
# report final status PCM
if ((defined($request->{status})) && ($request->{status} eq "yes")) {
my $rsp = {};
$rsp->{status}->[0] = "Running of Software maintenance has completed.";
$callback->($rsp);
}
return;
}
#-------------------------------------------------------------------------------
=head3 getdata - This is the local callback that handles the response from
the xdsh streaming calls when running postscripts
the xdsh streaming calls when running postscripts(-P) and software updates (-S)
$::TYPECALL = P from postscripts runs or S from Software updates
$::CALLERCALLBACK = saved callback from calling routine
$::REPORTSTATUS, if Y, return the good/bad status right away from this
routine to the $::CALLERCALLBACK ( PCM)
=cut
#-------------------------------------------------------------------------------
@@ -1677,6 +1751,7 @@ sub getdata
my $rsp;
foreach my $type (keys %$response)
{
my $alreadyinstalled=0;
foreach my $output (@{$response->{$type}})
{
chomp($output);
@@ -1684,19 +1759,98 @@ sub getdata
if($output =~ /^\s*(\S+)\s*:\s*Remote_command_successful/)
{
my ($node,$info) = split (/:/, $output);
push(@::SUCCESSFULLNODES,$node);
if ($::REPORTSTATUS eq "Y" ) { # return status NOW
if (grep(/^$node$/, @::FAILEDNODES)) { # already on the fail buffer
my $rsp2 = {}; # report failed
$rsp2->{status}->[0] = "$node: FAILED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="failed";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
} else { # completely successful
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: SUCCEEDED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="synced";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
}
}
if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer
next;
} else {
push(@::SUCCESSFULLNODES,$node);
}
}
# check for already installed on software updates, this is not an error
if($output =~ /^\s*(\S+)\s*:\s*already installed/)
{
$alreadyinstalled = 1;
}
if($output =~ /^\s*(\S+)\s*:\s*Remote_command_failed/)
{
my ($node,$info) = split (/:/, $output);
push(@::FAILEDNODES,$node);
if ($alreadyinstalled == 0) { # not an already install error, then real error
if ($::REPORTSTATUS eq "Y" ) { # return status NOW
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: FAILED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="failed";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
}
if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer
next;
} else {
push(@::FAILEDNODES,$node);
}
} else { # already installed is ok
if ($::REPORTSTATUS eq "Y" ) { # return status NOW
if (grep(/^$node$/, @::FAILEDNODES)) { # already on the fail buffer
my $rsp2 = {}; # report failed
$rsp2->{status}->[0] = "$node: FAILED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="failed";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
} else { # completely successful
my $rsp2 = {};
$rsp2->{status}->[0] = "$node: SUCCEEDED";
$::CALLERCALLBACK->($rsp2);
# update the nodelist table updatestatus flag for the node
my $stat="synced";
my @nodearray=();
push @nodearray,$node;
xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat);
}
}
if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer
next;
} else {
push(@::SUCCESSFULLNODES,$node);
}
}
}
if ($output =~ /returned from postscript/)
{
if ($::TYPECALL eq "P") { # -P flag
$output =~
s/returned from postscript/Running of postscripts has completed./;
} else { # should be -S flag
$output =~
s/returned from postscript/Running of Software Maintenance has completed./;
}
}
if ($RERUNPS4SECURITY && $RERUNPS4SECURITY eq "yes")
{
@@ -1720,58 +1874,6 @@ sub getdata
}
$CALLBACK->($rsp);
}
#-------------------------------------------------------------------------------
=head3 getdata2 - This is the local callback that handles the response from
the xdsh streaming calls when running software updates
=cut
#-------------------------------------------------------------------------------
sub getdata2
{
no strict;
my $response = shift;
my $rsp;
foreach my $type (keys %$response)
{
my $alreadyinstalled=0;
foreach my $output (@{$response->{$type}})
{
chomp($output);
$output =~ s/\\cM//;
if($output =~ /^\s*(\S+)\s*:\s*Remote_command_successful/)
{
my ($node,$info) = split (/:/, $output);
push(@::SUCCESSFULLNODES,$node);
}
# check for already installed, this is not an error
if($output =~ /^\s*(\S+)\s*:\s*already installed/)
{
$alreadyinstalled = 1;
}
if($output =~ /^\s*(\S+)\s*:\s*Remote_command_failed/)
{
if ($alreadyinstalled == 0) { # not an already install error
my ($node,$info) = split (/:/, $output);
push(@::FAILEDNODES,$node);
}
}
if ($output =~ /returned from postscript/)
{
$output =~
s/returned from postscript/Running of Software Maintenance has completed./;
}
if (($output !~ /^\s*(\S+)\s*:\s*Remote_command_successful/) && ($output !~ /^\s*(\S+)\s*:\s*Remote_command_failed/))
{
push @{$rsp->{$type}}, "$output";
}
}
}
$CALLBACK->($rsp);
}
#-------------------------------------------------------------------------------
@@ -2342,6 +2444,9 @@ sub updateAIXsoftware
{
%nodeupdateinfo = %{$updates};
}
# this drives getdata to report status complete for software updatees
$::TYPECALL ="S";
my %bndloc;
@@ -2588,7 +2693,7 @@ sub updateAIXsoftware
arg => $args1,
_xcatpreprocessed => [1]
},
\&getdata2
\&getdata
);
# remove pkglist_file from MN - local

View File

@@ -296,7 +296,9 @@ sub setstate {
my $pname = "yaboot.conf-" . $tmp;
unlink($tftpdir."/".$pname);
link($tftpdir."/etc/".$node,$tftpdir."/".$pname);
}
}
return;
}

View File

@@ -2054,27 +2054,24 @@ sub setupMNinDB
my $defined = 0;
my $cmds="XCATBYPASS=Y $::XCATROOT/sbin/tabdump nodelist | grep __mgmtnode";
my $output = xCAT::Utils->runcmd("$cmds", -1);
my @output = xCAT::Utils->runcmd("$cmds", -1);
if ($::RUNCMD_RC == 0) # found a management node defined
{
my $chtabcmds;
my @mn = split(",", $output);
$mn[0] =~ s/"//g; # remove the quotes
if ($mn[0] ne $mnname) { # does not match current host name,delete it
$chtabcmds = "$::XCATROOT/sbin/chtab -d node=$mn[0] nodelist;";
my $outref = xCAT::Utils->runcmd("$chtabcmds", 0);
if ($::RUNCMD_RC != 0)
{
xCAT::MsgUtils->message('E', "Could not run $chtabcmds.");
return;
# Look through the MN list and see if this MN is defined
foreach my $line (@output) {
my @mn = split(",", $line);
$mn[0]=~ s/"//g; # remove the quotes
if ($mn[0] eq $mnname) { # already in the database
verbose("$mnname already defined in the the nodelist table.");
$defined=1;
last;
}
} else { # it is defined and good
xCAT::MsgUtils->message('I', "$mnname already defined in the nodelist table.");
$defined=1;
}
}
# now add with the new name , if not already there
if ($defined ==0) {
}
# now add with the new name , if not already there
if ($defined ==0) {
my $chtabcmds = "$::XCATROOT/sbin/chtab node=$mnname nodelist.groups=__mgmtnode;";
my $outref = xCAT::Utils->runcmd("$chtabcmds", 0);
if ($::RUNCMD_RC != 0)
@@ -2125,9 +2122,10 @@ sub setupMNinDB
}
} else { # it was already defined in the servicenode table
xCAT::MsgUtils->message('I', "$mnname was already defined in the servicenode table.");
verbose("$mnname already defined in the the servicenode table.");
}
xCAT::MsgUtils->message('I', "Management Node defined in the database.");
return;
}
#-----------------------------------------------------------------------------

View File

@@ -39,10 +39,18 @@
# This command can only be run by a root user.
#
####################################################################
BEGIN
{
$::XCATROOT =
$ENV{'XCATROOT'} ? $ENV{'XCATROOT'}
: -d '/opt/xcat' ? '/opt/xcat'
: '/usr';
}
use lib "$::XCATROOT/lib/perl";
use File::Spec;
use Getopt::Long;
use strict;
require xCAT::MsgUtils;
my $OSname;
my @Commands_array;
my $Command_name;
@@ -94,7 +102,7 @@ sub run_cmd {
print "\n\tExecuting: $Command \n";
eval {
local $SIG{ALRM} = sub { die "Timeout\n" };
alarm 60;
alarm 600;
@output = `$Command`;
alarm 0;
};
@@ -193,7 +201,7 @@ sub snap_it {
@files_array = (
"/etc/xcat/*","$::ROOTHOME/.xcat/*", "$INSTALLDIR/autoinst/*",
"$INSTALLDIR/postscripts/*", "$INSTALLDIR/prescripts/*",
"$INSTALLDIR/postscripts/*", "$INSTALLDIR/prescripts/*", "$INSTALLDIR/custom/*",
"/tftpboot/*", "/var/log/consoles/*",
"/etc/*-release", "/etc/dhcpd.conf",
"/var/lib/dhcpd/dhcpd.leases", "/etc/hosts", "/etc/resolv.conf",
@@ -230,7 +238,7 @@ sub snap_it {
"ls $installdir","/usr/bin/crontab -l",
"find /tftpboot -size -32k","ls -lR $xcatroot",
"arp -a","ps -edlf","ps -aux","ulimit -a","df -k",
"cat /etc/issue","lsxcatd -a");
"cat /etc/issue","lsxcatd -a","cat /proc/meminfo", "cat /proc/cpuinfo");
}
foreach my $item (@Commands_array) {
$Command = $item;
@@ -332,7 +340,11 @@ if ($::HELP ) {
exit 0;
}
if ($::VERSION) {
print " xcatsnap tool version 1.0\n";
my $version = xCAT::Utils->Version();
$version .= "\n";
xCAT::MsgUtils->message("N", $version);
exit 0;
exit 0;
}

View File

View File

@@ -0,0 +1,148 @@
#
#cmdline
lang en_US
#
# Where's the source?
# nfs --server hostname.of.server or IP --dir /path/to/RH/CD/image
#
#nfs --server #XCATVAR:INSTALL_NFS# --dir #XCATVAR:INSTALL_SRC_DIR#
url --url http://#TABLE:noderes:$NODE:nfsserver#/install/#TABLE:nodetype:$NODE:os#/#TABLE:nodetype:$NODE:arch#
#device ethernet e100
keyboard "us"
#
# Clear the MBR
#
zerombr
#
# Wipe out the disk
#
clearpart --all --initlabel
#clearpart --linux
key --skip
#
# Customize to fit your needs
#
#XCAT_PARTITION_START#
#No RAID
#/boot really significant for this sort of setup nowadays?
#part /boot --size 50 --fstype ext3
%include /tmp/partitioning
#part swap --size 1024
#part / --size 1 --grow --fstype ext4
#XCAT_PARTITION_END#
#RAID 0 /scr for performance
#part / --size 1024 --ondisk sda
#part swap --size 512 --ondisk sda
#part /var --size 1024 --ondisk sdb
#part swap --size 512 --ondisk sdb
#part raid.01 --size 1 --grow --ondisk sda
#part raid.02 --size 1 --grow --ondisk sdb
#raid /scr --level 0 --device md0 raid.01 raid.02
#Full RAID 1 Sample
#part raid.01 --size 50 --ondisk sda
#part raid.02 --size 50 --ondisk sdb
#raid /boot --level 1 --device md0 raid.01 raid.02
#
#part raid.11 --size 1024 --ondisk sda
#part raid.12 --size 1024 --ondisk sdb
#raid / --level 1 --device md1 raid.11 raid.12
#
#part raid.21 --size 1024 --ondisk sda
#part raid.22 --size 1024 --ondisk sdb
#raid /var --level 1 --device md2 raid.21 raid.22
#
#part raid.31 --size 1024 --ondisk sda
#part raid.32 --size 1024 --ondisk sdb
#raid swap --level 1 --device md3 raid.31 raid.32
#
#part raid.41 --size 1 --grow --ondisk sda
#part raid.42 --size 1 --grow --ondisk sdb
#raid /scr --level 1 --device md4 raid.41 raid.42
#
# bootloader config
# --append <args>
# --useLilo
# --md5pass <crypted MD5 password for GRUB>
#
bootloader
#
# install or upgrade
#
install
#
# text mode install (default is graphical)
#
#text
#
# firewall
#
firewall --disabled
#
# Select a zone
# Add the --utc switch if your hardware clock is set to GMT
#
#timezone US/Hawaii
#timezone US/Pacific
#timezone US/Mountain
#timezone US/Central
#timezone US/Eastern
timezone --utc "#TABLE:site:key=timezone:value#"
#
# Don't do X
#
skipx
#
# To generate an encrypted root password use:
#
# perl -e 'print crypt("blah","Xa") . "\n";'p
# openssl passwd -apr1 -salt xxxxxxxx password
#
# where "blah" is your root password.
#
#rootpw --iscrypted XaLGAVe1C41x2
#rootpw XaLGAVe1C41x2 --iscrypted
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
#
# NIS setup: auth --enablenis --nisdomain sensenet
# --nisserver neptune --useshadow --enablemd5
#
# OR
auth --useshadow --enablemd5
#
# SE Linux
#
selinux --disabled
#
# Reboot after installation
#
reboot
#
#end of section
#
%packages
#INCLUDE_DEFAULT_PKGLIST#
%pre
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh#
%post
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rh#

View File

@@ -221,6 +221,10 @@ echo "part / --size 1 --grow --ondisk $instdisk --fstype $FSTYPE" >> /tmp/partit
# The following code is to generate the repository for the installation
cat /proc/cmdline
export nextserver=`cat /proc/cmdline | grep http | head -n 1 | cut -d / -f 3 | cut -d : -f 1`
NEXTSERVER=`cat /proc/cmdline | grep http | head -n 1`
NEXTSERVER=${NEXTSERVER#*http://}
NEXTSERVER=${NEXTSERVER%%:*}
export nextserver=$NEXTSERVER
#INSTALL_SOURCES_IN_PRE#

View File

@@ -0,0 +1,22 @@
bash
dracut-network
nfs-utils
openssl
dhclient
kernel
openssh-server
openssh-clients
busybox
dash
iputils
bc
irqbalance
procps
wget
vim-minimal
ntp
rpm
rsync
rsyslog
e2fsprogs
parted

View File

@@ -62,6 +62,7 @@ my $rootimg_dir;
my $permission; # the permission works only for statelite mode currently
my $tempfile;
my $prompt;
my $ignorekernelchk;
sub xdie {
@@ -92,6 +93,7 @@ GetOptions(
'driverupdatesrc=s' => \$driverupdatesrc, #internal flag
'interactive' =>\$prompt,
'onlyinitrd' =>\$onlyinitrd,
'ignorekernelchk' => \$ignorekernelchk,
);
if (@ARGV > 0) {
@@ -538,6 +540,14 @@ if (-d "$rootimg_dir/usr/share/dracut") {
print "Enter the dracut mode. Dracut version: $dracutver. Dracut directory: $dracutdir.\n";
}
#-- for centos, disable the internet repository
if( -e "$rootimg_dir/etc/yum.repos.d/CentOS-Base.repo" ) {
my $repo_content=`sed -e '/enabled/d' $rootimg_dir/etc/yum.repos.d/CentOS-Base.repo | sed -e '/^gpgkey/i enabled=0'`;
system("echo '$repo_content' > $rootimg_dir/etc/yum.repos.d/CentOS-Base.repo");
}
#
#-- run postinstall script
unless ($imagename) {
$postinstall_filename= imgutils::get_profile_def_filename($osver, $profile, $arch, $customdir, "postinstall");
@@ -1858,6 +1868,22 @@ sub load_dd ()
if (-d "$dd_dir/rpm/lib/firmware") {
system ("cp -rf $dd_dir/rpm/lib/firmware $rootimg_dir/lib");
}
# if $ignorekernelchk is specified, copy all driver files to target kernel dir
if ($ignorekernelchk) {
my @kernelpath4vrpm = <$dd_dir/rpm/lib/modules/*>;
foreach my $path (@kernelpath4vrpm) {
if ($path eq "$dd_dir/rpm/lib/modules/$kernelver") {
next;
}
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
}
system ("/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver");
}
}
# Copy the drivers to the rootimage
if (-d "$dd_dir/rpm/lib/modules/$kernelver") {
if (@driver_list) {
@@ -1886,6 +1912,8 @@ sub load_dd ()
}
} elsif ($Injectalldriver) {
# copy all the drviers to the rootimage
$driver_name = "\*\.ko";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
my @all_drivers = @all_real_path;
foreach my $new_driver (@all_drivers) {

View File

@@ -60,6 +60,7 @@ my $krpmver;
my $tempfile;
my $prompt;
my $timezone; #the TIMEZONE of the stateless and statelite node
my $ignorekernelchk;
sub xdie {
system("rm -rf /tmp/xcatinitrd.$$");
@@ -106,6 +107,7 @@ GetOptions(
'driverupdatesrc=s' => \$driverupdatesrc, #internal flag
'interactive' =>\$prompt,
'onlyinitrd' =>\$onlyinitrd,
'ignorekernelchk' => \$ignorekernelchk,
);
if (@ARGV > 0) {
@@ -676,6 +678,8 @@ EOS_UNAME
}
system("rm -rf $rootimg_dir/etc/zypp/repos.d/*");
# output the changed the attributes so that it can be save into db by the caller.
# all the information has been gathered
# now, update the linuximage and osimage tables
@@ -1968,6 +1972,22 @@ sub load_dd()
if (-d "$dd_dir/rpm/lib/firmware") {
system ("cp -rf $dd_dir/rpm/lib/firmware $rootimg_dir/lib");
}
# if $ignorekernelchk is specified, copy all driver files to target kernel dir
if ($ignorekernelchk) {
my @kernelpath4vrpm = <$dd_dir/rpm/lib/modules/*>;
foreach my $path (@kernelpath4vrpm) {
if ($path eq "$dd_dir/rpm/lib/modules/$kernelver") {
next;
}
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
}
system ("/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver");
}
}
# Copy the drivers to the rootimage
if (-d "$dd_dir/rpm/lib/modules/$kernelver") {
#mkpath "$rootimg_dir/lib/modules/$kernelver/updates/";
@@ -1997,6 +2017,8 @@ sub load_dd()
}
} elsif ($Injectalldriver) {
# copy all the drviers to the rootimage
$driver_name = "\*\.ko";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
my @all_drivers = @all_real_path;
foreach my $new_driver (@all_drivers) {

View File

@@ -23,7 +23,8 @@ use File::Path;
#process arguments. Currently supported arguments are:
# -c nics_to_configure,
# -u nics_to_unconfigure
# Both arguments are comma separated list of nics, i.e. eth0,eth1,ib0,ib1
# -s nics_to_configured_with_dhcplease
# All the arguments are comma separated list of nics, i.e. eth0,eth1,ib0,ib1
# it is possible that only -u may be specified to unconfigure nics and there will be no
# nics to configure. Likewise, there may be nics to configure but not nics to unconfigure.
my $nics = '';
@@ -52,6 +53,17 @@ while ($a = shift(@ARGV)) {
$rm_nics = $a;
}
}
elsif ($a eq "-s") {
$a = shift(@ARGV);
if (!$a || $a=~/^-/) {
# no arg specified for -s
system("logger -t xcat -p local4.err 'configeth: No argument specified for -s flag'");
exit 1;
}
else {
sprocess($a);
}
}
}
if ( !$nics && !$rm_nics ) {
@@ -592,6 +604,136 @@ for ($j=0; $j < (scalar @nics_to_install); $j++) {
}
exit 0;
sub sprocess () {
my $str_inst_nic = shift;
my $str_lease_file;
my $str_inst_ip;
my $str_inst_mask;
my $str_inst_gateway;
my $str_inst_mac;
my $str_conf_file;
if ($^O =~ /^aix/i) {
system("logger -t xcat -p local4.err 'configeth: aix does not support -s flag'");
exit 0;
} elsif (-r "/etc/debian_version" ){
$str_lease_file = "/var/lib/dhcp/dhclient.".$str_inst_nic.".leases";
if (-r $str_lease_file) {
chomp($str_inst_ip = `grep fixed-address $str_lease_file | tail -n 1 | awk '{print \$2}' | sed 's/;\$//'`);
chomp($str_inst_mask = `grep subnet-mask $str_lease_file | tail -n 1 | awk '{print \$3}' | sed 's/;\$//'`);
chomp($str_inst_gateway = `grep routers $str_lease_file | tail -n 1 | awk '{print \$3}' | sed 's/;\$//'`);
}
} elsif (($ENV{OSVER} && ($ENV{OSVER} =~ /sles|suse/i)) || (-f "/etc/SuSE-release")) {
$str_lease_file = "/var/lib/dhcpcd/dhcpcd-".$str_inst_nic.".info";
if (-r $str_lease_file) {
chomp($str_inst_ip = `grep IPADDR $str_lease_file | tail -n 1 | awk -F'=' '{print \$2}' | sed "s/\'//g"`);
chomp($str_inst_mask = `grep NETMASK $str_lease_file | tail -n 1 | awk -F'=' '{print \$2}' | sed "s/\'//g"`);
chomp($str_inst_gateway = `grep GATEWAYS $str_lease_file | tail -n 1 | awk -F'=' '{print \$2}' | sed "s/\'//g"`);
}
} else {
$str_lease_file = `ls /var/lib/dhclient/*$str_inst_nic* | grep leases`;
chomp($str_lease_file);
if (-r $str_lease_file) {
chomp($str_inst_ip = `grep fixed-address $str_lease_file | tail -n 1 | awk '{print \$2}' | sed 's/;\$//'`);
chomp($str_inst_mask = `grep subnet-mask $str_lease_file | tail -n 1 | awk '{print \$3}' | sed 's/;\$//'`);
chomp($str_inst_gateway = `grep routers $str_lease_file | tail -n 1 | awk '{print \$3}' | sed 's/;\$//'`);
}
}
if($ENV{MACADDRESS}) {
$str_inst_mac = $ENV{MACADDRESS};
} else {
chomp($str_inst_mac = `ifconfig $str_inst_nic | grep HWaddr | awk -F'HWaddr' '{print \$2}' | sed 's/\s*//'`);
}
unless ( "$str_inst_ip" or "$str_inst_mask" ){
system("logger -t xcat -p local4.err 'configeth: config install nic, can not find the information from lease file, return.'");
exit 0
}
if (-r "/etc/debian_version" ) {
$str_conf_file = "/etc/network/interfaces.d/".$str_inst_nic;
if(!open (FILE, ">$str_conf_file")){system("logger -t xcat -p local4.err 'configeth: config install nic, can not open interfaces file, return.'"); exit 1;};
print FILE "auto $str_inst_nic \n";
print FILE "iface $str_inst_nic inet static\n";
print FILE " address $str_inst_ip\n";
print FILE " netmask $str_inst_mask\n";
print FILE " hwaddress ether $str_inst_mac\n";
if ($str_inst_gateway) { print FILE " gateway $str_inst_gateway \n"; }
close FILE;
my $hostname = $ENV{NODE};
`hostname $hostname`;
my $hostfile = "/etc/hostname";
if(!open (FILE, ">$hostfile")){system("logger -t xcat -p local4.err 'configeth: config install nic, can not open $hostfile file, return.'"); exit 1;};
print FILE "$hostname\n";
close FILE;
}
elsif (($ENV{OSVER} && ($ENV{OSVER} =~ /sles|suse/i)) || (-r "/etc/SuSE-release")) {
$str_conf_file="/etc/sysconfig/network/ifcfg-".$str_inst_nic;
if(!open (FILE, ">$str_conf_file")){system("logger -t xcat -p local4.err 'configeth: config install nic, can not open $str_conf_file file, return.'"); exit 1;};
print FILE "DEVICE=$str_inst_nic\n";
print FILE "BOOTPROTO=static\n";
print FILE "IPADDR=$str_inst_ip\n";
print FILE "NETMASK=$str_inst_mask\n";
print FILE "HWADDR=$str_inst_mac\n";
print FILE "STARTMODE=onboot\n";
close FILE;
if ($str_inst_gateway) {
chomp(my $default = `grep -i "default" /etc/sysconfig/network/routes`);
if ($default) {
`sed -i "s/.*default.*/default ${str_inst_gateway} - -/i" /etc/sysconfig/network/routes`;
} else {
`echo "default $str_inst_gateway - -" >> /etc/sysconfig/network/routes`;
}
}
my $node = $ENV{NODE};
`hostname $node`;
my $hostfile = "/etc/HOSTNAME";
if(!open (FILE, ">$hostfile")){system("logger -t xcat -p local4.err 'configeth: config install nic, can not open $hostfile file, return.'"); exit 1;};
print FILE "$ENV{NODE}\n";
close FILE;
}
else {
$str_conf_file="/etc/sysconfig/network-scripts/ifcfg-".$str_inst_nic;
open (FILE, ">$str_conf_file");
print FILE "DEVICE=$str_inst_nic\n";
print FILE "IPADDR=$str_inst_ip\n";
print FILE "NETMASK=$str_inst_mask\n";
print FILE "BOOTPROTO=static\n";
print FILE "ONBOOT=yes\n";
print FILE "HWADDR=$str_inst_mac\n";
close FILE;
my $netfile = "/etc/sysconfig/network";
if(!open (FILE, ">>$netfile")){
system("logger -t xcat -p local4.err 'configeth: can not open $netfile file, return.'");
exit 1;
}
if ($str_inst_gateway) {
chomp(my $gatewayflag = `grep -i "GATEWAY" /etc/sysconfig/network`);
if ($gatewayflag) {
`sed -i "s/.*GATEWAY.*/GATEWAY=$str_inst_gateway/i" /etc/sysconfig/network`;
} else {
print FILE "GATEWAY=$str_inst_gateway\n";
}
}
my $hostname = $ENV{NODE};
`hostname $hostname`;
my $hostflag = `grep -i "HOSTNAME" $netfile`;
if ($hostflag) {
`sed -i "s/.*HOSTNAME.*/HOSTNAME=$hostname/i" /etc/sysconfig/network`;
}else {
print FILE "HOSTNAME=$hostname\n";
}
close FILE;
}
exit 0;
}
sub runcmd {
my $cmd = shift @_;

View File

@@ -286,9 +286,9 @@ do
if [ -f /etc/sysctl.conf ]
then
TMP1=`sed "/net.ipv4.conf.$nic.arp_filter=1/d" /etc/sysctl.conf 2>&1 1>/dev/null`
TMP1=`sed "/net.ipv4.conf.$nic.arp_filter=1/d" /etc/sysctl.conf`
echo "$TMP1" > /etc/sysctl.conf
TMP2=`sed "/net.ipv4.conf.$nic.arp_ignore=1/d" /etc/sysctl.conf 2>&1 1>/dev/null`
TMP2=`sed "/net.ipv4.conf.$nic.arp_ignore=1/d" /etc/sysctl.conf`
echo "$TMP2" > /etc/sysctl.conf
cfg="net.ipv4.conf.$nic.arp_filter=1"
grep "$cfg" /etc/sysctl.conf 2>&1 1>/dev/null

View File

@@ -37,8 +37,7 @@ Requires: /etc/xinetd.d/tftp
Requires: xCAT-buildkit
# yaboot-xcat is pulled in so any MN can manage ppc nodes
#Requires: yaboot-xcat
%endif
%ifarch ppc64
# Stty is only needed for rcons on ppc64 nodes, but for mixed clusters require it on both x and p
Requires: perl-IO-Stty
%endif
%endif

View File

@@ -34,8 +34,7 @@ Requires: /usr/bin/ssh
Requires: /etc/xinetd.d/tftp
# yaboot-xcat is pulled in so any MN can manage ppc nodes
#Requires: yaboot-xcat
%endif
%ifarch ppc64
# Stty is only needed for rcons on ppc64 nodes, but for mixed clusters require it on both x and p
Requires: perl-IO-Stty
%endif
%endif