diff --git a/buildcore.sh b/buildcore.sh index 770bdd58b..41866121e 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -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 diff --git a/perl-xCAT/db2man b/perl-xCAT/db2man index f05cfb5b5..43190a9d6 100755 --- a/perl-xCAT/db2man +++ b/perl-xCAT/db2man @@ -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 diff --git a/perl-xCAT/xCAT/FSPmac.pm b/perl-xCAT/xCAT/FSPmac.pm index b943af7b4..650057d0a 100644 --- a/perl-xCAT/xCAT/FSPmac.pm +++ b/perl-xCAT/xCAT/FSPmac.pm @@ -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]; diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index 6271f4aa6..45e5bfc4f 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -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"; diff --git a/perl-xCAT/xCAT/LparNetbootExp.pm b/perl-xCAT/xCAT/LparNetbootExp.pm index 92fab81d5..27cd82dd1 100755 --- a/perl-xCAT/xCAT/LparNetbootExp.pm +++ b/perl-xCAT/xCAT/LparNetbootExp.pm @@ -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++; diff --git a/perl-xCAT/xCAT/MsgUtils.pm b/perl-xCAT/xCAT/MsgUtils.pm index 6a554d8ae..71b8ea4cd 100644 --- a/perl-xCAT/xCAT/MsgUtils.pm +++ b/perl-xCAT/xCAT/MsgUtils.pm @@ -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; diff --git a/perl-xCAT/xCAT/PPCmac.pm b/perl-xCAT/xCAT/PPCmac.pm index 43c3a230f..afeb32ba0 100644 --- a/perl-xCAT/xCAT/PPCmac.pm +++ b/perl-xCAT/xCAT/PPCmac.pm @@ -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]; diff --git a/perl-xCAT/xCAT/ProfiledNodeUtils.pm b/perl-xCAT/xCAT/ProfiledNodeUtils.pm index 62c1b5081..5fee1f892 100644 --- a/perl-xCAT/xCAT/ProfiledNodeUtils.pm +++ b/perl-xCAT/xCAT/ProfiledNodeUtils.pm @@ -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 diff --git a/perl-xCAT/xCAT/SPD.pm b/perl-xCAT/xCAT/SPD.pm index 957f25f54..b2dd84eb0 100755 --- a/perl-xCAT/xCAT/SPD.pm +++ b/perl-xCAT/xCAT/SPD.pm @@ -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"; } } diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 055c2df86..acadf67ca 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -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". diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 5bbb4ba2e..9ef3b006b 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -33,7 +33,7 @@ my %usage = ( LPAR(with HMC) specific: rpower [on|off|reset|stat|state|boot|of|sms|softoff] CEC(using Direct FSP Management) specific: - rpower [on|onstandby|off|stat|state|lowpower|resetsp] + rpower [on|onstandby|off|stat|state|resetsp] Frame(using Direct FSP Management) specific: rpower [stat|state|rackstandby|exit_rackstandby|resetsp] LPAR(using Direct FSP Management) specific: diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index a284eb806..f8efb5dd0 100755 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -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; diff --git a/xCAT-OpenStack-baremetal/debian/copyright b/xCAT-OpenStack-baremetal/debian/copyright index 152491524..f61d34dfe 100644 --- a/xCAT-OpenStack-baremetal/debian/copyright +++ b/xCAT-OpenStack-baremetal/debian/copyright @@ -1,38 +1,88 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: xcat-openstack-baremetal -Source: +Eclipse Public License - v 1.0 -Files: * -Copyright: - -License: - - - . - +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 -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 - . - 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. + + diff --git a/xCAT-OpenStack-baremetal/debian/files b/xCAT-OpenStack-baremetal/debian/files deleted file mode 100644 index 0bf4353c0..000000000 --- a/xCAT-OpenStack-baremetal/debian/files +++ /dev/null @@ -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 diff --git a/xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log b/xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log deleted file mode 100644 index a151b91a0..000000000 --- a/xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log +++ /dev/null @@ -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 diff --git a/xCAT-SoftLayer/bin/modifygrub b/xCAT-SoftLayer/bin/modifygrub index 967509477..03a451c4c 100755 --- a/xCAT-SoftLayer/bin/modifygrub +++ b/xCAT-SoftLayer/bin/modifygrub @@ -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 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=, 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=, 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; diff --git a/xCAT-SoftLayer/bin/pushinitrd b/xCAT-SoftLayer/bin/pushinitrd index e3927f10c..8ee1d643a 100755 --- a/xCAT-SoftLayer/bin/pushinitrd +++ b/xCAT-SoftLayer/bin/pushinitrd @@ -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 ] \n\n"; + print "Usage: pushinitrd [-?|-h|--help] [-v|--verbose] [--dryrun] [-w ] [--noautoinst] \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/|; # 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'); diff --git a/xCAT-SoftLayer/postscripts/configbond b/xCAT-SoftLayer/postscripts/configbond deleted file mode 100755 index 5d43c3a8a..000000000 --- a/xCAT-SoftLayer/postscripts/configbond +++ /dev/null @@ -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 []'"); - 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; - } -} diff --git a/xCAT-SoftLayer/postscripts/setdefaultroute b/xCAT-SoftLayer/postscripts/setdefaultroute deleted file mode 100755 index 7e574ca4c..000000000 --- a/xCAT-SoftLayer/postscripts/setdefaultroute +++ /dev/null @@ -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 \ No newline at end of file diff --git a/xCAT-SoftLayer/xCAT-SoftLayer.spec b/xCAT-SoftLayer/xCAT-SoftLayer.spec index c5886c787..2d03a5d4a 100644 --- a/xCAT-SoftLayer/xCAT-SoftLayer.spec +++ b/xCAT-SoftLayer/xCAT-SoftLayer.spec @@ -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 diff --git a/xCAT-UI/xCAT-UI.spec b/xCAT-UI/xCAT-UI.spec index d16f9a1d4..d866c741a 100644 --- a/xCAT-UI/xCAT-UI.spec +++ b/xCAT-UI/xCAT-UI.spec @@ -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; diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 6b45d3ea9..ff1a456dd 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -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/<<>>/$kitname/; s/<<>>/$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 = ; + close(FH); + my $prep_comp_name="prep-".$comp->{basename}; + for(@lines) { + chomp; + s/<<>>/$prep_comp_name/; + s/<<>>/$comp->{ospkgdeps}/; + s/<<>>//; + s/<<>>//; + s/<<>>/$comp->{description}/; + s/<<>>/$upgradeflag/; + s/<<>>/$prescript/; + s/<<>>//; + s/<<>>/$preupscript/; + s/<<>>//; + s/<<>>/$preunscript/; + s/<<>>//; + + } + 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 = ; close(FH); + my $prepcomp="prep-".$comp->{basename}; for(@lines) { chomp; s/<<>>/$comp->{basename}/; s/<<>>/$comp->{ospkgdeps}/; s/<<>>/$comp->{kitpkgdeps}/; - s/<<>>/$comp->{kitcompdeps}/; + if ( $::VALID_PREP_COMPONENT ) { + s/<<>>/$comp->{kitcompdeps},$prepcomp/; + } + else + { + s/<<>>/$comp->{kitcompdeps}/; + } + s/<<>>/$comp->{description}/; s/<<>>/$upgradeflag/; s/<<>>/$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 diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index 18d7df37c..cf2254abd 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -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; + +} + + #------------------------------------------------------------------------------ diff --git a/xCAT-buildkit/share/xcat/kits/debian_template/postinst b/xCAT-buildkit/share/xcat/kits/debian_template/postinst index 54d566f4e..d12542954 100644 --- a/xCAT-buildkit/share/xcat/kits/debian_template/postinst +++ b/xCAT-buildkit/share/xcat/kits/debian_template/postinst @@ -21,7 +21,7 @@ set -e case "$1" in configure) <<>> - if [ -f /tmp/<<>> ] + if [ -f /tmp/<<>> ]; then <<>> rm /tmp/<<>> fi diff --git a/xCAT-buildkit/share/xcat/kits/debian_template/preinst b/xCAT-buildkit/share/xcat/kits/debian_template/preinst index a0b2977c5..6232bd33d 100644 --- a/xCAT-buildkit/share/xcat/kits/debian_template/preinst +++ b/xCAT-buildkit/share/xcat/kits/debian_template/preinst @@ -20,7 +20,7 @@ case "$1" in ;; upgrade) - if [ -f /tmp/<<>> ] + if [ -f /tmp/<<>> ]; then <<>> fi ;; diff --git a/xCAT-buildkit/share/xcat/kits/kit_template/source_packages/sample/pkg1/pkg1_1-2_all.deb b/xCAT-buildkit/share/xcat/kits/kit_template/source_packages/sample/pkg1/pkg1_1-2_all.deb new file mode 100644 index 000000000..4a445c94a Binary files /dev/null and b/xCAT-buildkit/share/xcat/kits/kit_template/source_packages/sample/pkg1/pkg1_1-2_all.deb differ diff --git a/xCAT-client/bin/getxcatdocs b/xCAT-client/bin/getxcatdocs index c9f0bcc8b..d57f778d4 100755 --- a/xCAT-client/bin/getxcatdocs +++ b/xCAT-client/bin/getxcatdocs @@ -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] []\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] []\n"; + print "Usage: getxcatdocs [-v|--verbose] [-c|--continue] [-d|--doc single_doc] [-i|--ignoreerrors] []\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/ tags, but converting them does not seem to do any good anyway. - my $cmd = q(sed -i 's/; + 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 = ; + 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 = ; + 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 () { - 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 = ; + 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 () { - 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=; + 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; + + + + + + } diff --git a/xCAT-client/bin/rcons b/xCAT-client/bin/rcons index c241085c3..78bd8e901 100755 --- a/xCAT-client/bin/rcons +++ b/xCAT-client/bin/rcons @@ -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 diff --git a/xCAT-client/debian/xcat-client.links b/xCAT-client/debian/xcat-client.links index 26c86715a..ac2487e23 100644 --- a/xCAT-client/debian/xcat-client.links +++ b/xCAT-client/debian/xcat-client.links @@ -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 diff --git a/xCAT-client/pods/man1/getxcatdocs.1.pod b/xCAT-client/pods/man1/getxcatdocs.1.pod index 08c5ad28c..a0c5729a4 100644 --- a/xCAT-client/pods/man1/getxcatdocs.1.pod +++ b/xCAT-client/pods/man1/getxcatdocs.1.pod @@ -4,19 +4,23 @@ B - downloads the xCAT documentation and converts to HTML and PDF =head1 SYNOPSIS -B [B<-?> | B<-h> | B<--help> | B<-v> | B<--version>] [I] +B [B<-?> | B<-h> | B<--help>] +B [B<-v> | B<--verbose>] [I] +B [B<-v> | B<--verbose>] [B<-c> | B<--continue>] [B<-d> | B<--doc> I] [I] =head1 DESCRIPTION The B 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 is specified, B 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 is specified, B 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 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 is specified, only that one wiki page will be downloaded and converted. + +B 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. 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 + +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 first. + =back =head1 RETURN VALUE diff --git a/xCAT-client/pods/man1/nodeimport.1.pod b/xCAT-client/pods/man1/nodeimport.1.pod index 871b7510d..41e962a52 100644 --- a/xCAT-client/pods/man1/nodeimport.1.pod +++ b/xCAT-client/pods/man1/nodeimport.1.pod @@ -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> 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 is the ID number. The default value is 1 if it is not defined. B> This is an optional item. diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index d507ea06b..fc7ffcbb8 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -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 diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 498bfa271..a44a773a4 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -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 diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index e335b9941..36e788e19 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -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 diff --git a/xCAT-genesis-builder/installkernel b/xCAT-genesis-builder/installkernel index c5f2776f9..60e5c0a05 100755 --- a/xCAT-genesis-builder/installkernel +++ b/xCAT-genesis-builder/installkernel @@ -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 diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index c4e537d96..64dafcb51 100755 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,4 +1,4 @@ -%define version 2.8 +%define version 2.9 %ifarch i386 i586 i686 x86 %define tarch x86 %endif diff --git a/xCAT-genesis-builder/xcat-cmdline.sh b/xCAT-genesis-builder/xcat-cmdline.sh old mode 100644 new mode 100755 index 0b60f30d9..00aa2556e --- a/xCAT-genesis-builder/xcat-cmdline.sh +++ b/xCAT-genesis-builder/xcat-cmdline.sh @@ -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 diff --git a/xCAT-genesis-scripts/bin/bmcsetup b/xCAT-genesis-scripts/bin/bmcsetup index 195c32159..d0590abc8 100755 --- a/xCAT-genesis-scripts/bin/bmcsetup +++ b/xCAT-genesis-scripts/bin/bmcsetup @@ -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}'` diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index e4c8dd6c0..3c3929dd8 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -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 '' > /tmp/discopacket echo "findme" >> /tmp/discopacket echo "$ARCH" >> /tmp/discopacket @@ -101,13 +119,19 @@ echo "$CPUCOUNT" >> /tmp/discopacket echo "$CPUTYPE" >> /tmp/discopacket echo "$MEMORY" >> /tmp/discopacket echo "$DISKSIZE" >> /tmp/discopacket -echo "$UUID" >> /tmp/discopacket +if [ "$UUID" != "unknown" ]; then + echo "$UUID" >> /tmp/discopacket +fi + if [ "$MTM" != "unknown" ]; then echo "$MTM" >> /tmp/discopacket fi if [ "$SERIAL" != "unknown" ]; then echo "$SERIAL" >> /tmp/discopacket fi +if [ "$PLATFORM" != "unknown" ]; then + echo "$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 diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 7e84e097c..7d6203531 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -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 diff --git a/xCAT-genesis-scripts/debian/copyright b/xCAT-genesis-scripts/debian/copyright index 15de46f36..f61d34dfe 100644 --- a/xCAT-genesis-scripts/debian/copyright +++ b/xCAT-genesis-scripts/debian/copyright @@ -1,36 +1,88 @@ -Format: http://dep.debian.net/deps/dep5 -Upstream-Name: xcat-genesis-scripts -Source: +Eclipse Public License - v 1.0 -Files: * -Copyright: - -License: - - - . - +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 -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 - . - 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. + + diff --git a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec index 70ffe87e4..cc6f3f02b 100755 --- a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec +++ b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec @@ -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 diff --git a/xCAT-rmc/debian/files b/xCAT-rmc/debian/files deleted file mode 100644 index 0cd53ffdc..000000000 --- a/xCAT-rmc/debian/files +++ /dev/null @@ -1 +0,0 @@ -xcat-rmc_2.5.0-1_all.deb admin extra diff --git a/xCAT-server/debian/control b/xCAT-server/debian/control index 1fa5e7349..2d7b5b865 100644 --- a/xCAT-server/debian/control +++ b/xCAT-server/debian/control @@ -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 diff --git a/xCAT-server/debian/dirs b/xCAT-server/debian/dirs index e9bb97e2d..93ede5a69 100644 --- a/xCAT-server/debian/dirs +++ b/xCAT-server/debian/dirs @@ -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 diff --git a/xCAT-server/debian/install b/xCAT-server/debian/install index 8ecc00e59..37c168c20 100644 --- a/xCAT-server/debian/install +++ b/xCAT-server/debian/install @@ -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 diff --git a/xCAT-server/debian/rules b/xCAT-server/debian/rules index f3a068123..410c07bb6 100644 --- a/xCAT-server/debian/rules +++ b/xCAT-server/debian/rules @@ -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/* diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm old mode 100755 new mode 100644 index 4b382f197..95063a76c --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -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 #################################### diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index a8a1d8633..3d7ba772b 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -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; } diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm old mode 100644 new mode 100755 index 483b80a18..e2bef10eb --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -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/) { diff --git a/xCAT-server/lib/perl/xCAT/xcatd.pm b/xCAT-server/lib/perl/xCAT/xcatd.pm index 6dae1b684..fb879db78 100644 --- a/xCAT-server/lib/perl/xCAT/xcatd.pm +++ b/xCAT-server/lib/perl/xCAT/xcatd.pm @@ -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; diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index d1303f37b..033942f24 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -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 diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index e86bb20d3..a4e2f64b8 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -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"; diff --git a/xCAT-server/lib/xcat/plugins/fsp.pm b/xCAT-server/lib/xcat/plugins/fsp.pm index 6d29d8c77..605bc82af 100644 --- a/xCAT-server/lib/xcat/plugins/fsp.pm +++ b/xCAT-server/lib/xcat/plugins/fsp.pm @@ -32,7 +32,7 @@ sub handled_commands { rscan => 'nodehm:mgt', getfspcon => 'nodehm:cons', getmulcon => 'fsp', - + findme => 'fsp', }; } diff --git a/xCAT-server/lib/xcat/plugins/imgcapture.pm b/xCAT-server/lib/xcat/plugins/imgcapture.pm index 26e58572f..5a2ff9946 100644 --- a/xCAT-server/lib/xcat/plugins/imgcapture.pm +++ b/xCAT-server/lib/xcat/plugins/imgcapture.pm @@ -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:\\(.*\\):\\1 id=\\\"41\\\" \\2:' /etc/systemimager/autoinstallscript.conf;fi); + $output = xCAT::Utils->runxcmd( + { + command => ["xdsh"], + node => [$node], + arg =>[$cmd] + }, + $subreq, 0, 1); + } + return 0; } diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 6138d0c86..a6334f063 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -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)); diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index 14ba0d96d..af033a1d8 100755 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -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$/){ diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index bdb2bcd17..f9c3316ba 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -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); } } diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index aea08954b..4dd348e36 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -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) { diff --git a/xCAT-server/lib/xcat/plugins/osdistro.pm b/xCAT-server/lib/xcat/plugins/osdistro.pm index beccf7f47..6b653db50 100644 --- a/xCAT-server/lib/xcat/plugins/osdistro.pm +++ b/xCAT-server/lib/xcat/plugins/osdistro.pm @@ -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]}) } diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 2480c00d8..79e231270 100644 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -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); } diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index dda254b19..09b87062e 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -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(); diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index 06bcccf2c..2f0cc335f 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -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{$_}; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 483cafc90..a66573dfc 100755 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -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"; diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 5196c24cb..95723cf2b 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -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') diff --git a/xCAT-server/share/xcat/install/rh/kvm.rhel7.pkglist b/xCAT-server/share/xcat/install/rh/kvm.rhel7.pkglist new file mode 100644 index 000000000..7a6779c4b --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/kvm.rhel7.pkglist @@ -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 diff --git a/xCAT-server/share/xcat/install/rh/kvm.rhel7.tmpl b/xCAT-server/share/xcat/install/rh/kvm.rhel7.tmpl new file mode 100644 index 000000000..b32f1f01d --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/kvm.rhel7.tmpl @@ -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 +# --useLilo +# --md5pass +# +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 diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist new file mode 100644 index 000000000..51cbbf9d0 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh5/x86_64/systemimager-client diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist new file mode 100644 index 000000000..6d3bbd5dd --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh6/ppc64/systemimager-client diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist new file mode 100644 index 000000000..a10301209 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh7/ppc64/systemimager-client diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist new file mode 100644 index 000000000..5b8feb497 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh7/x86_64/systemimager-client diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 10d406998..44fdf2912 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -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# diff --git a/xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist new file mode 100644 index 000000000..691b8e05a --- /dev/null +++ b/xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/sles11/ppc64/systemimager-client diff --git a/xCAT-server/share/xcat/netboot/SL/compute.SL6.pkglist b/xCAT-server/share/xcat/netboot/SL/compute.SL6.pkglist index a2ac48243..bebd8ee0a 120000 --- a/xCAT-server/share/xcat/netboot/SL/compute.SL6.pkglist +++ b/xCAT-server/share/xcat/netboot/SL/compute.SL6.pkglist @@ -1 +1 @@ -../rh/compute.rhels6.pkglist \ No newline at end of file +../rh/compute.rhels6.x86_64.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/SL/dracut/xcat-premount.sh b/xCAT-server/share/xcat/netboot/SL/dracut/xcat-premount.sh new file mode 120000 index 000000000..862e21b2e --- /dev/null +++ b/xCAT-server/share/xcat/netboot/SL/dracut/xcat-premount.sh @@ -0,0 +1 @@ +../../rh/dracut/xcat-premount.sh \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/SL/dracut/xcat-updateflag b/xCAT-server/share/xcat/netboot/SL/dracut/xcat-updateflag new file mode 120000 index 000000000..ba998cfb2 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/SL/dracut/xcat-updateflag @@ -0,0 +1 @@ +../../rh/dracut/xcat-updateflag \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist index aee31ff58..3f6a557e3 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist @@ -20,6 +20,6 @@ e2fsprogs bc lsvpd irqbalance -procps +procps-ng parted net-tools diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist index 410cd004c..87a71d977 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist @@ -9,7 +9,7 @@ openssh-clients iputils bc irqbalance -procps +procps-ng wget vim-minimal ntp diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 8c4ced961..e142715bf 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -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; diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg old mode 100644 new mode 100755 index 3e883b54b..b469b5729 --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -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"); } diff --git a/xCAT-test/autotest/testcase/copycds/cases0 b/xCAT-test/autotest/testcase/copycds/cases0 index 2bc29ee4a..be409c351 100644 --- a/xCAT-test/autotest/testcase/copycds/cases0 +++ b/xCAT-test/autotest/testcase/copycds/cases0 @@ -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 diff --git a/xCAT-test/autotest/testcase/restapi/node/cases0 b/xCAT-test/autotest/testcase/restapi/node/cases0 index 1920a0da7..a1308afe4 100644 --- a/xCAT-test/autotest/testcase/restapi/node/cases0 +++ b/xCAT-test/autotest/testcase/restapi/node/cases0 @@ -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 diff --git a/xCAT-test/autotest/testcase/rscan/cases0 b/xCAT-test/autotest/testcase/rscan/cases0 index c6e4f64a7..96484408e 100644 --- a/xCAT-test/autotest/testcase/rscan/cases0 +++ b/xCAT-test/autotest/testcase/rscan/cases0 @@ -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)__ diff --git a/xCAT-test/autotest/testcase/xdcp/cases0 b/xCAT-test/autotest/testcase/xdcp/cases0 index 102e14c1d..fb97776c9 100644 --- a/xCAT-test/autotest/testcase/xdcp/cases0 +++ b/xCAT-test/autotest/testcase/xdcp/cases0 @@ -1,7 +1,6 @@ start:xdcp_h cmd:xdcp -h check:rc==0 -check:output=~Usage end start:xdcp_V diff --git a/xCAT-test/xmlapi/README b/xCAT-test/xmlapi/README new file mode 100644 index 000000000..4d770945b --- /dev/null +++ b/xCAT-test/xmlapi/README @@ -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. + + +PCM +getTablesAllRowAttribs + +passwd +username +
+ +rack +rackname +
+
+ diff --git a/xCAT-test/xmlapi/Table.pm.routines b/xCAT-test/xmlapi/Table.pm.routines new file mode 100644 index 000000000..83336e081 --- /dev/null +++ b/xCAT-test/xmlapi/Table.pm.routines @@ -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 diff --git a/xCAT-test/xmlapi/delEntriesreq b/xCAT-test/xmlapi/delEntriesreq new file mode 100644 index 000000000..f1d01807a --- /dev/null +++ b/xCAT-test/xmlapi/delEntriesreq @@ -0,0 +1,11 @@ + +PCM +delEntries + + nodelist + + compute1,lissa + down + +
+
diff --git a/xCAT-test/xmlapi/delEntriesreq2 b/xCAT-test/xmlapi/delEntriesreq2 new file mode 100644 index 000000000..4958726c3 --- /dev/null +++ b/xCAT-test/xmlapi/delEntriesreq2 @@ -0,0 +1,17 @@ + +PCM +delEntries + + nodelist + + compute1,lissa + down + +
+ + nodelist + + compute2 + +
+
diff --git a/xCAT-test/xmlapi/delEntriesreq3 b/xCAT-test/xmlapi/delEntriesreq3 new file mode 100644 index 000000000..373df9f7c --- /dev/null +++ b/xCAT-test/xmlapi/delEntriesreq3 @@ -0,0 +1,7 @@ + +PCM +delEntries + + nodelist +
+
diff --git a/xCAT-test/xmlapi/deltblreq b/xCAT-test/xmlapi/deltblreq new file mode 100644 index 000000000..6030b4ce4 --- /dev/null +++ b/xCAT-test/xmlapi/deltblreq @@ -0,0 +1,35 @@ + +PCM +deltbl +tablename
+key1 +value1 +noderange2 +. +. +. +or ALL +attribute1 +attribute2 +. +. +. +attributeN +
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/getAllEntries b/xCAT-test/xmlapi/getAllEntries new file mode 100644 index 000000000..30d39721c --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntries @@ -0,0 +1,37 @@ +# Reads all entries from the input Table + +PCM +getAllEntries +tablename
+
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/getAllEntries.save1 b/xCAT-test/xmlapi/getAllEntries.save1 new file mode 100644 index 000000000..30d39721c --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntries.save1 @@ -0,0 +1,37 @@ +# Reads all entries from the input Table + +PCM +getAllEntries +tablename
+
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/getAllEntriesreq b/xCAT-test/xmlapi/getAllEntriesreq new file mode 100644 index 000000000..cbb3b83ac --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntriesreq @@ -0,0 +1,5 @@ + +PCM +getAllEntries +switch
+
diff --git a/xCAT-test/xmlapi/getAllEntriesreq.save b/xCAT-test/xmlapi/getAllEntriesreq.save new file mode 100644 index 000000000..5f20af2d8 --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntriesreq.save @@ -0,0 +1,5 @@ + +PCM +getAllEntries +nodelist
+
diff --git a/xCAT-test/xmlapi/getAllEntriesreq.save1 b/xCAT-test/xmlapi/getAllEntriesreq.save1 new file mode 100644 index 000000000..5f20af2d8 --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntriesreq.save1 @@ -0,0 +1,5 @@ + +PCM +getAllEntries +nodelist
+
diff --git a/xCAT-test/xmlapi/getAttribsreq b/xCAT-test/xmlapi/getAttribsreq new file mode 100644 index 000000000..de8172e18 --- /dev/null +++ b/xCAT-test/xmlapi/getAttribsreq @@ -0,0 +1,10 @@ + +PCM +getAttribs +site
+ + domain + +value +comments +
diff --git a/xCAT-test/xmlapi/getAttribsreq.old b/xCAT-test/xmlapi/getAttribsreq.old new file mode 100644 index 000000000..bee39d797 --- /dev/null +++ b/xCAT-test/xmlapi/getAttribsreq.old @@ -0,0 +1,8 @@ + +PCM +getAttribs +site
+domain +value +comments +
diff --git a/xCAT-test/xmlapi/getAttribsreq2 b/xCAT-test/xmlapi/getAttribsreq2 new file mode 100644 index 000000000..a4029372d --- /dev/null +++ b/xCAT-test/xmlapi/getAttribsreq2 @@ -0,0 +1,11 @@ + +PCM +getAttribs +networks
+ + 11.35.0.0 + 255.255.0.0 + +netname +dhcpserver +
diff --git a/xCAT-test/xmlapi/getNodeAttribs b/xCAT-test/xmlapi/getNodeAttribs new file mode 100644 index 000000000..7eabc87d1 --- /dev/null +++ b/xCAT-test/xmlapi/getNodeAttribs @@ -0,0 +1,50 @@ +# Reads the table input for the noderange and returns list of attributes +# requested + +PCM +getNodeAttribs +tablename
+noderange +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN +
+ +nodename1 + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. +nodenameN + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + + + + + + diff --git a/xCAT-test/xmlapi/getNodeAttribs1 b/xCAT-test/xmlapi/getNodeAttribs1 new file mode 100644 index 000000000..7eabc87d1 --- /dev/null +++ b/xCAT-test/xmlapi/getNodeAttribs1 @@ -0,0 +1,50 @@ +# Reads the table input for the noderange and returns list of attributes +# requested + +PCM +getNodeAttribs +tablename
+noderange +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN +
+ +nodename1 + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. +nodenameN + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + + + + + + diff --git a/xCAT-test/xmlapi/getNodesAttribsreq b/xCAT-test/xmlapi/getNodesAttribsreq new file mode 100644 index 000000000..fcc79224c --- /dev/null +++ b/xCAT-test/xmlapi/getNodesAttribsreq @@ -0,0 +1,8 @@ + +PCM +getNodesAttribs +nodelist
+blade01-blade02 +groups +status +
diff --git a/xCAT-test/xmlapi/getNodesAttribsreq1 b/xCAT-test/xmlapi/getNodesAttribsreq1 new file mode 100644 index 000000000..a2a2dd491 --- /dev/null +++ b/xCAT-test/xmlapi/getNodesAttribsreq1 @@ -0,0 +1,7 @@ + +PCM +getNodesAttribs +nodelist
+blade01-blade02 +ALL +
diff --git a/xCAT-test/xmlapi/getNodesAttribsreq2 b/xCAT-test/xmlapi/getNodesAttribsreq2 new file mode 100644 index 000000000..a2a2dd491 --- /dev/null +++ b/xCAT-test/xmlapi/getNodesAttribsreq2 @@ -0,0 +1,7 @@ + +PCM +getNodesAttribs +nodelist
+blade01-blade02 +ALL +
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq new file mode 100644 index 000000000..ba523421c --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq @@ -0,0 +1,9 @@ + +PCM +getTablesAllNodeAttribs + +nodelist +groups +comments +
+
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 new file mode 100644 index 000000000..943cd0439 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 @@ -0,0 +1,14 @@ + +PCM +getTablesAllNodeAttribs + +nodetype +os +nodetype +
+ +nodelist +groups +status +
+
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 new file mode 100644 index 000000000..350ba547b --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 @@ -0,0 +1,13 @@ + +PCM +getTablesAllNodeAttribs + +nodetype +os +nodetype +
+ +nodelist +ALL +
+
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 new file mode 100644 index 000000000..4dece144e --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 @@ -0,0 +1,36 @@ + +PCM +getTablesAllNodeAttribs + +nodetype +ALL +
+ +nodelist +ALL +
+ +noderes +ALL +
+ +postscripts +ALL +
+ +mac +ALL +
+ +mp +ALL +
+ +nodehm +ALL +
+ +mpa +ALL +
+
diff --git a/xCAT-test/xmlapi/getTablesAllRowAttribsreq b/xCAT-test/xmlapi/getTablesAllRowAttribsreq new file mode 100644 index 000000000..cb06e9beb --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllRowAttribsreq @@ -0,0 +1,12 @@ + +PCM +getTablesAllRowAttribs + +passwd +username +
+ +rack +rackname +
+
diff --git a/xCAT-test/xmlapi/getTablesNodesAttribsreq b/xCAT-test/xmlapi/getTablesNodesAttribsreq new file mode 100644 index 000000000..c4862f5d3 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesNodesAttribsreq @@ -0,0 +1,9 @@ + +PCM +getTablesNodesAttribs +test + +nodelist +ALL +
+
diff --git a/xCAT-test/xmlapi/getTablesNodesAttribsreq1 b/xCAT-test/xmlapi/getTablesNodesAttribsreq1 new file mode 100644 index 000000000..923444bb3 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesNodesAttribsreq1 @@ -0,0 +1,13 @@ + +PCM +getTablesNodesAttribs +test + +nodelist +ALL +
+ +nodetype +nodetype +
+
diff --git a/xCAT-test/xmlapi/getTablesNodesAttribsreq2 b/xCAT-test/xmlapi/getTablesNodesAttribsreq2 new file mode 100644 index 000000000..d85e7be03 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesNodesAttribsreq2 @@ -0,0 +1,9 @@ + +PCM +getTablesNodesAttribs +test + +noderes +ALL +
+
diff --git a/xCAT-test/xmlapi/noderange b/xCAT-test/xmlapi/noderange new file mode 100644 index 000000000..91f850065 --- /dev/null +++ b/xCAT-test/xmlapi/noderange @@ -0,0 +1,14 @@ +# Reads the table input for the noderange and returns list of attributes +# requested + +PCM +NodeRange +compute1-compute2 + + +node1 +. +. +. +noden + diff --git a/xCAT-test/xmlapi/noderangereq b/xCAT-test/xmlapi/noderangereq new file mode 100644 index 000000000..2b6131df8 --- /dev/null +++ b/xCAT-test/xmlapi/noderangereq @@ -0,0 +1,5 @@ + +PCM +NodeRange +compute1-compute2 + diff --git a/xCAT-test/xmlapi/noderangereq.save b/xCAT-test/xmlapi/noderangereq.save new file mode 100644 index 000000000..2b6131df8 --- /dev/null +++ b/xCAT-test/xmlapi/noderangereq.save @@ -0,0 +1,5 @@ + +PCM +NodeRange +compute1-compute2 + diff --git a/xCAT-test/xmlapi/noderangereq.save1 b/xCAT-test/xmlapi/noderangereq.save1 new file mode 100644 index 000000000..2b6131df8 --- /dev/null +++ b/xCAT-test/xmlapi/noderangereq.save1 @@ -0,0 +1,5 @@ + +PCM +NodeRange +compute1-compute2 + diff --git a/xCAT-test/xmlapi/readtblreq b/xCAT-test/xmlapi/readtblreq new file mode 100644 index 000000000..4b9d2346f --- /dev/null +++ b/xCAT-test/xmlapi/readtblreq @@ -0,0 +1,34 @@ + +PCM +readtbl +tablename
+noderange1 +noderange2 +. +. +. +or ALL +attribute1 +attribute2 +. +. +. +attributeN +
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/readtblreq.node b/xCAT-test/xmlapi/readtblreq.node new file mode 100644 index 000000000..4b9d2346f --- /dev/null +++ b/xCAT-test/xmlapi/readtblreq.node @@ -0,0 +1,34 @@ + +PCM +readtbl +tablename
+noderange1 +noderange2 +. +. +. +or ALL +attribute1 +attribute2 +. +. +. +attributeN +
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/setAttribs b/xCAT-test/xmlapi/setAttribs new file mode 100644 index 000000000..6ce815a27 --- /dev/null +++ b/xCAT-test/xmlapi/setAttribs @@ -0,0 +1,17 @@ + +PCM +setAttribs +tablename
+ +value1 +value2 For multiple key tables + + + value1 + value2 + +
+ + + + diff --git a/xCAT-test/xmlapi/setAttribsreq b/xCAT-test/xmlapi/setAttribsreq new file mode 100644 index 000000000..739822823 --- /dev/null +++ b/xCAT-test/xmlapi/setAttribsreq @@ -0,0 +1,12 @@ + +PCM +setAttribs +site
+ + domain + + + pok.com + This is a test + +
diff --git a/xCAT-test/xmlapi/setAttribsreq1 b/xCAT-test/xmlapi/setAttribsreq1 new file mode 100644 index 000000000..4f5daeeaa --- /dev/null +++ b/xCAT-test/xmlapi/setAttribsreq1 @@ -0,0 +1,13 @@ + +PCM +setAttribs +networks
+ + 10.0.1.0 + 255.255.255.0 + + + 10.0.1.254 + +
+ diff --git a/xCAT-test/xmlapi/setAttribsreq2 b/xCAT-test/xmlapi/setAttribsreq2 new file mode 100644 index 000000000..04b0f63d3 --- /dev/null +++ b/xCAT-test/xmlapi/setAttribsreq2 @@ -0,0 +1,13 @@ + +PCM +setAttribs +networks
+ + 10.0.1.0 + 255.255.255.0 + + + mynet + 10.0.1.254 + +
diff --git a/xCAT-test/xmlapi/setNodeAttribs b/xCAT-test/xmlapi/setNodeAttribs new file mode 100644 index 000000000..45f4cbf39 --- /dev/null +++ b/xCAT-test/xmlapi/setNodeAttribs @@ -0,0 +1,19 @@ + +PCM +setNodeAttribs +tablename
+noderange +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN +
+ + + + diff --git a/xCAT-test/xmlapi/setNodesAttribsreq b/xCAT-test/xmlapi/setNodesAttribsreq new file mode 100644 index 000000000..1fa4d38f6 --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq @@ -0,0 +1,14 @@ + +PCM +setNodesAttribs +blade01-blade02 + + + nodelist + + all,compute,lissa + This is a another test + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq1 b/xCAT-test/xmlapi/setNodesAttribsreq1 new file mode 100644 index 000000000..ebaece6cc --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq1 @@ -0,0 +1,14 @@ + +PCM +setNodesAttribs1 +blade01-blade02 + + + nodelist + + all,compute,lissa,newtest + This is a another testtest + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq1.1 b/xCAT-test/xmlapi/setNodesAttribsreq1.1 new file mode 100644 index 000000000..79b45ffec --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq1.1 @@ -0,0 +1,21 @@ + +PCM +setNodesAttribs +blade01-blade02 + + + nodelist + + lissa + This is a another testx + +
+ + nodetype + + Redhat2 + This is a another testy + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq1.new b/xCAT-test/xmlapi/setNodesAttribsreq1.new new file mode 100644 index 000000000..35856d42c --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq1.new @@ -0,0 +1,14 @@ + +PCM +setNodesAttribs1 +blade01-blade02 + + + nodelist + + all,compute + This is a test + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq2 b/xCAT-test/xmlapi/setNodesAttribsreq2 new file mode 100644 index 000000000..665213e45 --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq2 @@ -0,0 +1,17 @@ + +PCM +setNodesAttribs + + ppc
+ + + fsp1 + 1 + + + cec1 + + +
+
+ diff --git a/xCAT-test/xmlapi/setNodesAttribsreq3 b/xCAT-test/xmlapi/setNodesAttribsreq3 new file mode 100644 index 000000000..e82933b40 --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq3 @@ -0,0 +1,19 @@ + +PCM +setNodesAttribs +compute2 + + + nodelist + + allxxx + +
+ + nodetype + + Redhat20 + +
+
+
diff --git a/xCAT-test/xmlapi/xmldriver b/xCAT-test/xmlapi/xmldriver new file mode 100755 index 000000000..c355b976c --- /dev/null +++ b/xCAT-test/xmlapi/xmldriver @@ -0,0 +1,40 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = + $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} + : -d '/opt/xcat' ? '/opt/xcat' + : '/usr'; +} +use lib "$::XCATROOT/lib/perl"; +use strict; +use File::Basename; +use Cwd; +use Socket; +use XML::Simple; +require xCAT::MsgUtils; +use xCAT::Utils; +require xCAT::Client; +my $bname = basename($0); + +#----------------------------------------------------------------------------- + +=head1 pcmdriver - test XMLapi to Table.pm ( via tabutils.pm) + + +=cut + +#----------------------------------------------------------------------------- +# Main + + $ENV{'XCATXMLTRACE'}=1; +my $XML=`cat /root/lissa/xmlapi/getTablesAllRowAttribsreq`; + +my $data=$XML; + +$ENV{'XCATSHOWXML'}=1; + +xCAT::Client::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + diff --git a/xCAT-test/xmlapi/xmldriver.old b/xCAT-test/xmlapi/xmldriver.old new file mode 100755 index 000000000..581d5f400 --- /dev/null +++ b/xCAT-test/xmlapi/xmldriver.old @@ -0,0 +1,60 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = + $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} + : -d '/opt/xcat' ? '/opt/xcat' + : '/usr'; +} +use lib "$::XCATROOT/lib/perl"; +use strict; +use File::Basename; +use Cwd; +use Socket; +use XML::Simple; +require xCAT::MsgUtils; +use xCAT::Utils; +require xCAT::Client; +my $bname = basename($0); + +#----------------------------------------------------------------------------- + +=head1 pcmdriver - test XMLapi for PCM + + +=cut + +#----------------------------------------------------------------------------- +# Main + + $ENV{'XCATXMLTRACE'}=1; +my $XML=`cat /root/lissa/PCM/api/getTablesAllRowAttribsreq`; +#my $XML=`cat /root/lissa/PCM/api/getAllEntriesreq `; +#my $XML=`cat /root/lissa/PCM/api/setNodesAttribsreq `; +#y $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq1`; +#my $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq2`; +#my $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq3`; +#my $XML=`cat /root/lissa/PCM/api/getTablesNodesAttribsreq`; +#my $XML=`cat /root/lissa/PCM/api/getTablesNodesAttribsreq2`; +#my $XML=`cat /root/lissa/PCM/api/getTablesNodesAttribsreq1`; +#my $XML=`cat /root/lissa/PCM/api/setNodesAttribsreq1.1 `; +#my $XML=`cat /root/lissa/PCM/api/getNodesAttribsreq1 `; +#y $XML=`cat /root/lissa/PCM/api/getNodesAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/getNodesAttribsreq2 `; +#my $XML=`cat /root/lissa/PCM/api/setNodesAttribsreq3 `; +#my $XML=`cat /root/lissa/PCM/api/delEntriesreq `; +#my $XML=`cat /root/lissa/PCM/api/delEntriesreq3 `; +#my $XML=`cat /root/lissa/PCM/api/getAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/getAttribsreq2 `; +#my $XML=`cat /root/lissa/PCM/api/setAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/noderangereq `; + +my $data=$XML; + +$ENV{'XCATSHOWXML'}=1; + +xCAT::Client::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + diff --git a/xCAT-test/xmlapi/xmldriver.org b/xCAT-test/xmlapi/xmldriver.org new file mode 100644 index 000000000..dbc4bbc5e --- /dev/null +++ b/xCAT-test/xmlapi/xmldriver.org @@ -0,0 +1,43 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = + $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} + : -d '/opt/xcat' ? '/opt/xcat' + : '/usr'; +} +use lib "$::XCATROOT/lib/perl"; +use strict; +use File::Basename; +use Cwd; +use Socket; + +#use Data::Dumper; +use Getopt::Long; +require xCAT::MsgUtils; +require xCAT::DSHCLI; +use xCAT::Utils; +use xCAT::RemoteShellExp; +require xCAT::PCMClient; +my $bname = basename($0); + +#----------------------------------------------------------------------------- + +=head1 pcmdriver - test XMLapi for PCM + + +=cut + +#----------------------------------------------------------------------------- +# Main + + +my $XML=`cat /root/lissa/PCM/api/getAllEntriesreq `; +my $data=$XML; + + + +xCAT::PCMClient::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + diff --git a/xCAT-test/xmlapi/xmlrequest.org b/xCAT-test/xmlapi/xmlrequest.org new file mode 100644 index 000000000..3a1dac456 --- /dev/null +++ b/xCAT-test/xmlapi/xmlrequest.org @@ -0,0 +1,6 @@ + +cli +nodels +/svn/xcat-core/2.6/perl-xCAT/xCAT +service + diff --git a/xCAT-test/xmlapi/xmlresponse b/xCAT-test/xmlapi/xmlresponse new file mode 100644 index 000000000..da2dce15a --- /dev/null +++ b/xCAT-test/xmlapi/xmlresponse @@ -0,0 +1,9 @@ + + +rhsn + + +rhsn + + + diff --git a/xCAT/postscripts/configefi b/xCAT/postscripts/configefi index 5bc8c1ac8..1fc433126 100644 --- a/xCAT/postscripts/configefi +++ b/xCAT/postscripts/configefi @@ -4,81 +4,106 @@ # SI post-install script to configure the efi boot mgr or grub after SI has installed the OS # SI post-install scripts run in a chroot environment of the final OS image -if [ -d /sys/firmware/efi ]; then - echo "Setting Boot Manager for the next boot." - echo "delete all sysclone boot list" - str_bootnums=`efibootmgr | grep 'syscloneLinux' | awk '{print $1}' | sed 's/boot//i' | sed 's/*//'` - for str_num in $str_bootnums - do - efibootmgr -b $str_num -B -q - done +arch=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/` +if [ "$arch" = "x86_64" ]; then + if [ -d /sys/firmware/efi ]; then + echo "Setting Boot Manager for the next boot." + echo "delete all sysclone boot list" + str_bootnums=`efibootmgr | grep 'syscloneLinux' | awk '{print $1}' | sed 's/boot//i' | sed 's/*//'` + for str_num in $str_bootnums + do + efibootmgr -b $str_num -B -q + done - if [ -f "/boot/efi/EFI/redhat/grub.efi" ];then - efibootmgr -c -l \\EFI\\redhat\\grub.efi -L syscloneLinux - elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then - efibootmgr -c -l \\efi\\SuSE\\elilo.efi -L syscloneLinux + if [ -f "/boot/efi/EFI/redhat/grub.efi" ];then + efibootmgr -c -l \\EFI\\redhat\\grub.efi -L syscloneLinux + elif [ -f "/boot/efi/efi/SuSE/elilo.efi" ];then + efibootmgr -c -l \\efi\\SuSE\\elilo.efi -L syscloneLinux + else + echo "Can not find the boot loader." + exit 1 + fi + else + echo "run grub-install to configure the MBR." + if [ -e /etc/mtab ];then + mv /etc/mtab /etc/mtab.bak + fi + grep -v rootfs /proc/mounts > /etc/mtab + boot_device='' + if [ -f "/etc/systemconfig/systemconfig.conf" ];then + boot_root=`cat /etc/systemconfig/systemconfig.conf | grep ROOTDEV | awk '{print $3}'` + boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'` + else + boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` + boot_device=`echo $boot_root | sed -e 's/[0-9]*$//'` + + #str_temp=`mount | awk '{print $1","$3}'` + #for line in $str_temp + #do + # mp=`echo $line | awk -F, '{print $2}'` + # if [ "$mp" = "/" ];then + # boot_device=`echo $line | awk -F, '{print $1}' | sed -e 's/[0-9]*$//'` + # break + # fi + #done + fi + + if [ -n "$boot_device" ];then + echo "The boot device is $boot_device" + echo "The boot root device is $boot_root" + else + echo "Can not find the boot device, return error" + exit 1 + fi + + # set grub to use this boot device + if grep -qe '^VERSION\s*=\s*11' /etc/SuSE-release; then + #sles11, run grub-install.unsupported directly + echo "grub-install.unsupported --no-floppy --recheck $boot_device" + grub-install.unsupported --no-floppy --recheck $boot_device + # note: the error about grub-set-default not existing is harmless, because we want the default to be 0 anyway + else + #for sles10, should run grub-install with parameters + echo "grub-install --no-floppy --recheck $boot_device" + grub-install --no-floppy --recheck $boot_device + fi + + # change the entries in the grub conf file to use the correct boot root device + # (not the one leftover from the golden image) + if [ -f "/boot/grub/grub.conf" ];then + conffile="/boot/grub/grub.conf" + else + conffile="/boot/grub/menu.lst" + fi + sed -i 's| root=\S*| root='$boot_root'|' $conffile + sed -i 's| resume=\S*| noresume|' $conffile + + if [ -e /etc/mtab.bak ];then + mv -f /etc/mtab.bak /etc/mtab + else + rm -f /etc/mtab + fi + fi +elif [ "$arch" = "ppc64" ]; then + echo "run yaboot to configure the MBR." + if [ -f "/usr/lib/yaboot/yaboot" ]; then + # set bootloader + echo "dd if=/usr/lib/yaboot/yaboot of=/dev/sda1 bs=4096" + dd if=/usr/lib/yaboot/yaboot of=/dev/sda1 bs=4096 + + # Set 0x41 as the partition type of the first partition + # echo A | dd of=/dev/sda bs=1 count=1 seek=450 + elif [ -f "/lib/lilo/pmac/yaboot" ]; then + # set bootloader + echo "dd if=/lib/lilo/pmac/yaboot of=/dev/sda1 bs=4096" + dd if=/lib/lilo/pmac/yaboot of=/dev/sda1 bs=4096 + + # Set 0x41 as the partition type of the first partition + # echo A | dd of=/dev/sda bs=1 count=1 seek=450 else - echo "Can not find the boot loader." - exit 1 - fi + echo "there isn't yaboot bootloader" + fi else - echo "run grub-install to configure the MBR." - if [ -e /etc/mtab ];then - mv /etc/mtab /etc/mtab.bak - fi - grep -v rootfs /proc/mounts > /etc/mtab - boot_device='' - if [ -f "/etc/systemconfig/systemconfig.conf" ];then - boot_root=`cat /etc/systemconfig/systemconfig.conf | grep ROOTDEV | awk '{print $3}'` - boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'` - else - boot_root=`mount | grep -E ' on\s+/ type ' | awk '{print $1}'` - boot_device=`echo $boot_root | sed -e 's/[0-9]*$//'` - - #str_temp=`mount | awk '{print $1","$3}'` - #for line in $str_temp - #do - # mp=`echo $line | awk -F, '{print $2}'` - # if [ "$mp" = "/" ];then - # boot_device=`echo $line | awk -F, '{print $1}' | sed -e 's/[0-9]*$//'` - # break - # fi - #done - fi - - if [ -n "$boot_device" ];then - echo "The boot device is $boot_device" - echo "The boot root device is $boot_root" - else - echo "Can not find the boot device, return error" - exit 1 - fi - - # set grub to use this boot device - if grep -qe '^VERSION\s*=\s*11' /etc/SuSE-release; then - #sles11, run grub-install.unsupported directly - echo "grub-install.unsupported --no-floppy --recheck $boot_device" - grub-install.unsupported --no-floppy --recheck $boot_device - # note: the error about grub-set-default not existing is harmless, because we want the default to be 0 anyway - else - #for sles10, should run grub-install with parameters - echo "grub-install --no-floppy --recheck $boot_device" - grub-install --no-floppy --recheck $boot_device - fi - - # change the entries in the grub conf file to use the correct boot root device - # (not the one leftover from the golden image) - if [ -f "/boot/grub/grub.conf" ];then - conffile="/boot/grub/grub.conf" - else - conffile="/boot/grub/menu.lst" - fi - sed -i 's| root=\S*| root='$boot_root'|' $conffile - sed -i 's| resume=\S*| noresume|' $conffile - - if [ -e /etc/mtab.bak ];then - mv -f /etc/mtab.bak /etc/mtab - else - rm -f /etc/mtab - fi -fi + echo "[ERROR]: unsupport arch....." +fi + diff --git a/xCAT/postscripts/configib b/xCAT/postscripts/configib index 682979e7a..4717c1339 100755 --- a/xCAT/postscripts/configib +++ b/xCAT/postscripts/configib @@ -147,9 +147,12 @@ then else dir="/etc/sysconfig/network-scripts" fi - #`rm -f $dir/ifcfg-$nic` 2>&1 1>/dev/null - # nic aliases - `rm -f $dir/ifcfg-ib*` 2>&1 1>/dev/null + + # remove the nic configuration files which are included in $NIC_IBNICS + for nic in echo "$NIC_IBNICS" | tr "," "\n" + do + rm -f $dir/ifcfg-$nic 2>&1 1>/dev/null + done else loop_number=`lsdev | grep "IP over Infiniband Network Interface" | wc -l` num=0 diff --git a/xCAT/postscripts/enablekdump b/xCAT/postscripts/enablekdump index 52b8d7c89..3e711afff 100755 --- a/xCAT/postscripts/enablekdump +++ b/xCAT/postscripts/enablekdump @@ -99,8 +99,10 @@ if [ ! -z "$DUMP" ]; then # workaround for RHEL6 # the $KDIP:$KDPATH directory will be used to generate the initrd for kdump service MOUNTPATH="" - if (pmatch $OSVER "*6\.*" ); then + if ((pmatch $OSVER "*6\.*")); then MOUNTPATH="/tmp" + elif (pmatch $OSVER "*7\.*"); then + MOUNTPATH="/mnt" else MOUNTPATH="/var/tmp" fi @@ -213,7 +215,17 @@ EOF mv ${oldremount}.bak $oldremount fi else - if (pmatch $OSVER "fedora*") || (pmatch $OSVER "rhel6*") || (pmatch $OSVER "rhels6*") || [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ];then + if (pmatch $OSVER "rhel7*") || (pmatch $OSVER "rhels7*");then + /bin/mount -o vers=3 $KDIP:$KDPATH $MOUNTPATH + #/bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH + [ -d $MOUNTPATH/var/crash ] || mkdir -p $MOUNTPATH/var/crash + echo "nfs $KDIP:$KDPATH" > /etc/kdump.conf + echo "default shell" >> /etc/kdump.conf + sed -i 's/KDUMP_COMMANDLINE_APPEND="/KDUMP_COMMANDLINE_APPEND="nonodestatus /' /etc/sysconfig/kdump + [ -f /etc/dracut.conf ] && mv /etc/dracut.conf /tmp/dracut.conf + restartservice kdump + [ -f /tmp/dracut.conf ] && mv /tmp/dracut.conf /etc/dracut.conf + elif (pmatch $OSVER "fedora*") || (pmatch $OSVER "rhel6*") || (pmatch $OSVER "rhels6*") || [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ];then /bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH echo "net $KDIP:$KDPATH" > /etc/kdump.conf echo "link_delay 180" >> /etc/kdump.conf diff --git a/xCAT/postscripts/hardeths b/xCAT/postscripts/hardeths index 3c72f3dd0..caa0b63cb 100755 --- a/xCAT/postscripts/hardeths +++ b/xCAT/postscripts/hardeths @@ -1,4 +1,4 @@ -PREFIXMASK#!/bin/sh +#!/bin/sh # pmatch determines if 1st argument string is matched by 2nd argument pattern pmatch () diff --git a/xCAT/postscripts/replace_byid_device b/xCAT/postscripts/replace_byid_device new file mode 100644 index 000000000..8d199c2a6 --- /dev/null +++ b/xCAT/postscripts/replace_byid_device @@ -0,0 +1,45 @@ +#!/bin/bash + +#Only used by sysclone + +#if the /etc/systemimager/byid_real_map.conf exist, +#the device name used in fstab and grub are in "by-id" style +#use the by-id name on target node to replace the name on the goden client + +if [ ! -e /etc/systemimager/byid_real_map.conf ];then + exit 0 +fi + +sed -e 's/-part[0-9]\+//g' -e 's/[0-9]\+$//' /etc/systemimager/byid_real_map.conf | uniq | + while read str_line +do + str_old_dev="${str_line%%:*}" + str_real="${str_line##*:}" + str_real="${str_line##*/}" +# str_dev_prefix=`basename $str_old_dev | awk -F'-' '{print $1}'` + + #find out the new by-id name + str_new_dev=`ls -l --time-style=locale /dev/disk/by-id/ | grep -E "$str_real\$" | awk '{print $9}'` + if [ -z "$str_new_dev" ];then + continue + fi + str_new_dev="/dev/disk/by-id/${str_new_dev}" + + for str_file_name in \ + /boot/efi/efi/SuSE/elilo.conf \ + /boot/efi/EFI/redhat/grub.conf \ + /boot/grub/menu.lst \ + /boot/grub/device.map \ + /etc/elilo.conf \ + /etc/fstab \ + /etc/grub.conf \ + /etc/lilo.conf \ + /etc/yaboot.conf + do + if [ -f $str_file_name ];then + sed -i "s:$str_old_dev:$str_new_dev:g" "$str_file_name" + fi + done +done + +exit 0 diff --git a/xCAT/postscripts/syscloneimgupdate b/xCAT/postscripts/syscloneimgupdate index 645ba7925..add1e21be 100755 --- a/xCAT/postscripts/syscloneimgupdate +++ b/xCAT/postscripts/syscloneimgupdate @@ -13,7 +13,27 @@ fi #update the exclude configuration file #do not sync the following files -for filename in /etc/fstab /boot/grub /etc/grub.conf /boot/efi /etc/elilo.conf /xcatpost /etc/xcat /etc/hosts /etc/udev/rules.d /etc/modprobe.d/bond0.conf /etc/modprobe.d/bond1.conf /etc/ssh /etc/sysconfig/syslog /etc/syslog-ng/syslog-ng.conf /opt/xcat /root/.ssh /var/cache /var/lib +for filename in \ + /boot/efi \ + /boot/grub \ + /etc/fstab \ + /etc/grub.conf \ + /etc/lilo.conf \ + /etc/elilo.conf \ + /etc/xcat \ + /etc/yaboot.conf \ + /etc/hosts \ + /etc/udev/rules.d \ + /etc/modprobe.d/bond0.conf \ + /etc/modprobe.d/bond1.conf \ + /etc/ssh \ + /etc/sysconfig/syslog \ + /etc/syslog-ng/syslog-ng.conf \ + /opt/xcat \ + /root/.ssh \ + /var/cache \ + /var/lib \ + /xcatpost do if [ ! -e $filename ];then continue diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index c0ac65f1c..03fd10b82 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -12,6 +12,24 @@ fi SLI=$(awk 'BEGIN{srand(); printf("%d\n",rand()*10)}') sleep $SLI + + +#the nics have not been configured when running the PBS sometimes, need to make sure... +RETRY=0 +until ip -4 --oneline addr show|grep -v 127.0.0.1 >/dev/null +do + sleep 2 + RETRY=$[ $RETRY + 1 ] + if [ $RETRY -eq 15 ];then + logger -t xcat -p local4.err "Network not configured, please check..." + echo `date` "xcatinstallpost: Network not configured, please check..." >> /var/log/xcat/xcat.log + exit 1 + fi + +done + + + cd /xcatpost; PATH=/xcatpost:$PATH export PATH diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index 893f04996..713d273bc 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -63,6 +63,9 @@ Requires: syslinux xCAT-genesis-scripts-x86_64 elilo-xcat Requires: ipmitool-xcat >= 1.8.9 Requires: xnba-undi %endif +%ifarch ppc ppc64 +Requires: xCAT-genesis-scripts-ppc64 +%endif %if %notpcm %ifarch i386 i586 i686 x86 x86_64