Compare commits

...

63 Commits

Author SHA1 Message Date
arif 5a8479cd85 update the routes for debian/ubuntu as well 2014-03-28 11:05:37 +00:00
arif f3449882b3 fix minor typo for iface --> ifname 2014-03-27 23:03:19 +00:00
arif 8f3b04bd1a more fixes on device based routing 2014-03-27 22:22:11 +00:00
arif abbd20549a updatedate routes scripts so that we can route through a device 2014-03-27 22:15:08 +00:00
lissav a487eeda81 fix spelling 2014-03-27 13:34:07 -04:00
daniceexi e0ff38a38a refine the output for node resources 2014-03-27 10:18:29 -04:00
mellor e75be5fe88 defect 3998 - change file vars to globals 2014-03-26 17:10:05 -04:00
lissav c822d4f560 defect 3953 2014-03-26 13:08:41 -04:00
ligc 4d262b0db4 doxcat: the ntp -c rv 0 offset may return negative number 2014-03-26 16:02:16 -05:00
ligc fe545184b5 gensis-scripts: doxcat - ntpq -c rv state does not work any more, use the ntpq -c rv offset instead 2014-03-26 14:23:28 -05:00
mellor 2709ec4d25 defect 3964 - clarify mknb man page for hierarchy with sharedtftp=0 2014-03-25 15:59:17 -04:00
lissav 4c88b1b469 defect 3941 2014-03-25 08:11:11 -04:00
ligc 95a3d8ef3c add the centos6.5 discid info, fix a problem in post.xcat 2014-03-25 17:17:00 -05:00
daniceexi 8be3e23145 Change the output format for several URI 2014-03-25 10:18:34 -04:00
litingt 435e989da4 build script for local automation test 2014-03-25 02:45:11 -07:00
immarvin 36c2404d1c add grub2-xcat as a dependency to enable provisioning rhel7 on an ubuntu MN 2014-03-25 01:17:24 -07:00
ligc 9f9768fd28 fix xCAT-genesis-builder/buildrpm for latest mcp version 2014-03-25 14:54:51 -05:00
yinle 194b864487 Merge subroutines to xcatreg 2014-03-25 02:00:50 -07:00
root eb3e5aaee0 wangjunxiaw check autotest script 2014-03-24 18:51:30 -07:00
lissav 0297069b71 remove autosetup of useflowcontorl see 4031 2014-03-24 09:26:46 -04:00
zhaoertao 054ef6d125 rcons support for powerkvm 2014-03-24 02:03:06 -07:00
huweihua ec8a2069cd fix defect 3875 2014-03-24 05:04:30 -04:00
root e60212cfb8 code frame step by step 2014-03-24 01:39:31 -07:00
lissav dba2219b18 update man 2014-03-21 14:52:17 -04:00
lissav 5694147a73 tabprune -a supports all tables 2014-03-21 14:45:56 -04:00
Jarrod Johnson d183a0bb9d Support 'specific' copycds mode.
ESXi releases updates without bumping version numbers.  For such cases,
the default behavior is for the new version to supersede the old.  This
makes sense for the vast majority of cases.  There are, however, corner
cases where being explicit about the release is indicated.
2014-03-21 10:57:42 -04:00
lissav 021b4c69fb fix -L option 2014-03-21 09:57:22 -04:00
lissav 8fcfccb42f add pointer to Easy Regx documentation 2014-03-21 08:02:49 -04:00
immarvin 3fa9fd3e7b append some code logic and documentation for rhels7 support on grub2
Conflicts:

	xCAT-server/lib/xcat/plugins/grub2.pm
