2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-12 17:30:19 +00:00

Merge branch 'master' of github.com:xcat2/xcat-core into E2808

This commit is contained in:
XuWei
2017-04-17 02:12:20 -04:00
10 changed files with 114 additions and 52 deletions

View File

@ -8,7 +8,7 @@ Documentation
xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/
|docs_latest| |docs_2132| |docs_2131| |docs_2130| |docs_212| |docs_211|
|docs_latest| |docs_2133| |docs_2132| |docs_2131| |docs_2130| |docs_212| |docs_211|
Open Source License
-------------------
@ -22,6 +22,11 @@ Developers
Developers and prospective contributors are encouraged to read the `Developers Guide <http://xcat-docs.readthedocs.io/en/latest/developers/>`_
In particular the `GitHub <http://xcat-docs.readthedocs.io/en/latest/developers/github/>`_ related subsection.
.. |docs_2133| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.3
:alt: 2.13.3 documentation status
:scale: 100%
:target: http://xcat-docs.readthedocs.io/en/2.13.3/
.. |docs_2132| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.2
:alt: 2.13.2 documentation status
:scale: 100%

View File

@ -9,12 +9,16 @@ my $distname;
my $arch;
my $installpfx;
my $distrepopfx="/install/postscripts/repos";
sub localize_yumrepo {
my $self = shift;
my $pkgdir = shift;
$distname=shift;
$arch=shift;
open($yumrepofile, ">", "$pkgdir/local-repository.tmpl");
mkpath("$distrepopfx/$pkgdir");
open($yumrepofile, ">", "$distrepopfx/$pkgdir/local-repository.tmpl");
my %options = (
wanted => \&check_tofix,
follow_fast => 1
@ -27,7 +31,7 @@ sub localize_yumrepo {
sub remove_yumrepo {
my $self = shift;
my $pkgdir = shift;
rmtree("$pkgdir/local-repository.tmpl");
rmtree("$distrepopfx/$pkgdir/local-repository.tmpl");
}
sub check_tofix {
@ -50,8 +54,9 @@ sub generate_repo
my $dirlocation = shift;
my @dircomps = File::Spec->splitdir($dirlocation);
pop(@dircomps);
my $reponame = join("-",@dircomps);
my $yumurl = File::Spec->catdir(@dircomps);
my $reponame = $dircomps[$#dircomps];
print $yumrepofile "[local-$distname-$arch-$reponame]\n";
print $yumrepofile "name=xCAT configured yum repository for $yumurl\n";
print $yumrepofile "baseurl=$yumurl\n";

View File

@ -303,11 +303,12 @@ sub subvars {
$source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos";
$source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #for rhels5.9
}
if( -f "$pkgdir/local-repository.tmpl"){
my $distrepofile="/install/postscripts/repos/$pkgdir/local-repository.tmpl";
if( -f "$distrepofile"){
my $repofd;
my $repo_in_post;
local $/=undef;
open($repofd,"<","$pkgdir/local-repository.tmpl");
open($repofd,"<","$distrepofile");
$repo_in_post = <$repofd>;
close($repofd);
$repo_in_post =~ s#baseurl=#baseurl=http://$master/#g;

View File

@ -16,6 +16,7 @@ use xCAT::TableUtils;
use xCAT::NetworkUtils;
use xCAT::MsgUtils;
use xCAT::SvrUtils;
use xCAT::Yum;
#use Data::Dumper;
use Getopt::Long;
@ -1260,6 +1261,17 @@ sub mkinstall
}
}
my @pkgdirs=split(/,/,$pkgdir);
foreach my $mypkgdir (@pkgdirs){
unless(-f "/install/postscripts/repos/$mypkgdir/local-repository.tmpl"){
#fix issue #2856@github
#for the osimages created by <=xCAT 2.12.3
#there is no local-repository.tmpl under pkgdir created on copycds
#generate local-repository.tmpl here if it does not exist
xCAT::Yum->localize_yumrepo($mypkgdir, $os, $arch);
}
}
my @missingparms;
unless ($os) {
if ($imagename) { push @missingparms, "osimage.osvers"; }
@ -2462,8 +2474,6 @@ sub copycd
}
}
require xCAT::Yum;
xCAT::Yum->localize_yumrepo($path, $distname, $arch);
if ($rc != 0)

View File

@ -27,20 +27,16 @@ use Data::Dumper;
use Getopt::Long;
use JSON;
$::OPENBMC_DEVEL = $ENV{'OPENBMC_DEVEL'};
sub unsupported {
my $callback = shift;
if (defined($::OPENBMC_DEVEL) && ($::OPENBMC_DEVEL eq "YES")) {
xCAT::SvrUtils::sendmsg("Warning: Currently running development code, use at your own risk. Unset OPENBMC_DEVEL and `restartxcatd` to disable.", $callback);
xCAT::SvrUtils::sendmsg("Warning: Currently running development code, use at your own risk. Unset XCAT_OPENBMC_DEVEL", $callback);
return;
} else {
return ([ 1, "This openbmc related function is unsupported and disabled. To bypass, run the following: \n\texport OPENBMC_DEVEL=YES\n\trestartxcatd" ]);
return ([ 1, "This openbmc related function is unsupported and disabled. To bypass, run the following: \n\texport XCAT_OPENBMC_DEVEL=YES" ]);
}
}
#-------------------------------------------------------
=head3 handled_commands
@ -216,6 +212,16 @@ sub preprocess_request {
return [$request];
}
##############################################
# Delete this when could be released
if (ref($request->{environment}) eq 'ARRAY' and ref($request->{environment}->[0]->{XCAT_OPENBMC_DEVEL}) eq 'ARRAY') {
$::OPENBMC_DEVEL = $request->{environment}->[0]->{XCAT_OPENBMC_DEVEL}->[0];
} else {
$::OPENBMC_DEVEL = $request->{environment}->{XCAT_OPENBMC_DEVEL};
}
##############################################
$callback = shift;
my $command = $request->{command}->[0];
@ -355,7 +361,7 @@ sub parse_args {
$check = unsupported($callback); if (ref($check) eq "ARRAY") { return $check; }
$subcommand = "all" if (!defined($ARGV[0]));
unless ($subcommand =~ /^cpu$|^dimm$|^model$|^serial$|^firm$|^all$/) {
unless ($subcommand =~ /^cpu$|^dimm$|^model$|^serial$|^firm$|^mac$|^vpd$|^mprom$|^deviceid$|^guid$|^uuid$|^all$/) {
return ([ 1, "Unsupported command: $command $subcommand" ]);
}
} elsif ($command eq "getopenbmccons") {
@ -425,7 +431,7 @@ sub parse_command_status {
$subcommand = "all";
}
if ($subcommand eq "cpu" or $subcommand eq "dimm" or $subcommand eq "firm" or $subcommand eq "model" or $subcommand eq "serial" or $subcommand eq "all") {
if ($subcommand =~ /^cpu$|^dimm$|^model$|^serial$|^firm$|^mac$|^vpd$|^mprom$|^deviceid$|^guid$|^uuid$|^all$/) {
$next_status{LOGIN_RESPONSE} = "RINV_REQUEST";
$next_status{RINV_REQUEST} = "RINV_RESPONSE";
$status_info{RINV_RESPONSE}{argv} = "$subcommand";
@ -690,7 +696,7 @@ sub rpower_response {
}
}
if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE") {
if ($node_info{$node}{cur_status} eq "RPOWER_STATUS_RESPONSE" and !$next_status{ $node_info{$node}{cur_status} }) {
if ($response_info->{'data'}->{CurrentHostState} =~ /Off$/) {
xCAT::SvrUtils::sendmsg("off", $callback, $node);
} else {
@ -741,22 +747,26 @@ sub rinv_response {
foreach my $key_url (keys %{$response_info->{data}}) {
my %content = %{ ${ $response_info->{data} }{$key_url} };
if ($grep_string eq "model") {
if ($key_url =~ /\/motherboard$/) {
my $model = "Model : " . $content{Model};
my $partnumber = "PartNumber : " . "$content{PartNumber}";
xCAT::SvrUtils::sendmsg("$model", $callback, $node);
xCAT::SvrUtils::sendmsg("$partnumber", $callback, $node);
next;
}
} elsif ($grep_string eq "serial") {
if ($key_url =~ /\/motherboard$/) {
my $prettyname = "PrettyName : " . $content{PrettyName};
my $serialnumber = "SerialNumber : " . "$content{SerialNumber}";
xCAT::SvrUtils::sendmsg("$prettyname", $callback, $node);
xCAT::SvrUtils::sendmsg("$serialnumber", $callback, $node);
next;
}
if (($grep_string eq "vpd" or $grep_string eq "model") and $key_url =~ /\/motherboard$/) {
my $partnumber = "BOARD Part Number: " . "$content{PartNumber}";
xCAT::SvrUtils::sendmsg("$partnumber", $callback, $node);
next;
} elsif (($grep_string eq "vpd" or $grep_string eq "serial") and $key_url =~ /\/motherboard$/) {
my $serialnumber = "BOARD Serial Number: " . "$content{SerialNumber}";
xCAT::SvrUtils::sendmsg("$serialnumber", $callback, $node);
next;
} elsif (($grep_string eq "vpd" or $grep_string eq "mprom")) {
# wait for interface
} elsif (($grep_string eq "vpd" or $grep_string eq "deviceid")) {
# wait for interface
} elsif ($grep_string eq "uuid") {
# wait for interface
} elsif ($grep_string eq "guid") {
# wait for interface
} elsif ($grep_string eq "mac" and $key_url =~ /\/ethernet/) {
my $macaddress = "MAC: " . $content{MACAddress};
xCAT::SvrUtils::sendmsg("$macaddress", $callback, $node);
next;
} elsif ($grep_string eq "all" or $key_url =~ /\/$grep_string/ or ($grep_string eq "firm" and defined($content{Name}) and $content{Name} eq "OpenPOWER Firmware")) {
if ($key_url =~ /\/(cpu\d*)\/(\w+)/) {
$src = "$1 $2";
@ -829,25 +839,25 @@ sub rsetboot_response {
if ($node_info{$node}{cur_status} eq "RSETBOOT_HD_RESPONSE") {
if ($response_info->{'message'} eq "200 OK") {
xCAT::SvrUtils::sendmsg("HD", $callback, $node);
xCAT::SvrUtils::sendmsg("Hard Drive", $callback, $node);
}
}
if ($node_info{$node}{cur_status} eq "RSETBOOT_NET_RESPONSE") {
if ($response_info->{'message'} eq "200 OK") {
xCAT::SvrUtils::sendmsg("NET", $callback, $node);
xCAT::SvrUtils::sendmsg("Network", $callback, $node);
}
}
if ($node_info{$node}{cur_status} eq "RSETBOOT_CD_RESPONSE") {
if ($response_info->{'message'} eq "200 OK") {
xCAT::SvrUtils::sendmsg("CD", $callback, $node);
xCAT::SvrUtils::sendmsg("CD/DVD", $callback, $node);
}
}
if ($node_info{$node}{cur_status} eq "RSETBOOT_DEF_RESPONSE") {
if ($response_info->{'message'} eq "200 OK") {
xCAT::SvrUtils::sendmsg("DEF", $callback, $node);
xCAT::SvrUtils::sendmsg("boot override inactive", $callback, $node);
}
}

View File

@ -124,7 +124,7 @@ my $iface = "lanplus";
if (grep /IPMI Version : 1.5/, @mcinfo) {
$solcom = "isol";
$iface = "lan";
} elsif (grep /Manufacturer ID : 343/, @mcinfo) {
} elsif (grep /Manufacturer ID : 343/, @mcinfo && ! grep /Product ID : 117/,@mcinfo) {
$isintel = 1;
}
my $inteloption = "";

View File

@ -410,9 +410,9 @@ export ARCH=#TABLE:nodetype:THISNODE:arch#
export CONSOLEPORT=#TABLEBLANKOKAY:nodehm:THISNODE:serialport#
#for redhat:
##place-holder for the code to save the repo info on compute node,pointing to the "pkgdir" of the osimage
##so that the provisioned node
##WRITEREPO#
#place-holder for the code to save the repo info on compute node,pointing to the "pkgdir" of the osimage
#so that the provisioned node has the repo pointed to the distro path on MN
#WRITEREPO#
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
msgutil_r "$MASTER_IP" "info" "running mypostscript" "/var/log/xcat/xcat.log"

View File

@ -2,7 +2,7 @@
#
# go-xcat - Install xCAT automatically.
#
# Version 1.0.15
# Version 1.0.17
#
# Copyright (C) 2016 International Business Machines
# Eclipse Public License, Version 1.0 (EPL-1.0)
@ -517,7 +517,7 @@ function check_repo_version_zypper()
do
name+=("${name}")
ver+=("${ver}")
done < <(zypper --no-gpg-checks -n search -s --match-exact "$@" \
done < <(zypper --no-gpg-checks -n search -u -s --match-exact "$@" \
2>/dev/null | awk -F ' *\\| *' '/ package / { print $2, $4 }')
local -i i
while [[ -n "$1" ]]
@ -955,6 +955,7 @@ function remove_repo_yum()
# This is a quick and dirty method.
rm -f $(grep -l "^\[${repo_id}\]$" "/etc/yum.repos.d/"*".repo" 2>/dev/null)
yum clean metadata
:
}
# $1 repo id

View File

@ -1219,11 +1219,41 @@ cmd:chtab -d netname=testnetwork networks
check:rc==0
end
start:makedns_n_noderange
description:to verify makedns -n noderange works as design. add case for bug #2572. Test case bug number is #2826.
cmd:chtab netname=testnetwork networks.net=100.100.100.0 networks.mask=255.255.255.0 networks.mgtifname=eth0 networks.gateway=100.100.100.254
check:rc==0
cmd:chdef -t node -o dnstestnode[1-10] groups=dnsnode ip="|dnstestnode(\d+)|100.100.100.(\$1+0)|"
check:rc==0
cmd:cp -f /etc/hosts /etc/hosts.testbak
check:rc==0
cmd:for i in {1..10}; do echo "100.100.100.$i dnstestnode$i" >> /etc/hosts; done
check:rc==0
cmd:makedns -n dnstestnode[1-10]
check:rc==0
cmd:nslookup dnstestnode5 $$MN
check:output~=Server: $$MN
check:output!~(server can't find dnstestnode)
cmd:makedns -d dnstestnode[1-10]
check:rc==0
cmd:nslookup dnstestnode5 $$MN
check:output~=Server: $$MN
check:output~=(server can't find dnstestnode)
cmd:makedns -n dnsnode
check:rc==0
cmd:nslookup dnstestnode5 $$MN
check:output~=Server: $$MN
check:output!~(server can't find dnstestnode)
cmd:makedns -d dnsnode
check:rc==0
cmd:nslookup dnstestnode5 $$MN
check:output~=Server: $$MN
check:output~=(server can't find dnstestnode)
cmd:rmdef -t node dnstestnode[1-10]
check:rc==0
cmd:chtab -d netname=testnetwork networks
check:rc==0
cmd:makedns -n
check:rc==0
cmd:cp -f /etc/hosts.testbak /etc/hosts
end

View File

@ -909,7 +909,7 @@ sub runcase
my $runstart = timelocal(localtime());
my $runstartstr = scalar(localtime());
log_this("\nRUN:$cmd [$runstartstr]");
push(@record, "\nRUN:$cmd");
push(@record, "\nRUN:$cmd [$runstartstr]");
@output = &runcmd($cmd);
$rc = $::RUNCMD_RC;