Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core

This commit is contained in:
yinle 2014-09-25 14:52:34 -07:00
commit 5054e01a26
141 changed files with 3448 additions and 1199 deletions

View File

@ -44,10 +44,11 @@ FRS=/home/frs/project/x/xc/xcat
ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal"
ZVMBUILD="perl-xCAT xCAT-server xCAT-UI"
ZVMLINK="xCAT-client xCAT xCATsn"
# xCAT has PCM specific configuration - conserver-xcat, syslinux-xcat
# xCAT and xCATsn have PCM specific configuration - conserver-xcat, syslinux-xcat
# xCAT-server has PCM specific configuration - RESTAPI(perl-JSON)
PCMBUILD="xCAT xCAT-server xCATsn"
PCMLINK="perl-xCAT xCAT-client xCAT-buildkit xCAT-genesis-scripts-x86_64"
# xCAT-client has PCM specific configuration - getxcatdocs(perl-JSON)
PCMBUILD="xCAT xCAT-server xCAT-client xCATsn"
PCMLINK="perl-xCAT xCAT-buildkit xCAT-genesis-scripts-x86_64"
# Note: for FSM, the FlexCAT rpm is built separately from gsa/git
FSMBUILD="perl-xCAT xCAT-client xCAT-server"
FSMLINK=""
@ -264,6 +265,8 @@ if [ "$OSNAME" != "AIX" ]; then
ORIGFAILEDRPMS="$FAILEDRPMS"
./makerpm xCAT-genesis-scripts x86_64 "$EMBED"
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-x86_64"; fi
./makerpm xCAT-genesis-scripts ppc64 "$EMBED"
if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-ppc64"; fi
if [ "$FAILEDRPMS" = "$ORIGFAILEDRPMS" ]; then # all succeeded
rm -f $DESTDIR/xCAT-genesis-scripts*rpm
rm -f $SRCDIR/xCAT-genesis-scripts*rpm

View File

@ -266,7 +266,7 @@ See http://www.perl.com/doc/manual/html/pod/perlre.html for information on perl
As of xCAT 2.8.1, you can use a modified version of the regular expression support described in the previous section. You do not need to enter the node information (1st part of the expression), it will be derived from the input nodename. You only need to supply the 2nd part of the expression to determine the value to give the attribute. For examples, see
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Listing_and_Modifying_the_Database#Easy_Regular_expressions
https://sourceforge.net/p/xcat/wiki/Listing_and_Modifying_the_Database/#easy-regular-expressions
=head1 OBJECT DEFINITIONS

View File

@ -517,12 +517,14 @@ sub getmacs {
$data.= "\n$_\n";
push @$value, "\n$_\n";
} elsif ( /^ent\s+/ || /^hfi-ent\s+/ ) {
my @fields = split /\s+/, $_;
my $mac = $fields[2];
$mac = format_mac( $mac );
$fields[2] = $mac;
$data .= join(" ",@fields)."\n";
push @$value, join(" ",@fields)."\n";
#my @fields = split /\s+/, $_;
#my $mac = $fields[2];
#$mac = format_mac( $mac );
#$fields[2] = $mac;
#$data .= join(" ",@fields)."\n";
#push @$value, join(" ",@fields)."\n";
$data .= "$_\n";
push @$value, "$_\n";
}
}
push @$res,[$node,$data,0];

View File