2014-03-21 04:53:07 -07:00
zhaoertao 17aa3f84ac support for powerkvm provisioning 2014-03-21 00:14:47 -07:00
huweihua 5a3847d3ea add testcase for xdsh 2014-03-21 02:10:01 -04:00
huweihua 737550e69b add testcase for xdcp 2014-03-21 02:09:21 -04:00
huweihua 25f7bb326e add testcase for sysclone 2014-03-21 02:08:44 -04:00
huweihua 398e63f180 add testcase for pscp 2014-03-21 02:08:10 -04:00
huweihua 0a45d0bcf9 add testcase for prsync 2014-03-21 02:07:38 -04:00
huweihua 1535113fb1 add testcase for ppping 2014-03-21 01:55:20 -04:00
huweihua 43fefadf30 add testcase for makeroutes 2014-03-21 01:53:27 -04:00
huweihua b186280ab8 add testcase for makedns 2014-03-21 01:37:04 -04:00
arif 373cc13aa0 fix bug #4027, replace chop with chomp 2014-03-20 23:10:31 +00:00
lissav 12f1819180 fix defect 3981 2014-03-20 14:22:47 -04:00
linggao b96b2d0ec9 more code for supporting other hardware in OpenStack baremetal driver. 2014-03-21 06:58:10 -04:00
Jia Zhao ff619264a4 fix autodiscovery problem as not run makehosts command 2014-03-20 18:34:41 +08:00
daniceexi 3bac60fac8 add more rest api implementation. refine the doc output 2014-03-20 11:26:50 -04:00
daniceexi 4aafb62e16 add comments for the procedure to handle a restapi request; add comments to describe the definition of URI 2014-03-20 02:13:27 -04:00
Bruce Potter eab4fced6a Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
updated table rest api description
2014-03-19 18:02:24 -04:00
Bruce Potter bd7a9096b2 updated table rest api description 2014-03-19 18:01:58 -04:00
immarvin 9c3ed358b4 fix defect #4030 [DEV]'makedhcp -n' failed to add subnet info to dhcpd.conf on rhels7.0 x86_64 mn 2014-03-19 08:15:58 -07:00
immarvin c2b6d4def1 add rhels7 stateless and statelite support for x86_64 2014-03-19 08:00:45 -07:00
daniceexi 221a6854b7 add more doc info 2014-03-19 10:19:43 -04:00
lissav 149f0fd277 fix defect 4028 2014-03-19 07:23:32 -04:00
litingt 81dc649a24 Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core 2014-03-19 02:10:47 -04:00
litingt a0dc770139 xCAT daily regression tool script 2014-03-19 00:15:48 -04:00
Bruce Potter 7ad5cf800d Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
finished table get rest api calls
2014-03-18 18:47:14 -04:00
Bruce Potter 0bd4753702 finished table get rest api calls 2014-03-18 18:47:01 -04:00
mellor 9a2305dd3a clarify that genimage -i is optional 2014-03-18 14:55:32 -04:00
daniceexi a5ff9cfeec add the mechanism to auto make document for restapi 2014-03-18 10:22:17 -04:00
ligc 707f0c315b xCAT-SoftLayer package is noarch only on Linux, not on AIX 2014-03-18 16:20:19 -05:00
ligc 596aadcd3e xCAT-SoftLayer.spec: cp -a does not work on AIX, change to use -p -R instead 2014-03-18 14:16:55 -05:00
ligc 83732b7b5d makerpm: add copying xcat.conf.apach24 into /SOURCES 2014-03-18 13:56:45 -05:00
ligc 2a65930be9 update with xCAT-OpenStack-baremetal packaging: 1) update xpod2man to not create summary page 2) remove xcat.1.pod from xCAT-OpenStack-baremetal 2014-03-17 23:40:49 -04:00
Bruce Potter 120312c5ea Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
got table rest api call to work for single or multiple node
2014-03-17 18:16:43 -04:00
linggao 5529a93267 fix defect #4023 syntax error 2014-03-18 09:16:25 -04:00
Bruce Potter 79d7b55208 got table rest api call to work for single or multiple node 2014-03-17 18:16:13 -04:00
59 changed files with 5725 additions and 468 deletions
Executable
+106
View File
@@ -0,0 +1,106 @@
#######################################################################
#build script for local usage
#used for Linux/AIX/Ubuntu
#
###########################################################################
OSNAME=$(uname)
NAMEALL=$(uname -a)
echo "OSNAME is $OSNAME!"
echo "NAMEALL is $NAMEALL"
ls /code/xcat-core
if [ $? -gt 0 ]; then
echo "Error:no repo exist, exit 1."
exit 1
fi
# Get a lock, so can not do 2 builds at once
exec 8>/var/lock/xcatbld.lock
if ! flock -n 8; then
echo "Can't get lock /var/lock/xcatbld.lock. Someone else must be doing a build right now. Exiting...."
exit 1
fi
#used only for hard code, will change later
cd /code/xcat-core
rm -rf build/
echo "==============================================="
echo $NAMEALL | egrep "Ubuntu"
#Check if it is an Ubuntu system
if [ $? -eq 0 ]; then
echo "This is an Ubuntu system"
pkg_type="snap"
build_string="Snap_Build"
cur_date=`date +%Y%m%d`
short_ver=`cat Version|cut -d. -f 1,2`
pkg_version="${short_ver}-${pkg_type}${cur_date}"
mkdir -p /code/xcat-core/build
for rpmname in xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test; do
rpmname_low=`echo $rpmname | tr '[A-Z]' '[a-z]'`
echo "============================================"
echo "$rpmname_low"
cd $rpmname
dch -v $pkg_version -b -c debian/changelog $build_string
dpkg-buildpackage -uc -us
rc=$?
if [ $rc -gt 0 ]; then
echo "Error: $rpmname build package failed exit code $rc"
fi
cd -
mv ${rpmname_low}* /code/xcat-core/build
done
#delete all files except .deb file
find /code/xcat-core/build/* ! -name *.deb | xargs rm -f
else
#This is not an Ubuntu system
echo "This is an $OSNAME system"
rm -rf /root/rpmbuild/RPMS/noarch/*
rm -rf /root/rpmbuild/RPMS/x86_64/*
rm -rf /root/rpmbuild/RPMS/ppc64/*
mkdir build/
# Build the rest of the noarch rpms
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-test xCAT-buildkit; do
if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi
./makerpm $rpmname
done
#build xCAT-genesis-scripts if it is x86_64 platform
ARCH=$(uname -p)
if [ "$ARCH" = "x64_64" ]; then
./makerpm xCAT-genesis-scripts x86_64
fi
# Build the xCAT and xCATsn rpms for all platforms
for rpmname in xCAT xCATsn; do
if [ "$OSNAME" = "AIX" ]; then
./makerpm $rpmname
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname"; fi
else
for arch in x86_64 ppc64 s390x; do
./makerpm $rpmname $arch
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS $rpmname-$arch"; fi
done
fi
done
cp /root/rpmbuild/RPMS/noarch/* build/
cp /root/rpmbuild/RPMS/x86_64/* build/
cp /root/rpmbuild/RPMS/ppc64/* build/
fi
+1
View File
@@ -53,6 +53,7 @@ function makexcat {
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/templates.tar templates
gzip -f $RPMROOT/SOURCES/templates.tar
cp xcat.conf $RPMROOT/SOURCES
cp xcat.conf.apach24 $RPMROOT/SOURCES
cp xCATMN $RPMROOT/SOURCES
else # xCATsn
tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/license.tar LICENSE.html
+6
View File
@@ -262,6 +262,12 @@ expression B<($1-1)%14+1> will evaluate to B<6>.
See http://www.perl.com/doc/manual/html/pod/perlre.html for information on perl regular expressions.
=head2 Easy Regular Expressions
As of xCAT 2.8.1, you can use a modified version of the regular expression support described in the previous section. You do not need to enter the node information (1st part of the expression), it will be derived from the input nodename. You only need to supply the 2nd part of the expression to determine the value to give the attribute. For examples, see
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Listing_and_Modifying_the_Database#Easy_Regular_expressions
=head1 OBJECT DEFINITIONS
Because it can get confusing what attributes need to go in what tables, the xCAT database can also
+1 -1
View File
@@ -604,7 +604,7 @@ noderes => {
descriptions => {
node => 'The node name or group name.',
servicenode => 'A comma separated list of node names (as known by the management node) that provides most services for this node. The first service node on the list that is accessible will be used. The 2nd node on the list is generally considered to be the backup service node for this node when running commands like snmove.',
netboot => 'The type of network booting to use for this node. Valid values: pxe or xnba for x86* architecture, yaboot for POWER architecture.',
netboot => 'The type of network booting to use for this node. Valid values: pxe or xnba for x86* architecture, yaboot for POWER architecture, grub2 for RHEL7 on Power. Notice: yaboot is not supported from rhels7 on Power,use grub2 instead',
tftpserver => 'The TFTP server for this node (as known by this node). If not set, it defaults to networks.tftpserver.',
tftpdir => 'The directory that roots this nodes contents from a tftp and related perspective. Used for NAS offload by using different mountpoints.',
nfsserver => 'The NFS or HTTP server for this node (as known by this node).',
+5 -3
View File
@@ -14,9 +14,10 @@ require Exporter;
%distnames = (
"1310229985.226287" => "centos6",
"1323560292.885204" => "centos6.2",
"1341569670.539525" => "centos6.3",#x86
"1362445555.957609" => "centos6.4",#x86_64
"1323560292.885204" => "centos6.2",
"1341569670.539525" => "centos6.3",#x86
"1362445555.957609" => "centos6.4",#x86_64
"1385726732.061157" => "centos6.5",#x86_64
"1176234647.982657" => "centos5",
"1156364963.862322" => "centos4.4",
"1178480581.024704" => "centos4.5",
@@ -89,6 +90,7 @@ require Exporter;
"1273608367.051780" => "SL5.5", #x86_64 DVD ISO
"1299104542.844706" => "SL6", #x86_64 DVD ISO
"1394111947.452332" => "pkvm2.1", # ppc64
);
my %numdiscs = (
"1156364963.862322" => 4,
@@ -497,8 +497,40 @@ sub deploy_ops_bm_node {
return 1;
}
#set boot order, assuming it is ipmi nodes for now
# TODO: add support for system power hw.
#deploy the node now, supported nodehm.mgt values: ipmi, blade,fsp, hmc.
my $hmtab = xCAT::Table->new('nodehm');
my $hment = $hmtab->getNodeAttribs($node,['mgt']);
if ($hment && $hment->{'mgt'}) {
my $mgt = $hment->{'mgt'};
if ($mgt eq 'ipmi') {
deploy_bmc_node($callback, $doreq, $node);
} elsif (($mgt eq 'blade') || ($mgt eq 'fsp')) {
deploy_blade($callback, $doreq, $node);
} elsif ($mgt eq 'hmc') {
deploy_hmc_node($callback, $doreq, $node);
} else {
my $rsp;
push @{$rsp->{data}}, "Node $node: nodehm.mgt=$mgt is not supported in the OpenStack cloud.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
} else {
#nodehm.mgt must setup for node
my $rsp;
push @{$rsp->{data}}, "Node $node: nodehm.mgt cannot be empty in order to deploy.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
# Deploy a rack-mounted node
sub deploy_bmc_node {
my $callback = shift;
my $doreq = shift;
my $node = shift;
#set boot order
my $cmd = qq~net~;
my $output = xCAT::Utils->runxcmd(
{command => ["rsetboot"],
@@ -525,7 +557,62 @@ sub deploy_ops_bm_node {
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
# Deploy a blade or fsp controlled node
sub deploy_blade {
my $callback = shift;
my $doreq = shift;
my $node = shift;
#set boot order
my $cmd = qq~net~;
my $output = xCAT::Utils->runxcmd(
{command => ["rbootseq"],
node => [$node],
arg => [$cmd]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "rbootseq:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
}
#reboot the node
my $cmd = qq~boot~;
my $output = xCAT::Utils->runxcmd(
{command => ["rpower"],
node => [$node],
arg => [$cmd]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "rpower:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
# Deploy a node controlled by HMC
sub deploy_hmc_node {
my $callback = shift;
my $doreq = shift;
my $node = shift;
my $output = xCAT::Utils->runxcmd(
{command => ["rnetboot"],
node => [$node]},
$doreq, -1, 1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "rnetboot:";
push @{$rsp->{data}}, "$output";
xCAT::MsgUtils->message("E", $rsp, $callback);
return 1;
}
}
@@ -168,7 +168,7 @@ class xCATBareMetalDriver(bm_driver.BareMetalDriver):
"""
#import pdb
#pdb.set_trace()
context = nova_context.get_admin_context()
context = nova_context.get_admin_context()
try:
node = bm_driver._get_baremetal_node_by_instance_uuid(instance['uuid'])
+2 -1
View File
@@ -21,7 +21,7 @@ my @pods = getPodList($poddir);
#foreach (@pods) { print "$_\n"; } exit;
# Build the cmd overview page.
writesummarypage("$poddir/man1/xcat.1.pod", @pods);
#writesummarypage("$poddir/man1/xcat.1.pod", @pods);
# Build the man page for each pod.
#mkdir($mandir) or die "Error: could not create $mandir.\n";
@@ -126,6 +126,7 @@ sub getPodList {
# Create the xcat man page that gives a summary description of each xcat cmd.
# Not used
sub writesummarypage {
my $file = shift; # relative path file name of the man page
# the rest of @_ contains the pod files that describe each cmd
+3 -2
View File
@@ -11,8 +11,9 @@ Vendor: IBM Corp.
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
Prefix: /opt/xcat
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
%ifos linux
BuildArch: noarch
%endif
Requires: xCAT-server
#Requires: xCAT-server >= %{epoch}:%(cat Version|cut -d. -f 1,2)
@@ -47,7 +48,7 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
cp -a share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
cp -p -R share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin
chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
+5 -7
View File
@@ -117,7 +117,7 @@ if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) {
if ($? == 0) {
if (($tmpimgs) && ($tmpimgs !~ /^Could/)) { #Could is returned when the osimage table is empty
my @images=split('\n', $tmpimgs);
print "Do you want to re-genarate an existing image from the osimage table? ";
print "Do you want to re-generate an existing image from the osimage table? ";
print "[y/n] ";
my $conf = <stdin>;
chomp($conf);
@@ -128,7 +128,7 @@ if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) {
foreach(sort @images){
print " $_\n";
}
# default is the first image cause in many cases
# default is the first image
print "Which image do you want to re-generate? [";
print $images[0];
print "] ";
@@ -294,13 +294,10 @@ if ($profile) { print " Profile: $profile\n"; }
# get the interface
if ((!$imagename) && (!$interface)){
while(1){
print "Which network interface do you want the image to boot from? [";
print "eth0";
print "] ";
print "OPTIONAL: Which specific network interface will the image boot from? [<blank>]";
$interface = <stdin>;
chomp($interface);
if($interface eq ""){
$interface = "eth0";
last;
}else{
print "You want your stateless machines to boot off of ";
@@ -317,8 +314,9 @@ if ((!$imagename) && (!$interface)){
}
}
}
if ($interface) { print " Interface: $interface\n"; }
else { print " No interface specified. The interface will be determined at network boot time.\n"; }
}
if ($interface) { print " Interface: $interface\n"; }
+2 -2
View File
@@ -205,10 +205,10 @@ if ($::osname eq 'AIX')
&setulimits;
}
# if not just odbc update and not already running mysql or mysqlsetup -u
# if not just odbc update and not already running mysql or mysqlsetup -u or -L
# Get root and admin passwords
#
if ((($odbconly == 0) && ( $::xcatrunningmysql == 0)) || $::UPDATE )
if ((($odbconly == 0) && ( $::xcatrunningmysql == 0)) || $::UPDATE || $::SETUPLL )
{ # not just updating the odbc
if ($ENV{'XCATMYSQLADMIN_PW'}) # input env sets the password
{
+47 -41
View File
@@ -6,10 +6,10 @@ B<genimage> - Generates a stateless image to be used for a diskless install.
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>] [B<--ignorekernelchk>] 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<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
@@ -17,43 +17,43 @@ B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
=head1 DESCRIPTION
Generates a stateless and a statelite image that can be used to boot xCAT nodes in a diskless mode.
If I<imagename> is not specified, the default packages included
(and excluded) in the image are specified by
The I<imagename> format of the command is recommended. When specified, genimage will use the osimage definition for information to generate this image. Additional options specified on the command line will override any corresponding previous osimage settings, and will be written back to the osimage definition.
If I<imagename> is not specified (old method):
- the default packages included (and excluded) in the image are specified by
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].pkglist and
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].exlist.
Additional packages that are not from the os distro can be specified in a
- Additional packages that are not from the os distro can be specified in a
/opt/xcat/share/xcat/netboot/<os>/<profile>[.<osver>][.<arch>].otherpkgs.pkglist file.
Customized package list files can be specified under /install/custom/netboot/<os> directory. The generated image will be put in /install/netboot/<osver>/<arch>/<profile> directory.
- Customized package list files will override these files and can be specified under /install/custom/netboot/<os> directory.
- The generated image will be put in /install/netboot/<osver>/<arch>/<profile> directory.
The newly generated image names will have the following format:
- osimage definitions will be created in the I<linuximage> and I<osimage> tables. The newly generated image names will have the following format:
for stateless: <osver>-<arch>-netboot-<profile>
for stateless: <osver>-<arch>-netboot-<profile>
for statelite: <osver>-<arch>-statelite-<profile>
for statelite: <osver>-<arch>-statelite-<profile>
B<genimage> command will create them into I<linuximage> and I<osimage> tables.
If I<imagename> is specified, the package list file names are read from the I<osimage> table and I<linuximage> tables.
If B<genimage> runs on the management node, both the I<osimage> table and I<linuximage> table will be updated with the given values from the options.
The B<genimage> command will generate two initial ramdisks for B<stateless> and B<statelite>, one is B<initrd-stateless.gz>, the other one is B<initrd-statelite.gz>.
After your image is created, you can chroot to the
After your image is generated, you can chroot to the
image, install any additional software you would like, or make modifications to files, and then run the following command to prepare the image for deployment.
for stateless: B<packimage>
for statelite: B<liteimg>
Becides prompting for the input for some paramters, the B<genimage> command takes default quesses for the parameters not specified or not defined in the I<osimage> and I<linuximage> tables. It also makes default answers for questions from yum/zypper command when installing rpms into the image. Please use --interactive flag if you want yum/zypper command to prompt you for the answers.
Besides prompting for some paramter values, the B<genimage> command takes default guesses for the parameters not specified or not defined in the I<osimage> and I<linuximage> tables. It also assumes default answers for questions from the yum/zypper command when installing rpms into the image. Please use --interactive flag if you want the yum/zypper command to prompt you for the answers.
If B<--onlyinitrd> is specified, only regenerates the initrd for a stateless image to be used for a diskless install.
If B<--onlyinitrd> is specified, genimage only regenerates the initrd for a stateless image to be used for a diskless install.
The B<genimage> command must be run on a system that is the same architecture and same distro with same major release version as the nodes it will be
used on. If the management node is not the same architecture or same distro level, copy the contents of
@@ -61,10 +61,9 @@ used on. If the management node is not the same architecture or same distro lev
the management node to that system. Then change directory to /opt/xcat/share/xcat/netboot/<os> and run ./genimage.
=head1 Parameters
I<imagename> specifies the name of a os image definition to be used. The specification for the image is storted in the I<osimage> table and I<linuximage> table.
I<imagename> specifies the name of an os image definition to be used. The specification for the image is stored in the I<osimage> table and I<linuximage> table.
=head1 OPTIONS
@@ -88,7 +87,7 @@ the nodes' nodetype.profile attribute must be set to this same value.
=item B<-i> I<nodebootif>
The network interface the diskless node will boot over (e.g. eth0).
This argument is now optional, and allows you to specify the network boot interface to be configured in the image (e.g. eth0). If not specified, the interface will be determined and configured during the network boot process.
=item B<-n> I<nodenetdrivers>
@@ -183,46 +182,53 @@ To prompt the user for inputs:
genimage
=item 2
To generate an image using information from an osimage definition:
To generate a fedora8 image for a compute node architecture
genimage myimagename
=item 3
To run genimage in test mode without actually generating an image:
genimage --dryrun myimagename
=item 4
To generate an image and have yum/zypper prompt for responses:
genimage myimagename --interactive
=item 5
To generate an image, replacing some values in the osimage definition:
genimage -i eth0 -n tg3 myimagename
=item 6
(old method) To generate a fedora8 image for a compute node architecture
x86_64 and place it in the
/install/netboot/fedora8/x86_64/compute/rootimg directory:
genimage -i eth0 -o fedora8 -p compute
=item 3
=item 7
(old method)
genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute
=item 4
=item 8
(old method)
genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute --interactive
=item 5
=item 9
(old method)
genimage -i eth0 -n igb,e1000e,e1000,bnx2,tg3 -o centos5.4 -p nfsroot --permission 777
=item 6
genimage -i eth0 -n tg3 myimagename
=item 7
genimage myimagename
=item 8
genimage myimagename --interactive
=item 9
To regenerate the initrd for a fedora8 image for a compute node architecture x86_64 and place it in the /install/netboot/fedora8/x86_64/compute/rootimg directory: change directory to /opt/xcat/share/xcat/netboot/fedora and run:
genimage --onlyinitrd -i eth0 -n tg3,bnx2 -o fedora8 -p compute
=item 10
(old method)
To regenerate the initrd for a fedora8 image for a compute node architecture x86_64 and place it in the /install/netboot/fedora8/x86_64/compute/rootimg directory:
genimage --dryrun myimagename
cd /opt/xcat/share/xcat/netboot/fedora
./genimage --onlyinitrd -i eth0 -n tg3,bnx2 -o fedora8 -p compute
=back
+1 -1
View File
@@ -28,7 +28,7 @@ A network B<domain> and B<nameservers> values must be provided either in the B<n
Only entries in /etc/hosts or the hosts specified by B<noderange> that have a corresponding xCAT network definition will be added to DNS.
By default, B<makedns> sets up the B<named> service and updates the DNS records on the local system (mamagement node). If the -e flag is specified, it will also update the DNS records on any external DNS server that is listed in the /etc/resolv.conf on the management node. (Assuming the external DNS server can recognize the xCAT key as authentication.)
By default, B<makedns> sets up the B<named> service and updates the DNS records on the local system (management node). If the -e flag is specified, it will also update the DNS records on any external DNS server that is listed in the /etc/resolv.conf on the management node. (Assuming the external DNS server can recognize the xCAT key as authentication.)
For more information on Cluster Name Resolution:
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Cluster_Name_Resolution
+6 -1
View File
@@ -12,7 +12,12 @@ B<mknb> I<arch>
The B<mknb> command is run by xCAT automatically, when xCAT is installed on the management node.
It creates a network boot root image (used for node discovery, BMC programming, and flashing)
for the same architecture that the management node is. So you normally do not need to run the B<mknb>
command yourself. Presently, only the arch x86_64 is supported.
command yourself.
If you do run B<mknb> to add custom utilities to your boot root image, and you have an xCAT Hierarchical Cluster with service nodes that each have a local /tftpboot directory (site sharedtftp=0), you will also need to copy the generated root image to each service node.
Presently, only the arch x86_64 is supported.
=head1 OPTIONS
+4 -2
View File
@@ -6,11 +6,13 @@ B<tabprune> - Deletes records from the eventlog,auditlog,isnm_perf,isnm_perf_sum
B<tabprune> B<eventlog | auditlog> [B<-V>] B<-i> I<recid> |B<-n> I<number of records> | B<-p> I<percentage> | B<-d> I<number of days> | B<-a>
B<tabprune> B<tablename> B<-a>
B<tabprune> [B<-h>|B<--help>] [B<-v>|B<--version>]
=head1 DESCRIPTION
The tabprune command is used to delete records from the auditlog,eventlog,isnm_perf,isnm_perf_sum tables. As an option, the table header and all the rows pruned from the specified table will be displayed in CSV (comma separated values) format.
The tabprune command is used to delete records from the auditlog,eventlog,isnm_perf,isnm_perf_sum tables. As an option, the table header and all the rows pruned from the specified table will be displayed in CSV (comma separated values) format. The all records options (-a) can be used on any xCAT table.
=head1 OPTIONS
@@ -27,7 +29,7 @@ you want to redirect them to a file to archive them.
=item B<-a>
Remove all records.
Remove all records from the input table name. This option can be used on any xCAT table.
=item B<-i> I<recid number>
+8
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
+3 -1
View File
@@ -103,7 +103,9 @@ done
echo -n "Acquired IPv4 address on $bootnic: "
ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}'
ntpd -g -x
(while ! ntpq -c "rv 0 state"|grep 'state=4' > /dev/null; do sleep 1; done; hwclock --systohc) &
# rv 0 state does not work with the new ntp versions
#(while ! ntpq -c "rv 0 state"|grep 'state=4' > /dev/null; do sleep 1; done; hwclock --systohc) &
(while [ "`ntpq -c \"rv 0 offset\" | grep \"offset=\" | awk -F \"=\" '{print $2}' | awk -F \".\" '{print $1}' | sed s/-//`" -ge 1000 ]; do sleep 1; done; hwclock --systohc) &
if dmidecode|grep IPMI > /dev/null; then
modprobe ipmi_si
modprobe ipmi_devintf
+1 -1
View File
@@ -7,6 +7,6 @@ Standards-Version: 3.7.2
Package: xcat-server
Architecture: all
Depends: ${perl:Depends}, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl
Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl
Description: Server and configuration utilities of the xCAT management project
xCAT-server provides the core server and configuration management components of xCAT. This package should be installed on your management server
+41 -5
View File
@@ -39,11 +39,27 @@ sub getIPMIAuth {
if (defined($tmp)) {
$ipmiuser = $tmp->{username};
$ipmipass = $tmp->{password};
if ($ipmiuser or $ipmipass) {
unless($ipmiuser) {
$ipmiuser = '';
}
unless($ipmipass) {
$ipmipass = '';
}
}
}
($tmp)=$passtab->getAttribs({'key'=>'blade'},'username','password');
if (defined($tmp)) {
$bladeuser = $tmp->{username};
$bladepass = $tmp->{password};
if ($bladeuser or $bladepass) {
unless($bladeuser) {
$bladeuser = '';
}
unless($bladepass) {
$bladepass = '';
}
}
}
}
my $mpatab;
@@ -58,9 +74,19 @@ sub getIPMIAuth {
my $mpa = $mphash->{$node}->[0]->{mpa};
if (not $mpaauth{$mpa} and $mpatab) {
my $mpaent = $mpatab->getNodeAttribs($mpa,[qw/username password/],prefetchcache=>1); #TODO: this might make more sense to do as one retrieval, oh well
if (ref $mpaent and $mpaent->{username}) { $mpaauth{$mpa}->{username} = $mpaent->{username} }
if (ref $mpaent and $mpaent->{password}) { $mpaauth{$mpa}->{password} = $mpaent->{password} }
$mpaauth{$mpa}->{checked} = 1; #remember we already looked this up, to save lookup time even if search was fruitless
if (ref $mpaent and ($mpaent->{username} or $mpaent->{password})) {
if (!exists($mpaent->{username})) {
$mpaauth{$mpa}->{username} = '';
} else {
$mpaauth{$mpa}->{username} = $mpaent->{username};
}
if (!exists($mpaent->{password})) {
$mpaauth{$mpa}->{password} = '';
} else {
$mpaauth{$mpa}->{password} = $mpaent->{password};
}
}
$mpaauth{$mpa}->{checked} = 1; #remember we already looked this up, to save lookup time even if search was fruitless
}
if ($mpaauth{$mpa}->{username}) { $authmap{$node}->{username} = $mpaauth{$mpa}->{username}; $authmap{$node}->{cliusername}=$mpaauth{$mpa}->{username}; }
if ($mpaauth{$mpa}->{password}) { $authmap{$node}->{password} = $mpaauth{$mpa}->{password} ; $authmap{$node}->{clipassword}=$mpaauth{$mpa}->{password} }
@@ -68,8 +94,18 @@ sub getIPMIAuth {
unless (ref $ipmihash and ref $ipmihash->{$node}) {
next;
}
if ($ipmihash->{$node}->[0]->{username}) { $authmap{$node}->{username}=$ipmihash->{$node}->[0]->{username} }
if ($ipmihash->{$node}->[0]->{password}) { $authmap{$node}->{password}=$ipmihash->{$node}->[0]->{password} }
if ($ipmihash->{$node}->[0]->{username} or $ipmihash->{$node}->[0]->{password}) {
unless($ipmihash->{$node}->[0]->{username}) {
$authmap{$node}->{username} = '';
} else {
$authmap{$node}->{username}=$ipmihash->{$node}->[0]->{username};
}
unless($ipmihash->{$node}->[0]->{password}) {
$authmap{$node}->{password} = '';
} else {
$authmap{$node}->{password}=$ipmihash->{$node}->[0]->{password};
}
}
}
return \%authmap;
}
+3
View File
@@ -587,9 +587,11 @@ sub setup_DHCP
# setup DHCP
#
# clean up $::opt_n which set by last makedhcp context and conlicts with -a below.
undef $::opt_n;
my $modname = "dhcp";
if ($snonly != 1) { # setup dhcp for all nodes
$cmdref;
@@ -1213,6 +1215,7 @@ sub setup_TFTP
push @{$netmethods{$hmhash{$_}->[0]->{netboot}}}, $_;
}
}
$::DISABLENODESETWARNING=1; # stop the warnings about using install/netboot etc
$cmdref->{command}->[0] = "nodeset";
$cmdref->{inittime}->[0] = "1";
$cmdref->{arg}->[0] = "enact";
+22 -7
View File
@@ -40,7 +40,7 @@ sub handled_commands
return {
copycd => "anaconda",
mknetboot => "nodetype:os=(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)",
mkinstall => "nodetype:os=(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)",
mkinstall => "nodetype:os=(pkvm.*)|(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)",
mksysclone => "nodetype:os=(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)",
mkstatelite => "nodetype:os=(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)",
@@ -257,6 +257,7 @@ sub mknetboot
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm
$callback->(
{
warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset <noderange> osimage=<osimage_name>\" instead."],
@@ -264,6 +265,7 @@ sub mknetboot
);
# Do not print this warning message multiple times
last;
}
}
}
}
@@ -930,10 +932,6 @@ sub mknetboot
);
}
#my $rc = xCAT::TableUtils->create_postscripts_tar();
#if ( $rc != 0 ) {
# xCAT::MsgUtils->message( "S", "Error creating postscripts tar file." );
#}
}
sub mkinstall
@@ -1001,6 +999,7 @@ sub mkinstall
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm
$callback->(
{
warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset <noderange> osimage=<osimage_name>\" instead."],
@@ -1008,6 +1007,7 @@ sub mkinstall
);
# Do not print this warning message multiple times
last;
}
}
}
}
@@ -1287,7 +1287,11 @@ sub mkinstall
my $kernpath;
my $initrdpath;
my $maxmem;
my $esxi = 0;
my $esxi = 0;
my $pkvm = 0;
if ($os =~ /^pkvm/) {
$pkvm = 1;
}
if (
(
@@ -1383,11 +1387,16 @@ sub mkinstall
} else {
$httpprefix =~ s/^$installroot/\/install/;
}
my $kcmdline =
my $kcmdline;
if ($pkvm) {
$kcmdline = "ksdevice=bootif kssendmac text selinux=0 rd.dm=0 rd.md=0 repo=$httpmethod://$instserver:$httpport$httpprefix/packages/ kvmp.inst.auto=$httpmethod://$instserver:$httpport/install/autoinst/$node root=live:$httpmethod://$instserver:$httpport$httpprefix/LiveOS/squashfs.img";
} else {
$kcmdline =
"quiet repo=$httpmethod://$instserver:$httpport$httpprefix ks=$httpmethod://"
. $instserver . ":". $httpport
. "/install/autoinst/"
. $node;
}
if ($maxmem) {
$kcmdline.=" mem=$maxmem";
}
@@ -1482,6 +1491,9 @@ sub mkinstall
foreach(@addfiles){
$kcmdline .= " --- $rtftppath/$_";
}
}elsif ($pkvm) {
$k = "$httpmethod://$instserver:$httpport$tftppath/vmlinuz";
$i = "$httpmethod://$instserver:$httpport$tftppath/initrd.img";
}else{
$k = "$rtftppath/vmlinuz";
$i = "$rtftppath/initrd.img";
@@ -1577,6 +1589,7 @@ sub mksysclone
my $site_ent = $ents[0];
if (!defined($site_ent) || ($site_ent =~ /no/i) || ($site_ent =~ /0/))
{
if (!defined($::DISABLENODESETWARNING)) { # set by AAsn.pm
$callback->(
{
warning => ["The options \"install\", \"netboot\", and \"statelite\" have been deprecated. They should continue to work in this release, but have not been tested as carefully, and some new functions are not available with these options. For full function and support, use \"nodeset <noderange> osimage=<osimage_name>\" instead."],
@@ -1584,6 +1597,7 @@ sub mksysclone
);
# Do not print this warning message multiple times
last;
}
}
}
}
@@ -1987,6 +2001,7 @@ sub copycd
and $distname !~ /^fedora/
and $distname !~ /^SL/
and $distname !~ /^ol/
and $distname !~ /^pkvm/
and $distname !~ /^rh/)
{
+6
View File
@@ -43,6 +43,7 @@ sub process_request {
my $path=undef;
my $noosimage=undef;
my $nonoverwrite=undef;
my $specific=undef;
$identified=0;
$::CDMOUNTPATH="/var/run/xcat/mountpoint";
@@ -58,6 +59,7 @@ sub process_request {
'i|inspection' => \$inspection,
'p|path=s' => \$path,
'o|noosimage' => \$noosimage,
's|specific' => \$specific,
'w|nonoverwrite' => \$nonoverwrite,
);
if ($help) {
@@ -143,6 +145,10 @@ sub process_request {
{
push @{$newreq->{arg}},("-p",$path);
}
if($specific)
{
push @{$newreq->{arg}},("-s");
}
if($inspection)
{
+16 -2
View File
@@ -284,8 +284,22 @@ sub setdestiny {
}
}
}
#if the postscripts directory exists then make sure it is
# world readable and executable by root; otherwise wget fails
my $installdir = xCAT::TableUtils->getInstallDir();
my $postscripts = "$installdir/postscripts";
if (-e $postscripts)
{
my $cmd = "chmod -R a+r $postscripts";
xCAT::Utils->runcmd($cmd, 0);
my $rsp = {};
if ($::RUNCMD_RC != 0)
{
$callback->({info=>"$cmd failed"});
}
}
#print Dumper($req);
# if precreatemypostscripts=1, create each mypostscript for each node
# otherwise, create it during installation /updatenode
+33 -2
View File
@@ -881,6 +881,37 @@ sub check_options
xCAT::MsgUtils->message("I", $rsp, $callback, 0);
return 0;
}
# if not help, dhcpd needs to be running
if (!($opt->{h})) {
if (xCAT::Utils->isLinux()) {
my @output = xCAT::Utils->runcmd("service dhcpd status", -1);
if ($::RUNCMD_RC != 0) { # not running
my $rsp = {};
$rsp->{data}->[0] = "dhcpd is not running. Run service dhcpd start and rerun your command.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
} else { # AIX
my @output = xCAT::Utils->runcmd("lssrc -s dhcpsd ", -1);
if ($::RUNCMD_RC != 0) { # not running
my $rsp = {};
$rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
} else { # check the status
# the return output varies, sometime status is the third sometimes the 4th col
if (grep /inoperative/, @output)
{
my $rsp = {};
$rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
}
}
}
# check to see if -q is listed with any other options which is not allowed
if ($opt->{q} and ($opt->{a} || $opt->{d} || $opt->{n} || $opt->{r} || $opt->{l} || $statements)) {
@@ -956,7 +987,7 @@ sub preprocess_request
if ( $rc ) {
return [];
}
my $snonly=0;
my @entries = xCAT::TableUtils->get_site_attribute("disjointdhcps");
my $t_entry = $entries[0];
@@ -1442,7 +1473,7 @@ sub process_request
next;
}
}
if ($ent[1] =~ m/(remote|ipoib|ib|vlan|bond|eth|myri|man|wlan|en\d+|em\d+)/)
if ($ent[1] =~ m/(remote|ipoib|ib|vlan|bond|eth|myri|man|wlan|en\S*\d+|em\S*\d+)/)
{ #Mask out many types of interfaces, like xCAT 1.x
$activenics{$ent[1]} = 1;
}
+31 -1
View File
@@ -4333,10 +4333,12 @@ sub copycd {
}
#}
@ARGV = @{$request->{arg}};
my $includeupdate = 0;
GetOptions(
'n=s' => \$distname,
'a=s' => \$arch,
'm=s' => \$path
'm=s' => \$path,
's' => \$includeupdate
);
# run a few tests to see if the copycds should use this plugin
unless ($path){
@@ -4428,6 +4430,34 @@ sub copycd {
}
}
close(LINE);
} elsif (-r $path . "/upgrade/metadata.xml") {
open(LINE,$path."/upgrade/metadata.xml");
my $detectdistname;
while (<LINE>) {
if (/esxVersion>([^<]*)</) {
my $version = $1;
while ($version =~ /\.0$/) {
$version =~ s/\.0$//;
}
$darch="x86_64";
$arch="x86_64";
$detectdistname = 'esxi' . $version;
$found=1;
} elsif (/esxRelease>([^<]*)</) {
unless ($includeupdate) {
next;
}
my $release = $1;
while ($release =~ /\.0$/) {
$release =~ s/\.0$//;
}
unless ($release ne "0") {
next;
}
$detectdistname .= '_' . $release;
}
}
unless ($distname) { $distname=$detectdistname; }
} elsif (-r $path . "/vmware-esx-base-readme") {
open(LINE,$path."/vmware-esx-base-readme");
while (<LINE>) {
+630
View File
@@ -0,0 +1,630 @@
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT_plugin::grub2;
use Data::Dumper;
use Sys::Syslog;
use xCAT::Scope;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::NetworkUtils;
use xCAT::MsgUtils;
use File::Path;
use Socket;
use Getopt::Long;
use xCAT::Table;
my $request;
my %breaknetbootnodes;
our %normalnodes;
my %tftpserverip;
my $callback;
my $sub_req;
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
my %usage = (
"nodeset" => "Usage: nodeset <noderange> [install|shell|boot|runcmd=bmcsetup|netboot|iscsiboot|osimage[=<imagename>]|offline]",
);
sub handled_commands {
return {
nodeset => "noderes:netboot"
}
}
sub check_dhcp {
return 1;
#TODO: omapi magic to do things right
my $node = shift;
my $dhcpfile;
open ($dhcpfile,$dhcpconf);
while (<$dhcpfile>) {
if (/host $node\b/) {
close $dhcpfile;
return 1;
}
}
close $dhcpfile;
return 0;
}
sub _slow_get_tftpdir { #make up for paths where tftpdir is not passed in
my $node=shift;
my $nrtab = xCAT::Table->new('noderes',-create=>0); #in order to detect per-node tftp directories
unless ($nrtab) { return $globaltftpdir; }
my $ent = $nrtab->getNodeAttribs($node,["tftpdir"]);
if ($ent and $ent->{tftpdir}) {
return $ent->{tftpdir};
} else {
return $globaltftpdir;
}
}
sub getstate {
my $node = shift;
my $tftpdir = shift;
unless ($tftpdir) { $tftpdir = _slow_get_tftpdir($node); }
if (check_dhcp($node)) {
if (-r $tftpdir . "/boot/grub2/".$node) {
my $fhand;
open ($fhand,$tftpdir . "/boot/grub2/".$node);
my $headline = <$fhand>;
close $fhand;
$headline =~ s/^#//;
chomp($headline);
return $headline;
} else {
return "boot";
}
} else {
return "discover";
}
}
sub setstate {
=pod
This function will manipulate the grub structure to match what the noderes/chain tables indicate the node should be booting.
=cut
my $node = shift;
my %bphash = %{shift()};
my %chainhash = %{shift()};
my %machash = %{shift()};
my $tftpdir = shift;
my %nrhash = %{shift()};
my $linuximghash = shift();
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if ($kern->{kcmdline} =~ /!myipfn!/) {
my $ipfn = xCAT::NetworkUtils->my_ip_facing($node);
unless ($ipfn) {
my $servicenodes = $nrhash{$node}->[0];
if ($servicenodes and $servicenodes->{servicenode}) {
my @sns = split /,/, $servicenodes->{servicenode};
foreach my $sn ( @sns ) {
# We are in the service node pools, print error if no facing ip.
if (xCAT::InstUtils->is_me($sn)) {
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$::callback->(
{
error => [
"$myname: Unable to determine the image server for $node on service node $sn"
],
errorcode => [1]
}
);
return;
}
}
} else {
$::callback->(
{
error => [
"$myname: Unable to determine the image server for $node"
],
errorcode => [1]
}
);
return;
}
} else {
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
}
}
if ($kern->{addkcmdline}) {
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
}
if($linuximghash and $linuximghash->{'addkcmdline'})
{
unless($linuximghash->{'boottarget'})
{
$kern->{kcmdline} .= " ".$linuximghash->{'addkcmdline'};
}
}
my $pcfg;
unless (-d "$tftpdir/boot/grub2") {
mkpath("$tftpdir/boot/grub2");
}
my $nodemac;
my %client_nethash = xCAT::DBobjUtils->getNetwkInfo( [$node] );
open($pcfg,'>',$tftpdir."/boot/grub2/".$node);
my $cref=$chainhash{$node}->[0]; #$chaintab->getNodeAttribs($node,['currstate']);
if ($cref->{currstate}) {
print $pcfg "#".$cref->{currstate}."\n";
}
print $pcfg "set timeout=5\n";
$normalnodes{$node}=1; #Assume a normal netboot (well, normal dhcp,
#which is normally with a valid 'filename' field,
#but the typical ppc case will be 'special' makedhcp
#to clear the filename field, so the logic is a little
#opposite
if ($cref and $cref->{currstate} eq "boot") {
$breaknetbootnodes{$node}=1;
delete $normalnodes{$node}; #Signify to omit this from one makedhcp command
close($pcfg);
} elsif ($kern and $kern->{kernel}) {
#It's time to set grub configuration for this node to boot the kernel..
#get tftpserver
my $tftpserver;
if (defined ($nrhash{$node}->[0]) && $nrhash{$node}->[0]->{'tftpserver'}) {
$tftpserver = $nrhash{$node}->[0]->{'tftpserver'};
} elsif (defined ($nrhash{$node}->[0]) && $nrhash{$node}->[0]->{'xcatmaster'}) {
$tftpserver = $nrhash{$node}->[0]->{'xcatmaster'};
} else {
my @master = xCAT::TableUtils->get_site_attribute("master");
$tftpserver = $master[0];
}
my $serverip;
if (defined ($tftpserverip{$tftpserver})) {
$serverip = $tftpserverip{$tftpserver};
} else {
$serverip = xCAT::NetworkUtils->getipaddr($tftpserver);
unless ($serverip) {
syslog("local1|err","xCAT unable to resolve $tftpserver");
return;
}
$tftpserverip{$tftpserver} = $serverip;
}
print $pcfg "set default=\"xCAT OS Deployment\"\n";
print $pcfg "menuentry \"xCAT OS Deployment\" {\n";
print $pcfg " insmod http\n";
print $pcfg " insmod tftp\n";
print $pcfg " set root=http,$serverip\n";
print $pcfg " echo Loading Install kernel ...\n";
if ($kern and $kern->{kcmdline}) {
print $pcfg " linux $tftpdir/$kern->{kernel} $kern->{kcmdline}\n";
} else {
print $pcfg " linux $tftpdir/$kern->{kernel}\n";
}
print $pcfg " echo Loading initial ramdisk ...\n";
if ($kern and $kern->{initrd}) {
print $pcfg " initrd $tftpdir/$kern->{initrd}\n";
}
print $pcfg "}";
close($pcfg);
my $inetn = xCAT::NetworkUtils->getipaddr($node);
unless ($inetn) {
syslog("local1|err","xCAT unable to resolve IP for $node in grub2 plugin");
return;
}
} else {
close($pcfg);
}
my $ip = xCAT::NetworkUtils->getipaddr($node);
unless ($ip) {
syslog("local1|err","xCAT unable to resolve IP in grub2 plugin");
return;
}
my $mactab = xCAT::Table->new('mac');
my %ipaddrs;
$ipaddrs{$ip} = 1;
if ($mactab) {
my $ment = $machash{$node}->[0]; #$mactab->getNodeAttribs($node,['mac']);
if ($ment and $ment->{mac}) {
my @macs = split(/\|/,$ment->{mac});
foreach (@macs) {
$nodemac = $_;
if (/!(.*)/) {
my $ipaddr = xCAT::NetworkUtils->getipaddr($1);
if ($ipaddr) {
$ipaddrs{$ipaddr} = 1;
}
}
}
}
}
# Do not use symbolic link, p5 does not support symbolic link in /tftpboot
# my $hassymlink = eval { symlink("",""); 1 };
foreach $ip (keys %ipaddrs) {
my @ipa=split(/\./,$ip);
my $pname = "grub.cfg-" . sprintf("%02x%02x%02x%02x",@ipa);
unlink($tftpdir."/boot/grub2/".$pname);
link($tftpdir."/boot/grub2/".$node,$tftpdir."/boot/grub2/".$pname);
}
if ($nodemac =~ /:/) {
my $tmp = $nodemac;
$tmp =~ s/(..):(..):(..):(..):(..):(..)/$1-$2-$3-$4-$5-$6/g;
my $pname = "grub.cfg-01-" . $tmp;
unlink($tftpdir."/boot/grub2/".$pname);
link($tftpdir."/boot/grub2/".$node,$tftpdir."/boot/grub2/".$pname);
}
return;
}
my $errored = 0;
sub pass_along {
my $resp = shift;
$callback->($resp);
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
$errored=1;
}
foreach (@{$resp->{node}}) {
if ($_->{error} or $_->{errorcode}) {
$errored=1;
}
}
}
sub preprocess_request {
my $req = shift;
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
my $callback1 = shift;
my $command = $req->{command}->[0];
my $sub_req = shift;
my @args=();
if (ref($req->{arg})) {
@args=@{$req->{arg}};
} else {
@args=($req->{arg});
}
@ARGV = @args;
my $nodes = $req->{node};
#use Getopt::Long;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
if ($HELP) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
if ($VERSION) {
my $ver = xCAT::Utils->Version();
my %rsp;
$rsp{data}->[0]="$ver";
$callback1->(\%rsp);
return;
}
if (@ARGV==0) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
#if they specify no sharedtftp in site table
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry eq "0" or $t_entry eq "no" or $t_entry eq "NO")) {
# check for computenodes and servicenodes from the noderange, if so error out
my @SN;
my @CN;
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
unless (($args[0] eq 'stat') or ($args[0] eq 'enact')) {
if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN
my $rsp;
$rsp->{data}->[0] =
"Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n";
xCAT::MsgUtils->message("E", $rsp, $callback1);
return;
}
}
$req->{'_disparatetftp'}=[1];
if ($req->{inittime}->[0]) {
return [$req];
}
if (@CN >0 ) { # if compute nodes broadcast to all servicenodes
return xCAT::Scope->get_broadcast_scope($req,@_);
}
}
return [$req];
}
sub process_request {
$request = shift;
$callback = shift;
$::callback=$callback;
$sub_req = shift;
my $command = $request->{command}->[0];
%breaknetbootnodes=();
%normalnodes=();
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
} else {
if ($request->{node}) { @rnodes = ($request->{node}); }
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
}
return;
}
#if not shared tftpdir, then filter, otherwise, set up everything
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
push @nodes,$_;
} else {
xCAT::MsgUtils->message("S", "$_: grub2 netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster.");
}
}
} else {
@nodes = @rnodes;
}
# return directly if no nodes in the same network
unless (@nodes) {
xCAT::MsgUtils->message("S", "xCAT: grub2 netboot: no valid nodes. Stop the operation on this server.");
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
} else {
@args=($request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
$sub_req->({command=>['runbeginpre'],
node=>\@rnodes,
arg=>[$args[0]]},\&pass_along);
}
if ($errored) {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts.\n";
$callback->($rsp);
return;
}
}
#back to normal business
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
$errored=0;
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$sub_req->({command=>['setdestiny'],
node=>\@nodes,
inittime=>[$inittime],
arg=>\@args},\&pass_along);
}
if ($errored) { return; }
my $bptab=xCAT::Table->new('bootparams',-create=>1);
my $bphash = $bptab->getNodesAttribs(\@nodes,['kernel','initrd','kcmdline','addkcmdline']);
my $chaintab=xCAT::Table->new('chain',-create=>1);
my $chainhash=$chaintab->getNodesAttribs(\@nodes,['currstate']);
my $noderestab=xCAT::Table->new('noderes',-create=>1);
my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir']);
my $mactab=xCAT::Table->new('mac',-create=>1);
my $machash=$mactab->getNodesAttribs(\@nodes,['mac']);
my $nrtab=xCAT::Table->new('noderes',-create=>1);
my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode','tftpserver','xcatmaster']);
my $typetab=xCAT::Table->new('nodetype',-create=>1);
my $typehash=$typetab->getNodesAttribs(\@nodes,['os','provmethod','arch','profile']);
my $linuximgtab=xCAT::Table->new('linuximage',-create=>1);
my $osimagetab=xCAT::Table->new('osimage',-create=>1);
my $rc;
my $errstr;
my $tftpdir;
foreach (@nodes) {
my %response;
if ($nodereshash->{$_} and $nodereshash->{$_}->[0] and $nodereshash->{$_}->[0]->{tftpdir}) {
$tftpdir = $nodereshash->{$_}->[0]->{tftpdir};
} else {
$tftpdir = $globaltftpdir;
}
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
my $ent = $typehash->{$_}->[0];
my $osimgname = $ent->{'provmethod'};
my $linuximghash=undef;
unless($osimgname =~ /^(install|netboot|statelite)$/){
$linuximghash = $linuximgtab->getAttribs({imagename => $osimgname}, 'boottarget', 'addkcmdline');
}
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir,$nrhash,$linuximghash);
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
}
}
}# end of foreach node
my @normalnodeset = keys %normalnodes;
my @breaknetboot=keys %breaknetbootnodes;
#print "grub2 :inittime=$inittime; normalnodeset=@normalnodeset; breaknetboot=@breaknetboot\n";
my %osimagenodehash;
for my $nn (@normalnodeset){
#record the os version for node
my $ent = $typehash->{$nn}->[0];
my $osimage=$ent->{'provmethod'};
if($osimage =~ /^(install|netboot|statelite)$/){
$osimage=($ent->{'os'}).'-'.($ent->{'arch'}).'-'.($ent->{'provmethod'}).'-'.($ent->{'profile'});
}
push @{$osimagenodehash{$osimage}}, $nn;
}
my $do_dhcpsetup=1;
my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup");
my $t_entry = $entries[0];
if (defined($t_entry) ) {
if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; }
}
#Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time
unless (($args[0] eq 'stat') || ($inittime) || ($args[0] eq 'offline')) {
foreach my $osimage (keys %osimagenodehash) {
#TOTO check the existence of grub2 executable files for corresponding arch
my $osimgent = $osimagetab->getAttribs({imagename => $osimage },'osarch');
my $validarch=undef;
if($osimgent and $osimgent->{'osarch'})
{
$validarch = $osimgent->{'osarch'};
}
if ($validarch =~ /ppc64/i)
{
$validarch="ppc"
}
my $grub2 = "/boot/grub2/grub2.".$validarch;
my $tftppath = $tftpdir . $grub2;
unless (-e "$tftppath") {
my $rsp;
push @{$rsp->{data}},
"stop configuration, missing $tftppath.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
return;
}
if ($do_dhcpsetup) {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=>\@{$osimagenodehash{$osimage}},
arg=>['-l','-s','filename = \"'.$grub2.'\";']},$callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@{$osimagenodehash{$osimage}},
arg=>['-s','filename = \"'.$grub2.'\";']},$callback);
}
}
} #end of foreach osimagenodehash
if ($do_dhcpsetup) {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=>\@breaknetboot,
arg=>['-l','-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@breaknetboot,
arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
}
}
}
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
$sub_req->({command=>['runendpre'],
node=>\@rnodes,
arg=>[$args[0]]},\&pass_along);
}
if ($errored) {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts\n";
$callback->($rsp);
return;
}
}
}
#----------------------------------------------------------------------------
=head3 getNodesetStates
returns the nodeset state for the given nodes. The possible nodeset
states are: netboot, install, boot and discover.
Arguments:
nodes --- a pointer to an array of nodes
states -- a pointer to a hash table. This hash will be filled by this
function.The key is the nodeset status and the value is a pointer
to an array of nodes.
Returns:
(return code, error message)
=cut
#-----------------------------------------------------------------------------
sub getNodesetStates {
my $noderef=shift;
if ($noderef =~ /xCAT_plugin::grub2/) {
$noderef=shift;
}
my @nodes=@$noderef;
my $hashref=shift;
my $noderestab = xCAT::Table->new('noderes'); #in order to detect per-node tftp directories
my %nrhash = %{$noderestab->getNodesAttribs(\@nodes,[qw(tftpdir)])};
if (@nodes>0) {
foreach my $node (@nodes) {
my $tftpdir;
if ($nrhash{$node}->[0] and $nrhash{$node}->[0]->{tftpdir}) {
$tftpdir = $nrhash{$node}->[0]->{tftpdir};
} else {
$tftpdir = $globaltftpdir;
}
my $tmp=getstate($node, $tftpdir);
my @a=split(' ', $tmp);
$stat = $a[0];
if (exists($hashref->{$stat})) {
my $pa=$hashref->{$stat};
push(@$pa, $node);
}
else {
$hashref->{$stat}=[$node];
}
}
}
return (0, "");
}
1;
+6 -2
View File
@@ -6318,13 +6318,17 @@ sub preprocess_request {
if ($command eq "rpower") {
my $subcmd=$exargs[0];
if($subcmd eq ''){
$callback->({data=>["Please enter an action (eg: boot,off,on, etc)", $usage_string]});
#$callback->({data=>["Please enter an action (eg: boot,off,on, etc)", $usage_string]});
#Above statement will miss error code, so replaced by the below statement
$callback->({errorcode=>[1],data=>["Please enter an action (eg: boot,off,on, etc)", $usage_string]});
$request = {};
return 0;
}
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]});
#$callback->({data=>["Unsupported command: $command $subcmd", $usage_string]});
#Above statement will miss error code, so replaced by the below statement
$callback->({errorcode=>[1],data=>["Unsupported command: $command $subcmd", $usage_string]});
$request = {};
return;
}
@@ -239,7 +239,7 @@ sub add_known_host
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
return 1;
}
chop($output[0]);
chomp($output[0]);
my ($hostname,$ip_address) = xCAT::NetworkUtils->gethostnameandip($node);
if (!$hostname || !$ip_address)
{
+488
View File
@@ -0,0 +1,488 @@
# IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
package xCAT_plugin::petitboot;
use File::Path;
use Getopt::Long;
use xCAT::Table;
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
my %usage = (
"nodeset" => "Usage: nodeset <noderange> osimage[=<imagename>]",
);
sub handled_commands {
return {
nodeset => "noderes:netboot"
}
}
sub check_dhcp {
return 1;
#TODO: omapi magic to do things right
my $node = shift;
my $dhcpfile;
open ($dhcpfile,$dhcpconf);
while (<$dhcpfile>) {
if (/host $node\b/) {
close $dhcpfile;
return 1;
}
}
close $dhcpfile;
return 0;
}
sub _slow_get_tftpdir { #make up for paths where tftpdir is not passed in
my $node=shift;
my $nrtab = xCAT::Table->new('noderes',-create=>0); #in order to detect per-node tftp directories
unless ($nrtab) { return $globaltftpdir; }
my $ent = $nrtab->getNodeAttribs($node,["tftpdir"]);
if ($ent and $ent->{tftpdir}) {
return $ent->{tftpdir};
} else {
return $globaltftpdir;
}
}
sub getstate {
my $node = shift;
my $tftpdir = shift;
unless ($tftpdir) { $tftpdir = _slow_get_tftpdir($node); }
if (check_dhcp($node)) {
if (-r $tftpdir . "/petitboot/".$node) {
my $fhand;
open ($fhand,$tftpdir . "/petitboot/".$node);
my $headline = <$fhand>;
close $fhand;
$headline =~ s/^#//;
chomp($headline);
return $headline;
} else {
return "boot";
}
} else {
return "discover";
}
}
sub setstate {
=pod
This function will manipulate the yaboot structure to match what the noderes/chain tables indicate the node should be booting.
=cut
my $node = shift;
my %bphash = %{shift()};
my %chainhash = %{shift()};
my %machash = %{shift()};
my $tftpdir = shift;
my %nrhash = %{shift()};
my $linuximghash = shift();
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if ($kern->{kcmdline} =~ /!myipfn!/) {
my $ipfn = xCAT::NetworkUtils->my_ip_facing($node);
unless ($ipfn) {
my $servicenodes = $nrhash{$node}->[0];
if ($servicenodes and $servicenodes->{servicenode}) {
my @sns = split /,/, $servicenodes->{servicenode};
foreach my $sn ( @sns ) {
# We are in the service node pools, print error if no facing ip.
if (xCAT::InstUtils->is_me($sn)) {
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$::callback->(
{
error => [
"$myname: Unable to determine the image server for $node on service node $sn"
],
errorcode => [1]
}
);
return;
}
}
} else {
$::callback->(
{
error => [
"$myname: Unable to determine the image server for $node"
],
errorcode => [1]
}
);
return;
}
} else {
$kern->{kernel} =~ s/!myipfn!/$ipfn/g;
$kern->{initrd} =~ s/!myipfn!/$ipfn/g;
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
}
}
if ($kern->{addkcmdline}) {
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
}
if($linuximghash and $linuximghash->{'addkcmdline'})
{
unless($linuximghash->{'boottarget'})
{
$kern->{kcmdline} .= " ".$linuximghash->{'addkcmdline'};
}
}
my $pcfg;
unless (-d "$tftpdir/petitboot") {
mkpath("$tftpdir/petitboot");
}
my $nodemac;
open($pcfg,'>',$tftpdir."/petitboot/".$node);
my $cref=$chainhash{$node}->[0]; #$chaintab->getNodeAttribs($node,['currstate']);
if ($cref->{currstate}) {
print $pcfg "#".$cref->{currstate}."\n";
}
$normalnodes{$node}=1; #Assume a normal netboot (well, normal dhcp,
#which is normally with a valid 'filename' field,
#but the typical ppc case will be 'special' makedhcp
#to clear the filename field, so the logic is a little
#opposite
# $sub_req->({command=>['makedhcp'], #This is currently batched elswhere
# node=>[$node]},$callback); #It hopefully will perform correctly
if ($cref and $cref->{currstate} eq "boot") {
$breaknetbootnodes{$node}=1;
delete $normalnodes{$node}; #Signify to omit this from one makedhcp command
#$sub_req->({command=>['makedhcp'], #batched elsewhere, this code is stale, hopefully
# node=>[$node],
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
#print $pcfg "bye\n";
close($pcfg);
} elsif ($kern and $kern->{kernel}) {
#It's time to set yaboot for this node to boot the kernel..
print $pcfg "default xCAT\n";
print $pcfg "label xCAT\n";
print $pcfg "\tkernel $kern->{kernel}\n";
if ($kern and $kern->{initrd}) {
print $pcfg "\tinitrd ".$kern->{initrd}."\n";
}
if ($kern and $kern->{kcmdline}) {
print $pcfg "\tappend \"".$kern->{kcmdline}."\"\n";
}
close($pcfg);
my $inetn = xCAT::NetworkUtils->getipaddr($node);
unless ($inetn) {
syslog("local1|err","xCAT unable to resolve IP for $node in petitboot plugin");
return;
}
} else { #TODO: actually, should possibly default to xCAT image?
#print $pcfg "bye\n";
close($pcfg);
}
my $ip = xCAT::NetworkUtils->getipaddr($node);
unless ($ip) {
syslog("local1|err","xCAT unable to resolve IP in petitboot plugin");
return;
}
my @ipa=split(/\./,$ip);
my $pname = sprintf("%02x%02x%02x%02x",@ipa);
$pname = uc($pname);
unlink($tftpdir."/".$pname);
link($tftpdir."/petitboot/".$node,$tftpdir."/".$pname);
return;
}
my $errored = 0;
sub pass_along {
my $resp = shift;
# print Dumper($resp);
$callback->($resp);
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
$errored=1;
}
foreach (@{$resp->{node}}) {
if ($_->{error} or $_->{errorcode}) {
$errored=1;
}
}
}
sub preprocess_request {
my $req = shift;
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
my $callback1 = shift;
my $command = $req->{command}->[0];
my $sub_req = shift;
my @args=();
if (ref($req->{arg})) {
@args=@{$req->{arg}};
} else {
@args=($req->{arg});
}
@ARGV = @args;
my $nodes = $req->{node};
#use Getopt::Long;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION) ) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
if ($HELP) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
if ($VERSION) {
my $ver = xCAT::Utils->Version();
my %rsp;
$rsp{data}->[0]="$ver";
$callback1->(\%rsp);
return;
}
if (@ARGV==0) {
if($usage{$command}) {
my %rsp;
$rsp{data}->[0]=$usage{$command};
$callback1->(\%rsp);
}
return;
}
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
#if they specify no sharedtftp in site table
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)) {
# check for computenodes and servicenodes from the noderange, if so error out
my @SN;
my @CN;
xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN);
if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN
my $rsp;
$rsp->{data}->[0] =
"Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n";
xCAT::MsgUtils->message("E", $rsp, $callback1);
return;
}
$req->{'_disparatetftp'}=[1];
if ($req->{inittime}->[0]) {
return [$req];
}
if (@CN >0 ) { # if compute nodes broadcast to all servicenodes
return xCAT::Scope->get_broadcast_scope($req,@_);
}
}
return [$req];
}
sub process_request {
$request = shift;
$callback = shift;
$::callback=$callback;
$sub_req = shift;
my $command = $request->{command}->[0];
%breaknetbootnodes=();
%normalnodes=();
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
} else {
if ($request->{node}) { @rnodes = ($request->{node}); }
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
}
return;
}
#if not shared tftpdir, then filter, otherwise, set up everything
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
push @nodes,$_;
} else {
xCAT::MsgUtils->message("S", "$_: petitboot netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster.");
}
}
} else {
@nodes = @rnodes;
}
# return directly if no nodes in the same network
unless (@nodes) {
xCAT::MsgUtils->message("S", "xCAT: petitboot netboot: no valid nodes. Stop the operation on this server.");
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
} else {
@args=($request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
$sub_req->({command=>['runbeginpre'],
node=>\@rnodes,
arg=>[$args[0]]},\&pass_along);
}
if ($errored) {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts.\n";
$callback->($rsp);
return;
}
}
#back to normal business
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
$errored=0;
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$sub_req->({command=>['setdestiny'],
node=>\@nodes,
inittime=>[$inittime],
arg=>\@args},\&pass_along);
}
if ($errored) { return; }
my $bptab=xCAT::Table->new('bootparams',-create=>1);
my $bphash = $bptab->getNodesAttribs(\@nodes,['kernel','initrd','kcmdline','addkcmdline']);
my $chaintab=xCAT::Table->new('chain',-create=>1);
my $chainhash=$chaintab->getNodesAttribs(\@nodes,['currstate']);
my $noderestab=xCAT::Table->new('noderes',-create=>1);
my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir']);
my $mactab=xCAT::Table->new('mac',-create=>1);
my $machash=$mactab->getNodesAttribs(\@nodes,['mac']);
my $nrtab=xCAT::Table->new('noderes',-create=>1);
my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode']);
my $typetab=xCAT::Table->new('nodetype',-create=>1);
my $typehash=$typetab->getNodesAttribs(\@nodes,['os','provmethod','arch','profile']);
my $linuximgtab=xCAT::Table->new('linuximage',-create=>1);
my $osimagetab=xCAT::Table->new('osimage',-create=>1);
my $rc;
my $errstr;
my $tftpdir;
foreach (@nodes) {
my %response;
if ($nodereshash->{$_} and $nodereshash->{$_}->[0] and $nodereshash->{$_}->[0]->{tftpdir}) {
$tftpdir = $nodereshash->{$_}->[0]->{tftpdir};
} else {
$tftpdir = $globaltftpdir;
}
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
my $ent = $typehash->{$_}->[0];
my $osimgname = $ent->{'provmethod'};
my $linuximghash = $linuximghash = $linuximgtab->getAttribs({imagename => $osimgname}, 'boottarget', 'addkcmdline');
($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir,$nrhash,$linuximghash);
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
}
}
}# end of foreach node
my @normalnodeset = keys %normalnodes;
my @breaknetboot=keys %breaknetbootnodes;
#print "yaboot:inittime=$inittime; normalnodeset=@normalnodeset; breaknetboot=@breaknetboot\n";
my %osimagenodehash;
for my $nn (@normalnodeset){
#record the os version for node
my $ent = $typehash->{$nn}->[0];
my $osimage=$ent->{'provmethod'};
push @{$osimagenodehash{$osimage}}, $nn;
}
#Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time
unless (($args[0] eq 'stat') || ($inittime) || ($args[0] eq 'offline')) {
#dhcp stuff
my $do_dhcpsetup=1;
my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup");
my $t_entry = $entries[0];
if (defined($t_entry) ) {
if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; }
}
if ($do_dhcpsetup) {
foreach my $node (@normalnodeset) {
my $fpath = "http://9.3.190.175/tftpboot/petitboot/$node";
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=> [$node],
arg=>['-l','-s','conf-file = \"'.$fpath.'\";']},$callback);
} else {
$sub_req->({command=>['makedhcp'],
node=> [$node],
arg=>['-s','conf-file = \"'.$fpath.'\";']},$callback);
}
}
}
}
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
$sub_req->({command=>['runendpre'],
node=>\@rnodes,
arg=>[$args[0]]},\&pass_along);
}
if ($errored) {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts\n";
$callback->($rsp);
return;
}
}
}
1;
@@ -1627,12 +1627,16 @@ sub findme{
my @nodelist = keys %hostinfo_dict;
# call makehosts to get the IP by resolving the name
my $retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>\@nodelist, sequential=>[1]}, $request_command, 0, 2);
# call discover to notify client.
xCAT::MsgUtils->message('S', "Call discovered request.\n");
$request->{"command"} = ["discovered"];
$request->{"node"} = \@nodelist;
$request->{discoverymethod} = ['profile'];
my $retref = xCAT::Utils->runxcmd($request, $request_command, 0, 2);
$retref = "";
$retref = xCAT::Utils->runxcmd($request, $request_command, 0, 2);
my $retstrref = parse_runxcmd_ret($retref);
xCAT::MsgUtils->message('S', "Call nodemgmt plugins.\n");
+30 -33
View File
@@ -11,9 +11,6 @@ use Getopt::Long;
require xCAT::Utils;
require xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
my $addkcmdlinehandled;
my $request;
my $callback;
my $dhcpconf = "/etc/dhcpd.conf";
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
#my $dhcpver = 3;
@@ -93,7 +90,7 @@ sub setstate {
my $imgaddkcmdline=($linuximghash{'boottarget'})? undef:$linuximghash{'addkcmdline'};
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if (not $addkcmdlinehandled->{$node} and ($kern->{addkcmdline} or ($imgaddkcmdline))) {
if (not $::PXE_addkcmdlinehandled->{$node} and ($kern->{addkcmdline} or ($imgaddkcmdline))) {
#Implement the kcmdline append here for
#most generic, least code duplication
@@ -129,7 +126,7 @@ sub setstate {
$kcmdlinehack =~ s/#TABLE:([^:#]+):([^:#]+):([^:#]+)#/$naval/;
} else {
my $msg = "Table key of $2 not yet supported by boottarget mini-template";
$::callback->({
$::PXE_callback->({
error => ["$msg"],
errorcode => [1]
});
@@ -148,7 +145,7 @@ sub setstate {
unless ($ipfn) {
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$::callback->(
$::PXE_callback->(
{
error => [
"$myname: Unable to determine or reasonably guess the image server for $node"
@@ -263,11 +260,11 @@ sub pass_along {
$errored=1;
}
if ($_->{_addkcmdlinehandled}) {
$addkcmdlinehandled->{$_->{name}->[0]}=1;
$::PXE_addkcmdlinehandled->{$_->{name}->[0]}=1;
return; #Don't send back to client this internal hint
}
}
$callback->($resp);
$::PXE_callback->($resp);
}
@@ -356,28 +353,28 @@ sub preprocess_request {
}
sub process_request {
$request = shift;
$callback = shift;
$::PXE_request = shift;
$::PXE_callback = shift;
my $sub_req = shift;
$::callback=$callback;
undef $::PXE_addkcmdlinehandled;
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
if (ref($::PXE_request->{node})) {
@rnodes = @{$::PXE_request->{node}};
} else {
if ($request->{node}) { @rnodes = ($request->{node}); }
if ($::PXE_request->{node}) { @rnodes = ($::PXE_request->{node}); }
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
if ($usage{$::PXE_request->{command}->[0]}) {
$::PXE_callback->({data=>$usage{$::PXE_request->{command}->[0]}});
}
return;
}
#if not shared, then help sync up
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::PXE_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
@@ -396,16 +393,16 @@ sub process_request {
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
if (ref($::PXE_request->{arg})) {
@args=@{$::PXE_request->{arg}};
} else {
@args=($request->{arg});
@args=($::PXE_request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::PXE_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -418,7 +415,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts\n";
$callback->($rsp);
$::PXE_callback->($rsp);
return;
}
}
@@ -426,7 +423,7 @@ sub process_request {
#end prescripts code
if (! -r "$tftpdir/pxelinux.0") {
unless (-r "/usr/lib/syslinux/pxelinux.0" or -r "/usr/share/syslinux/pxelinux.0") {
$callback->({error=>["Unable to find pxelinux.0 "],errorcode=>[1]});
$::PXE_callback->({error=>["Unable to find pxelinux.0 "],errorcode=>[1]});
return;
}
if (-r "/usr/lib/syslinux/pxelinux.0") {
@@ -437,14 +434,14 @@ sub process_request {
chmod(0644,"$tftpdir/pxelinux.0");
}
unless ( -r "$tftpdir/pxelinux.0" ) {
$callback->({errror=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
$::PXE_callback->({errror=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
return;
}
$errored=0;
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::PXE_request->{inittime})) { $inittime= $::PXE_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$sub_req->({command=>['setdestiny'],
@@ -476,7 +473,7 @@ sub process_request {
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
$::PXE_callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
my $ent = $nthash{$_}->[0];
my $osimgname = $ent->{'provmethod'};
@@ -488,13 +485,13 @@ sub process_request {
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
$::PXE_callback->(\%response);
}
}
}
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::PXE_request->{inittime})) { $inittime= $::PXE_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
#dhcp stuff -- inittime is set when xcatd on sn is started
@@ -511,12 +508,12 @@ sub process_request {
#}
if ($do_dhcpsetup) {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::PXE_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],arg=>['-l'],
node=>\@nodes},$callback);
node=>\@nodes},$::PXE_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@nodes},$callback);
node=>\@nodes},$::PXE_callback);
}
}
@@ -568,7 +565,7 @@ sub process_request {
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::PXE_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -581,7 +578,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts\n";
$callback->($rsp);
$::PXE_callback->($rsp);
return;
}
}
+15 -7
View File
@@ -614,7 +614,11 @@ sub set_route {
}
} else {
if (xCAT::Utils->isLinux()) {
$cmd="route add -net $net netmask $mask gw $gw_ip";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$cmd="route add -net $net netmask $mask dev $ifname";
} else {
$cmd="route add -net $net netmask $mask gw $gw_ip";
}
} else {
$cmd="route add -net $net -netmask $mask $gw_ip";
}
@@ -966,7 +970,7 @@ sub addPersistentRoute_RH {
if ($net =~ /:/) {
$filename="/etc/sysconfig/static-routes-ipv6";
} else {
$filename="/etc/sysconfig/static-routes";
$filename="/etc/sysconfig/sysconfig/route-$ifname";
}
my @output=getConfig($filename);
#print "old output=" . join("\n", @output) . "\n";
@@ -987,7 +991,7 @@ sub addPersistentRoute_RH {
$new_config="$ifname $net/$mask $gw_ip";
} else {
$new_config="any net $net netmask $mask gw $gw_ip $ifname\n";
$new_config="$net/$mask via $gw_ip dev $ifname\n";
}
if (!$hasConfiged) {
push(@output, $new_config);
@@ -1024,7 +1028,7 @@ sub deletePersistentRoute_RH {
if ($net =~ /:/) {
$filename="/etc/sysconfig/static-routes-ipv6";
} else {
$filename="/etc/sysconfig/static-routes";
$filename="/etc/sysconfig/network-scripts/route-$ifname";
}
my @output=getConfig($filename);
#print "old output=" . join("\n", @output) . "\n";
@@ -1046,7 +1050,7 @@ sub deletePersistentRoute_RH {
if ($net =~ /:/) {
$rsp->{data}->[0]= "$host: Removed persistent route \"$ifname $net/$mask $gw_ip\" from $filename.";
} else {
$rsp->{data}->[0]= "$host: Removed persistent route \"any net $net netmask $mask gw $gw_ip $ifname\" from $filename.";
$rsp->{data}->[0]= "$host: Removed persistent route \"$net/$mask via $gw_ip dev $ifname\" from $filename.";
}
$callback->($rsp);
} else {
@@ -1054,7 +1058,7 @@ sub deletePersistentRoute_RH {
if ($net =~ /:/) {
$rsp->{data}->[0]= "$host: Persistent route \"$ifname $net/$mask $gw_ip\" does not exist in $filename.";
} else {
$rsp->{data}->[0]= "$host: Persistent route \"any net $net netmask $mask gw $gw_ip $ifname\" does not exist in $filename.";
$rsp->{data}->[0]= "$host: Persistent route \"$net/$mask via $gw_ip dev $ifname\" does not exist in $filename.";
}
$callback->($rsp);
}
@@ -1125,7 +1129,11 @@ sub addPersistentRoute_Debian{
}
else { #ipv4
$cmd = "grep \"-net $net netmask $mask gw $gw_ip\" $conf_file";
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip \n";
if ( $gw_ip == "" || $gw_ip == "0.0.0.0" ) {
$route_conf = " up route add -net $net netmask $mask dev $ifname \n down route del -net $net netmask $mask dev $ifname\n";
} else {
$route_conf = " up route add -net $net netmask $mask gw $gw_ip \n down route del -net $net netmask $mask gw $gw_ip\n";
}
}
#fine the corresponding config in the config file
+6 -6
View File
@@ -957,7 +957,7 @@ sub tabprune
push @{$rsp{data}}, " tabprune <tablename> [-V] -d <# of days>";
push @{$rsp{data}}, " tabprune [-h|--help]";
push @{$rsp{data}}, " tabprune [-v|--version]";
push @{$rsp{data}}, " tables supported:eventlog,auditlog";
push @{$rsp{data}}, " tables supported:eventlog,auditlog,unless -a which supports all tables";
push @{$rsp{data}}, " -d option only supported for eventlog,auditlog";
if ($exitcode) { $rsp{errorcode} = $exitcode; }
$cb->(\%rsp);
@@ -997,7 +997,7 @@ sub tabprune
}
$table=~ s/\s*//g; # remove blanks
if (($table ne "eventlog") && ($table ne "auditlog") && ($table ne "isnm_perf") && ($table ne "isnm_perf_sum") ) {
if (($table ne "eventlog") && ($table ne "auditlog") && ($table ne "isnm_perf") && ($table ne "isnm_perf_sum") && (! $ALL)) {
my %rsp;
$rsp{data}->[0] = "Table $table not supported, see tabprune -h for supported tables.";
$rsp{errorcode} = 1;
@@ -2654,7 +2654,7 @@ sub getTablesNodesAttribs
my %noderecs;
my $recs;
# build the table name record
@{$noderecs{table}->[0]->{tablename}} = $tablename;
#@{$noderecs{table}->[0]->{tablename}} = $tablename;
# if request for ALL attributes
if (grep (/ALL/,@attrs)) { # read the schema and build array of all attrs
@attrs=();
@@ -2681,6 +2681,7 @@ sub getTablesNodesAttribs
}
}
@{$noderecs{table}->[0]->{tablename}} = $tablename;
push @{$rsp{"table"}}, @{$noderecs{table}};
} # end of all table processing
# for checkin XML created
@@ -2752,9 +2753,9 @@ sub getTablesAllRowAttribs
my $attr = $tabhash->{attr};
my @attrs=@$attr;
my $tab=xCAT::Table->new($tablename);
my %noderecs;
my %tblrecs;
# build the table name record
@{$noderecs{table}->[0]->{tablename}} = $tablename;
@{$tblrecs{table}->[0]->{tablename}} = $tablename;
# if request for ALL attributes
if (grep (/ALL/,@attrs)) { # read the schema and build array of all attrs
@attrs=();
@@ -2767,7 +2768,6 @@ sub getTablesAllRowAttribs
}
# read all the attributes in this table
my @recs = $tab->getAllAttribs(@attrs);
my %tblrecs;
foreach my $rec (@recs) {
my %datseg=();
foreach my $key (keys %$rec) {
+30 -32
View File
@@ -11,9 +11,6 @@ use Getopt::Long;
use xCAT::MsgUtils;
use xCAT::ServiceNodeUtils;
use xCAT::TableUtils;
my $addkcmdlinehandled;
my $request;
my $callback;
my $dhcpconf = "/etc/dhcpd.conf";
my $tftpdir = "/tftpboot/vsmp";
#my $dhcpver = 3;
@@ -75,7 +72,7 @@ sub setstate {
my %chainhash = %{shift()};
my %machash = %{shift()};
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if (not $addkcmdlinehandled->{$node} and $kern->{addkcmdline}) { #Implement the kcmdline append here for
if (not $::VSMPPXE_addkcmdlinehandled->{$node} and $kern->{addkcmdline}) { #Implement the kcmdline append here for
#most generic, least code duplication
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
}
@@ -84,7 +81,7 @@ sub setstate {
unless ($ipfn) {
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$callback->(
$::VSMPPXE_callback->(
{
error => [
"$myname: Unable to determine or reasonably guess the image server for $node"
@@ -189,11 +186,11 @@ sub pass_along {
$errored=1;
}
if ($_->{_addkcmdlinehandled}) {
$addkcmdlinehandled->{$_->{name}->[0]}=1;
$::VSMPPXE_addkcmdlinehandled->{$_->{name}->[0]}=1;
return; #Don't send back to client this internal hint
}
}
$callback->($resp);
$::VSMPPXE_callback->($resp);
}
@@ -288,29 +285,30 @@ sub preprocess_request {
}
sub process_request {
$request = shift;
$callback = shift;
$::VSMPPXE_request = shift;
$::VSMPPXE_callback = shift;
my $sub_req = shift;
undef $::VSMPPXE_addkcmdlinehandled;
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
if (ref($::VSMPPXE_request->{node})) {
@rnodes = @{$::VSMPPXE_request->{node}};
} else {
if ($request->{node}) {
@rnodes = ($request->{node});
if ($::VSMPPXE_request->{node}) {
@rnodes = ($::VSMPPXE_request->{node});
}
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
if ($usage{$::VSMPPXE_request->{command}->[0]}) {
$::VSMPPXE_callback->({data=>$usage{$::VSMPPXE_request->{command}->[0]}});
}
return;
}
#if not shared, then help sync up
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::VSMPPXE_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
@@ -329,17 +327,17 @@ sub process_request {
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
if (ref($::VSMPPXE_request->{arg})) {
@args=@{$::VSMPPXE_request->{arg}};
} else {
@args=($request->{arg});
@args=($::VSMPPXE_request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::VSMPPXE_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -352,7 +350,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts\n";
$callback->($rsp);
$::VSMPPXE_callback->($rsp);
return;
}
}
@@ -375,7 +373,7 @@ sub process_request {
if (! -r "$tftpdir/pxelinux.0") {
unless (-r "/usr/lib/syslinux/pxelinux.0" or -r "/usr/share/syslinux/pxelinux.0") {
$callback->({error=>["Unable to find pxelinux.0 "],errorcode=>[1]});
$::VSMPPXE_callback->({error=>["Unable to find pxelinux.0 "],errorcode=>[1]});
return;
}
if (-r "/usr/lib/syslinux/pxelinux.0") {
@@ -386,14 +384,14 @@ sub process_request {
chmod(0644,"$tftpdir/pxelinux.0");
}
unless ( -r "$tftpdir/pxelinux.0" ) {
$callback->({errror=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
$::VSMPPXE_callback->({errror=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
return;
}
$errored=0;
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::VSMPPXE_request->{inittime})) { $inittime= $::VSMPPXE_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$sub_req->({command=>['setdestiny'],
@@ -414,19 +412,19 @@ sub process_request {
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_);
$callback->(\%response);
$::VSMPPXE_callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
($rc,$errstr) = setstate($_,\%bphash,\%chainhash,\%machash);
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
$::VSMPPXE_callback->(\%response);
}
}
}
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::VSMPPXE_request->{inittime})) { $inittime= $::VSMPPXE_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
#dhcp stuff -- inittime is set when xcatd on sn is started
@@ -443,12 +441,12 @@ sub process_request {
#}
if ($do_dhcpsetup) {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::VSMPPXE_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],arg=>['-l'],
node=>\@nodes},$callback);
node=>\@nodes},$::VSMPPXE_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@nodes},$callback);
node=>\@nodes},$::VSMPPXE_callback);
}
}
@@ -456,7 +454,7 @@ sub process_request {
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::VSMPPXE_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -469,7 +467,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts\n";
$callback->($rsp);
$::VSMPPXE_callback->($rsp);
return;
}
}
+29 -30
View File
@@ -11,9 +11,7 @@ use Getopt::Long;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
my $addkcmdlinehandled;
my $request;
my $callback;
my $dhcpconf = "/etc/dhcpd.conf";
#my $tftpdir = "/tftpboot";
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
@@ -102,7 +100,7 @@ sub setstate {
if (ref $linuximghashref) { %linuximghash = %{$linuximghashref}; }
my $imgaddkcmdline=($linuximghash{'boottarget'})? undef:$linuximghash{'addkcmdline'};
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
unless ($addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline
unless ($::XNBA_addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline
if ($kern->{addkcmdline} or ($imgaddkcmdline)) {
#Implement the kcmdline append here for
@@ -138,7 +136,7 @@ sub setstate {
$kcmdlinehack =~ s/#TABLE:([^:#]+):([^:#]+):([^:#]+)#/$naval/;
} else {
my $msg = "Table key of $2 not yet supported by boottarget mini-template";
$callback->({
$::XNBA_callback->({
error => ["$msg"],
errorcode => [1]
});
@@ -279,11 +277,11 @@ sub pass_along {
$errored=1;
}
if ($_->{_addkcmdlinehandled}) {
$addkcmdlinehandled->{$_->{name}->[0]}=1;
$::XNBA_addkcmdlinehandled->{$_->{name}->[0]}=1;
return; #Don't send back to client this internal hint
}
}
$callback->($resp);
$::XNBA_callback->($resp);
}
@@ -376,27 +374,28 @@ sub preprocess_request {
}
sub process_request {
$request = shift;
$callback = shift;
$::XNBA_request = shift;
$::XNBA_callback = shift;
my $sub_req = shift;
undef $::XNBA_addkcmdlinehandled; # clear out any previous value
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
if (ref($::XNBA_request->{node})) {
@rnodes = @{$::XNBA_request->{node}};
} else {
if ($request->{node}) { @rnodes = ($request->{node}); }
if ($::XNBA_request->{node}) { @rnodes = ($::XNBA_request->{node}); }
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
if ($usage{$::XNBA_request->{command}->[0]}) {
$::XNBA_callback->({data=>$usage{$::XNBA_request->{command}->[0]}});
}
return;
}
#if not shared, then help sync up
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::XNBA_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
@@ -415,16 +414,16 @@ sub process_request {
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
if (ref($::XNBA_request->{arg})) {
@args=@{$::XNBA_request->{arg}};
} else {
@args=($request->{arg});
@args=($::XNBA_request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::XNBA_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -437,7 +436,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts.\n";
$callback->($rsp);
$::XNBA_callback->($rsp);
return;
}
}
@@ -445,21 +444,21 @@ sub process_request {
#back to normal business
if (! -r "$globaltftpdir/xcat/pxelinux.0") {
unless (-r $::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0") {
$callback->({error=>["Unable to find pxelinux.0 at ".$::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0"],errorcode=>[1]});
$::XNBA_callback->({error=>["Unable to find pxelinux.0 at ".$::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0"],errorcode=>[1]});
return;
}
copy($::XCATROOT."/share/xcat/netboot/syslinux/pxelinux.0","$globaltftpdir/xcat/pxelinux.0");
chmod(0644,"$globaltftpdir/xcat/pxelinux.0");
}
unless ( -r "$globaltftpdir/xcat/pxelinux.0" ) {
$callback->({error=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
$::XNBA_callback->({error=>["Unable to find pxelinux.0 from syslinux"],errorcode=>[1]});
return;
}
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::XNBA_request->{inittime})) { $inittime= $::XNBA_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
$errored=0;
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
@@ -499,7 +498,7 @@ sub process_request {
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
$::XNBA_callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
my $rc;
my $errstr;
@@ -514,7 +513,7 @@ sub process_request {
#if ($rc) {
# $response{node}->[0]->{errorcode}->[0]= $rc;
# $response{node}->[0]->{errorc}->[0]= $errstr;
# $callback->(\%response);
# $::XNBA_callback->(\%response);
#}
if($args[0] eq 'offline') {
unlink($tftpdir."/xcat/xnba/nodes/".$_);
@@ -540,12 +539,12 @@ sub process_request {
#}
if ($do_dhcpsetup) {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::XNBA_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],arg=>['-l'],
node=>\@nodes},$callback);
node=>\@nodes},$::XNBA_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@nodes},$callback);
node=>\@nodes},$::XNBA_callback);
}
}
}
@@ -553,7 +552,7 @@ sub process_request {
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::XNBA_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -566,7 +565,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts.\n";
$callback->($rsp);
$::XNBA_callback->($rsp);
return;
}
}
+52 -47
View File
@@ -13,11 +13,8 @@ use Socket;
use Getopt::Long;
use xCAT::Table;
my $request;
my %breaknetbootnodes;
our %normalnodes;
my $callback;
my $sub_req;
my $dhcpconf = "/etc/dhcpd.conf";
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
#my $dhcpver = 3;
@@ -104,7 +101,7 @@ sub setstate {
if (xCAT::InstUtils->is_me($sn)) {
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$::callback->(
$::YABOOT_callback->(
{
error => [
"$myname: Unable to determine the image server for $node on service node $sn"
@@ -116,7 +113,7 @@ sub setstate {
}
}
} else {
$::callback->(
$::YABOOT_callback->(
{
error => [
"$myname: Unable to determine the image server for $node"
@@ -177,7 +174,7 @@ sub setstate {
delete $normalnodes{$node}; #Signify to omit this from one makedhcp command
#$sub_req->({command=>['makedhcp'], #batched elsewhere, this code is stale, hopefully
# node=>[$node],
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$::YABOOT_callback);
print $pcfg "bye\n";
close($pcfg);
} elsif ($kern and $kern->{kernel}) {
@@ -231,13 +228,13 @@ sub setstate {
#to clear the filename field, so the logic is a little
#opposite
# $sub_req->({command=>['makedhcp'], #This is currently batched elswhere
# node=>[$node]},$callback); #It hopefully will perform correctly
# node=>[$node]},$::YABOOT_callback); #It hopefully will perform correctly
if ($cref and $cref->{currstate} eq "boot") {
$breaknetbootnodes{$node}=1;
delete $normalnodes{$node}; #Signify to omit this from one makedhcp command
#$sub_req->({command=>['makedhcp'], #batched elsewhere, this code is stale, hopefully
# node=>[$node],
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
# arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$::YABOOT_callback);
print $pcfg "bye\n";
close($pcfg);
} elsif ($kern and $kern->{kernel}) {
@@ -309,7 +306,7 @@ sub pass_along {
# print Dumper($resp);
$callback->($resp);
$::YABOOT_callback->($resp);
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
$errored=1;
}
@@ -409,31 +406,30 @@ sub preprocess_request {
sub process_request {
$request = shift;
$callback = shift;
$::callback=$callback;
$sub_req = shift;
my $command = $request->{command}->[0];
$::YABOOT_request = shift;
$::YABOOT_callback = shift;
my $sub_req = shift;
my $command = $::YABOOT_request->{command}->[0];
%breaknetbootnodes=();
%normalnodes=();
my @args;
my @nodes;
my @rnodes;
if (ref($request->{node})) {
@rnodes = @{$request->{node}};
if (ref($::YABOOT_request->{node})) {
@rnodes = @{$::YABOOT_request->{node}};
} else {
if ($request->{node}) { @rnodes = ($request->{node}); }
if ($::YABOOT_request->{node}) { @rnodes = ($::YABOOT_request->{node}); }
}
unless (@rnodes) {
if ($usage{$request->{command}->[0]}) {
$callback->({data=>$usage{$request->{command}->[0]}});
if ($usage{$::YABOOT_request->{command}->[0]}) {
$::YABOOT_callback->({data=>$usage{$::YABOOT_request->{command}->[0]}});
}
return;
}
#if not shared tftpdir, then filter, otherwise, set up everything
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
@@ -452,16 +448,16 @@ sub process_request {
return;
}
if (ref($request->{arg})) {
@args=@{$request->{arg}};
if (ref($::YABOOT_request->{arg})) {
@args=@{$::YABOOT_request->{arg}};
} else {
@args=($request->{arg});
@args=($::YABOOT_request->{arg});
}
#now run the begin part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runbeginpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -474,14 +470,14 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running begin prescripts.\n";
$callback->($rsp);
$::YABOOT_callback->($rsp);
return;
}
}
#back to normal business
my $inittime=0;
if (exists($request->{inittime})) { $inittime= $request->{inittime}->[0];}
if (exists($::YABOOT_request->{inittime})) { $inittime= $::YABOOT_request->{inittime}->[0];}
if (!$inittime) { $inittime=0;}
$errored=0;
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
@@ -521,7 +517,7 @@ sub process_request {
$response{node}->[0]->{name}->[0]=$_;
if ($args[0] eq 'stat') {
$response{node}->[0]->{data}->[0]= getstate($_,$tftpdir);
$callback->(\%response);
$::YABOOT_callback->(\%response);
} elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate
my $ent = $typehash->{$_}->[0];
my $osimgname = $ent->{'provmethod'};
@@ -534,7 +530,7 @@ sub process_request {
if ($rc) {
$response{node}->[0]->{errorcode}->[0]= $rc;
$response{node}->[0]->{errorc}->[0]= $errstr;
$callback->(\%response);
$::YABOOT_callback->(\%response);
}
}
}# end of foreach node
@@ -571,7 +567,16 @@ sub process_request {
$osn = $2;
$osm = 0;
}
#Redhat recommend to use grub2 instead of yaboot for rhels7 provision
if ( $osv =~ /rh/ and int($osn) == 7 ){
my $rsp;
push @{$rsp->{data}},
"stop configuration because yaboot DOES NOT work for $os provision, please change noderes.netboot=grub2 instead.\n";
xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback);
return;
}
if (($osv =~ /rh/ and int($osn) < 6) or
($osv =~ /sles/ and int($osn) < 11)) {
# check if yaboot-xcat installed
@@ -580,7 +585,7 @@ sub process_request {
my $rsp;
push @{$rsp->{data}},
"stop configuration because yaboot-xcat need to be installed for $os.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback);
return;
}
} elsif (($osv =~ /rh/ and int($osn) >= 6) or
@@ -591,7 +596,7 @@ sub process_request {
my $rsp;
push @{$rsp->{data}},
"stop configuration because rsync does not exist or is not executable.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback);
return;
}
my $yabootpath = $tftpdir."/yb/".$os;
@@ -613,7 +618,7 @@ sub process_request {
my $rsp;
push @{$rsp->{data}},
"stop configuration because Unable to find the os shipped yaboot file.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback);
return;
}
@@ -624,7 +629,7 @@ sub process_request {
my $rsp;
push @{$rsp->{data}},
"stop configuration because $synccmd failed.\n";
xCAT::MsgUtils->message("E", $rsp, $callback);
xCAT::MsgUtils->message("E", $rsp, $::YABOOT_callback);
return;
}
}
@@ -666,42 +671,42 @@ sub process_request {
if (($osv =~ /rh/ and int($osn) >= 6) or
($osv =~ /sles/ and int($osn) >= 11)) {
my $fpath = "/yb/". $osentry."/yaboot";
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=>\@{$osimagenodehash{$osimage}},
arg=>['-l','-s','filename = \"'.$fpath.'\";']},$callback);
arg=>['-l','-s','filename = \"'.$fpath.'\";']},$::YABOOT_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@{$osimagenodehash{$osimage}},
arg=>['-s','filename = \"'.$fpath.'\";']},$callback);
arg=>['-s','filename = \"'.$fpath.'\";']},$::YABOOT_callback);
}
} else {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed
$sub_req->({command=>['makedhcp'],arg=>['-l'],
node=>\@{$osimagenodehash{$osimage}}},$callback);
node=>\@{$osimagenodehash{$osimage}}},$::YABOOT_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@{$osimagenodehash{$osimage}}},$callback);
node=>\@{$osimagenodehash{$osimage}}},$::YABOOT_callback);
}
}
}
} else {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed
$sub_req->({command=>['makedhcp'],arg=>['-l'],
node=>\@normalnodeset},$callback);
node=>\@normalnodeset},$::YABOOT_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@normalnodeset},$callback);
node=>\@normalnodeset},$::YABOOT_callback);
}
}
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
$sub_req->({command=>['makedhcp'],
node=>\@breaknetboot,
arg=>['-l','-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
arg=>['-l','-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$::YABOOT_callback);
} else {
$sub_req->({command=>['makedhcp'],
node=>\@breaknetboot,
arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback);
arg=>['-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$::YABOOT_callback);
}
}
}
@@ -709,7 +714,7 @@ sub process_request {
#now run the end part of the prescripts
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact')
$errored=0;
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
if ($::YABOOT_request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
$sub_req->({command=>['runendpre'],
node=>\@nodes,
arg=>[$args[0], '-l']},\&pass_along);
@@ -722,7 +727,7 @@ sub process_request {
my $rsp;
$rsp->{errorcode}->[0]=1;
$rsp->{error}->[0]="Failed in running end prescripts\n";
$callback->($rsp);
$::YABOOT_callback->($rsp);
return;
}
}
+1 -1
View File
@@ -1264,7 +1264,7 @@ sub initDB
$chtabcmds .= "$::XCATROOT/sbin/chtab key=vsftp site.value=n;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=cleanupxcatpost site.value=no;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=dhcplease site.value=43200;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=useflowcontrol site.value=yes;";
#$chtabcmds .= "$::XCATROOT/sbin/chtab key=useflowcontrol site.value=yes;"; # need to fix 4031
if ($::osname eq 'AIX')
{
+19 -7
View File
@@ -60,7 +60,7 @@ my $cmdref={
noderange=>[$ARGV[0]]
};
xCAT::Client::submit_request($cmdref,\&getans);
until ($username and $password and $bmc) {
until (($username or $password) and $bmc) {
release_lock(); #Let other clients have a go
$sleepint=10+int(rand(20));
print "Console not ready, retrying in $sleepint seconds (Ctrl-e,c,o to skip delay) \n";
@@ -69,6 +69,18 @@ until ($username and $password and $bmc) {
xCAT::Client::submit_request($cmdref,\&getans);
}
release_lock();
my ($user,$pass);
if ($username) {
$user = "-U $username";
} else {
$user = '';
}
if ($password) {
$pass = "-P $password";
} else {
$pass = '';
}
#require xCAT::Table;
#require xCAT::Utils;
#my $dba;
@@ -98,10 +110,10 @@ my $ipmitool = "ipmitool";
if (-x "$XCATROOT/bin/ipmitool-xcat") {
$ipmitool = "$XCATROOT/bin/ipmitool-xcat";
}
my @mcinfo=`$ipmitool -I lan -U $username -P $password -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1";
my @mcinfo=`$ipmitool -I lanplus $user $pass -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1";
$rc = $?;
if ($rc) { #some shoddy vendors ignore the IPMI 2.0 requirement to support IPMI 1.5 formats for BMC capability determination, attempt IPMI 2.0 even without the ability to confirm IPMI 2.0 support. Though SOL was not baked in prior IPMI 2.0, this script supports pre-2.0 'ISOL' on older devices, hence why we are checking for 1.5/2.0 before proceeding normally
@mcinfo=`$ipmitool -I lanplus -U $username -P $password -H $bmc mc info`;
@mcinfo=`$ipmitool -I lan $user $pass -H $bmc mc info`;
$rc = $?;
}
while ($rc != 0) {
@@ -109,10 +121,10 @@ while ($rc != 0) {
print "Failure to reach IPMI device, retrying in $sleepint seconds (Hit Ctrl-E,c,o to skip)\n";
exec("sleep $sleepint");
#sleep $sleepint;
@mcinfo=`$ipmitool -I lan -U $username -P $password -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1";
@mcinfo=`$ipmitool -I lanplus $user $pass -H $bmc mc info`;#| grep 'Manufacturer ID : 343' > /dev/null 2>&1";
$rc = $?;
if ($rc) { #repeat workaround for shoddy vendors
@mcinfo=`$ipmitool -I lanplus -U $username -P $password -H $bmc mc info`;
@mcinfo=`$ipmitool -I lan $user $pass -H $bmc mc info`;
$rc = $?;
}
}
@@ -130,9 +142,9 @@ if ($isintel) {
$inteloption=" -o intelplus";
}
if ($iface eq "lanplus") {
system "$ipmitool -I lanplus $inteloption -U $username -P $password -H $bmc $solcom deactivate"; #Stop any active session
system "$ipmitool -I lanplus $inteloption $user $pass -H $bmc $solcom deactivate"; #Stop any active session
}
exec "$ipmitool -I $iface $inteloption -U $username -P $password -H $bmc $solcom activate";
exec "$ipmitool -I $iface $inteloption $user $pass -H $bmc $solcom activate";
@@ -0,0 +1,42 @@
#
# 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 #CRYPT:passwd:key=system,username=root:password#
#partition / --ondisk=/dev/mapper/ibmpkvm_vg_root-ibmpkvm_lv_root
partition / --ondisk=/dev/sda
network --device eth0 --bootproto dhcp
%post
touch "/startpost"
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat#
touch "/inpost"
#sleep 1000000
%end
-2
View File
@@ -39,8 +39,6 @@ do
export USEOPENSSLFORXCAT
XCATSERVER=$i:3001
export XCATSERVER
mv $i/postscripts /xcatpost
rm -rf $i
# If mypostscript doesn't exist, we will get it through getpostscript.awk
if [ ! -x /xcatpost/mypostscript ]; then
@@ -0,0 +1,35 @@
./boot*
./usr/share/wallpapers/RHEL6/contents/images*
./usr/include*
./usr/lib/locale*
./usr/lib64/perl5/Encode/CN*
./usr/lib64/perl5/Encode/JP*
./usr/lib64/perl5/Encode/TW*
./usr/lib64/perl5/Encode/KR*
./lib/kbd/keymaps/i386*
./lib/kbd/keymaps/mac*
./lib/kdb/keymaps/include*
./usr/local/include*
./usr/local/share/man*
./usr/share/man*
./usr/share/cracklib*
./usr/share/doc*
./usr/share/doc/packages/cyrus-sasl/doc*
./usr/share/gnome*
./usr/share/i18n*
+./usr/share/i18n/en_US*
./usr/share/info*
./usr/share/locale/*
+./usr/share/locale/en_US*
+./usr/share/locale/C*
+./usr/share/locale/locale.alias
+./usr/lib/locale/locale-archive
+./usr/lib/locale/en*
./usr/share/man*
./usr/share/omf*
./usr/share/vim/site/doc*
./usr/share/vim/vim72/doc*
./usr/share/zoneinfo*
./var/cache/man*
./var/lib/yum*
@@ -0,0 +1,23 @@
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
net-tools
@@ -0,0 +1,45 @@
#!/bin/sh
#-- Do not remove following line if you want to make use of CVS version tracking
#-- $Id: compute.postinstall,v 1.21 2008/09/04 12:05:45 sikorsky Exp $
#-- jurij.sikorsky@t-systems.cz
#--
#-- this script is run after all packages from $profile.pkglist are installed
#--
#-- it gets these arguments:
#--
#-- $1 = install root (chroot directory for profile)
#-- $2 = OS version
#-- $3 = architecture
#-- $4 = profile name
#-- $5 = work dir (where genimage is located)
#--
#--
installroot=$1
osver=$2
arch=$3
profile=$4
workdir=$5
#-- Example how /etc/fstab can be automatically generated during image generation:
cat <<END >$installroot/etc/fstab
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
${profile}_${arch} / tmpfs rw 0 1
none /tmp tmpfs defaults,size=10m 0 2
none /var/tmp tmpfs defaults,size=10m 0 2
END
#-- Uncomment the line contains "cons" in /etc/inittab
#cons:12345:respawn:/sbin/smart_agetty -L 38400 console
#echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab
#-- Example of booted image versioning
#-- We want to know, with what configuration (version of the image) each node was booted.
#-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run.
#cat /dev/null > $installroot/etc/IMGVERSION
#for ext in pkglist exlist postinstall repolist; do
# [ -r $workdir/$profile.$ext ] && cat $workdir/$profile.$ext | grep -E '^[[:space:]]*#.*[[:space:]]\$Id' >> $installroot/etc/IMGVERSION
#done
+828
View File
@@ -0,0 +1,828 @@
#!/usr/bin/env perl
# IBM(c) 2010 EPL license http://www.eclipse.org/legal/epl-v10.html
#
#############################################################################################################################################
#
# This script will be used to run xCAT daily regression
#
# Usage:xCATreg - Run xCAT daily regression
# xCATreg [-?|-h]
# xCATreg [-b branch][-m MN][-f configure file][-a][-V]
#
# -?/-h: help information for the xCATreg usage.
# -b: when -b is specified, the regression will be done against the specified branch. You can use 2.7, 2.8,master.The default value is master.
# -m: when -m is specified, the regression will be done the specified mn. The default value is all the mn in configuration file.
# -f :specify the configuration file,default value is /xCATreg/regresson.conf
# -a: when -a is specified, run the regression even there is no code updates
# -V: log and message in verbose mode
#
# Example usage:
# ./xCATreg Run regressoins on master branch and on all platforms in configuration file
# ./xCATreg -b 2.8 -m slesmn -f /root/regressoin.conf -a Run regression on 2.8 branch on slesmn even when there is no code updates.
#
#############################################################################################################################################
use strict;
use warnings;
use Getopt::Long;
use Data::Dumper;
use Term::ANSIColor;
use Time::Local;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr';
}
use lib "$::XCATROOT/lib/perl";
#######################################
# step 0. Parse input arguments
#######################################
my $rootdir = "$::XCATROOT/share/xcat/tools/autotest";
my $needhelp = 0;
my $configfile = "$::XCATROOT/share/xcat/tools/autotest";
my $branch = 0;
my $configfile = "$rootdir/default.conf";
my $management_node = undef;
my $verbose_mode = 0;
my $updates_regression = 0;
my $send_msg = 0;
my $ret = 0;
my $string1 = undef;
if (
!GetOptions("h|?" => \$needhelp,
"f=s" => \$configfile,
"b=s" => \$branch,
"m=s" => \$management_node,
"V" => \$verbose_mode,
"U" => \$updates_regression,
"e=s" => \$send_msg)
)
{
&usage;
send_msg("PARSE ARGUMENTS returns error, exit");
exit 1;
}
if ($needhelp)
{
&usage;
exit 0;
}
sub usage
{
print "Usage:xCAYreg - Run xcat autotest test cases.\n
Explanation for the options:
-b: when -b is specified, the regression will be done against the specified branch. The default value is master.\n
-m: when -m is specified, run regression on the specified mn. The default value is all the mn in configuration file.\n
-f: specify the configuration file location.\n
-U: when -U is specified, only code updates can trigger the regression.\n
-V: log and message in verbose mode.\n
-e: <email_addr> send the test result to email_addr\n";
print " xCAYreg [-?|-h]\n";
print " xCAYreg [-f configure file] [-b branch] [-m mangement node][-V][-e] install mn \n";
print " xCAYreg [-f configure file] [-b branch] [-m mangement node ] [-U][-V][-e] if code updates there will be regression.\n";
print "\n";
return;
}
# send_msg("PARSE ARGUMENTS returns error, exit");
my $res;
my $confile = "regconf";
#######################################
# send messages
#######################################
sub send_msg {
my $msg = shift;
print "xcatreg message: $msg.\n";
}
#######################################
# read_conf
#######################################
sub read_conf{
my %confkeys;
my $keys;
if (!open($keys, "<$confile")) {
send_msg("Open configuration file error");
}
my $line;
while ($line = <$keys>) {
if ($line =~ /end/) {
last;
}
if ($line =~ /^\s*log\s*=\s*(\S*)\s*/) {
$confkeys{log} = $1;
}
if ($line =~ /^\s*mailgroup\s*=\s*(\S*)\s*/) {
$confkeys{mailgroup} = $1;
}
}
return %confkeys;
}
#######################################
# step 1. Parse arguments
#######################################
my %reghash = arg_phase();
unless (%reghash) {
send_msg("PARSE ARGUMENTS returns error, exit");
exit;
}
#######################################
# step 2. Read configuration files
#######################################
my %confhash = read_conf();
unless (%confhash) {
send_msg("READ CONF returns error, exit");
exit;
}
#######################################
# step 3. Install MNs
#######################################
$res = mn_install();
if ($res) {
send_msg("INSTALL MNS returns error, exit");
exit;
}
#######################################
# step 4. Copy code to MNs
#######################################
$res = copy_code();
if ($res) {
send_msg("COPY CODE returns error, exit");
exit;
}
#######################################
# step 5. Build xcat code in MNs
#######################################
$res = build_xcat();
if ($res) {
send_msg("BUILD XCAT returns error, exit");
exit;
}
#######################################
# step 6. Configure xCAT MN
#######################################
mkdir $resultdir unless -d $resultdir;
my $timestamp = `date +"%Y%m%d%H%M%S"`;
my %rhppc64config=();
my %slesppc64config=();
my %rhx8664config=();
my %slesx8664config=();
my @osname = &runcmd("uname -a");
$res = &config_mn();
if ($res) {
send_msg("CONFIGURE MN returns error, exit");
exit;
}
sub config_mn {
if(!(-e $configfile)){
send_msg("Warning: The xCAT test Configure file doesn't exist!");
send_msg("Warning: The xCAT test Configure file doesn't exist!");
return 0;
}
my $sub_type = undef; # The string after $type_
# Script-->
# Script_Prev
# Script_Post
# Table--->
# Table_xxxxx
# Object-->
# Object_xxxx
# System---->
# Custom---->
my $name = undef;
my $attr = undef;
my $value = undef;
my $c = 0;
my $cmd = undef;
my $mgt_name = undef;
open(FILE, "$configfile") or die "can't to open $configfile";
while(my $line = <FILE>) {
$line = &trim($line);
next if(length($line) == 0);
#Table name can not contain "_"
if($line =~ /\[\s*(\w+)\_(\w+)\s*\]/) {
$type = $1;
$sub_type = $2;
$name = undef;
$c = 0;
}elsif($line =~ /\[\s*rhppc64System|Custom\s*\]/){
$type = "rhppc64Varible";
}elsif ($type eq "rhppc64Table") {
##TABLE BLOCK##
if($line =~ /(\w+)\s*=\s*([\w\.\-]+)/) {
$attr = $1;
$value = $2;
f($name&&($rhppc64config{table}{$sub_type}{$name}{__KEY__} ne $attr)){
$rhppc64config{table}{$sub_type}{$name}{$attr}=$value;
} else {
$name = $value;
$rhppc64config{table}{$sub_type}{$name}{__KEY__}=$attr;
}
}
}elsif ($type eq "rhppc64Object") {
##OBJECT BLOCK##
if($line =~ /(\w+)\s*=\s*([\w\.\-]+)/) {
$attr = $1;
$value = $2;
print "rhppc64node attr is $attr\n";
print "rhppc64node value is $value\n";
if($attr eq "Name"){
$name = $value;
} elsif(!defined($name)){
print "Please give name for Object\n";
close FILE;
return 1;
} else {
$rhppc64config{object}{$sub_type}{$name}{$attr}=$value;
}
}
}elsif ($type eq "rhppc64Script") {
##SCRIPT_BLOCK##
if($sub_type eq "Prev") {
$rhppc64config{script_prev}->[$c] = $line;
$c = $c + 1;
}
elsif ($sub_type eq "rhppc64Post") {
$rhppc64config{script_post}->[$c] = $line;
$c = $c + 1;
}
} elsif ($type eq "rhppc64Varible") {
##NODE_BLOCK##
if($line =~ /(\w+)\s*=\s*([\w\.\-\/]+)/) {
$rhppc64config{var}{$1} = $2;
print "var $1,$2\n";
}
}
}
if(exists $rhppc64config{object}){
foreach my $type (keys %{$rhppc64config{object}}){
foreach my $name (keys %{$rhppc64config{object}{$type}}){
print "$name,TYPE:$type \n";
foreach my $attr (keys %{$rhppc64config{object}{$type}{$name}}){
}
}
}
}
if(exists $rhppc64config{table}){
foreach my $type (keys %{$rhppc64config{table}}){
# log_this("TABLE:$type");
foreach my $name (keys %{$rhppc64config{table}{$type}}){
# log_this(" $rhppc64config{table}{$type}{$name}{__KEY__} = $name");
foreach my $attr (keys %{$rhppc64config{table}{$type}{$name}}){
if($attr ne '__KEY__'){
# log_this(" $attr = $rhppc64config{table}{$type}{$name}{$attr}");
}
}
# rhppc64 log_this("\n");
}
}
}
if(exists $rhppc64config{script_prev}){
# log_this("Script_Prev:");
# foreach $cmd (@{$config{script_prev}}){
# log_this(" $cmd");
# }
}
if(exists $rhppc64config{script_post}){
# log_this("Script_Post:");
#foreach $cmd (@{$config{script_post}}){
# log_this(" $cmd");
# }
}
if (exists $rhppc64config{var}){
#my $MN=$rhppc64config{var}{MN};
#my $MNIP=$rhppc64config{var}{MNIP};
#&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts");
#print "MN is $MN\n";}
send_msg("Varible:");
foreach my $varname (keys %{$rhppc64config{var}}){
send_msg(" $varname = $config{var}{$varname}");
#print "var is $rhppc64config{var}\n";
}
}
close FILE;
return 0;
}
#######################################
# step 7. Genrate local configuration file
# Do test
# Write log
#######################################
$res = &init;
if ($res != 0){
goto EXIT;
}
$res = &do_test();
if ($res) {
send_msg("DO TEST returns error, exit");
exit;
}
sub init {
if (exists $rhppc64config{var}){
my $MN=$rhppc64config{var}{MN};
my $MNIP=$rhppc64config{var}{MNIP};
my $CN=$rhppc64config{var}{CN};
my $CNIP=$rhppc64config{var}{CNIP};
my $SN=$rhppc64config{var}{SN};
my $SNIP=$rhppc64config{var}{SNIP};
my $SNCN=$rhppc64config{var}{SNCN};
my $SNCNIP=$rhppc64config{var}{SNCNIP};
my $HMC=$rhppc64config{var}{HMC};
my $HMCIP=$rhppc64config{var}{HMCIP};
my $MOUNTIP=$rhppc64config{var}{MOUNTIP};
my $DOMAIN=$rhppc64config{var}{DOMAIN};
system("xdsh $MN mkdir -p /iso/mountpoint");
print "--prepareing redhat iso file.......\n";
print "--mount NF .......";
#system ("scp -r /iso/RHEL6.4-20130130.0-Server-ppc64-DVD1.iso $MNIP:/iso/mountpoint9");
#&runcmd( " echo $HMCIP $HMC.$DOMAIN $HMC\n$MNIP $MN.$DOMAIN $MN\n$CNIP $CN.$DOMAIN $CN\n$SNIP $SN.$DOMAIN $SN\n$SNCNIP $SNCN.$DOMAIN $SNCN>>/etc/hosts.rhppc64");
&runcmd( " echo $HMCIP $HMC.$DOMAIN $HMC>>/etc/hosts.rhppc64");
&runcmd( " echo $MNIP $MN.$DOMAIN $MN>>/etc/hosts.rhppc64");
&runcmd( " echo $CNIP $CN.$DOMAIN $CN>>/etc/hosts.rhppc64");
&runcmd( " echo $SNCNIP $SNCN.$DOMAIN $SNCN>>/etc/hosts.rhppc64");
#system ("xdsh $MN echo $HMCIP $HMC.$DOMAIN $HMC\n$MNIP $MN.$DOMAIN $MN\n$CNIP $CN.$DOMAIN $CN\n$SNIP $SN.$DOMAIN $SN\n$SNCNIP $SNCN.$DOMAIN $SNCN>>/etc/hosts.rhppc64");
system ("scp -r /etc/hosts.rhppc64 $MN:/etc/hosts");
#&runcmd("mv /etc/resolv.conf /etc/resolv.conf.bak");
&runcmd("echo ; generated by /sbin/dhclient-script\nsearch $DOMAIN.\nnameserver $MNIP\nnameserver 9.114.1.1 > /etc/resolv.conf.rhppc64 ");
system ("scp -r /etc/resolve.conf.rhppc64 $MOUNTIP:/etc/resolve.conf");
print "[OK]\n";
print "--get the latest XCAT tarball.......\n";
print "--untar XCAT .......\n";
# &runcmd("tar -jxvf $XCATFILE");
# &runcmd("tar -jxvf $DEPFILE");
system("xdsh $MN rm -rf /etc/yum.repos.d/*");
system( "scp -r rhel6.4.repo $MN:/etc/yum.repos.d/rhel6.4.repo"); ######## redhat 6.4
# &runcmd("cd ./xcat-core && ./mklocalrepo.sh");
# &runcmd("cd ./xcat-dep/rh6/ppc64/ && ./mklocalrepo.sh");
system("xdsh $MN perl /autotest/xcat-core/mklocalrepo.sh");
system("xdsh $MN perl /autotest/xcat-dep/rh6/ppc64/mklocalrepo.sh");
print "--install XCAT .......\n";
system("xdsh $MN yum clean metadata");
system("xdsh $MN rpm --import /iso/mountpoint/RPM-GPG-KEY-redhat-release");
system("xdsh $MN yum -y install xCAT");
print "--install XCATTEST .......\n";
system("xdsh $MN yum -y install xCAT-test");
print "--install createrepo .......\n";
system("xdsh $MN yum -y install createrepo");
system("xdsh $MN yum -y install screen");
system("xdsh $MN yum -y install mysql-server mysql mysql-bench mysql-devel mysql-connector-odbc");
system("xdsh $MN rm -rf ./result");
system("xdsh $MN mkdir result");
# &runcmd("xdsh p6ml4n02 sysctl -n net.ipv4.ip_forward=1");
system("xdsh $MN sysctl -n net.ipv4.ip_forward=1");
print " $MN env is ready\n";
# log_this("Varible:");
# foreach my $varname (keys %{$rhppc64config{var}}){
# log_this(" $varname = $config{var}{$varname}");
#print "MNIP is $MNIP\n";
#print "SNIP is $SNIP\n";
#print "HMCIP is $HMCIP\n";
# }
}
# if($restore){
# log_this("******************************");
# log_this("Backup current xCAT database");
# log_this("******************************");
# &runcmd("mkdir -p /tmp/xCATdbbackup");
# &runcmd("dumpxCATdb -p /tmp/xCATdbbackup");
# if($::RUNCMD_RC != 0){
# &log_this("Fail to backup xCAT database");
# &runcmd("rm -rf /tmp/xCATdbbackup");
# $restore = 0;
# return 1;
#}
#}
# log_this("******************************");
# log_this("Initialize xCAT test evironment");
# log_this("******************************");
my $cmd = undef;
#foreach $cmd (@{$rhppc64config{script_prev}}){
# log_this("$cmd");
# &runcmd($cmd);
#if($::RUNCMD_RC != 0){
# &log_this("Fail to run $cmd");
# return 1;
#}
# }
if(exists $rhppc64config{object}){
foreach my $type (keys %{$rhppc64config{object}}){
foreach my $name (keys %{$rhppc64config{object}{$type}}){
$cmd = "chdef -t $type -o $name";
foreach my $attr (keys %{$rhppc64config{object}{$type}{$name}}){
$cmd = $cmd." $attr=$rhppc64config{object}{$type}{$name}{$attr}";
}
send_msg($cmd);
my $MN=$rhppc64config{var}{MN};
# xdsh $MN &runcmd($cmd);
system("xdsh $MN $cmd");
print "ok\n";
if($::RUNCMD_RC != 0){
print "fail to run $cmd\n";
send_msg("Fail to run $cmd");
return 1;
}
}
}
}
if(exists $rhppc64config{table}){
foreach my $type (keys %{$rhppc64config{table}}){
foreach my $name (keys %{$rhppc64config{table}{$type}}){
$cmd = "chtab $rhppc64config{table}{$type}{$name}{__KEY__}=$name";
foreach my $attr (keys %{$rhppc64config{table}{$type}{$name}}){
if($attr ne '__KEY__'){
$cmd = $cmd." $type.$attr=$rhppc64config{table}{$type}{$name}{$attr}";
}
}
send_msg($cmd);
# &runcmd($cmd);
system("xdsh $MN $cmd");
if($::RUNCMD_RC != 0){
&send_msg("Fail to run $cmd");
return 1;
}
}
}
}
return 0;
}
sub do_test{
my $MN=$rhppc64config{var}{MN};
$fullinst=0;
$dsklsinst=0;
$bundlerun=1;
$stateliteinst=0;
$snfullinst=0;
$dsklscnsninst=0;
$fullcnsninst=0;
$statelitecnsninst=0;
print "Start to run diskless installation ...\n";
# send_msg("******************************");
# send_msg("Reading Configure");
#send_msg("******************************");
# if(!(-e $confile)){
# send_msg("Warning: The xCAT test Configure file doesn't exist!");
# return 0;
# }
if($dsklsinst){
# system("xdsh $MN $cmd");
system("xdsh $MN rm -f /opt/xcat/share/xcat/tools/autotest/testcase/installation/linux_diskless_installation_vm");
# `cp /autotest/linux_diskless_installation_vm /opt/xcat/share/xcat/tools/autotest/testcase/installation/";
system("xdsh $MN /opt/xcat/bin/xcattest -t Linux_diskless_installation_flat_ppc64");
$output = system("xdsh $MN ls /opt/xcat/share/xcat/tools/autotest/result/failedcases.*");
if($output =~ /failedcases.(\d+)/){
$timestamp=$1;
}
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
$output = ("xdsh $MN tail /autotest/result/xcattest.log.$timestamp");
if($output =~ /Failed: (\d+)/){
if($1 != 0){
$msg_send{linux_diskless_installation_flat}{pass} = 0;
$msg_send{linux_diskless_installation_flat}{timestamp} = $timestamp;
} else {
$msg_send{linux_diskless_installation_flat}{pass} = 1;
}
}
}
if($bundlerun){
print "Start to run the automation test bucket ....\n";
system("xdsh $MN mkdir -p /autotest/result");
system("xdsh $MN /opt/xcat/bin/xcattest -b lsdef.bundle");
$output = system("xdsh ls /opt/xcat/share/xcat/tools/autotest/result/xcattest.log.*");
if($output =~ /xcattest\.log\.(\d+)/){
$timestamp = $1;
}
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
system("xdsh $MN cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current");
$output = ("xdsh $MN tail /autotest/result/xcattest.log.$timestamp");
if($output =~ /Total: (\d+) , Failed: (\d+)/){
$msg{command}{total} = $1;
$msg{command}{fail} = $2;
$msg{command}{timestamp} = $timestamp;
if($msg{command}{fail} != 0){
$msg{command}{failcase} = "| | | Failed cases:"."\n";
$output = `cat /autotest/result/failedcases.$timestamp | grep END`;
while($output =~ /END::(\w+)/g){
$msg{command}{failcase} = $msg{command}{failcase}."| | | ".$1."\n";
# print "$msg{command}{failcase}";
}
print "$msg{command}{failcase}";
}
}
}
if($stateliteinst){
`rm -f /opt/xcat/share/xcat/tools/autotest/testcase/installation/linux_statelite_installation_vm`;
# `cp /autotest/linux_statelite_installation_vm /opt/xcat/share/xcat/tools/autotest/testcase/installation/`;
system("/opt/xcat/bin/xcattest -t Linux_statelite_installation_flat_ppc64");
$output = `ls /opt/xcat/share/xcat/tools/autotest/result/failedcases.*`;
if($output =~ /failedcases\.(\d+)/){
$timestamp = $1;
}
`mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/`;
`cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current`;
$output = `tail /autotest/result/xcattest.log.$timestamp`;
if($output =~ /Failed: (\d+)/){
if($1 != 0){
$msg{linux_statelite_installation_flat}{pass} = 0;
$msg{linux_statelite_installation_flat}{timestamp} = $timestamp;
} else {
$msg{linux_statelite_installation_flat}{pass} = 1;
}
}
}
if($fullinst){
`rm -f /opt/xcat/share/xcat/tools/autotest/testcase/installation/linux_full_installation_vm`;
# `cp /autotest/linux_full_installation_vm /opt/xcat/share/xcat/tools/autotest/testcase/installation/`;
system("/opt/xcat/bin/xcattest -t Linux_full_installation_flat_ppc64");
$output = `ls /opt/xcat/share/xcat/tools/autotest/result/failedcases.*`;
if($output =~ /failedcases\.(\d+)/){
$timestamp = $1;
}
`mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/`;
`cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current`;
$output = `tail /autotest/result/xcattest.log.$timestamp`;
if($output =~ /Failed: (\d+)/){
if($1 != 0){
$msg{linux_full_installation_flat}{pass} = 0;
$msg{linux_full_installation_flat}{timestamp} = $timestamp;
} else {
$msg{linux_full_installation_flat}{pass} = 1;
}
}
}
if($snfullinst){
`rm -f /opt/xcat/share/xcat/tools/autotest/testcase/installation/linux_sn_installation_vm`;
`cp /autotest/linux_sn_installation_vm /opt/xcat/share/xcat/tools/autotest/testcase/installation/`;
system("/opt/xcat/bin/xcattest -t Linux_sn_installation_flat_x86_vm");
$output = `ls /opt/xcat/share/xcat/tools/autotest/result/failedcases.*`;
if($output =~ /failedcases\.(\d+)/){
$timestamp = $1;
}
`mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/`;
`cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current`;
$output = `tail /autotest/result/xcattest.log.$timestamp`;
if($output =~ /Failed: (\d+)/){
if($1 != 0){
$msg{linux_sn_installation_flat}{pass} = 0;
$msg{linux_sn_installation_flat}{timestamp} = $timestamp;
} else {
$msg{linux_sn_installation_flat}{pass} = 1;
}
}
}
if($dsklscnsninst){
`rm -f /opt/xcat/share/xcat/tools/autotest/testcase/installation/linux_cn_with_sn_diskless_installation_vm`;
`cp /autotest/linux_cn_with_sn_diskless_installation_vm /opt/xcat/share/xcat/tools/autotest/testcase/installation/`;
system("/opt/xcat/bin/xcattest -t Linux_cn_with_sn_diskless_installation_flat_x86_vm");
$output = `ls /opt/xcat/share/xcat/tools/autotest/result/failedcases.*`;
if($output =~ /failedcases\.(\d+)/){
$timestamp = $1;
}
`mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/`;
`cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current`;
$output = `tail /autotest/result/xcattest.log.$timestamp`;
if($output =~ /Failed: (\d+)/){
if($1 != 0){
$msg{linux_cn_with_sn_diskless_installation_flat}{pass} = 0;
$msg{linux_cn_with_sn_diskless_installation_flat}{timestamp} = $timestamp;
} else {
$msg{linux_cn_with_sn_diskless_installation_flat}{pass} = 1;
}
}
}
if($statelitecnsninst){
`rm -f /opt/xcat/share/xcat/tools/autotest/testcase/installation/linux_cn_with_sn_statelite_installation_vm`;
`cp /autotest/linux_cn_with_sn_statelite_installation_vm /opt/xcat/share/xcat/tools/autotest/testcase/installation/`;
system("/opt/xcat/bin/xcattest -t Linux_cn_with_sn_statelite_installation_flat_x86_vm");
$output = `ls /opt/xcat/share/xcat/tools/autotest/result/failedcases.*`;
if($output =~ /failedcases\.(\d+)/){
$timestamp = $1;
}
`mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/`;
`cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current`;
$output = `tail /autotest/result/xcattest.log.$timestamp`;
if($output =~ /Failed: (\d+)/){
if($1 != 0){
$msg{linux_cn_with_sn_statelite_installation_flat}{pass} = 0;
$msg{linux_cn_with_sn_statelite_installation_flat}{timestamp} = $timestamp;
} else {
$msg{linux_cn_with_sn_statelite_installation_flat}{pass} = 1;
}
}
}
if($fullcnsninst){
`rm -f /opt/xcat/share/xcat/tools/autotest/testcase/installation/linux_cn_with_sn_full_installation_vm`;
`cp /autotest/linux_cn_with_sn_full_installation_vm /opt/xcat/share/xcat/tools/autotest/testcase/installation/`;
system("/opt/xcat/bin/xcattest -t Linux_cn_with_sn_full_installation_flat_x86_vm");
$output = `ls /opt/xcat/share/xcat/tools/autotest/result/failedcases.*`;
if($output =~ /failedcases\.(\d+)/){
$timestamp = $1;
}
`mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/`;
`cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current`;
$output = `tail /autotest/result/xcattest.log.$timestamp`;
if($output =~ /Failed: (\d+)/){
if($1 != 0){
$msg{linux_cn_with_sn_full_installation_flat}{pass} = 0;
$msg{linux_cn_with_sn_full_installation_flat}{timestamp} = $timestamp;
} else {
$msg{linux_cn_with_sn_full_installation_flat}{pass} = 1;
}
}
}
`mv /autotest/result/failedcases.* /autotest/result/failcases/`;
`mv /autotest/result/xcattest.log.* /autotest/result/log/`;
`mv /autotest/result/performance.report.* /autotest/result/performance`;
print "\nlog for failed cases is in /autotest/result/failcases/";
print "\nxcattest.log is in /autotest/result/log/";
print "\nperformance.report log is in /autotest/result/performance\n";
$mailprog = "/bin/mail";
$subject = "[xcat-autotest] autotest result for xCAT 2.8 on Redhat6.3";
$message = "\nBuild: $latestbuild Host:10.1.34.1[Redhat 6.3 RC2]\n";
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
$message = $message." | RESULT | Remark \n";
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
if($fullinst){
if($msg{linux_full_installation_flat}{pass}){
$message = $message."| full installation | PASS |\n";
}else{
$message = $message."| full installation | FAIL |";
$message = $message." See /autotest/result/failcases/failedcases.$msg{linux_full_installation_flat}{timestamp}\n";
}
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
}
if($dsklsinst){
if($msg{linux_diskless_installation_flat}{pass}){
$message = $message."| diskless installation | PASS |\n";
}else{
$message = $message."| diskless installation | FAIL |";
$message = $message." See /autotest/result/failcases/failedcases.$msg{linux_diskless_installation_flat}{timestamp}\n";
}
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
}
if($stateliteinst){
if($msg{linux_statelite_installation_flat}{pass}){
$message = $message."| statelite installation | PASS |\n";
}else{
$message = $message."| statelite installation | FAIL |";
$message = $message." See /autotest/result/failcases/failedcases.$msg{linux_statelite_installation_flat}{timestamp}\n";
}
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
}
if($snfullinst){
if($msg{linux_sn_installation_flat}{pass}){
$message = $message."| servicenode installation | PASS |\n";
}else{
$message = $message."| servicenode installation | FAIL |";
$message = $message." See /autotest/result/failcases/failedcases.$msg{linux_statelite_installation_flat}{timestamp}\n";
}
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
}
if($dsklscnsninst){
if($msg{linux_cn_with_sn_diskless_installation_flat}{pass}){
$message = $message."| diskless with sn installation | PASS |\n";
}else{
$message = $message."| diskless with sn installation | FAIL |";
$message = $message." See /autotest/result/failcases/failedcases.$msg{linux_cn_with_sn_diskless_installation_flat}{timestamp}\n";
}
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
if($statelitecnsninst){
if($msg{linux_cn_with_sn_statelite_installation_flat}{pass}){
$message = $message."| statelite with sn installation | PASS |\n";
}else{
$message = $message."| statelite with sn installation | FAIL |";
$message = $message." See /autotest/result/failcases/failedcases.$msg{linux_cn_with_sn_statelite_installation_flat}{timestamp}\n";
}
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
}
if($fullcnsninst){
if($msg{linux_cn_with_sn_full_installation_flat}{pass}){
$message = $message."| diskfull with sn installation | PASS |\n";
}else{
$message = $message."| diskfull with sn installation | FAIL |";
$message = $message." See /autotest/result/failcases/failedcases.$msg{linux_cn_with_sn_full_installation_flat}{timestamp}\n";
}
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
}
if($bundlerun){
if($msg{command}{fail} == 0){
$message = $message."| commands | PASS | Total:$msg{command}{total}\n";
} else {
$message = $message."| commands | FAIL | Total:$msg{command}{total}, Failed:$msg{command}{fail}\n$msg{command}{failcase}\n";
$message = $message."| | | See /autotest/result/failcases/failedcases.$msg{command}{timestamp}\n";
}
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
}
$message = $message."Note: This message is sent by Automated test system, Please don't reply it\n";
$sendmail = "echo \"$message\"";
$email = "bybai\@cn.ibm.com";
$sendmail = $sendmail." | $mailprog -s \"$subject\" \"$email\" ";
system($sendmail);
}
#######################################
# step 8. Copy code and configuration
#######################################
$res = pro_result();
if ($res) {
send_msg("PROCESS RESULT returns error, exit");
exit;
}
#########
sub runcmd
{
my ($cmd) = @_;
my $rc = 0;
$::RUNCMD_RC = 0;
my $outref = [];
@$outref = `$cmd 2>&1`;
if ($?)
{
$rc = $? ;
$::RUNCMD_RC = $rc;
}
chomp(@$outref);
return @$outref;
}
sub trim
{
my $str = shift @_;
if($str){
# $str =~ s/\#/__wellnumber__/g;
$str =~ s/^\s+|#.+|\s+$//g;
# $str =~ s/__wellnumber__/#/g;
}
return $str;
}
########
+1 -1
View File
@@ -20,7 +20,7 @@ AutoReqProv: no
# also need to fix Requires for AIX
%ifos linux
BuildArch: noarch
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser grub2-xcat
Obsoletes: atftp-xcat
%endif
+264
View File
@@ -0,0 +1,264 @@
#! /usr/bin/perl
package genrestapidoc;
my @apigroups = (
{
groupname => 'node',
header => "Node Resources",
desc => "The URI list which can be used to create, query, change and manage nodes.",
resources => ['allnode', 'nodeallattr', 'nodeattr', 'power', 'energy', 'energyattr', 'serviceprocessor', 'nextboot',
'vitals', 'vitalsattr', 'inventory', 'inventoryattr', 'eventlog', 'beacon', 'bootstat',
'updating','filesyncing','software_maintenance','postscript', 'nodeshell', 'nodecopy',]
},
{
groupname => 'policy',
header => "Policy Resources",
desc => "URI list which can be used to create, query, change and manage policy entries.",
resources => ['policy', 'policy_allattr', 'policy_attr']
},
{
groupname => 'globalconf',
header => "Global Configuration Resources",
desc => "URI list which can be used to create, query, change global configuration.",
resources => ['all_site']
},
{
groupname => 'table',
header => "Table Resources",
desc => "URI list which can be used to create, query, change global configuration.",
resources => ['table_nodes', 'table_rows']
},
{
# groupname => 'network',
resources => ['network', 'network_allattr']
},
);
my %formathdl = (
text => \&outtext,
wiki => \&outwiki,
);
my @errmsg;
sub outtext {
my $def = shift;
my $opt = shift;
my $res = shift;
if ($res) {
if (defined ($res->{'desc'})) {
print "\n$res->{'desc'}\n";
}
foreach (1..10) {
if (defined ($res->{'desc'.$_})) {
print $res->{'desc'.$_}."\n";
}
}
}
my $postfix = "?userName=root&password=cluster&pretty=1";
if (defined ($def->{desc})) {
print " $opt - $def->{desc}\n";
}
foreach (1..10) {
if (defined ($def->{'desc'.$_})) {
print " ".$def->{'desc'.$_}."\n";
}
}
if (defined ($def->{usage})) {
my @parts = split ('\|', $def->{usage});
if ($parts[1]) {
print " Parameters: $parts[1]\n";
}
if ($parts[2]) {
print " Returns: $parts[2]\n";
}
}
if (defined ($def->{example})) {
my @parts = split ('\|', $def->{example});
print " Example:\n";
if ($parts[1]) {
print " $parts[1]\n";
} else {
push @errmsg, "Error format in:[".$def->{desc}."]\n";
}
if ($parts[2] && $parts[3] && $parts[4]) {
my ($uri, $data);
if ($parts[3] =~ /\s+/) {
($uri, $data) = split(/ /, $parts[3]);
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
} else {
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$parts[3]$postfix\'\n";
}
$parts[4] =~ s/\n/\n /g;
print " $parts[4]\n";
} else {
push @errmsg, "Error format in:[".$def->{desc}."]\n";
}
} else {
push @errmsg, "Error format in:[".$def->{desc}."]\n";
}
}
sub outwiki {
my $def = shift;
my $opt = shift;
my $res = shift;
if ($res) {
if (defined ($res->{'desc'})) {
print "===$res->{'desc'}===\n";
}
foreach (1..10) {
if (defined ($res->{'desc'.$_})) {
print $res->{'desc'.$_}."\n\n";
}
}
}
my $postfix = "?userName=root&password=cluster&pretty=1";
if (defined ($def->{desc})) {
print "===='''$opt - $def->{desc}'''====\n";
}
foreach (1..10) {
if (defined ($def->{'desc'.$_})) {
print $def->{'desc'.$_}."\n\n";
}
}
if (defined ($def->{cmd})) {
my $manpath = search_manpage($def->{cmd});
if ($manpath) {
print "Refer to the man page:[http://xcat.sourceforge.net".$manpath.".html ".$def->{cmd}."]\n\n";
} else {
print "Refer to the man page of ".$def->{cmd}." command.\n\n";
}
}
if (defined ($def->{usage})) {
my @parts = split ('\|', $def->{usage});
if ($parts[1]) {
print "'''Parameters:'''\n\n*$parts[1]\n";
}
if ($parts[2]) {
print "'''Returns:'''\n\n*$parts[2]\n";
}
}
if (defined ($def->{example})) {
my @parts = split ('\|', $def->{example});
print "'''Example:'''\n\n";
if ($parts[1]) {
print "$parts[1]\n";
} else {
push @errmsg, "Error format for:[".$def->{desc}."]\n";
}
if ($parts[2] && $parts[3] && $parts[4]) {
my ($uri, $data);
if ($parts[3] =~ /\s+/) {
($uri, $data) = split(/ /, $parts[3]);
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$uri$postfix\' -H Content-Type:application/json --data \'$data\'\n";
} else {
print " #curl -X $parts[2] -k \'https://127.0.0.1/xcatws$parts[3]$postfix\'\n";
}
$parts[4] =~ s/\n/\n /g;
print " $parts[4]\n";
} else {
push @errmsg, "Error format for:[".$def->{desc}."]\n";
}
} else {
push @errmsg, "Error format for:[".$def->{desc}."]\n";
}
}
sub search_manpage {
my $cmd = shift;
if (-d "/opt/xcat/share/man") {
my $run = "cd /opt/xcat/share/man; find . | grep \'$cmd\\.\'";
my @output = `$run`;
if (@output) {
$output[0] =~ s/^\.//;
chomp($output[0]);
return $output[0];
}
}
return undef;
}
sub gendoc {
my $URIdef = shift;
my $format = shift;
unless ($format) {
$format = "text";
}
foreach my $group (@apigroups) {
my $groupname = $group->{'groupname'};
if (defined ($URIdef->{$groupname})) {
# display the head of resource group
if ($format eq "text") {
print "############################################\n";
print "##########".$group->{'header'}."\n";
print $group->{'desc'}."\n";
print "############################################\n";
} elsif ($format eq "wiki") {
print "==".$group->{'header'}."==\n";
print $group->{'desc'}."\n";
}
foreach my $res (@{$group->{'resources'}}) {
if (defined ($URIdef->{$groupname}->{$res})) {
my $headdone;
if (defined ($URIdef->{$groupname}->{$res}->{GET})) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{GET}, "GET", $URIdef->{$groupname}->{$res});
$headdone = 1;
}
if (defined ($URIdef->{$groupname}->{$res}->{PUT})) {
if ($headdone) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{PUT}, "PUT");
} else {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{PUT}, "PUT", $URIdef->{$groupname}->{$res});
}
}
if (defined ($URIdef->{$groupname}->{$res}->{POST})) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{POST}, "POST");
}
if (defined ($URIdef->{$groupname}->{$res}->{DELETE})) {
$formathdl{$format}->($URIdef->{$groupname}->{$res}->{DELETE}, "DELETE");
}
} else {
push @errmsg, "Cannot find the definition for resource [$res]\n";
}
}
} else {
push @errmsg, "Cannot find the definition for resource group [$groupname]\n";
}
}
if (@errmsg) {
print "\n\n\n================= Error Messages ===================\n";
print @errmsg;
}
}
1;
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -117,7 +117,7 @@ curl -# -X POST -k "https://127.0.0.1/xcatws/node/$nr/dcp?userName=$user&passwor
| grep -q '"errorcode":"0"'; chkrc
# test the table calls
#curl -# -X GET -k "https://127.0.0.1/xcatws/table/nodelist/test001?userName=$user&password=$pw&$format"
curl -# -X GET -k "https://127.0.0.1/xcatws/table/nodelist/wstest?userName=$user&password=$pw&$format"
exit
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,89 @@
start:makeroutes_h
cmd:makeroutes -h
check:rc==0
check:output=~Usage
end
start:makeroutes_v
cmd:makeroutes -v
check:rc==0
check:output=~Version
end
start:makeroutes_r_d_node
cmd:chtab routename=testr routes.net=10.1.0.0 routes.mask=255.255.0.0 routes.gateway=10.1.254.254
check:rc==0
cmd: makeroutes $$CN -r testr
check:rc==0
cmd:xdsh $$CN route
check:rc==0
check:output=~10.1.0.0\s*10.1.254.254\s*255.255.0.0
cmd: makeroutes $$CN -d -r testr
check:rc==0
cmd:xdsh $$CN route
check:rc==0
check:output!=10.1.0.0\s*10.1.254.254\s*255.255.0.0
cmd:chtab -d routename=testr routes
check:rc==0
end
start:makeroutes_r_d
cmd:chtab routename=testr routes.net=10.1.0.0 routes.mask=255.255.0.0 routes.gateway=10.1.254.254
check:rc==0
cmd: makeroutes -r testr
check:rc==0
cmd:route
check:rc==0
check:output=~10.1.0.0\s*10.1.254.254\s*255.255.0.0
cmd: makeroutes -d -r testr
check:rc==0
cmd:route
check:rc==0
check:output!=10.1.0.0\s*10.1.254.254\s*255.255.0.0
cmd:chtab -d routename=testr routes
check:rc==0
end
start:makeroutes_use_site_mnroutenames
cmd:chtab routename=testr routes.net=10.1.0.0 routes.mask=255.255.0.0 routes.gateway=10.1.254.254
check:rc==0
cmd:chtab key=mnroutenames site.value=testr
check:rc==0
cmd: makeroutes
check:rc==0
cmd:route
check:rc==0
check:output=~10.1.0.0\s*10.1.254.254\s*255.255.0.0
cmd: makeroutes -d
check:rc==0
cmd:route
check:rc==0
check:output!=10.1.0.0\s*10.1.254.254\s*255.255.0.0
cmd:chtab -d key=mnroutenames site
check:rc==0
cmd:chtab -d routename=testr routes
check:rc==0
end
start:makeroutes_use_noderes_routenames
cmd:chtab routename=testr routes.net=10.1.0.0 routes.mask=255.255.0.0 routes.gateway=10.1.254.254
check:rc==0
cmd:chtab node=$$CN noderes.routenames=testr
check:rc==0
cmd: makeroutes $$CN
check:rc==0
cmd:xdsh $$CN route
check:rc==0
check:output=~10.1.0.0\s*10.1.254.254\s*255.255.0.0
cmd: makeroutes $$CN -d
check:rc==0
cmd:xdsh $$CN route
check:rc==0
check:output!=10.1.0.0\s*10.1.254.254\s*255.255.0.0
cmd:chtab node=$$CN noderes.routenames=
check:rc==0
cmd:chtab -d routename=testr routes
check:rc==0
end
+100
View File
@@ -0,0 +1,100 @@
start:ppping_h
cmd:ppping -h
check:rc==0
check:output=~Usage
end
start:ppping_v
cmd:ppping -v
check:rc==0
check:output=~Version
end
start:ppping_node
cmd:ping -c 3 $$CN > /dev/null 2>&1
check:rc==0
cmd:ppping $$CN
check:rc==0
check:output=~$$CN: pinged all nodes successfully
end
start:ppping_V_node
cmd:ping -c 3 $$CN > /dev/null 2>&1
check:rc==0
cmd:ppping -V $$CN
check:rc==0
check:output=~$$CN: $$CN: ping
end
start:ppping_q_node
cmd:ping -c 3 $$CN > /dev/null 2>&1
check:rc==0
cmd:ppping -q $$CN
check:rc==0
check:output=~
end
start:ppping_d_node
cmd:ppping -d $$CN
check:rc==0
check:output=~[start]
check:output=~[stop]
end
start:ppping_i_node
cmd:ping -c 3 $$CN > /dev/null 2>&1
check:rc==0
cmd:cp /etc/hosts /etc/hosts.bak
check:rc==0
cmd:a=`cat /etc/hosts |grep ' $$CN.'|awk '{print $1}'`;b=`cat /etc/resolv.conf |grep search|awk '{print $2}'`;echo "$a $$CN-eth0.$b $$CN-eth0" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:ppping $$CN -i eth0
check:rc==0
check:output=~$$CN: pinged all nodes successfully on interface eth0
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.bak /etc/hosts
check:rc==0
end
start:ppping_nodes
cmd:ping -c 3 $$CN > /dev/null 2>&1
check:rc==0
cmd:ping -c 3 $$SN > /dev/null 2>&1
check:rc==0
cmd:ppping $$SN,$$CN
check:rc==0
check:output=~$$SN: pinged all nodes successfully
check:output=~$$CN: pinged all nodes successfully
end
start:ppping_V_nodes
cmd:ping -c 3 $$CN > /dev/null 2>&1
check:rc==0
cmd:ping -c 3 $$SN > /dev/null 2>&1
check:rc==0
cmd:ppping -V $$SN,$$CN
check:rc==0
check:output=~$$CN: $$CN: ping
check:output=~$$CN: $$SN: ping
check:output=~$$SN: $$SN: ping
check:output=~$$SN: $$CN: ping
end
start:ppping_V_s_nodes
cmd:ping -c 3 $$CN > /dev/null 2>&1
check:rc==0
cmd:ping -c 3 $$SN > /dev/null 2>&1
check:rc==0
cmd:ppping -V -s $$SN,$$CN
check:rc==0
check:output=~$$SN: $$SN: ping*\n$$SN: $$CN: ping*\n$$CN: $$SN: ping*\n$$CN: $$CN: ping
end
+52
View File
@@ -0,0 +1,52 @@
start:prsync_h
cmd:prsync -h
check:rc==0
check:output=~Usage
end
start:prsync_v
cmd:prsync -v
check:rc==0
check:output=~Version
end
start:prsync_dir_node
cmd: mkdir -p /tmp/pscp
check:rc==0
cmd:echo "test" > /tmp/pscp/pscp.tmp
check:rc==0
cmd:prsync -o "crz" /tmp/pscp $$CN:/tmp/
check:rc==0
check:$$CN: done
cmd:xdsh $$CN "ls -l /tmp |grep pscp"
check:rc==0
check:output=~pscp
cmd:xdsh $$CN "ls -l /tmp/pscp |grep pscp.tmp"
check:rc==0
check:output=~pscp.tmp
cmd:xdsh $$CN "cat /tmp/pscp/pscp.tmp"
check:rc==0
check:output=~test
cmd:xdsh $$CN "rm -rf /tmp/pscp"
check:rc==0
cmd:rm -rf /tmp/pscp
check:rc==0
end
start:prsync_file_node
cmd: echo "prsync-test" > prsync.test
check:rc==0
cmd:prsync prsync.test $$CN:/tmp/
check:rc==0
check:$$CN: done
cmd:xdsh $$CN "ls -l /tmp |grep prsync.test"
check:rc==0
check:output=~prsync.test
cmd:xdsh $$CN "cat /tmp/prsync.test"
check:rc==0
check:output=~prsync-test
cmd:xdsh $$CN "rm -rf /tmp/prsync.test"
check:rc==0
cmd:rm -rf prsync.test
check:rc==0
end
+84
View File
@@ -0,0 +1,84 @@
start:pscp_h
cmd:pscp -h
check:rc==0
check:output=~Usage
end
start:pscp_v
cmd:pscp -v
check:rc==0
check:output=~Version
end
#copy single file
start:pscp_node
cmd:echo "test" > /tmp/pscp.tmp
check:rc==0
cmd:pscp /tmp/pscp.tmp $$CN:/tmp/
check:rc==0
check:$$CN: done
cmd:xdsh $$CN "ls -l /tmp |grep pscp.tmp"
check:rc==0
check:output=~pscp.tmp
cmd:xdsh $$CN "cat /tmp/pscp.tmp"
check:rc==0
check:output=~test
cmd:xdsh $$CN "rm -f /tmp/pscp.tmp"
check:rc==0
cmd:rm -f /tmp/pscp.tmp
check:rc==0
end
#copy a directory
start:pscp_r_node
cmd: mkdir -p /tmp/pscp
check:rc==0
cmd:echo "test" > /tmp/pscp/pscp.tmp
check:rc==0
cmd:pscp -r /tmp/pscp $$CN:/tmp/
check:rc==0
check:$$CN: done
cmd:xdsh $$CN "ls -l /tmp |grep pscp"
check:rc==0
check:output=~pscp
cmd:xdsh $$CN "ls -l /tmp/pscp |grep pscp.tmp"
check:rc==0
check:output=~pscp.tmp
cmd:xdsh $$CN "cat /tmp/pscp/pscp.tmp"
check:rc==0
check:output=~test
cmd:xdsh $$CN "rm -rf /tmp/pscp"
check:rc==0
cmd:rm -rf /tmp/pscp
check:rc==0
end
start:pscp_i_node
cmd:cp /etc/hosts /etc/hosts.bak
check:rc==0
cmd:a=`cat /etc/hosts |grep ' $$CN.'|awk '{print $1}'`;b=`cat /etc/resolv.conf |grep search|awk '{print $2}'`;echo "$a $$CN-eth0.$b $$CN-eth0" >> /etc/hosts
check:rc==0
cmd:makedns -n
check:rc==0
cmd:echo "pscp" > /tmp/pscp.tmp
check:rc==0
cmd:pscp -i eth0 /tmp/pscp.tmp $$CN:/tmp
check:rc==0
check:output=~$$CN-eth0: done
cmd:xdsh $$CN "ls -l /tmp |grep pscp.tmp"
check:rc==0
check:output=~pscp.tmp
cmd:xdsh $$CN "cat /tmp/pscp.tmp"
check:rc==0
check:output=~pscp
cmd:xdsh $$CN "rm -rf /tmp/pscp.tmp"
check:rc==0
cmd:rm -rf /tmp/pscp.tmp
check:rc==0
cmd:rm -f /etc/hosts
check:rc==0
cmd:mv /etc/hosts.bak /etc/hosts
check:rc==0
end
+104
View File
@@ -0,0 +1,104 @@
start:sysclone
cmd:makedns -n
check:rc==0
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:makeconservercf $$GOLDEN_CLIENT
check:rc==0
cmd:makeconservercf $$TARGET_NODE
check:rc==0
cmd:copycds $$ISO
check:rc==0
cmd:yum -y install systemimager-server
check:rc==0
cmd:lsdef
check:output=~$$GOLDEN_CLIENT
check:output=~$$TARGET_NODE
cmd:rpm -qa|grep perl-AppConfig
check:output=~perl-AppConfig[0-9.-]*noarch
cmd:rpm -qa|grep systemconfigurator
check:output=~systemconfigurator[0-9.-]*noarch
cmd:rpm -qa|grep systemimager-common
check:output=~systemimager-common[0-9.-]*noarch
cmd:rpm -qa|grep genisoimage
check:output=~genisoimage[0-9.-]*el6.x86_64
cmd:rpm -qa|grep systemimager-server
check:output=~systemimager-server[0-9.-]*noarch
cmd:mkdir -p $$OTHERPKGDIR/xcat
check:rc==0
cmd:cp $$XCAT_DEP_TARBALL_PATH/$$XCAT_DEP_TARBALL $$OTHERPKGDIR/xcat
check:rc==0
cmd:cd $$OTHERPKGDIR/xcat && tar xvf $$XCAT_DEP_TARBALL
check:rc==0
cmd:chdef -t osimage -o $$GOS-x86_64-install-compute -p otherpkgdir=$$OTHERPKGDIR
check:rc==0
cmd:chdef -t osimage -o $$GOS-x86_64-install-compute otherpkglist=$$OTHERPKGLIST
check:rc==0
cmd:nodeset $$GOLDEN_CLIENT osimage=$$GOS-x86_64-install-compute
check:rc==0
cmd:rsetboot $$GOLDEN_CLIENT net
check:rc==0
cmd:rpower $$GOLDEN_CLIENT reset
check:rc==0
cmd:sleep 500
cmd:a=0;while ! `lsdef -l $$GOLDEN_CLIENT|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 200 ];then break;fi done
cmd:ping $$GOLDEN_CLIENT -c 3
check:output=~64 bytes from $$GOLDEN_CLIENT
cmd:lsdef -l $$GOLDEN_CLIENT | grep status
check:output=~booted
cmd:xdsh $$GOLDEN_CLIENT date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$GOLDEN_CLIENT "rpm -qa|grep systemimager-client"
check:output=~$$GOLDEN_CLIENT: systemimager-client*
cmd:xdsh $$GOLDEN_CLIENT "rpm -qa|grep perl-AppConfig"
check:output=~$$GOLDEN_CLIENT: perl-AppConfig*
cmd:xdsh $$GOLDEN_CLIENT "rpm -qa|grep systemconfigurator"
check:output=~$$GOLDEN_CLIENT: systemconfigurator*
cmd:xdsh $$GOLDEN_CLIENT "rpm -qa|grep systemimager-common"
check:output=~$$GOLDEN_CLIENT: systemimager-common*
cmd:xdsh $$GOLDEN_CLIENT "cd /home && >test.file"
check:rc==0
cmd:imgcapture $$GOLDEN_CLIENT -t sysclone -o goldenclient-osimage-$$GOS-$$MODE -V
check:rc==0
cmd:lsdef -t osimage goldenclient-osimage-$$GOS-$$MODE| grep provmethod
check:output=~sysclone
cmd:nodeset $$TARGET_NODE osimage=goldenclient-osimage-$$GOS-$$MODE
check:rc==0
cmd:rsetboot $$TARGET_NODE net
check:rc==0
cmd:rpower $$TARGET_NODE reset
check:rc==0
cmd:sleep 300
cmd:a=0;while ! `lsdef -l $$TARGET_NODE|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done
cmd:ping $$TARGET_NODE -c 3
check:output=~64 bytes from $$TARGET_NODE
cmd:lsdef -l $$TARGET_NODE | grep status
check:output=~booted
cmd:xdsh $$TARGET_NODE date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$TARGET_NODE "ls -l /home"
check:output=~test.file
cmd:xdsh $$TARGET_NODE "hostname"
check:output=~$$TARGET_NODE: $$TARGET_NODE
end
+192 -1
View File
@@ -1,3 +1,15 @@
start:xdcp_h
cmd:xdcp -h
check:rc==0
check:output=~Usage
end
start:xdcp_V
cmd:xdcp -V
check:rc==0
check:output=~Version
end
start:xdcp_src_dst
cmd:xdsh $$CN rm -f /tmp/hosts
cmd:xdcp $$CN /etc/hosts /tmp/hosts
@@ -9,7 +21,8 @@ check:rc==0
cmd:xdsh $$CN rm -f /tmp/hosts
cmd:rm -f /tmp/hosts
end
start:xdcp_P
start:xdcp_P_src_dst
cmd:xdcp $$CN -P /etc/inittab /tmp/
check:rc==0
cmd:xdsh $$CN cat /etc/inittab > /tmp/inittab1
@@ -18,3 +31,181 @@ cmd:diff /tmp/inittab._$$CN /tmp/inittab1
check:rc==0
cmd:rm -f /tmp/inittab._$$CN /tmp/inittab1
end
start:xdcp_RP
cmd:xdsh $$CN "mkdir -p /tmp/xdcp/test1"
check:rc==0
cmd:xdsh $$CN "echo "test1" > /tmp/xdcp/test1/test1.txt"
check:rc==0
cmd:xdsh $$CN "mkdir -p /tmp/xdcp/test2"
check:rc==0
cmd:xdsh $$CN "echo "test2" > /tmp/xdcp/test2/test2.txt"
check:rc==0
cmd:xdcp $$CN -RP /tmp/xdcp /tmp
check:rc==0
cmd:ls -l /tmp/xdcp._$$CN
check:output=~test1
check:output=~test2
cmd:ls -l /tmp/xdcp._$$CN/test1
check:output=~test1.txt
cmd:ls -l /tmp/xdcp._$$CN/test2
check:output=~test2.txt
cmd:cat /tmp/xdcp._$$CN/test1/test1.txt
check:output=~test1
cmd:cat /tmp/xdcp._$$CN/test2/test2.txt
check:output=~test2
cmd:xdsh $$CN "rm -rf /tmp/xdcp"
check:rc==0
cmd:rm -rf /tmp/xdcp._$$CN
check:rc==0
end
start:xdcp_R
cmd:mkdir -p /tmp/xdcp/test1
check:rc==0
cmd:echo "test1" > /tmp/xdcp/test1/test1.txt
check:rc==0
cmd:mkdir -p /tmp/xdcp/test2
check:rc==0
cmd:echo "test2" > /tmp/xdcp/test2/test2.txt
check:rc==0
cmd:xdcp $$CN -R /tmp/xdcp /tmp
check:rc==0
cmd:xdsh $$CN "ls -l /tmp"
check:output=~xdcp
cmd:xdsh $$CN "ls -l /tmp/xdcp"
check:output=~test1
check:output=~test2
cmd:xdsh $$CN "ls -l /tmp/xdcp/test1"
check:output=~test1.txt
cmd:xdsh $$CN "ls -l /tmp/xdcp/test2"
check:output=~test2.txt
cmd:xdsh $$CN "cat /tmp/xdcp/test1/test1.txt"
check:output=~test1
cmd:xdsh $$CN "cat /tmp/xdcp/test2/test2.txt"
check:output=~test2
cmd:xdsh $$CN "rm -rf /tmp/xdcp"
check:rc==0
cmd:rm -rf /tmp/xdcp
check:rc==0
end
start:xdcp_all_files_of_dir
cmd:mkdir -p /tmp/xdcp/
check:rc==0
cmd:echo "test1" > /tmp/xdcp/test1.txt
check:rc==0
cmd:echo "test2" > /tmp/xdcp/test2.txt
check:rc==0
cmd:xdcp $$CN /tmp/xdcp/* /tmp
check:rc==0
cmd:xdsh $$CN "ls -l /tmp"
check:output=~test1.txt
check:output=~test2.txt
cmd:xdsh $$CN "ls -l /tmp/test1.txt"
check:output=~test1
cmd:xdsh $$CN "ls -l /tmp/test2.txt"
check:output=~test2
cmd:xdsh $$CN "rm -rf /tmp/test1.txt /tmp/test2.txt"
check:rc==0
cmd:rm -rf /tmp/xdcp
check:rc==0
end
start:xdcp_rsync
cmd:mkdir -p /tmp/xdcp/
check:rc==0
cmd:echo "test1" > /tmp/xdcp/test1.txt
check:rc==0
cmd:echo "test2" > /tmp/xdcp/test2.txt
check:rc==0
cmd:xdcp $$CN -r /usr/bin/rsync -o "-t" /tmp/xdcp/test1.txt /tmp/xdcp/test2.txt /tmp
check:rc==0
cmd:xdsh $$CN "ls -l /tmp"
check:output=~test1.txt
check:output=~test2.txt
cmd:xdsh $$CN "ls -l /tmp/test1.txt"
check:output=~test1
cmd:xdsh $$CN "ls -l /tmp/test2.txt"
check:output=~test2
cmd:xdsh $$CN "rm -rf /tmp/test1.txt /tmp/test2.txt"
check:rc==0
cmd:rm -rf /tmp/xdcp
check:rc==0
end
start:xdcp_rsyncfile_single_file
cmd:mkdir -p /tmp/xdcp/
check:rc==0
cmd:echo "test1" > /tmp/xdcp/test1.txt
check:rc==0
cmd:echo "/tmp/xdcp/test1.txt -> /tmp/" > /tmp/myrsync
check:rc==0
cmd:xdcp $$CN -F /tmp/myrsync
check:rc==0
cmd:xdsh $$CN "ls -l /tmp"
check:output=~test1.txt
cmd:xdsh $$CN "ls -l /tmp/test1.txt"
check:output=~test1
cmd:xdsh $$CN "rm -rf /tmp/test1.txt"
check:rc==0
cmd:rm -rf /tmp/xdcp /tmp/myrsync
check:rc==0
end
start:xdcp_rsyncfile_files
cmd:mkdir -p /tmp/xdcp/
check:rc==0
cmd:echo "test1" > /tmp/xdcp/test1.txt
check:rc==0
cmd:echo "test2" > /tmp/xdcp/test2.txt
check:rc==0
cmd:echo "/tmp/xdcp/* -> /tmp/" > /tmp/myrsync
check:rc==0
cmd:xdcp $$CN -F /tmp/myrsync
check:rc==0
cmd:xdsh $$CN "ls -l /tmp"
check:output=~test1.txt
check:output=~test2.txt
cmd:xdsh $$CN "ls -l /tmp/test1.txt"
check:output=~test1
cmd:xdsh $$CN "ls -l /tmp/test2.txt"
check:output=~test2
cmd:xdsh $$CN "rm -rf /tmp/test1.txt /tmp/test2.txt"
check:rc==0
cmd:rm -rf /tmp/xdcp /tmp/myrsync
check:rc==0
end
start:xdcp_rsyncfile_files_changename
cmd:mkdir -p /tmp/xdcp/
check:rc==0
cmd:echo "test1" > /tmp/xdcp/test1.txt
check:rc==0
cmd:echo "test2" > /tmp/xdcp/test2.txt
check:rc==0
cmd:echo "/tmp/xdcp/test1.txt -> /tmp/testx.txt" > /tmp/myrsync
check:rc==0
cmd:echo "/tmp/xdcp/test2.txt -> /tmp/testy.txt" >> /tmp/myrsync
check:rc==0
cmd:xdcp $$CN -F /tmp/myrsync
check:rc==0
cmd:xdsh $$CN "ls -l /tmp"
check:output=~testx.txt
check:output=~testy.txt
cmd:xdsh $$CN "cat /tmp/testx.txt"
check:output=~test1
cmd:xdsh $$CN "cat /tmp/testy.txt"
check:output=~test2
cmd:xdsh $$CN "rm -rf /tmp/testx.txt /tmp/testy.txt"
check:rc==0
cmd:rm -rf /tmp/xdcp /tmp/myrsync
check:rc==0
end
+140
View File
@@ -0,0 +1,140 @@
start:xdsh_h
cmd:xdsh -h
check:rc==0
check:output=~Usage
end
start:xdsh_V
cmd:xdsh -V
check:rc==0
check:output=~Version
end
start:xdsh_regular_command
cmd:xdsh $$CN "ps -ef"
check:rc==0
check:output=~$$CN: UID PID PPID C STIME TTY TIME CMD
end
start:xdsh_Q_command
cmd:xdsh $$CN -Q "ps -ef"
check:rc==0
check:output=~
end
start:xdsh_c_sn
cmd:xdsh $$SN "ls -l /var/xcat/syncfiles" > /dev/null 2>&1; if [ "$?" -ne "0" ]; then xdsh $$SN "mkdir -p /var/xcat/syncfiles";fi
check:rc==0
cmd: xdsh $$SN "echo 'test' > /var/xcat/syncfiles/xdsh_c.tmp"
check:rc==0
cmd: xdsh $$SN -c
check:rc==0
cmd:xdsh $$SN "ls -l /var/xcat/syncfiles"
check:rc==0
check:output=~
end
start:xdsh_c_cn
cmd:xdsh $$CN "ls -l /var/xcat/node/syncfiles" > /dev/null 2>&1; if [ "$?" -ne "0" ]; then xdsh $$CN "mkdir -p /var/xcat/node/syncfiles";fi
check:rc==0
cmd: xdsh $$CN "echo 'test' > /var/xcat/node/syncfiles/xdsh_c.tmp"
check:rc==0
cmd: xdsh $$CN -c
check:rc==0
cmd:xdsh $$CN "ls -l /var/xcat/node"
check:rc==0
check:output=~
end
start:xdsh_e_filename
cmd:echo "echo 'xdsh_e_filename test' > /tmp/xdsh_e_filename.txt" > /tmp/xdsh_script.sh
check:rc==0
cmd:chmod +x /tmp/xdsh_script.sh
check:rc==0
cmd:xdsh $$CN -e /tmp/xdsh_script.sh
check:rc==0
cmd:xdsh $$CN "ls -l /tmp |grep xdsh_e_filename.txt"
check:output=~xdsh_e_filename.txt
cmd:xdsh $$CN "cat /tmp/xdsh_e_filename.txt"
check:output=~xdsh_e_filename test
cmd:xdsh $$CN "rm -r /tmp/xdsh_e_filename.txt"
check:rc==0
cmd:rm -r /tmp/xdsh_script.sh
check:rc==0
end
start:xdsh_E
cmd:echo 'export DSH_FANOUT=8' > /tmp/xdsh.test
check:rc==0
cmd:xdsh $$CN -E /tmp/xdsh.test "export |grep DSH_FANOUT"
check:rc==0
check:output=$$CN: declare -x DSH_FANOUT="8"
cmd:rm -r /tmp/xdsh.test
check:rc==0
end
start:xdsh_i_linux
cmd:copycds $$ISO
check:rc==0
cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
check:rc==0
cmd:xdsh -i /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg "rpm -qa|grep uuid"
check:rc==0
check:output=~libuuid
end
start:xdsh_t
cmd:date +%s > /tmp/start.txt
check:rc==0
cmd:xdsh $$CN -t 5 "ssh 1.1.1.1"
check:rc!=0
check:output=~Error: Caught SIGINT - terminating the child processes.
cmd:date +%s > /tmp/end.txt
check:rc==0
cmd:a=`cat /tmp/start.txt`;b=`cat /tmp/end.txt`;c=$[$b-$a];echo $c
check:rc==0
check:output<7
cmd:rm -f /tmp/start.txt /tmp/end.txt
end
start:xdsh_q
cmd:xdsh $$CN -q
check:rc==0
check:output=~DSH:DSH_FANOUT=
end
start:xdsh_T
cmd:xdsh $$CN -T "hostname"
check:rc==0
check:output=~TRACE:Default context is XCAT
check:output=~$$CN: $$CN
end
start:xdsh_o
cmd:xdsh $$CN -o "-v" date
check:rc==0
check:output=~$$CN: OpenSSH
check:output=~$$CN: debug
end
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/awk -f
BEGIN {
if ((ENVIRON["USEOPENSSLFORXCAT"]) || (ENVIRON["AIX"])) {
server = "openssl s_client -quiet -connect " ENVIRON["XCATSERVER"] " 2> /dev/null"
server = "openssl s_client -quiet -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
} else {
server = "/inet/tcp/0/127.0.0.1/400"
}
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/awk -f
BEGIN {
if (ENVIRON["USEOPENSSLFORXCAT"]) {
server = "openssl s_client -connect " ENVIRON["XCATSERVER"] " 2> /dev/null"
server = "openssl s_client -connect " ENVIRON["XCATSERVER"] " -rand /bin/nice 2> /dev/null"
} else {
server = "/inet/tcp/0/127.0.0.1/400"
}
+25 -11
View File
@@ -240,8 +240,13 @@ add_persistent_route()
echo " up route -A inet6 add $net/$mask gw $gw" >> $tempfile
echo " down route -A inet6 del $net/$mask gw $gw" >> $tempfile
else
echo " up route add -net $net netmask $mask gw $gw" >> $tempfile
echo " down route del -net $net netmask $mask gw $gw" >> $tempfile
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
echo " up route add -net $net netmask $mask dev $ifname" >> $tempfile
echo " down route del -net $net netmask $mask dev $ifname" >> $tempfile
else
echo " up route add -net $net netmask $mask gw $gw" >> $tempfile
echo " down route del -net $net netmask $mask gw $gw" >> $tempfile
fi
fi
fi
echo $LINE | grep "iface $ifname " 2>&1 1>/dev/null
@@ -258,8 +263,13 @@ add_persistent_route()
echo " up route -A inet6 add $net/$mask gw $gw" >> $tempfile
echo " down route -A inet6 del $net/$mask gw $gw" >> $tempfile
else
echo " up route add -net $net netmask $mask gw $gw" >> $tempfile
echo " down route del -net $net netmask $mask gw $gw" >> $tempfile
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
echo " up route add -net $net netmask $mask dev $ifname" >> $tempfile
echo " down route del -net $net netmask $mask dev $ifname" >> $tempfile
else
echo " up route add -net $net netmask $mask gw $gw" >> $tempfile
echo " down route del -net $net netmask $mask gw $gw" >> $tempfile
fi
fi
fi
mv -f $tempfile $filename
@@ -278,9 +288,9 @@ add_persistent_route()
# $net/mask does not work with sed cmd
route1="$ifname $net\/$mask $gw";
else
filename="/etc/sysconfig/static-routes";
route="any net $net netmask $mask gw $gw $ifname";
route1="any net $net netmask $mask gw $gw $ifname";
filename="/etc/sysconfig/network-scripts/route-$ifname";
route="$net/$mask via $gw dev $ifname";
route1="$net\/$mask via $gw dev $ifname";
fi
if [ -f $filename ]; then
grep "$route" $filename 2>&1 1>/dev/null
@@ -400,9 +410,9 @@ rm_persistent_route()
route="$ifname $net\/$mask $gw"
route1="$ifname $net/$mask $gw"
else
filename="/etc/sysconfig/static-routes";
route="any net $net netmask $mask gw $gw $ifname";
route1="any net $net netmask $mask gw $gw $ifname";
filename="/etc/sysconfig/network-scripts/route-$ifname";
route="$net/$mask via $gw dev $ifname";
route1="$net\/$mask via $gw dev $ifname";
fi
if [ -f $filename ]; then
grep "$route" $filename 2>&1 1>/dev/null
@@ -438,7 +448,11 @@ if [ "$op" = "add" ]; then
fi
else
if [ "$(uname -s)" = "Linux" ]; then
cmd="route add -net $net netmask $mask gw $gw"
if [ "$gw" = "" -o "$gw" = "0.0.0.0" ] ; then
cmd="route add -net $net netmask $mask dev $ifname"
else
cmd="route add -net $net netmask $mask gw $gw"
fi
else
cmd="route add -net $net -netmask $mask $gw"
fi