Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
commit
bf55ee9416
@ -48,7 +48,7 @@ binary-arch: build install
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/man5/*
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/man/man7/*
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/man7/*
|
||||
./modifyUtils `cat ../Version` `svn info | grep Revision | cut -d" " -f 2`
|
||||
./modifyUtils `cat ../Version` `git log -n 1 | head -n 1 | cut -f 2 -d ' '`
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
|
@ -1901,50 +1901,6 @@ sub isIpaddr
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 getSubnetGateway
|
||||
Description:
|
||||
Get gateway from the networks table of the specified net.
|
||||
|
||||
Arguments:
|
||||
net: the net, ie. the "net" field of the networks table
|
||||
Returns:
|
||||
Return a string, of the gateway
|
||||
undef - Failed to get the gateway
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $gateway = xCAT::NetworkUtils::getSubnetGateway('192.168.1.0');
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getSubnetGateway
|
||||
{
|
||||
my $netname=shift;
|
||||
if( $netname =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$netname=shift;
|
||||
}
|
||||
|
||||
my $gateway=undef;
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
unless($nettab) { die "No entry defined in networks"; }
|
||||
my @nets = $nettab->getAllAttribs('net','gateway');
|
||||
foreach(@nets)
|
||||
{
|
||||
if("$_->{net}" eq "$netname")
|
||||
{
|
||||
$gateway = $_->{gateway};
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -2002,6 +1958,50 @@ sub getNodeNameservers{
|
||||
return \%nodenameservers;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 getNodeGateway
|
||||
Description:
|
||||
Get gateway from the networks table of the node.
|
||||
|
||||
Arguments:
|
||||
ip: the ip address of the node
|
||||
Returns:
|
||||
Return a string, of the gateway
|
||||
undef - Failed to get the gateway
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $gateway = xCAT::NetworkUtils::getNodeGateway('192.168.1.0');
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getNodeGateway
|
||||
{
|
||||
my $ip=shift;
|
||||
if( $ip =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$ip=shift;
|
||||
}
|
||||
my $gateway=undef;
|
||||
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
if ($nettab) {
|
||||
my @nets = $nettab->getAllAttribs('net','mask','gateway');
|
||||
foreach my $net (@nets) {
|
||||
if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) {
|
||||
$gateway=$net->{'gateway'};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getNodeNetworkCfg
|
||||
@ -2031,8 +2031,8 @@ sub getNodeNetworkCfg
|
||||
if( $node =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$node =shift;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
my $nets = xCAT::NetworkUtils::my_nets();
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
my $mask = undef;
|
||||
@ -2041,12 +2041,14 @@ sub getNodeNetworkCfg
|
||||
{
|
||||
my $netname;
|
||||
($netname,$mask) = split /\//, $net;
|
||||
$gateway=xCAT::NetworkUtils::getSubnetGateway($netname);
|
||||
last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1));
|
||||
}
|
||||
$gateway=xCAT::NetworkUtils::getNodeGateway($ip);
|
||||
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_hdwr_ip
|
||||
|
@ -810,6 +810,10 @@ sub senddeviceskeys
|
||||
# add to the command
|
||||
$setupcmd .=$key;
|
||||
$setupcmd .="\"";
|
||||
# Special case for vios
|
||||
if ($ENV{DEVICETYPE} eq 'vios') {
|
||||
$setupcmd = "\"echo $key | tee -a ~/.ssh/authorized_keys2\"";
|
||||
}
|
||||
# For each input device
|
||||
my @nodelist=split(/,/,$nodes);
|
||||
foreach my $node (@nodelist) {
|
||||
|
87
xCAT-SoftLayer/bin/khrem
Executable file
87
xCAT-SoftLayer/bin/khrem
Executable file
@ -0,0 +1,87 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# remove entries from the .ssh/known_hosts file for a node
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Data::Dumper;
|
||||
#$Data::Dumper::Maxdepth=2;
|
||||
|
||||
# Globals - these are set once and then only read.
|
||||
my $HELP;
|
||||
my $VERBOSE;
|
||||
my $file = '~/.ssh/known_hosts';
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: khrem <node>\n";
|
||||
exit $exitcode;
|
||||
};
|
||||
|
||||
# Process the cmd line args
|
||||
Getopt::Long::Configure("bundling");
|
||||
#Getopt::Long::Configure("pass_through");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE)) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
if (scalar(@ARGV)!=1) { $usage->(1); }
|
||||
my $node = $ARGV[0]; # if they specified a hostname match, only show svrs that start with that
|
||||
|
||||
my @output = runcmd("host $node");
|
||||
my $hostname;
|
||||
my $line = shift @output;
|
||||
#print "line=$line\n";
|
||||
if ($line =~ m/is an alias for /) {
|
||||
($hostname) = $line =~ m/is an alias for ([^\.]+)/;
|
||||
#print "hostname=$hostname\n";
|
||||
$line = shift @output;
|
||||
}
|
||||
#print "line=$line\n";
|
||||
my ($ip) = $line =~ m/has address (.+)$/;
|
||||
if (defined($hostname)) {
|
||||
print "Removing entries from $file for: $node, $hostname, $ip\n";
|
||||
runcmd("sed -i '/^$node/d;/^$hostname/d;/^$ip/d' $file");
|
||||
}
|
||||
else {
|
||||
print "Removing entries from $file for: $node, $ip\n";
|
||||
runcmd("sed -i '/^$node/d;/^$ip/d' $file");
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
|
||||
# Pring msg only if -v was specified
|
||||
sub verbose { if ($VERBOSE) { print shift, "\n"; } }
|
||||
|
||||
|
||||
|
||||
|
||||
# Run a command. If called in the context of return an array, it will capture the output
|
||||
# of the cmd and return it. Otherwise, it will display the output to stdout.
|
||||
# If the cmd has a non-zero rc, this function will die with a msg.
|
||||
sub runcmd
|
||||
{
|
||||
my ($cmd) = @_;
|
||||
my $rc;
|
||||
|
||||
$cmd .= ' 2>&1' ;
|
||||
verbose($cmd);
|
||||
|
||||
my @output;
|
||||
if (wantarray) {
|
||||
@output = `$cmd`;
|
||||
$rc = $?;
|
||||
}
|
||||
else {
|
||||
system($cmd);
|
||||
$rc = $?;
|
||||
}
|
||||
|
||||
if ($rc) {
|
||||
$rc = $rc >> 8;
|
||||
if ($rc > 0) { die "Error: rc $rc return from cmd: $cmd\n"; }
|
||||
else { die "Error: system error returned from cmd: $cmd\n"; }
|
||||
}
|
||||
elsif (wantarray) { return @output; }
|
||||
}
|
@ -12,13 +12,14 @@ use Socket;
|
||||
# Globals - these are set once and then only read.
|
||||
my $HELP;
|
||||
my $VERBOSE;
|
||||
my $DRYRUN;
|
||||
my $WAITTIME;
|
||||
my $PROVMETHOD;
|
||||
my $XCATNETBOOTTITLE = 'xCAT network boot kernel and initrd';
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [-w <waittime>] [-p <provmethod] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
|
||||
print "Usage: modifygrub [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] [-p <provmethod] <kernel-path> <initrd-path> <kernel-parms> <mn-ip>\n\n";
|
||||
if (!$exitcode) {
|
||||
print "Modify the grub config file on the node to boot the specified kernel and initrd.\n";
|
||||
}
|
||||
@ -31,7 +32,7 @@ if (-f '/etc/os-release') { die "This script doesn't support ubuntu yet.\n"; }
|
||||
Getopt::Long::Configure("bundling");
|
||||
#Getopt::Long::Configure("pass_through");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME, 'p|provmethod=s' => \$PROVMETHOD)) { $usage->(1); }
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'dryrun' => \$DRYRUN, 'w|waittime=s' => \$WAITTIME, 'p|provmethod=s' => \$PROVMETHOD)) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
if (scalar(@ARGV) != 4) { $usage->(1); }
|
||||
@ -71,13 +72,15 @@ sub addKernelParms {
|
||||
$bootif = "BOOTIF=01-$bootif";
|
||||
}
|
||||
|
||||
#todo: if you are running genesis shell (nodeset <node> shell), this if-else will depend on the nodeset done before that.
|
||||
# really should check for currstate=shell, or something like that
|
||||
if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') {
|
||||
# add additional parms for sysclone
|
||||
# DEVICE=eth0 IPADDR=10.0.0.99 NETMASK=255.255.255.0 NETWORK=10.0.0.0 BROADCAST=10.0.0.255 GATEWAY=10.0.0.1 GATEWAYDEV=eth0
|
||||
#todo: should we also add ETHER_SLEEP=$WAITTIME textmode=1 dns=$mnip ?
|
||||
$args->{kernelparms} .= " $bootif IPADDR=$ip NETMASK=$netmask NETWORK=$network BROADCAST=$broadcast GATEWAY=$gateway HOSTNAME=$nodename DEVICE=$nic GATEWAYDEV=$nic";
|
||||
}
|
||||
else { # scripted install or genesis shell
|
||||
else { # scripted install
|
||||
$args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
|
||||
}
|
||||
}
|
||||
@ -89,7 +92,8 @@ sub getNodeIpInfo {
|
||||
my ($ipprefix) = $args->{mnip}=~m/^(\d+)\./; #todo: this is a hack, just using the 1st octet of the mn ip addr
|
||||
verbose("using IP prefix $ipprefix");
|
||||
|
||||
# parse ip addr show output, looking for ipprefix, to determine nic and ip
|
||||
# parse ip addr show output, looking for ipprefix, to determine nic, ip, mac
|
||||
#todo: is there a way to find the actual/individual mac of the nic? When 2 nics are bonded, they both display the same mac.
|
||||
my @output = runcmd("ip addr show");
|
||||
my ($nic, $mac, $ipandmask);
|
||||
foreach my $line (@output) {
|
||||
@ -98,22 +102,49 @@ sub getNodeIpInfo {
|
||||
if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) |) { $mac = $mactmp; } # got mac, remember it
|
||||
if (($iptmp) = $line=~m/^\s+inet\s+($ipprefix\S+) /) { $ipandmask = $iptmp; last; } # got ip, we are done
|
||||
}
|
||||
if (!defined($ipandmask)) { die "Error: can't find a NIC with a prefix $ipprefix that communicates with".$args->{mnip}.".\n"; }
|
||||
my ($ip, $netmask, $network, $broadcast) = convertIpAndMask($ipandmask);
|
||||
|
||||
# if the nic is a bonded nic (common on sl), then find the 1st real nic that is part of it
|
||||
my $realnic = $nic;
|
||||
# if the nic is a bonded nic (common on sl), then find the 1st real nic that is up that is part of it.
|
||||
# also find that real nics real mac
|
||||
my $realnic;
|
||||
if ($nic =~ /^bond/) {
|
||||
my @nics = grep(m/\s+master\s+$nic\s+/, @output);
|
||||
if (!scalar(@nics)) { die "Error: can't find the NICs that are part of $nic.\n"; }
|
||||
($realnic) = $nics[0]=~m/^\d+:\s+(\S+): /;
|
||||
# do not need to go back thru the ip addr show output and find the mac of this nic because the mac
|
||||
# of the bond nic is the same. Plus the code below does not work right for some reason anyway.
|
||||
#foreach my $line (@output) {
|
||||
# my ($nictmp, $mactmp, $foundnic);
|
||||
# if (($nictmp) = $line=~m/^\d+:\s+(\S+): / && $nictmp eq $realnic) { $foundnic = 1; }
|
||||
# if (($mactmp) = $line=~m|^\s+link/ether\s+(\S+) | && $foundnic) { $mac = $mactmp; last; } # got mac, we are done
|
||||
#}
|
||||
foreach my $line (@nics) {
|
||||
my ($nictmp, $state) = $line=~m/^\d+:\s+(\S+): .* state\s+(\S+)/;
|
||||
if (defined($nictmp) && defined($state) && $state eq 'UP') { $realnic = $nictmp; last; } # got ip, we are done
|
||||
}
|
||||
if (!defined($realnic)) { die "Error: can't find a physical NIC that is up and part of $nic.\n"; }
|
||||
|
||||
# now get the real mac of this real nic (when 2 nics are bonded, ip addr show displays one of the nics
|
||||
# macs for both nics and the bond). So we have to depend on /proc/net/bonding/$bond instead.
|
||||
my @bondout = runcmd("cat /proc/net/bonding/$nic");
|
||||
my $foundnic;
|
||||
foreach my $line (@bondout) {
|
||||
my $mactmp;
|
||||
if ($line=~m/^Slave Interface:\s+$realnic/) { $foundnic = 1; } # found the stanza for this nic, remember it
|
||||
if ($foundnic && (($mactmp) = $line=~m/^Permanent HW addr:\s+(\S+)/)) { $mac = $mactmp; last; }
|
||||
}
|
||||
}
|
||||
else { $realnic = $nic; }
|
||||
|
||||
# centos/redhat seems to name the nic in a different order than sles on some svrs.
|
||||
# sles seems to name them in the same order as 'ip addr show' displays them, centos does not.
|
||||
# so if we are on centos right now, we need to count down to determine the number that sles
|
||||
# will give the nic that we have selected, because it is the sles naming that we care about,
|
||||
# because that is the initrd that will be running in the scripted install case.
|
||||
# For the sysclone case, genesis doxcat should be changed to use the mac to find the nic.
|
||||
if (isRedhat()) {
|
||||
my @nics = grep(m/^\d+:\s+eth/, @output);
|
||||
my $i = 0;
|
||||
foreach my $line (@nics) {
|
||||
my ($nictmp) = $line=~m/^\d+:\s+(\S+):/;
|
||||
if (defined($nictmp) && $nictmp eq $realnic) { $realnic = "eth$i"; last; } # got ip, we are done
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "Determined that SLES will call the install NIC $realnic (it has mac $mac)\n";
|
||||
|
||||
# finally, find the gateway
|
||||
my $gateway;
|
||||
@ -198,6 +229,11 @@ sub updateGrub {
|
||||
"\tkernel " . $fileprefix . $args->{kernelpath} . ' ' . $args->{kernelparms} . "\n",
|
||||
"\tinitrd " . $fileprefix . $args->{initrdpath} . "\n",
|
||||
);
|
||||
if ($DRYRUN) {
|
||||
print "Dry run: would add this stanza to $grubfile:\n";
|
||||
foreach my $l (@entry) { print $l; }
|
||||
return;
|
||||
}
|
||||
|
||||
my $needtowritefile = 1;
|
||||
if (grep(/^title\s+$XCATNETBOOTTITLE/, @lines)) { $needtowritefile = updateGrubEntry(\@lines, \@entry); } # there is already an entry in there
|
||||
|
@ -13,12 +13,13 @@ use Data::Dumper;
|
||||
# Globals - these are set once and then only read.
|
||||
my $HELP;
|
||||
my $VERBOSE;
|
||||
my $DRYRUN;
|
||||
my $WAITTIME;
|
||||
my $NOAUTOINST;
|
||||
|
||||
my $usage = sub {
|
||||
my $exitcode = shift @_;
|
||||
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [-w <waittime>] <noderange>\n\n";
|
||||
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] <noderange>\n\n";
|
||||
if (!$exitcode) {
|
||||
print "Copy the initrd, kernel, params, and static IP info to nodes, so they can net install\n";
|
||||
print "even across vlans (w/o setting up pxe/dhcp broadcast relay). This assumes a working\n";
|
||||
@ -32,7 +33,7 @@ my $usage = sub {
|
||||
Getopt::Long::Configure("bundling");
|
||||
#Getopt::Long::Configure("pass_through");
|
||||
Getopt::Long::Configure("no_pass_through");
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'w|waittime=s' => \$WAITTIME, 'a|noautoinst' => \$NOAUTOINST)) { $usage->(1); }
|
||||
if (!GetOptions('h|?|help' => \$HELP, 'v|verbose' => \$VERBOSE, 'dryrun' => \$DRYRUN, 'w|waittime=s' => \$WAITTIME, 'a|noautoinst' => \$NOAUTOINST)) { $usage->(1); }
|
||||
|
||||
if ($HELP) { $usage->(0); }
|
||||
if (scalar(@ARGV) != 1) { $usage->(1); }
|
||||
@ -45,6 +46,8 @@ copyFilesToNodes($noderange, \%bootparms);
|
||||
|
||||
updateGrubOnNodes($noderange, \%bootparms);
|
||||
|
||||
if ($DRYRUN) { exit(0); }
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
|
||||
|
||||
if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); }
|
||||
@ -66,6 +69,8 @@ sub getBootParms {
|
||||
# for now just pick the 1st one. They should all be the same, except for the node name in kcmdline
|
||||
chomp($gresults[0]);
|
||||
$gresults[0] =~ s/^\S+:\s+$attr:\s*//;
|
||||
#print "gresults='$gresults[0]'\n";
|
||||
if ($gresults[0] !~ m/\S/) { die "Error: attribute $attr not defined for the noderange. Did you run 'nodeset <noderange> osimage=<osimage>' ?\n"; }
|
||||
$bootparms{$a} = $gresults[0];
|
||||
}
|
||||
$bootparms{kcmdline} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|;
|
||||
@ -73,6 +78,7 @@ sub getBootParms {
|
||||
# from the nodes provmethod, get the osimage provmethod, so we know the type of install
|
||||
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod");
|
||||
chomp($output[0]);
|
||||
if ($output[0] =~ m/^Could not find/) { die "Error: provmethod $bootparms{provmethod} is set for the node, but there is no osimage definition by that name."; }
|
||||
my ($junk, $provmethod) = split(/=/, $output[0]);
|
||||
$bootparms{osimageprovmethod} = $provmethod;
|
||||
|
||||
@ -97,8 +103,13 @@ sub copyFilesToNodes {
|
||||
my $localfile = "/tftpboot/$file";
|
||||
# for the
|
||||
my $remotefile = '/boot/' . remoteFilename($file);
|
||||
print "Copying $localfile to $nr:$remotefile\n";
|
||||
runcmd("xdcp $nr -p $localfile $remotefile");
|
||||
if ($DRYRUN) {
|
||||
print "Dry run: would copy $localfile to $nr:$remotefile\n";
|
||||
}
|
||||
else {
|
||||
print "Copying $localfile to $nr:$remotefile\n";
|
||||
runcmd("xdcp $nr -p $localfile $remotefile");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,10 +128,11 @@ sub updateGrubOnNodes {
|
||||
my $nr = shift @_;
|
||||
my $bootparms = shift @_;
|
||||
my $vtxt = ($VERBOSE ? '-v' : '');
|
||||
my $dtxt = ($DRYRUN ? '--dryrun' : '');
|
||||
my @output = runcmd('which modifygrub');
|
||||
my $modifygrub = $output[0];
|
||||
chomp($modifygrub);
|
||||
my $cmd = "xdsh $nr -e $modifygrub $vtxt -w $WAITTIME -p " . $bootparms->{osimageprovmethod} . ' ' . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
|
||||
my $cmd = "xdsh $nr -e $modifygrub $vtxt $dtxt -w $WAITTIME -p " . $bootparms->{osimageprovmethod} . ' ' . remoteFilename($bootparms->{kernel}) . ' ' . remoteFilename($bootparms->{initrd}) . ' ';
|
||||
# we need to quote the kernel parms, both here when passing it to xdsh, and on the node
|
||||
# when xdsh is passing it to modifygrub. The way to get single quotes inside single quotes
|
||||
# is to quote each of the outer single quotes with double quotes.
|
||||
|
@ -4,26 +4,29 @@
|
||||
# Usage: configbond bond1 eth1 [eth3]
|
||||
#
|
||||
# Note: this postscript currently has some assumptions that are specific to the softlayer environment.
|
||||
# It is only used to configure bond1, because bond0 gets configured by the node provisioning process.
|
||||
# We only use this to configure bond1, because bond0 gets configured by the node provisioning process.
|
||||
# (altho this script would work for bond0)
|
||||
|
||||
use strict;
|
||||
# Check number of args
|
||||
|
||||
my $nargs = $#ARGV + 1;
|
||||
if (scalar(@ARGV) < 2 || scalar(@ARGV) > 3) {
|
||||
system("logger -t xcat -p local4.err 'Usage: configbond bond dev0 [dev1]'");
|
||||
system("logger -t xcat -p local4.err 'Usage: configbond <bond> <dev0> [<dev1>]'");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $bond = shift(@ARGV);
|
||||
my $nic = $ARGV[0];
|
||||
my @devs = ();
|
||||
push(@devs,$ARGV[0]);
|
||||
if (defined($ARGV[1])) { push(@devs,$ARGV[1]); }
|
||||
my @devs;
|
||||
push(@devs,@ARGV);
|
||||
my $nicips = $ENV{NICIPS};
|
||||
my $nicnetworks = $ENV{NICNETWORKS};
|
||||
my $net_cnt = $ENV{NETWORKS_LINES};
|
||||
|
||||
#todo: change this script so they dont need to specify nicnetworks
|
||||
if (!$nicips || !$nicnetworks) { system("logger -t xcat -p local4.err 'configbond: must specify attributes nicips and nicnetworks in the xcat db for this node.'"); exit 1; }
|
||||
|
||||
#todo: these are specific to softlayer. They should be another attribute or argument
|
||||
my $bondingopts = 'mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1';
|
||||
|
||||
|
@ -82,6 +82,7 @@
|
||||
<bonding_master>yes</bonding_master>
|
||||
<bonding_module_opts>mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1</bonding_module_opts>
|
||||
<bonding_slave0>eth0</bonding_slave0>
|
||||
<bonding_slave1>eth2</bonding_slave1>
|
||||
<device>bond0</device>
|
||||
<bootproto>static</bootproto>
|
||||
<startmode>auto</startmode>
|
||||
@ -95,6 +96,12 @@
|
||||
<name>Ethernet Card 0</name>
|
||||
<startmode>off</startmode>
|
||||
</interface>
|
||||
<interface>
|
||||
<bootproto>none</bootproto>
|
||||
<device>eth2</device>
|
||||
<name>Ethernet Card 2</name>
|
||||
<startmode>off</startmode>
|
||||
</interface>
|
||||
</interfaces>
|
||||
<routing>
|
||||
<ip_forward config:type="boolean">false</ip_forward>
|
||||
|
@ -39,6 +39,9 @@ fi
|
||||
|
||||
hostname $HOSTNAME
|
||||
bond=bond0
|
||||
if [[ $DEVICE == "eth0" ]]; then
|
||||
$DEVICE2=eth2
|
||||
fi
|
||||
|
||||
device_names=`ifconfig -a | grep -i hwaddr | grep -i 'Ethernet' | grep -v usb| awk '{print $1}'`
|
||||
str_cfg_file=''
|
||||
@ -83,9 +86,23 @@ if [ -d "/etc/sysconfig/network-scripts/" ];then
|
||||
echo "SLAVE=yes" >> $str_cfg_file
|
||||
echo "USERCTL=no" >> $str_cfg_file
|
||||
|
||||
if [[ $DEVICE2 != "" ]]; then
|
||||
# write ifcfg-eth0
|
||||
i="$DEVICE2"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "DEVICE=$i" > $str_cfg_file
|
||||
echo "BOOTPROTO=none" >> $str_cfg_file
|
||||
echo "MASTER=$bond" >> $str_cfg_file
|
||||
echo "ONBOOT=yes" >> $str_cfg_file
|
||||
echo "SLAVE=yes" >> $str_cfg_file
|
||||
echo "USERCTL=no" >> $str_cfg_file
|
||||
fi
|
||||
|
||||
# write modprobe alias config
|
||||
str_cfg_file="/etc/modprobe.d/$bond.conf"
|
||||
echo "alias $bond bonding" > $str_cfg_file
|
||||
|
||||
#todo: figure out how to set the default gateway in rhel
|
||||
else
|
||||
# use dhcp for all nics
|
||||
for i in $device_names;do
|
||||
@ -122,6 +139,9 @@ elif [ -d "/etc/sysconfig/network/" ];then
|
||||
echo "BROADCAST=$BROADCAST" >> $str_cfg_file
|
||||
echo "USERCONTROL=no" >> $str_cfg_file
|
||||
echo "BONDING_SLAVE_0=$DEVICE" >> $str_cfg_file
|
||||
if [[ $DEVICE2 != "" ]]; then
|
||||
echo "BONDING_SLAVE_1=$DEVICE2" >> $str_cfg_file
|
||||
fi
|
||||
|
||||
# write ifcfg-eth0
|
||||
i="$DEVICE"
|
||||
@ -129,10 +149,28 @@ elif [ -d "/etc/sysconfig/network/" ];then
|
||||
echo "BOOTPROTO=none" > $str_cfg_file
|
||||
echo "STARTMODE=hotplug" >> $str_cfg_file
|
||||
|
||||
if [[ $DEVICE2 != "" ]]; then
|
||||
# write ifcfg-eth2
|
||||
i="$DEVICE2"
|
||||
str_cfg_file="$dir/ifcfg-$i"
|
||||
echo "BOOTPROTO=none" > $str_cfg_file
|
||||
echo "STARTMODE=hotplug" >> $str_cfg_file
|
||||
fi
|
||||
|
||||
# write modprobe alias config
|
||||
str_cfg_file="/etc/modprobe.d/$bond.conf"
|
||||
echo "alias $bond bonding" > $str_cfg_file
|
||||
|
||||
# set the default gateway (at this point this is the private nic gateway, to handle provision across vlans)
|
||||
file=/etc/sysconfig/network/routes
|
||||
if grep -q -E '^default ' $file; then
|
||||
# replace the default route that is already in there
|
||||
sed -i 's/^default .*$/default '$GATEWAY' - -/' $file
|
||||
else
|
||||
# no default route yet, append to file
|
||||
echo "default $GATEWAY - -" >>$file
|
||||
fi
|
||||
|
||||
# this was the original config of the eth0 nic (without bonding)
|
||||
#echo "DEVICE=$i" > $str_cfg_file
|
||||
#echo "BOOTPROTO=static" >> $str_cfg_file
|
||||
|
11
xCAT-SoftLayer/si-post-install/20all.mkinitrd_for_suse11
Executable file
11
xCAT-SoftLayer/si-post-install/20all.mkinitrd_for_suse11
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This SI post-install script is needed because the initrd that autoyast builds when installing
|
||||
# sles on the golden node may not have the drivers when that initrd runs on the node that is
|
||||
# being deployed with this image (specifically, drivers to be able to mount the disk).
|
||||
# So rebuild the initrd on the to-node after putting the image on the disk, but before rebooting.
|
||||
|
||||
#todo: this same issue could occur on other distros too. Make this script work on red hat by
|
||||
# checking for dracut and using that if it exists.
|
||||
|
||||
mkinitrd
|
@ -126,18 +126,17 @@ for parm in `cat /proc/cmdline`; do
|
||||
netmask=$value
|
||||
elif [[ ${key,,} == "gateway" ]]; then
|
||||
gateway=$value
|
||||
elif [[ ${key,,} == "netdevice" || ${key,,} == "device" ]]; then
|
||||
netdevice=$value
|
||||
fi
|
||||
done
|
||||
if [[ -n $hostip && -n $netmask && -n $gateway && -n $netdevice ]]; then
|
||||
if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then
|
||||
# doing static ip
|
||||
# the device was determined above from the bootif mac, and put in bootnic
|
||||
numbits=$(mask2prefix $netmask)
|
||||
broadcast=$(bcastcalc $hostip $netmask)
|
||||
echo "Setting static IP=$hostip/$numbits broadcast=$broadcast gateway=$gateway netdevice=$netdevice ..."
|
||||
ip addr add $hostip/$numbits broadcast $broadcast dev $netdevice scope global label $netdevice
|
||||
ip link set $netdevice up
|
||||
ip route replace to default via $gateway dev $netdevice
|
||||
echo "Setting static IP=$hostip/$numbits broadcast=$broadcast gateway=$gateway device=$bootnic BOOTIF=$BOOTIF ..."
|
||||
ip addr add $hostip/$numbits broadcast $broadcast dev $bootnic scope global label $bootnic
|
||||
ip link set $bootnic up
|
||||
ip route replace to default via $gateway dev $bootnic
|
||||
# in softlayer it takes up to 60 seconds for the nic to actually be able to communicate
|
||||
echo -n Waiting to reach xCAT mgmt node $gateway.
|
||||
xcatretries=60
|
||||
|
@ -568,6 +568,7 @@ sub nextdestiny {
|
||||
}
|
||||
|
||||
my $node;
|
||||
my $noupdate_flag = 0;
|
||||
$chaintab = xCAT::Table->new('chain');
|
||||
my $chainents = $chaintab->getNodesAttribs(\@nodes,[qw(currstate currchain chain)]);
|
||||
foreach $node (@nodes) {
|
||||
@ -599,14 +600,24 @@ sub nextdestiny {
|
||||
{
|
||||
my @items = split /[:]/,$ref->{currstate};
|
||||
$requ{arg}= \@items;
|
||||
$noupdate_flag = 1;
|
||||
}
|
||||
setdestiny(\%requ, $flag+1);
|
||||
}
|
||||
|
||||
if ($callnodeset) {
|
||||
my $args;
|
||||
if($noupdate_flag)
|
||||
{
|
||||
$args = ['enact', '--noupdateinitrd'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$args = ['enact'];
|
||||
}
|
||||
$subreq->({command=>['nodeset'],
|
||||
node=> \@nodes,
|
||||
arg=>['enact', '--noupdateinitrd']});
|
||||
arg=>$args});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -636,15 +636,20 @@ sub sysclone_createosimgdef{
|
||||
my ($node, $server, $osimage, $callback, $subreq) = @_;
|
||||
my $createnew = 0;
|
||||
my %osimgdef;
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
my $osimgtab = xCAT::Table->new('osimage');
|
||||
my $entry = ($osimgtab->getAllAttribsWhere("imagename = '$osimage'", 'ALL' ))[0];
|
||||
if($entry){
|
||||
my $entry;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
$entry = ($osimgtab->getAllAttribsWhere("\"imagename\" = '$osimage'", 'ALL' ))[0];
|
||||
} else {
|
||||
$entry = ($osimgtab->getAllAttribsWhere("imagename = '$osimage'", 'ALL' ))[0];
|
||||
}
|
||||
if($entry){
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = qq{Using the existing osimage "$osimage" defined on $server.};
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
# try to see if we can get the osimage def from golden client.
|
||||
my $nttab = xCAT::Table->new('nodetype');
|
||||
|
@ -17,7 +17,7 @@ use warnings;
|
||||
#use xCAT::Table;
|
||||
#use xCAT::Schema;
|
||||
#use xCAT::NodeRange qw/noderange abbreviate_noderange/;
|
||||
#use xCAT::Utils;
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use Data::Dumper;
|
||||
use XML::Simple;
|
||||
@ -316,6 +316,7 @@ sub get_image_info {
|
||||
my $kitlist;
|
||||
my $kitrepolist;
|
||||
my $kitcomplist;
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
foreach my $kitcomponent (split ',', $attrs0->{kitcomponents}) {
|
||||
(my $kitcomphash) = $kitcomponenttab->getAttribs({kitcompname => $kitcomponent},'kitname');
|
||||
if (!$kitcomphash) {
|
||||
@ -325,15 +326,24 @@ sub get_image_info {
|
||||
|
||||
if ($kitcomphash->{kitname}) {
|
||||
$kitlist->{$kitcomphash->{kitname}} = 1;
|
||||
|
||||
my @kitrepohash = $kitrepotab->getAllAttribsWhere( "kitname = '$kitcomphash->{kitname}'", 'kitreponame');
|
||||
my @kitrepohash;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@kitrepohash = $kitrepotab->getAllAttribsWhere( "\"kitname\" = '$kitcomphash->{kitname}'", 'kitreponame');
|
||||
} else {
|
||||
@kitrepohash = $kitrepotab->getAllAttribsWhere( "kitname = '$kitcomphash->{kitname}'", 'kitreponame');
|
||||
}
|
||||
foreach my $kitrepo (@kitrepohash) {
|
||||
if ($kitrepo->{kitreponame}) {
|
||||
$kitrepolist->{$kitrepo->{kitreponame}} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
my @kitcomponents = $kitcomponenttab->getAllAttribsWhere( "kitname = '$kitcomphash->{kitname}'", 'kitcompname');
|
||||
my @kitcomponents;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@kitcomponents = $kitcomponenttab->getAllAttribsWhere( "\"kitname\" = '$kitcomphash->{kitname}'", 'kitcompname');
|
||||
} else {
|
||||
@kitcomponents = $kitcomponenttab->getAllAttribsWhere( "kitname = '$kitcomphash->{kitname}'", 'kitcompname');
|
||||
}
|
||||
foreach my $kitcomp (@kitcomponents) {
|
||||
if ($kitcomp->{kitcompname}) {
|
||||
$kitcomplist->{$kitcomp->{kitcompname}} = 1;
|
||||
|
@ -1494,6 +1494,7 @@ sub rmkit
|
||||
my %kitnames;
|
||||
my $des = shift @ARGV;
|
||||
my @kits = split ',', $des;
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
foreach my $kit (@kits) {
|
||||
|
||||
# Check if it is a kitname or basename
|
||||
@ -1508,7 +1509,12 @@ sub rmkit
|
||||
}
|
||||
$kitnames{$kit} = 1;
|
||||
} else {
|
||||
my @entries = $tabs{kit}->getAllAttribsWhere( "basename = '$kit'", 'kitname', 'isinternal');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kit}->getAllAttribsWhere( "\"basename\" = '$kit'", 'kitname', 'isinternal');
|
||||
} else {
|
||||
@entries = $tabs{kit}->getAllAttribsWhere( "basename = '$kit'", 'kitname', 'isinternal');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "Kit $kit could not be found in DB $t";
|
||||
@ -1545,8 +1551,12 @@ sub rmkit
|
||||
|
||||
# Find all the components in this kit.
|
||||
my $kitcompnames;
|
||||
my @kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "kitname = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall');
|
||||
|
||||
my @kitcomphash;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "\"kitname\" = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall');
|
||||
} else {
|
||||
@kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "kitname = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall');
|
||||
}
|
||||
if (@entries && (@entries > 0)) {
|
||||
|
||||
if($::VERBOSE and !$test){
|
||||
@ -1682,7 +1692,12 @@ sub rmkit
|
||||
}
|
||||
|
||||
# Remove kitrepo
|
||||
my @kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "kitname = '$kitname'", 'kitreponame');
|
||||
my @kitrepohash;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "\"kitname\" = '$kitname'", 'kitreponame');
|
||||
} else {
|
||||
@kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "kitname = '$kitname'", 'kitreponame');
|
||||
}
|
||||
foreach my $kitrepo ( @kitrepohash ) {
|
||||
my $kitreponame = $kitrepo->{kitreponame};
|
||||
$tabs{kitrepo}->delEntries({kitreponame => $kitreponame});
|
||||
@ -1878,7 +1893,7 @@ sub addkitcomp
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
my %tabs = ();
|
||||
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
|
||||
foreach my $t ( @tables ) {
|
||||
@ -1911,7 +1926,12 @@ sub addkitcomp
|
||||
$kitcomps{$kitcomponent}{name} = $kitcomponent;
|
||||
$kitcomps{$kitcomponent}{basename} = $kitcomptable->{'basename'};
|
||||
} else {
|
||||
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
} else {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist";
|
||||
@ -2101,7 +2121,12 @@ sub addkitcomp
|
||||
my @kitcompdeps = split ',', $kitcomptable->{'kitcompdeps'};
|
||||
foreach my $kitcompdependency ( @kitcompdeps ) {
|
||||
my ($kitcompdep, $vers) = split /<=|>=|=|<|>/, $kitcompdependency;
|
||||
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release');
|
||||
} else {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "Cannot find any matched kit component for kit component $kitcomp dependency $kitcompdep";
|
||||
@ -2413,7 +2438,7 @@ sub rmkitcomp
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
my %tabs = ();
|
||||
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
|
||||
foreach my $t ( @tables ) {
|
||||
@ -2456,7 +2481,12 @@ sub rmkitcomp
|
||||
$kitcomps{$kitcomponent}{driverpacks} = $kitcomptable->{driverpacks};
|
||||
$kitcomps{$kitcomponent}{genimage_postinstall} = $kitcomptable->{genimage_postinstall};
|
||||
} else {
|
||||
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
} else {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist";
|
||||
@ -2530,7 +2560,12 @@ sub rmkitcomp
|
||||
|
||||
my ($kitcompdep, $vers) = split /<=|>=|=|<|>/, $kitcompdependency;
|
||||
# Get the kit component full name from basename.
|
||||
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitcompname' , 'version', 'release');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcompdep'", 'kitcompname' , 'version', 'release');
|
||||
} else {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitcompname' , 'version', 'release');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "kitcomponent $kitcompdep basename does not exist";
|
||||
@ -3214,7 +3249,7 @@ sub chkkitcomp
|
||||
create_version_response('chkkitcomp');
|
||||
return 1; # no usage - just exit
|
||||
}
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
my %tabs = ();
|
||||
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
|
||||
foreach my $t ( @tables ) {
|
||||
@ -3248,7 +3283,12 @@ sub chkkitcomp
|
||||
$kitcomps{$kitcomponent}{serverroles} = $kitcomptable->{serverroles};
|
||||
$kitcompbasename{$kitcomptable->{basename}} = 1;
|
||||
} else {
|
||||
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
} else {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist";
|
||||
@ -4660,6 +4700,7 @@ sub db_get_table_rows {
|
||||
|
||||
my $table = xCAT::Table->new($tablename);
|
||||
my @table_rows = ();
|
||||
# todo fix for DB2 support
|
||||
if (defined($filter_stmt)) {
|
||||
if (length($filter_stmt) > 0) {
|
||||
@table_rows = $table->getAllAttribsWhere($filter_stmt, @{$attrs});
|
||||
|
@ -95,6 +95,7 @@ sub getOSdistroref
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
# verified this does work on DB2
|
||||
|
||||
my @clause=();
|
||||
|
||||
|
@ -25,6 +25,7 @@ use xCAT::NodeRange;
|
||||
use xCAT::Table;
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::Utils;
|
||||
use xCAT::DiscoveryUtils;
|
||||
use xCAT::NodeRange qw/noderange/;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
@ -701,7 +702,7 @@ Usage:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
# Go thought discoverydata table and display the sequential disocvery entries
|
||||
my $distab = xCAT::Table->new('discoverydata');
|
||||
unless ($distab) {
|
||||
@ -710,7 +711,12 @@ Usage:
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
my @disdata = $distab->getAllAttribsWhere("method='sequential'", 'node', 'mtm', 'serial');
|
||||
my @disdata;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@disdata = $distab->getAllAttribsWhere("\"method\" = 'sequential'", 'node', 'mtm', 'serial');
|
||||
} else {
|
||||
@disdata = $distab->getAllAttribsWhere("method='sequential'", 'node', 'mtm', 'serial');
|
||||
}
|
||||
my @discoverednodes;
|
||||
|
||||
foreach (@disdata) {
|
||||
@ -817,6 +823,7 @@ Usage:
|
||||
}
|
||||
}
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
# Go thought discoverydata table and display the disocvery entries
|
||||
my $distab = xCAT::Table->new('discoverydata');
|
||||
unless ($distab) {
|
||||
@ -837,10 +844,18 @@ Usage:
|
||||
@disdata = $distab->getAllAttribs(@disattrs);
|
||||
} else {
|
||||
$type = "sequential" if ($type =~ /^seq/);
|
||||
@disdata = $distab->getAllAttribsWhere("method='$type'", @disattrs);
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@disdata = $distab->getAllAttribsWhere("\"method\" = '$type'", @disattrs);
|
||||
} else {
|
||||
@disdata = $distab->getAllAttribsWhere("method='$type'", @disattrs);
|
||||
}
|
||||
}
|
||||
} elsif ($uuid) {
|
||||
@disdata = $distab->getAllAttribsWhere("uuid='$uuid'", @disattrs);
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@disdata = $distab->getAllAttribsWhere("\"uuid\" = '$uuid'", @disattrs);
|
||||
} else {
|
||||
@disdata = $distab->getAllAttribsWhere("uuid='$uuid'", @disattrs);
|
||||
}
|
||||
}
|
||||
my $discoverednum = $#disdata + 1;
|
||||
|
||||
@ -1002,6 +1017,7 @@ Usage:
|
||||
return;
|
||||
}
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
# open the discoverydata table for the subsequent using
|
||||
my $distab = xCAT::Table->new("discoverydata");
|
||||
unless ($distab) {
|
||||
@ -1022,7 +1038,12 @@ Usage:
|
||||
|
||||
if ($uuid) {
|
||||
# handle the -r -u <uuid>
|
||||
my @disdata = $distab->getAllAttribsWhere("uuid='$uuid'", 'method');
|
||||
my @disdata;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@disdata = $distab->getAllAttribsWhere("\"uuid\" = '$uuid'", 'method');
|
||||
} else {
|
||||
@disdata = $distab->getAllAttribsWhere("uuid='$uuid'", 'method');
|
||||
}
|
||||
unless (@disdata) {
|
||||
xCAT::MsgUtils->message("E", {data=>["Cannot find discovery entry with uuid equals [$uuid]."]}, $callback);
|
||||
return;
|
||||
@ -1089,7 +1110,12 @@ Usage:
|
||||
|
||||
# get all the attributes for the entry from the discoverydata table
|
||||
my @disattrs = ('uuid', 'node', 'method', 'discoverytime', 'arch', 'cpucount', 'cputype', 'memory', 'mtm', 'serial', 'nicdriver', 'nicipv4', 'nichwaddr', 'nicpci', 'nicloc', 'niconboard', 'nicfirm', 'switchname', 'switchaddr', 'switchdesc', 'switchport', 'otherdata');
|
||||
my @disdata = $distab->getAllAttribsWhere("uuid='$uuid'", @disattrs);
|
||||
my @disdata ;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@disdata = $distab->getAllAttribsWhere("\"uuid\" = '$uuid'", @disattrs);
|
||||
} else {
|
||||
@disdata = $distab->getAllAttribsWhere("uuid='$uuid'", @disattrs);
|
||||
}
|
||||
unless (@disdata) {
|
||||
xCAT::MsgUtils->message("E", {data=>["Cannot find discovery entry with uuid equals $uuid"]}, $callback);
|
||||
return;
|
||||
|
@ -1385,6 +1385,13 @@ sub updatenoderunps
|
||||
|
||||
foreach my $snkey (keys %servernodes)
|
||||
{
|
||||
if ((!defined($snkey)) or ($snkey eq "")) { # if we could not find the xcatmaster
|
||||
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "Could not find xcatmaster for @{$servernodes{$snkey}}. Will skip this node. ";
|
||||
$callback->($rsp);
|
||||
next;
|
||||
}
|
||||
my $nodestring = join(',', @{$servernodes{$snkey}});
|
||||
my $args;
|
||||
my $mode;
|
||||
|
5
xCAT-server/share/xcat/devicetype/vios/config
Normal file
5
xCAT-server/share/xcat/devicetype/vios/config
Normal file
@ -0,0 +1,5 @@
|
||||
[main]
|
||||
ssh-setup-command=echo
|
||||
[xdsh]
|
||||
pre-command=NULL
|
||||
post-command=NULL
|
@ -59,7 +59,7 @@ do
|
||||
mv $i/postscripts /xcatpost
|
||||
rm -rf $i
|
||||
chmod +x /xcatpost/*
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
@ -72,7 +72,7 @@ do
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
done
|
||||
|
||||
|
@ -61,7 +61,7 @@ do
|
||||
mv $i/postscripts /xcatpost
|
||||
rm -rf $i
|
||||
chmod +x /xcatpost/*
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
@ -74,7 +74,7 @@ do
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
done
|
||||
|
||||
|
@ -44,7 +44,7 @@ do
|
||||
if [ ! -x /xcatpost/mypostscript ]; then
|
||||
|
||||
chmod +x /xcatpost/*
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript
|
||||
|
||||
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
@ -59,7 +59,7 @@ do
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript
|
||||
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
done
|
||||
|
@ -5,10 +5,8 @@ dhclient
|
||||
kernel
|
||||
openssh-server
|
||||
openssh-clients
|
||||
busybox
|
||||
wget
|
||||
rsyslog
|
||||
dash
|
||||
vim-minimal
|
||||
ntp
|
||||
rsyslog
|
||||
|
@ -6,8 +6,6 @@ dhclient
|
||||
kernel
|
||||
openssh-server
|
||||
openssh-clients
|
||||
busybox
|
||||
dash
|
||||
iputils
|
||||
bc
|
||||
irqbalance
|
||||
|
@ -39,8 +39,8 @@ my %confhash;
|
||||
my $rootdir = "$::XCATROOT/share/xcat/tools/autotest";
|
||||
my $needhelp = 0;
|
||||
my $branch = 0;
|
||||
my $rhppc64configfile = "$rootdir/default.conf";
|
||||
my $configfile = "/regression/rhppc64/default.conf";
|
||||
my $testconfigfile = "$rootdir/default.conf";
|
||||
my $configfile = "/regression/default.conf";
|
||||
my $MN = undef;
|
||||
my $management_node = undef;
|
||||
my $CN = undef;
|
||||
@ -92,7 +92,7 @@ sub usage
|
||||
#######################################
|
||||
# config for rhppc64env
|
||||
#######################################
|
||||
sub config_rhppc64 {
|
||||
sub config_test {
|
||||
send_msg("******************************");
|
||||
send_msg("Reading Configure");
|
||||
send_msg("******************************");
|
||||
@ -133,6 +133,15 @@ sub config_rhppc64 {
|
||||
}elsif($line =~ /\[\s*rhppc64System|Custom\s*\]/){
|
||||
|
||||
$type = "rhppc64Varible";
|
||||
}elsif($line =~ /\[\s*slesppc64System|Custom\s*\]/){
|
||||
|
||||
$type = "slesppc64Varible";
|
||||
}elsif($line =~ /\[\s*rhx8664System|Custom\s*\]/){
|
||||
|
||||
$type = "rhx8664Varible";
|
||||
}elsif($line =~ /\[\s*slesx8664System|Custom\s*\]/){
|
||||
|
||||
$type = "slesx8664Varible";
|
||||
}elsif ($type eq "rhppc64Table") {
|
||||
##TABLE BLOCK##
|
||||
if($line =~ /(\w+)\s*=\s*([\w\.\-]+)/) {
|
||||
@ -145,6 +154,43 @@ sub config_rhppc64 {
|
||||
$rhppc64config{table}{$sub_type}{$name}{__KEY__}=$attr;
|
||||
}
|
||||
}
|
||||
}elsif ($type eq "slesppc64Table") {
|
||||
##TABLE BLOCK##
|
||||
if($line =~ /(\w+)\s*=\s*([\w\.\-]+)/) {
|
||||
$attr = $1;
|
||||
$value = $2;
|
||||
if($name&&($slesppc64config{table}{$sub_type}{$name}{__KEY__} ne $attr)){
|
||||
$slesppc64config{table}{$sub_type}{$name}{$attr}=$value;
|
||||
} else {
|
||||
$name = $value;
|
||||
$slesppc64config{table}{$sub_type}{$name}{__KEY__}=$attr;
|
||||
}
|
||||
}
|
||||
}elsif ($type eq "rhx8664Table") {
|
||||
##TABLE BLOCK##
|
||||
if($line =~ /(\w+)\s*=\s*([\w\.\-]+)/) {
|
||||
$attr = $1;
|
||||
$value = $2;
|
||||
if($name&&($rhx8664config{table}{$sub_type}{$name}{__KEY__} ne $attr)){
|
||||
$rhx8664config{table}{$sub_type}{$name}{$attr}=$value;
|
||||
} else {
|
||||
$name = $value;
|
||||
$rhx8664config{table}{$sub_type}{$name}{__KEY__}=$attr;
|
||||
}
|
||||
}
|
||||
}elsif ($type eq "slesx8664Table") {
|
||||
##TABLE BLOCK##
|
||||
if($line =~ /(\w+)\s*=\s*([\w\.\-]+)/) {
|
||||
$attr = $1;
|
||||
$value = $2;
|
||||
if($name&&($slesx8664config{table}{$sub_type}{$name}{__KEY__} ne $attr)){
|
||||
$slesx8664config{table}{$sub_type}{$name}{$attr}=$value;
|
||||
} else {
|
||||
$name = $value;
|
||||
$slesx8664config{table}{$sub_type}{$name}{__KEY__}=$attr;
|
||||
}
|
||||
}
|
||||
|
||||
}elsif ($type eq "rhppc64Object") {
|
||||
##OBJECT BLOCK##
|
||||
if($line =~ /(\w+)\s*=\s*([\w\.\-]+)/) {
|
||||
@ -162,6 +208,58 @@ sub config_rhppc64 {
|
||||
$rhppc64config{object}{$sub_type}{$name}{$attr}=$value;
|
||||
}
|
||||
}
|
||||
}elsif ($type eq "slesppc64Object") {
|
||||
##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 {
|
||||
$slesppc64config{object}{$sub_type}{$name}{$attr}=$value;
|
||||
}
|
||||
}
|
||||
}elsif ($type eq "rhx8664Object") {
|
||||
##OBJECT BLOCK##
|
||||
if($line =~ /(\w+)\s*=\s*([\w\.\-]+)/) {
|
||||
$attr = $1;
|
||||
$value = $2;
|
||||
#print "rhx8664node attr is $attr\n";
|
||||
#print "rhx8664node 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 {
|
||||
$rhx8664config{object}{$sub_type}{$name}{$attr}=$value;
|
||||
}
|
||||
}
|
||||
}elsif ($type eq "slesx8664Object") {
|
||||
##OBJECT BLOCK##
|
||||
if($line =~ /(\w+)\s*=\s*([\w\.\-]+)/) {
|
||||
$attr = $1;
|
||||
$value = $2;
|
||||
#print "slesx8664node attr is $attr\n";
|
||||
#print "slesx8664node 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 {
|
||||
$slesx8664config{object}{$sub_type}{$name}{$attr}=$value;
|
||||
}
|
||||
}
|
||||
|
||||
}elsif ($type eq "rhppc64Script") {
|
||||
##SCRIPT_BLOCK##
|
||||
if($sub_type eq "Prev") {
|
||||
@ -172,14 +270,63 @@ sub config_rhppc64 {
|
||||
$rhppc64config{script_post}->[$c] = $line;
|
||||
$c = $c + 1;
|
||||
}
|
||||
}elsif ($type eq "slesppc64Script") {
|
||||
##SCRIPT_BLOCK##
|
||||
if($sub_type eq "Prev") {
|
||||
$slesppc64config{script_prev}->[$c] = $line;
|
||||
$c = $c + 1;
|
||||
}
|
||||
elsif ($sub_type eq "slesppc64Post") {
|
||||
$slesppc64config{script_post}->[$c] = $line;
|
||||
$c = $c + 1;
|
||||
}
|
||||
}elsif ($type eq "rhx8664Script") {
|
||||
##SCRIPT_BLOCK##
|
||||
if($sub_type eq "Prev") {
|
||||
$rhx8664config{script_prev}->[$c] = $line;
|
||||
$c = $c + 1;
|
||||
}
|
||||
elsif ($sub_type eq "rhx8664Post") {
|
||||
$rhx8664config{script_post}->[$c] = $line;
|
||||
$c = $c + 1;
|
||||
}
|
||||
}elsif ($type eq "slesx8664Script") {
|
||||
##SCRIPT_BLOCK##
|
||||
if($sub_type eq "Prev") {
|
||||
$slesx8664config{script_prev}->[$c] = $line;
|
||||
$c = $c + 1;
|
||||
}
|
||||
elsif ($sub_type eq "slesx8664Post") {
|
||||
$slesx8664config{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";
|
||||
}
|
||||
} elsif ($type eq "slesppc64Varible") {
|
||||
##NODE_BLOCK##
|
||||
if($line =~ /(\w+)\s*=\s*([\w\.\-\/]+)/) {
|
||||
$slesppc64config{var}{$1} = $2;
|
||||
}
|
||||
} elsif ($type eq "rhx8664Varible") {
|
||||
##NODE_BLOCK##
|
||||
if($line =~ /(\w+)\s*=\s*([\w\.\-\/]+)/) {
|
||||
$rhx8664config{var}{$1} = $2;
|
||||
print "var $1,$2\n";
|
||||
}
|
||||
} elsif ($type eq "slesx8664Varible") {
|
||||
##NODE_BLOCK##
|
||||
if($line =~ /(\w+)\s*=\s*([\w\.\-\/]+)/) {
|
||||
$slesx8664config{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}}){
|
||||
@ -194,6 +341,49 @@ sub config_rhppc64 {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(exists $slesppc64config{object}){
|
||||
foreach my $type (keys %{$slesppc64config{object}}){
|
||||
foreach my $name (keys %{$slesppc64config{object}{$type}}){
|
||||
send_msg("OBJECT:$name,TYPE:$type");
|
||||
&runcmd( " echo [Object_$type]>>defaultslesppc64.conf");
|
||||
&runcmd( " echo Name=$name>>defaultslesppc64.conf");
|
||||
#print "$name,TYPE:$type \n";
|
||||
foreach my $attr (keys %{$slesppc64config{object}{$type}{$name}}){
|
||||
send_msg(" $attr = $slesppc64config{object}{$type}{$name}{$attr};");
|
||||
&runcmd( " echo $attr=$slesppc64config{object}{$type}{$name}{$attr}>>defaultslesppc64.conf");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(exists $rhx8664config{object}){
|
||||
foreach my $type (keys %{$rhx8664config{object}}){
|
||||
foreach my $name (keys %{$rhx8664config{object}{$type}}){
|
||||
send_msg("OBJECT:$name,TYPE:$type");
|
||||
&runcmd( " echo [Object_$type]>>defaultrhx8664.conf");
|
||||
&runcmd( " echo Name=$name>>defaultrhx8664.conf");
|
||||
#print "$name,TYPE:$type \n";
|
||||
foreach my $attr (keys %{$rhx8664config{object}{$type}{$name}}){
|
||||
send_msg(" $attr = $rhx8664config{object}{$type}{$name}{$attr};");
|
||||
&runcmd( " echo $attr=$rhx8664config{object}{$type}{$name}{$attr}>>defaultrhx8664.conf");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(exists $slesx8664config{object}){
|
||||
foreach my $type (keys %{$slesx8664config{object}}){
|
||||
foreach my $name (keys %{$slesx8664config{object}{$type}}){
|
||||
send_msg("OBJECT:$name,TYPE:$type");
|
||||
&runcmd( " echo [Object_$type]>>defaultslesx8664.conf");
|
||||
&runcmd( " echo Name=$name>>defaultslesx8664.conf");
|
||||
#print "$name,TYPE:$type \n";
|
||||
foreach my $attr (keys %{$slesx8664config{object}{$type}{$name}}){
|
||||
send_msg(" $attr = $slesx8664config{object}{$type}{$name}{$attr};");
|
||||
&runcmd( " echo $attr=$slesx8664config{object}{$type}{$name}{$attr}>>defaultslesx8664.conf");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(exists $rhppc64config{table}){
|
||||
foreach my $type (keys %{$rhppc64config{table}}){
|
||||
send_msg("TABLE:$type");
|
||||
@ -214,6 +404,67 @@ sub config_rhppc64 {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(exists $slesppc64config{table}){
|
||||
foreach my $type (keys %{$slesppc64config{table}}){
|
||||
send_msg("TABLE:$type");
|
||||
&runcmd( " echo [Table_$type]>>defaultslesppc64.conf");
|
||||
#&runcmd( " echo key=$type>>default.conf");
|
||||
#&runcmd( " echo [Table_site]>>default.conf");
|
||||
#&runcmd( " echo key=$type>>default.conf");
|
||||
foreach my $name (keys %{$slesppc64config{table}{$type}}){
|
||||
send_msg(" $slesppc64config{table}{$type}{$name}{__KEY__} = $name");
|
||||
&runcmd( " echo $slesppc64config{table}{$type}{$name}{__KEY__}=$name>>defaultslesppc64.conf");
|
||||
foreach my $attr (keys %{$slesppc64config{table}{$type}{$name}}){
|
||||
if($attr ne '__KEY__'){
|
||||
send_msg(" $attr = $slesppc64config{table}{$type}{$name}{$attr}");
|
||||
&runcmd( " echo $attr=$slesppc64config{table}{$type}{$name}{$attr}>>defaultslesppc64.conf");
|
||||
}
|
||||
}
|
||||
send_msg("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(exists $rhx8664config{table}){
|
||||
foreach my $type (keys %{$rhx8664config{table}}){
|
||||
send_msg("TABLE:$type");
|
||||
&runcmd( " echo [Table_$type]>>defaultrhx8664.conf");
|
||||
#&runcmd( " echo key=$type>>default.conf");
|
||||
#&runcmd( " echo [Table_site]>>default.conf");
|
||||
#&runcmd( " echo key=$type>>default.conf");
|
||||
foreach my $name (keys %{$rhx8664config{table}{$type}}){
|
||||
send_msg(" $rhx8664config{table}{$type}{$name}{__KEY__} = $name");
|
||||
&runcmd( " echo $rhx8664config{table}{$type}{$name}{__KEY__}=$name>>defaultrhx8664.conf");
|
||||
foreach my $attr (keys %{$rhx8664config{table}{$type}{$name}}){
|
||||
if($attr ne '__KEY__'){
|
||||
send_msg(" $attr = $rhx8664config{table}{$type}{$name}{$attr}");
|
||||
&runcmd( " echo $attr=$rhx8664config{table}{$type}{$name}{$attr}>>defaultrhx8664.conf");
|
||||
}
|
||||
}
|
||||
send_msg("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(exists $slesx8664config{table}){
|
||||
foreach my $type (keys %{$slesx8664config{table}}){
|
||||
send_msg("TABLE:$type");
|
||||
&runcmd( " echo [Table_$type]>>defaultslesx8664.conf");
|
||||
#&runcmd( " echo key=$type>>default.conf");
|
||||
#&runcmd( " echo [Table_site]>>default.conf");
|
||||
#&runcmd( " echo key=$type>>default.conf");
|
||||
foreach my $name (keys %{$slesx8664config{table}{$type}}){
|
||||
send_msg(" $slesx8664config{table}{$type}{$name}{__KEY__} = $name");
|
||||
&runcmd( " echo $slesx8664config{table}{$type}{$name}{__KEY__}=$name>>defaultslesx8664.conf");
|
||||
foreach my $attr (keys %{$slesx8664config{table}{$type}{$name}}){
|
||||
if($attr ne '__KEY__'){
|
||||
send_msg(" $attr = $slesx8664config{table}{$type}{$name}{$attr}");
|
||||
&runcmd( " echo $attr=$slesx8664config{table}{$type}{$name}{$attr}>>defaultslesx8664.conf");
|
||||
}
|
||||
}
|
||||
send_msg("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(exists $rhppc64config{script_prev}){
|
||||
send_msg("Script_Prev:");
|
||||
foreach $cmd (@{$rhppc64config{script_prev}}){
|
||||
@ -240,7 +491,46 @@ sub config_rhppc64 {
|
||||
#print "var is $rhppc64config{var}\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (exists $slesppc64config{var}){
|
||||
#my $MN=$slesppc64config{var}{MN};
|
||||
#my $MNIP=$rhppc64config{var}{MNIP};
|
||||
#&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts");
|
||||
#print "MN is $MN\n";}
|
||||
send_msg("Varible:");
|
||||
&runcmd( " echo [System]>>defaultslesppc64.conf");
|
||||
foreach my $varname (keys %{$slesppc64config{var}}){
|
||||
send_msg(" $varname = $slesppc64config{var}{$varname}");
|
||||
&runcmd( " echo $varname=$slesppc64config{var}{$varname}>>defaultslesppc64.conf");
|
||||
#print "var is $slesppc64config{var}\n";
|
||||
}
|
||||
}
|
||||
if (exists $rhx8664config{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:");
|
||||
&runcmd( " echo [System]>>defaultrhx8664.conf");
|
||||
foreach my $varname (keys %{$rhx8664config{var}}){
|
||||
send_msg(" $varname = $rhx8664config{var}{$varname}");
|
||||
&runcmd( " echo $varname=$rhx8664config{var}{$varname}>>defaultrhx8664.conf");
|
||||
#print "var is $rhppc64config{var}\n";
|
||||
}
|
||||
}
|
||||
if (exists $slesx8664config{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:");
|
||||
&runcmd( " echo [System]>>defaultslesx8664.conf");
|
||||
foreach my $varname (keys %{$slesx8664config{var}}){
|
||||
send_msg(" $varname = $slesx8664config{var}{$varname}");
|
||||
&runcmd( " echo $varname=$slesx8664config{var}{$varname}>>defaultslesx8664.conf");
|
||||
#print "var is $rhppc64config{var}\n";
|
||||
}
|
||||
}
|
||||
|
||||
close FILE;
|
||||
return 0;
|
||||
|
||||
@ -359,23 +649,35 @@ sub config_mn {
|
||||
#######################################
|
||||
# install xcat and init rhppc64 env
|
||||
#######################################
|
||||
sub gettestinfo {
|
||||
my $testenvinfo = undef;
|
||||
my @osname = runcmd("xdsh mn uname -a ");
|
||||
my @release = runcmd("xdsh mn cat /etc/*release");
|
||||
my @osinfo = runcmd("xdsh mn lsb_release -a");
|
||||
if ( $osname [0] =~ /Linux/ && $osname [0] =~ /ppc64/ && $release [1] =~ /Red Hat Enterprise Linux Server release 6.5/){
|
||||
print "MN info is redhat ppc 64 ";
|
||||
$testenvinfo = "rhppc64";
|
||||
}elsif ( $osinfo [2] =~ /SUSE Linux Enterprise Server 11/ && $osinfo [2] =~ /ppc64/){
|
||||
print " MN info is sles 11.3 ppc64 ";
|
||||
$testenvinfo = "slesppc64";
|
||||
}elsif ( $osinfo [2] =~ /SUSE Linux Enterprise Server 11/ && $osinfo [2] =~ /x86_64/){
|
||||
print " MN info is sles 11.3 x86_64 ";
|
||||
$testenvinfo = "slesx8664";
|
||||
}elsif ( $osinfo [0] =~ /amd64/ && $osinfo [2] =~ /Red Hat Enterprise Linux Server release 6.5/){
|
||||
print "MN info is redhat 6.5 x86_64 \n";
|
||||
$testenvinfo = "rhx8664";
|
||||
}else
|
||||
{print "no machine info ";}
|
||||
return $testenvinfo;
|
||||
}
|
||||
|
||||
sub init
|
||||
{
|
||||
my $mn = shift;
|
||||
if (exists $rhppc64config{var}){
|
||||
my $MN=$mn;
|
||||
my $envoutput = &gettestinfo;
|
||||
if ($envoutput eq 'rhppc64'){
|
||||
#my $MN=$rhppc64config{var}{MN};
|
||||
my $MN=$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};
|
||||
my $nodedir=$rhppc64config{var}{nodedir};
|
||||
system("xdsh $MN mkdir -p /iso/mountpoint");
|
||||
print "--prepareing redhat iso file.......\n";
|
||||
@ -389,8 +691,8 @@ sub init
|
||||
system("xdsh $MN rm -rf /etc/yum.repos.d/*");
|
||||
# $res = system("scp -r $nodedir/xcat-dep $MN:/");
|
||||
&repo();
|
||||
system("scp -r rhel6.4.repo $MN:/etc/yum.repos.d/rhel6.4.repo");
|
||||
#system("scp -r default.conf $MN:$rhppc64configfile");
|
||||
system("scp -r rhel6.5.repo $MN:/etc/yum.repos.d/rhel6.5.repo");
|
||||
#system("scp -r default.conf $MN:$testconfigfile");
|
||||
#system("xdsh $MN perl $nodedir/xcatbuild/xcat-core/mklocalrepo.sh");
|
||||
system("xdsh $MN perl /xcat-dep/rh6/ppc64/mklocalrepo.sh");
|
||||
print "--install XCAT .......\n";
|
||||
@ -403,7 +705,7 @@ sub init
|
||||
system("xdsh $MN yum -y install perl-xCAT xCAT-client xCAT-server xCAT");
|
||||
print "--install XCATTEST .......\n";
|
||||
system("xdsh $MN yum -y install xCAT-test");
|
||||
system("scp -r default.conf $MN:$rhppc64configfile");
|
||||
system("scp -r default.conf $MN:$testconfigfile");
|
||||
|
||||
print "--install createrepo .......\n";
|
||||
#system("xdsh $MN yum -y install createrepo");
|
||||
@ -418,11 +720,90 @@ sub init
|
||||
#}
|
||||
|
||||
send_msg( " rhppc64 env is ready\n");
|
||||
}
|
||||
}elsif ($envoutput eq 'slesppc64'){
|
||||
system(" xdsh $MN mkdir -p /iso/mountpoint");
|
||||
print "--prepareing SLES iso file.......\n";
|
||||
system("scp -r /iso/SLES-11-SP3-DVD-ppc64-GM-DVD1.iso $MN:/iso/");
|
||||
system("xdsh $MN mount -o loop /iso/SLES-11-SP3-DVD-ppc64-GM-DVD1.iso /iso/mountpoint"); ####
|
||||
print "[OK]\n";
|
||||
|
||||
return 0;
|
||||
print "--prepareing /etc/hosts /etc/resolv.conf.......";
|
||||
system ("scp -r /etc/hosts $MN:/etc/hosts");
|
||||
system ("scp -r /etc/resolv.conf $MN:/etc/resolv.conf");
|
||||
print "[OK]\n";
|
||||
|
||||
print "--get the latest XCAT tarball.......\n";
|
||||
system("xdsh $MN rm -rf /etc/yum.repos.d/*");
|
||||
# $res = system("scp -r $nodedir/xcat-dep $MN:/");
|
||||
|
||||
print "[OK]\n--deploy zypper....";
|
||||
system("xdsh $MN rm -rf /etc/zypp/repos.d/*");
|
||||
# system(xdsh $MN zypper ar file:///autotest/wjx/xcat-core xCAT-core);
|
||||
system("xdsh $MN zypper ar file:///xcat-dep/sles11/ppc64 xCAT-dep");
|
||||
system("xdsh $MN zypper ar file:///iso/mountpoint sles11");
|
||||
|
||||
print "[OK]\n--install xcat....";
|
||||
system("xdsh $MN zypper sl -U");
|
||||
system("xdsh $MN zypper --gpg-auto-import-keys search --match-exact -s screen");
|
||||
system("xdsh $MN zypper -n install xCAT");
|
||||
system("xdsh $MN zypper -n install xCAT-test");
|
||||
system("scp -r defaultslesppc64.conf $MN:$testconfigfile");
|
||||
print "--prepare test environment....\n";
|
||||
print "[OK]\n";
|
||||
}elsif ($envoutput eq 'rhx8664'){
|
||||
system("xdsh $MN mkdir -p /iso/mountpoint");
|
||||
print "--prepareing redhat iso file.......\n";
|
||||
print "[OK]\n--copy ISO file.....";
|
||||
system(" scp -r /iso/RHEL6.5-20131111.0-Server-x86_64-DVD1.iso $MN:/iso");
|
||||
print "--prepareing /etc/hosts /etc/resolv.conf.......";
|
||||
system ("scp -r /etc/hosts $MN:/etc/hosts");
|
||||
system ("scp -r /etc/resolv.conf $MN:/etc/resolv.conf");
|
||||
print "[OK]\n";
|
||||
print "--get the latest XCAT tarball.......\n";
|
||||
#system("scp -r $nodedir/xcat-dep $MN:/");
|
||||
system("xdsh $MN rm -rf /etc/yum.repos.d/*");
|
||||
&repo();
|
||||
system("scp -r rhel6.5.repo $MN:/etc/yum.repos.d/");
|
||||
system("xdsh $MN perl /xcat-dep/rh6/ppc64/mklocalrepo.sh");
|
||||
print "--install XCAT .......\n";
|
||||
system("xdsh $MN yum clean metadata");
|
||||
system("xdsh $MN rpm --import /iso/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 yum -y install iscsi-initiator-utils bridge-utils kvm perl-Sys-Virt perl-Sys-Virt.x86_64 libvirt.x86_64 qemu-kvm.x86_64 ");
|
||||
system("scp -r defaultrhx8664.conf $MN:$testconfigfile");
|
||||
}elsif ($envoutput eq 'slesx8664'){
|
||||
system("xdsh $MN mkdir -p /iso/mountpoint");
|
||||
print "--prepareing SLES iso file.......\n";
|
||||
system(" scp -r /iso/SLES-11-SP3-DVD-x86_64-GM-DVD1.iso $MN:/iso");
|
||||
print "[OK]\n--mount ISO file.....";
|
||||
system("mount -o loop /iso/SLES-11-SP3-DVD-x86_64-GM-DVD1.iso /iso/mountpoint"); ####
|
||||
print "[OK]\n";
|
||||
print "--prepareing /etc/hosts /etc/resolv.conf.......";
|
||||
system ("scp -r /etc/hosts $MN:/etc/hosts");
|
||||
system ("scp -r /etc/resolv.conf $MN:/etc/resolv.conf");
|
||||
print "[OK]\n";
|
||||
print "--get the latest XCAT tarball.......\n";
|
||||
print "[OK]\n--deploy zypper....";
|
||||
system("xdsh $MN rm -rf /etc/zypp/repos.d/*");
|
||||
system("xdsh $MN zypper ar file:///xcat-dep/sles11/x86_64 xCAT-dep");
|
||||
system("xdsh $MN zypper ar file:///iso/mountpoint sles11");
|
||||
print "[OK]\n--install xcat....";
|
||||
system("xdsh $MN zypper sl -U");
|
||||
system("xdsh $MN zypper --gpg-auto-import-keys search --match-exact -s screen");
|
||||
system("xdsh $MN zypper -n install xCAT");
|
||||
system("xdsh $MN zypper -n xCAT-test*");
|
||||
print "--prepare test environment....\n";
|
||||
system("xdsh $MN zypper -n install iscsi-initiator-utils bridge-utils kvm perl-Sys-Virt perl-Sys-Virt.x86_64 libvirt.x86_64 qemu-kvm.x86_64");
|
||||
system("scp -r defaultslesx8664.conf $MN:$testconfigfile");
|
||||
print "--prepare vmtest environment....\n";
|
||||
print "[OK]\n";}
|
||||
return 0;
|
||||
}
|
||||
#######################################
|
||||
# do test
|
||||
@ -431,6 +812,10 @@ sub do_test {
|
||||
my $mn = shift;
|
||||
# step 7.1 Install xcat and init mn
|
||||
send_msg("began to install xCAT and initialize mn");
|
||||
$res = &config_test();
|
||||
if ($res != 0){
|
||||
exit 1;
|
||||
}
|
||||
$res = &init($mn);
|
||||
if ($res != 0){
|
||||
exit 1;
|
||||
@ -453,83 +838,26 @@ sub do_test1
|
||||
my $mn = shift;
|
||||
#my $MN=$rhppc64config{var}{MN};
|
||||
my $MN=$mn;
|
||||
my $envoutput = &gettestinfo;
|
||||
if ($envoutput eq 'rhppc64'){
|
||||
my $nodedir=$rhppc64config{var}{nodedir};
|
||||
print "copy config file ";
|
||||
system("scp -r default.conf $MN:$rhppc64configfile");
|
||||
system("scp -r default.conf $MN:$testconfigfile");
|
||||
|
||||
print "Start to run diskless installation $MN ...\n";
|
||||
send_msg("******************************");
|
||||
send_msg("start diskless test");
|
||||
send_msg("start test");
|
||||
send_msg("******************************");
|
||||
#if($dsklsinst){
|
||||
# system("xdsh $MN perl /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_diskless_installation_flat_ppc64");
|
||||
# system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
# exit 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 /opt/xcat/share/xcat/tools/autotest/bundle/bat.bundle");
|
||||
# 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+)/){
|
||||
# send_msg{command}{total} = $1;
|
||||
# send_msg{command}{fail} = $2;
|
||||
# send_msg{command}{timestamp} = $timestamp;
|
||||
# if(send_msg{command}{fail} != 0){
|
||||
# send_msg{command}{failcase} = "| | | Failed cases:"."\n";
|
||||
# $output = (xdsh $MN cat /autotest/result/failedcases.$timestamp | grep END);
|
||||
# while($output =~ /END::(\w+)/g){
|
||||
# send_msg{command}{failcase} = $send_msg{command}{failcase}."| | | ".$1."\n";
|
||||
# print "$msg{command}{failcase}";
|
||||
# }
|
||||
# print "$send_msg{command}{failcase}";
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#if($stateliteinst){
|
||||
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_statelite_installation_flat_ppc64");
|
||||
# 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 = system(" xdsh $MN tail /autotest/result/xcattest.log.$timestamp");
|
||||
# if($output =~ /Failed: (\d+)/){
|
||||
# if($1 != 0){
|
||||
# send_msg{linux_statelite_installation_flat}{pass} = 0;
|
||||
# send_msg{linux_statelite_installation_flat}{timestamp} = $timestamp;
|
||||
# } else {
|
||||
# send_msg{linux_statelite_installation_flat}{pass} = 1;
|
||||
# }
|
||||
# }
|
||||
#}
|
||||
#if($fullinst){
|
||||
system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64");
|
||||
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 =~ /Failed: (\d+)/){
|
||||
# if($1 != 0){
|
||||
# send_msg{linux_full_installation_flat}{pass} = 0;
|
||||
# send_msg{linux_full_installation_flat}{timestamp} = $timestamp;
|
||||
# } else {
|
||||
# send_msg{linux_full_installation_flat}{pass} = 1;
|
||||
# }
|
||||
# }
|
||||
#}
|
||||
#if($snfullinst){
|
||||
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm");
|
||||
# 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 =~ /Failed: (\d+)/){
|
||||
# if($1 != 0){
|
||||
# send_msg{linux_sn_installation_flat}{pass} = 0;
|
||||
# send_msg{linux_sn_installation_flat}{timestamp} = $timestamp;
|
||||
# } else {
|
||||
# send_msg{linux_sn_installation_flat}{pass} = 1;
|
||||
# }
|
||||
# }
|
||||
#}
|
||||
system("xdsh $MN perl /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_diskless_installation_flat_ppc64");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
|
||||
system("xdsh $MN /opt/xcat/bin/xcattest -b /opt/xcat/share/xcat/tools/autotest/bundle/bat.bundle");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_statelite_installation_flat_ppc64");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
#if($dsklscnsninst){
|
||||
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_cn_with_sn_diskless_installation_flat_x86_vm");
|
||||
# system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
@ -555,6 +883,62 @@ sub do_test1
|
||||
#}
|
||||
#system("mkdir -p $nodedir/result");
|
||||
# system("scp -r $MN:/autotest/result /regression/rhppc64");
|
||||
}elsif ($envoutput eq 'slesppc64'){
|
||||
my $nodedir=$slesppc64config{var}{nodedir};
|
||||
print "copy config file ";
|
||||
system("scp -r defaultslesppc64.conf $MN:$testconfigfile");
|
||||
send_msg("******************************");
|
||||
send_msg("start test");
|
||||
send_msg("******************************");
|
||||
system("xdsh $MN perl /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sles_diskless_installation_ppc64_flat");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
system("xdsh $MN /opt/xcat/bin/xcattest -b /opt/xcat/share/xcat/tools/autotest/bundle/bat.bundle");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sles_statelite_installation_flat_ppc64");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm");
|
||||
# system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
|
||||
}elsif ($envoutput eq 'rhx8664'){
|
||||
my $nodedir=$rhx8664config{var}{nodedir};
|
||||
print "copy config file ";
|
||||
system("scp -r defaultrhx8664.conf $MN:$testconfigfile");
|
||||
send_msg("******************************");
|
||||
send_msg("start test");
|
||||
send_msg("******************************");
|
||||
#system("xdsh $MN perl /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_diskless_installation_flat_ppc64");
|
||||
#system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
|
||||
system("xdsh $MN /opt/xcat/bin/xcattest -b /opt/xcat/share/xcat/tools/autotest/bundle/bat.bundle");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_statelite_installation_flat_ppc64");
|
||||
# system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64");
|
||||
# system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm");
|
||||
# system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
|
||||
}elsif ($envoutput eq 'slesx8664'){
|
||||
my $nodedir=$slesx8664config{var}{nodedir};
|
||||
print "copy config file ";
|
||||
system("scp -r defaultslesx8664.conf $MN:$testconfigfile");
|
||||
send_msg("******************************");
|
||||
send_msg("start test");
|
||||
send_msg("******************************");
|
||||
#system("xdsh $MN perl /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t ");
|
||||
#system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
|
||||
system("xdsh $MN /opt/xcat/bin/xcattest -b /opt/xcat/share/xcat/tools/autotest/bundle/bat.bundle");
|
||||
system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
#system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_statelite_installation_flat_ppc64");
|
||||
#system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64");
|
||||
# system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
# system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm");
|
||||
# system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/");
|
||||
|
||||
}
|
||||
|
||||
#######################################
|
||||
@ -620,21 +1004,13 @@ sub trim {
|
||||
#repo
|
||||
####################################
|
||||
sub repo{
|
||||
my @osname = &runcmd("uname -a");
|
||||
if ( $osname [0] =~ /^Linux\s*/ && -f "/etc/redhat-release" && $osname [0] =~ /ppc64/){
|
||||
send_msg ("ppc64 redhat env\n");
|
||||
my $os="rhels6.4";
|
||||
my $arch="ppc64";
|
||||
send_msg ("os is $os,arch is $arch\n");
|
||||
&runcmd( " echo [rhe-6.4-server]>>rhel6.4.repo");
|
||||
&runcmd( " echo name=RHEL 6.4 SERVER packages>>rhel6.4.repo");
|
||||
&runcmd(" echo baseurl=file:///iso/mountpoint/Server/>>rhel6.4.repo");
|
||||
&runcmd(" echo enabled=1>>rhel6.4.repo");
|
||||
&runcmd(" echo gpgcheck=1>>rhel6.4.repo");
|
||||
# system("scp -r rhel6.4.repo $MN:/etc/yum.repos.d/rhel6.4.repo");
|
||||
&runcmd( " echo [rhe-6.5-server]>>rhel6.5.repo");
|
||||
&runcmd( " echo name=RHEL 6.5 SERVER packages>>rhel6.5.repo");
|
||||
&runcmd(" echo baseurl=file:///iso/mountpoint/Server/>>rhel6.5.repo");
|
||||
&runcmd(" echo enabled=1>>rhel6.5.repo");
|
||||
&runcmd(" echo gpgcheck=1>>rhel6.5.repo");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#######################################
|
||||
# send messages
|
||||
|
@ -124,7 +124,7 @@ my %URIdef = (
|
||||
GET => {
|
||||
desc => "Get the running status for the node {noderange}.",
|
||||
usage => "||$usagemsg{objreturn}|",
|
||||
example => "|Get the running status for node node1|GET|/nodes/node1/nodestat|x|",
|
||||
example => "|Get the running status for node node1|GET|/nodes/node1/nodestat|{\n \"node1\":{\n \"nodestat\":\"noping\"\n }\n}|",
|
||||
cmd => "nodestat",
|
||||
fhandler => \&actionhdl,
|
||||
outhdler => \&actionout,
|
||||
@ -1401,6 +1401,9 @@ sub defout {
|
||||
$lines = \@alldata;
|
||||
}
|
||||
foreach my $l (@$lines) {
|
||||
if ($l =~ /No responses/) { # handle the case that no output from lsslp command
|
||||
return;
|
||||
}
|
||||
if ($l =~ /^Object name: / || $l =~ /^\S+:$/) { # start new node
|
||||
if ($l =~ /^Object name:\s+(\S+)/) { # handle the output of lsdef -t <type> <obj>
|
||||
$nodename = $1;
|
||||
|
@ -144,6 +144,11 @@ for my $u (@users) {
|
||||
$i++;
|
||||
for my $t (@tokens) {
|
||||
for my $c (@certs){
|
||||
if ($method eq "POST" and ($resource =~ /^\/nodes\/(\w+)$/)) {
|
||||
`/opt/xcat/bin/rmdef $1`;
|
||||
print_debug("restapi test rmdef $1\n");
|
||||
}
|
||||
|
||||
my $res = run_restapi($method, $resource, $data, $c, $port, $host, $u, $p, $t);
|
||||
if($res){
|
||||
my $reshash = parse_json($res);
|
||||
@ -276,6 +281,49 @@ sub parse_json
|
||||
print "[:] content is $content \n" if($debug);
|
||||
parse_json($content);
|
||||
}
|
||||
# for those who look like:
|
||||
# {"Vc68m4hsp01":{"parent":"Server-9119-590-SN02C5F9E","pprofile":"Vc68m4hsp01"},"p5ih_c75vios":{"parent":"P5IH-SN02012EB-A","mgt":"hmc","id":"2"},"p5ih_lpar04":{"parent":"P5IH-SN02013EB-A","pprofile":"p5ih_lpar04"}}
|
||||
elsif($input =~ /^"(\S+?)\":{\S+},/){
|
||||
$input =~ s/},/}%/;
|
||||
my @contents = split /%/, $input;
|
||||
my @reval;
|
||||
# record result
|
||||
foreach my $t (@contents) {
|
||||
print ":{}, content is $t \n" if($debug);
|
||||
my $re = parse_json($t);
|
||||
push @reval, $re;
|
||||
}
|
||||
# merge hash
|
||||
foreach my $t (@reval) {
|
||||
if(ref($t) =~ "HASH") {
|
||||
foreach my $k (keys %$t){
|
||||
$hash{$k} = $$t{$k};
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%hash;
|
||||
}
|
||||
elsif( $input =~ /^{\S+},{\S+}/ and !($input =~ /]/)){
|
||||
$input =~ s/},{/}%{/;
|
||||
my @contents = split /%/, $input;
|
||||
my @reval;
|
||||
# record result
|
||||
foreach my $t (@contents) {
|
||||
print "{},{}, content is $t \n" if($debug);
|
||||
my $re = parse_json($t);
|
||||
push @reval, $re;
|
||||
}
|
||||
# merge hash
|
||||
foreach my $t (@reval) {
|
||||
if(ref($t) =~ "HASH") {
|
||||
foreach my $k (keys %$t){
|
||||
$hash{$k} = $$t{$k};
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%hash;
|
||||
}
|
||||
|
||||
# for those who look like
|
||||
# {"clustersite":{"domain":"cluster.com","master":"192.168.1.15"}}
|
||||
elsif ($input =~ /^\s*{(.*)}\s*$/s) {
|
||||
@ -283,6 +331,26 @@ sub parse_json
|
||||
print "{} content is $content \n" if($debug);
|
||||
parse_json($content);
|
||||
}
|
||||
elsif( $input =~ /],\"\S+\":/)){
|
||||
$input =~ s/],\"\S+\":/]%\"\S+\":/;
|
||||
my @contents = split /%/, $input;
|
||||
my @reval;
|
||||
# record result
|
||||
foreach my $t (@contents) {
|
||||
print "],:, content is $t \n" if($debug);
|
||||
my $re = parse_json($t);
|
||||
push @reval, $re;
|
||||
}
|
||||
# merge hash
|
||||
foreach my $t (@reval) {
|
||||
if(ref($t) =~ "HASH") {
|
||||
foreach my $k (keys %$t){
|
||||
$hash{$k} = $$t{$k};
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%hash;
|
||||
}
|
||||
# for those who look like
|
||||
# "domain":"cluster.com","master":"192.168.1.15"
|
||||
elsif ($input =~ /,/ and !($input =~ /}/)) {
|
||||
@ -505,3 +573,5 @@ sub transf_hash
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -19,16 +19,19 @@ function splitconfig(){
|
||||
IFS=$','
|
||||
array_conf_temp=($1)
|
||||
IFS=$old_ifs
|
||||
for i in ${array_conf_temp[@]}
|
||||
|
||||
i=0
|
||||
while [ $i -lt ${#array_conf_temp[@]} ]
|
||||
do
|
||||
token="${array_conf_temp[$i]}"
|
||||
D=
|
||||
if [ `echo $i | grep "!"` ];then
|
||||
if echo "$token" | grep "!"; then
|
||||
D="!"
|
||||
else
|
||||
D=":"
|
||||
fi
|
||||
key=`echo $i | cut -d"$D" -f 1`
|
||||
str_temp_value=`echo $i | cut -d"$D" -f 2`
|
||||
key=`echo "$token" | cut -d"$D" -f 1`
|
||||
str_temp_value=`echo "$token" | cut -d"$D" -f 2`
|
||||
|
||||
str_temp=$(hashget hash_defined_nics $key)
|
||||
if [ -n "$str_temp" ];then
|
||||
@ -37,7 +40,8 @@ function splitconfig(){
|
||||
str_temp="$str_temp_value"
|
||||
str_all_nics=$str_all_nics"$key "
|
||||
fi
|
||||
hashset hash_defined_nics $key $str_temp
|
||||
hashset hash_defined_nics $key "$str_temp"
|
||||
i=$((i+1))
|
||||
done
|
||||
}
|
||||
|
||||
@ -198,8 +202,8 @@ if [ -z "$NICIPS" ];then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
splitconfig $NICIPS
|
||||
splitconfig $NICCUSTOMSCRIPTS
|
||||
splitconfig "$NICIPS"
|
||||
splitconfig "$NICCUSTOMSCRIPTS"
|
||||
|
||||
if [ $boot_myscript -eq 1 ];then
|
||||
. $str_dir_name/$myscript
|
||||
|
@ -508,7 +508,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then
|
||||
useflowcontrol=0
|
||||
fi
|
||||
fi
|
||||
/$xcatpost/getpostscript.awk | egrep '<data>' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /$xcatpost/mypostscript;
|
||||
/$xcatpost/getpostscript.awk | egrep '<data>' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /$xcatpost/mypostscript;
|
||||
|
||||
|
||||
MYCONT=`grep MASTER /$xcatpost/mypostscript`
|
||||
@ -539,7 +539,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then
|
||||
useflowcontrol=0
|
||||
fi
|
||||
fi
|
||||
/$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /$xcatpost/mypostscript;
|
||||
/$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /$xcatpost/mypostscript;
|
||||
MYCONT=`grep MASTER /$xcatpost/mypostscript`
|
||||
if [ ! -z "$MYCONT" ]; then
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user