@ -801,6 +801,19 @@ sub do_op_extra_cmds {
if ($op eq "lparname") {
$action = "set_lpar_name";
} elsif ($op eq "huge_page") {
my @td = @$d;
@td[0] = 0;
my $tmphash = &query_cec_info_actions($request, $name, \@td, 1, ["get_huge_page"]);
if ($tmphash->{huge_page_avail}) {
if ($param > $tmphash->{huge_page_avail}) {
push @values, [$name, "No enough huge pages, only $tmphash->{huge_page_avail} pages available", 0];
$param = $tmphash->{huge_page_avail};
}
$param = "1/$param/$param";
} else {
push @values, [$name, "No huge page available to configure", 0];
next;
}
$action = "set_huge_page";
} elsif ($op eq "vmcpus") {
$action = "part_set_lpar_pending_proc";

View File

@ -629,7 +629,8 @@ sub get_adap_prop {
$cmd[0] = "\" supported-network-types\" " . $phandle . " get-package-property\r";
$msg[0] = "Status: rc and all supported network types now on stack\n";
#$pattern[0] = "(.*)3 >(.*)";
$pattern[0] = "3 >";
#$pattern[0] = "3 >";
$pattern[0] = "ok";
$newstate[0] = 1;
# state 1, return code and string on stack
@ -637,7 +638,8 @@ sub get_adap_prop {
$cmd[1] = ".\r";
$msg[1] = "Status: All supported network types now on stack\n";
#$pattern[1] = "(.*)2 >(.*)";
$pattern[1] = "2 >";
#$pattern[1] = "2 >";
$pattern[1] = "ok";
$newstate[1] = 2;
# state 2, data ready to decode
@ -691,6 +693,16 @@ sub get_adap_prop {
$timeout,
[ qr/$pattern[$state]/i,
sub {
if ($state eq 1) {
if ($rconsole->before() =~ /-\d+/) {
nc_msg($verbose, "Status: Error getting adapter property for phandle=$phandle.\n");
$state = 7;
$rconsole->clear_accum();
$rc = 1;
return 1;
}
}
nc_msg($verbose, $msg[$state]);
$state = $newstate[$state];
$rconsole->clear_accum();
@ -878,6 +890,15 @@ sub get_mac_addr {
$timeout,
[qr/$pattern[$state]/=>
sub {
if ($state eq 1) {
if ($rconsole->before() =~ /-\d+/) {
nc_msg($verbose, "Status: Error getting MAC address for phandle=$phandle.\n");
$rconsole->clear_accum();
$state = 4;
$rc = 1;
return undef;
}
}
nc_msg($verbose, $msg[$state]);
$state = $newstate[$state];
$rconsole->clear_accum();
@ -1019,7 +1040,8 @@ sub get_mac_addr {
$cmd[0] = "\" ibm,loc-code\" $phandle get-package-property\r";
$msg[0] = "Status: return code and loc-code now on stack\n";
#$pattern[0] = "(.*)3 >(.*)";
$pattern[0] = "3 >";
#$pattern[0] = "3 >";
$pattern[0] = "ok";
$newstate[0] = 1;
# cmd(1) is a dot (.). This is a stack manipulation command that removes one
@ -1052,6 +1074,16 @@ sub get_mac_addr {
$timeout,
[qr/$pattern[$state]/=>
sub {
if ($state eq 1) {
if ($rconsole->before() =~ /-\d+/) {
nc_msg($verbose, "Status: Error getting adapter location for phandle=$phandle.");
$rconsole->clear_accum();
$state = 3;
$rc = 1;
return undef;
}
}
nc_msg($verbose, $msg[$state]);
$rconsole->clear_accum();
$state = $newstate[$state];
@ -1125,10 +1157,19 @@ sub get_mac_addr {
return undef if ($rc eq 1);
}
# Did we find one or more adapters?
if ($result[3] =~ /(\w*):(.*):(\w*\.\w*\.\w*):/) {
$loc_code = $3;
}else {
my @loc_array = split /\n/,$result[3];
my $found = 0;
$loc_code = '';
foreach my $line ( @loc_array ) {
if ($line =~ /(\w*):(.*):([\w|\.|-]*):/) {
$loc_code .= $3;
$found = 1;
}
}
if ($found) {
$loc_code =~ s/\.$//;
return $loc_code;
} else {
return undef;
}
}
@ -3006,6 +3047,21 @@ sub lparnetbootexp
$device_type = "physical";
}
if (defined($mac_address)) {
my @newmacs = ();
my @allmacs = split /\|/,$mac_address;
if ( !xCAT::Utils->isAIX() ) {
foreach my $mac_a ( @allmacs ) {
$mac_a = lc($mac_a);
$mac_a =~ s/(\w{2})/$1:/g;
$mac_a =~ s/:$//;
push @newmacs, $mac_a;
}
$mac_address = join("|",@newmacs);
}
}
if($colon) {
nc_msg($verbose, "$adap_type[$i]\:$loc_code\:$mac_address\:$full_path_name_array[$i]\:$ping_result\:$device_type\:\:\:\:\n");
$outputarrayindex++;

View File

@ -138,8 +138,9 @@ This program module file, supports the xcat messaging and logging
N - Node informational goes to STDOUT
S - Message will be logged to syslog ( severe error)
Note S can be combined with other flags for example
SE logs message to syslog and is sent to STDERR.
SA logs message to syslog and to the auditlog DB table
SE logs message to syslog and is sent to STDERR.
SA logs message to syslog and to the auditlog DB table. (only xcatd)
A logs message auditlog DB table only. (only for xcatd)
V - verbose. This flag is not valid, the calling routine
should check for verbose mode before calling the message
@ -175,7 +176,7 @@ This program module file, supports the xcat messaging and logging
# Message to Syslog
xCAT::MsgUtils->message('S', "Host $host not responding\n");
# Message to Syslog and auditlog table
# Message to Syslog and auditlog table (only used by xcatd)
# see tabdump -d auditlog
my $rsp = {};
$rsp->{syslogdata}->[0] = "$host not responding\n"; # for syslog
@ -189,6 +190,18 @@ This program module file, supports the xcat messaging and logging
$rsp->{status} -> [0] = $status;
xCAT::MsgUtils->message('SA', $rsp);
# Message to only auditlog table (only used by xcatd)
# see tabdump -d auditlog
my $rsp = {};
$rsp->{userid} ->[0] = $user;
$rsp->{clientname} -> [0] = $client;
$rsp->{clienttype} -> [0] = $clienttype;
$rsp->{command} -> [0] = $command;
$rsp->{noderange} -> [0] = $noderange;
$rsp->{args} -> [0] = $arguments;
$rsp->{status} -> [0] = $status;
xCAT::MsgUtils->message('A', $rsp);
# Message to Log and Syslog
xCAT::MsgUtils->message('LS', "Host $host not responding\n");
@ -197,44 +210,44 @@ This program module file, supports the xcat messaging and logging
Use with callback
# Message to callback
my $rsp = {};
my $rsp = {};
$rsp->{data}->[0] = "Job did not run. \n";
xCAT::MsgUtils->message("D", $rsp, $::CALLBACK);
my $rsp = {};
my $rsp = {};
$rsp->{error}->[0] = "No hosts in node list\n";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
my $rsp = {};
$rsp->{node}->[0]->{name}->[0] ="mynode";
$rsp->{node}->[0]->{data}->[0] ="mydata";
xCAT::MsgUtils->message("N", $rsp, $callback);
my $rsp = {};
$rsp->{node}->[0]->{name}->[0] ="mynode";
$rsp->{node}->[0]->{data}->[0] ="mydata";
xCAT::MsgUtils->message("N", $rsp, $callback);
my $rsp = {};
my $rsp = {};
$rsp->{info}->[0] = "No hosts in node list\n";
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
my $rsp = {};
my $rsp = {};
$rsp->{sinfo}->[0] = "No hosts in node list\n";
xCAT::MsgUtils->message("IS", $rsp, $::CALLBACK);
my $rsp = {};
my $rsp = {};
$rsp->{warning}->[0] = "No hosts in node list\n";
xCAT::MsgUtils->message("W", $rsp, $::CALLBACK);
my $rsp = {};
my $rsp = {};
$rsp->{error}->[0] = "Host not responding\n";
xCAT::MsgUtils->message("S", $rsp, $::CALLBACK);
# Message to Syslog and callback
my $rsp = {};
my $rsp = {};
$rsp->{error}->[0] = "Host not responding\n";
xCAT::MsgUtils->message("SE", $rsp, $::CALLBACK);
# Message to Syslog and callback
my $rsp = {};
my $rsp = {};
$rsp->{info}->[0] = "Host not responding\n";
xCAT::MsgUtils->message("SI", $rsp, $::CALLBACK);
@ -274,17 +287,19 @@ sub message
my $call_back = shift; # optional
my $exitcode = shift; # optional
# should be I,IS, D, E, S, SA ,LS, W , L,N
# should be I,IS, D, E, S, SA,A ,LS, W , L,N
# or S(I, D, E, S, W, L,N)
#
# if new SA option need to split syslog messages from auditlog entry
# if SA option need to split syslog messages from auditlog entry
#
my $newrsp;
if ($sev eq 'SA')
{ # if SA then need to pull first entry from $rsp
# for syslog, to preserve old interface
if (($sev eq 'SA') || ($sev eq 'A'))
{ # if SA ( syslog and auditlog) or A ( only auditlog)then need to pull first entry from $rsp
# for syslog, to preserve old interface
$newrsp = $rsp;
if ($sev eq 'SA'){ # syslog and auditlog
$rsp = $newrsp->{syslogdata}->[0];
}
}
my $stdouterrf = \*STDOUT;
my $stdouterrd = '';
@ -449,11 +464,10 @@ sub message
}
}
# is syslog requested
# is syslog option requested
if ($sev =~ /S/)
{
# If they want this msg to also go to syslog, do that now
eval {
openlog("xCAT", "nofatal,pid", "local4");
@ -474,7 +488,7 @@ sub message
# if write to auditlog table requested, if not on service node
if (xCAT::Utils->isMN()){
if ($sev eq 'SA')
if (($sev eq 'SA') || ($sev eq 'A'))
{
require xCAT::Table;
my $auditlogentry;

View File

@ -555,6 +555,9 @@ sub getmacs {
} else {
$type = "virtualio";
}
if ($mac_addr) {
$mac_addr = format_mac($mac_addr);
}
my %att = ();
$att{'MAC_Address'} = ($mac_addr) ? $mac_addr : "N/A";
@ -627,9 +630,9 @@ sub getmacs {
}
foreach ( @$value ) {
if ( /^#\s?Type/ ) {
$data.= "\n$_\n";
$data.= "\n$_\n";
} else {
$data.= format_mac( $_ );
$data.= "$_\n";
}
}
@ -756,7 +759,7 @@ sub getmacs {
if ( /^#\s?Type/ ) {
$data.= "\n$_\n";
} elsif ( /^ent\s+/ or /^hfi-ent\s+/ ) {
$data.= format_mac( $_ );
$data.= "$_\n";
}
}
#####################################
@ -801,10 +804,8 @@ sub cal_mac {
##########################################################################
sub format_mac {
my $data = shift;
my $mac = shift;
$data =~ /^(\S+\s+\S+\s+)(\S+)(\s+.*)$/;
my $mac = $2;
#####################################
# Get adapter mac
#####################################
@ -813,6 +814,10 @@ sub format_mac {
if ( !xCAT::Utils->isAIX() ) {
foreach my $mac_a ( @macs ) {
if (&checkmac($mac_a)) {
push @newmacs, $mac_a;
next;
}
#################################
# Delineate MAC with colons
#################################
@ -821,14 +826,30 @@ sub format_mac {
$mac_a =~ s/:$//;
push @newmacs, $mac_a;
}
my $newmac = join("|",@newmacs);
$data =~ s/$mac/$newmac/;
$mac = join("|",@newmacs);
}
return( "$data\n" );
return( "$mac\n" );
}
##########################################################################
# checkmac format
##########################################################################
sub checkmac {
my $mac = shift;
if ( !xCAT::Utils->isAIX()) {
if ($mac =~ /\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2}/) {
return 1;
} else {
return 0;
}
} else {
return 1;
}
}
##########################################################################
# Write first valid adapter MAC to database
@ -847,6 +868,9 @@ sub writemac {
# Find first valid adapter
#####################################
foreach ( @$data ) {
unless (&checkmac($_)) {
next;
}
if ( /^ent\s+/ or /^hfi-ent\s+/ ) {
$value = $_;
#####################################
@ -869,6 +893,9 @@ sub writemac {
#####################################
if ( $pingret ne "successful" ) {
foreach ( @$data ) {
unless (&checkmac($_)) {
next;
}
if ( /^ent\s+/ or /^hfi-ent\s+/ ) {
$value = $_;
$ping_test = 0;
@ -890,7 +917,7 @@ sub writemac {
#####################################
# Get adapter mac
#####################################
$value = format_mac( $value );
#$value = format_mac( $value );
@fields = split /\s+/, $value;
$mac = $fields[2];

View File

@ -653,6 +653,39 @@ sub get_all_cecs
}
}
#-------------------------------------------------------------------------------
=head3 get_all_lparids
Description : Get all LPAR ids in system.
Arguments : ref of all cecs
Returns : ref for LPAR ids hash.
Example :
my $arrayref = xCAT::ProfiledNodeUtils->get_all_lparids(\%allcecs);
=cut
#-------------------------------------------------------------------------------
sub get_all_lparids
{
my $class= shift;
my $cecsref = shift;
my %allcecs = %$cecsref;
my %lparids;
my $ppctab = xCAT::Table->new('ppc');
foreach my $cec (keys %allcecs) {
my @ids = $ppctab->getAllAttribsWhere("hcp = '$cec'", 'id');
foreach (@ids) {
if ( $_->{'id'} ){
$lparids{$cec}{$_->{'id'}} = 0;
}
}
}
$ppctab->close();
return \%lparids;
}
#-------------------------------------------------------------------------------
=head3 is_discover_started

View File

@ -815,7 +815,7 @@ sub decode_spd {
$rethash->{product}->{builddate} = sprintf("Week %x of 20%02x",$spd[323],$spd[324]);
}
foreach (@spd[329..348]) {
if ($_ & 0b10000000) {
if ($_ > 126 or $_ < 32) {
$rethash->{product}->{model}="Malformed SPD";
}
}

View File

@ -924,8 +924,11 @@ site => {
" -----------------\n".
"DATABASE ATTRIBUTES\n".
" -----------------\n".
" auditnosyslog: If set to 1, then commands will only be written to the auditlog table.\n".
" This attribute set to 1 and auditskipcmds=ALL means no logging of commands.\n".
" Default is to write to both the auditlog table and syslog.\n".
" auditskipcmds: List of commands and/or client types that will not be\n".
" written to the auditlog table.\n".
" written to the auditlog table and syslog. See auditnosyslog.\n".
" 'ALL' means all cmds will be skipped. If attribute is null, all\n".
" commands will be written.\n".
" clienttype:web would skip all commands from the web client\n".
@ -943,6 +946,7 @@ site => {
" nodestatus: If set to 'n', the nodelist.status column will not be updated during\n".
" the node deployment, node discovery and power operations. The default is to update.\n\n".
" skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n\n".
" skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not be logged in syslog.\n\n".
" -------------\n".
"DHCP ATTRIBUTES\n".
" -------------\n".

View File

@ -33,7 +33,7 @@ my %usage = (
LPAR(with HMC) specific:
rpower <noderange> [on|off|reset|stat|state|boot|of|sms|softoff]
CEC(using Direct FSP Management) specific:
rpower <noderange> [on|onstandby|off|stat|state|lowpower|resetsp]
rpower <noderange> [on|onstandby|off|stat|state|resetsp]
Frame(using Direct FSP Management) specific:
rpower <noderange> [stat|state|rackstandby|exit_rackstandby|resetsp]
LPAR(using Direct FSP Management) specific:

View File

@ -4232,4 +4232,68 @@ sub disableservice{
xCAT::Utils->runcmd($cmd, -1);
return $::RUNCMD_RC;
}
sub cleanup_for_powerLE_hardware_discovery {
my $host_node = shift;
if( $host_node =~ /xCAT::Utils/)
{
$host_node=shift;
}
my $pbmc_node = shift;
my $subreq = shift;
my $ipmitab = xCAT::Table->new("ipmi");
unless($ipmitab) {
xCAT::MsgUtils->message("S", "Discovery Error: can not open ipmi table.");
return;
}
my @nodes = ($host_node, $pbmc_node);
my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['node', 'bmc', 'username', 'password']);
if ($ipmihash) {
my $new_bmc_ip = $ipmihash->{$host_node}->[0]->{bmc};
my $new_bmc_password = $ipmihash->{$host_node}->[0]->{password};
xCAT::MsgUtils->message("S", "Discovery info: configure password for pbmc_node:$pbmc_node.");
`rspconfig $pbmc_node password=$new_bmc_password`;
#if ($new_bmc_password) {
# xCAT::Utils->runxcmd(
# {
# command => ["rspconfig"],
# node => ["$pbmc_node"],
# arg => [ "password=$new_bmc_password" ],
# },
# $subreq, 0,1);
# if ($::RUNCMD_RC != 0) {
# xCAT::MsgUtils->message("S", "Discovery Error: configure password failed for FSP.");
# return;
# }
#}
xCAT::MsgUtils->message("S", "Discover info: configure ip:$new_bmc_ip for pbmc_node:$pbmc_node.");
`rspconfig $pbmc_node ip=$new_bmc_ip`;
#if($new_bmc_ip) {
# xCAT::Utils->runxcmd(
# {
# command => ["rspconfig"],
# node => ["$pbmc_node"],
# arg => [ "ip=$new_bmc_ip" ],
# },
# $subreq, 0,1);
# if ($::RUNCMD_RC != 0) {
# xCAT::MsgUtils->message("S", "Discovery Error: configure IP address failed for FSP.");
# return;
# }
#}
xCAT::MsgUtils->message("S", "Discovery info: remove pbmc_node:$pbmc_node.");
`rmdef $pbmc_node`;
#xCAT::Utils->runxcmd(
# {
# command => ["rmdef"],
# node => ["$pbmc_node"],
# },
# $subreq, 0,1);
}
}
1;

View File

@ -1,38 +1,88 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: xcat-openstack-baremetal
Source: <url://example.com>
Eclipse Public License - v 1.0
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: <special license>
<Put the license of the package here indented by 1 space>
<This follows the format of Description: lines in control file>
.
<Including paragraphs>
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2014 root <root@unknown>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
1. DEFINITIONS
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.
"Contribution" means:
a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
"Program" means the Contributions distributed in accordance with this Agreement.
"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright notices contained within the Program.
Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.

View File

@ -1,2 +0,0 @@
xcat-openstack-baremetal_2.8.4-1_all.deb admin extra
xcat-openstack-baremetal_2.8.4-1_all.deb admin extra

View File

@ -1,201 +0,0 @@
dh_installdirs
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb
dh_installdirs
dh_install
dh_link
dh_installman
dh_compress
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb

View File

@ -63,26 +63,50 @@ sub addKernelParms {
# get node ip and add it to the kernel parms
my ($nic, $ip, $netmask, $network, $broadcast, $gateway, $mac) = getNodeIpInfo($args);
if (!$ip) { die "Error: could not find the NIC that would connect to the xCAT mgmt node's IP (".$args->{mnip}.").\n"; }
# if we are booting genesis, need to add the BOOTIF parm
my $bootif;
#if (defined($PROVMETHOD) && $PROVMETHOD eq 'sysclone') {
if ($args->{kernelpath} =~ m/genesis\.kernel\.x86_64/) {
$bootif = $mac;
# genesis case, add additional parms for sysclone or nodeset shell
my $bootif = $mac;
$bootif =~ s/:/-/g;
$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
#todo: the parameters for kickstart are likely different
$args->{kernelparms} .= " $bootif hostip=$ip netmask=$netmask gateway=$gateway dns=$mnip hostname=$nodename netdevice=$nic netwait=$WAITTIME textmode=1";
# print Dumper($args->{kernelparms})
else { # scripted install (kickstart or autoyast)
if ($args->{kernelparms} =~ m/autoyast=/) { # sles
# if site.managedaddressmode=static is set, it will put several of these kernel parms on there for us. Do not duplicate in that case.
if ($args->{kernelparms} !~ m/ hostip=/) { $args->{kernelparms} .= " hostip=$ip"; }
if ($args->{kernelparms} !~ m/ netmask=/) { $args->{kernelparms} .= " netmask=$netmask"; }
if ($args->{kernelparms} !~ m/ gateway=/) { $args->{kernelparms} .= " gateway=$gateway"; }
if ($args->{kernelparms} !~ m/ hostname=/) { $args->{kernelparms} .= " hostname=$nodename"; }
if ($args->{kernelparms} !~ m/ dns=/) { $args->{kernelparms} .= " dns=$mnip"; }
# If they set installnic=mac (recommended), the netdevice will already be set to the mac.
# If they explicitly set installnic=<nic>, then ksdevice will be set to that and we will not disturb it here.
# Otherwise add netdevice set to the nic we calculated it should be.
if ($args->{kernelparms} !~ m/ netdevice=/) { $args->{kernelparms} .= " netdevice=$nic"; }
$args->{kernelparms} .= " netwait=$WAITTIME textmode=1";
# print Dumper($args->{kernelparms})
}
elsif ($args->{kernelparms} =~ m/ks=/) { # rhel/centos
# See https://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-kickstart2-startinginstall.html
# and http://fedoraproject.org/wiki/Anaconda/NetworkIssues for description of kickstart kernel parms
# if site.managedaddressmode=static is set, it will put several of these kernel parms on there for us. Do not duplicate in that case.
if ($args->{kernelparms} !~ m/ ip=/) { $args->{kernelparms} .= " ip=$ip"; }
if ($args->{kernelparms} !~ m/ netmask=/) { $args->{kernelparms} .= " netmask=$netmask"; }
if ($args->{kernelparms} !~ m/ gateway=/) { $args->{kernelparms} .= " gateway=$gateway"; }
if ($args->{kernelparms} !~ m/ hostname=/) { $args->{kernelparms} .= " hostname=$nodename"; }
if ($args->{kernelparms} !~ m/ dns=/) { $args->{kernelparms} .= " dns=$mnip"; }
# If they set installnic=mac (recommended), the ksdevice will already be set to the mac.
# If they explicitly set installnic=<nic>, then ksdevice will be set to that and we will not disturb it here.
# Otherwise ksdevice will be set to bootif, and we change it to the nic we calculated it should be.
if ($args->{kernelparms} =~ m/ ksdevice=bootif/) { $args->{kernelparms} =~ s/ ksdevice=bootif/ ksdevice=$nic/; }
elsif ($args->{kernelparms} !~ m/ ksdevice=/) { $args->{kernelparms} .= " ksdevice=$nic"; }
$args->{kernelparms} .= " nicdelay=$WAITTIME linksleep=$WAITTIME textmode=1";
# print Dumper($args->{kernelparms})
}
else { die "Error: for scripted installs, only support SLES or RHEL/CentOS as the target OS.\n"; }
}
}
@ -134,8 +158,10 @@ sub getNodeIpInfo {
# 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()) {
# This works similarly (at least in some case) when rhel is the target OS.
# The preferred way is for the user to set installnic=mac, then we do not need to run this code.
# For the sysclone case, genesis doxcat uses the mac to find the nic.
if (isRedhat() && $args->{kernelparms} !~ m/ ksdevice=\S*:/ && $args->{kernelparms} !~ m/ netdevice=\S*:/) {
my @nics = grep(m/^\d+:\s+eth/, @output);
my $i = 0;
foreach my $line (@nics) {
@ -143,8 +169,8 @@ sub getNodeIpInfo {
if (defined($nictmp) && $nictmp eq $realnic) { $realnic = "eth$i"; last; } # got ip, we are done
$i++;
}
print "Determined that SLES/RHEL will call the install NIC $realnic (it has mac $mac)\n";
}
print "Determined that SLES will call the install NIC $realnic (it has mac $mac)\n";
# finally, find the gateway
my $gateway;

View File

@ -4,7 +4,7 @@
# even across vlans (w/o setting up pxe/dhcp broadcast relay). This assumes a working
# OS is on the node. This script is primarily meant to be used in the softlayer environment.
#todo: site attr for using static ip?
#todo: work with site.managedaddressmode=static for sles
use strict;
use Getopt::Long;
@ -19,12 +19,12 @@ my $NOAUTOINST;
my $usage = sub {
my $exitcode = shift @_;
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] <noderange>\n\n";
print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w <waittime>] [--noautoinst] <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";
print "OS is on the node, that you've run nodeset for these nodes, and that all of the nodes\n";
print "are using the same osimage.\n";
print "in this noderange are using the same osimage.\n";
}
exit $exitcode;
};
@ -48,7 +48,7 @@ updateGrubOnNodes($noderange, \%bootparms);
if ($DRYRUN) { exit(0); }
if ($bootparms{osimageprovmethod} eq 'install' && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
if ($bootparms{osimageprovmethod} eq 'install' && $bootparms{osimageosvers}=~ m/^sles/ && !$NOAUTOINST) { modifyAutoinstFiles($noderange, \%bootparms); }
if ($bootparms{osimageprovmethod} eq 'sysclone') { copySyscloneFiles(); }
@ -77,11 +77,20 @@ sub getBootParms {
$bootparms{kcmdline} =~ s|/install/autoinst/\S+|/install/autoinst/<nodename>|;
# 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;
@output = runcmd("lsdef -t osimage $bootparms{provmethod} -ci provmethod,osvers");
foreach my $line (@output) {
chomp($line);
if ($line =~ m/^Could not find/) { die "Error: provmethod $bootparms{provmethod} is set for the node, but there is no osimage definition by that name."; }
if ($line =~ m/ provmethod=/) {
my ($junk, $provmethod) = split(/=/, $line);
$bootparms{osimageprovmethod} = $provmethod;
}
if ($line =~ m/ osvers=/) {
my ($junk, $osvers) = split(/=/, $line);
$bootparms{osimageosvers} = $osvers;
}
}
#print "provmethod=$bootparms{osimageprovmethod}, osvers=$bootparms{osimageosvers}\n"; exit;
# get the mgmt node cluster-facing ip addr
@output = runcmd('lsdef -t site -ci master');

View File

@ -1,248 +0,0 @@
#!/usr/bin/perl
# xCAT postscript for configuring bonding of nics.
# Usage: configbond bond1 eth1 [eth3]
#
# Note: this postscript currently has some assumptions that are specific to the softlayer environment.
# 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>]'");
exit 1;
}
my $bond = shift(@ARGV);
my $nic = $ARGV[0];
my @devs;
foreach my $a (@ARGV) { push(@devs,split('@',$a)); } # support the new syntax in the xcat configbond postscript
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';
my $netmask ='';
my $ipaddr = '';
my $nic_num = '';
my $subnet = '';
my $nic_net = '';
my $net_name = '';
my @nic_nets = (); # array of networks for this nic
my @nic_ips =(); # array of ipaddresses for this nic
my @networks = (); # array of all networks from networks table.
# { network_name, subnet, netmask }
system("logger -t xcat -p local4.err 'configbond: Master: $bond'");
system("logger -t xcat -p local4.err 'configbond: Slaves: @devs'");
#system("logger -t xcat -p local4.err 'configbond: NIC: $nic'");
system("logger -t xcat -p local4.err 'configbond: NICNETWORKS: $nicnetworks'");
system("logger -t xcat -p local4.err 'configbond: NICIPS: $nicips'");
# Update modprobe
my $file = "/etc/modprobe.d/$bond.conf";
if (!open(FILE, ">$file")) { system("logger -t xcat -p local4.err 'configbond: cannot open $file.'"); exit 1; }
print FILE "alias $bond bonding\n";
# the bonding options are put in the ifcfg file instead
#print FILE "options $bond mode=balance-rr miimon=100\n";
close FILE;
# create array of network info. Needed in case where there are
# more than one ip address per nic and shouldn't be many networks.
my $net_info;
my $cnt = 1;
while ( $cnt <= $net_cnt ) {
$net_info = $ENV{"NETWORKS_LINE$cnt"};
$net_info =~ /^netname=([^\|]*)\|\|/;
$net_name = $1;
$net_info =~ /net=([^\|]*)\|\|/;
$subnet = $1;
$net_info =~ /mask=([^\|]*)\|\|/;
$netmask = $1;
push @{ $networks[$cnt-1] }, ($net_name, $subnet, $netmask);
$cnt +=1;
}
# get network or networks for this nic from NICNETWORKS:
# eth0:1_0_0_0-255_255_0_0|network2,eth1:1_1_0_0
# create array of networks for this nic
foreach my $nic_networks (split(/,/,$nicnetworks)) {
my @net = ();
if ( $nic_networks =~ /!/ ) {
@net = split(/!/,$nic_networks);
} else {
@net = split(/:/,$nic_networks);
}
if ($net[0] eq $nic) {
@nic_nets = split(/\|/,$net[1]);
last;
}
}
# get all nic ipaddress from $nicips: i.e. eth0:1.0.0.1|2.0.0.1,eth1:1.1.1.1
# Then get all ips for this specific nic, i.e. eth0.
foreach my $ips (split(/,/,$nicips)) {
my @ip = ();
if ( $ips =~ /!/ ) {
@ip = split(/!/,$ips);
} else {
@ip = split(/:/,$ips);
}
if ($ip[0] eq $nic ) {
@nic_ips = split(/\|/,$ip[1]);
}
}
my $i;
for ($i=0; $i < (scalar @nic_ips) ; $i++ ) {
# Time to create the interfaces.
# loop through the nic networks, find the matching networks to get the
# subnet and netmask and then create the appropriate ifcfg file for linux
my $specific_nic = $nic;
if ($i > 0) {
$specific_nic = $nic . ":" . ($i);
}
#todo: support case in which nicnetworks is not specified, find the correct network by calculation
$cnt = 0;
$subnet = "";
$netmask = "";
$net_name = "";
while ( $cnt < $net_cnt ) {
if ( $networks[$cnt][0] eq $nic_nets[$i] ) {
$subnet = $networks[$cnt][1];
$netmask = $networks[$cnt][2];
$cnt = $net_cnt; # found match - get out.
}
else {
$cnt++;
}
}
# check that there is a subnet and netmask set
if ( !(length($subnet) > 0) || !(length($netmask) > 0) ) {
system("logger -t xcat -p local4.err 'configbond: network subnet or netmask not set.'");
exit 1;
}
system("logger -t xcat -p local4.err 'configbond: network subnet and netmask: $subnet, $netmask'");
system("logger -t xcat -p local4.err 'configbond: $specific_nic, $nic_ips[$i]'");
# Write the master info to the ifcfg file
if (-d "/etc/sysconfig/network-scripts") {
# rhel/centos/fedora
my $dir = "/etc/sysconfig/network-scripts";
if (!open(FILE, ">$dir/ifcfg-$bond")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$bond.'"); exit 1; }
print FILE "DEVICE=$bond\n";
print FILE "BOOTPROTO=none\n";
print FILE "IPADDR=$nic_ips[$i]\n";
print FILE "NETMASK=$netmask\n";
print FILE "ONBOOT=yes\n";
print FILE "USERCTL=no\n";
print FILE qq(BONDING_OPTS="$bondingopts"\n);
close FILE;
# Configure slaves
my @output = `ip addr show 2>&1`; # to check for existance of the device later
foreach my $dev (@devs) {
# as a convenience, make sure the device exists before adding it to the bond
if (!grep(m/^\d+:\s+$dev:/, @output)) {
system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'");
unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning
next;
}
system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'");
if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; }
print FILE "DEVICE=$dev\n";
print FILE "BOOTPROTO=none\n";
print FILE "MASTER=$bond\n";
print FILE "ONBOOT=yes\n";
print FILE "SLAVE=yes\n";
print FILE "USERCTL=no\n";
close FILE;
}
}
elsif (-d "/etc/sysconfig/network") {
# sles
my $dir = "/etc/sysconfig/network";
if (!open(FILE, ">$dir/ifcfg-$bond")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$bond.'"); exit 1; }
print FILE "BOOTPROTO=static\n";
print FILE "BONDING_MASTER=yes\n";
print FILE "BONDING_MODULE_OPTS='$bondingopts'\n";
print FILE "NAME='Bonded Interface'\n";
print FILE "IPADDR=$nic_ips[$i]\n";
print FILE "NETMASK=$netmask\n";
print FILE "STARTMODE=onboot\n";
print FILE "USERCONTROL=no\n";
my $devnum = 0;
my @output = `ip addr show 2>&1`; # to check for existance of the device later
foreach my $dev (@devs) {
if (!grep(m/^\d+:\s+$dev:/, @output)) { next; }
print FILE "BONDING_SLAVE_$devnum=$dev\n";
$devnum++;
}
close FILE;
# Configure slaves
foreach my $dev (@devs) {
# as a convenience, make sure the device exists before adding it to the bond
if (!grep(m/^\d+:\s+$dev:/, @output)) {
system("logger -t xcat -p local4.err 'configbond: not configuring $dev because it does not exist.'");
unlink("$dir/ifcfg-$dev"); # in case it was left over in the image we are cloning
next;
}
system("logger -t xcat -p local4.err 'configbond: slave dev: $dev'");
if (!open(FILE, ">$dir/ifcfg-$dev")) { system("logger -t xcat -p local4.err 'configbond: cannot open $dir/ifcfg-$dev'"); exit 1; }
print FILE "BOOTPROTO=none\n";
print FILE "STARTMODE=hotplug\n";
close FILE;
}
}
else {
# do not recognize this distro
system("logger -t xcat -p local4.err 'configbond: network directory is not either the Red Hat or SuSE format.'");
exit 1;
}
# Apply the changes. Since we are only doing bond1 right now, lets not restart the whole network
# so we dont disrupt the installnic connection. Instead we just need to bring down the slave nics,
# and then bring up the bond nic.
#runcmd("service network restart");
foreach my $dev (@devs) {
runcmd("ifdown $dev");
}
runcmd("ifdown $bond"); # in case it was already up
runcmd("ifup $bond"); # note: this wont reload the bonding kernel module, so we are depending on the provisioning process to already have set the correct bonding options
system("logger -t xcat -p local4.info 'configbond: successfully configured $specific_nic.'");
}
exit 0;
sub runcmd {
my $cmd = shift @_;
$cmd .= ' 2>&1';
my @output = `$cmd`;
my $rc = $? >> 8;
if ($rc) {
system("logger -t xcat -p local4.err 'configeth: command $cmd failed with rc $rc: " . join('',@output) . "'");
my $errout= "configeth: command $cmd failed with rc $rc.";
`echo $errout`;
exit $rc;
}
}

View File

@ -1,28 +0,0 @@
#!/bin/bash
# set the default route of the node to the ip address and nic passed in
# this should be added to the postbootscripts, NOT postscripts
gateway="$1"
nic="$2"
# set it temporarily
echo "ip route replace to default via $gateway dev $nic"
ip route replace to default via $gateway dev $nic
# set it permanently
#todo: this is only for sles right now
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
# While we are here, clean up the network wait hack, if it is still there.
# (It was added during scripted install, because autoyast will not use the bond
# configuration for 1 part of the process.) Do not know a better place to clean
# this up.
sed -i '/Waiting to reach xCAT mgmt node/d' /etc/init.d/network

View File

@ -48,7 +48,7 @@ xCAT-SoftLayer provides Utilities to make xCAT work in a SoftLayer environment.
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/install
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
#mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-SoftLayer
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1
@ -59,8 +59,8 @@ cp -p -R share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin
chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
cp -d postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts/*
#cp -d postscripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts
#chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/postscripts/*
cp -d si-post-install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/sysclone/post-install/*
@ -84,9 +84,3 @@ rm -rf $RPM_BUILD_ROOT
%post
# We are shipping the postscripts in a sysclone dir and then copying them to /install/postscripts here,
# because we want to allow base xcat to eventually ship them and not conflict on the file name/path
# But base xcat now has a newer/better configbond written in bash, so if that is there do not overwrite it.
head /install/postscripts/configbond | grep -q -E '^#! */bin/bash'
if [[ $? != 0 ]]; then
# the new configbond from xcat 2.8.5 is not there, so copy ours
cp -f /%{prefix}/share/xcat/sysclone/postscripts/* /install/postscripts
fi

View File

@ -101,15 +101,13 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/webportal
# Inspect whether PHP related RPM packages are installed
%ifos linux
if [ -e "/etc/redhat-release" ]; then
rpm -q php >/dev/null
if [ $? != 0 ]; then
if [ ! -e "/etc/httpd/conf.d/php.conf" ]; then
echo ""
echo "Error! php has not been installed. Please run 'yum install php' before installing xCAT-UI.";
exit -1;
fi
else # SUSE
rpm -q apache2-mod_php5 php5 >/dev/null
if [ $? != 0 ]; then
if [ ! -e "/etc/apache2/conf.d/php5.conf" ]; then
echo ""
echo "Error! apache2-mod_php5 and php5 have not been installed. Please run 'zypper install apache2-mod_php5 php5' before installing xCAT-UI."
exit -1;

View File

@ -764,20 +764,21 @@ sub kit_buildrepo1
}
}
# Build kitcomponent metapackages
# Build kitcomponent preppackages and metapackages
if ( $debianflag ){
foreach my $kc (@{$::bldkit_config->{kitcomponent}{entries}}) {
if ($repoid ne $kc->{kitrepoid}) { next; }
my $debname = "$repodir/".&comppkgname($kc);
if (-r $debname) { next; }
if ($::VERBOSE) { print "building kitcomponent metapackage for $kc->{basename} \n";}
if ($::VERBOSE) { print "building kitcomponent package for $kc->{basename} \n";}
if (&build_kitcomp_debian($kc)) {
print "Error building kitcomponent metapackage for $kc->{basename} \n";
return 1;
}
}
if ( system("dpkg-scanpackages $repodir > $repodir/Packages") ) {
print "Error building the repository meta-data with the dpkg-scanpackages command \n";
if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) {
print "Error building the repository meta-data with the dpkg-scanpackages command \n";
return 1;
}
}
@ -1145,8 +1146,16 @@ sub edit_bldkitconf
my ($osbasename,$osmore) = split(/\,/, $osinfo);
my ($osmajorversion,$osminorversion) = split(/\./, $osmore);
my $osarch=`uname -p`;
my $kitcomponent_basename = $kitname."_compute";
if ($debianflag==1) {
if($osarch == "ppc64le"){
$osarch="ppc64el";
}
$kitcomponent_basename = $kitname."-compute";
}
for (@lines) {
s/<<<INSERT_kitbasename_HERE>>>/$kitname/;
s/<<<INSERT_kitrepoid_HERE>>>/$kitrepoid/;
@ -1865,6 +1874,12 @@ sub validate_os
my ($osmajorversion,$osminorversion) = split(/\./, $osmore);
my $osarch=`uname -p`;
chomp($osarch);
if ($debianflag==1) {
if($osarch == "ppc64le"){
$osarch="ppc64el";
}
}
$osinfo =~ s/\,//;
my $repo_osinfo = "$repo->{osbasename}$repo->{osmajorversion}";
if (defined($repo->{osminorversion})){
@ -2407,14 +2422,45 @@ sub build_kitcomp_debian{
}
}
#run the dpkg-buildpackage command
my $curdir = $::workdir;
my $cmd = "rm -Rf $debbuilddir";
system($cmd);
mkpath($debbuilddir);
#Create debian directory for this kit component
if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; }
$::VALID_PREP_COMPONENT = 0;
if ( !$::PREREQUISITE ) {
if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) {
#Create debian directory for this kit component preppackage
if ( &gen_kitcomp_debdir_prep($comp,\%repo) ) { return 1; }
$::VALID_PREP_COMPONENT = 1;
# build prep deb
my $prep_compversion = $comp->{version} . "-" . $comp->{release};
my $prep_buildstring = "Prep Kit component build package.";
my $prep_debbuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname};
my $prep_debianbuildcmd = "cd $prep_debbuilddir;dch -v $prep_compversion -b -c debian/changelog $prep_buildstring;dpkg-buildpackage -uc -us";
if ( system($prep_debianbuildcmd) ) {
print "Error running \"dpkg-buildpackage -uc -us\" command for kit component prep-$comp->{kitcompname} meta package\n";
return 1;
}
}
#Create debian directory for this kit component metapackage
if ( &gen_kitcomp_debdir($comp,\%repo,'METADEB') ) { return 1; }
} else {
#Create debian directory for this kit component
if ( &gen_kitcomp_debdir($comp,\%repo,'ALL') ) { return 1; }
}
if (defined($comp->{non_native_pkgs}) ) {
my $sourcedir = $::workdir."/source_packages";
@ -2456,6 +2502,99 @@ sub build_kitcomp_debian{
return 0;
}
#-----------------------------------------------------------------------------
=head3 gen_kitcomp_debdir_prep
=cut
#-----------------------------------------------------------------------------
sub gen_kitcomp_debdir_prep{
my $comp = shift;
my $repo = shift;
my $scriptdir = $::workdir."/scripts/";
my $combuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname};
#copy the debian dir template to the build path
mkpath("$combuilddir/debian");
my $cmd = "cp -Rf " . $::XCATSHARE . "/kits/debian_template/* $combuilddir/debian/";
system($cmd);
my $kitname = $::bldkit_config->{kit}{entries}[0]->{basename};
my $kitcompname = "prep-".$comp->{kitcompname};
my $upgradeflag = "pre-".$comp->{basename} . ".tmp";
my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript,$nonnativepkgs) = '';
if (defined($comp->{preinstall})) {
$prescript = &load_script("$scriptdir$comp->{preinstall}");
}
if (defined($comp->{preupgrade})) {
$preupscript = &load_script("$scriptdir$comp->{preupgrade}");
}
if (defined($comp->{preuninstall})) {
$preunscript = &load_script("$scriptdir$comp->{preuninstall}");
}
#replace all special sub string in all files under debian
unless (opendir(DH, "${combuilddir}/debian/")){
print "Can not open the xCAT Kit Component debian dir: ${combuilddir}/debian/";
return 1;
}
foreach (readdir(DH)){
my $file = "${combuilddir}/debian/$_";
if ( -d $file){
next;
}
unless ( open ( FH, "<", $file )){
print "Error attempting to open the xCAT Kit Component ${kitcompname}'s debian template file $file.\n";
close(DH);
return 1;
}
if ($::VERBOSE){
print "Reading the xCAT Kit Component ${kitcompname}'s debian template file $file. \n";
}
my @lines = <FH>;
close(FH);
my $prep_comp_name="prep-".$comp->{basename};
for(@lines) {
chomp;
s/<<<INSERT_kitcomponent_basename_HERE>>>/$prep_comp_name/;
s/<<<INSERT_kitcomponent_ospkgdeps_HERE>>>/$comp->{ospkgdeps}/;
s/<<<INSERT_kitcomponent_kitpkgdeps_HERE>>>//;
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>//;
s/<<<INSERT_kitcomponent_desc_HERE>>>/$comp->{description}/;
s/<<<INSERT_kitcomponent_upgrade_flag_HERE>>>/$upgradeflag/;
s/<<<INSERT_kitcomponent_preinstall_script_HERE>>>/$prescript/;
s/<<<INSERT_kitcomponent_postinstall_script_HERE>>>//;
s/<<<INSERT_kitcomponent_preupgrade_script_HERE>>>/$preupscript/;
s/<<<INSERT_kitcomponent_postupgrade_script_HERE>>>//;
s/<<<INSERT_kitcomponent_preuninstall_script_HERE>>>/$preunscript/;
s/<<<INSERT_kitcomponent_postuninstall_script_HERE>>>//;
}
my $joined_lines = join("\n", @lines);
@lines = split(/\\n/,$joined_lines);
open (FH, ">", $file);
if ($::VERBOSE){
print "Created kitcomponent ${kitcompname}'s build file under debian dir $file";
}
print FH @lines;
close(FH);
}
closedir(DH);
return 0;
}
#-----------------------------------------------------------------------------
=head3 gen_kitcomp_debdir
@ -2468,6 +2607,7 @@ sub build_kitcomp_debian{
sub gen_kitcomp_debdir{
my $comp = shift;
my $repo = shift;
my $level = shift;
my $scriptdir = $::workdir."/scripts/";
my $combuilddir = $::workdir."/debbuild/".$comp->{kitcompname};
@ -2481,29 +2621,38 @@ sub gen_kitcomp_debdir{
my $upgradeflag = $comp->{basename} . ".tmp";
my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript,$nonnativepkgs) = '';
if (defined($comp->{preinstall})) {
$prescript = &load_script("$scriptdir$comp->{preinstall}");
}
if (defined($comp->{postinstall})) {
$postscript = &load_script("$scriptdir$comp->{postinstall}");
}
if (defined($comp->{preupgrade})) {
$preupscript = &load_script("$scriptdir$comp->{preupgrade}");
}
if (defined($comp->{postupgrade})) {
$postupscript = &load_script("$scriptdir$comp->{postupgrade}");
}
if (defined($comp->{preuninstall})) {
$preunscript = &load_script("$scriptdir$comp->{preuninstall}");
}
if (defined($comp->{postuninstall})) {
$postunscript = &load_script("$scriptdir$comp->{postuninstall}");
}
if (defined($comp->{non_native_pkgs})) {
$nonnativepkgs = "\n";
$nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
$nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
if ($level eq 'METADEB' || $level eq 'ALL')
{
if (defined($comp->{postinstall})) {
$postscript = &load_script("$scriptdir$comp->{postinstall}");
}
if (defined($comp->{postupgrade})) {
$postupscript = &load_script("$scriptdir$comp->{postupgrade}");
}
if (defined($comp->{postuninstall})) {
$postunscript = &load_script("$scriptdir$comp->{postuninstall}");
}
if (defined($comp->{non_native_pkgs})) {
$nonnativepkgs = "\n";
$nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
$nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n";
}
}
if ($level eq 'ALL')
{
if (defined($comp->{preinstall})) {
$prescript = &load_script("$scriptdir$comp->{preinstall}");
}
if (defined($comp->{preupgrade})) {
$preupscript = &load_script("$scriptdir$comp->{preupgrade}");
}
if (defined($comp->{preuninstall})) {
$preunscript = &load_script("$scriptdir$comp->{preuninstall}");
}
}
#replace all special sub string in all files under debian
unless (opendir(DH, "${combuilddir}/debian/")){
@ -2528,12 +2677,20 @@ sub gen_kitcomp_debdir{
}
my @lines = <FH>;
close(FH);
my $prepcomp="prep-".$comp->{basename};
for(@lines) {
chomp;
s/<<<INSERT_kitcomponent_basename_HERE>>>/$comp->{basename}/;
s/<<<INSERT_kitcomponent_ospkgdeps_HERE>>>/$comp->{ospkgdeps}/;
s/<<<INSERT_kitcomponent_kitpkgdeps_HERE>>>/$comp->{kitpkgdeps}/;
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps}/;
if ( $::VALID_PREP_COMPONENT ) {
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps},$prepcomp/;
}
else
{
s/<<<INSERT_kitcomponent_kitcompdeps_HERE>>>/$comp->{kitcompdeps}/;
}
s/<<<INSERT_kitcomponent_desc_HERE>>>/$comp->{description}/;
s/<<<INSERT_kitcomponent_upgrade_flag_HERE>>>/$upgradeflag/;
s/<<<INSERT_kitcomponent_preinstall_script_HERE>>>/$prescript/;
@ -3587,9 +3744,13 @@ sub NEW_kit_addpkgs
if ($kp->{isexternalpkg} eq 'yes') {
my $ext_filename = $kp->{filename};
my $ext_reponames = $kp->{kitreponame};
my $files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename);
my $files;
if($debianflag){
$files = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirlist, $ext_filename);
}
else {
$files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename);
}
if (!defined($files) ) {
print "Error: The product package file $ext_filename was not found in the package directory(s) @pkgdirlist.\n";
# Cleanup

View File

@ -134,6 +134,87 @@ sub get_latest_version
}
}
#--------------------------------------------------------------------------
=head3 get_latest_version_deb
Find the latest version in a list of debs with the same basename
Arguments:
- the repo location
- a list of debs with the same basename
Returns:
- name of deb
- undef
Example:
my $new_d = xCAT::BuildKitUtils->get_latest_version($repodir, \@rpmlist);
Comments:
=cut
#--------------------------------------------------------------------------
sub get_latest_version_deb
{
my ($class, $repodir, $debs) = @_;
my @deblist = @$debs;
my %localversions_hash = ();
my $file_name;
my %founddeb;
my $latest;
my $i = 0;
foreach my $deb (@deblist)
{
# include path
my $fulldebpath = "$repodir/$deb*";
chomp $deb;
# get the basename, version, and release for this deb
print "dpkg -I $repodir/$deb |grep Package|awk '{print \$2}'";
my $basenamedeb = `dpkg -I $repodir/$deb |grep Package|awk '{print \$2}'`;
chomp $basenamedeb;
my $versiondeb = `dpkg -I $repodir/$deb |grep Version|awk '{print \$2}'`;
chomp $versiondeb;
$founddeb{$basenamedeb}{$deb}{version}=$versiondeb;
$i++;
}
if ($i == 0)
{
print "error\n";
return undef;
}
foreach my $r (keys %founddeb ) {
# if more than one with same basename then find the latest
my $latestmatch="";
foreach my $fdeb (keys %{$founddeb{$r}} ) {
# if we already found a match in some other dir
if ($latestmatch) {
# then we need to figure out which is the newest
# if the $fdeb is newer than use iti
if ( ! xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, 'gt', $founddeb{$r}{$latestmatch}{version}) ) {
$latestmatch = $fdeb;
}
} else {
$latestmatch = $fdeb;
}
}
$latest=$latestmatch;
}
if ($i == 0)
{
print "Error: Could not determine the latest version for the following list of debs: @deblist\n";
return undef;
} else {
return ($latest);
}
}
#--------------------------------------------------------------------------
=head3 find_latest_pkg
@ -160,6 +241,7 @@ sub find_latest_pkg
my @rpms;
my %foundrpm;
# need to check each pkgdir for the rpm(s)
# - if more than one match need to pick latest
# find all the matches in all the directories
@ -223,6 +305,128 @@ sub find_latest_pkg
}
}
#--------------------------------------------------------------------------
=head3 find_latest_pkg_deb
Find the latest deb package give the deb name and a list of
possible package locations.
Arguments:
- a list of package directories
- the name of the deb
Returns:
- \@founddeblist
- undef
Example:
my $newrpm = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirs, $debname);
Comments:
=cut
#--------------------------------------------------------------------------
sub find_latest_pkg_deb
{
my ($class, $pkgdirs, $debname) = @_;
my @pkgdirlist = @$pkgdirs;
my @debs;
my %founddeb;
# need to check each pkgdir for the deb(s)
# - if more than one match need to pick latest
# find all the matches in all the directories
foreach my $debdir (@pkgdirlist) {
my $ffile = $debdir."/".$debname;
if ( system("/bin/ls $ffile > /dev/null 2>&1") ){
# if not then skip to next dir
next;
} else {
# if so then get the details and add it to the %founddeb hash
my $cmd = "/bin/ls $ffile 2>/dev/null";
my $output = `$cmd`;
my @deblist = split(/\n/, $output);
if ( scalar(@deblist) == 0) {
next;
}
foreach my $r (@deblist) {
my $basename = `dpkg -I $r* |grep Package|awk '{print \$2}'`;
chomp $basename;
my $version = `dpkg -I $r* |grep Version|awk '{print \$2}'`;
chomp $version;
$founddeb{$basename}{$r}{version}=$version;
}
}
}
# for each unique deb basename
foreach my $r (keys %founddeb ) {
# if more than one with same basename then find the latest
my $latestmatch="";
foreach my $fdeb (keys %{$founddeb{$r}} ) {
# if we already found a match in some other dir
if ($latestmatch) {
# then we need to figure out which is the newest
# if the $fdeb is newer than use it
if ( ! xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, 'gt', $founddeb{$r}{$latestmatch}{version}) ) {
$latestmatch = $fdeb;
}
} else {
$latestmatch = $fdeb;
}
}
push(@debs, $latestmatch);
}
if (scalar(@debs)) {
return \@debs;
} else {
return undef;
}
}
#------------------------------------------------------------------------------
=head3 testVersion_deb
Compare version1 and version2 according to the operator and
return 1 0 or 0.
Arguments:
$version1
$operator
$version2
Returns:
1 or 0
Example:
Comments:
The return value is generated with the Require query
=cut
#-----------------------------------------------------------------------------
sub testVersion_deb
{
my ($class, $version1, $operator, $version2) = @_;
if ($::VERBOSE) {
print "dpkg --compare-versions $version1 $operator $version2 \n";
}
my $result =`dpkg --compare-versions $version1 $operator $version2`;
return $result;
}
#------------------------------------------------------------------------------

View File

@ -21,7 +21,7 @@ set -e
case "$1" in
configure)
<<<INSERT_kitcomponent_postinstall_script_HERE>>>
if [ -f /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>> ]
if [ -f /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>> ]; then
<<<INSERT_kitcomponent_postupgrade_script_HERE>>>
rm /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>>
fi

View File

@ -20,7 +20,7 @@ case "$1" in
;;
upgrade)
if [ -f /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>> ]
if [ -f /tmp/<<<INSERT_kitcomponent_upgrade_flag_HERE>>> ]; then
<<<INSERT_kitcomponent_preupgrade_script_HERE>>>
fi
;;

View File

@ -1,191 +1,397 @@
#!/usr/bin/perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
# Downloads/converts the xCAT docs on the sourceforge wiki to local HTML and PDF.
# Downloads/converts the xCAT docs on the sourceforge Allura wiki to local HTML and PDF.
# This script is not dependent on other xCAT code, so you can copy it to a machine
# that has internet access to run it. Before running this command, you must have
# wget, python, and pisa installed. See: http://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documentation_Pages#Converting_Wiki_Pages_to_HTML_and_PDFs .
# curl, pandoc, and latex installed. See: http://sourceforge.net/p/xcat/wiki/Editing_and_Downloading_xCAT_Documentation/#converting-wiki-pages-to-html-and-pdfs
# Note: do not use the --upload option, unless your machine has authority to write to http://xcat.sourceforge.net/doc/ .
# You also need to set $UPLOADUSER to your sourceforge user.
# You also need to set $UPLOADUSER to your sourceforge user:
my $UPLOADUSER = 'bp-sawyers';
#BEGIN
#{
# $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr';
#}
use strict;
#use lib "$::XCATROOT/lib/perl";
#use xCAT::Utils;
use Getopt::Long;
#use File::Path;
use Cwd;
#use Data::Dumper;
use JSON;
use List::Util qw[max];
# URL for the xCAT Allura wiki API markdown on SourceForge
my $SF_URL='http://sourceforge.net/rest';
my $WIKI_URL=$SF_URL.'/p/xcat/wiki/';
# Update this list if you group any xcat docs on a separate page such that they
# are no longer linked from the main doc page:
my @INDEXDOCS = ('XCAT_Documentation',
'Power_775_Cluster_Documentation',
'Highly_Available_Management_Node',
'Mixed_Cluster_Support',
'IBM_HPC_Stack_in_an_xCAT_Cluster');
# Update this list if you group any xcat docs on a separate page such that they are no longer linked from the
# main doc page.
my @indexdocs = ('XCAT_Documentation', 'Power_775_Cluster_Documentation', 'Highly_Available_Management_Node', 'Mixed_Cluster_Support', 'IBM_HPC_Stack_in_an_xCAT_Cluster');
#my $VERSION;
my $HELP;
my $UPLOAD;
my $UPLOADONLY;
my $IGNOREERRORS;
my $CONTINUE;
my $SINGLE_DOC;
my $VERBOSE;
my $usage = sub {
my $exitcode = shift @_;
print "Usage: getxcatdocs [-?|-h|--help] [-v|--verbose] [-u|--upload] [--uploadonly] [<destination-dir>]\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, 'u|upload' => \$UPLOAD, 'uploadonly' => \$UPLOADONLY )) { $usage->(1); }
if ($HELP) { $usage->(0); }
#if ($VERSION) {
#print xCAT::Utils->Version(), "\n";
# exit;
#}
if ($^O =~ /^aix/i) { die "Error: this command is not yet supported on AIX.\n"; }
my $destdir = scalar(@ARGV) ? $ARGV[0] : '.';
chdir($destdir) or die "Can not cd to $destdir: $!\n";
#my $docdir = $ENV{'PWD'};
# Download the HTML docs and convert them all to pdfs
my @dir;
if (!$UPLOADONLY) {
@dir = gethtmldocs('html');
convert2pdf('pdf', \@dir);
}
# tar/compress
my $date=`date +%Y%m%d%H%M`;
chop $date;
my $docname="xcat-docs-snap$date.tar.gz";
#system('pwd');
my $cmd = "tar -zcf $docname html pdf 2>&1";
verbose($cmd);
system($cmd) == 0 or die "Error running $cmd: $!, rc=$?";
# Optionally upload the tarball to sourceforge
if ($UPLOAD || $UPLOADONLY) {
my $UPLOADUSER = 'bp-sawyers';
my $count = 1;
#my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:htdocs/doc/';
my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/doc/';
print "$cmd\n";
while ($count<=5 && system("$cmd 2>&1")) { $count++; }
}
exit 0;
my $MDDIR;
my $HTMLDIR;
my $PDFDIR;
my $IMAGEDIR;
my %LOADEDDOCS;
sub verbose { if ($VERBOSE) { print shift, "\n"; } }
my $usage = sub {
my $exitcode = shift @_;
print "Usage: getxcatdocs [-?|-h|--help] \n";
print "Usage: getxcatdocs [-v|--verbose] [-u|--upload] [--uploadonly] [-U|--uploaduser sourceforge_id] [-i|--ignoreerrors] [<destination-dir>]\n";
print "Usage: getxcatdocs [-v|--verbose] [-c|--continue] [-d|--doc single_doc] [-i|--ignoreerrors] [<destination-dir>]\n";
exit $exitcode;
};
# Main processing
# 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,
'u|upload' => \$UPLOAD,
'uploadonly' => \$UPLOADONLY,
'uploaduser' => \$UPLOADUSER,
'c|continue' => \$CONTINUE,
'i|ignoreerrors' => \$IGNOREERRORS,
'd|doc=s' => \$SINGLE_DOC ))
{ $usage->(1); }
if ($HELP) { $usage->(0); }
if ($^O =~ /^aix/i) { die "Error: this command is not yet supported on AIX.\n"; }
my $DESTDIR = scalar(@ARGV) ? $ARGV[0] : '.';
chdir($DESTDIR) or die "Can not cd to $DESTDIR: $!\n";
my $json = JSON->new();
if ($SINGLE_DOC) {
$MDDIR = '.';
$HTMLDIR = '.';
$PDFDIR = '.';
$IMAGEDIR = '.';
download_doc($SINGLE_DOC);
convert_doc($SINGLE_DOC);
exit;
}
# Download the HTML docs and convert them all to pdfs
if (!$UPLOADONLY) { gethtmldocs(); }
# tar/compress
my $date=`date +%Y%m%d%H%M`;
chop $date;
my $docname="xcat-docs-snap$date.tar.gz";
my $cmd = "tar -zcf $docname html pdf images 2>&1";
verbose($cmd);
system($cmd) == 0 or die "Error running $cmd: $!, rc=$?";
# Optionally upload the tarball to sourceforge
if ($UPLOAD || $UPLOADONLY) {
my $count = 1;
#my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:htdocs/doc/';
my $cmd = "rsync -v $docname $UPLOADUSER," . 'xcat@web.sourceforge.net:/home/frs/project/x/xc/xcat/doc/';
print "$cmd\n";
while ($count<=5 && system("$cmd 2>&1")) { $count++; }
}
exit 0;
# Download all of the html docs from several "index" docs
sub gethtmldocs {
my $dir = shift;
my $savedir = getcwd();
#File::Path::make_path($dir);
mkdir($dir);
chdir($dir);
#system('pwd');
unlink <*>; # delete all the files in the dir, in case they previously ran this
#system('ls');
my $indexes = '';
foreach my $index (@indexdocs) {
$indexes .= qq('http://sourceforge.net/apps/mediawiki/xcat/index.php?title=$index&printable=yes' );
}
print "Downloading the xCAT wiki documentation to $dir, from: $indexes ...\n";
runwget($indexes);
# Remove the funny chars from the links to other docs and rename the docs
#my $sedcmd = q(sed -i 's/<a href="\/apps\/mediawiki\/xcat\/index.php?title/<a href="index.php%3Ftitle/' *);
# sed -i 's/href="index.php%3Ftitle=/href="/g' index.php\?title\=
# sed -i 's/<a href="\([^"]*\)"/<a href="\1.html"/'
# This searches for '<a href="index.php?title=' and then all text before a '"' or '#', and then removes the front part and add .html on the end
# Note: this does not convert the 'MediaWiki:*' files because they are used in <link> tags, but converting them does not seem to do any good anyway.
my $cmd = q(sed -i 's/<a href="index.php?title=\\([^"#]*\\)\\("\|#\\)/<a href="\1.html\2/g' *);
verbose($cmd);
system($cmd) == 0 or die "Error running $cmd: $!, rc=$?";
# get the list of docs
opendir(DIR, '.') or die "Error: could not read the just created html directory.\n";
#my @docs = grep /^index.php\?title=/, readdir(DIR); # /
my @docs;
foreach my $f (readdir(DIR)) {
if ($f !~ /^index.php\?title=/ || $f =~ /^index.php\?title=MediaWiki:/) { next; }
my $newf = $f;
$newf =~ s/^index.php\?title=//;
if ($newf !~ /\./) { $newf .= '.html'; }
verbose("Renaming $f to $newf");
rename($f, $newf);
push @docs, $newf;
}
close(DIR);
chdir($savedir);
return @docs;
$MDDIR = 'md';
$HTMLDIR = 'html';
$PDFDIR = 'pdf';
$IMAGEDIR = 'images';
mkdir($MDDIR);
mkdir($HTMLDIR);
mkdir($PDFDIR);
mkdir($IMAGEDIR);
#delete all the files in the dirs in case they previously ran this
if ($CONTINUE) {
print "CONTINUING with files already in $MDDIR";
my @mdfiles = glob "$MDDIR/*.md";
foreach my $mdf (@mdfiles) {
$mdf =~ s/^$MDDIR\///;
$mdf =~ s/\.md//;
$LOADEDDOCS{$mdf}=1;
}
} else {
unlink <$MDDIR/*>;
unlink <$HTMLDIR/*>;
unlink <$PDFDIR/*>;
unlink <$IMAGEDIR/*>;
}
print "\nDownloading and converting the xCAT wiki document list from $WIKI_URL ...\n";
foreach my $index (@INDEXDOCS) {
my @related_docs = download_doc($index);
foreach my $docref (@related_docs) {
my $docref_name = $docref;
$docref_name =~ s/\/.*\/(.+)\/$/$1/;
download_doc($docref_name);
}
}
foreach my $doc (keys %LOADEDDOCS) {
convert_doc($doc);
}
return;
}
# Convert to pdf
sub convert2pdf {
my ($dir, $files) = @_;
my $savedir = getcwd();
#File::Path::make_path($dir);
mkdir($dir);
chdir($dir);
if (system('which xhtml2pdf >/dev/null 2>&1')) { die "xhtml2pdf is not installed. See http://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documentation_Pages#Converting_Wiki_Pages_to_HTML_and_PDFs .\n"; }
unlink <*>; # delete all the files in the dir, in case they previously ran this
foreach my $file (@$files) {
#if ($file =~ /^index.php\?title=MediaWiki:/ || $file eq 'index.php?title=XCAT_Documentation') { next; }
if ($file eq 'XCAT_Documentation') { next; }
#my ($docname) = $file =~ /^index.php\?title=(.+)$/;
$file =~ s/\.html$//;
print "Converting $file to PDF format...\n";
my $url = 'http://sourceforge.net/apps/mediawiki/xcat/index.php?title=' . $file . '&printable=yes';
my $destfile = "$file.pdf";
my $cmd = "xhtml2pdf '$url' '$destfile' ";
runh2p($cmd);
}
chdir($savedir);
sub download_doc {
my $doc_name = shift;
if ( $LOADEDDOCS{$doc_name} ) { return; }
verbose("processing $doc_name");
$LOADEDDOCS{$doc_name}=1;
my $curlcmd = "curl --retry 5 -X GET $WIKI_URL/$doc_name";
verbose($curlcmd);
my $docjson = `$curlcmd`;
if ($? && !$IGNOREERRORS) { die "error encountered in $curlcmd \n";}
my $jsout = $json->decode($docjson);
foreach my $att (@{$jsout->{attachments}}) {
my $wgetcmd = "wget -P $IMAGEDIR/ $att->{url}";
verbose($wgetcmd);
system($wgetcmd);
if ($? && !$IGNOREERRORS) { die "error encountered in $wgetcmd \n";}
}
open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md";
print MDFILE $jsout->{text};
close MDFILE;
return @{$jsout->{related_artifacts}};
}
sub convert_doc {
my $doc_name = shift;
open(MDFILE, "<$MDDIR/${doc_name}.md") or die "Could not open <$MDDIR/${doc_name}.md";
my @doc_lines = <MDFILE>;
close MDFILE;
my $doc_text = join('',@doc_lines);
$doc_text = process_includes($doc_text,0);
if ($doc_text =~ /begin_xcat_table/) {
open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md";
print MDFILE $doc_text;
close MDFILE;
convert_tables($doc_name);
open(MDFILE, "<$MDDIR/${doc_name}.md") or die "Could not open <$MDDIR/${doc_name}.md";
@doc_lines = <MDFILE>;
close MDFILE;
$doc_text = join('',@doc_lines);
}
## Make image refs local
$doc_text =~ s/\!\[\]\(.+\/(.+)\.png\)/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.png\)/g;
$doc_text =~ s/\!\[\]\(.+\/(.+)\.PNG\)/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.PNG\)/g;
$doc_text =~ s/\!\[\]\(.+\/(.+)\.jpg\)/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.jpg\)/g;
$doc_text =~ s/\[img src=(.+)\.png\]/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.png\)/g;
$doc_text =~ s/\[img src=(.+)\.PNG\]/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.PNG\)/g;
$doc_text =~ s/\[img src=(.+)\.jpg\]/\!\[\]\(\.\.\/$IMAGEDIR\/$1\.jpg\)/g;
## Remove [TOC] entries
$doc_text =~ s/\[TOC\]//g;
open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md";
print MDFILE $doc_text;
close MDFILE;
my $pandoccmd = "pandoc -s --toc $MDDIR/${doc_name}.md -o $HTMLDIR/${doc_name}.html";
verbose($pandoccmd);
system($pandoccmd);
if ($? && !$IGNOREERRORS) { die "error encountered in $pandoccmd \n";}
# This rename is probably a hack, but I didn't want to take the time to
# figure out what was going on:
# pandoc does different processing if target filetype is html
# but all internal refs only work in browser when there is no html filetype
rename "$HTMLDIR/${doc_name}.html","$HTMLDIR/${doc_name}";
$doc_text =~ s/\!\[\]\(\.\.\/$IMAGEDIR\/(.+)\.png\)/\!\[\]\(\.\/$IMAGEDIR\/$1\.png\)/g;
$doc_text =~ s/\!\[\]\(\.\.\/$IMAGEDIR\/(.+)\.PNG\)/\!\[\]\(\.\/$IMAGEDIR\/$1\.PNG\)/g;
$doc_text =~ s/\!\[\]\(\.\.\/$IMAGEDIR\/(.+)\.jpg\)/\!\[\]\(\.\/$IMAGEDIR\/$1\.jpg\)/g;
open(MDFILE, ">$MDDIR/${doc_name}.md") or die "Could not open >$MDDIR/${doc_name}.md";
print MDFILE $doc_text;
close MDFILE;
my $pandoccmd2 = "pandoc --toc $MDDIR/${doc_name}.md -o $PDFDIR/${doc_name}.pdf";
verbose($pandoccmd2);
system($pandoccmd2);
if ($? && !$IGNOREERRORS) { die "error encountered in $pandoccmd2 \n";}
}
# Run the wget cmd and filter out some of the silly output
sub runwget {
my $index = shift;
# options we might consider: --html-extension --restrict-file-names=windows --cut-dirs=3
# options that do not work: --relative
#my $rejectlist = q('*title=Special:*,*title=Talk:*,*title=-&*,*title=HowTos,*title=Main_Page,*title=MediaWiki:*,*title=Release_Notes,*title=Wish_List_for_xCAT_2,*&action=edit*,*&action=history*,*&printable=yes*,*&oldid=*,index.html,opensearch_desc.php,xcat,login.php,support');
my $rejectlist = q('*title=Special:*,*title=Talk:*,*title=-&*,*title=HowTos,*title=Main_Page,*title=Release_Notes,*title=Wish_List_for_xCAT_2,*&action=edit*,*&action=history*,*&printable=yes*,*&oldid=*,index.html,opensearch_desc.php,xcat,login.php,support');
my $cmd = qq(wget --recursive --convert-links --no-verbose --progress=bar --level=1 --page-requisites --no-parent --no-host-directories --no-directories --no-clobber --execute robots=off --post-data='printable=yes' --reject $rejectlist $index);
verbose($cmd);
open(OUT, "$cmd 2>&1 |") || die "can't fork $cmd: $!\n";
while (<OUT>) {
if (/URL:https*:\/\/sourceforge\.net.+\s+->\s+\"(\S+)\"\s+\[/) { print "Downloaded $1.\n"; }
else { print; }
}
close OUT || print "Error running $cmd: $! $?\n";
sub process_includes {
my $doc_text = shift;
my $include_nest = shift;
if ($include_nest++ > 10) { die "nested include processing greater than 10. Infinite recursion???"; }
while (1) {
if ($doc_text =~ /\[\[(\s*)include (\s*)ref=(\s*)(.+)(\s*)\]\]/) {
my $next_include = $4;
download_doc($next_include);
open(INCLDFILE, "<$MDDIR/${next_include}.md") or die "Could not open <$MDDIR/${next_include}.md";
my @include_lines = <INCLDFILE>;
close INCLDFILE;
# my $include_text = join('\n', @include_lines);
my $include_text = join('', @include_lines);
$include_text = process_includes($include_text,$include_nest);
$doc_text =~ s/\[\[(\s*)include (\s*)ref=(\s*)$next_include(\s*)\]\]/$include_text/g;
} else {
last;
}
}
return $doc_text;
}
# Run the xhtml2pdf cmd and filter out some of the silly output
sub runh2p {
my $cmd = shift;
verbose($cmd);
open(OUT, "$cmd 2>&1 |") || die "can't fork $cmd: $!\n";
while (<OUT>) {
next if /DeprecationWarning:\sthe sets module is deprecated/;
next if /from sets import ImmutableSet/;
next if /^\s*import sets\s*$/;
next if /^Converting\ssourceforge.net/;
print;
}
close OUT || print "Error running $cmd: $! $?\n";
sub convert_tables {
my $doc_name=shift;
my $infile="$MDDIR/${doc_name}.md";
my $outfile=$infile;
open(MDFILE, "<$infile") or die "Could not open <$infile";
my @inlines=<MDFILE>;
close MDFILE;
my @outlines;
my @tablines;
my $in_comment=0;
my $xcat_table=0;
my $numcols=1;
my @colwidths=(0);
my $tabcount=0;
verbose("converting tables in $doc_name");
foreach my $line (@inlines) {
if ($line =~ /\<\!---/) { $in_comment=1; next; }
if ($in_comment) {
if ($line =~ /begin_xcat_table/) {$xcat_table=1; next;}
if ($xcat_table) {
if ($line =~ /numcols=(\d+)/) { $numcols=$1; next;}
if ($line =~ /colwidths=([\d,]+)/) { @colwidths=split(',',$1); next;}
}
if ($line =~ /end_xcat_table/) {
my $separator = '+';
foreach my $c (@colwidths) {
if ($c > 0) { $separator .= '-' x $c; }
$separator .= '+';
}
$separator .= "\n";
my $headsep = $separator;
$headsep =~ s/-/=/g;
my $rowline = $separator;
$rowline =~ s/-/ /g;
my $nosep=0;
foreach my $tabline(@tablines) {
if ($tabline =~ /^\s*$/) { next;}
if ($tabline =~ /^\-\-/) {
push (@outlines,$headsep);
$nosep = 1;
next;
}
if ($nosep) { $nosep=0;} else {push (@outlines,$separator);}
$tabline =~ s/^\s*\|//;
my @vals = split (/\|/,$tabline);
my $last_cell_line=0;
my $colnum=0;
my @tabrow;
foreach my $c (@colwidths) {
if ($c > 0) {
my $colval=$vals[$colnum];
$colval =~ s/(\s*)$//;
my $vallen = length($colval);
my $cell_line=0;
while ($vallen > $c) {
$tabrow[$cell_line++][$colnum] = substr($colval,0,$c);
$vallen -= $c;
$colval = substr($colval,$c,$vallen);
}
$tabrow[$cell_line][$colnum] = substr($colval,0,$vallen);
if ($vallen < $c) {
$tabrow[$cell_line][$colnum] .= " " x ($c-$vallen);
}
$last_cell_line = max($cell_line,$last_cell_line);
}
$colnum++;
}
my @rowlines;
for (my $i=0;$i<=$last_cell_line;$i++) {
for (my $j=0;$j<=$numcols-1;$j++) {
$rowlines[$i] .= "|";
if ($tabrow[$i][$j]) { $rowlines[$i] .= $tabrow[$i][$j]; }
else { $rowlines[$i] .= " " x $colwidths[$j]; }
}
$rowlines[$i] .= "|\n";
}
push (@outlines,@rowlines);
}
push (@outlines,$separator);
# reset to process next table
@tablines = ();
$xcat_table=0; $numcols=1;@colwidths=(0);next;
}
if ($line =~ /--\>/) {$in_comment=0;next;}
next;
}
if ($xcat_table) { push (@tablines,$line); next; }
push (@outlines,$line);
next;
}
open(MD2FILE, ">$outfile") or die "Could not open >$outfile";
print MD2FILE @outlines;
close MD2FILE;
return;
}

View File

@ -21,7 +21,11 @@ if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help"
exit 0
fi
if [ "$1" = "-v" ]; then
echo "Version 2.8"
echo "Version 2.9"
exit 0
fi
if [ "$1" = "--version" ]; then
echo "Version 2.9"
exit 0
fi

View File

@ -88,4 +88,12 @@ opt/xcat/bin/xcatclient opt/xcat/bin/lshwconn
opt/xcat/bin/xcatclientnnr opt/xcat/sbin/makeroutes
opt/xcat/bin/xcatclientnnr opt/xcat/sbin/snmove
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lsxcatd
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskit
opt/xcat/bin/xcatclientnnr opt/xcat/bin/addkit
opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkit
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitcomp
opt/xcat/bin/xcatclientnnr opt/xcat/bin/addkitcomp
opt/xcat/bin/xcatclientnnr opt/xcat/bin/rmkitcomp
opt/xcat/bin/xcatclientnnr opt/xcat/bin/chkkitcomp
opt/xcat/bin/xcatclientnnr opt/xcat/bin/lskitdeployparam
opt/xcat/bin/xcatclient opt/xcat/bin/postage

View File

@ -4,19 +4,23 @@ B<getxcatdocs> - downloads the xCAT documentation and converts to HTML and PDF
=head1 SYNOPSIS
B<getxcatdocs> [B<-?> | B<-h> | B<--help> | B<-v> | B<--version>] [I<destination-dir>]
B<getxcatdocs> [B<-?> | B<-h> | B<--help>]
B<getxcatdocs> [B<-v> | B<--verbose>] [I<destination-dir>]
B<getxcatdocs> [B<-v> | B<--verbose>] [B<-c> | B<--continue>] [B<-d> | B<--doc> I<single_doc>] [I<destination-dir>]
=head1 DESCRIPTION
The B<getxcatdocs> command downloads the xCAT documentation from the wiki and converts it to both HTML and PDF.
This enables reading the documentation when you do not have internet access. Note that this command does not
download/convert the entire xCAT wiki - only the "official" xCAT documentation linked from https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Documentation .
download/convert the entire xCAT wiki - only the "official" xCAT documentation linked from http://sourceforge.net/p/xcat/wiki/XCAT_Documentation.
If I<destination-dir> is specified, B<getxcatdocs> will put the converted documentation in that directory, in 2 sub-directories: html, pdf.
Otherwise, it will put it in the current directory (in the same two sub-directories).
If I<destination-dir> is specified, B<getxcatdocs> will put the converted documentation in that directory, in 3 sub-directories: html, pdf, images.
Otherwise, it will put it in the current directory (in the same three sub-directories).
B<getxcatdocs> uses wget to do the download the documents and xhtml2pdf to convert them to PDF. To install xhtml2pdf, see:
https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documentation_Pages#Converting_Wiki_Pages_to_HTML_and_PDFs .
If B<--doc> I<single_doc> is specified, only that one wiki page will be downloaded and converted.
B<getxcatdocs> uses curl to run the Allura wiki API to download the document markdown text, and Pandoc with LaTex them to PDF. You must have all of these functions installed to run B<getxcatdocs>. See:
http://sourceforge.net/p/xcat/wiki/Editing_and_Downloading_xCAT_Documentation/#converting-wiki-pages-to-html-and-pdfs
=head2 Limitations:
@ -26,24 +30,28 @@ https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Editing_xCAT_Documen
This command does not run on AIX or Windows.
=item *
The conversion to HTML does not yet honor the xCAT wiki style sheet.
=back
=head1 OPTIONS
=over 10
=item B<-v|--version>
Command Version.
=item B<-?|-h|--help>
Display usage message.
=item B<-v|--verbose>
Run the command in verbose mode.
=item B<-c|--continue>
If a previous run of this command failed (which often happens if you lose your network connection), continue processing using files already downloaded to your markdown directory.
=item B<-d|--doc> I<single_doc>
Run this command for a single document only. If you get errors about Official-xcat-doc.png not found, either download this image directly from http://sourceforge.net/p/xcat/wiki/XCAT_Documentation/attachment/Official-xcat-doc.png or run B<getxcatdocs -d XCAT_Documentation> first.
=back
=head1 RETURN VALUE

View File

@ -128,7 +128,11 @@ To import nodes using a profile, follow the following steps:
__hostname__:
mac=b8:ac:6f:37:59:28
cec=mycec
lparid=1
__hostname__:
mac=b8:ac:6f:37:59:28
cec=mycec
lparid=2
# Node information file ends.
The node information file includes the following items:
@ -155,7 +159,7 @@ Description: Specifies the name of a Power rack-mount central electronic complex
B<lparid=<lpar-id>> This is a optional option for defining Power rack-mounted nodes.
Description: Specifies the LPAR id of Power rack-mounted node.
Description: Specifies the LPAR ID of a Power rack-mounted node, where <lpar-id> is the ID number. The default value is 1 if it is not defined.
B<ip=<ip-address>> This is an optional item.

View File

@ -13,6 +13,8 @@ Prefix: /opt/xcat
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
%define pcm %(if [ "$pcm" = "1" ];then echo 1; else echo 0; fi)
%define notpcm %(if [ "$pcm" = "1" ];then echo 0; else echo 1; fi)
# AIX will build with an arch of "ppc"
%ifos linux
@ -115,6 +117,14 @@ cp share/xcat/tools/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/tools
#cp usr/share/xcat/scripts/setup-local-client.sh $RPM_BUILD_ROOT/usr/share/xcat/scripts/setup-local-client.sh
#chmod 755 $RPM_BUILD_ROOT/usr/share/xcat/scripts/setup-local-client.sh
# PCM does not need getxcatdocs
# getxcatdocs causes xCAT-client requires perl-JSON, which is not shipped with PCM
%if %pcm
rm -f $RPM_BUILD_ROOT/%{prefix}/bin/getxcatdocs
rm -f $RPM_BUILD_ROOT/%{prefix}/share/doc/man1/getxcatdocs.1.html
rm -f $RPM_BUILD_ROOT/%{prefix}/share/man/man1/getxcatdocs.1
%endif
# These links get made in the RPM_BUILD_ROOT/prefix area
ln -sf xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/rpower
ln -sf xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/rscan

View File

@ -10,7 +10,15 @@ DIR=`dirname $0`
DIR=`readlink -f $DIR`
# get the input files for dracut in the right place
DRACUTMODDIR=/usr/share/dracut/modules.d/97xcat
# Fedora 20 ppc64 uses /usr/lib/dracut/modules.d
# CentOS 7 probably uses /usr/lib/dracut/modules.d also
if [ -e "/usr/share/dracut/modules.d" ]
then
DRACUTMODDIR=/usr/share/dracut/modules.d/97xcat
else
DRACUTMODDIR=/usr/lib/dracut/modules.d/97xcat
fi
mkdir -p $DRACUTMODDIR
cp $DIR/* $DRACUTMODDIR
# For ppc64 platform, needs to remove some files,
@ -22,6 +30,20 @@ if [ `uname -m` = "ppc64" ]; then
sed -i 's/\/usr\/lib\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.13/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libgcc_s.so.1/\/lib64\/libgcc_s.so.1/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libtinfo.so.5.7/\/lib64\/libtinfo.so.5.7/' $DRACUTMODDIR/install
# following changes are required on Fedora 20 ppc64
sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.18.so/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libc.so.6/\/lib64\/libc.so.6/' $DRACUTMODDIR/install
sed -i 's/\/lib\/ld-linux.so.2/\/lib64\/ld-2.18.so/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libdl.so.2/\/lib64\/libdl.so.2/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libm.so.6/\/lib64\/libm.so.6/' $DRACUTMODDIR/install
sed -i 's/\/lib\/libpthread.so.0/\/lib64\/libpthread.so.0/' $DRACUTMODDIR/install
sed -i 's/\/lib64\/libncurses.so.5.7/\/lib64\/libncurses.so.5.9/' $DRACUTMODDIR/install
sed -i 's/\/usr\/lib64\/libstdc++.so.6.0.13/\/usr\/lib64\/libstdc++.so.6.0.19/' $DRACUTMODDIR/install
sed -i 's/\/lib64\/libtinfo.so.5.7/\/lib64\/libtinfo.so.5.9/' $DRACUTMODDIR/install
sed -i 's/\/usr\/lib64\/libsasl2.so.2/\/usr\/lib64\/libsasl2.so.3/' $DRACUTMODDIR/install
sed -i 's/\/lib64\/libnss_dns-2.12.so/\/lib64\/libnss_dns-2.18.so/' $DRACUTMODDIR/install
sed -i 's/\/lib\/terminfo\/l\/linux/\/usr\/share\/terminfo\/l\/linux/g' $DRACUTMODDIR/install
sed -i 's/\/lib\/terminfo\/v\/vt100/\/usr\/share\/terminfo\/v\/vt100/g' $DRACUTMODDIR/install
fi
if [ "$HOSTOS" = "mcp" ]; then
@ -55,8 +77,13 @@ if [ "$HOSTOS" = "mcp" ]; then
else
echo Creating the initramfs in /tmp/xcatgenesis.$$.rfs using dracut ...
fi
dracut -m "xcat base" -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION
# On Fedora 20 ppc64, dracut uses host-only mode by default
if [ `uname -m` = "ppc64" ]; then
dracut -m "xcat base" -N -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION
else
dracut -m "xcat base" -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION
fi
echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs ...
cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/`uname -m`/fs
zcat /tmp/xcatgenesis.$$.rfs|cpio -dumi

View File

@ -1,6 +1,6 @@
#!/bin/sh
echo $drivers
dracut_install wget openssl tar mstflint ipmitool cpio gzip lsmod ethtool modprobe touch echo cut wc
dracut_install wget openssl tar mstflint ipmitool cpio gzip lsmod ethtool modprobe touch echo cut wc bash
dracut_install netstat # broadcom update requires
dracut_install uniq # mellanox update requires
dracut_install grep ip hostname /usr/bin/awk egrep grep dirname expr
@ -617,7 +617,7 @@ dracut_install /lib64/rsyslog/lmnet.so
dracut_install /lib64/rsyslog/lmstrmsrv.so
dracut_install /lib64/rsyslog/imuxsock.so
dracut_install /usr/lib64/libnfsidmap/nsswitch.so
dracut_install killall logger nc nslookup bc chown chroot dd expr kill mkdosfs parted rsync shutdown sort ssh-keygen tr blockdev findfs insmod kexec lvm mdadm mke2fs pivot_root sshd swapon tune2fs mkreiserfs reiserfstune pvcreate lvremove vgremove vgcreate lvcreate lvscan lvchange vgchange pvdisplay lvdisplay vgdisplay blkid dmsetup # for sysclone
dracut_install killall logger nc nslookup bc chown chroot dd expr kill mkdosfs parted rsync shutdown sort ssh-keygen tr blockdev findfs insmod kexec lvm mdadm mke2fs pivot_root sshd swapon tune2fs mkreiserfs reiserfstune pvcreate lvremove vgremove vgcreate lvcreate lvscan lvchange vgchange pvdisplay lvdisplay vgdisplay blkid dmsetup sfdisk # for sysclone
dracut_install /lib/udev/rules.d/10-dm.rules
dracut_install /lib/udev/rules.d/11-dm-lvm.rules
dracut_install /lib/udev/rules.d/13-dm-disk.rules

View File

@ -1,11 +1,11 @@
#!/bin/bash
instmods nfs sunrpc
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf
instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf qlcnic
instmods macvlan macvtap 8021q bridge bonding vmxnet3 cpufreq_ondemand acpi-cpufreq powernow-k8 cdc_ether
instmods mptctl #LSI firmware management requires this
instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys
instmods reiserfs #reiserfs on sysclone
instmods ibmveth # ppc64 virtual ethernet
instmods ibmvscsic # ppc64 virtual disk
instmods ibmvscsi # ppc64 virtual disk
instmods ehea # ppc64 hea ethernet
instmods dm-mod #support LVM for sysclone

View File

@ -1,4 +1,4 @@
%define version 2.8
%define version 2.9
%ifarch i386 i586 i686 x86
%define tarch x86
%endif

36
xCAT-genesis-builder/xcat-cmdline.sh Normal file → Executable file
View File

@ -12,10 +12,23 @@ echo sshd:x:30:30:SSH User:/var/empty/sshd:/sbin/nologin >> /etc/passwd
echo rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin >> /etc/passwd
echo rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin >> /etc/passwd
echo qemu:x:107:107:qemu user:/:/sbin/nologin >> /etc/passwd
echo '[ -e $NEWROOT/proc ]' > /initqueue-finished/xcatroot.sh
# Fedora 20 ppc64 uses /lib/dracut/hooks/initqueue/finished
# CentOS 7 probably uses /lib/dracut/hooks/initqueue/finished also
if [ -d "/initqueue-finished" ]; then
echo '[ -e $NEWROOT/proc ]' > /initqueue-finished/xcatroot.sh
else
#echo 'if [ -e /proc ]; then /bin/doxcat; fi' > /lib/dracut/hooks/initqueue/finished/xcatroot.sh
echo '[ -e /proc ]' > /lib/dracut/hooks/initqueue/finished/xcatroot.sh
fi
mkdir /dev/cgroup
mount -t cgroup -o cpu,memory,devices cgroup /dev/cgroup
udevd --daemon
# Fedora 20 ppc64 does not udevd
# CentOS 7 probably does not have udevd either
if [ -f "/sbin/udevd" ]; then
udevd --daemon
else
/usr/lib/systemd/systemd-udevd --daemon
fi
udevadm trigger
mkdir -p /var/lib/dhclient/
mkdir -p /var/log
@ -25,4 +38,23 @@ if grep console=ttyS /proc/cmdline > /dev/null; then
while :; do sleep 1; screen -x console < /dev/tty1 > /dev/tty1 2>&1; clear; done &
fi
while :; do screen -ln < /dev/tty2 > /dev/tty2 2>&1; done &
# The section below is just for System P LE hardware discovery
# Need to wait for NIC initialization
sleep 20
ARCH=`uname -m`
if [ $ARCH == 'ppc64' ]; then
ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo`
for tmp in $ALL_NICS; do
tmp_data=`ip link show $tmp | grep -v "^ " | grep "UP"`
if [ "$tmp_data" == "" ]; then
ip link set $tmp up
fi
tmp_data="UP"
sleep 1
done
fi
while :; do screen -L -ln doxcat; done

View File

@ -387,6 +387,21 @@ if [ ! "$IPMIVER" == "1.5" ]; then
if [ $TRIES -gt $TIMEOUT ]; then echo "ERROR"; else echo "OK"; fi
fi
# Reset the BMC for the x3755 M4 (8722), otherwise the BMC will not be pingable after running of bmcsetup
XPROD=`ipmitool mc info|grep "^Product ID"|awk '{print $4}'`
if [ "$XPROD" = "309" ] ; then
echo "Resetting BMC ..."
ipmitool mc reset cold
echo "Waiting for the BMC to appear ..."
sleep 15
TRIES=0
while ! ipmitool lan print $LANCHAN > /dev/null; do
sleep 3
let TRIES=TRIES+1
if [ $TRIES -gt $TIMEOUT ]; then break; fi
done
fi
# update the node status to 'bmcready'
for parm in `cat /proc/cmdline`; do
key=`echo $parm|awk -F= '{print $1}'`

View File

@ -58,6 +58,7 @@ MTM=unknown
SERIAL=unknown
ARCH=unknown
ARCH=`uname -m` #32-bit only is old news
PLATFORM=unknown
if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86
PRODNAME=`cat /sys/devices/virtual/dmi/id/product_name`
IAMAVM=0
@ -71,10 +72,27 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86
MTM=`cat /sys/devices/virtual/dmi/id/product_name|awk -F'[' '{print $2}'|awk -F']' '{print $1}'`
SERIAL=`cat /sys/devices/virtual/dmi/id/product_serial`
fi
CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l`
grep "model name" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing
echo $line > /tmp/cpumod
done
CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'`
UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid`
elif [ -r /proc/device-tree/model ]; then #POWER
MTM=`cat /proc/device-tree/model |awk -F, '{print $2}'`
#MTM=`cat /proc/device-tree/model |awk -F, '{print $2}'`
MTM=`cat /proc/device-tree/model | sed -e 's/\^.*,//'`
CPUCOUNT=`cat /proc/cpuinfo |grep -e "^cpu\s*:"|wc -l`
PLATFORM=`cat /proc/cpuinfo | grep -e "^platform\s*:" | awk '{print \$3}'`
grep -e "^cpu\s*:" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing
echo $line > /tmp/cpumod
done
CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'`
SERIAL=`cat /proc/device-tree/system-id`
UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /proc/sys/kernel/random/uuid`
fi
CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l`
#CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l`
# The MEMORY will look like this: 32868920
MEMORY=`cat /proc/meminfo |grep MemTotal|awk '{printf "%.0fMB\n", $2/1024}'`
@ -86,11 +104,11 @@ MEMORY=`cat /proc/meminfo |grep MemTotal|awk '{printf "%.0fMB\n", $2/1024}'`
# The DISKSIZE will look like this: sdb:250GB,sda:250GB
DISKSIZE=`cat /proc/partitions |grep -e "sd.\>" |awk -F' ' '{printf "%s:%.0fGB\n", $4, $3*0.000001024}' |sed 'N;s/\n/,/'`
UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid`
grep "model name" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing
echo $line > /tmp/cpumod
done
CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'`
#UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid`
#grep "model name" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing
# echo $line > /tmp/cpumod
#done
#CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'`
echo '<xcatrequest>' > /tmp/discopacket
echo "<command>findme</command>" >> /tmp/discopacket
echo "<arch>$ARCH</arch>" >> /tmp/discopacket
@ -101,13 +119,19 @@ echo "<cpucount>$CPUCOUNT</cpucount>" >> /tmp/discopacket
echo "<cputype>$CPUTYPE</cputype>" >> /tmp/discopacket
echo "<memory>$MEMORY</memory>" >> /tmp/discopacket
echo "<disksize>$DISKSIZE</disksize>" >> /tmp/discopacket
echo "<uuid>$UUID</uuid>" >> /tmp/discopacket
if [ "$UUID" != "unknown" ]; then
echo "<uuid>$UUID</uuid>" >> /tmp/discopacket
fi
if [ "$MTM" != "unknown" ]; then
echo "<mtm>$MTM</mtm>" >> /tmp/discopacket
fi
if [ "$SERIAL" != "unknown" ]; then
echo "<serial>$SERIAL</serial>" >> /tmp/discopacket
fi
if [ "$PLATFORM" != "unknown" ]; then
echo "<platform>$PLATFORM</platform>" >> /tmp/discopacket
fi
#so we have some cases where DMI table explictly records every function number, and some where only first function is enumerated
#so for each onboard device, we record it. If it is also the first function, we'll seek out other function numbers and append
#if that other function number does not show up in its own dmi type 41 record

View File

@ -145,6 +145,29 @@ if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then
sleep 3
else
echo "Setting IP via DHCP..."
# This section is for System P hardware discovery, which won't have a BOOTIF value set
tries=0
while [ $tries -lt 5 ]; do
if [ -z "$bootnic" ]; then
ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo`
for tmp1 in $ALLUP_NICS; do
bootnic=$tmp1
break
done
else
break
fi
sleep 2
tries=$(($tries+1))
done
if [ -z "$bootnic" ]; then
ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo`
for tmp in $ALL_NICS; do
bootnic=$tmp
break
done
fi
dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic &
#we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce
#chances that we'll perform a partial discovery
@ -176,9 +199,11 @@ ntpd -g -x
# rv 0 state does not work with the new ntp versions
#(while ! ntpq -c "rv 0 state"|grep 'state=4' > /dev/null; do sleep 1; done; hwclock --systohc) &
(while [ "`ntpq -c \"rv 0 offset\" | grep \"offset=\" | awk -F \"=\" '{print $2}' | awk -F \".\" '{print $1}' | sed s/-//`" -ge 1000 ]; do sleep 1; done; hwclock --systohc) &
if dmidecode|grep IPMI > /dev/null; then
modprobe ipmi_si
modprobe ipmi_devintf
if [ -f "/usr/sbin/dmidecode" ]; then
if dmidecode|grep IPMI > /dev/null; then
modprobe ipmi_si
modprobe ipmi_devintf
fi
fi
DEVICE=$bootnic
export DEVICE

View File

@ -1,36 +1,88 @@
Format: http://dep.debian.net/deps/dep5
Upstream-Name: xcat-genesis-scripts
Source: <url://example.com>
Eclipse Public License - v 1.0
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: <special license>
<Put the license of the package here indented by 1 space>
<This follows the format of Description: lines in control file>
.
<Including paragraphs>
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2013 root <root@unknown>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
1. DEFINITIONS
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
"Contribution" means:
a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
"Program" means the Contributions distributed in accordance with this Agreement.
"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright notices contained within the Program.
Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.

View File

@ -7,6 +7,7 @@
%ifarch ppc ppc64
%define tarch ppc64
%endif
%define rpminstallroot /opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs
BuildArch: noarch
%define name xCAT-genesis-scripts-%{tarch}
%define __spec_install_post :
@ -74,4 +75,33 @@ touch /etc/xcat/genesis-scripts-updated
%Files
%defattr(-,root,root)
/opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs
#%dir %attr(-,root,root) %{rpminstallroot}
%{rpminstallroot}/bin/allowcred.awk
%{rpminstallroot}/bin/bmcsetup
%{rpminstallroot}/bin/dodiscovery
%{rpminstallroot}/bin/dosysclone
%{rpminstallroot}/bin/doxcat
%{rpminstallroot}/bin/getcert
%{rpminstallroot}/bin/getdestiny
%{rpminstallroot}/bin/getipmi
%{rpminstallroot}/bin/ifup
%{rpminstallroot}/bin/minixcatd.awk
%{rpminstallroot}/bin/nextdestiny
%{rpminstallroot}/bin/remoteimmsetup
%{rpminstallroot}/bin/udpcat.awk
%{rpminstallroot}/bin/updateflag.awk
%{rpminstallroot}/debian/changelog
%{rpminstallroot}/debian/compat
%{rpminstallroot}/debian/control
%{rpminstallroot}/debian/copyright
%{rpminstallroot}/debian/dirs
%{rpminstallroot}/debian/docs
%{rpminstallroot}/debian/install
%{rpminstallroot}/debian/postinst
%{rpminstallroot}/debian/postrm
%{rpminstallroot}/debian/preinst
%{rpminstallroot}/debian/prerm
%{rpminstallroot}/debian/rules
%{rpminstallroot}/etc/init.d/functions
%{rpminstallroot}/etc/udev/rules.d/99-imm.rules
%{rpminstallroot}/sbin/setupimmnic

View File

@ -1 +0,0 @@
xcat-rmc_2.5.0-1_all.deb admin extra

View File

@ -7,6 +7,6 @@ Standards-Version: 3.7.2
Package: xcat-server
Architecture: all
Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl
Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl,libjson-perl
Description: Server and configuration utilities of the xCAT management project
xCAT-server provides the core server and configuration management components of xCAT. This package should be installed on your management server

View File

@ -22,6 +22,7 @@ opt/xcat/share/xcat/ib/netboot/sles
opt/xcat/share/xcat/ib/netboot/rh
opt/xcat/lib
opt/xcat/lib/perl
opt/xcat/lib/perl/Confluent
opt/xcat/lib/perl/xCAT
opt/xcat/lib/perl/xCAT_plugin
opt/xcat/lib/perl/xCAT_schema

View File

@ -24,6 +24,7 @@ lib/xcat/plugins/* opt/xcat/lib/perl/xCAT_plugin/
lib/xcat/schema/* opt/xcat/lib/perl/xCAT_schema/
lib/xcat/monitoring/* opt/xcat/lib/perl/xCAT_monitoring/
lib/xcat/dsh/Context/* opt/xcat/xdsh/Context
lib/xcat/Confluent/* opt/xcat/lib/perl/Confluent/
lib/xcat/shfunctions opt/xcat/lib
etc/init.d/xcatd etc/init.d

View File

@ -60,6 +60,7 @@ binary-arch:
chmod 644 $(rootdir)/lib/perl/xCAT_monitoring/samples/*
chmod 755 $(rootdir)/lib/perl/xCAT_monitoring/pcp
chmod 644 $(rootdir)/lib/perl/xCAT_monitoring/pcp/*
chmod 644 $(rootdir)/lib/perl/Confluent/*
chmod 644 $(rootdir)/lib/perl/xCAT_schema/*
chmod 755 $(rootdir)/lib/perl/xCAT_schema/samples
chmod 644 $(rootdir)/lib/perl/xCAT_schema/samples/*

67
xCAT-server/lib/perl/xCAT/PPC.pm Executable file → Normal file
View File

@ -2138,6 +2138,62 @@ sub parse_args
}
sub findme {
my $request = shift;
my $callback = shift;
my $subreq = shift;
my $vpdtab = xCAT::Table->new('vpd');
if (!defined $request->{'mtm'} or !defined $request->{'serial'}) {
xCAT::MsgUtils->message("S", "Discovery Error: 'mtm' or 'serial' not found.");
return;
}
unless ($vpdtab) {
xCAT::MsgUtils->message("S", "Discovery Error: Could not open table: vpd.");
return;
}
my @attr_array = ();
push @attr_array, "mtm==$request->{mtm}->[0]";
push @attr_array, "serial==$request->{serial}->[0]";
my @tmp_nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node');
my @nodes = ();
my $pbmc_node;
my %nodes_hash = ();
foreach (@tmp_nodes) {
$nodes_hash{$_->{node}} = '1';
}
@nodes = keys (%nodes_hash);
# remove the pbmc node defined by lsslp from the node groups
my $ppctab = xCAT::Table->new('ppc');
if ($ppctab) {
my $ppchash = $ppctab->getNodesAttribs(\@nodes, ['node', 'nodetype']);
foreach (@nodes) {
if (defined($ppchash->{$_}->[0]) && defined($ppchash->{$_}->[0]->{'nodetype'}) && $ppchash->{$_}->[0]->{'nodetype'} eq 'pbmc') {
delete $nodes_hash{$_};
$pbmc_node = $_;
}
}
@nodes = keys (%nodes_hash);
}
my $nodenum = $#nodes;
if ($nodenum < 0) {
xCAT::MsgUtils->message("S", "Discovery Error: Could not find any node.");
return;
} elsif ($nodenum > 0) {
xCAT::MsgUtils->message("S", "Discovery Error: More than one node were found.");
return;
}
{
my $req = {%$request};
$req->{command} = ['discovered'];
$req->{noderange} = [$nodes[0]];
$req->{pbmc_node} = [$pbmc_node];
$req->{discoverymethod} = ['mtms'];
$subreq->($req);
%{$req} = ();
}
}
##########################################################################
# Process request from xCat daemon
##########################################################################
@ -2153,6 +2209,17 @@ sub process_request {
####################################
$package =~ s/xCAT_plugin:://;
####################################
# Deal with findme request
####################################
if ($req->{command}->[0] eq 'findme') {
# The arch of the node shall be check first to makesure it is a power machine
if (!defined $req->{'arch'} or $req->{'arch'}->[0] ne 'ppc64') {
return;
}
&findme($req, $callback, $subreq);
return;
}
####################################
# Build hash to pass around
####################################

View File

@ -1858,12 +1858,45 @@ sub getPostScripts
$result .= "setbootfromnet\n";
}
# add setbootfromdisk if the nodesetstate is install and arch is ppc64
if (($nodesetstate) && ($nodesetstate eq "install") && ($arch eq "ppc64"))
# add setbootfromdisk if the nodesetstate is install or sysclone and arch is ppc64
if (($nodesetstate) && (($nodesetstate eq "install") || ($nodesetstate eq "sysclone")) && ($arch eq "ppc64"))
{
$result .= "setbootfromdisk\n";
}
#for redhat 7, append "disableconsistentNICrename" to default postscripts
#if "net.ifnames=0" is specified in kcmdline/addkcmdline of node or osimage
my $tftpdir = xCAT::TableUtils::getTftpDir();
my $osimagetab=xCAT::Table->new('osimage',-create=>1);
my $osimgent = $osimagetab->getAttribs({imagename => $osimgname },'osvers');
my $os = $osimgent->{'osvers'};
my $nrret = $::GLOBAL_TAB_HASH{noderes}{$node};
my $netboot = $nrret->{'netboot'};
if( (($os =~ "rhel7*") || ($os =~ "rhels7*")) && ($nodesetstate) && ($nodesetstate eq "install") )
{
my $nodecfg;
if($netboot eq "grub2")
{
$nodecfg="$tftpdir/boot/grub2/$node";
}elsif($netboot eq "xnba")
{
$nodecfg="$tftpdir/xcat/xnba/nodes/$node";
}elsif($netboot eq "pxe")
{
$nodecfg="$tftpdir/pxelinux.cfg/$node";
}
my $rc=system("grep net.ifnames=0 $nodecfg >/dev/null 2>&1");
if($rc ==0)
{
$result .= "disableconsistentNICrename\n";
}
}
return $result;
}

20
xCAT-server/lib/perl/xCAT/SvrUtils.pm Normal file → Executable file
View File

@ -53,6 +53,7 @@ sub getNodesetStates
my @pxenodes = ();
my @yabootnodes = ();
my @xnbanodes= ();
my @grub2nodes = ();
my $tabdata = $tab->getNodesAttribs(\@nodes, ['node', 'netboot']);
foreach my $node (@nodes)
{
@ -75,6 +76,10 @@ sub getNodesetStates
{
push(@aixnodes, $node);
}
elsif ($nb eq "grub2")
{
push(@grub2nodes, $node);
}
}
my @retarray;
@ -131,6 +136,18 @@ sub getNodesetStates
xCAT::MsgUtils->message('E', $retarray[1]);
}
}
if (@grub2nodes > 0)
{
require xCAT_plugin::grub2;
@retarray =
xCAT_plugin::grub2::getNodesetStates(\@grub2nodes, $hashref);
if ($retarray[0])
{
$retcode = $retarray[0];
$errormsg .= $retarray[1];
xCAT::MsgUtils->message('E', $retarray[1]);
}
}
}
return (0, "");
}
@ -696,6 +713,9 @@ sub update_tables_with_templates
osarch=>$arch,
synclists=>$synclistfile,
osdistroname=>$osdistroname);
if ($args{description}) {
$tb_cols{description} = $args{description};
}
$osimagetab->setAttribs(\%key_col, \%tb_cols);
if ($osname =~ /^win/) {

View File

@ -29,7 +29,7 @@ This program module file, is a set of utilities used by xCAT daemon.
Here is where we check if $peername is allowed to do $request in policy tbl.
$peername, if set signifies client has a cert that the xCAT CA accepted.
Logs to syslog and auditlog table all user commands, see site.auditskipcmds
attribute.
attribute and auditnosyslog attribute.
Arguments:
@ -205,9 +205,15 @@ sub validate {
if($peername) { $logst .= " for " . $request->{username}->[0]};
if ($peerhost) { $logst .= " from " . $peerhost };
# read site.auditskipcmds attribute,
# read site.auditskipcmds and auditnosyslog attributes,
# if set skip commands else audit all cmds.
my @skipcmds=($::XCATSITEVALS{auditskipcmds}); #xCAT::Utils->get_site_attribute('auditskipcmds');
# is auditnosyslog, then only write to auditlog table and not to syslog
my @skipcmds=($::XCATSITEVALS{auditskipcmds});
my $auditnosyslog=($::XCATSITEVALS{auditnosyslog});
my $skipsyslog = 0; # default is to write all commands to auditlog and syslog
if (defined($auditnosyslog)) {
$skipsyslog = $auditnosyslog; # take setting from site table, 1 means no syslog
}
# if not "ALL" and not a command from site.auditskipcmds
# and not getcredentials and not getcredentials ,
# put in syslog and auditlog
@ -232,9 +238,12 @@ sub validate {
@$deferredmsgargs=(); #should be redundant, but just in case
if (($request->{command}->[0] ne "getpostscript") && ($request->{command}->[0] ne "getcredentials") && ($skip == 0)) {
# put in audit Table and syslog
# put in audit Table and syslog unless site.noauditsyslog=1
my $rsp = {};
$rsp->{syslogdata}->[0] = $logst;
if ($skipsyslog == 0){ # write to syslog and auditlog
$rsp->{syslogdata}->[0] = $logst; # put in syslog data
}
if ($peername) {
$rsp->{userid} ->[0] = $request->{username}->[0];
}
@ -256,9 +265,20 @@ sub validate {
}
$rsp->{args} -> [0] =$arglist;
$rsp->{status} -> [0] = $status;
@$deferredmsgargs = ("SA",$rsp);
if ($skipsyslog == 0){ # write to syslog and auditlog
@$deferredmsgargs = ("SA",$rsp);
} else{ # only auditlog
@$deferredmsgargs = ("A",$rsp);
}
} else { # getpostscript or getcredentials, just syslog
unless ($::XCATSITEVALS{skipvalidatelog}) { @$deferredmsgargs=("S",$logst); }
if (($request->{command}->[0] eq "getpostscript")
|| ($request->{command}->[0] eq "getcredentials")) {
unless ($::XCATSITEVALS{skipvalidatelog}) { @$deferredmsgargs=("S",$logst); }
} else { #other skipped command syslog unless auditnosyslog
if ($skipsyslog == 0){ # write to syslog
@$deferredmsgargs=("S",$logst);
}
}
}
} # end getbladecons,etc check
return $rc;

View File

@ -1957,6 +1957,18 @@ sub mksysclone
}
}
$kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename";
my $nodetab = xCAT::Table->new('nodetype');
my $archref = $nodetab->getNodeAttribs($node, ['arch']);
if ($archref->{arch} eq "ppc64"){
my $mactab = xCAT::Table->new('mac');
my $macref = $mactab->getNodeAttribs($node, ['mac']);
my $formatmac = $macref->{mac};
$formatmac =~ s/:/-/g;
$formatmac = "01-".$formatmac;
$kcmdline .= " BOOTIF=$formatmac ";
}
#$kcmdline .= " noipv6";
# add the addkcmdline attribute to the end
# of the command, if it exists

View File

@ -2416,6 +2416,9 @@ sub addnet
push @netent,
" } else if option client-architecture = 00:02 { #ia64\n ";
push @netent, " filename \"elilo.efi\";\n";
push @netent,
" } else if option client-architecture = 00:0e { #OPAL-v3\n ";
push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/".$net."_".$maskbits."\";\n";
push @netent,
" } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n ";
push @netent, " filename \"/yaboot\";\n";

View File

@ -32,7 +32,7 @@ sub handled_commands {
rscan => 'nodehm:mgt',
getfspcon => 'nodehm:cons',
getmulcon => 'fsp',
findme => 'fsp',
};
}

View File

@ -618,6 +618,21 @@ sub sysclone_prepclient {
},
$subreq, 0, 1);
my @nodes = ($node);
my $nodetypetab = xCAT::Table->new("nodetype");
my $nthash = $nodetypetab->getNodesAttribs(\@nodes, ['arch']);
my $tmp = $nthash->{$node}->[0]->{arch};
if ( $tmp eq 'ppc64'){
$cmd = qq(if ! cat /etc/systemimager/autoinstallscript.conf |grep 'part num=\\\"1\\\"' |grep 'id=' >/dev/null ;then sed -i 's:\\(.*<part num=\\\"1\\\".*\\)\\(/>\\):\\1 id=\\\"41\\\" \\2:' /etc/systemimager/autoinstallscript.conf;fi);
$output = xCAT::Utils->runxcmd(
{
command => ["xdsh"],
node => [$node],
arg =>[$cmd]
},
$subreq, 0, 1);
}
return 0;
}

View File

@ -510,7 +510,11 @@ sub on_bmc_connect {
} elsif($command eq "rspconfig") {
shift @{$sessdata->{extraargs}};
if ($sessdata->{subcommand} =~ /=/) {
setnetinfo($sessdata);
if ($sessdata->{subcommand} =~ /password/) {
setpassword($sessdata);
} else {
setnetinfo($sessdata);
}
} else {
getnetinfo($sessdata);
}
@ -635,6 +639,55 @@ sub resetedbmc {
}
}
sub setpassword {
my $sessdata = shift;
my $subcommand = $sessdata->{subcommand};
my $argument;
($subcommand, $argument) = split(/=/, $subcommand);
my $netfun = 0x06;
my $command = 0x47;
my @data = ();
@data = unpack("C*", $argument);
if ($#data > 19 or $#data < 0) {
xCAT::SvrUtils::sendmsg([1, "The new password is invalid"],$callback,$sessdata->{node},%allerrornodes);
return(1,"The new password is invalid.");
}
$sessdata->{newpassword}=$argument;
my $index = $#data;
while($index < 19) { # Password must be padded with 0 to 20 bytes for IPMI 2.0
push @data, 0;
$index += 1;
}
unshift @data, 0x02; # byte 2, operation: 0x00 disable user, 0x01 enable user, 0x02 set password, 0x03 test password
unshift @data, 0x01; # byte 1, userID, User ID 1 is permanently associated with User 1, the null user name
$sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@data,callback=>\&password_set,callback_args=>$sessdata);
}
sub password_set {
my $rsp = shift;
my $sessdata = shift;
if ($rsp->{error}) {
xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes);
return;
}
if ($rsp->{code}) {
if ($codes{$rsp->{code}}) {
xCAT::SvrUtils::sendmsg([1,$codes{$rsp->{code}}],$callback,$sessdata->{node},%allerrornodes);
} else {
xCAT::SvrUtils::sendmsg([1,sprintf("Unknown ipmi error %02xh",$rsp->{code})],$callback,$sessdata->{node},%allerrornodes);
}
return;
}
my $ipmitab = xCAT::Table->new('ipmi');
if (!$ipmitab) {
xCAT::SvrUtils::sendmsg([1, "Failed to update ipmi table."],$callback,$sessdata->{node},%allerrornodes);
} else {
$ipmitab->setNodeAttribs($sessdata->{node}, {'password'=>$sessdata->{newpassword}});
xCAT::SvrUtils::sendmsg("Done",$callback,$sessdata->{node},%allerrornodes);
}
return;
}
sub setnetinfo {
my $sessdata = shift;
my $subcommand = $sessdata->{subcommand};
@ -736,12 +789,25 @@ sub setnetinfo {
else {
return(1,"configuration of $subcommand is not implemented currently");
}
unless ($sessdata->{netinfo_setinprogress}) {
$sessdata->{netinfo_setinprogress} = '1';
$sessdata->{ipmisession}->subcmd(netfn=>$netfun, command=>0x01, data=>[$channel_number,0x0,0x1], callback=>\&setnetinfo,callback_args=>$sessdata);
}
my $command = shift @cmd;
$sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@cmd,callback=>\&netinfo_set,callback_args=>$sessdata);
}
sub netinfo_set {
my $rsp = shift;
my $sessdata = shift;
if ($sessdata->{netinfo_setinprogress}) {
my $channel_number = $sessdata->{ipmisession}->{currentchannel};
delete $sessdata->{netinfo_setinprogress};
$sessdata->{rsp}->{error} = $rsp->{error};
$sessdata->{rsp}->{code} = $rsp->{code};
$sessdata->{ipmisession}->subcmd(netfn=>0x0c, command=>0x01, data=>[$channel_number,0x0,0x0], callback=>\&netinfo_set,callback_args=>$sessdata);
} else {
$rsp = $sessdata->{rsp};
}
if ($rsp->{error}) {
xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes);
return;
@ -833,6 +899,7 @@ sub getnetinfo_response {
my $rsp = shift;
my $sessdata = shift;
my $subcommand = $sessdata->{subcommand};
$subcommand =~ s/=.*//;
$sessdata->{subcommand} = shift @{$sessdata->{extraargs}};
if ($rsp->{error}) {
xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes);
@ -1213,6 +1280,9 @@ sub getrvidparms_with_buildid {
my $rsp = shift;
my $sessdata = shift;
my @build_id = (0,@{$rsp->{data}});
if ($build_id[1]==0x54 and $build_id[2]==0x43 and $build_id[3]==0x4f and $build_id[4]==0x4f) { ##Lenovo IMM2
return getrvidparms_imm2($rsp,$sessdata);
}
if ($build_id[1]==0x31 and $build_id[2]==0x41 and $build_id[3]==0x4f and $build_id[4]==0x4f) { #Only know how to cope with yuoo builds
return getrvidparms_imm2($rsp,$sessdata);
}
@ -1983,7 +2053,7 @@ sub got_bmc_fw_info {
my @returnd = (@{$rsp->{data}});
my @a = ($fw_rev2);
my $prefix = pack("C*",@returnd[0..3]);
if ($prefix =~ /yuoo/i or $prefix =~ /1aoo/i) { #we have an imm
if ($prefix =~ /yuoo/i or $prefix =~ /1aoo/i or $prefix =~ /tcoo/i) { #we have an imm
$isanimm=1;
}
$mprom = sprintf("%d.%s (%s)",$fw_rev1,decodebcd(\@a),getascii(@returnd));

View File

@ -160,6 +160,7 @@ my %globalhwtype = (
cec => $::NODETYPE_CEC,
cmm => $::NODETYPE_CMM,
imm2 => $::NODETYPE_IMM2,
pbmc => "pbmc",
);
my %globalnodetype = (
fsp => $::NODETYPE_PPC,
@ -170,6 +171,7 @@ my %globalnodetype = (
ivm => $::NODETYPE_PPC,
cmm => $::NODETYPE_MP,
lpar =>"$::NODETYPE_PPC,$::NODETYPE_OSI",
pbmc => $::NODETYPE_PPC,
);
my %globalmgt = (
fsp => "fsp",
@ -182,6 +184,7 @@ my %globalmgt = (
cmm => "blade",
imm2 => "blade",
hmc => "hmc",
pbmc => "ipmi",
);
my %globalid = (
fsp => "cid",
@ -249,7 +252,8 @@ sub parse_args {
RSA => HARDWARE_SERVICE.":".SERVICE_RSA.":",
CMM => HARDWARE_SERVICE.":".SERVICE_CMM,
IMM2 => HARDWARE_SERVICE.":".SERVICE_IMM2,
MM => HARDWARE_SERVICE.":".SERVICE_MM.":"
MM => HARDWARE_SERVICE.":".SERVICE_MM.":",
PBMC => HARDWARE_SERVICE.":".SERVICE_FSP
);
#############################################
# Responds with usage statement
@ -1116,6 +1120,16 @@ sub parse_responses {
trace( $request, "Discover node $atthash{hostname}: type is $atthash{type},\
mtm is $atthash{mtm},sn is $atthash{serial}, ip is $atthash{ip},\
mac is $atthash{mac}, otherinterfaces is $atthash{otherinterfaces}" );
} elsif (($type eq SERVICE_FSP) && ($option_s eq "PBMC")) {
my %tmphash;
$atthash{type} = "pbmc";
$atthash{mtm} = ${$attributes->{'machinetype-model'}}[0];
$atthash{serial} = ${$attributes->{'serial-number'}}[0];
$atthash{ip} = ${$searchmacs{$rsp}}{peername};
$atthash{url} = ${$searchmacs{$rsp}}{payload};
$atthash{hostname} = 'Server-'.$atthash{mtm}.'-SN'.$atthash{serial};
$outhash{'Server-'.$atthash{mtm}.'-SN'.$atthash{serial}} = \%atthash;
}elsif (($type eq SERVICE_FSP) && (${$attributes->{'machinetype-model'}}[0] =~ /^7895|1457|7954/ )) {
# Skip this entry if "-s CEC" was specified - we do not list FSP entries for Flex when only CECs were requested
next unless ($option_s ne "CEC");
@ -1179,7 +1193,7 @@ sub parse_responses {
otherinterfaces is $tmphash1{otherinterfaces}" );
}
}
}else {
}else {
#begin to define fsp and bpa
my %tmphash;
$tmphash{type} = ($type eq SERVICE_BPA) ? TYPE_BPA : TYPE_FSP;
@ -1447,6 +1461,7 @@ sub xCATdB {
my %hostshash;
my %machash;
my %mphash;
my %ipmihash;
foreach my $nodeentry ( keys %$outhash ) {
my $type = ${$outhash->{$nodeentry}}{type};
my $model = ${$outhash->{$nodeentry}}{mtm};
@ -1479,6 +1494,13 @@ sub xCATdB {
$nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}};
$hostshash{$hostname} = {otherinterfaces=>$otherif} if ($type =~ /fsp|bpa/);
$machash{$hostname} = {mac=>$mac} if ($type =~ /^fsp|bpa$/);
} elsif ( $type =~ /^pbmc$/) {
$nodelisthash{$hostname} = {groups=>$groups, hidden=>$hidden};
$ppchash{$hostname} = {nodetype=>$globalhwtype{$type}};
$vpdhash{$hostname} = {mtm=>$model, serial=>$serial};
$nodehmhash{$hostname} = {mgt=>$globalmgt{$type}};
$nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}};
$ipmihash{$hostname} = {bmc=>$ip};
} elsif ( $type =~ /^(rsa|mm)$/ ) {
my @data = ($type, $model, $serial, $side, $ip, $frameid, $cageid, $parent, $mac);
xCAT::PPCdb::add_systemX( $type, $hostname, \@data );
@ -1512,7 +1534,7 @@ sub xCATdB {
$dbhash{hosts} = \%hostshash, if (%hostshash);
$dbhash{mac} = \%machash, if (%machash);
$dbhash{mp} = \%mphash, if (%mphash);
$dbhash{ipmi} = \%ipmihash, if (%ipmihash);
for my $tab (keys %dbhash) {
my $db = xCAT::Table->new($tab);
@ -1553,6 +1575,8 @@ sub format_stanza {
$result .= "$hostname:\n\tobjtype=node\n";
if ($type =~ /^cmm$/){
$result .= "\tmpa=${$outhash->{$name}}{hostname}\n";
} elsif ($type =~ /^pbmc$/) {
$result .= "\tbmc=${$outhash->{$name}}{ip}\n";
}else{
$result .= "\thcp=${$outhash->{$name}}{hostname}\n";
}
@ -1571,7 +1595,7 @@ sub format_stanza {
if ($type =~ /^fsp|bpa|cec$/ and exists(${$outhash->{$name}}{parent})) {
$result .= "\tparent=${$outhash->{$name}}{parent}\n";
}
unless ($type =~ /^frame|cec$/){
unless ($type =~ /^frame|cec$/ or !exists(${$outhash->{$name}}{mac})){
$result .= "\tmac=${$outhash->{$name}}{mac}\n";
}
if ($type =~ /^fsp|bpa$/){

View File

@ -117,6 +117,7 @@ sub process_request {
system("ssh-keygen -t rsa -f $tempdir/etc/ssh_host_rsa_key -C '' -N ''");
system("ssh-keygen -t dsa -f $tempdir/etc/ssh_host_dsa_key -C '' -N ''");
}
my $initrd_file = undef;
my $lzma_exit_value=1;
if ($invisibletouch) {
my $done=0;
@ -129,18 +130,25 @@ sub process_request {
unlink ("$tftpdir/xcat/genesis.fs.$arch.lzma");
} else {
$done = 1;
$initrd_file = "$tftpdir/xcat/genesis.fs.$arch.lzma";
}
}
if (not $done) {
$callback->({data=>["Creating genesis.fs.$arch.gz in $tftpdir/xcat"]});
system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/genesis.fs.$arch.gz");
$initrd_file = "$tftpdir/xcat/genesis.fs.$arch.gz";
}
} else {
$callback->({data=>["Creating nbfs.$arch.gz in $tftpdir/xcat"]});
system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/nbfs.$arch.gz");
$initrd_file = "$tftpdir/xcat/nbfs.$arch.gz";
}
system ("rm -rf $tempdir");
unless ($initrd_file) {
$callback->({data=>["Creating filesystem file in $tftpdir/xcat failed"]});
return;
}
my $hexnets = xCAT::NetworkUtils->my_hexnets();
my $normnets = xCAT::NetworkUtils->my_nets();
my $consolecmdline;
@ -170,7 +178,7 @@ sub process_request {
chmod(0644,"$tftpdir/pxelinux.0");
}
} elsif ($arch =~ /ppc/) {
mkpath("$tftpdir/etc");
mkpath("$tftpdir/pxelinux.cfg/p/");
}
my $dopxe=0;
foreach (keys %{$normnets}) {
@ -231,6 +239,14 @@ sub process_request {
close($cfg);
}
} elsif ($arch =~ /ppc/) {
open($cfgfile,">", "$tftpdir/pxelinux.cfg/p/$net");
print $cfgfile "default xCAT\n";
print $cfgfile " label xCAT\n";
print $cfgfile " kernel http://".$normnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n";
print $cfgfile " initrd http://".$normnets->{$_}.":80/$initrd_file\n";
print $cfgfile ' append "quiet xcatd='.$normnets->{$_}.":$xcatdport $consolecmdline\"\n";
close($cfgfile);
}
}
$dopxe=0;
@ -262,11 +278,11 @@ sub process_request {
close($cfgfile);
} elsif ($arch =~ /ppc/) {
open($cfgfile,">","$tftpdir/etc/".lc($_));
print $cfgfile "timeout=5\n";
print $cfgfile " label=xcat\n";
print $cfgfile " image=xcat/nbk.$arch\n";
print $cfgfile " initrd=xcat/nbfs.$arch.gz\n";
print $cfgfile ' append="quiet xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n";
print $cfgfile "default xCAT\n";
print $cfgfile " label xCAT\n";
print $cfgfile " kernel http://".$hexnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n";
print $cfgfile " initrd http://".$hexnets->{$_}.":80/$initrd_file\n";
print $cfgfile ' append "quiet xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n";
close($cfgfile);
}
}

View File

@ -206,6 +206,8 @@ sub process_request {
}
if ($request->{arch}->[0] =~ /x86/ and $currboot !~ /pxe/ and $currboot !~ /xnba/) {
$nrtab->setNodeAttribs($node,{netboot=>'xnba'});
} elsif ($request->{arch}->[0] =~ /ppc/ and $request->{platform}->[0] =~ /PowerNV/) {
$nrtab->setNodeAttribs($node,{netboot=>'petitboot'});
} elsif ($request->{arch}->[0] =~ /ppc/ and $currboot !~ /yaboot/) {
$nrtab->setNodeAttribs($node,{netboot=>'yaboot'});
}
@ -351,6 +353,10 @@ sub process_request {
$callback->({error=> ["The node [$node] should have a correct IP address which belongs to the management network."], errorcode=>["1"]});
return;
}
if (defined ($request->{pbmc_node}) and defined($request->{pbmc_node}->[0]) ) {
my $pbmc_node = $request->{pbmc_node}->[0];
xCAT::Utils->cleanup_for_powerLE_hardware_discovery($node, $pbmc_node, $doreq);
}
my $restartstring = "restart";
if (scalar @forcenics > 0) {

View File

@ -95,7 +95,6 @@ sub getOSdistroref
{
return undef;
}
# verified this does work on DB2
my @clause=();
@ -158,7 +157,7 @@ sub rmosdistro
if ($help) {
$callback->({info=>"rmosdistro [{-a|--all}] [-f|--force] [osdistroname] ...",errorcode=>[0]});
$callback->({info=>["rmosdistro [{-a|--all}] [-f|--force] [osdistroname] ..."],errorcode=>[0]});
return;
}
@ -166,7 +165,7 @@ sub rmosdistro
{
unless(scalar @ARGV)
{
$callback->({info=>"please specify osdistroname to remove, or specify \"-a|--all\" to remove all osdistros ",errorcode=>[1]});
$callback->({info=>["please specify osdistroname to remove, or specify \"-a|--all\" to remove all osdistros "],errorcode=>[1]});
return;
}
#if any osdistro has been specified,push it into array
@ -176,7 +175,7 @@ sub rmosdistro
my $osdistrotab = xCAT::Table->new('osdistro',-create=>1);
unless($osdistrotab)
{
$callback->({error=>"rmosdistro: failed to open table 'osdistro'!",errorcode=>[1]});
$callback->({error=>["rmosdistro: failed to open table 'osdistro'!"],errorcode=>[1]});
return;
}
@ -203,7 +202,7 @@ sub rmosdistro
$osimagetab=xCAT::Table->new('osimage');
unless($osimagetab)
{
$callback->({error=>"rmosdistro: failed to open table 'osimage'!",errorcode=>[1]});
$callback->({error=>["rmosdistro: failed to open table 'osimage'!"],errorcode=>[1]});
$osdistrotab->close();
return;
}
@ -218,7 +217,7 @@ sub rmosdistro
my $result=&getOSdistroref($osimagetab,$_);
if($result)
{
$callback->({error=>"rmosdistro: failed to remove $_, it is referenced by osimages:\n$result\nretry with -f option !",errorcode=>[1]});
$callback->({error=>["rmosdistro: failed to remove $_, it is referenced by osimages:\n$result\nretry with -f option !"],errorcode=>[1]});
next;
}
}
@ -228,7 +227,7 @@ sub rmosdistro
my $result=$osdistrotab->getAttribs(\%keyhash,'dirpaths','basename','majorversion','minorversion','arch');
unless($result)
{
$callback->({error=>"rmosdistro: $keyhash{osdistroname} not exist!",errorcode=>[1]});
$callback->({error=>["rmosdistro: $keyhash{osdistroname} not exist!"],errorcode=>[1]});
next;
}
@ -240,7 +239,7 @@ sub rmosdistro
system("rm -rf $result->{'dirpaths'}");
if($? != 0)
{
$callback->({error=>"rmosdistro: failed to remove $keyhash{osdistroname} directory!",errorcode=>[1]});
$callback->({error=>["rmosdistro: failed to remove $keyhash{osdistroname} directory!"],errorcode=>[1]});
next;
}
}
@ -259,7 +258,7 @@ sub rmosdistro
#remove the osdistro entry
$osdistrotab->delEntries(\%keyhash);
$osdistrotab->commit;
$callback->({info=>"rmosdistro: remove $_ success",errorcode=>[0]});
$callback->({info=>["rmosdistro: remove $_ success"],errorcode=>[0]})
}

View File

@ -246,6 +246,13 @@ sub process_request {
}
}
#restore the install.netboot of xcat dracut module
if(-e "$rootimg_dir/usr/lib/dracut/modules.d/97xcat/install"){
xCAT::Utils->runcmd("mv $rootimg_dir/usr/lib/dracut/modules.d/97xcat/install $rootimg_dir/.statebackup/install", 0, 1);
}
xCAT::Utils->runcmd("cp /opt/xcat/share/xcat/netboot/rh/dracut_033/install.netboot $rootimg_dir/usr/lib/dracut/modules.d/97xcat/install", 0, 1);
my $xcat_packimg_tmpfile = "/tmp/xcat_packimg.$$";
my $excludestr = "find . -xdev ";
my $includestr;
@ -439,6 +446,8 @@ sub process_request {
xCAT::Utils->runcmd("mv $rootimg_dir/.statebackup$filename $rootimg_dir$filename", 0, 1);
}
}
xCAT::Utils->runcmd("mv $rootimg_dir/.statebackup/install $rootimg_dir/usr/lib/dracut/modules.d/97xcat/install", 0, 1);
xCAT::Utils->runcmd("mv $rootimg_dir/.statebackup/statelite $rootimg_dir/etc/init.d/statelite", 0, 1);
xCAT::Utils->runcmd("rm -rf $rootimg_dir/.statebackup", 0, 1);
}

View File

@ -4,6 +4,7 @@ package xCAT_plugin::petitboot;
use File::Path;
use Getopt::Long;
use xCAT::Table;
use Sys::Syslog;
my $globaltftpdir = xCAT::TableUtils->getTftpDir();

View File

@ -33,6 +33,7 @@ my %allhostnames;
my %allbmcips;
my %allmacs;
my %allcecs;
my %alllparids;
my %allmacsupper;
my %allips;
my %allinstallips;
@ -425,6 +426,10 @@ Usage:
# Get all CEC names
$recordsref = xCAT::ProfiledNodeUtils->get_all_cecs(1);
%allcecs = %$recordsref;
# Get all LPAR ids
$recordsref = xCAT::ProfiledNodeUtils->get_all_lparids(\%allcecs);
%alllparids = %$recordsref;
#TODO: can not use getallnode to get rack infos.
$recordsref = xCAT::ProfiledNodeUtils->get_all_rack(1);
@ -804,38 +809,55 @@ Usage:
}
}
#fix 241844 issue, use local variable to store args_dict value
my $imageprofile = undef;
my $networkprofile = undef;
my $hardwareprofile = undef;
if(exists $args_dict{'imageprofile'}){
$imageprofile = $args_dict{'imageprofile'};
}
if(exists $args_dict{'networkprofile'}){
$networkprofile = $args_dict{'networkprofile'};
}
if(exists $args_dict{'hardwareprofile'}){
$hardwareprofile = $args_dict{'hardwareprofile'};
}
# After checking, all nodes' profile should be same
# Get the new profile with specified ones in args_dict
my $changeflag = 0;
my $profile_groups;
my $profile_status;
if(exists $args_dict{'networkprofile'}){
$profile_groups .= $args_dict{'networkprofile'}.",";
if ($args_dict{'networkprofile'} ne $nodeoldprofiles{'networkprofile'}){
if($networkprofile){
$profile_groups .= $networkprofile . ",";
if ($networkprofile ne $nodeoldprofiles{'networkprofile'}){
$changeflag = 1;
}else{
xCAT::MsgUtils->message('S', "Specified networkprofile is same with current value, ignore.");
delete($args_dict{'networkprofile'});
$networkprofile = undef;
}
}
if(exists $args_dict{'hardwareprofile'}){
$profile_groups .= $args_dict{'hardwareprofile'}.",";
if ($args_dict{'hardwareprofile'} ne $nodeoldprofiles{'hardwareprofile'}){
if($hardwareprofile){
$profile_groups .= $hardwareprofile . ",";
if ($hardwareprofile ne $nodeoldprofiles{'hardwareprofile'}){
$profile_status = 'defined';
$changeflag = 1;
}else{
xCAT::MsgUtils->message('S', "Specified hardwareprofile is same with current value, ignore.");
delete($args_dict{'hardwareprofile'});
$hardwareprofile = undef;
}
}
if(exists $args_dict{'imageprofile'}){
$profile_groups .= $args_dict{'imageprofile'}.",";
if ($args_dict{'imageprofile'} ne $nodeoldprofiles{'imageprofile'}){
if($imageprofile){
$profile_groups .= $imageprofile . ",";
if ($imageprofile ne $nodeoldprofiles{'imageprofile'}){
$profile_status = 'defined';
$changeflag = 1;
}else{
xCAT::MsgUtils->message('S', "Specified imageprofile is same with current value, ignore.");
delete($args_dict{'imageprofile'});
$imageprofile = undef;
}
}
# make sure there are something changed, otherwise we should quit without any changes.
@ -865,8 +887,8 @@ Usage:
# If network profile specified. Need re-generate IPs for all nodess again.
# As new design, ignore BMC/FSP NIC while reinstall nodes
if(exists $args_dict{'networkprofile'}){
my $newNetProfileName = $args_dict{'networkprofile'};
if($networkprofile){
my $newNetProfileName = $networkprofile;
my $oldNetProfileName = $nodeoldprofiles{'networkprofile'};
my $newNicsRef = xCAT::ProfiledNodeUtils->get_nodes_nic_attrs([$newNetProfileName])->{$newNetProfileName};
@ -904,10 +926,7 @@ Usage:
# hardware profile changed or
# image profile changed or
# network profile changed.
if ((exists $args_dict{'networkprofile'}) or
(exists $args_dict{'hardwareprofile'}) or
(exists $args_dict{'imageprofile'})){
if (($imageprofile) or ($networkprofile) or ($hardwareprofile)){
my $nodetypetab = xCAT::Table->new('nodetype');
my $firstnode = $nodes->[0];
my $profiles = xCAT::ProfiledNodeUtils->get_nodes_profiles([$firstnode], 1);
@ -919,7 +938,7 @@ Usage:
# If we have hardware changes, reconfigure everything including BMC.
my $chainret = 0;
my $chainstr = "";
if(exists $args_dict{'hardwareprofile'}){
if($hardwareprofile){
($chainret, $chainstr) = xCAT::ProfiledNodeUtils->gen_chain_for_profiles($profiles->{$firstnode}, 1);
} else {
($chainret, $chainstr) = xCAT::ProfiledNodeUtils->gen_chain_for_profiles($profiles->{$firstnode}, 0);
@ -933,6 +952,7 @@ Usage:
my %chainAttr = {};
foreach my $node (@$nodes){
$chainAttr{$node}{'chain'} = $chainstr;
$chainAttr{$node}{'currchain'} = '';
}
my $chaintab = xCAT::Table->new('chain', -create=>1);
$chaintab->setNodesAttribs(\%chainAttr);
@ -1124,14 +1144,18 @@ Usage:
$fsp_flag = 1;
$fspipsAttr{$node}{"hcp"} = $nextip;
}
}
}
}
# Add reserve nics
foreach my $nicname (@reserveNics){
my $oldip = $nodesNicsRef->{$node}->{$nicname}->{"ip"};
if ($oldip) {
$nicipsAttr{$node}{nicips} .= $nicname."!".$oldip.",";
}
my $count = index($nicipsAttr{$node}{nicips}, $nicname);
if($count < 0) {
my $oldip = $nodesNicsRef->{$node}->{$nicname}->{"ip"};
if ($oldip) {
$nicipsAttr{$node}{nicips} .= $nicname."!".$oldip.",";
}
}
}
}
@ -1278,26 +1302,50 @@ Usage:
my $nodelist = $request->{node};
my $hostname = $nodelist->[0];
# Validate MAC address
my $recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('mac', 'mac');
%allmacs = %$recordsref;
foreach (keys %allmacs){
my @hostentries = split(/\|/, $_);
foreach my $hostandmac ( @hostentries){
my ($macstr, $machostname) = split("!", $hostandmac);
$allmacs{$macstr} = 0;
if("__NOMAC__" eq $args_dict{"mac"}) {
# Validate if node is bind on a switch
my $switch_table = xCAT::Table->new("switch");
my @item = $switch_table->getAttribs({'node' => $hostname}, 'switch', 'port');
my $item_num = @item;
my $switch_valid = 0;
unless($item[0])
{
setrsp_errormsg("Failed to replace node <$hostname>. Switch information cannot be retrieved. Ensure that the switch is configured correctly.");
return;
} else {
foreach my $switch_item (@item){
if($switch_item->{'switch'} && $switch_item->{'port'}){
$switch_valid = 1;
}
}
}
unless ($switch_valid)
{
setrsp_errormsg("Failed to replace node <$hostname>. Switch information cannot be retrieved. Ensure that the switch is configured correctly.");
return;
}
} else {
#Validate MAC address
my $recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('mac', 'mac');
%allmacs = %$recordsref;
foreach (keys %allmacs){
my @hostentries = split(/\|/, $_);
foreach my $hostandmac ( @hostentries){
my ($macstr, $machostname) = split("!", $hostandmac);
$allmacs{$macstr} = 0;
}
}
%allmacsupper = ();
foreach (keys %allmacs){
$allmacsupper{uc($_)} = 0;
}
if (exists $allmacsupper{uc($args_dict{"mac"})}){
setrsp_errormsg("The specified MAC address $args_dict{'mac'} already exists. You must use a different MAC address.");
return;
} elsif(! xCAT::NetworkUtils->isValidMAC($args_dict{'mac'})) {
setrsp_errormsg("The specified MAC address $args_dict{'mac'} is invalid. You must use a valid MAC address.");
return;
}
}
%allmacsupper = ();
foreach (keys %allmacs){
$allmacsupper{uc($_)} = 0;
}
if (exists $allmacsupper{uc($args_dict{"mac"})}){
setrsp_errormsg("The specified MAC address $args_dict{'mac'} already exists. You must use a different MAC address.");
return;
} elsif(! xCAT::NetworkUtils->isValidMAC($args_dict{'mac'})){
setrsp_errormsg("The specified MAC address $args_dict{'mac'} is invalid. You must use a valid MAC address.");
return;
}
# re-create the chain record as updating mac may means for replacing a new brand hardware...
@ -1317,13 +1365,23 @@ Usage:
# Update database records.
setrsp_progress("Updating database...");
# MAC table
my $mactab = xCAT::Table->new('mac',-create=>1);
$mactab->setNodeAttribs($hostname, {mac=>$args_dict{'mac'}});
$mactab->close();
if("__NOMAC__" eq $args_dict{"mac"})
{
my $mactab = xCAT::Table->new('mac',-create=>1);
my %keyhash;
$keyhash{'node'} = $hostname;
$mactab->delEntries(\%keyhash);
$mactab->commit();
$mactab->close();
} else {
my $mactab = xCAT::Table->new('mac',-create=>1);
$mactab->setNodeAttribs($hostname, {mac=>$args_dict{'mac'}});
$mactab->close();
}
# DB update: chain table.
my $chaintab = xCAT::Table->new('chain', -create=>1);
$mactab->setNodeAttribs($hostname, {chain=>$chainstr});
$chaintab->setNodeAttribs($hostname, {chain=>$chainstr, currchain=>''});
$chaintab->close();
@ -1346,6 +1404,17 @@ Usage:
setrsp_progress("Warning: failed to call kit commands.");
}
if("__NOMAC__" eq $args_dict{"mac"})
{
setrsp_progress("Updating DHCP entries");
$retref = xCAT::Utils->runxcmd({command=>["makedhcp"], node=>[$hostname], arg=>['-d']}, $request_command, 0, 2);
$retref = {};
$retstrref = parse_runxcmd_ret($retref);
if ($::RUNCMD_RC != 0){
setrsp_progress("Warning: failed to call kit commands.");
}
}
setrsp_progress("Re-creating nodes...");
$retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>[$hostname], macflag=>[1]}, $request_command, 0, 2);
$retstrref = parse_runxcmd_ret($retref);
@ -2298,10 +2367,10 @@ sub validate_node_entry{
}
# Must specify either MAC, CEC or switch + port.
if (exists $node_entry{"mac"} ||
exists $node_entry{"switch"} && exists $node_entry{"switchport"} ||
exists $node_entry{"switches"} ||
exists $node_entry{"cec"}){
} else{
$errmsg .= "MAC address, cec, switch and port is not specified. You must specify the MAC address, CEC name or switch and port.\n";
$errmsg .= "MAC address, cec, switches is not specified. You must specify the MAC address, CEC name or switches.\n";
}
if (! xCAT::NetworkUtils->isValidHostname($node_name)){
@ -2435,10 +2504,20 @@ sub validate_node_entry{
$errmsg .= "The lparid option must be used with the cec option.\n";
}
}elsif ($_ eq "cec"){
my $cec_name = $node_entry{"cec"};
my $lpar_id = 1;
# Check the specified CEC is existing
if (! exists $allcecs{$node_entry{$_}}){
$errmsg .= "The CEC name $node_entry{$_} that is specified in the node information file is not defined in the system.\n";
}elsif (exists $node_entry{"lparid"}){
$lpar_id = $node_entry{"lparid"};
}
if (exists $alllparids{$cec_name}{$lpar_id}){
$errmsg .= "The CEC name $cec_name and LPAR id $lpar_id already exist in the database or in the nodeinfo file. You must use a new CEC name and LPAR id.\n";
}else{
$alllparids{$cec_name}{$lpar_id} = 0;
}
}elsif ($_ eq "nicips"){
# Check Multi-Nic's ip
my $othernics = $node_entry{$_};

View File

@ -1349,6 +1349,7 @@ sub mksysclone
my $clusterfile = "$installroot/sysclone/scripts/cluster.txt";
mkpath("$pspath");
copy("$installroot/postscripts/replace_byid_device","$pspath/11all.replace_byid_device");
copy("$installroot/postscripts/configefi","$pspath/15all.configefi");
copy("$installroot/postscripts/updatenetwork","$pspath/16all.updatenetwork");
copy("$installroot/postscripts/runxcatpost","$pspath/17all.runxcatpost");
@ -1361,11 +1362,11 @@ sub mksysclone
copy("/var/lib/systemimager/scripts/post-install/10all.fix_swap_uuids","$pspath");
}
unless (-r "$pspath/11all.replace_byid_device")
{
mkpath("$pspath");
copy("/var/lib/systemimager/scripts/post-install/11all.replace_byid_device","$pspath");
}
#unless (-r "$pspath/11all.replace_byid_device")
#{
# mkpath("$pspath");
# copy("/var/lib/systemimager/scripts/post-install/11all.replace_byid_device","$pspath");
#}
unless (-r "$pspath/95all.monitord_rebooted")
{
@ -1481,6 +1482,18 @@ sub mksysclone
}
$kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename";
my $nodetab = xCAT::Table->new('nodetype');
my $archref = $nodetab->getNodeAttribs($node, ['arch']);
if ($archref->{arch} eq "ppc64"){
my $mactab = xCAT::Table->new('mac');
my $macref = $mactab->getNodeAttribs($node, ['mac']);
my $formatmac = $macref->{mac};
$formatmac =~ s/:/-/g;
$formatmac = "01-".$formatmac;
$kcmdline .= " BOOTIF=$formatmac ";
}
my $i = "xcat/genesis.fs.$arch.gz";
if ( -r "$tftpdir/xcat/genesis.fs.$arch.lzma" ){
$i = "xcat/genesis.fs.$arch.lzma";

View File

@ -1063,7 +1063,7 @@ sub is_redhat6sp4
=head3 initDB
Will initialize the DB if it does not already exist, also updates with
new data needed or database changes during xCAT update install.
new data needed or database changes during xCAT install.
=cut
@ -1210,6 +1210,7 @@ sub initDB
$chtabcmds .= "$::XCATROOT/sbin/chtab key=vsftp site.value=n;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=cleanupxcatpost site.value=no;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=dhcplease site.value=43200;";
$chtabcmds .= "$::XCATROOT/sbin/chtab key=auditnosyslog site.value=0;";
#$chtabcmds .= "$::XCATROOT/sbin/chtab key=useflowcontrol site.value=yes;"; # need to fix 4031
if ($::osname eq 'AIX')

View File

@ -0,0 +1,13 @@
#Please make sure there is a space between @ and group name
wget
ntp
nfs-utils
net-snmp
rsync
yp-tools
openssh-server
util-linux-ng
net-tools
libvirt
screen
qemu-kvm

View File

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

View File

@ -0,0 +1 @@
xcat/xcat-dep/rh5/x86_64/systemimager-client

View File

@ -0,0 +1 @@
xcat/xcat-dep/rh6/ppc64/systemimager-client

View File

@ -0,0 +1 @@
xcat/xcat-dep/rh7/ppc64/systemimager-client

View File

@ -0,0 +1 @@
xcat/xcat-dep/rh7/x86_64/systemimager-client

View File

@ -94,7 +94,7 @@ cd /xcatpost
export PATH=$PATH:/xcatpost
# use the run_ps subroutine to run the postscripts
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`
TMP=`sed "/^#\s*postscripts-start-here/,/^#\s*postscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`
echo "
# global value to store the running status of the postbootscripts,the value is non-zero if one postbootscript failed
return_value=0
@ -125,12 +125,12 @@ run_ps () {
" > /xcatpost/mypostscript
echo "$TMP" >> /xcatpost/mypostscript
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`
TMP=`sed "/^#\s*postbootscripts-start-here/,/^#\s*postbootscripts-end-here/ s/\(.*\)/run_ps \1/;s/run_ps\s*#/#/;s/run_ps\s*$//" /xcatpost/mypostscript`
echo "$TMP" > /xcatpost/mypostscript
#save the postboot scripts to /xcatpost/mypostscript.post
TMP=`sed "/postscripts-start-here/,/postscripts-end-here/ d" /xcatpost/mypostscript`
TMP=`sed "/^#\s*postscripts-start-here/,/^#\s*postscripts-end-here/ d" /xcatpost/mypostscript`
echo "$TMP" > /xcatpost/mypostscript.post
chmod 755 /xcatpost/mypostscript.post
@ -173,7 +173,7 @@ EOF
chmod 755 /opt/xcat/xcatdsklspost
#only run the prebooot scripts here
TMP=`sed "/postbootscripts-start-here/,/postbootscripts-end-here/ d" /xcatpost/mypostscript`
TMP=`sed "/^#\s*postbootscripts-start-here/,/^#\s*postbootscripts-end-here/ d" /xcatpost/mypostscript`
echo "$TMP" > /xcatpost/mypostscript
export NODE=#TABLE:nodelist:THISNODE:node#

View File

@ -0,0 +1 @@
xcat/xcat-dep/sles11/ppc64/systemimager-client

View File

@ -1 +1 @@
../rh/compute.rhels6.pkglist
../rh/compute.rhels6.x86_64.pkglist

View File

@ -0,0 +1 @@
../../rh/dracut/xcat-premount.sh

View File

@ -0,0 +1 @@
../../rh/dracut/xcat-updateflag

View File

@ -20,6 +20,6 @@ e2fsprogs
bc
lsvpd
irqbalance
procps
procps-ng
parted
net-tools

View File

@ -9,7 +9,7 @@ openssh-clients
iputils
bc
irqbalance
procps
procps-ng
wget
vim-minimal
ntp

View File

@ -543,6 +543,11 @@ if (@new_order) {
@ndrivers = (@new_order, @ndrivers);
}
if (-f "$rootimg_dir/lib/modules/$kernelver/kernel/drivers/net/ethernet/mellanox/mlx4/mlx4_en.ko") {
for (@ndrivers) {
s/mlx_en/mlx4_en/;
}
}
open($moddeps,"<","$rootimg_dir/lib/modules/$kernelver/modules.dep");
my @moddeps = <$moddeps>;
my @checkdeps = @ndrivers;

179
xCAT-server/share/xcat/tools/xCATreg Normal file → Executable file
View File

@ -43,6 +43,7 @@ my $branch = 0;
my $testconfigfile = "$rootdir/default.conf";
my $configfile = "/regression/default.conf";
my $MN = undef;
my $confdir = "/regression/confdir";
my $management_node = undef;
my $CN = undef;
my $output = undef;
@ -378,21 +379,23 @@ sub config_test {
}
}
}
&runcmd ("touch default.conf");
&runcmd ("touch defaultslesppc64.conf");
&runcmd ("touch defaultrhx8664.conf");
&runcmd ("touch defaultslesx8664.conf");
&runcmd ("touch defaultubux8664.conf");
&runcmd ("rm -rf $confdir/*");
&runcmd ("touch $confdir/default.conf");
&runcmd ("touch $confdir/defaultslesppc64.conf");
&runcmd ("touch $confdir/defaultrhx8664.conf");
&runcmd ("touch $confdir/defaultslesx8664.conf");
&runcmd ("touch $confdir/defaultubux8664.conf");
if(exists $rhppc64config{object}){
foreach my $type (keys %{$rhppc64config{object}}){
foreach my $name (keys %{$rhppc64config{object}{$type}}){
send_msg(2, "OBJECT:$name,TYPE:$type");
&runcmd( " echo [Object_$type]>>default.conf");
&runcmd( " echo Name=$name>>default.conf");
&runcmd( " echo [Object_$type]>>$confdir/default.conf");
&runcmd( " echo Name=$name>>$confdir/default.conf");
#print "$name,TYPE:$type \n";
foreach my $attr (keys %{$rhppc64config{object}{$type}{$name}}){
send_msg(2, " $attr = $rhppc64config{object}{$type}{$name}{$attr};");
&runcmd( " echo $attr=$rhppc64config{object}{$type}{$name}{$attr}>>default.conf");
&runcmd( " echo $attr=$rhppc64config{object}{$type}{$name}{$attr}>>$confdir/default.conf");
}
}
}
@ -401,12 +404,12 @@ sub config_test {
foreach my $type (keys %{$slesppc64config{object}}){
foreach my $name (keys %{$slesppc64config{object}{$type}}){
send_msg(2, "OBJECT:$name,TYPE:$type");
&runcmd( " echo [Object_$type]>>defaultslesppc64.conf");
&runcmd( " echo Name=$name>>defaultslesppc64.conf");
&runcmd( " echo [Object_$type]>>$confdir/defaultslesppc64.conf");
&runcmd( " echo Name=$name>>$confdir/defaultslesppc64.conf");
#print "$name,TYPE:$type \n";
foreach my $attr (keys %{$slesppc64config{object}{$type}{$name}}){
send_msg(2, " $attr = $slesppc64config{object}{$type}{$name}{$attr};");
&runcmd( " echo $attr=$slesppc64config{object}{$type}{$name}{$attr}>>defaultslesppc64.conf");
&runcmd( " echo $attr=$slesppc64config{object}{$type}{$name}{$attr}>>$confdir/defaultslesppc64.conf");
}
}
}
@ -415,12 +418,12 @@ sub config_test {
foreach my $type (keys %{$rhx8664config{object}}){
foreach my $name (keys %{$rhx8664config{object}{$type}}){
send_msg(2, "OBJECT:$name,TYPE:$type");
&runcmd( " echo [Object_$type]>>defaultrhx8664.conf");
&runcmd( " echo Name=$name>>defaultrhx8664.conf");
&runcmd( " echo [Object_$type]>>$confdir/defaultrhx8664.conf");
&runcmd( " echo Name=$name>>$confdir/defaultrhx8664.conf");
#print "$name,TYPE:$type \n";
foreach my $attr (keys %{$rhx8664config{object}{$type}{$name}}){
send_msg(2, " $attr = $rhx8664config{object}{$type}{$name}{$attr};");
&runcmd( " echo $attr=$rhx8664config{object}{$type}{$name}{$attr}>>defaultrhx8664.conf");
&runcmd( " echo $attr=$rhx8664config{object}{$type}{$name}{$attr}>>$confdir/defaultrhx8664.conf");
}
}
}
@ -429,12 +432,12 @@ sub config_test {
foreach my $type (keys %{$slesx8664config{object}}){
foreach my $name (keys %{$slesx8664config{object}{$type}}){
send_msg(2, "OBJECT:$name,TYPE:$type");
&runcmd( " echo [Object_$type]>>defaultslesx8664.conf");
&runcmd( " echo Name=$name>>defaultslesx8664.conf");
&runcmd( " echo [Object_$type]>>$confdir/defaultslesx8664.conf");
&runcmd( " echo Name=$name>>$confdir/defaultslesx8664.conf");
#print "$name,TYPE:$type \n";
foreach my $attr (keys %{$slesx8664config{object}{$type}{$name}}){
send_msg(2, " $attr = $slesx8664config{object}{$type}{$name}{$attr};");
&runcmd( " echo $attr=$slesx8664config{object}{$type}{$name}{$attr}>>defaultslesx8664.conf");
&runcmd( " echo $attr=$slesx8664config{object}{$type}{$name}{$attr}>>$confdir/defaultslesx8664.conf");
}
}
}
@ -443,12 +446,12 @@ sub config_test {
foreach my $type (keys %{$ubux8664config{object}}){
foreach my $name (keys %{$ubux8664config{object}{$type}}){
send_msg(2, "OBJECT:$name,TYPE:$type");
&runcmd( " echo [Object_$type]>>defaultubux8664.conf");
&runcmd( " echo Name=$name>>defaultubux8664.conf");
&runcmd( " echo [Object_$type]>>$confdir/defaultubux8664.conf");
&runcmd( " echo Name=$name>>$confdir/defaultubux8664.conf");
#print "$name,TYPE:$type \n";
foreach my $attr (keys %{$ubux8664config{object}{$type}{$name}}){
send_msg(2, " $attr = $ubux8664config{object}{$type}{$name}{$attr};");
&runcmd( " echo $attr=$ubux8664config{object}{$type}{$name}{$attr}>>defaultubux8664.conf");
&runcmd( " echo $attr=$ubux8664config{object}{$type}{$name}{$attr}>>$confdir/defaultubux8664.conf");
}
}
}
@ -457,17 +460,17 @@ sub config_test {
if(exists $rhppc64config{table}){
foreach my $type (keys %{$rhppc64config{table}}){
send_msg(2, "TABLE:$type");
&runcmd( " echo [Table_$type]>>default.conf");
&runcmd( " echo [Table_$type]>>$confdir/default.conf");
#&runcmd( " echo key=$type>>default.conf");
#&runcmd( " echo [Table_site]>>default.conf");
#&runcmd( " echo key=$type>>default.conf");
foreach my $name (keys %{$rhppc64config{table}{$type}}){
send_msg(2, " $rhppc64config{table}{$type}{$name}{__KEY__} = $name");
&runcmd( " echo $rhppc64config{table}{$type}{$name}{__KEY__}=$name>>default.conf");
&runcmd( " echo $rhppc64config{table}{$type}{$name}{__KEY__}=$name>>$confdir/default.conf");
foreach my $attr (keys %{$rhppc64config{table}{$type}{$name}}){
if($attr ne '__KEY__'){
send_msg(2, " $attr = $rhppc64config{table}{$type}{$name}{$attr}");
&runcmd( " echo $attr=$rhppc64config{table}{$type}{$name}{$attr}>>default.conf");
&runcmd( " echo $attr=$rhppc64config{table}{$type}{$name}{$attr}>>$confdir/default.conf");
}
}
send_msg(2, "\n");
@ -477,17 +480,17 @@ sub config_test {
if(exists $slesppc64config{table}){
foreach my $type (keys %{$slesppc64config{table}}){
send_msg(2, "TABLE:$type");
&runcmd( " echo [Table_$type]>>defaultslesppc64.conf");
&runcmd( " echo [Table_$type]>>$confdir/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(2, " $slesppc64config{table}{$type}{$name}{__KEY__} = $name");
&runcmd( " echo $slesppc64config{table}{$type}{$name}{__KEY__}=$name>>defaultslesppc64.conf");
&runcmd( " echo $slesppc64config{table}{$type}{$name}{__KEY__}=$name>>$confdir/defaultslesppc64.conf");
foreach my $attr (keys %{$slesppc64config{table}{$type}{$name}}){
if($attr ne '__KEY__'){
send_msg(2, " $attr = $slesppc64config{table}{$type}{$name}{$attr}");
&runcmd( " echo $attr=$slesppc64config{table}{$type}{$name}{$attr}>>defaultslesppc64.conf");
&runcmd( " echo $attr=$slesppc64config{table}{$type}{$name}{$attr}>>$confdir/defaultslesppc64.conf");
}
}
send_msg(2, "\n");
@ -497,17 +500,17 @@ sub config_test {
if(exists $rhx8664config{table}){
foreach my $type (keys %{$rhx8664config{table}}){
send_msg(2, "TABLE:$type");
&runcmd( " echo [Table_$type]>>defaultrhx8664.conf");
&runcmd( " echo [Table_$type]>>$confdir/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(2, " $rhx8664config{table}{$type}{$name}{__KEY__} = $name");
&runcmd( " echo $rhx8664config{table}{$type}{$name}{__KEY__}=$name>>defaultrhx8664.conf");
&runcmd( " echo $rhx8664config{table}{$type}{$name}{__KEY__}=$name>>$confdir/defaultrhx8664.conf");
foreach my $attr (keys %{$rhx8664config{table}{$type}{$name}}){
if($attr ne '__KEY__'){
send_msg(2, " $attr = $rhx8664config{table}{$type}{$name}{$attr}");
&runcmd( " echo $attr=$rhx8664config{table}{$type}{$name}{$attr}>>defaultrhx8664.conf");
&runcmd( " echo $attr=$rhx8664config{table}{$type}{$name}{$attr}>>$confdir/defaultrhx8664.conf");
}
}
send_msg(2, "\n");
@ -517,17 +520,17 @@ sub config_test {
if(exists $slesx8664config{table}){
foreach my $type (keys %{$slesx8664config{table}}){
send_msg(2, "TABLE:$type");
&runcmd( " echo [Table_$type]>>defaultslesx8664.conf");
&runcmd( " echo [Table_$type]>>$confdir/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(2, " $slesx8664config{table}{$type}{$name}{__KEY__} = $name");
&runcmd( " echo $slesx8664config{table}{$type}{$name}{__KEY__}=$name>>defaultslesx8664.conf");
&runcmd( " echo $slesx8664config{table}{$type}{$name}{__KEY__}=$name>>$confdir/defaultslesx8664.conf");
foreach my $attr (keys %{$slesx8664config{table}{$type}{$name}}){
if($attr ne '__KEY__'){
send_msg(2, " $attr = $slesx8664config{table}{$type}{$name}{$attr}");
&runcmd( " echo $attr=$slesx8664config{table}{$type}{$name}{$attr}>>defaultslesx8664.conf");
&runcmd( " echo $attr=$slesx8664config{table}{$type}{$name}{$attr}>>$confdir/defaultslesx8664.conf");
}
}
send_msg(2, "\n");
@ -537,17 +540,17 @@ sub config_test {
if(exists $ubux8664config{table}){
foreach my $type (keys %{$ubux8664config{table}}){
send_msg(2, "TABLE:$type");
&runcmd( " echo [Table_$type]>>defaultubux8664.conf");
&runcmd( " echo [Table_$type]>>$confdir/defaultubux8664.conf");
#&runcmd( " echo key=$type>>default.conf");
#&runcmd( " echo [Table_site]>>default.conf");
#&runcmd( " echo key=$type>>default.conf");
foreach my $name (keys %{$ubux8664config{table}{$type}}){
send_msg(2, " $ubux8664config{table}{$type}{$name}{__KEY__} = $name");
&runcmd( " echo $ubux8664config{table}{$type}{$name}{__KEY__}=$name>>defaultubux8664.conf");
&runcmd( " echo $ubux8664config{table}{$type}{$name}{__KEY__}=$name>>$confdir/defaultubux8664.conf");
foreach my $attr (keys %{$ubux8664config{table}{$type}{$name}}){
if($attr ne '__KEY__'){
send_msg(2, " $attr = $ubux8664config{table}{$type}{$name}{$attr}");
&runcmd( " echo $attr=$ubux8664config{table}{$type}{$name}{$attr}>>defaultubux8664.conf");
&runcmd( " echo $attr=$ubux8664config{table}{$type}{$name}{$attr}>>$confdir/defaultubux8664.conf");
}
}
send_msg(2, "\n");
@ -574,10 +577,10 @@ sub config_test {
#&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts");
#print "MN is $MN\n";}
send_msg(2, "Varible:");
&runcmd( " echo [System]>>default.conf");
&runcmd( " echo [System]>>$confdir/default.conf");
foreach my $varname (keys %{$rhppc64config{var}}){
send_msg(2, " $varname = $rhppc64config{var}{$varname}");
&runcmd( " echo $varname=$rhppc64config{var}{$varname}>>default.conf");
&runcmd( " echo $varname=$rhppc64config{var}{$varname}>>$confdir/default.conf");
#print "var is $rhppc64config{var}\n";
}
}
@ -587,10 +590,10 @@ sub config_test {
#&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts");
#print "MN is $MN\n";}
send_msg(2, "Varible:");
&runcmd( " echo [System]>>defaultslesppc64.conf");
&runcmd( " echo [System]>>$confdir/defaultslesppc64.conf");
foreach my $varname (keys %{$slesppc64config{var}}){
send_msg(2, " $varname = $slesppc64config{var}{$varname}");
&runcmd( " echo $varname=$slesppc64config{var}{$varname}>>defaultslesppc64.conf");
&runcmd( " echo $varname=$slesppc64config{var}{$varname}>>$confdir/defaultslesppc64.conf");
#print "var is $slesppc64config{var}\n";
}
}
@ -600,10 +603,10 @@ sub config_test {
#&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts");
#print "MN is $MN\n";}
send_msg(2, "Varible:");
&runcmd( " echo [System]>>defaultrhx8664.conf");
&runcmd( " echo [System]>>$confdir/defaultrhx8664.conf");
foreach my $varname (keys %{$rhx8664config{var}}){
send_msg(2, " $varname = $rhx8664config{var}{$varname}");
&runcmd( " echo $varname=$rhx8664config{var}{$varname}>>defaultrhx8664.conf");
&runcmd( " echo $varname=$rhx8664config{var}{$varname}>>$confdir/defaultrhx8664.conf");
#print "var is $rhppc64config{var}\n";
}
}
@ -613,10 +616,10 @@ sub config_test {
#&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts");
#print "MN is $MN\n";}
send_msg(2, "Varible:");
&runcmd( " echo [System]>>defaultslesx8664.conf");
&runcmd( " echo [System]>>$confdir/defaultslesx8664.conf");
foreach my $varname (keys %{$slesx8664config{var}}){
send_msg(2, " $varname = $slesx8664config{var}{$varname}");
&runcmd( " echo $varname=$slesx8664config{var}{$varname}>>defaultslesx8664.conf");
&runcmd( " echo $varname=$slesx8664config{var}{$varname}>>$confdir/defaultslesx8664.conf");
#print "var is $rhppc64config{var}\n";
}
}
@ -626,10 +629,10 @@ sub config_test {
#&runcmd( "echo $MN $MN.$DOMAIN $MNIP>>/etc/hosts");
#print "MN is $MN\n";}
send_msg(2, "Varible:");
&runcmd( " echo [System]>>defaultubux8664.conf");
&runcmd( " echo [System]>>$confdir/defaultubux8664.conf");
foreach my $varname (keys %{$ubux8664config{var}}){
send_msg(2, " $varname = $ubux8664config{var}{$varname}");
&runcmd( " echo $varname=$ubux8664config{var}{$varname}>>defaultubux8664.conf");
&runcmd( " echo $varname=$ubux8664config{var}{$varname}>>$confdir/defaultubux8664.conf");
#print "var is $rhppc64config{var}\n";
}
}
@ -647,6 +650,8 @@ sub git_update {
my $lastcommit;
my $commitlog1;
my $lastcommitfile;
my $codedir;
$codedir="/regression/code/xcat-core";
my $gitup;
$gitup="/tmp/gitup";
@ -659,6 +664,8 @@ sub git_update {
# exit;
#}
chdir $codedir;
$res = system("git checkout $branch");
if ($res != 0){
send_msg(0, "git checkout failed");
@ -800,27 +807,36 @@ sub config_mn {
sub gettestinfo {
my $mn = shift;
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 ";
my $osinfoconf = "/regression/lsbinfo";
runcmd("xdsh $mn lsb_release -a > $osinfoconf");
send_msg(2, "=============gettestinf==============");
my $os = 2;
my $osenv = 2;
my $osubu = 2;
$os = system("cat $osinfoconf |grep RedHat");
$osenv = system("cat $osinfoconf |grep ppc64");
$osubu = system("cat $configfile |grep Ubuntu");
if (($osenv == 0)&&($os == 0)){
$testenvinfo = "rhppc64";
}elsif ( $osinfo [2] =~ /SUSE Linux Enterprise Server 11/ && $osinfo [2] =~ /ppc64/){
print " MN info is sles 11.3 ppc64 ";
print "MN osinfo is $testenvinfo";
}elsif (($osenv == 0)&&($os == 256)){
$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";
print "MN osinfo is $testenvinfo";
}elsif (($osenv == 256)&&($os == 0)){
$testenvinfo = "rhx8664";
}elsif ( $osinfo [1] =~ /Ubuntu/ && $osinfo [1] =~ /12.04/){
print "MN info is Ubuntu 12.04 x86_64 \n";
print "MN osinfo is $testenvinfo";
}elsif (($osenv == 256)&&($os == 256)){
$testenvinfo = "slesx8664";
print "MN osinfo is $testenvinfo";
}elsif ($osubu == 0){
$testenvinfo = "ubux8664";
}else
{print "no machine info ";}
print "MN osinfo is $testenvinfo";
}
else
{
send_msg(0, "no machine info");
}
send_msg(2, "testenvinfo is $testenvinfo");
return $testenvinfo;
}
@ -829,6 +845,8 @@ sub init
my $mn = shift;
my $MN=$mn;
my $envoutput = &gettestinfo($mn);
send_msg(2, "****************************** MNinit is $mn ");
send_msg(2, "==================in init function================");
if ($envoutput eq 'rhppc64'){
my $nodedir=$confkeys{rhpdir};
my $iso=$rhppc64config{var}{ISO};
@ -843,7 +861,7 @@ sub init
print "--get the latest XCAT tarball.......\n";
$res = system("scp -r $nodedir/xcat-dep $MN:/");
&repo();
system("scp -r rhel6.5.repo $MN:/etc/yum.repos.d/rhel6.5.repo");
system("scp -r $confdir/rhel6.5.repo $MN:/etc/yum.repos.d/rhel6.5.repo");
system("xdsh $MN perl /xcat-dep/rh6/ppc64/mklocalrepo.sh");
print "--install XCAT .......\n";
system("xdsh $MN rpm --import /iso/mountpoint/RPM-GPG-KEY-redhat-release");
@ -852,12 +870,10 @@ 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:$testconfigfile");
system("rm -rf default.conf");
system("rm -rf rhel6.5.repo");
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 sysctl -n net.ipv4.ip_forward=1");
system("scp -r $confdir/default.conf $MN:$testconfigfile");
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 sysctl -n net.ipv4.ip_forward=1");
$res = system("xdsh $MN source /etc/profile.d/xcat.sh");
#if ($res != 0){
#send_msg(0, "install xCAT failed on rhpmn");
@ -893,8 +909,7 @@ sub init
system("xdsh $MN zypper -n install xCAT");
system("xdsh $MN zypper -n install xCAT-test");
system("xdsh $MN zypper -n install lsb");
system("scp -r defaultslesppc64.conf $MN:$testconfigfile");
system("rm -rf defaultslesppc64.conf");
system("scp -r $confdir/defaultslesppc64.conf $MN:$testconfigfile");
print "--prepare test environment....\n";
print "[OK]\n";
}elsif ($envoutput eq 'rhx8664'){
@ -912,7 +927,7 @@ sub init
print "--get the latest XCAT tarball.......\n";
system("scp -r $nodedir/xcat-dep $MN:/");
&repo();
system("scp -r rhel6.5.repo $MN:/etc/yum.repos.d/");
system("scp -r $confdir/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");
@ -925,9 +940,7 @@ sub init
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");
system("rm -rf defaultrhx8664.conf");
system("rm -rf rhel6.5.repo");
system("scp -r $confdir/defaultrhx8664.conf $MN:$testconfigfile");
}elsif ($envoutput eq 'slesx8664'){
my $nodedir=$confkeys{slesxdir};
my $iso=$slesx8664config{var}{ISO};
@ -954,8 +967,7 @@ sub init
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");
system("rm -rf defaultslesx8664.conf");
system("scp -r $confdir/defaultslesx8664.conf $MN:$testconfigfile");
print "--prepare vmslestest environment....\n";
print "[OK]\n";
}elsif ($envoutput eq 'ubux8664'){
@ -992,10 +1004,9 @@ sub init
system("xdsh $MN source /etc/profile.d/xcat.sh");
system("xdsh $MN apt-get install xcat-test");
print "--prepare test environment....\n";
system("scp -r defaultubux8664.conf $MN:$testconfigfile");
system("scp -r $confdir/defaultubux8664.conf $MN:$testconfigfile");
print "--prepare vmubuntu test environment....\n";
print "[OK]\n";}
system("rm -rf default*.conf");
return 0;
}
#######################################
@ -1181,11 +1192,11 @@ sub trim {
#repo
####################################
sub 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");
&runcmd( " echo [rhe-6.5-server]>>$confdir/rhel6.5.repo");
&runcmd( " echo name=RHEL 6.5 SERVER packages>>$confdir/rhel6.5.repo");
&runcmd(" echo baseurl=file:///iso/mountpoint/Server/>>$confdir/rhel6.5.repo");
&runcmd(" echo enabled=1>>$confdir/rhel6.5.repo");
&runcmd(" echo gpgcheck=1>>$confdir/rhel6.5.repo");
}

View File

@ -1,6 +1,6 @@
start:copycds_iso
os:Linux
cmd:umount /mnt/xcat
#cmd:umount /mnt/xcat
cmd:copycds $$ISO
check:rc==0
check:output=~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__
@ -11,7 +11,7 @@ end
start:copycds_n
os:Linux
cmd:umount /mnt/xcat
#cmd:umount /mnt/xcat
cmd:copycds -n __GETNODEATTR($$CN,os)__ $$ISO
check:rc==0
check:output=~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__
@ -22,7 +22,7 @@ end
start:copycds_a
os:Linux
cmd:umount /mnt/xcat
#cmd:umount /mnt/xcat
cmd:copycds -a __GETNODEATTR($$CN,arch)__ $$ISO
check:rc==0
check:output=~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__
@ -33,7 +33,7 @@ end
start:copycds_n_a
os:Linux
cmd:umount /mnt/xcat
#cmd:umount /mnt/xcat
cmd:copycds -n __GETNODEATTR($$CN,os)__ -a __GETNODEATTR($$CN,arch)__ $$ISO
check:rc==0
check:output=~Copying media to /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__
@ -44,14 +44,14 @@ end
start:copycds_a_err
os:Linux
cmd:umount /mnt/xcat
#cmd:umount /mnt/xcat
cmd:copycds -a 386 $$ISO
check:output=~Error
end
start:copycds_n_err
os:Linux
cmd:umount /mnt/xcat
#cmd:umount /mnt/xcat
cmd:copycds -n aix $$ISO
check:rc!=0
check:output=~Error

View File

@ -8,7 +8,7 @@ start:node_post2
description: node_post2
cmd:restapitest -m POST -r /nodes/node1 -d '{"groups":"all","mgt":"dfm","netboot":"yaboot"}'
check:rc==403
cmdcheck:restapitest -o '{"errorcode":"1","error":["\nA definition for 'node1' already exists."]}' -O =~
cmdcheck:restapitest -o '{"errorcode":"1"}' -O ==
end
@ -36,7 +36,7 @@ end
start:node_delete
description: node_delete
cmd:restapitest -m GET -r /nodes/node1
cmd:restapitest -m DELETE -r /nodes/node1
check:rc==200
end
@ -51,7 +51,7 @@ start:node_get2
description: node_get2
cmd:restapitest -m GET -r /nodes/node1
check:rc==403
cmdcheck:restapitest -o '{"errorcode":"1","error":["Could not find an object named 'node1' of type 'node'."]}' -O =~
cmdcheck:restapitest -o '{"errorcode":"1"}' -O ==
end
start:node_post3_for_get_test
@ -67,7 +67,6 @@ check:rc==200
cmdcheck:restapitest -o '{"node1":{"netboot":"yaboot"}}' -O ==
end
###########此次需先添加networks表和hosts表的net和ip属性
start:node_makehosts
description: node_makehosts
cmd:restapitest -m POST -r /nodes/node1/host
@ -121,70 +120,70 @@ end
start:node_scan
description: node_scan
cmd:restapitest -m GET -r /nodes/e108m6hmc02/subnodes
cmd:restapitest -m GET -r /nodes/__GETNODEATTR($$CN,hcp)__
check:rc==200
cmdcheck:restapitest -o '{"Vc68m4hsp01":{"parent":"Server-9119-590-SN02C5F9E"}}' -O ==
cmdcheck:restapitest -o '{"__GETNODEATTR($$CN,hcp)__":"ANY"}' -O ==
end
start:node_power_get
description: node_power_get
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/power
cmd:restapitest -m GET -r /nodes/$$CN/power
check:rc==200
cmdcheck:restapitest -o '{"Vc68m5sn01":{"power":"ANY"}}' -O ==
cmdcheck:restapitest -o '{"$$CN":{"power":"ANY"}}' -O ==
end
start:node_power_put
description: node_power_put
cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/power -d '{"action":"on"}'
description: node_power_reset
cmd:restapitest -m PUT -r /nodes/$$CN/power -d '{"action":"reset"}'
check:rc==200
end
start:node_energy_put
description: node_energy_put
cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/energy -d '{"cappingstatus":"on"}'
check:rc==200
end
#start:node_energy_put
#description: node_energy_put
#cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/energy -d '{"cappingstatus":"on"}'
#check:rc==200
#end
start:node_energy_get
description: node_energy_get
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy
check:rc==200
cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"on"}}' -O ==
end
#start:node_energy_get
#description: node_energy_get
#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy
#check:rc==200
#cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"on"}}' -O ==
#end
start:node_energy_get_attr
description: node_energy_get_attr
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy/cappingmaxmin,cappingstatus
check:rc==200
cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"ANY"}}' -O ==
end
#start:node_energy_get_attr
#description: node_energy_get_attr
#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/energy/cappingmaxmin,cappingstatus
#check:rc==200
#cmdcheck:restapitest -o '{"Vc68m5sn01":{"cappingmin":"ANY"}}' -O ==
#end
start:node_get_attr
description: node_get_attr
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/sp/community
check:rc==200
cmdcheck:restapitest -o '{"Vc68m5sn01":{"SP SNMP Community":"public"}}' -O ==
end
#start:node_get_attr
#description: node_get_attr
#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/sp/community
#check:rc==200
#cmdcheck:restapitest -o '{"Vc68m5sn01":{"SP SNMP Community":"public"}}' -O ==
#end
start:node_put_attr
description: node_put_attr
cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/sp/community -d '{"value":"mycommunity"}''
check:rc==200
end
#start:node_put_attr
#description: node_put_attr
#cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/sp/community -d '{"value":"mycommunity"}''
#check:rc==200
#end
start:node_put_nextboot
description: node_put_nextboot
cmd:restapitest -m PUT -r /nodes/Vc68m5sn01/nextboot -d '{"order":"net"}'
check:rc==201
end
#start:node_put_nextboot
#description: node_put_nextboot
#cmd:restapitest -m PUT -r /nodes/$$CN/nextboot -d '{"order":"net"}'
#check:rc==201
#end
start:node_get_nextboot
description: node_get_nextboot
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/nextboot
check:rc==200
cmdcheck:restapitest -o '{"Vc68m5sn01":{"nextboot":"net"}}' -O ==
end
#start:node_get_nextboot
#description: node_get_nextboot
#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/nextboot
#check:rc==200
#cmdcheck:restapitest -o '{"Vc68m5sn01":{"nextboot":"net"}}' -O ==
#end
start:node_put_bootstate
description: node_put_bootstate
@ -194,9 +193,9 @@ end
start:node_get_bootstate
description: node_get_bootstate
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/bootstate
cmd:restapitest -m GET -r /nodes/$$CN/bootstate
check:rc==200
cmdcheck:restapitest -o '{"Vc68m5sn01":{"bootstat":"boot"}}' -O ==
cmdcheck:restapitest -o '{"$$CN":{"bootstat":"ANY"}}' -O ==
end
start:node_get_vitals
@ -208,9 +207,9 @@ end
start:node_get_vitals_attr
description: node_get_vitals_attr
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/vitals/fanspeed
cmd:restapitest -m GET -r /nodes/$$CN/vitals/all
check:rc==200
cmdcheck:restapitest -o '{"Vc68m5sn01":{"Fan 1A Tach":"3219 RPM"}}' -O ==
cmdcheck:restapitest -o '{"$$CN":{"System Temperature":"ANY"}}' -O ==
end
start:node_get_inventory
@ -227,16 +226,16 @@ check:rc==200
cmdcheck:restapitest -o '{"Vc68m5sn01":{"System Description":"System x3650 M4"}}' -O ==
end
start:node_get_eventlog
description: node_get_eventlog
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/eventlog
check:rc==200
cmdcheck:restapitest -o '{"Vc68m5sn01":{"eventlog":"ANY"}}' -O ==
end
#start:node_get_eventlog
#description: node_get_eventlog
#cmd:restapitest -m GET -r /nodes/Vc68m5sn01/eventlog
#check:rc==200
#cmdcheck:restapitest -o '{"Vc68m5sn01":{"eventlog":"ANY"}}' -O ==
#end
start:node_post_nodecopy
description: node_post_nodecopy
cmd:restapitest -m GET -r /nodes/Vc68m5sn01/nodecopy -d '{"src":["/tmp/f1","/tmp/f2"],"target":"/tmp"}'
cmd:restapitest -m POST -r /nodes/$$CN/nodecopy -d '{"src":["/etc/hosts","/etc/resolv.conf"],"target":"/tmp"}'
check:rc==201
end

View File

@ -29,7 +29,7 @@ cmd:rscan __GETNODEATTR(testnode,hcp)__ -w
check:rc==0
check:output=~lpar\s+\w+\s+\d+\s+\w{4}-\w{3}\s+\w{7}\s+[\w|-]+
check:output=~cec\s+[\w|-]+\s+\w{4}-\w{3}\s+\w{7}
check:output=~hmc\s+__GETNODEATTR($$CN,hcp)__\s+\w{4}-\w{3}\s+\w{7}
check:output=~hmc\s+__GETNODEATTR($$CN,hcp)__+\s+\w{4}-\w{3}\s+\w{7}
cmd:lsdef -l $$CN
check:rc==0
check:output=~hcp=__GETNODEATTR($$CN,hcp)__

View File

@ -1,7 +1,6 @@
start:xdcp_h
cmd:xdcp -h
check:rc==0
check:output=~Usage
end
start:xdcp_V

55
xCAT-test/xmlapi/README Normal file
View File

@ -0,0 +1,55 @@
xCAT has an XML input interface to the xCAT tables. The routines are in tabutils.pm and map to the
Table.pm routines by the same name. These routines were written for PCM but are also used in the restapi. They are not a documented api.
For the restapi, check the following for how and which routines are used.
xCAT-server/xCAT-wsapi/xcatws.cgi at all the functions between tablenodehdl() and tablerowdelhdl().
getAllEntries => "tabutils",
getNodesAttribs => "tabutils",
getTablesAllNodeAttribs => "tabutils",
getTablesNodesAttribs => "tabutils",
getTablesAllRowAttribs => "tabutils",
setNodesAttribs => "tabutils",
delEntries => "tabutils",
getAttribs => "tabutils",
setAttribs => "tabutils",
NodeRange => "tabutils",
If you vi /opt/xcat/lib/perl/xCAT_plugin/tabutils.pm, and search for example "sub getAllEntries", you will see documented in the routines comments to input XML format requried and the output XML sent.
To test these routines, I put together a driver program pcmdriver, that generates the test XML and sends it and displays the returned output.
For example:
vi xmldriver in this directory
You will see
$ENV{'XCATXMLTRACE'}=1;
my $XML=`cat /.../xmlapi/getTablesAllRowAttribsreq`;
my $data=$XML;
$ENV{'XCATSHOWXML'}=1;
xCAT::Client::submit_request($data, \&xCAT::Client::handle_response);
exit $xCAT::Client::EXITCODE;
If you vi getTablesAllRowAttribsreq, you will see the following. This is an XML request to get the all rows from the passwd table the attributes username and rack. These is one of these XML request files for all
possible input to the routines in the directory.
XCATXMLTRACE is exported to show the XML that is being sent to xcatd. XCATSHOWXML is exported to display the XML returned to the client.
To get the XML request you must not be running in XCATBYPASS mode, you can get the reponse in XCATBYPASS mode.
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getTablesAllRowAttribs</command>
<table>
<tablename>passwd</tablename>
<attr>username</attr>
</table>
<table>
<tablename>rack</tablename>
<attr>rackname</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,13 @@
sub setNodeAttribs
sub addNodeAttribs
sub setAttribs
sub setAttribsWhere
sub setNodesAttribs
sub getNodesAttribs
sub getNodeAttribs
sub getAllEntries
sub getAllAttribsWhere
sub getAllNodeAttribs
sub getAllAttribs
sub delEntries
sub getAttribs

View File

@ -0,0 +1,11 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>delEntries</command>
<table>
<name>nodelist</name>
<attr>
<groups>compute1,lissa</groups>
<status>down</status>
</attr>
</table>
</xcatrequest>

View File

@ -0,0 +1,17 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>delEntries</command>
<table>
<name>nodelist</name>
<attrs>
<groups>compute1,lissa</groups>
<status>down</status>
</attrs>
</table>
<table>
<name>nodelist</name>
<attrs>
<groups>compute2</groups>
</attrs>
</table>
</xcatrequest>

View File

@ -0,0 +1,7 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>delEntries</command>
<table>
<name>nodelist</name>
</table>
</xcatrequest>

View File

@ -0,0 +1,35 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>deltbl</command>
<table>tablename</table>
<key>key1</key>
<value>value1</value>
<node>noderange2</node>
.
.
.
or <node>ALL</node>
<attr>attribute1</attr>
<attr>attribute2</attr>
.
.
.
<attr>attributeN</attr>
</xcatrequest>
<xcatresponse>
<rows>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</rows>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,37 @@
# Reads all entries from the input Table
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAllEntries</command>
<table>tablename</table>
</xcatrequest>
<xcatresponse>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
.
.
.
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
</xcatresponse>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,37 @@
# Reads all entries from the input Table
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAllEntries</command>
<table>tablename</table>
</xcatrequest>
<xcatresponse>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
.
.
.
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
</xcatresponse>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,5 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAllEntries</command>
<table>switch</table>
</xcatrequest>

View File

@ -0,0 +1,5 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAllEntries</command>
<table>nodelist</table>
</xcatrequest>

View File

@ -0,0 +1,5 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAllEntries</command>
<table>nodelist</table>
</xcatrequest>

View File

@ -0,0 +1,10 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAttribs</command>
<table>site</table>
<keys>
<key>domain</key>
</keys>
<attrs>value</attrs>
<attrs>comments</attrs>
</xcatrequest>

View File

@ -0,0 +1,8 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAttribs</command>
<table>site</table>
<key>domain</key>
<attr>value</attr>
<attr>comments</attr>
</xcatrequest>

View File

@ -0,0 +1,11 @@
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getAttribs</command>
<table>networks</table>
<keys>
<net>11.35.0.0</net>
<mask>255.255.0.0</mask>
</keys>
<attr>netname</attr>
<attr>dhcpserver</attr>
</xcatrequest>

View File

@ -0,0 +1,50 @@
# Reads the table input for the noderange and returns list of attributes
# requested
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getNodeAttribs</command>
<table>tablename</table>
<node>noderange</node>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</xcatrequest>
<xcatresponse>
<node>nodename1</node>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
.
.
.
<node>nodenameN</node>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
</xcatresponse>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

View File

@ -0,0 +1,50 @@
# Reads the table input for the noderange and returns list of attributes
# requested
<xcatrequest>
<clienttype>PCM</clienttype>
<command>getNodeAttribs</command>
<table>tablename</table>
<node>noderange</node>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</xcatrequest>
<xcatresponse>
<node>nodename1</node>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
.
.
.
<node>nodenameN</node>
<row>
<attr>attribute1</attr>
<value>value1</value>
<attr>attribute2</attr>
<value>value2</value>
.
.
.
<attr>attributeN</attr>
<value>valueN</value>
</row>
</xcatresponse>
<xcatresponse>
<serverdone></serverdone>
</xcatresponse>

Some files were not shown because too many files have changed in this diff Show More