From 8c2e36a02c38ee0e48d3d1aa08a3b8ebef330eb3 Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 31 Jul 2013 10:16:58 +0800 Subject: [PATCH 001/184] this is a test --- README | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/README b/README index 0696fd032..7ac9ab2fb 100644 --- a/README +++ b/README @@ -6,9 +6,4 @@ xCAT documentation is available at: http://xcat.sourceforge.net/ xCAT is made available as open source software under the EPL license: http://www.opensource.org/licenses/eclipse-1.0.php - - - - - - +test From 79748cf356a944ce820ff7c078658bf8aa30fa2d Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 31 Jul 2013 10:22:34 +0800 Subject: [PATCH 002/184] fix README --- README | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 README diff --git a/README b/README deleted file mode 100644 index 7ac9ab2fb..000000000 --- a/README +++ /dev/null @@ -1,9 +0,0 @@ -xCAT - eXtreme Cloud Administration Toolkit - -xCAT is a toolkit for the deployment and administration of clusters. - -xCAT documentation is available at: http://xcat.sourceforge.net/ - -xCAT is made available as open source software under the EPL license: -http://www.opensource.org/licenses/eclipse-1.0.php -test From 0f0046ca9d73dc43d432ad9fe7fef401cfd81513 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 5 Aug 2013 09:36:08 -0400 Subject: [PATCH 003/184] add support for updatenode -g flag to generate mypostcripts files --- perl-xCAT/xCAT/Usage.pm | 5 ++- xCAT-client/bin/updatenode | 1 + xCAT-server/lib/xcat/plugins/updatenode.pm | 43 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 10d370aa0..52e362627 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -343,7 +343,7 @@ my %usage = ( renergy noderange [-V] { cappingstatus={on | enable | off | disable} | {cappingwatt|cappingvalue}=watt }", "updatenode" => "Usage: - updatenode [-h|--help|-v|--version] + updatenode [-h|--help|-v|--version | -g|--genmypost] or updatenode [-V|--verbose] [-k|--security] [-s|--sn] or @@ -368,6 +368,9 @@ Options: [-f|--snsync] Performs File Syncing to the service nodes that service the nodes in the noderange. + [-g|--genmypost] Will generate a new mypostscript file for the + the nodes in the noderange, if site precreatemypostscripts is 1 or YES. + [-l|--user] User name to run the updatenode command. It overrides the current user which is the default. diff --git a/xCAT-client/bin/updatenode b/xCAT-client/bin/updatenode index b0c14fe5c..35e7efd99 100755 --- a/xCAT-client/bin/updatenode +++ b/xCAT-client/bin/updatenode @@ -88,6 +88,7 @@ if ( 'v|version' => \$::VERSION, 'V|verbose' => \$::VERBOSE, 'F|sync' => \$::FILESYNC, + 'g|genmypost' => \$::GENMYPOST, 'f|snsync' => \$::SNFILESYNC, 'l|user:s' => \$::USER, 'S|sw' => \$::SWMAINTENANCE, diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 7295b26b7..a8e03b1ad 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -218,6 +218,7 @@ sub preprocess_updatenode 'v|version' => \$::VERSION, 'V|verbose' => \$::VERBOSE, 'F|sync' => \$::FILESYNC, + 'g|genmypost' => \$::GENMYPOST, 'l|user:s' => \$::USER, 'f|snsync' => \$::SNFILESYNC, 'S|sw' => \$::SWMAINTENANCE, @@ -249,6 +250,38 @@ sub preprocess_updatenode $callback->($rsp); return; } + # Just generate mypostscripts file and get out + if ($::GENMYPOST) + { + my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts"); + if ($entries[0] ) { + $entries[0] =~ tr/a-z/A-Z/; + if ($entries[0] =~ /^(1|YES)$/ ) { + + my $notmpfiles=1; + my $nofiles=0; + xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles); + my $rsp = {}; + $rsp->{data}->[0] = "Generated new mypostscript files"; + $callback->($rsp); + } else { # not valid unless precreatemypostscripts enabled + my $rsp = {}; + $rsp->{error}->[0] = + "This option is only valid if site table precreatemypostscripts attribute is 1 or YES"; + $rsp->{errorcode}->[0] =1; + $callback->($rsp); + return ; + } + } else { # not in the site table + my $rsp = {}; + $rsp->{error}->[0] = + "This option is only valid if site table precreatemypostscripts attribute is 1 or YES"; + $rsp->{errorcode}->[0] =1; + $callback->($rsp); + return ; + } + return 0; + } # -c must work with -S for AIX node if ($::CMDLINE && !$::SWMAINTENANCE) @@ -1267,6 +1300,7 @@ sub updatenoderunps # Note order of parameters to xcatdsklspost #is important and cannot be changed my $runpscmd; + if ($::SETSERVER){ $runpscmd = "$installdir/postscripts/xcatdsklspost $mode -M $snkey '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c"; @@ -1274,6 +1308,11 @@ sub updatenoderunps $runpscmd = "$installdir/postscripts/xcatdsklspost $mode -m $snkey '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c" } + # add verbose flag + if ($::VERBOSE){ + $runpscmd .= " -V"; + } + push @$args1,"--nodestatus"; # return nodestatus if (defined($::fanout)) { # fanout push @$args1,"-f" ; @@ -1596,6 +1635,10 @@ sub updatenodesoftware $cmd = "$installdir/postscripts/xcatdsklspost 2 -m $snkey 'ospkgs,otherpkgs' --tftp $tftpdir"; } + # add verbose flag + if ($::VERBOSE){ + $cmd .= " -V"; + } # build xdsh command push @$args1,"--nodestatus"; # return nodestatus From cf502073f421fc428fa32bec5b0f1697391be3ee Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 5 Aug 2013 09:52:45 -0400 Subject: [PATCH 004/184] fix defect 3479 --- xCAT/postscripts/remoteshell | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index 35ba0dbb6..c8a7553fa 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -23,21 +23,28 @@ if [ "$(uname -s)" = "AIX" ]; then fi if [ -r /etc/ssh/sshd_config ] then - logger -t xcat -p local4.info "Install: setup /etc/ssh/sshd_config" + logger -t xcat -p local4.info "remoteshell: setup /etc/ssh/sshd_config and ssh_config" cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIG - sed -i 's/^X11Forwarding .*$/X11Forwarding yes/' /etc/ssh/sshd_config - sed -i 's/^KeyRegenerationInterval .*$/KeyRegenerationInterval 0/' /etc/ssh/sshd_config - sed -i 's/\(.*MaxStartups.*\)/#\1/' /etc/ssh/sshd_config - echo "MaxStartups 1024" >>/etc/ssh/sshd_config + #delete all occurance of the attribute and then add xCAT settings + sed -i '/X11Forwarding /'d /etc/ssh/sshd_config + echo "X11Forwarding yes" >>/etc/ssh/sshd_config + sed -i '/KeyRegenerationInterval /'d /etc/ssh/sshd_config + echo "KeyRegenerationInterval 0" >>/etc/ssh/sshd_config + sed -i '/MaxStartups /'d /etc/ssh/sshd_config + echo "MaxStartups 1024" >>/etc/ssh/sshd_config + if [ "$SETUPFORPCM" = "1" ];then - sed -i 's/\(.*PasswordAuthentication.*\)/#\1/' /etc/ssh/sshd_config - echo "PasswordAuthentication yes" >>/etc/ssh/sshd_config + sed -i '/PasswordAuthentication /'d /etc/ssh/sshd_config + echo "PasswordAuthentication yes" >>/etc/ssh/sshd_config + fi fi if [ -r /etc/ssh/sshd_config ] then - echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config + sed -i '/StrictHostKeyChecking /'d /etc/ssh/ssh_config + echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config + fi if [ -d /xcatpost/_ssh ] From d0411a285f29375cf213ad34ed6e3bcd356c9e51 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 5 Aug 2013 10:05:05 -0400 Subject: [PATCH 005/184] fix defect 2959 --- xCAT-server/lib/perl/xCAT/xcatd.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/xcatd.pm b/xCAT-server/lib/perl/xCAT/xcatd.pm index 67891d54e..ed76310dc 100644 --- a/xCAT-server/lib/perl/xCAT/xcatd.pm +++ b/xCAT-server/lib/perl/xCAT/xcatd.pm @@ -69,15 +69,18 @@ sub validate { $policytable->close; my $rule; my $peerstatus="untrusted"; + # This sorts the policy table rows based on the level of the priority field in the row. + # note the lower the number in the policy table the higher the priority + my @sortedpolicies = sort { $a->{priority} <=> $b->{priority} } (@$policies); # check to see if peerhost is trusted - foreach $rule (@$policies) { + foreach $rule (@sortedpolicies) { if (($rule->{name} and $rule->{name} eq $peername) && ($rule->{rule}=~ /trusted/i)) { $peerstatus="Trusted"; last; } } - RULE: foreach $rule (@$policies) { + RULE: foreach $rule (@sortedpolicies) { if ($rule->{name} and $rule->{name} ne '*') { #TODO: more complex matching (lists, wildcards) next unless ($peername and $peername eq $rule->{name}); From 861794f576729ff63482685fd921c475e1abe20d Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 5 Aug 2013 10:36:29 -0400 Subject: [PATCH 006/184] fix defect 3464 --- perl-xCAT/xCAT/ServiceNodeUtils.pm | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/perl-xCAT/xCAT/ServiceNodeUtils.pm b/perl-xCAT/xCAT/ServiceNodeUtils.pm index 97cb15ba1..242ccbf08 100644 --- a/perl-xCAT/xCAT/ServiceNodeUtils.pm +++ b/perl-xCAT/xCAT/ServiceNodeUtils.pm @@ -30,7 +30,6 @@ use strict; Example: my $retdata = xCAT::ServiceNodeUtils->readSNInfo; =cut - #----------------------------------------------------------------------------- sub readSNInfo { @@ -102,13 +101,17 @@ sub isServiceReq require xCAT::Table; my ($class, $servicenodename, $serviceip) = @_; - # list of all services from service node table - # note this must be updated if more services added - my @services = ( - "nameserver", "dhcpserver", "tftpserver", "nfsserver", - "conserver", "monserver", "ldapserver", "ntpserver", - "ftpserver", "ipforward" - ); + # get list of all services from service node table ( actually all defined attributes) + # read the schema + my $schema = xCAT::Table->getTableSchema("servicenode"); + my @services; # list of only the actual service attributes from the servicenode table + my @servicesattrs; # building second copy for call to getAllNodeAttribs, which modifies the array + foreach my $c (@{$schema->{cols}}) { + if (($c ne "node") && ($c ne "comments") && ($c ne "disable")) { + push @servicesattrs,$c; + push @services,$c; + } + } my @ips = @$serviceip; # list of service node ip addresses and names my $rc = 0; @@ -139,10 +142,11 @@ sub isServiceReq } my $servicehash; - # read all the nodes from the table, for each service - foreach my $service (@services) + + # read all the nodes from the table, all the service attributes + my @snodelist= $servicenodetab->getAllNodeAttribs(\@servicesattrs); + foreach my $service (@services) # check list of services { - my @snodelist = $servicenodetab->getAllNodeAttribs([$service]); foreach $serviceip (@ips) # check the table for this servicenode { From df1c52016195d223bc0cd3bb0b5e582345f5a291 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 5 Aug 2013 14:10:20 -0400 Subject: [PATCH 007/184] add MAX/MIN function --- perl-xCAT/xCAT/Table.pm | 94 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 34c73c189..278b11aec 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -323,6 +323,8 @@ sub handle_dbc_request { return $opentables{$tablename}->{$autocommit}->getAllNodeAttribs(@args); } elsif ($functionname eq 'getAllEntries') { return $opentables{$tablename}->{$autocommit}->getAllEntries(@args); + } elsif ($functionname eq 'getMAXMINEntries') { + return $opentables{$tablename}->{$autocommit}->getMAXMINEntries(@args); } elsif ($functionname eq 'writeAllEntries') { return $opentables{$tablename}->{$autocommit}->writeAllEntries(@args); } elsif ($functionname eq 'getAllAttribsWhere') { @@ -3988,5 +3990,97 @@ sub output_table { print $fh "\n"; return 0; } +#-------------------------------------------------------------------------- + +=head3 getMAXMINEntries + + Description: Select the rows in the Table which has the MAX and the row with the + Min value for the input attribute. + Currently only the auditlog and evenlog are setup to have such an attribute (recid). + + Arguments: + Table handle + attribute name ( e.g. recid) + + Returns: + HASH + max=> max value + min=> min value + Globals: + + Error: + + Example: + + my $tabh = xCAT::Table->new($table); + my $recs=$tabh->getMAXMINEntries("recid"); + + Comments: + none + +=cut + +#-------------------------------------------------------------------------------- +sub getMAXMINEntries +{ + my $self = shift; + my $attr = shift; + if ($dbworkerpid) { + return dbc_call($self,'getMAXMINEntries',@_); + } + my $rets; + my $query; + my $xcatcfg=get_xcatcfg(); + # delimit the disable column based on the DB + my $disable= &delimitcol("disable"); + my $qstring; + if ($xcatcfg =~ /^DB2:/) { # for DB2 + $qstring = "SELECT MAX (\"$attr\") FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')"; + } else { + $qstring = "SELECT MAX($attr) FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')"; + } + $query = $self->{dbh}->prepare($qstring); + + $query->execute(); + while (my $data = $query->fetchrow_hashref()) + { + foreach (keys %$data) + { + if ($data->{$_} =~ /^$/) + { + $rets->{"max"} = undef; + } else { + $rets->{"max"} = $data->{$_}; + + } + last; # better only be one value for max + + } + } + $query->finish(); + if ($xcatcfg =~ /^DB2:/) { # for DB2 + $qstring = "SELECT MIN (\"$attr\") FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')"; + } else { + $qstring = "SELECT MIN($attr) FROM " . $self->{tabname} . " WHERE " . $disable . " is NULL or " . $disable . " in ('0','no','NO','No','nO')"; + } + $query = $self->{dbh}->prepare($qstring); + + $query->execute(); + while (my $data = $query->fetchrow_hashref()) + { + foreach (keys %$data) + { + if ($data->{$_} =~ /^$/) + { + $rets->{"min"} = undef; + } else { + $rets->{"min"} = $data->{$_}; + } + last; # better be only one value for min + } + } + return $rets; +} + 1; From 8921bc2734d2dc7f257526f2ab9386a935f180fb Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 6 Aug 2013 00:53:30 -0700 Subject: [PATCH 008/184] fix defect 3245 2.8:return value of nodeset does not equal to 0 on ppc64 --- xCAT-server/lib/xcat/plugins/yaboot.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 004b73360..6351ff2e6 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -296,7 +296,8 @@ sub setstate { my $pname = "yaboot.conf-" . $tmp; unlink($tftpdir."/".$pname); link($tftpdir."/etc/".$node,$tftpdir."/".$pname); - } + } + return; } From e88a680e6b492745b7e0c1ddc11aa3263bc2e20f Mon Sep 17 00:00:00 2001 From: root Date: Tue, 6 Aug 2013 16:02:31 -0400 Subject: [PATCH 009/184] fixed bug 3706. When genimage, it generated the CentOS-Base.repo in the /etc/yum.repos.d, but the internet repositories were not enabled=0. disable it --- xCAT-server/share/xcat/netboot/rh/genimage | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index b67cdd98c..aca1fc013 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -538,6 +538,14 @@ if (-d "$rootimg_dir/usr/share/dracut") { print "Enter the dracut mode. Dracut version: $dracutver. Dracut directory: $dracutdir.\n"; } + +#-- for centos, disable the internet repository +if( -e "$rootimg_dir/etc/yum.repos.d/CentOS-Base.repo" ) { + my $repo_content=`sed -e '/enabled/d' $rootimg_dir/etc/yum.repos.d/CentOS-Base.repo | sed -e '/^gpgkey/i enabled=0'`; + system("echo '$repo_content' > $rootimg_dir/etc/yum.repos.d/CentOS-Base.repo"); +} +# + #-- run postinstall script unless ($imagename) { $postinstall_filename= imgutils::get_profile_def_filename($osver, $profile, $arch, $customdir, "postinstall"); From 2bca640ffaad911434e3983ab37202781d9b5508 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 6 Aug 2013 09:44:52 -0400 Subject: [PATCH 010/184] fix bug --- perl-xCAT/xCAT/Table.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 278b11aec..1e1750d52 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -4024,10 +4024,10 @@ sub output_table { sub getMAXMINEntries { my $self = shift; - my $attr = shift; if ($dbworkerpid) { return dbc_call($self,'getMAXMINEntries',@_); } + my $attr = shift; my $rets; my $query; my $xcatcfg=get_xcatcfg(); From 63edd565d11deaea0c2bc5de620ed1d046662841 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 6 Aug 2013 10:56:57 -0400 Subject: [PATCH 011/184] Correct language in sensor decode --- xCAT-server/lib/xcat/plugins/ipmi.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 1d7abb317..8126558c8 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -3905,8 +3905,8 @@ sub getaddsensorevent { 0x0f => "Enabling docking station", 0x10 => "Docking staion ejection", 0x11 => "Disable docking station", - 0x12 => "Calling operation system wake-up vector", - 0x13 => "Starting operation system boot process, call init 19h", + 0x12 => "Calling operating system wake-up vector", + 0x13 => "Starting operating system boot process, call init 19h", 0x14 => "Baseboard or motherboard initialization", 0x16 => "Floppy initialization", 0x17 => "Keyboard test", From 780fbaaad823073355c0702c8d6c668fd226a69a Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 6 Aug 2013 12:15:26 -0400 Subject: [PATCH 012/184] use MAXMIN routine --- xCAT-server/lib/xcat/plugins/tabutils.pm | 110 ++++++++--------------- 1 file changed, 38 insertions(+), 72 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 9cf8b00fc..2596cab60 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -580,9 +580,10 @@ sub tabdump if ($args) { @ARGV = @{$args}; } - Getopt::Long::Configure("posix_default"); - Getopt::Long::Configure("no_gnu_compat"); - Getopt::Long::Configure("bundling"); + Getopt::Long::Configure("posix_default"); + Getopt::Long::Configure("no_gnu_compat"); + Getopt::Long::Configure("bundling"); + if (!GetOptions( 'h|?|help' => \$HELP, @@ -604,14 +605,15 @@ sub tabdump return; } if ($FILENAME and $FILENAME !~ /^\//) { $FILENAME =~ s/^/$request->{cwd}->[0]\//; } - + if ($HELP) { $tabdump_usage->(0); return; } + if (($NUMBERENTRIES) && ($DESC)) { $cb->({error => "You cannot use the -n and -d flag together. ",errorcode=>1}); return 1; } - + if (($NUMBERENTRIES) && ($OPTW)) { $cb->({error => "You cannot use the -n and -w flag together. ",errorcode=>1}); return 1; @@ -620,10 +622,8 @@ sub tabdump $cb->({error => "You cannot use the -n and -f flag together. ",errorcode=>1}); return 1; } - if (scalar(@ARGV)>1) { $tabdump_usage->(1); return; } - my %rsp; # If no arguments given, we display a list of the tables if (!scalar(@ARGV)) { @@ -647,15 +647,15 @@ sub tabdump } # get the table name $table = $ARGV[0]; - + # if -n can only be the auditlog or eventlog if ($NUMBERENTRIES) { if (!( $table =~ /^auditlog/ ) && (!($table =~ /^eventlog/))){ $cb->({error => "$table table is not supported in tabdump -n. You may only use this option on the auditlog or the eventlog.",errorcode=>1}); return 1; - } - } - + } + } + # do not allow teal tables if ( $table =~ /^x_teal/ ) { $cb->({error => "$table table is not supported in tabdump. Use Teal maintenance commands. ",errorcode=>1}); @@ -703,7 +703,6 @@ sub tabdump return $rc; } - my $recs; my @ents; my @attrarray; @@ -758,12 +757,12 @@ sub tabdump } # # display input number of records for the table requested tabdump -n +# note currently only supports auditlog and eventlog # sub tabdump_numberentries { my $table = shift; my $cb = shift; my $numberentries = shift; # either number of records to display - my $attrrecid="recid"; my $VERBOSE = shift; my $rc=0; @@ -772,38 +771,21 @@ sub tabdump_numberentries { $cb->({error => "Unable to open $table",errorcode=>4}); return 1; } - my $DBname = xCAT::Utils->get_DBName; - my @attribs = ($attrrecid); - my @ents=$tab->getAllAttribs(@attribs); - if (@ents) { # anything to process - # find smallest and largest recid, note table is not ordered by recid after - # a while - my $smallrid; - my $largerid; - foreach my $rid (@ents) { - if (!(defined $smallrid)) { - $smallrid=$rid; - } - if (!(defined $largerid)) { - $largerid=$rid; - } - if ($rid->{$attrrecid} < $smallrid->{$attrrecid}) { - $smallrid=$rid; - } - if ($rid->{$attrrecid} > $largerid->{$attrrecid}) { - $largerid=$rid; - } - } - my $RECID; - #determine recid to show all records after - $RECID= $largerid->{$attrrecid} - $numberentries ; - $rc=tabdump_recid($table,$cb,$RECID, $attrrecid); - } else { + #determine recid to show all records after + my $RECID; + my $attrrecid="recid"; + my $values = $tab->getMAXMINEntries($attrrecid); + my $max=$values->{"max"}; + if (defined($values->{"max"})){ + $RECID= $values->{"max"} - $numberentries ; + $rc=tabdump_recid($table,$cb,$RECID, $attrrecid); + + } else { my %rsp; push @{$rsp{data}}, "Nothing to display from $table."; $rsp{errorcode} = $rc; $cb->(\%rsp); - } + } return $rc; } # Display requested recored @@ -831,6 +813,7 @@ sub tabdump_recid { output_table($table,$cb,$tab,\@recs); return $rc; } + # Display information from the daemon. # sub lsxcatd @@ -1066,7 +1049,7 @@ sub tabprune if (($table eq "eventlog") || ($table eq "auditlog")) { $attrrecid="recid"; } else { - if ($table eq "isnm_perf") { # if ISNM These tables are really not supported in 2.8 or later + if ($table eq "isnm_perf") { # if ISNM These tables are really not supported in 2.8 or later $attrrecid="perfid"; } else { $attrrecid="period"; # isnm_perf_sum table @@ -1134,51 +1117,34 @@ sub tabprune_numberentries { $cb->({error => "Unable to open $table",errorcode=>4}); return 1; } - my $DBname = xCAT::Utils->get_DBName; - my @attribs = ("$attrrecid"); - my @ents=$tab->getAllAttribs(@attribs); - if (@ents) { # anything to process - # find smallest and largest recid, note table is not ordered by recid after - # a while - my $smallrid; - my $largerid; - foreach my $rid (@ents) { - if (!(defined $smallrid)) { - $smallrid=$rid; - } - if (!(defined $largerid)) { - $largerid=$rid; - } - if ($rid->{$attrrecid} < $smallrid->{$attrrecid}) { - $smallrid=$rid; - } - if ($rid->{$attrrecid} > $largerid->{$attrrecid}) { - $largerid=$rid; - } - } - my $RECID; + my $RECID; + my $values = $tab->getMAXMINEntries($attrrecid); + if ((defined($values->{"max"})) && (defined($values->{"min"}))) { + my $largerid = $values->{"max"}; + my $smallrid = $values->{"min"}; if ($flag eq "n") { # deleting number of records - #determine recid to delete all entries that come before like the -i flag - $RECID= $smallrid->{$attrrecid} + $numberentries ; + #get the smalled recid and add number to delete, that is where to start removing + $RECID= $smallrid + $numberentries ; } else { # flag must be percentage #take largest and smallest recid and percentage and determine the recid # that will remove the requested percentage. If some are missing in the # middle due to tabedit, we are not worried about it. - my $totalnumberrids = $largerid->{$attrrecid} - $smallrid->{$attrrecid} +1; + my $totalnumberrids = $largerid - $smallrid +1; my $percent = $numberentries / 100; my $percentage=$totalnumberrids * $percent ; my $cnt=sprintf( "%d", $percentage ); # round to whole number - $RECID=$smallrid->{$attrrecid} + $cnt; # get recid to remove all before + $RECID=$smallrid + $cnt; # get recid to remove all before } + # Now prune starting at $RECID $rc=tabprune_recid($table,$cb,$RECID, $attrrecid,$VERBOSE); - } else { + } else { my %rsp; push @{$rsp{data}}, "Nothing to prune from $table."; $rsp{errorcode} = $rc; $cb->(\%rsp); - } - return $rc; + } + return $rc; } # prune all entries up to the record id input From 6fb47b1d50d171d63a4d5cc897c60fe399508b36 Mon Sep 17 00:00:00 2001 From: linggao Date: Tue, 6 Aug 2013 20:21:03 -0400 Subject: [PATCH 013/184] fixed defect 3729 imgexport does not honor rootimgdir --- xCAT-server/lib/xcat/plugins/imgport.pm | 125 ++++++++++++++---------- 1 file changed, 75 insertions(+), 50 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/imgport.pm b/xCAT-server/lib/xcat/plugins/imgport.pm index db6d04585..9e3e2af9a 100644 --- a/xCAT-server/lib/xcat/plugins/imgport.pm +++ b/xCAT-server/lib/xcat/plugins/imgport.pm @@ -438,7 +438,7 @@ sub get_files{ my @files; my $dir = "$installroot/netboot/$osvers/s390x/$profile"; opendir(DIR, $dir) or $callback->({error=>["Could not open image files in directory $dir"], errorcode=>[1]}); - + while (my $file = readdir(DIR)) { # We only want files in the directory that end with .img next unless (-f "$dir/$file"); @@ -449,7 +449,7 @@ sub get_files{ if (@files) { $attrs->{rawimagefiles}->{files} = [@files]; } - + closedir(DIR); } else { @@ -465,37 +465,51 @@ sub get_files{ $attrs->{linuximage}->{pkglist} = $temp; } } - + @arr = ("$installroot/netboot"); - - # look for ramdisk - my $ramdisk = look_for_file('initrd-stateless.gz', $callback, $attrs, @arr); - unless($ramdisk){ - $callback->({error=>["Couldn't find ramdisk (initrd-stateless.gz) for $imagename"],errorcode=>[1]}); - $errors++; - }else{ - $attrs->{ramdisk} = $ramdisk; - } - - # look for kernel - my $kernel = look_for_file('kernel', $callback, $attrs, @arr); - unless($kernel){ - $callback->({error=>["Couldn't find kernel (kernel) for $imagename"],errorcode=>[1]}); - $errors++; - }else{ - $attrs->{kernel} = $kernel; - } - - # look for rootimg.gz - my $rootimg = look_for_file('rootimg.gz', $callback, $attrs, @arr); - unless($rootimg){ - $callback->({error=>["Couldn't find rootimg (rootimg.gz) for $imagename"],errorcode=>[1]}); - $errors++; - }else{ - $attrs->{rootimg} = $rootimg; - } - } - } elsif ($provmethod =~ /statelite/) { + my $rootimgdir=$attrs->{linuximage}->{rootimgdir}; + my $ramdisk; + my $kernel; + my $rootimg; + # look for ramdisk, kernel and rootimg.gz + if($rootimgdir) { + if (-f "$rootimgdir/initrd-stateless.gz") { + $ramdisk="$rootimgdir/initrd-stateless.gz"; + } + if (-f "$rootimgdir/kernel") { + $kernel="$rootimgdir/kernel"; + } + if (-f "$rootimgdir/rootimg.gz") { + $rootimg="$rootimgdir/rootimg.gz"; + } + + } else { + $ramdisk = look_for_file('initrd-stateless.gz', $callback, $attrs, @arr); + $kernel = look_for_file('kernel', $callback, $attrs, @arr); + $rootimg = look_for_file('rootimg.gz', $callback, $attrs, @arr); + } + unless($ramdisk){ + $callback->({error=>["Couldn't find ramdisk (initrd-stateless.gz) for $imagename"],errorcode=>[1]}); + $errors++; + }else{ + $attrs->{ramdisk} = $ramdisk; + } + + unless($kernel){ + $callback->({error=>["Couldn't find kernel (kernel) for $imagename"],errorcode=>[1]}); + $errors++; + }else{ + $attrs->{kernel} = $kernel; + } + + unless($rootimg){ + $callback->({error=>["Couldn't find rootimg (rootimg.gz) for $imagename"],errorcode=>[1]}); + $errors++; + }else{ + $attrs->{rootimg} = $rootimg; + } + } + } elsif ($provmethod =~ /statelite/) { @arr = ("$installroot/custom/netboot", "$xcatroot/share/xcat/netboot"); #get .pkglist file if (! $attrs->{linuximage}->{pkglist}) { @@ -510,25 +524,36 @@ sub get_files{ } @arr = ("$installroot/netboot"); - - # look for kernel - my $kernel = look_for_file('kernel', $callback, $attrs, @arr); - unless($kernel){ - $callback->({error=>["Couldn't find kernel (kernel) for $imagename"],errorcode=>[1]}); - $errors++; - }else{ - $attrs->{kernel} = $kernel; - } + my $rootimgdir=$attrs->{linuximage}->{rootimgdir}; + my $kernel; + my $ramdisk; + #look for kernel and ramdisk + if($rootimgdir) { + if (-f "$rootimgdir/kernel") { + $kernel="$rootimgdir/kernel"; + } + if (-f "$rootimgdir/initrd-statelite.gz") { + $ramdisk="$rootimgdir/initrd-statelite.gz"; + } + } else { + $kernel = look_for_file('kernel', $callback, $attrs, @arr); + $ramdisk = look_for_file('initrd-statelite.gz', $callback, $attrs, @arr); + } + + unless($kernel){ + $callback->({error=>["Couldn't find kernel (kernel) for $imagename"],errorcode=>[1]}); + $errors++; + }else{ + $attrs->{kernel} = $kernel; + } - # look for ramdisk - my $ramdisk = look_for_file('initrd-statelite.gz', $callback, $attrs, @arr); - unless($ramdisk){ - $callback->({error=>["Couldn't find ramdisk (initrd-statelite.gz) for $imagename"],errorcode=>[1]}); - $errors++; - }else{ - $attrs->{ramdisk} = $ramdisk; - } - } + unless($ramdisk){ + $callback->({error=>["Couldn't find ramdisk (initrd-statelite.gz) for $imagename"],errorcode=>[1]}); + $errors++; + }else{ + $attrs->{ramdisk} = $ramdisk; + } + } } if (( $provmethod =~ /raw/ ) and ( $arch =~ /s390x/ )) { From 5f8d3943462ed322f50e34d72515bd9cab5ae6c8 Mon Sep 17 00:00:00 2001 From: yinqing Date: Wed, 7 Aug 2013 11:30:21 +0800 Subject: [PATCH 014/184] #221180 There is no mechanism to prevent error message printed in kitimagepostdelete when disassociated kit with the image profile --- .../xcat/kits/kit_template/plugins/sample/imageprofile.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-buildkit/share/xcat/kits/kit_template/plugins/sample/imageprofile.pm b/xCAT-buildkit/share/xcat/kits/kit_template/plugins/sample/imageprofile.pm index 212aa60e6..cd287a7dd 100644 --- a/xCAT-buildkit/share/xcat/kits/kit_template/plugins/sample/imageprofile.pm +++ b/xCAT-buildkit/share/xcat/kits/kit_template/plugins/sample/imageprofile.pm @@ -171,6 +171,12 @@ sub process_request { # Do the check my $imageprofile = parse_str_arg($request->{arg}->[0]); + if (! exists($request->{kitdata})) + { + $rsp->{data}->[0] = "Skipped running \"$command\" plugin command for \"$PLUGIN_KITNAME\" kit."; + xCAT::MsgUtils->message("I", $rsp, $callback); + return; + } my $kitdata = $request->{kitdata}; if (! defined($kitdata)) { $kitdata = xCAT::KitPluginUtils->get_kits_used_by_image_profiles([$imageprofile]); @@ -742,4 +748,4 @@ sub parse_list_arg { } -1; \ No newline at end of file +1; From 600ab740aea724065e0e6b311b795435e4107588 Mon Sep 17 00:00:00 2001 From: yinqing Date: Wed, 7 Aug 2013 13:29:25 +0800 Subject: [PATCH 015/184] #220993 Can not import node by auto discovery switch and switch port. --- perl-xCAT/xCAT/ProfiledNodeUtils.pm | 27 +++++++++++++++++++ xCAT-server/lib/xcat/plugins/profilednodes.pm | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/ProfiledNodeUtils.pm b/perl-xCAT/xCAT/ProfiledNodeUtils.pm index 16fd6ae38..80f740384 100644 --- a/perl-xCAT/xCAT/ProfiledNodeUtils.pm +++ b/perl-xCAT/xCAT/ProfiledNodeUtils.pm @@ -550,6 +550,32 @@ sub get_allnode_singleattrib_hash #------------------------------------------------------------------------------- +=head3 get_db_swtiches + Description : Get all records of switch config from a table, then return a string list. + Arguments : $tabname - the table name. + Returns : Reference of the records hash. +=cut + +#------------------------------------------------------------------------------- +sub get_db_switches +{ + my $class = shift; + my $table = xCAT::Table->new("switches"); + my @attribs = ("switch"); + my @entries = $table->getAllAttribs(@attribs); + $table->close(); + my %allrecords; + foreach (@entries) + { + if ($_->{'switch'}){ + $allrecords{$_->{'switch'}} = 0; + } + } + return \%allrecords; +} + +#------------------------------------------------------------------------------- + =head3 get_db_swtichports Description : Get all records of switch config from a table, then return a string list. Arguments : $tabname - the table name. @@ -563,6 +589,7 @@ sub get_db_switchports my $table = xCAT::Table->new("switch"); my @attribs = ("switch", "port"); my @entries = $table->getAllAttribs(@attribs); + $table->close(); my %allrecords; foreach (@entries) { diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index 7c0b273bd..9161577e5 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -370,7 +370,7 @@ Usage: my %allfspips = %$recordsref; # Get all switches name - $recordsref = xCAT::ProfiledNodeUtils->get_allnode_singleattrib_hash('switches', 'switch'); + $recordsref = xCAT::ProfiledNodeUtils->get_db_switches(); %allswitches = %$recordsref; # Get all switches_switchport From 5459cf6a60e7b6fef40672e899c982c0f93e0835 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 7 Aug 2013 00:38:15 -0700 Subject: [PATCH 016/184] fix defect 3719 [DEV] rcons fails when nodehm.mgt=kvm --- xCAT-server/share/xcat/cons/kvm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/cons/kvm b/xCAT-server/share/xcat/cons/kvm index ae435a5aa..da90b01b8 100755 --- a/xCAT-server/share/xcat/cons/kvm +++ b/xCAT-server/share/xcat/cons/kvm @@ -51,9 +51,9 @@ import File::Basename; my $scriptname = $0; my $cmdref={ - command=>"getcons", - arg=>"text", - noderange=>$ARGV[0] + command=>["getcons"], + arg=>["text"], + noderange=>[$ARGV[0]] }; use Data::Dumper; my $dsthost; From 67a48e2ee648a44e99884802fdb8d8b6c01aad5f Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 7 Aug 2013 08:36:41 -0400 Subject: [PATCH 017/184] defect 3726: for the initrd of sles, the /modules in initrd should symbol link to the new kernel dir if there's new kernel dir --- xCAT-server/lib/xcat/plugins/sles.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index b2e9cf4c1..e4abb066f 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1851,6 +1851,15 @@ sub insert_dd () { # if the new kernel from update distro is not existed in initrd, create the path for it if (! -r "$dd_dir/initrd_img/lib/modules/$new_kernel_ver/") { mkpath ("$dd_dir/initrd_img/lib/modules/$new_kernel_ver/"); + # link the /modules to this new kernel dir + unlink "$dd_dir/initrd_img/modules"; + $cmd = "/bin/ln -sf lib/modules/$new_kernel_ver/initrd $dd_dir/initrd_img/modules"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + my $rsp; + push @{$rsp->{data}}, "Handle the driver update failed. Could not create link to the new kernel dir."; + xCAT::MsgUtils->message("I", $rsp, $callback); + } } # Copy the drivers to the rootimage From 650928ad15f9e8a07e9092d5d3278fd3629a4213 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 7 Aug 2013 16:59:49 -0400 Subject: [PATCH 018/184] Fix for noderange parentheses handling --- perl-xCAT/xCAT/NodeRange.pm | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 301fffe90..66df2c45c 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -1,5 +1,6 @@ # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html package xCAT::NodeRange; +use Text::Balanced qw/extract_bracketed/; require xCAT::Table; require Exporter; use strict; @@ -549,6 +550,26 @@ sub abbreviate_noderange { return (join ',',keys %targetelems,keys %nodesleft); } +sub set_arith { + my $operand = shift; + my $op = shift; + my $newset = shift; + if ($op =~ /@/) { # compute the intersection of the current atom and the node list we have received before this + foreach (keys %$operand) { + unless ($newset->{$_}) { + delete $operand->{$_}; + } + } + } elsif ($op =~ /,-/) { # add the nodes from this atom to the exclude list + foreach (keys %$newset) { + delete $operand->{$_} + } + } else { # add the nodes from this atom to the total node list + foreach (keys %$newset) { + $operand->{$_}=1; + } + } +} # Expand the given noderange # Input args: # - noderange to expand @@ -573,6 +594,38 @@ sub noderange { } my %nodes = (); my %delnodes = (); + if ($range =~ /\(/) { + my ($middle, $end, $start) = + extract_bracketed($range, '()', qr/[^()]*/); + unless ($middle) { die "Unbalanced parentheses in noderange" } + $middle = substr($middle,1,-1); + my $op = ","; + if ($start =~ m/-$/) { #subtract the parenthetical + $op .= "-" + } elsif ($start =~ m/@$/) { + $op = "@" + } + $start =~ s/,-$//; + $start =~ s/,$//; + $start =~ s/@$//; + %nodes = map { $_ => 1 } noderange($start,$verify,$exsitenode,%options); + my %innernodes = map { $_ => 1 } noderange($middle,$verify,$exsitenode,%options); + set_arith(\%nodes,$op,\%innernodes); + $op=","; + if ($end =~ m/^,-/) { + $op = ",-"; + $end =~ s/^,-//; + } elsif ($end =~ m/^@/) { + $op = "@"; + $end =~ s/^@//; + } else { + $end =~ s/^,//; + } + my %endnodes = map { $_ => 1 } noderange($end,$verify,$exsitenode,%options); + set_arith(\%nodes,$op,\%endnodes); + return sort(keys %nodes) + } + my $op = ","; my @elems = split(/(,(?![^[]*?])(?![^\(]*?\)))/,$range); # commas outside of [] or () if (scalar(@elems)==1) { From 68b4a0b5c723ba55ea435f7e8c33013eb22baa1d Mon Sep 17 00:00:00 2001 From: jjhua Date: Thu, 8 Aug 2013 14:41:41 -0400 Subject: [PATCH 019/184] fixed bug 3732, centos 5.x needs the url rpository --- xCAT-server/lib/perl/xCAT/Template.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 5981f1050..11d9c2085 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -178,7 +178,7 @@ sub subvars { my $source_in_pre; my $c = 0; foreach my $pkgdir(@pkgdirs) { - if( $platform =~ /^(rh|SL)$/ ) { + if( $platform =~ /^(rh|SL|centos)$/ ) { if ( $c == 0 ) { # After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x # the rhels5.9 will not be installed successfully. So put in kickstart directly. From fbd772e8cd547c843caaef2ea8e9db21dd07717d Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 8 Aug 2013 16:02:18 +0800 Subject: [PATCH 020/184] add testcase lsdef_t_h_i --- xCAT-test/autotest/testcase/lsdef/cases0 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xCAT-test/autotest/testcase/lsdef/cases0 b/xCAT-test/autotest/testcase/lsdef/cases0 index 6f1e3780b..2c8f50bbe 100644 --- a/xCAT-test/autotest/testcase/lsdef/cases0 +++ b/xCAT-test/autotest/testcase/lsdef/cases0 @@ -189,3 +189,10 @@ cmd:lsdef -t wrongtype -o test check:rc!=0 check:output=~Error end + +start:lsdef_t_h_i +description:lsdef -t node -h -i status +cmd:lsdef -t node -h -i status +check:rc==0 +check:output=~status +end From 839c6d85a38d9449dd8015803b9fa9c66b704f72 Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 8 Aug 2013 16:20:07 +0800 Subject: [PATCH 021/184] add testcase lsdef_nics --- xCAT-test/autotest/testcase/lsdef/cases0 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xCAT-test/autotest/testcase/lsdef/cases0 b/xCAT-test/autotest/testcase/lsdef/cases0 index 2c8f50bbe..0a4af8608 100644 --- a/xCAT-test/autotest/testcase/lsdef/cases0 +++ b/xCAT-test/autotest/testcase/lsdef/cases0 @@ -196,3 +196,14 @@ cmd:lsdef -t node -h -i status check:rc==0 check:output=~status end + +start:lsdef_nics +description:lsdef --nics +cmd:mkdef -t node -o testnode1 groups=all mgt=ipmi nicips.eth0=1.1.1.1 +check:rc==0 +cmd:lsdef testnode1 --nics +check:rc==0 +check:output=~1.1.1.1 +cmd:rmdef testnode1 +check:rc==0 +end From 3c874d9555a45e85f69e98ab890974cd868a2c1b Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 8 Aug 2013 17:18:00 +0800 Subject: [PATCH 022/184] update test case lsdef_nics --- xCAT-test/autotest/testcase/lsdef/cases0 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-test/autotest/testcase/lsdef/cases0 b/xCAT-test/autotest/testcase/lsdef/cases0 index 0a4af8608..9850384fc 100644 --- a/xCAT-test/autotest/testcase/lsdef/cases0 +++ b/xCAT-test/autotest/testcase/lsdef/cases0 @@ -206,4 +206,6 @@ check:rc==0 check:output=~1.1.1.1 cmd:rmdef testnode1 check:rc==0 +cmd:lsdef testnode1 +check:output=~Could not find end From 4225daa29f511365e86df05be07fa56603f0a00d Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 8 Aug 2013 12:58:00 -0400 Subject: [PATCH 023/184] defect 3703: to support command [nodeset osimage] when the provmethod has been set --- xCAT-server/lib/xcat/plugins/mic.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/mic.pm b/xCAT-server/lib/xcat/plugins/mic.pm index ebc4421e5..3c64260db 100644 --- a/xCAT-server/lib/xcat/plugins/mic.pm +++ b/xCAT-server/lib/xcat/plugins/mic.pm @@ -596,7 +596,7 @@ sub nodeset { my $subreq = shift; my $host2mic = shift; - my $usage_string = "nodeset noderange [osimage=imagename]"; + my $usage_string = "nodeset noderange osimage[=imagename]"; my $nodes = $request->{'node'}; my $args = $request->{arg}; @@ -604,9 +604,6 @@ sub nodeset { foreach (@$args) { if (/osimage=(.*)/) { $setosimg = $1; - } else { - xCAT::MsgUtils->message("E", {error=>[$usage_string], errorcode=>["1"]}, $callback); - return; } } @@ -625,11 +622,12 @@ sub nodeset { } $nttab->setNodesAttribs(\%setpmethod); } - + + # get the provision method from nodetype table my $nthash = $nttab->getNodesAttribs($nodes,['provmethod']); foreach my $node (@$nodes) { unless (defined ($nthash->{$node}->[0]->{'provmethod'})) { - xCAT::MsgUtils->message("E", {error=>["The provmethod for the node $node must be set before the nodeset."], errorcode=>["1"]}, $callback); + xCAT::MsgUtils->message("E", {error=>["The provmethod for the node $node must be set by [nodeset osimage=] or set in the provmethod attribute of the node."], errorcode=>["1"]}, $callback); return; } } From 76a47d856cd992b7240257b01f791b9ae6a464ed Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 8 Aug 2013 13:00:37 -0400 Subject: [PATCH 024/184] defect 3703: make the configmic and flashmic could get the correct hostname on the host node --- xCAT-server/sbin/configmic | 49 +++++++++++++++++++++++++------------- xCAT-server/sbin/flashmic | 49 +++++++++++++++++++++++++------------- 2 files changed, 64 insertions(+), 34 deletions(-) diff --git a/xCAT-server/sbin/configmic b/xCAT-server/sbin/configmic index fdcba748c..7eb4d10f3 100755 --- a/xCAT-server/sbin/configmic +++ b/xCAT-server/sbin/configmic @@ -35,28 +35,43 @@ unless ($master && $cfgpath) { } # get the correct host name for the host -my $nodename; +my ($nodename, $nodename_short); my $masterip = `getent hosts $master | awk {'print \$1'}`; -chomp($masterip); -my $myip = `ip route get $masterip| head -n 1 | sed 's/^.*src//g' | awk {'print \$1'}`; -my $myipinfo =`getent hosts $myip`; -if ($myipinfo =~ /([^\s]+)\s+([^\s]+)\s+([^\s]+)/) { - my $n1 = $2; - my $n2 = $3; - if (length($n1) > length($n2)) { - $nodename = $n2; - } else { - $nodename = $n1; +if ($masterip) { + chomp($masterip); + my $myip = `ip route get $masterip| head -n 1 | sed 's/^.*src//g' | awk {'print \$1'}`; + if ($myip) { + my $myipinfo =`getent hosts $myip`; + + if ($myipinfo && $myipinfo =~ /([^\s]+)\s+([^\s]+)\s+([^\s]+)/) { + my $n1 = $2; + my $n2 = $3; + if (length($n1) > length($n2)) { + $nodename_short = $n2; + } else { + $nodename = $n1; + } + } elsif ($myipinfo && $myipinfo =~ /([^\s]+)\s+([^\s]+)/) { + $nodename_short = $2; + } } -} elsif ($myipinfo =~ /([^\s]+)\s+([^\s]+)/) { - $nodename = $2; -} else { - outputmsg("Error: cannot get the hostname of the host node\n", 2); +} +unless ($nodename) { + $nodename = `hostname`; + chomp($nodename); +} +unless ($nodename_short) { + $nodename_short = `hostname -s`; + chomp($nodename_short); } # download the mic configuration file from master -my $cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/miccfg.$nodename -P $tmppath"; -my ($rc, $output) = runsyscmd ($cmd, "Error: failed to download mic configuration file from $master\n", 3); +my $cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/miccfg.$nodename_short -P $tmppath"; +my ($rc, $output) = runsyscmd ($cmd); +if ($rc) { + $cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/miccfg.$nodename -P $tmppath"; + runsyscmd ($cmd, "Error: failed to download mic configuration file from $master\n", 3); +} unless (-r "$tmppath/miccfg.$nodename") { runsyscmd ("Error: cannot get the mic configuration file from http://$master/$cfgpath/miccfg.$nodename\n", 4); diff --git a/xCAT-server/sbin/flashmic b/xCAT-server/sbin/flashmic index 0b0271595..daee9256b 100755 --- a/xCAT-server/sbin/flashmic +++ b/xCAT-server/sbin/flashmic @@ -36,28 +36,43 @@ unless ($master && $cfgpath) { } # get the correct host name for the host -my $nodename; +my ($nodename, $nodename_short); my $masterip = `getent hosts $master | awk {'print \$1'}`; -chomp($masterip); -my $myip = `ip route get $masterip| head -n 1 | sed 's/^.*src//g' | awk {'print \$1'}`; -my $myipinfo =`getent hosts $myip`; -if ($myipinfo =~ /([^\s]+)\s+([^\s]+)\s+([^\s]+)/) { - my $n1 = $2; - my $n2 = $3; - if (length($n1) > length($n2)) { - $nodename = $n2; - } else { - $nodename = $n1; +if ($masterip) { + chomp($masterip); + my $myip = `ip route get $masterip| head -n 1 | sed 's/^.*src//g' | awk {'print \$1'}`; + if ($myip) { + my $myipinfo =`getent hosts $myip`; + + if ($myipinfo && $myipinfo =~ /([^\s]+)\s+([^\s]+)\s+([^\s]+)/) { + my $n1 = $2; + my $n2 = $3; + if (length($n1) > length($n2)) { + $nodename_short = $n2; + } else { + $nodename = $n1; + } + } elsif ($myipinfo && $myipinfo =~ /([^\s]+)\s+([^\s]+)/) { + $nodename_short = $2; + } } -} elsif ($myipinfo =~ /([^\s]+)\s+([^\s]+)/) { - $nodename = $2; -} else { - outputmsg("Error: cannot get the hostname of the host node\n", 2); +} +unless ($nodename) { + $nodename = `hostname`; + chomp($nodename); +} +unless ($nodename_short) { + $nodename_short = `hostname -s`; + chomp($nodename_short); } # download the mic configuration file from master -my $cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/micflash.$nodename -P $tmppath"; -my ($rc, $output) = runsyscmd ($cmd, "Error: failed to download mic configuration file from $master\n", 3); +my $cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/micflash.$nodename_short -P $tmppath"; +my ($rc, $output) = runsyscmd ($cmd); +if ($rc) { + $cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/micflash.$nodename -P $tmppath"; + runsyscmd ($cmd, "Error: failed to download mic configuration file from $master\n", 3); +} unless (-r "$tmppath/micflash.$nodename") { runsyscmd ("Error: cannot get the mic configuration file from http://$master/$cfgpath/micflash.$nodename\n", 4); From 020889ad3cd7d5ca656df47f1fecca781a7a2dd1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 8 Aug 2013 16:26:00 -0400 Subject: [PATCH 025/184] Implement vm.storagecache and vm.storageformat It has been requested to make these tunables available since different storage schemes can benefit greatly from them --- perl-xCAT/xCAT/Schema.pm | 12 +++++++++++- perl-xCAT/xCAT/VMCommon.pm | 2 +- xCAT-server/lib/xcat/plugins/kvm.pm | 27 +++++++++++++++++++++------ 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index d965e3293..5a900e6c6 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -191,7 +191,7 @@ vmmaster => { } }, vm => { - cols => [qw(node mgr host migrationdest storage storagemodel cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter cluster guestostype othersettings vidmodel vidproto vidpassword comments disable)], + cols => [qw(node mgr host migrationdest storage storagemodel storagecache storageformat cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter cluster guestostype othersettings vidmodel vidproto vidpassword comments disable)], keys => [qw(node)], tablespace =>'XCATTBS32K', table_desc => 'Virtualization parameters', @@ -230,6 +230,8 @@ vm => { 'vidproto' => "Request a specific protocol for remote video access be set up. For example, spice in KVM.", 'vidmodel' => "Model of video adapter to provide to guest. For example, qxl in KVM", 'vidpassword' => "Password to use instead of temporary random tokens for VNC and SPICE access", + 'storagecache' => "Select caching scheme to employ. E.g. KVM understands 'none', 'writethrough' and 'writeback'", + 'storageformat' => "Select disk format to use by default (e.g. raw versus qcow2)", } }, hypervisor => { @@ -2237,6 +2239,14 @@ my @nodeattrs = ( tabentry => 'vm.storagemodel', access_tabentry => 'vm.node=attr:node', }, + {attr_name => 'vmstoragecache', + tabentry => 'vm.storagecache', + access_tabentry => 'vm.node=attr:node', + }, + {attr_name => 'vmstorageformat', + tabentry => 'vm.storageformat', + access_tabentry => 'vm.node=attr:node', + }, {attr_name => 'vmcfgstore', tabentry => 'vm.cfgstore', access_tabentry => 'vm.node=attr:node', diff --git a/perl-xCAT/xCAT/VMCommon.pm b/perl-xCAT/xCAT/VMCommon.pm index 96dc6367f..ab657b47d 100644 --- a/perl-xCAT/xCAT/VMCommon.pm +++ b/perl-xCAT/xCAT/VMCommon.pm @@ -26,7 +26,7 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes if ($vpdtab) { $cfghash->{vpd} = $vpdtab->getNodesAttribs($noderange,['uuid']); } - $cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','vidmodel','vidproto','vidpassword','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags','datacenter','guestostype','othersettings','master']); + $cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','storagecache','storageformat','vidmodel','vidproto','vidpassword','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags','datacenter','guestostype','othersettings','master']); my $mactab = xCAT::Table->new("mac",-create=>1); my $nrtab= xCAT::Table->new("noderes",-create=>1); $cfghash->{mac} = $mactab->getAllNodeAttribs(['mac'],1); diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index fc3880957..2c52ffb1e 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -488,6 +488,10 @@ sub build_diskstruct { $cdhash->{target}->{dev}='hdc'; push @returns,$cdhash; } + my $cachemethod = "none"; + if ( $confdata->{vm}->{$node}->[0]->{storagecache}) { + $cachemethod = $confdata->{vm}->{$node}->[0]->{storagecache}; + } if (defined $confdata->{vm}->{$node}->[0]->{storage}) { @@ -530,8 +534,7 @@ sub build_diskstruct { $tdiskhash->{device}='disk'; $tdiskhash->{driver}->{name}='qemu'; $tdiskhash->{driver}->{type}=$disks{$_}->{format}; - $tdiskhash->{driver}->{cache}="none"; #in this scenario, making a brand new vm, there is not much the hypervisor cache can do for us that the - #guest cannot do for itself + $tdiskhash->{driver}->{cache}=$cachemethod; $tdiskhash->{source}->{file}=$_; $tdiskhash->{target}->{dev} = $disks{$_}->{device}; if ($disks{$_} =~ /^vd/) { @@ -1209,13 +1212,17 @@ sub createstorage { #my $diskstruct = shift; my $node = $cfginfo->{node}; my @flags = split /,/,$cfginfo->{virtflags}; + my $format; foreach (@flags) { if (/^imageformat=(.*)\z/) { - $imgfmt=$1; + $format=$1; } elsif (/^clonemethod=(.*)\z/) { $clonemethod=$1; } } + if ($cfginfo->{storageformat}) { + $format = $cfginfo->{storageformat}; + } my $mountpath; my $pathappend; @@ -1242,7 +1249,7 @@ sub createstorage { if ($filename =~ /^nfs:/ or $filename =~ /^dir:/ or $filename =~ /^lvm:/) { #libvirt storage pool to be used for this my @sizes = split /,/,$size; foreach (@sizes) { - get_filepath_by_url(url=>$filename,dev=>$prefix.shift(@suffixes),create=>$_, force=>$force); + get_filepath_by_url(url=>$filename,dev=>$prefix.shift(@suffixes),create=>$_, force=>$force, format=>$format); } }else{ oldCreateStorage($filename, $mastername, $size, $cfginfo, $force); @@ -1653,6 +1660,15 @@ sub chvm { $suffix=$1; $format='raw'; } + if ($confdata->{vm}->{$node}->[0]->{storageformat}) { + $format = $confdata->{vm}->{$node}->[0]->{storageformat}; + } + #when creating a new disk not cloned from anything, disable cache as copy on write content similarity is a lost cause... + my $cachemode = 'none'; + #unless user knows better + if ($confdata->{vm}->{$node}->[0]->{storagecache}) { + $cachemode = $confdata->{vm}->{$node}->[0]->{storagecache}; + } my $bus; if ($suffix =~ /^sd/) { $bus='scsi'; @@ -1661,8 +1677,7 @@ sub chvm { } elsif ($suffix =~ /vd/) { $bus='virtio'; } - #when creating a new disk not cloned from anything, disable cache as copy on write content similarity is a lost cause... - my $xml = ""; + my $xml = ""; if ($currstate eq 'on') { #attempt live attach eval { $dom->attach_device($xml); From 368d0d1e837bf8ef559f86f79607af92e85b1689 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 8 Aug 2013 21:03:39 -0700 Subject: [PATCH 026/184] fix defect 3734 makehosts throw exceptions when node ip is not illegal --- xCAT-server/lib/xcat/plugins/hosts.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index d5e100f5b..f3da69d44 100644 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -257,7 +257,7 @@ sub add_hosts_content { else { my $rsp; - push @{$rsp->{data}}, "Invalid IP Addr \'$_->{ip}\' for node \'$_->{node}\'."; + push @{$rsp->{data}}, "Invalid IP Addr \'$ref->{ip}\' for node \'$ref->{node}\'."; xCAT::MsgUtils->message("E", $rsp, $callback); } if (defined($ref->{otherinterfaces})) From d948f8c69eabca9eff63c456a4c5d055774af601 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 8 Aug 2013 21:27:01 -0700 Subject: [PATCH 027/184] fix defect 3734 makehosts throw exceptions when node ip is not illegal --- xCAT-server/lib/xcat/plugins/hosts.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index f3da69d44..ca78142c3 100644 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -260,6 +260,7 @@ sub add_hosts_content { push @{$rsp->{data}}, "Invalid IP Addr \'$ref->{ip}\' for node \'$ref->{node}\'."; xCAT::MsgUtils->message("E", $rsp, $callback); } + if (defined($ref->{otherinterfaces})) { addotherinterfaces $callback, $nodename, $ref->{otherinterfaces}, $domain; @@ -451,6 +452,13 @@ sub process_request { addnode $callback, $_->{node}, $_->{ip}, $_->{hostnames}, $domain; } + else + { + my $rsp; + push @{$rsp->{data}}, "Invalid IP Addr \'$_->{ip}\' for node \'$_->{node}\'."; + xCAT::MsgUtils->message("E", $rsp, $callback); + } + if (defined($_->{otherinterfaces})) { addotherinterfaces $callback, $_->{node}, $_->{otherinterfaces}, $domain; From 311d3aafac36f569e650052369da792bb1b8acec Mon Sep 17 00:00:00 2001 From: xq2005 Date: Fri, 9 Aug 2013 01:21:00 -0700 Subject: [PATCH 028/184] fix symbo error --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index 5588f2157..b1e06c45d 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -19,6 +19,7 @@ use File::Path; use Socket; use strict; use Symbol; +my $sha1support; if ( -f "/etc/debian_version" ) { $sha1support = eval { require Digest::SHA; From 0995a924dcec4c2b62aa82b1837c5a992548e94c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 9 Aug 2013 10:30:58 -0400 Subject: [PATCH 029/184] Do sparse allocation for non-lvm raw format images --- xCAT-server/lib/xcat/plugins/kvm.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 2c52ffb1e..53d7568ef 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -278,7 +278,9 @@ sub get_filepath_by_url { #at the end of the day, the libvirt storage api gives my $create = $args{create}; my $force = $args{force}; my $format = $args{format}; + my $sparse = 1; if ($url =~ /^lvm:/) { + $sparse = 0; $format = 'raw'; } unless ($format) { @@ -327,7 +329,7 @@ sub get_filepath_by_url { #at the end of the day, the libvirt storage api gives # additionally, when mastering a powered down node, we should rebase the node to be a cow clone of the master it just spawned } else { my $vol; - if ($format eq 'raw') { #skip allocation specification for now + unless ($sparse) { #skip allocation specification for now #currently, LV can have reduced allocation, but *cannot* grow..... $vol = $poolobj->create_volume("".$desiredname."".getUnits($create,"G",1).""); } else { From 73ab8e8a7f478df20362842ef07c932bc0271354 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 12 Aug 2013 02:59:17 -0700 Subject: [PATCH 030/184] add comments in anaconda.pm --- xCAT-server/lib/xcat/plugins/anaconda.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 524c8bbad..166d212be 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -1576,7 +1576,8 @@ sub mksysclone } } - # copy postscripts + # copy postscripts, the xCAT scripts may update, but the image is captured long time ago + # should update the scripts at each nodeset my $script1 = "configefi"; my $script2 = "updatenetwork"; my $pspath = "$installroot/sysclone/scripts/post-install/"; From 1b5ff23093f70c50df9b67e66801bfcf835647c3 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 12 Aug 2013 11:18:49 -0400 Subject: [PATCH 031/184] Add usage message and manpage for geninitrd command; Add --noupdateinitrd flag for nodeset manpage; Make geninitrd to check the provmethod if no image name is specified --- xCAT-client/pods/man1/geninitrd.1.pod | 100 ++++++++++++++++++++++ xCAT-client/pods/man8/nodeset.8.pod | 7 ++ xCAT-server/lib/xcat/plugins/geninitrd.pm | 53 ++++++++++-- 3 files changed, 155 insertions(+), 5 deletions(-) create mode 100644 xCAT-client/pods/man1/geninitrd.1.pod diff --git a/xCAT-client/pods/man1/geninitrd.1.pod b/xCAT-client/pods/man1/geninitrd.1.pod new file mode 100644 index 000000000..65de247df --- /dev/null +++ b/xCAT-client/pods/man1/geninitrd.1.pod @@ -0,0 +1,100 @@ +=head1 NAME + +B - Generate an initrd (initial ramfs) which to be used for statefull install or stateless netboot. + +=head1 SYNOPSIS + +B + +B [B<-h> | B<--help>] + + +=head1 DESCRIPTION + +Generate the initrd for the osimage: B which is an xCAT object of I type. + +B + +=over 2 + +If the B is a statefull one (The provmethod attribute for the osimage is 'install'), +this command is used to rebuild the initrd to inject the new drivers from driver rpms or +'update distro' and copy the rebuilt initrd and new kernel (If there's new kernel in 'update +distro') to the directory I>. + +If the initrd has been rebuilt by geninitrd, when run nodeset, the I<--noupdateinitrd> option +should be used to skip the rebuilding of initrd to improve the performance. + +Three attributes of osimage object can be used to specify the Driver RPM location and Driver names +for injecting new drviers to initrd. + +B - comma separated driver names that need to be injected to the initrd. +The postfix '.ko' can be ignored. The netdrivers attribute must be set to specify the new driver list. +If you want to load all the drivers from the driver rpms, using the keyword allupdate. + +B - comma separated driver rpm packages (full path should be specified) + +B - comma separated 'osdistroupdate' object. Each 'osdistroupdate' object specifies a +Linux distro update. When run geninitrd, 'kernel-*.rpm' will be searched from osdistroupdate.dirpath +to get all the rpm packages and then search the drivers from the rpm packages. + +Refer to the doc: https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Using_Linux_Driver_Update_Disk + +=back + +B + +=over 2 + +If the B is a stateless one (The provmethod attribute for the osimage is 'netboot'), +this command is used to generate the initrd from the rootimg which generated by 'genimage' command. +So the 'genimage' must be run once before running the geninitrd command. + +Two attributes of osimage object can be used to specify the Driver RPM location and Driver names +for injecting new drviers to initrd. + +B - comma separated driver names that need to be injected to the initrd. +The postfix '.ko' can be ignored. The netdrivers attribute must be set to specify the new driver list. +If you want to load all the drivers from the driver rpms, using the keyword allupdate. + +B - comma separated driver rpm packages (full path should be specified) + +=back + + +=head1 Parameters + +I specifies the name of an os image definition to be used. The specification for the image is storted in the I table and I table. + + +=head1 RETURN VALUE + +0 The command completed successfully. + +1 An error has occurred. + + +=head1 EXAMPLES + +=over 3 + +=item 1 +To generate initrd for the osimage B: + + geninitrd myimagename + +=back + + +=head1 FILES + +/opt/xcat/bin/geninitrd + +/opt/xcat/bin/genimage + +/opt/xcat/share/xcat/netboot//genimage + + +=head1 SEE ALSO + +L, L diff --git a/xCAT-client/pods/man8/nodeset.8.pod b/xCAT-client/pods/man8/nodeset.8.pod index 0c5584924..e0a2e6b74 100644 --- a/xCAT-client/pods/man8/nodeset.8.pod +++ b/xCAT-client/pods/man8/nodeset.8.pod @@ -6,6 +6,8 @@ B - set the boot state for a noderange B [I] [I|I|I|I|I|I|I|I|I>]] +B I [I> I<--noupdateinitrd>] + B [I<-h>|I<--help>|I<-v>|I<--version>] =head1 B @@ -67,6 +69,11 @@ Cleanup the current pxe/tftp boot configuration files for the nodes requested Prepare server for installing a node using the specified os image. The os image is defined in the I table and I table. If the is omitted, the os image name will be obtained from I for the node. +=item B<--noupdateinitrd> + +Skip the rebuilding of initrd when the 'netdrivers', 'drvierupdatesrc' or 'osupdatename' were set for injecting new drviers to initrd. But, the geninitrd command +should be run to rebuild the initrd for new drivers injecting. This is used to improve the performance of nodeset command. + =item B=> If you would like to run a task after deployment, you can define that task with this attribute. diff --git a/xCAT-server/lib/xcat/plugins/geninitrd.pm b/xCAT-server/lib/xcat/plugins/geninitrd.pm index a364a6210..9a9fe45f1 100644 --- a/xCAT-server/lib/xcat/plugins/geninitrd.pm +++ b/xCAT-server/lib/xcat/plugins/geninitrd.pm @@ -26,8 +26,28 @@ sub preprocess_request my $req = shift; my $callback = shift; - unless (defined ($req->{arg}) && $req->{arg}->[0]) { - xCAT::MsgUtils->message("E", {error=>["An osimage name needs to be specified."], errorcode=>["1"]}, $callback); + my $usage = sub { + my $callback = shift; + xCAT::MsgUtils->message("I", {data=>["Usage: geninitrd [-h | --help]"]}, $callback); + }; + + my $osimage; + if (defined ($req->{arg})) { + foreach (@{$req->{arg}}) { + if (/^-/) { + $usage->($callback); + return; + }else { + $osimage = $_; + } + } + } else { + $usage->($callback); + return; + } + + unless ($osimage) { + $usage->($callback); return; } @@ -46,10 +66,11 @@ sub process_request { my $req = shift; my $callback = shift; + my $doreq = shift; if ($req->{command}->[0] eq 'geninitrd') { - return geninitrd($req, $callback); + return geninitrd($req, $callback, $doreq); } } @@ -57,6 +78,7 @@ sub process_request sub geninitrd { my $req = shift; my $callback = shift; + my $doreq = shift; my $osimage = $req->{arg}->[0]; @@ -69,7 +91,7 @@ sub geninitrd { return; } - my $oient = $osimagetab->getAttribs({imagename => $osimage}, 'osvers', 'osarch', 'osupdatename'); + my $oient = $osimagetab->getAttribs({imagename => $osimage}, 'provmethod', 'osvers', 'osarch', 'osupdatename'); unless ($oient && $oient->{'osvers'} && $oient->{'osarch'} ) { xCAT::MsgUtils->message("E", {error=>["The osimage [$osimage] was not defined or [osvers, osarch] attributes were not set."], errorcode=>["1"]}, $callback); return; @@ -84,7 +106,7 @@ sub geninitrd { return; } - my $lient = $linuximagetab->getAttribs({imagename => $osimage}, 'pkgdir', 'driverupdatesrc', 'netdrivers'); + my $lient = $linuximagetab->getAttribs({imagename => $osimage}, 'rootimgdir', 'pkgdir', 'driverupdatesrc', 'netdrivers'); unless ($lient && $lient->{'pkgdir'}) { xCAT::MsgUtils->message("E", {error=>["The osimage [$osimage] was not defined or [pkgdir] attribute was not set."], errorcode=>["1"]}, $callback); return; @@ -93,6 +115,27 @@ sub geninitrd { $driverupdatesrc = $lient->{'driverupdatesrc'}; $netdrivers = $lient->{'netdrivers'}; + # if the provmethod equals 'netboot', call the genimage --onlyinitrd directly + if ($oient->{'provmethod'} && $oient->{'provmethod'} eq "netboot") { + if ($lient->{'rootimgdir'}) { + unless (-d $lient->{'rootimgdir'}."/rootimg/lib/modules") { + xCAT::MsgUtils->message("E", {error=>["The genimage should be run before running geninitrd."], errorcode=>["1"]}, $callback); + return; + } + } else { + xCAT::MsgUtils->message("E", {error=>["The rootimgdir attribute for the osimage should be set."], errorcode=>["1"]}, $callback); + return; + } + my @output = `genimage $osimage --onlyinitrd`; + xCAT::MsgUtils->message("I", {data=>\@output}, $callback); + #$doreq->({ command => ['genimage'], + # arg => [$osimage, '--onlyinitrd'] }, $callback); + return; + } elsif (!$oient->{'provmethod'} || $oient->{'provmethod'} ne "install") { + xCAT::MsgUtils->message("E", {error=>["The attribute [provmethod] for osimage [$osimage] must be set to install or netboot."], errorcode=>["1"]}, $callback); + return; + } + # get the path list of the osdistroupdate if ($oient->{'osupdatename'}) { my @osupdatenames = split (/,/, $oient->{'osupdatename'}); From 09bf36a32329466068e390ae8e8341d8606be81b Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 12 Aug 2013 12:56:50 -0400 Subject: [PATCH 032/184] Defect 3731 --- perl-xCAT/xCAT/MsgUtils.pm | 3 --- 1 file changed, 3 deletions(-) diff --git a/perl-xCAT/xCAT/MsgUtils.pm b/perl-xCAT/xCAT/MsgUtils.pm index 4f7462669..a26cbe75e 100644 --- a/perl-xCAT/xCAT/MsgUtils.pm +++ b/perl-xCAT/xCAT/MsgUtils.pm @@ -457,7 +457,6 @@ sub message # If they want this msg to also go to syslog, do that now eval { openlog("xCAT", '', 'local4'); - setlogsock(["tcp", "unix", "stream"]); if ($sev eq 'SE') { syslog("err", $rsp); } else { @@ -504,7 +503,6 @@ sub message print $stdouterrf "Unable to open auditlog\n"; eval { openlog("xCAT", '', 'local4'); - setlogsock(["tcp", "unix", "stream"]); syslog("err", "Unable to write to auditlog"); closelog(); }; @@ -522,7 +520,6 @@ sub message print $stdouterrf "Unable to open auditlog\n"; eval { openlog("xCAT", '', 'local4'); - setlogsock(["tcp", "unix", "stream"]); syslog("err", "Unable to open auditlog"); closelog(); }; From 6969c52f82805bf9a66837d5743df507a4cb1afd Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 12 Aug 2013 13:53:38 -0400 Subject: [PATCH 033/184] defect 3731 --- perl-xCAT/xCAT/MsgUtils.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/perl-xCAT/xCAT/MsgUtils.pm b/perl-xCAT/xCAT/MsgUtils.pm index a26cbe75e..6a554d8ae 100644 --- a/perl-xCAT/xCAT/MsgUtils.pm +++ b/perl-xCAT/xCAT/MsgUtils.pm @@ -10,7 +10,7 @@ if ($^O =~ /^aix/i) { } use strict; -use Sys::Syslog qw (:DEFAULT setlogsock); +use Sys::Syslog; use xCAT::Utils; #use locale; use Socket; @@ -456,7 +456,7 @@ sub message # If they want this msg to also go to syslog, do that now eval { - openlog("xCAT", '', 'local4'); + openlog("xCAT", "nofatal,pid", "local4"); if ($sev eq 'SE') { syslog("err", $rsp); } else { @@ -502,7 +502,7 @@ sub message { print $stdouterrf "Unable to open auditlog\n"; eval { - openlog("xCAT", '', 'local4'); + openlog("xCAT", "nofatal,pid", "local4"); syslog("err", "Unable to write to auditlog"); closelog(); }; @@ -519,7 +519,7 @@ sub message { # error print $stdouterrf "Unable to open auditlog\n"; eval { - openlog("xCAT", '', 'local4'); + openlog("xCAT", "nofatal,pid", "local4"); syslog("err", "Unable to open auditlog"); closelog(); }; From 1808cbf1297cd8f6669ebbe1d17e0642c3270369 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 12 Aug 2013 15:08:26 -0400 Subject: [PATCH 034/184] Correct IPMI breakage from previous commit that removed ipmi2support scope --- xCAT-server/lib/perl/xCAT/IPMI.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index 92ee0ab65..61082f040 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -46,6 +46,7 @@ use Digest::MD5 qw/md5/; my $pendingpackets=0; my %tabooseq; #TODO: this is a global which means one taboo in the whole set causes unrelated session objects to consider it taboo unnecessarily my $maxpending; #determined dynamically based on rcvbuf detection +my $ipmi2support; if ( -f "/etc/debian_release" ){ $ipmi2support = eval { require Digest::SHA; From d6ce28f9549930199bc45376cc0185d2aa4ee218 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 12 Aug 2013 16:04:08 -0400 Subject: [PATCH 035/184] Fix ipmi FRU parser to give up once malformed data is encountered --- xCAT-server/lib/xcat/plugins/ipmi.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 8126558c8..880b08c9f 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2772,6 +2772,7 @@ sub parseprod { } $idx+=$currsize; ($currsize,$currdata,$encode)=extractfield(\@area,$idx); + if ($currsize < 0) { last } } return \%info; @@ -2844,6 +2845,7 @@ sub parseboard { } $idx+=$currsize; ($currsize,$currdata,$encode)=extractfield(\@area,$idx); + if ($currsize < 0) { last } } if ($global_sessdata->{isanimm}) { #we can understand more specifically some of the extra fields... $boardinf{frunum}=$boardinf{extra}->[0]->{value}; @@ -2908,6 +2910,7 @@ sub parsechassis { } $idx+=$currsize; ($currsize,$currdata,$encode)=extractfield(\@chassarea,$idx); + if ($currsize < 0) { last } } return \%chassisinf; } @@ -2919,7 +2922,7 @@ sub extractfield { #idx is location of the type/length byte, returns something a my $data; if ($idx >= scalar @$area) { xCAT::SvrUtils::sendmsg([1,"Error parsing FRU data from BMC"],$callback); - return 1,undef,undef; + return -1,undef,undef; } my $size = $area->[$idx] & 0b00111111; my $encoding = ($area->[$idx] & 0b11000000)>>6; From 08f4ed81e5e88a2158946458c9229c76ee78846d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 13 Aug 2013 10:13:06 -0400 Subject: [PATCH 036/184] Add support for rinv and faster DDR3 dimms --- perl-xCAT/xCAT/SPD.pm | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/SPD.pm b/perl-xCAT/xCAT/SPD.pm index 2fd107f4f..15f31ef24 100755 --- a/perl-xCAT/xCAT/SPD.pm +++ b/perl-xCAT/xCAT/SPD.pm @@ -667,6 +667,9 @@ sub decode_spd { 1066 => 8500, 1333 => 10600, 1600 => 12800, + 1867 => 14900, + 2133 => 17000, + 2134 => 17000, ); my %ddr3modcap = ( @@ -707,9 +710,20 @@ sub decode_spd { } $rethash->{product}->{name}=$memtypes{$spd[2]}; if ($spd[2] == 11) { #DDR3 spec applies + my $ftbdividend = $spd[9] >> 4; + my $ftbdivisor = $spd[9] & 0xf; + my $ftb = $ftbdividend/$ftbdivisor; + my $fineoffset = $spd[34]; + if ($fineoffset & 0b10000000) { + #negative value, twos complement + $fineoffset = 0-(($fineoffset ^ 0xff) + 1); + } + $fineoffset = ($ftb * $fineoffset) * 10**-3; my $mtb = $spd[10]/$spd[11]; - my $speed = $speedfromclock{int(2/($mtb*$spd[12]*10**-3))}; - $rethash->{product}->{name}="PC3-".$speed; + my $clock = int(2/(($mtb*$spd[12]+$fineoffset)*10**-3)); + my $speed = $speedfromclock{$clock}; + unless ($speed) { $speed = "UNKNOWN"; } + $rethash->{product}->{name}="PC3-".$speed." ($clock MT/s)"; if ($spd[8]&0b11000) { $rethash->{product}->{name} .= " ECC"; } From 529597d3c181c382015f8f4203a1556cf9bef3e2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 13 Aug 2013 13:28:34 -0400 Subject: [PATCH 037/184] Try to bring up extra interfaces for discovery --- xCAT-genesis-scripts/bin/dodiscovery | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index d888d13f5..40acc6e4e 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -5,6 +5,9 @@ PUBKEY=`echo $PUBKEY|sed -e 's/ //g'` export PUBKEY echo "Beginning node discovery process" +for nic in `ip link|grep mtu|grep -v LOOPBACK|grep -v usb|grep -v ,LOWER_UP|awk -F: '{print $2}'`; do + ip link set $nic up +done waitforlink=100 while [ ! -z "$NICSTOBRINGUP" -a $waitforlink -gt 0 ]; do NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v usb|grep -v ,LOWER_UP|awk -F: '{print $2}'` From 5ca816b0c4e56b3ad2c61c376c104692bdbe871b Mon Sep 17 00:00:00 2001 From: Bruce Potter Date: Tue, 13 Aug 2013 18:29:42 -0400 Subject: [PATCH 038/184] fix bld script to put rpms in release specific place --- buildcore.sh | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/buildcore.sh b/buildcore.sh index 0a2db354b..7ec8b0a7a 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -85,6 +85,20 @@ if [ "$OSNAME" != "AIX" ]; then export HOME=/root # This is so rpm and gpg will know home, even in sudo fi +# for the git case, query the current branch and set REL (changing master to devel if necessary) +function setbranch { + #git checkout $BRANCH + REL=`git rev-parse --abbrev-ref HEAD` + if [ "$REL" = "master" ]; then + REL="devel" + fi +} + +if [ "$REL" = "xcat-core" ]; then # using git + GIT=1 + setbranch # this changes the REL variable +fi + YUMDIR=$FRS YUMREPOURL="https://sourceforge.net/projects/xcat/files/yum" @@ -112,7 +126,11 @@ fi XCATCORE="xcat-core" # core-snap is a sym link to xcat-core -DESTDIR=../..$EMBEDDIR/$XCATCORE +if [ "$GIT" = "1" ]; then # using git - need to include REL in the path where we put the built rpms + DESTDIR=../../$REL$EMBEDDIR/$XCATCORE +else + DESTDIR=../..$EMBEDDIR/$XCATCORE +fi SRCD=core-snap-srpms # currently aix builds ppc rpms, but someday it should build noarch @@ -151,20 +169,9 @@ else #echo "source=$source" fi -# for the git case, query the current branch and set REL (changing master to devel if necessary) -function setbranch { - #git checkout $BRANCH - REL=`git rev-parse --abbrev-ref HEAD` - if [ "$REL" = "master" ]; then - REL="devel" - fi -} - # If they have not given us a premade update file, do an svn update or git pull and capture the results SOMETHINGCHANGED=0 -if [ "$REL" = "xcat-core" ]; then # using git - GIT=1 - setbranch +if [ "$GIT" = "1" ]; then # using git if [ -z "$GITUP" ]; then GITUP=../coregitup echo "git pull > $GITUP" From 4cdeeb0b22dd785a7152d84b11f2a509474f119b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 14 Aug 2013 08:58:01 -0400 Subject: [PATCH 039/184] Correct spelling mistake in xCAT-genesis that got in the way of interface bring up --- xCAT-genesis-scripts/bin/doxcat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 1b730aaf2..eb412ae57 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -82,7 +82,7 @@ dhclient -6 -pf /var/run/dhclient6.$bootnic.pid $bootnic -lf /var/lib/dhclient/d NICSTOBRINGUP=`ip link|grep mtu|grep -v LOOPBACK|grep -v $bootnic|grep -v usb|grep -v ,UP|awk -F: '{print $2}'` export NICSTOBRINGUP for nic in $NICSTOBRINGUP; do - (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; cdhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) & + (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$nic.pid $nic ) & (while ! ethtool $nic | grep Link\ detected|grep yes > /dev/null; do sleep 5; done; dhclient -cf /etc/dhclient.conf -6 -pf /var/run/dhclient6.$nic.pid -lf /var/lib/dhclient/dhclient6.leases $nic ) & done openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 & From a2a9dc9efdc6bc27fab3b73f406c2c800a7ebdd8 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 14 Aug 2013 09:48:02 -0400 Subject: [PATCH 040/184] setup interface for setting tunables --- xCAT-server/sbin/xcatconfig | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 4f51516b9..0f46907b2 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -64,6 +64,7 @@ if ( 'k|sshkeys' => \$::genSSHRootKeys, 'm|mgtnode' => \$::setupMNinDB, 's|sshnodehostkeys' => \$::genSSHNodeHostKeys, + 't|tunables' => \$::settunables, 'c|credentials' => \$::genCredentials, 'd|database' => \$::initDB, 'h|help' => \$::HELP, @@ -101,6 +102,7 @@ if ($::FORCE) || $::genSSHRootKeys || $::genSSHNodeHostKey || $::genCredentials + || $::settunables || $::initDB) { my $warning = @@ -234,6 +236,17 @@ if (xCAT::Utils->isMN()) { &genSSHNodeHostKey; } } + +# +# Set tunables +# +# +if ($::FORCE || $::settunables || $::INITIALINSTALL ) +{ + if ($::osname eq 'Linux') { + &settunables; + } +} # # gen root's ssh keys, if needed and copy to appropriate directories to # be used during install @@ -628,11 +641,11 @@ sub usage { xCAT::MsgUtils->message( 'I', - "Usage:\nxcatconfig - Performs basic xCAT setup operations on an xCAT management node. This command should not be run on an xCAT Service Node, unless you are making it a Management Node.\n" + "Usage:\nxcatconfig - Performs basic xCAT setup operations on an xCAT management node. Only the -t option should be used on a Service Node.\n" ); xCAT::MsgUtils->message( 'I', - "xcatconfig [-h|--help]\nxcatconfig [-v|--version]\nxcatconfig [-f|--force] [-V|--verbose]\nxcatconfig [-i|--initinstall] [-V|--verbose]\nxcatconfig [-u|--updateinstall] [-V|--verbose]\nxcatconfig [-k|--sshkeys] [-s|--sshnodehostkeys] [-c|--credentials] [-d|database] [-m|mgtnode] [-V|--verbose]" + "xcatconfig [-h|--help]\nxcatconfig [-v|--version]\nxcatconfig [-f|--force] [-V|--verbose]\nxcatconfig [-i|--initinstall] [-V|--verbose]\nxcatconfig [-u|--updateinstall] [-V|--verbose]\nxcatconfig [-k|--sshkeys] [-s|--sshnodehostkeys] [-c|--credentials] [-d|database] [-m|mgtnode] [-t|tunables] [-V|--verbose]" ); } @@ -822,7 +835,24 @@ sub genSSHRootKeys ); } } +#----------------------------------------------------------------------------- +=head3 settunables + + Will set the default suggested tunables on the Management Node or service node for Linux + +=cut + +#----------------------------------------------------------------------------- + +sub settunables + +{ + xCAT::MsgUtils->message( + 'I', + "The set of tunables that will be initialized is TBD."); + +} #----------------------------------------------------------------------------- =head3 genSSHNodeHostKey From 88914d34930bbb3d8e71f9f93bc31db5ebdc8079 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 14 Aug 2013 09:55:29 -0400 Subject: [PATCH 041/184] new man page for xcatconfig -t --- xCAT-client/pods/man8/xcatconfig.8.pod | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xCAT-client/pods/man8/xcatconfig.8.pod b/xCAT-client/pods/man8/xcatconfig.8.pod index 44abdbd90..e65e90a54 100644 --- a/xCAT-client/pods/man8/xcatconfig.8.pod +++ b/xCAT-client/pods/man8/xcatconfig.8.pod @@ -14,7 +14,7 @@ B {B<-i>|B<--initinstall>} [B<-V>|B<--verbose>] B {B<-u>|B<--updateinstall>} [B<-V>|B<--verbose>] -B [B<-k>|B<--sshkeys>] [B<-s>|B<--sshnodehostkeys>] [B<-c>|B<--credentials>] [B<-d>|B<--database>] [B<-m>|B<--mgtnode>] [B<-V>|B<--verbose>] +B [B<-k>|B<--sshkeys>] [B<-s>|B<--sshnodehostkeys>] [B<-c>|B<--credentials>] [B<-d>|B<--database>] [B<-m>|B<--mgtnode>] [B<-t>|B<--tunables>] [B<-V>|B<--verbose>] B {B<-f>|B<--force>} [B<-V>|B<--verbose>] @@ -74,6 +74,11 @@ Redistribute credentials and ssh keys to the service nodes and ssh keys to the n This option will add the Management Node to the database with the correct attributes set to be recognized by xCAT. This should be run after the hostname of the Management Node is set to the name that will resolve to the cluster-facing NIC. + +=item B<-t|--tunables> + +This option will set tunable parameters on the Management and Service nodes recommended for your Linux cluster. It will only set them during initial install, if you run xcatconfig -f or xcatconfig -t. + =back =head1 EXAMPLES From c03f4d202f2d5799ef7276f27034308b9457d901 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 15 Aug 2013 07:34:01 -0400 Subject: [PATCH 042/184] fix syntax --- xCAT-client/pods/man8/xcatconfig.8.pod | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-client/pods/man8/xcatconfig.8.pod b/xCAT-client/pods/man8/xcatconfig.8.pod index e65e90a54..fe8b07110 100644 --- a/xCAT-client/pods/man8/xcatconfig.8.pod +++ b/xCAT-client/pods/man8/xcatconfig.8.pod @@ -74,7 +74,6 @@ Redistribute credentials and ssh keys to the service nodes and ssh keys to the n This option will add the Management Node to the database with the correct attributes set to be recognized by xCAT. This should be run after the hostname of the Management Node is set to the name that will resolve to the cluster-facing NIC. - =item B<-t|--tunables> This option will set tunable parameters on the Management and Service nodes recommended for your Linux cluster. It will only set them during initial install, if you run xcatconfig -f or xcatconfig -t. From 8600f159b0a7286084cf5413109cb2afd3b7748f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 15 Aug 2013 11:35:12 -0400 Subject: [PATCH 043/184] Default in user/password in the same way that ipmi works in plugin --- xCAT-client/bin/pasu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-client/bin/pasu b/xCAT-client/bin/pasu index d8c380c7a..3ebdb6038 100755 --- a/xCAT-client/bin/pasu +++ b/xCAT-client/bin/pasu @@ -386,7 +386,7 @@ sub getdefaultcredentials { last; } } - if (!defined($user) || !defined($pw)) { die "Did not find the ipmi username and password in the xCAT passwd table.\n"; } + if (!defined($user) || !defined($pw)) { $user = "USERID"; $pw = "PASSW0RD"; } return ($user, $pw); } From 11b99248a980b8b9442d2a60cd367791fd0d1989 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 16 Aug 2013 01:26:06 -0400 Subject: [PATCH 044/184] Enchancement for drvier injection to initrd: 1. add the updateonly keyword for netdrivers att that only update the existed drivers from new distro update instead of copying all the drivers, this is helpful to reduce the size of new built initrd; 2. the drivers for old kernel will be removed if there's new kernel will be used. --- xCAT-server/lib/xcat/plugins/anaconda.pm | 105 +++++++++++++++++------ xCAT-server/lib/xcat/plugins/sles.pm | 56 ++++++++---- 2 files changed, 118 insertions(+), 43 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 166d212be..77da2276a 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2429,6 +2429,7 @@ sub insert_dd { my @rpm_list; my @driver_list; my $Injectalldriver; + my $updatealldriver; my @rpm_drivers; @@ -2473,6 +2474,9 @@ sub insert_dd { if (/^allupdate$/) { $Injectalldriver = 1; next; + } elsif (/^updateonly$/) { + $updatealldriver = 1; + next; } unless (/\.ko$/) { s/$/.ko/; @@ -2483,7 +2487,7 @@ sub insert_dd { chomp(@dd_list); chomp(@rpm_list); - unless (@dd_list || (@rpm_list && ($Injectalldriver || @driver_list))) { + unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) { return (); } @@ -2494,7 +2498,7 @@ sub insert_dd { # dracut + drvier rpm # !dracut + driver rpm # !dracut + driver disk - if (!<$install_dir/$os/$arch/Packages/dracut*> || (@rpm_list && ($Injectalldriver || @driver_list))) { + if (!<$install_dir/$os/$arch/Packages/dracut*> || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) { mkpath "$dd_dir/initrd_img"; # The dir for the new initrd # unzip the initrd image @@ -2557,13 +2561,12 @@ sub insert_dd { } my $new_kernel_ver; - if (@rpm_list && ($Injectalldriver || @driver_list)) { + if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) { # Extract the files from rpm to the tmp dir mkpath "$dd_dir/rpm"; foreach my $rpm (@rpm_list) { if (-r $rpm) { $cmd = "cd $dd_dir/rpm; rpm2cpio $rpm | cpio -idum"; - #$cmd = "rpm -i --quiet --nodeps --force --ignorearch --ignoreos --nosignature --root $dd_dir/rpm $rpm"; xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { my $rsp; @@ -2580,17 +2583,17 @@ sub insert_dd { # and copy it to the /tftpboot my @new_kernels = <$dd_dir/rpm/boot/vmlinuz*>; foreach my $new_kernel (@new_kernels) { - if (-r $new_kernel && $new_kernel =~ /\/vmlinuz-(.*(x86_64|ppc64))$/) { - $new_kernel_ver = $1; - $cmd = "/bin/mv -f $new_kernel $kernelpath"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) { - my $rsp; - push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $kernelpath."; - xCAT::MsgUtils->message("I", $rsp, $callback); + if (-r $new_kernel && $new_kernel =~ /\/vmlinuz-(.*(x86_64|ppc64|el\d+))$/) { + $new_kernel_ver = $1; + $cmd = "/bin/mv -f $new_kernel $kernelpath"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + my $rsp; + push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $kernelpath."; + xCAT::MsgUtils->message("I", $rsp, $callback); + } } } - } # To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver # Change it back to xxx.ko here @@ -2621,7 +2624,7 @@ sub insert_dd { # For dracut mode, only copy the drivers from rpm packages to the /lib/modules/ # The driver disk will be handled that append the whole disk to the orignial initrd - if (@rpm_list && ($Injectalldriver || @driver_list)) { + if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) { # Copy the firmware to the rootimage if (-d "$dd_dir/rpm/lib/firmware") { if (! -d "$dd_dir/initrd_img/lib/firmware") { @@ -2636,14 +2639,15 @@ sub insert_dd { } } - # if the new kernel from update distro is not existed in initrd, copy all the modules for the new kernel to initrd - if ((! -r "$dd_dir/initrd_img/lib/modules/$new_kernel_ver") && (-r "$dd_dir/rpm/lib/modules/$new_kernel_ver")) { - $cmd = "/bin/cp -rf $dd_dir/rpm/lib/modules/$new_kernel_ver $dd_dir/initrd_img/lib/modules/"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) { - my $rsp; - push @{$rsp->{data}}, "Handle the driver update failed. Could not copy $dd_dir/rpm/lib/modules/$new_kernel_ver to $dd_dir/initrd_img/lib/modules."; - xCAT::MsgUtils->message("E", $rsp, $callback); + # get the name list for all drivers in the original initrd if 'netdrivers=updateonly' + # then only the drivers in this list will be updated from the drvier rpms + if ($updatealldriver) { + $driver_name = "\*\.ko"; + @all_real_path = (); + find(\&get_all_path, <$dd_dir/initrd_img/lib/modules/*>); + foreach my $real_path (@all_real_path) { + my $driver = basename($real_path); + push @driver_list, $driver; } } @@ -2651,9 +2655,19 @@ sub insert_dd { # Figure out the kernel version my @kernelpaths = <$dd_dir/initrd_img/lib/modules/*>; my @kernelvers; + if ($new_kernel_ver) { + push @kernelvers, $new_kernel_ver; + } + + # if new kernel is used, remove all the original kernel directories foreach (@kernelpaths) { - if (basename($_) =~ /^[\d\.]+/) { - push @kernelvers, basename($_); + my $kernelv = basename($_); + if ($kernelv =~ /^[\d\.]+/) { + if ($new_kernel_ver) { + rmtree ("$dd_dir/initrd_img/lib/modules/$kernelv"); + } else { + push @kernelvers, $kernelv; + } } } @@ -2663,6 +2677,7 @@ sub insert_dd { } if (@driver_list) { foreach my $driver (@driver_list) { + $driver =~ s/\.gz$//; $driver_name = $driver; @all_real_path = (); find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>); @@ -2825,7 +2840,7 @@ sub insert_dd { } # Merge the drviers from rpm packages to the initrd - if (@rpm_list && ($Injectalldriver || @driver_list)) { + if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) { # Copy the firmware to the rootimage if (-d "$dd_dir/rpm/lib/firmware") { if (! -d "$dd_dir/initrd_img/lib") { @@ -2845,18 +2860,44 @@ sub insert_dd { mkpath ("$dd_dir/modules/$new_kernel_ver/$arch/"); } + # get the name list for all drivers in the original initrd if 'netdrivers=updateonly' + # then only the drivers in this list will be updated from the drvier rpms + if ($updatealldriver) { + $driver_name = "\*\.ko"; + @all_real_path = (); + find(\&get_all_path, <$dd_dir/modules/*>); + foreach my $real_path (@all_real_path) { + my $driver = basename($real_path); + push @driver_list, $driver; + } + } + # Copy the drivers to the initrd # Figure out the kernel version my @kernelpaths = <$dd_dir/modules/*>; my @kernelvers; + if ($new_kernel_ver) { + push @kernelvers, $new_kernel_ver; + } foreach (@kernelpaths) { - push @kernelvers, basename($_); + my $kernelv = basename($_); + if ($kernelv =~ /^[\d\.]+/) { + if ($new_kernel_ver) { + rmtree ("$dd_dir/modules/$kernelv"); + } else { + push @kernelvers, $kernelv; + } + } } foreach my $kernelver (@kernelvers) { unless (-d "$dd_dir/rpm/lib/modules/$kernelver") { next; } + # create path for the new kernel in the modules package + unless (-d "$dd_dir/modules/$kernelver") { + mkpath ("$dd_dir/modules/$kernelver/$arch/"); + } # find the $kernelver/$arch dir in the $dd_dir/modules my $arch4modules; foreach (<$dd_dir/modules/$kernelver/*>) { @@ -2932,13 +2973,23 @@ sub insert_dd { if (-d $ma) { mkpath "$dd_dir/depmod/lib/modules/$mk"; xCAT::Utils->runcmd("/bin/cp -rf $ma/* $dd_dir/depmod/lib/modules/$mk", -1); - $cmd = "depmod -b $dd_dir/depmod/"; + $cmd = "depmod -b $dd_dir/depmod/ $mk"; + #$cmd = "depmod -b $dd_dir/depmod/"; xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { my $rsp; push @{$rsp->{data}}, "Handle the driver update failed. Could not generate the depdency for the drivers in the initrd."; xCAT::MsgUtils->message("I", $rsp, $callback); } + # remove the .ko postfix from the driver name for rh5 + $cmd = "/bin/sed ".'s/\.ko//g'." $dd_dir/depmod/lib/modules/$mk/modules.dep > $dd_dir/depmod/lib/modules/$mk/modules.dep1; mv -f $dd_dir/depmod/lib/modules/$mk/modules.dep1 $dd_dir/depmod/lib/modules/$mk/modules.dep"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + my $rsp; + push @{$rsp->{data}}, "Handle the driver update failed. Could not generate the depdency for the drivers in the initrd."; + xCAT::MsgUtils->message("I", $rsp, $callback); + } + if (-f "$dd_dir/depmod/lib/modules/$mk/modules.dep") { copy ("$dd_dir/depmod/lib/modules/$mk/modules.dep", "$dd_dir/initrd_img/modules/modules.dep"); } diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index e4abb066f..72677014a 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1689,6 +1689,7 @@ sub insert_dd () { my @rpm_list; my @driver_list; my $Injectalldriver; + my $updatealldriver; my @rpm_drivers; @@ -1734,6 +1735,9 @@ sub insert_dd () { if (/^allupdate$/) { $Injectalldriver = 1; next; + } elsif (/^updateonly$/) { + $updatealldriver = 1; + next; } unless (/\.ko$/) { s/$/.ko/; @@ -1744,7 +1748,7 @@ sub insert_dd () { chomp(@dd_list); chomp(@rpm_list); - unless (@dd_list || (@rpm_list && ($Injectalldriver || @driver_list))) { + unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) { return (); } @@ -1757,7 +1761,7 @@ sub insert_dd () { # Unzip the original initrd # This only needs to be done for ppc or handling the driver rpm # For the driver disk against x86, append the driver disk to initrd directly - if ($arch =~/ppc/ || (@rpm_list && ($Injectalldriver || @driver_list))) { + if ($arch =~/ppc/ || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) { if ($arch =~ /ppc/) { $cmd = "gunzip --quiet -c $pkgdir/1/suseboot/initrd64 > $dd_dir/initrd"; } elsif ($arch =~ /x86/) { @@ -1782,7 +1786,7 @@ sub insert_dd () { } # Start to load the drivers from rpm packages - if (@rpm_list && ($Injectalldriver || @driver_list)) { + if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) { # Extract the files from rpm to the tmp dir mkpath "$dd_dir/rpm"; my $new_kernel_ver; @@ -1804,17 +1808,17 @@ sub insert_dd () { # get the new kernel if it exists in the update distro my @new_kernels = <$dd_dir/rpm/boot/vmlinu*>; foreach my $new_kernel (@new_kernels) { - if (-r $new_kernel && $new_kernel =~ /\/vmlinu[zx]-(.*(x86_64|ppc64|default))$/) { - $new_kernel_ver = $1; - $cmd = "/bin/mv -f $new_kernel $dd_dir/rpm/newkernel"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) { - my $rsp; - push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $dd_dir/rpm/newkernel."; - xCAT::MsgUtils->message("I", $rsp, $callback); + if (-r $new_kernel && $new_kernel =~ /\/vmlinu[zx]-(.*(x86_64|ppc64|default))$/) { + $new_kernel_ver = $1; + $cmd = "/bin/mv -f $new_kernel $dd_dir/rpm/newkernel"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + my $rsp; + push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $dd_dir/rpm/newkernel."; + xCAT::MsgUtils->message("I", $rsp, $callback); + } } } - } # To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver # Change it back to xxx.ko here @@ -1861,13 +1865,35 @@ sub insert_dd () { xCAT::MsgUtils->message("I", $rsp, $callback); } } + + # get the name list for all drivers in the original initrd if 'netdrivers=updateonly' + # then only the drivers in this list will be updated from the drvier rpms + if ($updatealldriver) { + $driver_name = "\*\.ko"; + @all_real_path = (); + find(\&get_all_path, <$dd_dir/initrd_img/lib/modules/*>); + foreach my $real_path (@all_real_path) { + my $driver = basename($real_path); + push @driver_list, $driver; + } + } # Copy the drivers to the rootimage # Figure out the kernel version my @kernelpaths = <$dd_dir/initrd_img/lib/modules/*>; my @kernelvers; + if ($new_kernel_ver) { + push @kernelvers, $new_kernel_ver; + } foreach (@kernelpaths) { - push @kernelvers, basename($_); + my $kernelv = basename($_); + if ($kernelv =~ /^[\d\.]+/) { + if ($new_kernel_ver) { + rmtree ("$dd_dir/initrd_img/lib/modules/$kernelv"); + } else { + push @kernelvers, $kernelv; + } + } } foreach my $kernelver (@kernelvers) { @@ -1880,7 +1906,6 @@ sub insert_dd () { $driver_name = $driver; @all_real_path = (); find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>); - #if ($real_path && $real_path =~ m!$dd_dir/rpm(/lib/modules/$kernelver/.*?)[^\/]*$!) { # NOTE: for the initrd of sles that the drivers are put in the /lib/modules/$kernelver/initrd/ foreach my $real_path (@all_real_path) { if ($real_path && $real_path =~ m!$dd_dir/rpm/lib/modules/$kernelver/!) { @@ -1904,8 +1929,7 @@ sub insert_dd () { $driver_name = "\*\.ko"; @all_real_path = (); find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>); - foreach $real_path (@all_real_path) { - #if ($real_path && $real_path =~ m!$dd_dir/rpm(/lib/modules/$kernelver/.*?)[^\/]*$!) { + foreach my $real_path (@all_real_path) { # NOTE: for the initrd of sles that the drivers are put in the /lib/modules/$kernelver/initrd/ if ($real_path && $real_path =~ m!$dd_dir/rpm/lib/modules/$kernelver/!) { if (! -d "$dd_dir/initrd_img/lib/modules/$kernelver/initrd") { From f2b4b14a5390a82dab09490df11dd75b48424080 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Thu, 15 Aug 2013 20:10:50 -0700 Subject: [PATCH 045/184] The item of updating pre-defined groups for nodes --- perl-xCAT/xCAT/FSPscan.pm | 33 ++++++++++++-- perl-xCAT/xCAT/PPCdb.pm | 9 ++++ perl-xCAT/xCAT/PPCinv.pm | 13 +++++- perl-xCAT/xCAT/PPCscan.pm | 32 +++++++++++-- perl-xCAT/xCAT/TableUtils.pm | 47 ++++++++++++++++++++ perl-xCAT/xCAT/Usage.pm | 8 ++-- perl-xCAT/xCAT/data/ibmhwtypes.pm | 43 ++++++++++++++++++ xCAT-server/lib/xcat/plugins/blade.pm | 42 ++++++++++++++++- xCAT-server/lib/xcat/plugins/ipmi.pm | 30 ++++++++++--- xCAT-server/lib/xcat/plugins/lsslp.pm | 23 ++++++++-- xCAT-server/lib/xcat/plugins/seqdiscovery.pm | 10 ++++- 11 files changed, 266 insertions(+), 24 deletions(-) create mode 100755 perl-xCAT/xCAT/data/ibmhwtypes.pm diff --git a/perl-xCAT/xCAT/FSPscan.pm b/perl-xCAT/xCAT/FSPscan.pm index 90a985caf..6ed064c17 100644 --- a/perl-xCAT/xCAT/FSPscan.pm +++ b/perl-xCAT/xCAT/FSPscan.pm @@ -13,6 +13,7 @@ use xCAT::GlobalDef; use xCAT::Usage; use xCAT::NetworkUtils; use xCAT::FSPUtils; +require xCAT::data::ibmhwtypes; #use Data::Dumper; ############################################## @@ -391,6 +392,7 @@ sub format_stanza { ################################# # Add each attribute ################################# + my $mtm = undef; foreach ( @attribs ) { my $d = $data[$i++]; @@ -401,7 +403,8 @@ sub format_stanza { } elsif ( /^hwtype$/ ) { $d = $globalhwtype{$type}; } elsif ( /^groups$/ ) { - $d = "$type,all"; + next; + #$d = "$type,all"; } elsif ( /^mgt$/ ) { $d = $hwtype; } elsif ( /^cons$/ ) { @@ -414,7 +417,9 @@ sub format_stanza { } elsif ( /^(mtm|serial)$/ ) { if ( $type eq "lpar" ) { $d = undef; - } + } elsif (/^mtm$/) { + $mtm = $d; + } } elsif (/^side$/) { unless ( $type =~ /^fsp|bpa$/ ) { next; @@ -422,6 +427,15 @@ sub format_stanza { } $result .= "\t$_=$d\n"; } + my $tmp_groups = "$type,all"; + if (defined($mtm)) { + my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm); + if (defined($tmp_pre)) { + $tmp_groups .= ",$tmp_pre"; + } + } + $result .= "\tgroups=$tmp_groups\n"; + } return( $result ); } @@ -464,6 +478,7 @@ sub format_xml { ################################# # Add each attribute ################################# + my $mtm = undef; foreach ( @attribs ) { my $d = $data[$i++]; @@ -472,7 +487,8 @@ sub format_xml { } elsif ( /^hwtype$/ ) { $d = $globalhwtype{$type}; } elsif ( /^groups$/ ) { - $d = "$type,all"; + next; + #$d = "$type,all"; } elsif ( /^mgt$/ ) { $d = $hwtype; } elsif ( /^cons$/ ) { @@ -484,6 +500,8 @@ sub format_xml { } elsif ( /^(mtm|serial)$/ ) { if ( $type eq "lpar" ) { $d = undef; + } elsif (/^mtm$/) { + $mtm = $d; } } elsif (/^side$/) { unless ( $type =~ /^fsp|bpa$/ ) { @@ -492,6 +510,15 @@ sub format_xml { } $href->{Node}->{$_} = $d; } + my $tmp_groups = "$type,all"; + if (defined($mtm)) { + my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm); + if (defined($tmp_pre)) { + $tmp_groups .= ",$tmp_pre"; + } + } + $href->{Node}->{groups}=$tmp_groups; + #print Dumper($href); ################################# # XML encoding diff --git a/perl-xCAT/xCAT/PPCdb.pm b/perl-xCAT/xCAT/PPCdb.pm index 52bc3a804..145652510 100644 --- a/perl-xCAT/xCAT/PPCdb.pm +++ b/perl-xCAT/xCAT/PPCdb.pm @@ -7,6 +7,7 @@ use xCAT::GlobalDef; use xCAT::Utils; use xCAT::TableUtils; use xCAT::NetworkUtils; +require xCAT::data::ibmhwtypes; ########################################### # Factory defaults @@ -168,6 +169,10 @@ sub add_ppc { # Update nodelist table ########################### updategroups( $name, $db{nodelist}, $type ); + my $tmp_group = xCAT::data::ibmhwtypes::parse_group($model); + if (defined($tmp_group)) { + updategroups($name, $db{nodelist}, $tmp_group); + } if ( $type =~ /^(fsp|bpa)$/ ) { $db{nodelist}->setNodeAttribs( $name, {hidden => '1'}); } else { @@ -525,6 +530,10 @@ sub update_node_attribs if ( $namediff) { updategroups( $name, $db->{nodelist}, $type ); + my $tmp_group = xCAT::data::ibmhwtypes::parse_group($model); + if (defined($tmp_group)) { + updategroups($name, $db->{nodelist}, $tmp_group); + } $db->{nodelist}->setNodeAttribs( $name, {status=>$nodelisthash->{status}, appstatus=>$nodelisthash->{appstatus}, primarysn=>$nodelisthash->{primarysn}, diff --git a/perl-xCAT/xCAT/PPCinv.pm b/perl-xCAT/xCAT/PPCinv.pm index 640cc1dd9..ea7f0d0c0 100644 --- a/perl-xCAT/xCAT/PPCinv.pm +++ b/perl-xCAT/xCAT/PPCinv.pm @@ -5,6 +5,8 @@ use strict; use Getopt::Long; use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR); use xCAT::Usage; +use xCAT::TableUtils; +require xCAT::data::ibmhwtypes; ########################################## @@ -59,7 +61,7 @@ sub parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose) )) { + if ( !GetOptions( \%opt, qw(V|verbose t) )) { return( usage() ); } #################################### @@ -75,6 +77,9 @@ sub parse_args { if ( !defined( $cmd )) { return(usage( "Invalid command: $ARGV[0]" )); } + if (exists($opt{t}) and $cmd ne "model") { + return(["Option 't' can only work with 'model'."]); + } #################################### # Check for an extra argument #################################### @@ -411,6 +416,12 @@ sub vpd { ############################# # Output value ############################# + if ($_ eq 'model' and exists($request->{opt}->{t})) { + my $tmp_pre = xCAT::data::ibmhwtypes::parse_args($data->{$_}); + if (defined($tmp_pre)) { + xCAT::TableUtils->updatenodegroups($name, $tmp_pre); + } + } my $value = "@{$prefix{$_}}[0]: $data->{$_}"; push @result, [$name,$value,$Rc]; } diff --git a/perl-xCAT/xCAT/PPCscan.pm b/perl-xCAT/xCAT/PPCscan.pm index 513d52c88..413e93f05 100644 --- a/perl-xCAT/xCAT/PPCscan.pm +++ b/perl-xCAT/xCAT/PPCscan.pm @@ -11,7 +11,7 @@ use xCAT::PPCdb; use xCAT::GlobalDef; use xCAT::Usage; use xCAT::NetworkUtils; - +require xCAT::data::ibmhwtypes; ############################################## # Globals @@ -545,6 +545,7 @@ sub format_stanza { ################################# # Add each attribute ################################# + my $mtm = undef; foreach ( @attribs ) { my $d = $data[$i++]; @@ -555,7 +556,8 @@ sub format_stanza { } elsif ( /^hwtype$/ ) { $d = $globalhwtype{$type}; } elsif ( /^groups$/ ) { - $d = "$type,all"; + next; + #$d = "$type,all"; } elsif ( /^mgt$/ ) { $d = $hwtype; } elsif ( /^cons$/ ) { @@ -568,7 +570,9 @@ sub format_stanza { } elsif ( /^(mtm|serial)$/ ) { if ( $type eq "lpar" ) { $d = undef; - } + } elsif (/^mtm$/) { + $mtm = $d; + } } elsif (/^side$/) { unless ( $type =~ /^fsp|bpa$/ ) { next; @@ -576,6 +580,14 @@ sub format_stanza { } $result .= "\t$_=$d\n"; } + my $tmp_groups = "$type,all"; + if (defined($mtm)) { + my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm); + if (defined($tmp_pre)) { + $tmp_groups .= ",$tmp_pre"; + } + } + $result .= "\tgroups=$tmp_groups\n"; } return( $result ); } @@ -623,6 +635,7 @@ sub format_xml { ################################# # Add each attribute ################################# + my $mtm = undef; foreach ( @attribs ) { my $d = $data[$i++]; @@ -631,7 +644,8 @@ sub format_xml { } elsif ( /^hwtype$/ ) { $d = $globalhwtype{$type}; } elsif ( /^groups$/ ) { - $d = "$type,all"; + next; + #$d = "$type,all"; } elsif ( /^mgt$/ ) { $d = $hwtype; } elsif ( /^cons$/ ) { @@ -643,6 +657,8 @@ sub format_xml { } elsif ( /^(mtm|serial)$/ ) { if ( $type eq "lpar" ) { $d = undef; + } elsif (/^mtm$/){ + $mtm = $d; } } elsif (/^side$/) { unless ( $type =~ /^fsp|bpa$/ ) { @@ -651,6 +667,14 @@ sub format_xml { } $href->{Node}->{$_} = $d; } + my $tmp_groups = "$type,all"; + if (defined($mtm)) { + my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm); + if (defined($tmp_pre)) { + $tmp_groups .= ",$tmp_pre"; + } + } + $href->{Node}->{groups}=$tmp_groups; ################################# # XML encoding ################################# diff --git a/perl-xCAT/xCAT/TableUtils.pm b/perl-xCAT/xCAT/TableUtils.pm index a6b2128ff..da113712a 100644 --- a/perl-xCAT/xCAT/TableUtils.pm +++ b/perl-xCAT/xCAT/TableUtils.pm @@ -1735,4 +1735,51 @@ sub getimagenames() $nodetab->close; return @imagenames; } +#----------------------------------------------------------------------------- + + +=head3 updatenodegroups + Update groups attribute for the specified node + + Arguments: + node + tabhd: the handler of 'nodelist' table, + groups: the groups attribute need to be merged. + Can be an array or string. + Globals: + none + Error: + Example: + xCAT::TableUtils->updatenodegroups($node, $tab, $groups); + +=cut + +#----------------------------------------------------------------------------- + +sub updatenodegroups { + my ($class, $node, $tabhd, $groups) = @_; + if (!$groups) { + $groups = $tabhd; + $tabhd = xCAT::Table->new('nodelist'); + unless ($tabhd) { + xCAT::MsgUtils->message("E", " Could not read the nodelist table\n"); + return; + } + } + my ($ent) = $tabhd->getNodeAttribs($node, ['groups']); + my @list = qw(all); + if (defined($ent) and $ent->{groups}) { + push @list, split(/,/,$ent->{groups}); + } + if (ref($groups) eq 'ARRAY') { + push @list, @$groups; + } else { + push @list, split(/,/,$groups); + } + my %saw; + @saw{@list} = (); + @list = keys %saw; + $tabhd->setNodeAttribs($node, {groups=>join(",",@list)}); +} + 1; diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 52e362627..242104d2e 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -72,16 +72,16 @@ my %usage = ( rinv [all|model|serial] [-V|--verbose] rinv [-h|--help|-v|--version] BMC specific: - rinv [vpd|mprom|deviceid|uuid|guid] + rinv [mprom|deviceid|uuid|guid|vpd [-t]|all [-t]] MPA specific: - rinv [firm|bios|diag|mprom|sprom|mparom|mac|mtm] + rinv [firm|bios|diag|mprom|sprom|mparom|mac|mtm [-t]] PPC specific(with HMC): - rinv [bus|config|serial|model|firm|all] + rinv [all|bus|config|serial|model|firm [-t]] PPC specific(using Direct FSP Management): rinv [firm] rinv [deconfig [-x]] Blade specific: - rinv [mtm|serial|mac|bios|diag|mprom|mparom|firm|all] + rinv [all|serial|mac|bios|diag|mprom|mparom|firm|mtm [-t]] IBM Flex System Compute Node specific: rinv [firm] VMware specific: diff --git a/perl-xCAT/xCAT/data/ibmhwtypes.pm b/perl-xCAT/xCAT/data/ibmhwtypes.pm new file mode 100755 index 000000000..efe78c025 --- /dev/null +++ b/perl-xCAT/xCAT/data/ibmhwtypes.pm @@ -0,0 +1,43 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html + +package xCAT::data::ibmhwtypes; +require Exporter; +@EXPORT_OK=qw(parse_group mt2group); +use Data::Dumper; +my %groups2mtm = ( + "x3250" => ["2583","4251","4252"], + "x3550" => ["7914","7944","7946"], + "x3650" => ["7915","7945"], + "dx360" => [], + "x220" => ["7906"], + "x240" => ["8737","7863"], + "x440" => ["7917"], + "p260" => ["7895"], #789522X, 789523X + "p460" => [], #789542X + "p470" => ["7954"], +); + +%mt2group = (); +foreach my $group (keys %groups2mtm) { + foreach my $mtm (@{$groups2mtm{$group}}) { + $mt2group{$mtm} = $group; + } +} + +sub parse_group { + my $mtm = shift; + if ($mtm =~ /xCAT::data/) { + $mtm = shift; + } + if ($mtm =~ /^(\w{4})/) { + $mt = $1; + if ($mt eq "7895" and $mtm =~ /789542X/i) { + return "p460"; + } + return $mt2group{$mt}; + } + return undef; +} + +1; diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 8a6446657..88e7f2fc0 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -28,6 +28,7 @@ use xCAT::GlobalDef; use xCAT_monitoring::monitorctrl; use strict; use LWP; +require xCAT::data::ibmhwtypes; #use warnings; my %mm_comm_pids; @@ -1773,6 +1774,7 @@ sub rscan_xml { my $href = { Node => { } }; + my $mtm = undef; foreach ( @rscan_attribs ) { my $d = $data[$i++]; @@ -1789,6 +1791,7 @@ sub rscan_xml { } } elsif ( /^groups$/ ) { $d = "$type,all"; + $ignore = 1; } elsif ( /^mgt$/ ) { if ($origtype eq "ppcblade") { $d = "fsp"; @@ -1831,13 +1834,23 @@ sub rscan_xml { } else { $ignore = 1; } + } elsif (/^mtm$/) { + $d =~ /^(\w{4})/; + $mtm = $1; } if (!$ignore) { $href->{Node}->{$_} = $d; } } - + my $tmp_groups = "$type,all"; + if (defined($mtm)) { + my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm); + if (defined($tmp_pre)) { + $tmp_groups .= ",$tmp_pre"; + } + } + $href->{Node}->{groups} = $tmp_groups; $xml.= XMLout($href,NoAttr=>1,KeyAttr=>[],RootName=>undef); } return( $xml ); @@ -1872,7 +1885,7 @@ sub rscan_stanza { $objname = $data[1]; } $result .= "$objname:\n\tobjtype=node\n"; - + my $mtm = undef; foreach ( @rscan_attribs ) { my $d = $data[$i++]; @@ -1889,6 +1902,7 @@ sub rscan_stanza { } } elsif ( /^groups$/ ) { $d = "$type,all"; + $ignore = 1; } elsif ( /^mgt$/ ) { if ($origtype eq "ppcblade") { $d = "fsp"; @@ -1931,12 +1945,23 @@ sub rscan_stanza { } else { $ignore = 1; } + } elsif (/^mtm$/) { + $d =~ /^(\w{4})/; + $mtm = $1; } if (!$ignore) { $result .= "\t$_=$d\n"; } } + my $tmp_groups = "$type,all"; + if (defined ($mtm)) { + my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm); + if (defined ($tmp_pre)) { + $tmp_groups .= ",$tmp_pre"; + } + } + $result .= "\tgroups=$tmp_groups\n"; } return( $result ); } @@ -2246,6 +2271,13 @@ sub inv { } } } + if ($updatetable and $updatehash{mtm}) { + #updatenodegroups + my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($updatehash{mtm}) ; + if (defined($tmp_pre)) { + xCAT::TableUtils->updatenodegroups($currnode, $tmp_pre); + } + } if ($updatetable and keys %updatehash) { my $vpdtab = xCAT::Table->new('vpd'); $vpdtab->setNodeAttribs($currnode,\%updatehash); @@ -4388,6 +4420,12 @@ sub process_request { unless ($node) { return 1; #failure } + if ($request->{mtm} and $request->{mtm} =~ /^(\w{4})/) { + my $group = xCAT::data::ibmhwtypes::parse_group($request->{mtm}); + if (defined($group)) { + xCAT::TableUtils->updatenodegroups($node, $group); + } + } if ($mac) { my $mactab = xCAT::Table->new('mac',-create=>1); $mactab->setNodeAttribs($macmap{$mac},{mac=>$mac}); diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 880b08c9f..641fb7ae0 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -34,6 +34,7 @@ my $iem_support; my $vpdhash; my %allerrornodes=(); my $global_sessdata; +require xCAT::data::ibmhwtypes; eval { require IBM::EnergyManager; @@ -1568,6 +1569,11 @@ sub inv { sub fru_initted { my $sessdata = shift; my $key; + my @args = @{$sessdata->{extraargs}}; + my $up_group = undef; + if (grep /-t/, @args) { + $up_group = '1'; + } my @types = @{$sessdata->{invtypes}}; my $format = "%-20s %s"; @@ -1576,11 +1582,17 @@ sub fru_initted { my $type; foreach $type (split /,/,$fru->rec_type) { if(grep {$_ eq $type} @types) { - my $bmcifo=""; - if ($sessdata->{bmcnum} != 1) { - $bmcifo=" on BMC ".$sessdata->{bmcnum}; - } - xCAT::SvrUtils::sendmsg(sprintf($format.$bmcifo,$sessdata->{fru_hash}->{$key}->desc . ":",$sessdata->{fru_hash}->{$key}->value),$callback,$sessdata->{node},%allerrornodes); + my $bmcifo=""; + if ($sessdata->{bmcnum} != 1) { + $bmcifo=" on BMC ".$sessdata->{bmcnum}; + } + xCAT::SvrUtils::sendmsg(sprintf($format.$bmcifo,$sessdata->{fru_hash}->{$key}->desc . ":",$sessdata->{fru_hash}->{$key}->value),$callback,$sessdata->{node},%allerrornodes); + if ($up_group and $type eq "model" and $fru->desc =~ /MTM/) { + my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($fru->value); + if (defined($tmp_pre)) { + xCAT::TableUtils->updatenodegroups($sessdata->{node}, $tmp_pre); + } + } last; } } @@ -6001,6 +6013,14 @@ sub preprocess_request { my (@bmcnodes, @nohandle); xCAT::Utils->filter_nodes($request, undef, undef, \@bmcnodes, \@nohandle); $realnoderange = \@bmcnodes; + } elsif ($command eq "rinv") { + if ($exargs[0] eq "-t" and $#exargs == 0) { + unshift @{$request->{arg}}, 'all'; + } elsif ((grep /-t/, @exargs) and !(grep /(all|vpd)/, @exargs) ) { + $callback->({errorcode=>[1],error=>["option '-t' can only work with 'all' or 'vpd'"]}); + $request = {}; + return 0; + } } if (!$realnoderange) { diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index 4881aef30..79e4f1674 100644 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -20,6 +20,7 @@ use xCAT::MacMap; use xCAT::IMMUtils; use xCAT_plugin::blade; use xCAT::SLP; +require xCAT::data::ibmhwtypes; my $mpahash; @@ -1401,11 +1402,18 @@ sub xCATdB { my $id = ($type =~ /bpa|frame/) ? $frameid:$cageid; my $hidden = ($type =~ /bpa|fsp/)? 1:0; + my $groups = lc($type).",all"; + my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($model); + + if (defined($tmp_pre)) { + $groups .= ",$tmp_pre"; + } ######################################## # Write result to every tables, ######################################## if ( $type =~ /^bpa|fsp|cec|frame$/ ) { - $nodelisthash{$hostname} = {groups=>"$type,all", hidden=>$hidden}; + #$nodelisthash{$hostname} = {groups=>"$type,all", hidden=>$hidden}; + $nodelisthash{$hostname} = {groups=>$groups, hidden=>$hidden}; $ppchash{$hostname} = {id=>$id, parent=>$parent, hcp=>$hostname, nodetype=>$globalhwtype{$type}}; $vpdhash{$hostname} = {mtm=>$model, serial=>$serial, side=>$side}; $nodehmhash{$hostname} = {mgt=>$globalmgt{$type}}; @@ -1416,7 +1424,7 @@ sub xCATdB { my @data = ($type, $model, $serial, $side, $ip, $frameid, $cageid, $parent, $mac); xCAT::PPCdb::add_systemX( $type, $hostname, \@data ); } elsif ( $type =~ /^(hmc|ivm)$/ ) { - $nodelisthash{$hostname} = {groups=>"$type,all", hidden=>$hidden}; + $nodelisthash{$hostname} = {groups=>$groups, hidden=>$hidden}; $ppchash{$hostname} = {nodetype=>$globalhwtype{$type}}; $vpdhash{$hostname} = {mtm=>$model, serial=>$serial}; $nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}}; @@ -1424,7 +1432,7 @@ sub xCATdB { $hostshash{$hostname} = {ip=>$ip}; $machash{$hostname} = {mac=>$mac}; }elsif ($type =~ /^cmm$/){ - $nodelisthash{$hostname} = {groups=>"cmm,all", hidden=>$hidden}; + $nodelisthash{$hostname} = {groups=>$groups, hidden=>$hidden}; $vpdhash{$hostname} = {mtm=>$model, serial=>$serial}; $nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}}; $nodehmhash{$hostname} = {mgt=>"blade"}; @@ -1474,6 +1482,12 @@ sub format_stanza { $ip = $2; } my $type = ${$outhash->{$name}}{type}; + my $groups = "$type,all"; + my $tmp_pre = xCAT::data::ibmhwtypes::parse_group(${$outhash->{$name}}{mtm}); + if (defined($tmp_pre)) { + $groups .= ",$tmp_pre"; + } + ################################# # Node attributes @@ -1490,7 +1504,8 @@ sub format_stanza { if ($type =~ /^fsp|bpa|cmm$/) { $result .= "\tside=${$outhash->{$name}}{side}\n"; } - $result .= "\tgroups=$type,all\n"; + #$result .= "\tgroups=$type,all\n"; + $result .= "\tgroups=$groups\n"; $result .= "\tmgt=$globalmgt{$type}\n"; if ($type =~ /^fsp|bpa|frame|cec$/) { $result .= "\tid=${$outhash->{$name}}{$globalid{$type}}\n"; diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index 10afe143d..e3d2d3116 100644 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -27,6 +27,7 @@ use xCAT::NetworkUtils; use xCAT::MsgUtils; use xCAT::DiscoveryUtils; use xCAT::NodeRange qw/noderange/; +require xCAT::data::ibmhwtypes; use Time::HiRes qw(gettimeofday sleep); @@ -272,7 +273,14 @@ sub findme { $nltab->setNodeAttribs($node, {groups=>"all"}); } } - + # update node groups with pre-defined groups + if (defined($param{'mtm'})){ + my @list = (); + my $tmp_group = xCAT::data::ibmhwtypes::parse_group($param{'mtm'}); + if (defined($tmp_group)) { + xCAT::TableUtils->updatenodegroups($node, $nltab, $tmp_group); + } + } # set the mgt for the node my $hmtab = xCAT::Table->new('nodehm'); unless ($hmtab) { From 7dd70c12d2b957bee7a1682792317d9fd9201d41 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 16 Aug 2013 00:06:25 -0700 Subject: [PATCH 046/184] update the nodelist.status to installing/netbooting via feedback from node during provision --- xCAT-server/lib/xcat/plugins/kvm.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 53d7568ef..5679815d6 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -2813,6 +2813,8 @@ sub process_request { } } } + #donot update node provision status (installing or netbooting) here + xCAT::Utils->filter_nostatusupdate(\%newnodestatus); #print "newstatus" . Dumper(\%newnodestatus); xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1); } From b3cf456fae3bf22ca3981a4e960641d26f42e89e Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 16 Aug 2013 06:58:10 -0400 Subject: [PATCH 047/184] flow control --- xCAT/postscripts/xcatflowrequest | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 xCAT/postscripts/xcatflowrequest diff --git a/xCAT/postscripts/xcatflowrequest b/xCAT/postscripts/xcatflowrequest new file mode 100755 index 000000000..79112ca68 --- /dev/null +++ b/xCAT/postscripts/xcatflowrequest @@ -0,0 +1,31 @@ +#!/bin/bash +# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html +# This routine when called, contacts xcatd. It will return to the caller when xcatd is +# ready to process the request +# It is called by xcatdsklspost before calling getpostscripts.awk +# it is called by remoteshell before calling getcredentials.awk +# +exec 13<>/dev/udp/$1/$2 +echo "resourcerequest: xcatd" >&13 +parpid=$$ +touch /tmp/goahead.$parpid +touch /tmp/killme.$parpid +exec 2> /dev/null +while ! grep 'resourcerequest: ok' /tmp/goahead.$parpid > /dev/null; do + ( + echo "resourcerequest: xcatd" >&13 + exec 14<>/proc/self/stat + read mystat<&14 + mypid=$(echo $mystat|cut -d " " -f 4) + (sleep $(((RANDOM%60)+120)).$((RANDOM%50)); if [ -f /tmp/killme.$parpid ]; then kill -TERM $mypid; fi) & + echo $! > /tmp/sleeperpid.$parpid + exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&13 + ) +done +sleeper=$(cat /tmp/sleeperpid.$parpid) +sleeper=$(ps -ef|awk "\$3==$sleeper"|awk '{print $2}') +kill -TERM $sleeper +rm /tmp/goahead.$parpid +rm /tmp/sleeperpid.$parpid +rm /tmp/killme.$parpid + From a9acb42b1e37afd76b1f2f7acd7781973e3a401f Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 16 Aug 2013 07:05:32 -0400 Subject: [PATCH 048/184] add flow control --- xCAT-server/sbin/xcatd | 154 +++++++++++++++++++++++++-------- xCAT/postscripts/remoteshell | 39 +++++---- xCAT/postscripts/xcatdsklspost | 24 +++-- 3 files changed, 158 insertions(+), 59 deletions(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 149346d79..20d272850 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -18,6 +18,8 @@ BEGIN } } +my $sslctl; +my $udpctl; # if AIX - make sure we include perl 5.8.2 in INC path. # Needed to find perl dependencies shipped in deps tarball. if ($^O =~ /^aix/i) { @@ -48,6 +50,7 @@ use xCAT::Client qw(submit_request); my $clientselect = new IO::Select; my $sslclients = 0; #THROTTLE my $maxsslclients = 64; #default +my $batchclients = 50; my @deferredmsgargs; # hold argumentlist for MsgUtils call until after fork #parallelizing logging overhead with real work @@ -125,7 +128,7 @@ unless ($pidfile) { #start syslog if it is not up if (xCAT::Utils->isLinux()) { my $init_file="/etc/init.d/syslog"; - if ((-f "/etc/fedora-release") || (-f "/etc/redhat-release") || (-f "/etc/lsb-release")){ + if ((-f "/etc/fedora-release") || (-f "/etc/redhat-release") || (-f "/etc/lsb-release")){ $init_file="/etc/init.d/rsyslog"; } if ( -x $init_file ) { @@ -174,6 +177,8 @@ if ($tmp) { } ($tmp) = $sitetab->getAttribs({'key'=>'xcatmaxconnections'},'value'); if ($tmp and $tmp->{value}) { $maxsslclients = $tmp->{value}; } +($tmp) = $sitetab->getAttribs({'key'=>'xcatmaxbatchconnections'},'value'); +if ($tmp and $tmp->{value}) { $batchclients = $tmp->{value}; } my $plugins_dir=$::XCATROOT.'/lib/perl/xCAT_plugin'; @@ -479,6 +484,37 @@ if ($inet6support) { } } +sub update_udpcontext_from_sslctl { + my %args = @_; + my $udpcontext = $args{udpcontext}; + my $select = $args{select}; + my $msg; + eval { $msg = fd_retrieve($sslctl); }; + if ($msg) { + #remember new count and, if new connection and we have a fudge factor, decrese fudge factor optimisticly assuming it's the right one + $udpcontext->{sslclientcount} = $msg->{sslclientcount}; + if ($udpcontext->{clientfudge} and $msg->{clientcountchange} > 0) { $udpcontext->{clientfudge} -= $msg->{clientcountchange}; } + } else { + $select->remove($sslctl); close($sslctl); #something went horribly wrong + } +} + +sub grant_tcrequests { + my $requestors = shift; + my $udpcontext = shift; + my $availableslots = $batchclients; + $availableslots -= $udpcontext->{clientfudge}; #value that forecasts the pressure + $availableslots -= $udpcontext->{sslclientcount}; #subtract all currently really active sessions + my $oldtime = time()-180; #drop requests older than three minutes if still around + foreach my $rkey (keys %{$requestors}) { + if ($requestors->{$rkey}->{timestamp} < $oldtime) { delete $requestors->{$rkey}; next; } + unless ($availableslots > 0) { next; } # no slots, ignore requests for now + $udpcontext->{clientfudge}+=1; #adjust forecast for being busy + $availableslots-=1; + $udpcontext->{socket}->send("resourcerequest: ok\n",0,$requestors->{$rkey}->{sockaddr}); + delete ($requestors->{$rkey}); #we acknoweldged, assume consumer got it, they'll do retry if they failed + } +} sub do_udp_service { #This function opens up a UDP port #It will do similar to the standard service, except: @@ -489,6 +525,9 @@ sub do_udp_service { #This function opens up a UDP port #Explicitly, to handle whatever operations nodes periodically send during discover state #Could be used for heartbeating and such as desired $dispatch_requests=0; + my $udpcontext; + $udpcontext->{clientfudge}=0; + $udpcontext->{sslclientcount}=0; my $udppidfile; my $retry=1; my $socket; @@ -499,10 +538,10 @@ sub do_udp_service { #This function opens up a UDP port xCAT::MsgUtils->message("S","xcatd udp service $$ quiescing"); } }; - if ($inet6support) { + if ($inet6support) { $socket = IO::Socket::INET6->new(LocalPort => $port, Proto => 'udp', - Domain => AF_INET); + ); } else { $socket = IO::Socket::INET->new(LocalPort => $port, Proto => 'udp', @@ -519,10 +558,10 @@ sub do_udp_service { #This function opens up a UDP port } my $select = new IO::Select; while (not $socket and $retry) { -if ($inet6support) { +if ($inet6support) { $socket = IO::Socket::INET6->new(LocalPort => $port, Proto => 'udp', - Domain => AF_INET); + ); } else { $socket = IO::Socket::INET->new(LocalPort => $port, Proto => 'udp', @@ -542,6 +581,8 @@ sleep 0.05; print $udppidfile $$; close($udppidfile); $select->add($socket); + $udpcontext->{socket} = $socket; + $select->add($sslctl); my $data; my $part; my $sport; @@ -551,6 +592,7 @@ sleep 0.05; my $actualpid=$$; until ($quit) { eval { + my $tcclients; # hash reference to store traffic control requests while (1) { unless ($actualpid == $$) { #This really should be impossible now... xCAT::MsgUtils->message("S","xcatd: Something absolutely ludicrous happpened, xCAT developers think this message is impossible to see, post if you see it, fork bomb averted"); @@ -561,57 +603,84 @@ sleep 0.05; populate_site_hash(); yield; } - while ($select->can_read(0)) { #Pull all buffer data that can be pulled + my @hdls; + while (@hdls = $select->can_read(0)) { #Pull all buffer data that can be pulled + my $hdl; + foreach $hdl (@hdls) { + if ($hdl == $socket) { $part = $socket->recv($data,1500); - ($sport,$client) = sockaddr_in($part); - if ($sport < 1000) { #Only remember udp packets from privileged ports - $packets{inet_ntoa($client)} = [$part,$data]; - } + $packets{$part} = [$part,$data]; + } elsif ($hdl == $sslctl) { + update_udpcontext_from_sslctl(udpcontext=>$udpcontext,select=>$select); + } else { + print "Something is wrong in udp process (search xcatd for this string)\n"; + } + } } foreach my $pkey (keys %packets) { - ($sport,$client) = sockaddr_in($packets{$pkey}->[0]); + my $saddr = $packets{$pkey}->[0]; + my $clientn; + my $clientip; + if ($inet6support) { + ($client,$sport) = Socket6::getnameinfo($saddr); + ($clientip,$sport) = Socket6::getnameinfo($saddr,Socket6::NI_NUMERICHOST()); + if ($clientip =~ /::ffff:.*\..*\./) { + $clientip =~ s/^::ffff://; + } + if ($client =~ /::ffff:.*\..*\./) { + $client =~ s/^::ffff://; + } + } else { + ($sport,$clientn) = sockaddr_in($saddr); + $clientip = inet_ntoa($clientn); + $client=gethostbyaddr($clientn,AF_INET); + } $data=$packets{$pkey}->[1]; - $peerhost=gethostbyaddr($client,AF_INET); - $peerhost .="\n"; if ($data =~ /^\037\213/) { #per rfc 1952, these two bytes are gzip, and they are invalid for #xcatrequest xml, so go ahead and decompress it my $bigdata; IO::Uncompress::Gunzip::gunzip(\$data,\$bigdata); $data = $bigdata } + if ($data =~ /^undef,ForceArray=>1) }; - if ($req and $req->{command} and ($req->{command}->[0] eq "findme")) { - $req->{'_xcat_clienthost'}=gethostbyaddr($client,AF_INET); - $req->{'_xcat_clientip'}=inet_ntoa($client); + if ($req and $req->{command} and ($req->{command}->[0] eq "findme" and $sport < 1000)) { #only consider priveleged port requests to start with + $req->{'_xcat_clienthost'}=$client; + $req->{'_xcat_clientip'}=$clientip; $req->{'_xcat_clientport'}=$sport; - if (defined($cmd_handlers{"findme"}) and xCAT::NetworkUtils->nodeonmynet(inet_ntoa($client))) { #only discover from ips that appear to be on a managed network + if (defined($cmd_handlers{"findme"}) and xCAT::NetworkUtils->nodeonmynet($clientip)) { #only discover from ips that appear to be on a managed network xCAT::MsgUtils->message("S","xcatd: Processing discovery request from ".$req->{'_xcat_clientip'}); $req->{cacheonly}->[0] = 1; plugin_command($req,undef,\&build_response); if ($req->{cacheonly}->[0]) { delete $req->{cacheonly}; plugin_command($req,undef,\&build_response); - #if ($req) { - # $req->{cacheonly}->[0] = 1; - # $req->{checkallmacs}->[0] = 1; - # plugin_command($req,undef,\&convey_response); - # } - } } else { - xCAT::MsgUtils->message("S","xcatd: Skipping discovery from ".inet_ntoa($client)." because we either have no discovery plugins or the client address does not match an IP network that xCAT is managing"); + xCAT::MsgUtils->message("S","xcatd: Skipping discovery from ".$client." because we either have no discovery plugins or the client address does not match an IP network that xCAT is managing"); } } + } else { # for *now*, we'll do a tiny YAML subset + if ($data =~ /^resourcerequest: xcatd$/) { + $tcclients->{$pkey}={ sockaddr=>$packets{$pkey}->[0], timestamp=>time() } + } + } # JSON maybe one day if important if ($quit) { last; } - while ($select->can_read(0)) { #grab any incoming requests during run - $part = $socket->recv($data,1500); - ($sport,$client) = sockaddr_in($part); - $packets{inet_ntoa($client)} = [$part,$data]; + while (@hdls = $select->can_read(0)) { #grab any incoming requests during run + foreach my $hdl (@hdls) { + if ($hdl == $socket) { + $part = $socket->recv($data,1500); + $packets{$part} = [$part,$data]; + } elsif ($hdl == $sslctl) { + update_udpcontext_from_sslctl(udpcontext=>$udpcontext,select=>$select); + } + } } #Some of those 'future' packets might be stale dupes of this packet, so... delete $packets{$pkey}; #Delete any duplicates of current packet } if ($quit) { last; } + grant_tcrequests($tcclients,$udpcontext); } }; if ($@) { @@ -695,6 +764,7 @@ if (defined $pid_init) { close($writepipe); %cmd_handlers = %{fd_retrieve($readpipe)}; } else { + $$progname = "xcatd: plugin initialization"; scan_plugins($writepipe); exit(0); } @@ -730,17 +800,20 @@ sub generic_reaper { sub ssl_reaper { local($!); + my $numdone = 0; while (($CHILDPID=waitpid(-1,WNOHANG)) > 0) { if ($immediatechildren{$CHILDPID}) { delete $immediatechildren{$CHILDPID}; + $sslclients--; + $numdone--; } - $sslclients--; } + store_fd({clientcountchange=>$numdone,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active $SIG{CHLD} = \&ssl_reaper; } sub dispatch_reaper { - local($!); + local($!); while (($CHILDPID =waitpid(-1, WNOHANG)) > 0) { if ($dispatched_children{$CHILDPID}) { delete $dispatched_children{$CHILDPID}; @@ -789,16 +862,24 @@ $SIG{TERM} = $SIG{INT} = sub { alarm(2); }; +socketpair($sslctl, $udpctl,AF_UNIX,SOCK_STREAM,PF_UNSPEC); +my $prevfh = select($udpctl); +$|=1; +select($sslctl); +$|=1; +select($prevfh); $pid_UDP = xCAT::Utils->xfork; if (! defined $pid_UDP) { xCAT::MsgUtils->message("S", "Unable to fork for UDP/TCP"); die; } unless ($pid_UDP) { + close($udpctl); $$progname="xcatd: UDP listener"; do_udp_service; xexit(0); } +close($sslctl); $pid_MON = xCAT::Utils->xfork; if (! defined $pid_MON) { xCAT::MsgUtils->message("S", "Unable to fork installmonitor"); @@ -806,6 +887,7 @@ if (! defined $pid_MON) { } unless ($pid_MON) { $$progname="xcatd: install monitor"; + close($udpctl); do_installm_service; xexit(0); } @@ -946,6 +1028,7 @@ until ($quit) { } if ($child == 0) { + close($udpctl); $SIG{TERM} = $SIG{INT} = {}; $SIG{CHLD} = \&generic_reaper; #THROTTLE $listener->close; @@ -1023,6 +1106,7 @@ if ($inet6support) { xexit(0); } $sslclients++; #THROTTLE + store_fd({clientcountchange=>1,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active $cnnection->close(); } if (open($mainpidfile,"<","/var/run/xcat/mainservice.pid")) { @@ -1647,7 +1731,7 @@ sub dispatch_request { #flock($dlock,LOCK_UN); if ($errstr) { if ($numdests == 1) { - dispatch_callback({error=>["Unable to dispatch hierarchical sub-command to ".$ENV{XCATHOST}.". Error: $errstr."],errorcode=>[1]}); + dispatch_callback({error=>["Unable to dispatch hierarchical sub-command to ".$ENV{XCATHOST}.". This service node may be down or its xcatd daemon may not be responding."],errorcode=>[1]}); xCAT::MsgUtils->message("S","Error dispatching request to ".$ENV{XCATHOST}.": ".$errstr); } else { xCAT::MsgUtils->message("S","Error dispatching request to ".$ENV{XCATHOST}.", trying other service nodes: ".$errstr); @@ -1861,7 +1945,7 @@ sub service_connection { my $bytesread; do { $bytesread=sysread($sock,$line,65536,length($line)) } while ($bytesread); if (length($line)==0) { - if (not defined $bytesread and (($! == EAGAIN) or ($! == ECHILD))) { next; } # + if (not defined $bytesread and (($! == EAGAIN) or ($! == ECHILD))) { next; } # last; } $flags=fcntl($sock,F_GETFL,0); @@ -2014,9 +2098,9 @@ sub send_pending_responses { $blocks += 1; } foreach (0..$blocks) { - do { - syswrite($sock,$resp,4096,$_*4096); - } while (($! == EAGAIN) or ($! == ECHILD)); + do { + syswrite($sock,$resp,4096,$_*4096); + } while (($! == EAGAIN) or ($! == ECHILD)); } }; } diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index c8a7553fa..151208a00 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -21,6 +21,8 @@ if [ "$(uname -s)" = "AIX" ]; then logger -t xcat -p local4.info "Install: On AIX , remoteshell calling aixremoteshell -d " exit 0 fi +master=$MASTER + if [ -r /etc/ssh/sshd_config ] then logger -t xcat -p local4.info "remoteshell: setup /etc/ssh/sshd_config and ssh_config" @@ -46,7 +48,7 @@ then echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config fi - +xcatpost="xcatpost" if [ -d /xcatpost/_ssh ] then logger -p local4.info -t xcat "Install: setup root .ssh" @@ -69,13 +71,11 @@ if [ ! -x /usr/bin/openssl ]; then fi allowcred.awk & CREDPID=$! -sleep 1 -if [ "$(uname -s)" = "AIX" ]; then - AIX=1 - export AIX - logger -t xcat -p local4.info "remoteshell setting up AIX" -fi + +#first contact daemon xcatflowrequest 3001 +logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" +/$xcatpost/xcatflowrequest $master 3001 getcredentials.awk ssh_dsa_hostkey | grep -E -v '|' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_dsa_hostkey #check the message is an error or not @@ -86,9 +86,9 @@ if [ $? -ne 0 ]; then logger -t xCAT -p local4.info ssh_dsa_hostkey MYCONT=`cat /etc/ssh/ssh_host_dsa_key` while [ -z "$MYCONT" ]; do - let SLI=$RANDOM%10 - let SLI=SLI+10 - sleep $SLI + #first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" + /$xcatpost/xcatflowrequest $master 3001 getcredentials.awk ssh_dsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_dsa_key MYCONT=`cat /etc/ssh/ssh_host_dsa_key` done @@ -107,6 +107,9 @@ else fi rm /tmp/ssh_dsa_hostkey +# first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" +/$xcatpost/xcatflowrequest $master 3001 getcredentials.awk ssh_rsa_hostkey | grep -E -v '|' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_rsa_hostkey #check whether the message is an error or not @@ -117,9 +120,10 @@ if [ $? -ne 0 ]; then logger -t xCAT -p local4.info ssh_rsa_hostkey MYCONT=`cat /etc/ssh/ssh_host_rsa_key` while [ -z "$MYCONT" ]; do - let SLI=$RANDOM%10 - let SLI=SLI+10 - sleep $SLI + # first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" + /$xcatpost/xcatflowrequest $master 3001 + getcredentials.awk ssh_rsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_rsa_key MYCONT=`cat /etc/ssh/ssh_host_rsa_key` done @@ -150,6 +154,9 @@ mkdir -p /root/.ssh/ sleep 1 if [ $ENABLESSHBETWEENNODES = "YES" ]; then + #first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" + /$xcatpost/xcatflowrequest $master 3001 getcredentials.awk ssh_root_key | grep -E -v '|'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_root_key #check whether the message is an error or not @@ -160,9 +167,9 @@ then logger -t xCAT -p local4.info ssh_root_key MYCONT=`cat /root/.ssh/id_rsa` while [ -z "$MYCONT" ]; do - let SLI=$RANDOM%10 - let SLI=SLI+10 - sleep $SLI + # first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" + /$xcatpost/xcatflowrequest $master 3001 getcredentials.awk ssh_root_key | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /root/.ssh/id_rsa MYCONT=`cat /root/.ssh/id_rsa` done diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 62d795f02..1bce0ef3b 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -3,8 +3,8 @@ ##################################################### # # Generic xCAT post script for diskless nodes -# The syntax of this script -# xcatdsklspost {mode} {-m|-M} [postscripts] +# The syntax of this script: +# xcatdsklspost {mode} {-m|-M} [postscripts] --tftp /tftpboot --installdir /install --nfsv4 no -c -V # This script is called in the following different places: # updatenode -P ... --> xcatdsklspost 1 -m/-M ... # updatenode -S --> xcatdsklspost 2 -m/-M otherpkgs @@ -169,15 +169,19 @@ else fi fi if [ $ARGNUM -gt 10 ]; then - if [ $11 = "-c" ]; then + if [ ${11} = "-c" ]; then CFLAG=${11} fi fi + if [ $ARGNUM -gt 11 ]; then + if [ ${12} = "-V" ]; then + export VERBOSE=1 + fi + fi ;; 3|4|6) MODE=$1;; esac fi - # set the default path for the xcatpost directory xcatpost="/xcatpost" # Check for debug mode and you have nodename available you can change the path for debug @@ -204,7 +208,7 @@ if [ ! `uname` = Linux ]; then rmdir /xcatmnt logger -t xCAT -p local4.err "Running xcataixpost $*" echo "/$xcatpost/xcataixpost $1 $2 $3 '"$4"' $5 $6 $7 $8 $9 ${10} ${11}" - exec /$xcatpost/xcataixpost $1 $2 $3 "$4" $5 $6 $7 $8 $9 ${10} ${11} + exec /$xcatpost/xcataixpost $1 $2 $3 "$4" $5 $6 $7 $8 $9 ${10} ${11} exit fi @@ -470,6 +474,9 @@ fi # We need to call getpostscript.awk . if [ ! -x /$xcatpost/mypostscript ]; then + # first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "xcatdsklspost: xcatflowrequest $SIP 3001" +/$xcatpost/xcatflowrequest $SIP 3001 /$xcatpost/getpostscript.awk | egrep '' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /$xcatpost/mypostscript; MYCONT=`grep MASTER /$xcatpost/mypostscript` MAX_RETRIES=10 @@ -481,9 +488,10 @@ if [ ! -x /$xcatpost/mypostscript ]; then break fi - SLI=$(awk 'BEGIN{srand(); printf("%d\n",rand()*10)}') - SLI=$((10 + $SLI)) - sleep $SLI + # contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "xcatdsklspost: xcatflowrequest $SIP 3001" + /$xcatpost/xcatflowrequest $SIP 3001 + /$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /$xcatpost/mypostscript; MYCONT=`grep MASTER /$xcatpost/mypostscript` if [ ! -z "$MYCONT" ]; then From 37118daaf9da138caee46dc0375e179bc58889e2 Mon Sep 17 00:00:00 2001 From: Bruce Potter Date: Sat, 17 Aug 2013 10:52:52 -0400 Subject: [PATCH 049/184] add --nonodecheck to the psh usage and man page --- xCAT-client/bin/psh | 2 +- xCAT-client/pods/man1/psh.1.pod | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-client/bin/psh b/xCAT-client/bin/psh index 23ed4a08f..4ce61652f 100755 --- a/xCAT-client/bin/psh +++ b/xCAT-client/bin/psh @@ -30,7 +30,7 @@ if (!GetOptions( "nonodecheck" => \$::NONODECHECK, #does not check the noderange, in this case, noderange need to be a list of nodes. 'h|help' => \$help, ) || $help || scalar(@ARGV)<2 ) { - print "Usage: psh [-i ] [-l ] [-f ] \n"; + print "Usage: psh [-i ] [-l ] [-f ] [--nonodecheck] \n"; exit; } my %nodehdl; diff --git a/xCAT-client/pods/man1/psh.1.pod b/xCAT-client/pods/man1/psh.1.pod index 100f34e7c..a2a48c313 100644 --- a/xCAT-client/pods/man1/psh.1.pod +++ b/xCAT-client/pods/man1/psh.1.pod @@ -43,6 +43,12 @@ rently executing remote shell processes. Log into the nodes as the specified username. The default is to use the same username as you are running the psh command as. +=item B<-n|--nonodecheck> + +Do not send the noderange to xcatd to expand it into a list of nodes. Instead, use the noderange exactly as it is specified. +In this case, the noderange must be a simple list of comma-separated hostnames of the nodes. +This allows you to run B even when xcatd is not running. + =item B See L. From 0bdae5e4c40155cb9e3637ca29474f16cd0e9597 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 19 Aug 2013 13:29:11 -0400 Subject: [PATCH 050/184] fix pid files did not get removed and the kill term showing up --- xCAT/postscripts/xcatflowrequest | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT/postscripts/xcatflowrequest b/xCAT/postscripts/xcatflowrequest index 79112ca68..ab1253ead 100755 --- a/xCAT/postscripts/xcatflowrequest +++ b/xCAT/postscripts/xcatflowrequest @@ -24,8 +24,7 @@ while ! grep 'resourcerequest: ok' /tmp/goahead.$parpid > /dev/null; do done sleeper=$(cat /tmp/sleeperpid.$parpid) sleeper=$(ps -ef|awk "\$3==$sleeper"|awk '{print $2}') -kill -TERM $sleeper rm /tmp/goahead.$parpid rm /tmp/sleeperpid.$parpid rm /tmp/killme.$parpid - +kill -TERM $sleeper From 5eaaf7369c84670bec48946b2ac4f42aa0f892d4 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 19 Aug 2013 23:52:29 -0700 Subject: [PATCH 051/184] add debianpreconf into xcatlib.sh on 2.8 --- xCAT/postscripts/xcatlib.sh | 74 ++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 9 deletions(-) diff --git a/xCAT/postscripts/xcatlib.sh b/xCAT/postscripts/xcatlib.sh index e5b5da8fd..17a5adf6f 100644 --- a/xCAT/postscripts/xcatlib.sh +++ b/xCAT/postscripts/xcatlib.sh @@ -1,17 +1,73 @@ function hashencode(){ - local map="$1" - echo `echo $map | sed 's/\./xDOTx/g' | sed 's/:/xCOLONx/g' | sed 's/,/:xCOMMAx/g'` + local str_map="$1" + echo `echo $str_map | sed 's/\./xDOTx/g' | sed 's/:/xCOLONx/g' | sed 's/,/:xCOMMAx/g'` } function hashset(){ - local hashname="hash${1}${2}" - local value=$3 - hashname=$(hashencode $hashname) - eval "${hashname}='${value}'" + local str_hashname="hash${1}${2}" + local str_value=$3 + str_hashname=$(hashencode $str_hashname) + eval "${str_hashname}='${str_value}'" } function hashget(){ - local hashname="hash${1}${2}" - hashname=$(hashencode $hashname) - eval echo "\$${hashname}" + local str_hashname="hash${1}${2}" + str_hashname=$(hashencode $str_hashname) + eval echo "\$${str_hashname}" } + +function debianpreconf(){ + #create the config sub dir + if [ ! -d "/etc/network/interfaces.d" ];then + mkdir -p "/etc/network/interfaces.d" + fi + #search xcat flag + `grep "#XCAT_CONFIG" /etc/network/interfaces` + if [ $? -eq 0 ];then + return + fi + + #back up the old interface configure + if [ ! -e "/etc/network/interfaces.bak" ];then + mv /etc/network/interfaces /etc/network/interfaces.bak + fi + + #create the new config file + echo "#XCAT_CONFIG" > /etc/network/interfaces + echo "source /etc/network/interfaces.d/*" >> /etc/network/interfaces + + local str_conf_file='' + + #read the backfile + cat /etc/network/interfaces.bak | while read str_line + do + if [ ! "$str_line" ];then + continue + fi + local str_first_char=${str_line:0:1} + if [ $str_first_char = '#' ];then + continue + fi + + local str_conf_type=`echo $str_line | cut -d" " -f1` + if [ $str_conf_type = 'auto' -o $str_conf_type = 'allow-hotplug' ];then + str_line=${str_line#$str_conf_type} + for str_nic_name in $str_line; do + echo "$str_conf_type $str_nic_name" > "/etc/network/interfaces.d/$str_nic_name" + done + elif [ $str_conf_type = 'iface' -o $str_conf_type = 'mapping' ];then + #find out the nic name, should think about the eth0:1 + str_nic_name=`echo $str_line | cut -d" " -f 2 | cut -d":" -f 1` + str_conf_file="/etc/network/interfaces.d/$str_nic_name" + if [ ! -e $str_conf_file ];then + echo "auto $str_nic_name" > $str_conf_file + fi + + #write lines into the conffile + echo $str_line >> $str_conf_file + else + echo $str_line >> $str_conf_file + fi + done +} + From c057f231a0e54d5eec55c2fd5a15abf0ecac1d0a Mon Sep 17 00:00:00 2001 From: xq2005 Date: Tue, 20 Aug 2013 02:12:07 -0700 Subject: [PATCH 052/184] postscripts modifiction about sysclone supporting for sles on 2.8 --- xCAT/postscripts/killsyslog | 11 +++++++++++ xCAT/postscripts/runxcatpost | 10 +++++++++- xCAT/postscripts/updatenetwork | 26 ++++++++++++++++++++++---- 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100755 xCAT/postscripts/killsyslog diff --git a/xCAT/postscripts/killsyslog b/xCAT/postscripts/killsyslog new file mode 100755 index 000000000..47aa106b5 --- /dev/null +++ b/xCAT/postscripts/killsyslog @@ -0,0 +1,11 @@ +#!/bin/bash + +#only used in sysclone when the image os is sles + +if [ -f "/etc/SuSE-release" ];then + str_out=`ps -ef | grep -v grep | grep syslog-ng` + if [ $? -eq 0 ];then + str_id=`echo $str_out | awk '{print $2}'` + kill -9 $str_id + fi +fi diff --git a/xCAT/postscripts/runxcatpost b/xCAT/postscripts/runxcatpost index 0dbf33f5e..9d4647342 100644 --- a/xCAT/postscripts/runxcatpost +++ b/xCAT/postscripts/runxcatpost @@ -1 +1,9 @@ -/opt/xcat/xcatdsklspost \ No newline at end of file +#!/bin/bash +/opt/xcat/xcatdsklspost + +. /tmp/post-install/variables.txt + +if [ -x "/xcatpost/updateflag.awk" ];then + /xcatpost/updateflag.awk $IMAGESERVER 3002 +fi + diff --git a/xCAT/postscripts/updatenetwork b/xCAT/postscripts/updatenetwork index d40cfdbd2..4e7e9355d 100644 --- a/xCAT/postscripts/updatenetwork +++ b/xCAT/postscripts/updatenetwork @@ -1,17 +1,35 @@ #!/bin/bash . /tmp/post-install/variables.txt +#delete the udev rule in the image +rule_file=`ls /etc/udev/rules.d/*net_persistent_names.rules` +if [ -n "$rule_file" ];then + rm -f $rule_file +fi + echo "Updating hostname to $HOSTNAME" sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network hostname $HOSTNAME +str_cfg_file='' +if [ -d "/etc/sysconfig/network-scripts/" ];then + #redhat + str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$DEVICE" +elif [ -d "/etc/sysconfig/network/" ];then + #suse + str_cfg_file="/etc/sysconfig/network/ifcfg-$DEVICE" +else + #ubuntu + str_cfg_file="/etc/network/interfaces.d/$DEVICE" +fi + echo "Old ifcfg-$DEVICE is:" -cat /etc/sysconfig/network-scripts/ifcfg-$DEVICE +cat $str_cfg_file HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'` -sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" /etc/sysconfig/network-scripts/ifcfg-$DEVICE -sed -i "s/UUID=.*//g" /etc/sysconfig/network-scripts/ifcfg-$DEVICE +sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" $str_cfg_file +sed -i "s/UUID=.*//g" $str_cfg_file echo "New ifcfg-$DEVICE is:" -cat /etc/sysconfig/network-scripts/ifcfg-$DEVICE +cat $str_cfg_file From c93aeba53c642aad418e975cd49692978a7e3725 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 20 Aug 2013 10:22:32 -0400 Subject: [PATCH 053/184] fix defect 3750 --- perl-xCAT/xCAT/ServiceNodeUtils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/ServiceNodeUtils.pm b/perl-xCAT/xCAT/ServiceNodeUtils.pm index 242ccbf08..5bcf6508b 100644 --- a/perl-xCAT/xCAT/ServiceNodeUtils.pm +++ b/perl-xCAT/xCAT/ServiceNodeUtils.pm @@ -355,7 +355,7 @@ sub getSNList $servicenodetab->close; foreach my $node (@nodes) { - if ($service eq "") # want all the service nodes + if (! defined ($service) || ($service eq "")) # want all the service nodes { push @servicenodes, $node->{node}; } From b81e4cee2d20b7e103f924d7a30727ab2aa10b85 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Tue, 20 Aug 2013 23:32:12 +0800 Subject: [PATCH 054/184] sync the bug fix for 3746 and 3721 from master to 2.8 branch. --- xCAT-server/lib/xcat/plugins/kit.pm | 78 ++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 2f1bed90f..8bacb467e 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -303,6 +303,47 @@ sub comp_word } + +#------------------------------------------------------- + +=head3 check_newinstall + + Check if the given kitcomp list are in NEW_INSTALL_LIST + or not. If so, set $::noupgrade all other kitcomp + depending on this list will be put into NEW_INSTALL_LIST + also + +=cut + +#------------------------------------------------------- +sub check_newinstall +{ + my $kitcomponents = shift; + my @lines = @_; + + my @kitcomps = split /,/, $kitcomponents; + + foreach my $kitcomp ( @kitcomps ) { + last if ( $::noupgrade ); + + my $match_newinstall = 0; + foreach my $line ( @lines ) { + chomp($line); + if ( $line =~ /^#NEW_INSTALL_LIST#$/ ) { + $match_newinstall = 1; + } + if ( $line =~ /\/$kitcomp$/ ) { + if ( $match_newinstall ) { + $::noupgrade = 1; + } + last; + } + } + } + +} + + #------------------------------------------------------- =head3 assign_to_osimage @@ -319,7 +360,7 @@ sub assign_to_osimage my $callback = shift; my $tabs = shift; - (my $kitcomptable) = $tabs->{kitcomponent}->getAttribs({kitcompname=> $kitcomp}, 'kitname', 'kitreponame', 'basename', 'kitpkgdeps', 'prerequisite', 'exlist', 'genimage_postinstall','postbootscripts', 'driverpacks'); + (my $kitcomptable) = $tabs->{kitcomponent}->getAttribs({kitcompname=> $kitcomp}, 'kitname', 'kitreponame', 'basename', 'kitcompdeps', 'kitpkgdeps', 'prerequisite', 'exlist', 'genimage_postinstall','postbootscripts', 'driverpacks'); (my $osimagetable) = $tabs->{osimage}->getAttribs({imagename=> $osimage}, 'provmethod', 'osarch', 'postbootscripts', 'kitcomponents'); (my $linuximagetable) = $tabs->{linuximage}->getAttribs({imagename=> $osimage}, 'rootimgdir', 'exlist', 'postinstall', 'otherpkglist', 'otherpkgdir', 'driverupdatesrc'); @@ -688,6 +729,13 @@ sub assign_to_osimage push @lines, "$kitreponame/$kitcomptable->{prerequisite}\n"; $::noupgrade = 1; } + + # Check if this kitcomponent's kitcompdeps are in NEW_INSTALL_LIST or not. + # If so, set $::noupgrade to put this kitcomp in a new NEW_INSTALL_LIST + if ( $kitcomptable and $kitcomptable->{kitcompdeps} ) { + check_newinstall($kitcomptable->{kitcompdeps}, @lines); + } + if ( $::noupgrade ) { push @lines, "#NEW_INSTALL_LIST#\n"; foreach my $kitdeployparam ( @kitdeployparams ) { @@ -2141,7 +2189,7 @@ sub addkitcomp if ( $kitcomp eq $oskitcomp ) { my %rsp; push@{ $rsp{data} }, "$kitcomp kit component is already in osimage $osimage"; - xCAT::MsgUtils->message( "E", \%rsp, $callback ); + xCAT::MsgUtils->message( "I", \%rsp, $callback ); $catched = 1; } } @@ -2174,7 +2222,7 @@ sub addkitcomp my %rsp; push@{ $rsp{data} }, "Upgrading kit component $oskitcomp to $kitcomp"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); - my $ret = xCAT::Utils->runxcmd({ command => ['rmkitcomp'], arg => ['-f','-u','-i',$osimage, $oskitcomp] }, $request_command, -2, 1); + my $ret = xCAT::Utils->runxcmd({ command => ['rmkitcomp'], arg => ['-f','-i',$osimage, $oskitcomp] }, $request_command, -2, 1); if ( !$ret ) { my %rsp; push@{ $rsp{data} }, "Failed to remove kit component $kitcomp from $osimage"; @@ -2379,7 +2427,6 @@ sub rmkitcomp my %rsp; push@{ $rsp{data} }, "kitcomponent $kitcompdep basename does not exist"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); - return 1; } my $kitcompdepname = get_highest_version('kitcompname', 'version', 'release', @entries); @@ -2438,7 +2485,7 @@ sub rmkitcomp foreach my $kitcomponent (keys %kitcomps) { my @kitcompscripts = split( ',', $kitcomps{$kitcomponent}{postbootscripts} ); foreach my $kitcompscript ( @kitcompscripts ) { - if ( $osimagescript =~ /^$kitcompscript$/ ) { + if ( $osimagescript =~ /^$kitcompscript/ ) { $match = 1; last; } @@ -2491,19 +2538,36 @@ sub rmkitcomp # Remove symlink from osimage.otherpkgdir. + # Read all the kitcomponents assigned to all the osimage to make sure the repo used by other osimage + # will not be deleted. + + my @allosikitcomps = $tabs{osimage}->getAllAttribs( 'imagename', 'kitcomponents' ); + (my $linuximagetable) = $tabs{linuximage}->getAttribs({imagename=> $osimage}, 'postinstall', 'exlist', 'otherpkglist', 'otherpkgdir', 'driverupdatesrc'); if ( $linuximagetable and $linuximagetable->{otherpkgdir} ) { my $otherpkgdir = $linuximagetable->{otherpkgdir}; foreach my $kitcomponent (keys %kitcomps) { + my %newosikitcomponents; + foreach my $allosikitcomp (@allosikitcomps) { + if ( $allosikitcomp->{kitcomponents} and $allosikitcomp->{imagename} ) { + my @allkitcomps = split /,/, $allosikitcomp->{kitcomponents}; + foreach my $allkitcomp ( @allkitcomps ) { + if ( $allosikitcomp->{imagename} ne $osimage or $allkitcomp ne $kitcomponent ) { + $newosikitcomponents{$allkitcomp} = 1; + } + } + } + } + if ( $kitcomps{$kitcomponent}{kitreponame} ) { if ( -d "$otherpkgdir/$kitcomps{$kitcomponent}{kitreponame}" ) { # Check if this repo is used by other kitcomponent before removing the link my $match = 0; - foreach my $osikitcomp ( @osikitcomps ) { - next if ( $osikitcomp =~ /$kitcomponent/ ); + foreach my $osikitcomp ( keys %newosikitcomponents ) { + my $depkitrepodir; (my $kitcomptable) = $tabs{kitcomponent}->getAttribs({kitcompname => $osikitcomp}, 'kitreponame'); if ( $kitcomptable and $kitcomptable->{kitreponame} ) { From 67a7fab655d2289fe26631d8ab5d94d0d85d78ef Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 20 Aug 2013 15:34:16 -0400 Subject: [PATCH 055/184] Fix problem where values after parenthitcal group were not evaluated correctly --- perl-xCAT/xCAT/NodeRange.pm | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 66df2c45c..3c01fb005 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -611,19 +611,7 @@ sub noderange { %nodes = map { $_ => 1 } noderange($start,$verify,$exsitenode,%options); my %innernodes = map { $_ => 1 } noderange($middle,$verify,$exsitenode,%options); set_arith(\%nodes,$op,\%innernodes); - $op=","; - if ($end =~ m/^,-/) { - $op = ",-"; - $end =~ s/^,-//; - } elsif ($end =~ m/^@/) { - $op = "@"; - $end =~ s/^@//; - } else { - $end =~ s/^,//; - } - my %endnodes = map { $_ => 1 } noderange($end,$verify,$exsitenode,%options); - set_arith(\%nodes,$op,\%endnodes); - return sort(keys %nodes) + $range = $end; } my $op = ","; @@ -632,7 +620,8 @@ sub noderange { @elems = split(/(@(?![^\(]*?\)))/,$range); # only split on @ when no , are present (inner recursion) } - while (my $atom = shift @elems) { + while (defined(my $atom = shift @elems)) { + if ($atom eq '') { next; } if ($atom eq ',') { next; } From ef7fe69e19fae5bfd0ae5ae1ccd9a6bb713de412 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 21 Aug 2013 03:11:04 -0700 Subject: [PATCH 056/184] modification for builing xcat on ubuntu --- build-ubunturepo | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index d133d2af3..ff9a42d60 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -43,6 +43,10 @@ printusage() # Process cmd line variable assignments, assigning each attr=val pair to a variable of same name for i in $*; do + echo $i | grep '=' + if [ $? != 0 ];then + continue + fi # upper case the variable name varstring=`echo "$i"|cut -d '=' -f 1|tr '[a-z]' '[A-Z]'`=`echo "$i"|cut -d '=' -f 2` export $varstring @@ -167,6 +171,7 @@ then short_ver=`cat Version|cut -d. -f 1,2` short_short_ver=`cat Version|cut -d. -f 1` + package_dir_name=debs$short_short_ver #TODO: define the core path and tarball name tarball_name="core-debs-snap.tar.bz2" @@ -186,8 +191,8 @@ then cur_date=`date +%Y%m%d` pkg_version="${short_ver}-${pkg_type}${cur_date}" - if [ ! -d ../../debs ];then - mkdir -p "../../debs" + if [ ! -d ../../$package_dir_name ];then + mkdir -p "../../$package_dir_name" fi packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack" @@ -195,9 +200,9 @@ then do file_low=`echo $file | tr '[A-Z]' '[a-z]'` if grep -q $file $update_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then - rm -f ../../debs/${file_low}_*.deb + rm -f ../../$package_dir_name/${file_low}_*.deb #only for genesis package - rm -f ../../debs/${file_low}-amd64_*.deb + rm -f ../../$package_dir_name/${file_low}-amd64_*.deb cd $file dch -v $pkg_version -b -c debian/changelog $build_string dpkg-buildpackage -uc -us @@ -208,11 +213,11 @@ then cd - find $file -maxdepth 3 -type d -name "${file_low}*" | grep debian | xargs rm -rf find $file -maxdepth 3 -type f -name "files" | grep debian | xargs rm -rf - mv ${file_low}* ../../debs/ + mv ${file_low}* ../../$package_dir_name/ fi done - find ../../debs/* ! -name *.deb | xargs rm -f + find ../../$package_dir_name/* ! -name *.deb | xargs rm -f fi if [ "$PROMOTE" = 1 ]; then @@ -256,7 +261,7 @@ __EOF__ #import the deb packages into the repo for dist in $dists; do - for file in `ls ../debs/*.deb`; do + for file in `ls ../$package_dir_name/*.deb`; do reprepro -b ./ includedeb $dist $file; done done From 77bcb156567ee12d8e0f6312b5c8baa302c35b79 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 21 Aug 2013 07:36:46 -0700 Subject: [PATCH 057/184] add kvm pkglist and template for ubuntu --- .../share/xcat/install/ubuntu/kvm.pkglist | 10 ++ .../share/xcat/install/ubuntu/kvm.tmpl | 114 ++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 xCAT-server/share/xcat/install/ubuntu/kvm.pkglist create mode 100644 xCAT-server/share/xcat/install/ubuntu/kvm.tmpl diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.pkglist b/xCAT-server/share/xcat/install/ubuntu/kvm.pkglist new file mode 100644 index 000000000..edad393e0 --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/kvm.pkglist @@ -0,0 +1,10 @@ +openssh-server +ntp +gawk +nfs-common +snmpd +qemu-kvm +libvirt-bin +bridge-utils +libcap2-bin +vlan diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl new file mode 100644 index 000000000..76136115f --- /dev/null +++ b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl @@ -0,0 +1,114 @@ + +### Localization +d-i debian-installer/locale string en_US +d-i localechooser/supported-locales multiselect en_US.UTF-8 + +# Keyboard Selection +d-i console-setup/ask_detect boolean false +d-i console-setup/layoutcode string en + +### Network Configuration + +d-i netcfg/get_hostname string unassigned-hostname +d-i netcfg/get_domain string unassigned-domain +d-i netcfg/wireless_wep string + +### Mirror settings +# If you select ftp, the mirror/country string does not need to be set. + +d-i mirror/country string manual +d-i mirror/protocol string http +d-i mirror/http/directory string /install/#TABLE:nodetype:$NODE:os#/#TABLE:nodetype:$NODE:arch# +d-i mirror/http/proxy string + +# Suite to install. +#d-i mirror/suite string testing +# Suite to use for loading installer components (optional). +#d-i mirror/udeb/suite string testing + + +### Partitioning +# This creates a small /boot partition, suitable +# swap, and uses the rest of the space for the root partition: + +d-i partman-auto/method string regular +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true + +#create the /tmp/partitioning based on the uefi or legacy bios +d-i partman-auto/expert_recipe_file string /tmp/partitioning + +# This makes partman automatically partition without confirmation, provided +# that you told it what to do using one of the methods above. + +d-i partman/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + + +### Account setup + +d-i passwd/root-login boolean true +d-i passwd/make-user boolean false + +d-i passwd/root-password-crypted password #CRYPT:passwd:key=system,username=root:password# + +### Clock and time zone setup + +d-i clock-setup/ntp boolean true +d-i clock-setup/ntp-server string #TABLE:site:key=master:value# +d-i clock-setup/utc boolean true +d-i time/zone string #TABLE:site:key=timezone:value# + +### Apt setup + +d-i apt-setup/multiverse boolean false +d-i apt-setup/universe boolean false +d-i apt-setup/backports boolean false +d-i apt-setup/updates boolean false + + +### Boot loader installation + +d-i grub-installer/only_debian boolean true + +### Package selection + +tasksel tasksel/first multiselect standard + +# gawk required for the xCAT scripts to work +# Otherwise it installs mawk, which doesn't work + +d-i pkgsel/include string #INCLUDE_DEFAULT_PKGLIST_PRESEED# + +d-i debian-installer/allow_unauthenticated string true +d-i pkgsel/update-policy select none +d-i pkgsel/updatedb boolean false + +### Finishing up the installation +d-i finish-install/reboot_in_progress note + +### X configuration +xserver-xorg xserver-xorg/autodetect_monitor boolean true + +xserver-xorg xserver-xorg/config/monitor/selection-method \ + select medium + +xserver-xorg xserver-xorg/config/monitor/mode-list \ + select 1024x768 @ 60 Hz + + +d-i preseed/early_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.pre; \ + chmod u+x #HOSTNAME#.pre; \ + ./#HOSTNAME#.pre + +d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.post; \ + chmod u+x #HOSTNAME#.post; \ + cp ./#HOSTNAME#.post /target/root/post.script; \ + mount -o bind /proc /target/proc -t proc; \ + mount -o bind /dev /target/dev; \ + mount -o bind /dev/pts /target/dev/pts -t devpts; \ + mount -o bind /sys /target/sys; \ + chroot /target /root/post.script + From adf53e32cd45d6e56135d6449945e75e58629baa Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 21 Aug 2013 09:10:16 -0700 Subject: [PATCH 058/184] add reiserfs into genesis to support sysclone for sels --- xCAT-genesis-builder/install | 2 +- xCAT-genesis-builder/installkernel | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index a756ae655..0491c148b 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -623,4 +623,4 @@ 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 # 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 klogd lvm mdadm mke2fs pivot_root sshd swapon tune2fs mkreiserfs reiserfstune # for sysclone diff --git a/xCAT-genesis-builder/installkernel b/xCAT-genesis-builder/installkernel index 9e52ac794..4217d9988 100755 --- a/xCAT-genesis-builder/installkernel +++ b/xCAT-genesis-builder/installkernel @@ -4,3 +4,4 @@ instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x 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 From 56cab3f2c804fb7c162b70a30702099d28e32f97 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 21 Aug 2013 09:49:09 -0700 Subject: [PATCH 059/184] build packages on ubuntu --- build-ubunturepo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-ubunturepo b/build-ubunturepo index ff9a42d60..2829edeb2 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -171,7 +171,7 @@ then short_ver=`cat Version|cut -d. -f 1,2` short_short_ver=`cat Version|cut -d. -f 1` - package_dir_name=debs$short_short_ver + package_dir_name=debs$REL #TODO: define the core path and tarball name tarball_name="core-debs-snap.tar.bz2" From e6f7e461e47f8d1458c8dbceb953512bc69f2770 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 21 Aug 2013 12:54:41 -0400 Subject: [PATCH 060/184] defect 3754 --- perl-xCAT/xCAT/SINV.pm | 46 +++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/perl-xCAT/xCAT/SINV.pm b/perl-xCAT/xCAT/SINV.pm index 2b01f5cb3..2df6d6420 100644 --- a/perl-xCAT/xCAT/SINV.pm +++ b/perl-xCAT/xCAT/SINV.pm @@ -202,9 +202,11 @@ sub parse_and_run_sinv # my @nodelist = (); my @cmdparts = (); + my $devicecommand =0; if ($options{'devicetype'}) { # must split different because devices have commands with spaces @cmdparts = split(' ', $cmd,3); + $devicecommand =1; } else { @cmdparts = split(' ', $cmd); } @@ -503,7 +505,7 @@ sub parse_and_run_sinv ); # write the results to the tempfile after running through xdshcoll - $rc = &storeresults($callback); + $rc = &storeresults($callback,$devicecommand); } $processflg = "node"; @@ -534,7 +536,7 @@ sub parse_and_run_sinv # write the results to the tempfile after running through xdshcoll - $rc = &storeresults($callback); + $rc = &storeresults($callback,$devicecommand); # Build report and write to output file # if file exist and has something in it @@ -1451,12 +1453,11 @@ sub rinvoutput sub storeresults { my $callback = shift; - + my $devicecommand= shift; # open file to write results of xdsh or rinv command my $newtempfile = $tempfile; $newtempfile .= "temp"; - open(FILE, ">$newtempfile"); - if ($? > 0) + unless (open(NEWTMPFILE, ">$newtempfile")) { my $rsp = {}; $rsp->{data}->[0] = "Could not open $newtempfile\n"; @@ -1465,9 +1466,9 @@ sub storeresults } foreach my $line (@cmdresult) { - print FILE $line; + print NEWTMPFILE $line; } - close FILE; + close NEWTMPFILE; my $outputfile; if ($processflg eq "seednode") { # cmd to seednode @@ -1479,8 +1480,7 @@ sub storeresults } # open file to put results of xdshcoll - open(FILE, ">$outputfile"); - if ($? > 0) + unless (open(NEWOUTFILE, ">$outputfile")) { my $rsp = {}; $rsp->{data}->[0] = "Could not open $outputfile\n"; @@ -1489,8 +1489,7 @@ sub storeresults } my $cmd = " $::XCATROOT/sbin/xdshcoll <$newtempfile |"; - open(XCOLL, "$cmd"); - if ($? > 0) + unless (open(XCOLL, "$cmd")) { my $rsp = {}; $rsp->{data}->[0] = "Could not call xdshcoll \n"; @@ -1503,18 +1502,37 @@ sub storeresults while () { $line = $_; - print FILE $line + print NEWOUTFILE $line } close(XCOLL); - close FILE; + close NEWOUTFILE; system("/bin/rm $newtempfile"); + # is device command, we get false errors from the Switch, check for + # blank error output lines and remove them. If there is nothing left + # then there really were no errors + my @newerrresult=(); + my $processerrors =1; + if ($devicecommand==1) { + foreach my $line (@errresult) + { + my @newline = (split(/:/, $line)); + if ($newline[1] !~ /^\s*$/) { # Not blank, then save it + push @newerrresult,$line; + } + + } + my $arraysize=@newerrresult; + if ($arraysize < 1) { + $processerrors =0; + } + } # capture errors # - if (@errresult) + if ((@errresult) && ($processerrors ==1)) { # if errors my $rsp = {}; my $i = 0; From 19a77111f6099da9fe3da94401fb0ceb069721d2 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 21 Aug 2013 19:51:35 -0700 Subject: [PATCH 061/184] remove klogd from genesis base --- xCAT-genesis-builder/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index 0491c148b..1ee268a35 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -623,4 +623,4 @@ 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 klogd lvm mdadm mke2fs pivot_root sshd swapon tune2fs mkreiserfs reiserfstune # 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 # for sysclone From 62ee471f89ba9be66e1f81aa5e4c5723489c05b9 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 22 Aug 2013 06:34:15 -0400 Subject: [PATCH 062/184] Remove the validity checking base machine type so that any power machines can be run with renergy command --- xCAT-client/pods/man1/renergy.1.pod | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/xCAT-client/pods/man1/renergy.1.pod b/xCAT-client/pods/man1/renergy.1.pod index 36019e0bc..f12187487 100644 --- a/xCAT-client/pods/man1/renergy.1.pod +++ b/xCAT-client/pods/man1/renergy.1.pod @@ -192,7 +192,7 @@ cappingperc =back -B<9125-F2C> +B<9125-F2C>, B<9119-FHB> =over 4 @@ -208,6 +208,22 @@ cappingperc,fsavingstatus,ffovalue =back +B + +=over 4 + +For the machine type which is not in the above list, the following +attributes can be tried but not guaranteed: + +B: savingstatus,dsavingstatus,cappingstatus,cappingmin, +cappingmax,,cappingvalue,cappingsoftmin,averageAC,averageDC, +ambienttemp,exhausttemp,CPUspeed,syssbpower,sysIPLtime + +B: savingstatus,dsavingstatus,cappingstatus,cappingwatt, +cappingperc + +=back + =back Note: From 2b0caf0346949a2aff13705f8209281c920a0343 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 22 Aug 2013 07:05:41 -0400 Subject: [PATCH 063/184] make geninitrd could run against statelite image to generate initrd --- xCAT-server/lib/xcat/plugins/geninitrd.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/geninitrd.pm b/xCAT-server/lib/xcat/plugins/geninitrd.pm index 9a9fe45f1..18782cb99 100644 --- a/xCAT-server/lib/xcat/plugins/geninitrd.pm +++ b/xCAT-server/lib/xcat/plugins/geninitrd.pm @@ -116,7 +116,7 @@ sub geninitrd { $netdrivers = $lient->{'netdrivers'}; # if the provmethod equals 'netboot', call the genimage --onlyinitrd directly - if ($oient->{'provmethod'} && $oient->{'provmethod'} eq "netboot") { + if ($oient->{'provmethod'} && ($oient->{'provmethod'} eq "netboot" || $oient->{'provmethod'} eq "statelite")) { if ($lient->{'rootimgdir'}) { unless (-d $lient->{'rootimgdir'}."/rootimg/lib/modules") { xCAT::MsgUtils->message("E", {error=>["The genimage should be run before running geninitrd."], errorcode=>["1"]}, $callback); @@ -132,7 +132,7 @@ sub geninitrd { # arg => [$osimage, '--onlyinitrd'] }, $callback); return; } elsif (!$oient->{'provmethod'} || $oient->{'provmethod'} ne "install") { - xCAT::MsgUtils->message("E", {error=>["The attribute [provmethod] for osimage [$osimage] must be set to install or netboot."], errorcode=>["1"]}, $callback); + xCAT::MsgUtils->message("E", {error=>["The attribute [provmethod] for osimage [$osimage] must be set to install, netboot or statelite."], errorcode=>["1"]}, $callback); return; } From 9b3f5a15d02ff2af28ce4bf705f7b7297eafe128 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 22 Aug 2013 12:04:11 -0400 Subject: [PATCH 064/184] fix schema definition --- perl-xCAT/xCAT/Schema.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 5a900e6c6..5c7f82422 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -3232,7 +3232,7 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs); access_tabentry => 'firmware.file=attr:cfgfile', }, {attr_name => 'disable', - tabentry => 'auditlog.disable', + tabentry => 'firmware.disable', access_tabentry => 'firmware.file=attr:cfgfile', }, ); From cb9794ccdbc943982e1619464c06f7a0297dfaaa Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 22 Aug 2013 14:35:21 -0400 Subject: [PATCH 065/184] Correct more issues with noderange --- perl-xCAT/xCAT/NodeRange.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 3c01fb005..1a34b912b 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -602,12 +602,12 @@ sub noderange { my $op = ","; if ($start =~ m/-$/) { #subtract the parenthetical $op .= "-" - } elsif ($start =~ m/@$/) { + } elsif ($start =~ m/\@$/) { $op = "@" } $start =~ s/,-$//; $start =~ s/,$//; - $start =~ s/@$//; + $start =~ s/\@$//; %nodes = map { $_ => 1 } noderange($start,$verify,$exsitenode,%options); my %innernodes = map { $_ => 1 } noderange($middle,$verify,$exsitenode,%options); set_arith(\%nodes,$op,\%innernodes); @@ -628,7 +628,11 @@ sub noderange { if ($atom =~ /^-/) { # if this is an exclusion, strip off the minus, but remember it $atom = substr($atom,1); $op = $op."-"; + } elsif ($atom =~ /^\@/) { # if this is an exclusion, strip off the minus, but remember it + $atom = substr($atom,1); + $op = "@"; } + if ($atom eq '') { next; } if ($atom =~ /^\^(.*)$/) { # get a list of nodes from a file open(NRF,$1); From 6853cbc89f4d900305ab5416570b959e2ea754a3 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Thu, 22 Aug 2013 23:00:08 -0700 Subject: [PATCH 066/184] postscripts modification for sysclone on sles --- xCAT/postscripts/configefi | 47 ++++++++++++++++++++++++++++++++-- xCAT/postscripts/killsyslog | 4 --- xCAT/postscripts/updatenetwork | 6 ++--- 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/xCAT/postscripts/configefi b/xCAT/postscripts/configefi index 6067248ce..4db78507c 100644 --- a/xCAT/postscripts/configefi +++ b/xCAT/postscripts/configefi @@ -1,2 +1,45 @@ -echo "Setting Boot Manager for the next boot." -efibootmgr -c -l \\EFI\\redhat\\grub.efi -L Linux +if [ -d /sys/firmware/efi ]; then + echo "Setting Boot Manager for the next boot." + efibootmgr -c -l \\EFI\\redhat\\grub.efi -L Linux +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_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'` + else + 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" + else + echo "Can not find the boot device, return error" + exit 1 + fi + + #for sles10, should run grub-install with parameters + echo "grub-install --no-floppy --recheck $boot_device" + grub-install --no-floppy --recheck $boot_device + if [ $? -ne 0 ];then + #sles11, run grub install directly + grub-install + fi + + if [ -e /etc/mtab.bak ];then + mv -f /etc/mtab.bak /etc/mtab + else + rm -f /etc/mtab + fi +fi diff --git a/xCAT/postscripts/killsyslog b/xCAT/postscripts/killsyslog index 47aa106b5..ba2395caa 100755 --- a/xCAT/postscripts/killsyslog +++ b/xCAT/postscripts/killsyslog @@ -1,7 +1,3 @@ -#!/bin/bash - -#only used in sysclone when the image os is sles - if [ -f "/etc/SuSE-release" ];then str_out=`ps -ef | grep -v grep | grep syslog-ng` if [ $? -eq 0 ];then diff --git a/xCAT/postscripts/updatenetwork b/xCAT/postscripts/updatenetwork index 4e7e9355d..fc82ab64d 100644 --- a/xCAT/postscripts/updatenetwork +++ b/xCAT/postscripts/updatenetwork @@ -7,21 +7,21 @@ if [ -n "$rule_file" ];then rm -f $rule_file fi -echo "Updating hostname to $HOSTNAME" -sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network - hostname $HOSTNAME str_cfg_file='' if [ -d "/etc/sysconfig/network-scripts/" ];then #redhat str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$DEVICE" + sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network elif [ -d "/etc/sysconfig/network/" ];then #suse str_cfg_file="/etc/sysconfig/network/ifcfg-$DEVICE" + echo "$HOSTNAME" > /etc/HOSTNAME else #ubuntu str_cfg_file="/etc/network/interfaces.d/$DEVICE" + echo "$HOSTNAME" > /etc/hostname fi echo "Old ifcfg-$DEVICE is:" From 67a663131eeed8c28479ce083bea7f1032699c99 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Thu, 22 Aug 2013 23:30:45 -0700 Subject: [PATCH 067/184] add mksysclone in sles.pm --- xCAT-server/lib/xcat/plugins/sles.pm | 251 ++++++++++++++++++++++++++- 1 file changed, 250 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 72677014a..7c76da347 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -37,7 +37,8 @@ sub handled_commands copycd => "sles", mknetboot => "nodetype:os=(sles.*)|(suse.*)", mkinstall => "nodetype:os=(sles.*)|(suse.*)", - mkstatelite => "nodetype:os=(sles.*)" + mkstatelite => "nodetype:os=(sles.*)", + mksysclone => "nodetype:os=(sles.*)|(suse.*)" }; } @@ -690,6 +691,10 @@ sub process_request { return mknetboot($request, $callback, $doreq); } + elsif ($request->{command}->[0] eq 'mksysclone') + { + return mksysclone($request, $callback, $doreq); + } } sub mkinstall @@ -1204,6 +1209,250 @@ sub mkinstall #} } +sub mksysclone +{ + my $request = shift; + my $callback = shift; + my $doreq = shift; + my @nodes = @{$request->{node}}; + my $osimagetab; + my %img_hash=(); + + my $installroot; + my $globaltftpdir; + $installroot = "/install"; + $globaltftpdir = "/tftpboot"; + + my @ents = xCAT::TableUtils->get_site_attribute("installdir"); + my $site_ent = $ents[0]; + if( defined($site_ent) ) + { + $installroot = $site_ent; + } + @ents = xCAT::TableUtils->get_site_attribute("tftpdir"); + $site_ent = $ents[0]; + if( defined($site_ent) ) + { + $globaltftpdir = $site_ent; + } + + my $node; + my $ostab = xCAT::Table->new('nodetype'); + my $restab = xCAT::Table->new('noderes'); + my $bptab = xCAT::Table->new('bootparams',-create=>1); + my $hmtab = xCAT::Table->new('nodehm'); + my %osents = %{$ostab->getNodesAttribs(\@nodes, ['os', 'arch', 'provmethod'])}; + my %rents = + %{$restab->getNodesAttribs(\@nodes, + ['xcatmaster', 'nfsserver', 'tftpdir', 'primarynic', 'installnic'])}; + my %hents = + %{$hmtab->getNodesAttribs(\@nodes, + ['serialport', 'serialspeed', 'serialflow'])}; + my $xcatdport="3001"; + my @entries = xCAT::TableUtils->get_site_attribute("xcatdport"); + if ( defined($entries[0])) { + $xcatdport = $entries[0]; + } + + my @entries = xCAT::TableUtils->get_site_attribute("master"); + my $master_entry = $entries[0]; + + require xCAT::Template; + + my $flag_return = 0; + # Warning message for nodeset install/netboot/statelite + foreach my $knode (keys %osents) + { + my $ent = $osents{$knode}->[0]; + if ($ent && $ent->{provmethod} && ($ent->{provmethod} eq 'sysclone')){ + $callback->( { error => ["$knode: The provmethod \"sysclone\" have been deprecated. use \"nodeset osimage=\" instead."], + errorcode => [1]}); + # Do not print this warning message multiple times + $flag_return = 1; + } + } + + if ( $flag_return == 1 ){ + return; + } + + # copy postscripts + my $pspath = "$installroot/sysclone/scripts/post-install/"; + my $clusterfile = "$installroot/sysclone/scripts/cluster.txt"; + + mkpath("$pspath"); + copy("$installroot/postscripts/configefi","$pspath/15all.configefi"); + copy("$installroot/postscripts/updatenetwork","$pspath/16all.updatenetwork"); + copy("$installroot/postscripts/runxcatpost","$pspath/17all.runxcatpost"); + copy("$installroot/postscripts/killsyslog","$pspath/17all.killsyslog"); + + unless (-r "$pspath/10all.fix_swap_uuids") + { + mkpath("$pspath"); + copy("/var/lib/systemimager/scripts/post-install/10all.fix_swap_uuids","$pspath"); + } + + unless (-r "$pspath/95all.monitord_rebooted") + { + mkpath("$pspath"); + copy("/var/lib/systemimager/scripts/post-install/95all.monitord_rebooted","$pspath"); + } + + # copy hosts + copy("/etc/hosts","$installroot/sysclone/scripts/"); + + foreach $node (@nodes) + { + my $os; + my $tftpdir; + my $arch; + my $imagename; # set it if running of 'nodeset osimage=xxx' + my $xcatmaster; + my $instserver; + + my $ient = $rents{$node}->[0]; + if ($ient and $ient->{xcatmaster}) + { + $xcatmaster = $ient->{xcatmaster}; + } else { + $xcatmaster = $master_entry; + } + + my $osinst; + if ($rents{$node}->[0] and $rents{$node}->[0]->{tftpdir}) { + $tftpdir = $rents{$node}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } + my $ent = $osents{$node}->[0]; + if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite') and ($ent->{provmethod} ne 'sysclone')) { + $imagename=$ent->{provmethod}; + #print "imagename=$imagename\n"; + if (!exists($img_hash{$imagename})) { + if (!$osimagetab) { + $osimagetab=xCAT::Table->new('osimage', -create=>1); + } + (my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'provmethod'); + if ($ref) { + $img_hash{$imagename}->{osarch}=$ref->{'osarch'}; + } else { + $callback->( + {error => ["The os image $imagename does not exists on the osimage table for $node"], + errorcode => [1]}); + next; + } + } + my $ph=$img_hash{$imagename}; + $arch = $ph->{osarch}; + } + + # copy kernel and initrd from image dir to /tftpboot + my $ramdisk_size = 200000; + + if ( + -r "$tftpdir/xcat/genesis.kernel.$arch" + and -r "$tftpdir/xcat/genesis.fs.$arch.gz" + ) + { + #We have a shot... + my $ent = $rents{$node}->[0]; + my $sent = $hents{$node}->[0]; + + my $kcmdline = "ramdisk_size=$ramdisk_size"; + my $ksdev = ""; + if ($ent->{installnic}) + { + $ksdev = $ent->{installnic}; + } + elsif ($ent->{primarynic}) + { + $ksdev = $ent->{primarynic}; + } + else + { + $ksdev = "bootif"; #if not specified, fall back to bootif + } + + if ($ksdev eq "mac") + { + my $mactab = xCAT::Table->new("mac"); + my $macref = $mactab->getNodeAttribs($node, ['mac']); + $ksdev = $macref->{mac}; + } + + unless ( $ksdev eq "bootif" ) { + $kcmdline .= " netdevice=" . $ksdev; + } + + if ($arch =~ /ppc/) { + $kcmdline .= " dhcptimeout=150"; + } + + if (defined($sent->{serialport})) + { + unless ($sent->{serialspeed}) + { + $callback->( { error => [ "serialport defined, but no serialspeed for $node in nodehm table" ], + errorcode => [1] } ); + } + else { + #go cmdline if serial console is requested, the shiny ansi is just impractical + $kcmdline .= " cmdline console=tty0 console=ttyS" + . $sent->{serialport} . "," + . $sent->{serialspeed}; + if ($sent->{serialflow} =~ /(hard|cts|ctsrts)/) { + $kcmdline .= "n8r"; + } + } + } + $kcmdline .= " xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename"; + + $bptab->setNodeAttribs( + $node, + { + kernel => "xcat/genesis.kernel.$arch", + initrd => "xcat/genesis.fs.$arch.gz", + kcmdline => $kcmdline + } + ); + } + else + { + $callback->( { error => ["Kernel and initrd not found in $tftpdir/xcat"], + errorcode => [1] } ); + } + + # assign nodes to an image + if (-r "$clusterfile") + { + my $cmd = qq{cat $clusterfile | grep "$node"}; + my $out = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC == 0) + { + my $out = `sed -i /$node./d $clusterfile`; + } + } + + my $cmd =qq{echo "$node:compute:$imagename:" >> $clusterfile}; + my $out = xCAT::Utils->runcmd($cmd, -1); + + unless (-r "$installroot/sysclone/images/$imagename/opt/xcat/xcatdsklspost") + { + mkpath("$installroot/sysclone/images/$imagename/opt/xcat/"); + copy("$installroot/postscripts/xcatdsklspost","$installroot/sysclone/images/$imagename/opt/xcat/"); + } + } + + # check systemimager-server-rsyncd to make sure it's running. + my $out = xCAT::Utils->runcmd("service systemimager-server-rsyncd status", -1); + if ($::RUNCMD_RC != 0) { # not running + my $rc = xCAT::Utils->startService("systemimager-server-rsyncd"); + if ($rc != 0) { + return 1; + } + } +} + sub copycd { my $request = shift; From 045011b1683e850ace0085ceb15e86a2386281e1 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 23 Aug 2013 06:42:36 -0400 Subject: [PATCH 068/184] kill the child processes when create socket failed --- xCAT-server/share/xcat/tools/detect_dhcpd | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/tools/detect_dhcpd b/xCAT-server/share/xcat/tools/detect_dhcpd index 10956e144..d696a66eb 100755 --- a/xCAT-server/share/xcat/tools/detect_dhcpd +++ b/xCAT-server/share/xcat/tools/detect_dhcpd @@ -88,7 +88,13 @@ my $sock = IO::Socket::INET->new(Proto => 'udp', #LocalAddr => 0, LocalAddr => $IP, LocalPort => '68', - PeerAddr => inet_ntoa(INADDR_BROADCAST)) or die "Create socket error: $@\n"; + PeerAddr => inet_ntoa(INADDR_BROADCAST)); + +unless ($sock) { + print "Create socket error: $@\n"; + kill_child(); + exit 1; +} my $timeout = 10; if ($::TIMEOUT) { @@ -104,6 +110,8 @@ while ($end - $start <= $timeout) { $end =~ s/(\d.*)\.(\d.*)/$1/; } + +kill_child(); #kill the child process kill 15, $pid; my @pidoftcpdump = `ps -ef | grep -E "[0-9]+:[0-9]+:[0-9]+ tcpdump -i $IF" | awk -F' ' '{print \$2}'`; @@ -297,4 +305,11 @@ sub packdhcppkg{ return $package; } - +sub kill_child { + kill 15, $pid; + my @pidoftcpdump = `ps -ef | grep -E "[0-9]+:[0-9]+:[0-9]+ tcpdump -i $IF" | awk -F' ' '{print \$2}'`; + foreach my $cpid (@pidoftcpdump) { + kill 15, $cpid; + #print "try to kill $cpid\n"; + } +} From 181010799855958ade77f1ed648d62b099a0288d Mon Sep 17 00:00:00 2001 From: lissav Date: Sat, 24 Aug 2013 06:31:21 -0400 Subject: [PATCH 069/184] add additonal ethernet setup --- xCAT-client/pods/man1/xdsh.1.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-client/pods/man1/xdsh.1.pod b/xCAT-client/pods/man1/xdsh.1.pod index a98eb07ab..e5ba3c110 100644 --- a/xCAT-client/pods/man1/xdsh.1.pod +++ b/xCAT-client/pods/man1/xdsh.1.pod @@ -565,7 +565,7 @@ To define a BNT Ethernet switch as a node and run a command to create a new vlan B I -B I +B I where I and I are the SSH user name and password for the switch. If it is for Telnet, add I in front of the user name: I. I From 814974aaa88adb7f840d0d223e007659ebeaeb2a Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 26 Aug 2013 00:17:08 -0700 Subject: [PATCH 070/184] sles.pm mksysclone for sles --- xCAT-server/lib/xcat/plugins/sles.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 7c76da347..f14257767 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1292,6 +1292,12 @@ 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/95all.monitord_rebooted") { mkpath("$pspath"); From 624fce5e4d3602179823af8641de45e6c6b65dcb Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 26 Aug 2013 11:10:35 -0400 Subject: [PATCH 071/184] changes for defect 3758 git patch --- xCAT-client/pods/man1/rbootseq.1.pod | 22 +++++++++++++++++++++- xCAT-server/lib/xcat/plugins/hpblade.pm | 9 +++++++++ xCAT-server/share/xcat/cons/hpblade | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/xCAT-client/pods/man1/rbootseq.1.pod b/xCAT-client/pods/man1/rbootseq.1.pod index 7a5c491ea..a81eee0f0 100644 --- a/xCAT-client/pods/man1/rbootseq.1.pod +++ b/xCAT-client/pods/man1/rbootseq.1.pod @@ -11,6 +11,10 @@ B [B<-h>|B<--help>|B<-v>|B<--version>] B I {B|B|B|B|B|B|B|B|B|B|B|B|B}B<,>I<...> +=head2 HP Blade specific: + +B I {B|B|B|B|B|B|B|B|B}B<,>I<...> + =head2 PPC (using Direct FSP Management) specific: B I B<[hfi|net]> @@ -52,6 +56,22 @@ The fourth hard disk. Boot over the ethernet network, using a PXE or BOOTP broadcast. +=item B|B|B|B|B (HP Blade Only) + +Boot over the first ethernet network, using a PXE or BOOTP broadcast. + +=item B|B (HP Blade Only) + +Boot over the second ethernet network, using a PXE or BOOTP broadcast. + +=item B|B (HP Blade Only) + +Boot over the third ethernet network, using a PXE or BOOTP broadcast. + +=item B|B (HP Blade Only) + +Boot over the fourth ethernet network, using a PXE or BOOTP broadcast. + =item B Boot p775 nodes over the HFI network, using BOOTP broadcast. @@ -68,7 +88,7 @@ Boot to an iSCSI disk over the network. The CD or DVD drive. -=item B|B|B +=item B|B|B A USB flash drive. diff --git a/xCAT-server/lib/xcat/plugins/hpblade.pm b/xCAT-server/lib/xcat/plugins/hpblade.pm index 1322d2708..156de8071 100755 --- a/xCAT-server/lib/xcat/plugins/hpblade.pm +++ b/xCAT-server/lib/xcat/plugins/hpblade.pm @@ -90,21 +90,30 @@ my %bootnumbers = ( 'f' => 2, 'floppy' => 2, 'usb' => 3, + 'usbflash' => 3, + 'flash' => 3, 'h' => 4, 'hd' => 4, 'hdd' => 4, + 'hd0' => 4, 'harddisk' => 4, 'eth0' => 5, 'nic1' => 5, + 'net1' => 5, + 'net' => 5, + 'n' => 5, 'pxe_nic1' => 5, 'eth1' => 6, 'nic2' => 6, + 'net2' => 6, 'pxe_nic2' => 6, 'eth2' => 7, 'nic3' => 7, + 'net3' => 7, 'pxe_nic3' => 7, 'eth3' => 8, 'nic4' => 8, + 'net4' => 8, 'pxe_nic4' => 8 ); diff --git a/xCAT-server/share/xcat/cons/hpblade b/xCAT-server/share/xcat/cons/hpblade index eb572075d..2bb0efd34 100755 --- a/xCAT-server/share/xcat/cons/hpblade +++ b/xCAT-server/share/xcat/cons/hpblade @@ -109,7 +109,7 @@ until ($mm and $username and $slot) { } release_lock(); #done with xcatd, can run with near impunity $sleepint=10+int(rand(30)); #Stagger sleep to take it easy on AMM/hosting server -exec "ssh -t $username"."@"."$mm"; +exec "ssh -t $username"."@"."$mm vsp"; my $pathtochild= dirname($scriptname). "/"; #exec $pathtochild."hpblade.expect"; From 9c0032b3c1af47d2e4f859ccf15347a1153461b3 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 26 Aug 2013 20:55:11 -0700 Subject: [PATCH 072/184] sysclone support sles11 on uefi mode --- xCAT-server/lib/xcat/plugins/anaconda.pm | 2 +- xCAT-server/lib/xcat/plugins/sles.pm | 17 +++++++----- xCAT/postscripts/configefi | 16 ++++++++++- xCAT/postscripts/runxcatpost | 3 ++ xCAT/postscripts/updatenetwork | 35 ++++++++++++++++++------ 5 files changed, 55 insertions(+), 18 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 77da2276a..ac38dfc07 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -1860,7 +1860,7 @@ sub mksysclone $kcmdline .= "n8r"; } } - $kcmdline .= " xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename"; + $kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename"; #$kcmdline .= " noipv6"; # add the addkcmdline attribute to the end # of the command, if it exists diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index f14257767..0bcdfb310 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1284,7 +1284,7 @@ sub mksysclone copy("$installroot/postscripts/configefi","$pspath/15all.configefi"); copy("$installroot/postscripts/updatenetwork","$pspath/16all.updatenetwork"); copy("$installroot/postscripts/runxcatpost","$pspath/17all.runxcatpost"); - copy("$installroot/postscripts/killsyslog","$pspath/17all.killsyslog"); + copy("$installroot/postscripts/killsyslog","$pspath/99all.killsyslog"); unless (-r "$pspath/10all.fix_swap_uuids") { @@ -1355,10 +1355,9 @@ sub mksysclone # copy kernel and initrd from image dir to /tftpboot my $ramdisk_size = 200000; - if ( - -r "$tftpdir/xcat/genesis.kernel.$arch" - and -r "$tftpdir/xcat/genesis.fs.$arch.gz" - ) + if ( -r "$tftpdir/xcat/genesis.kernel.$arch" + and ( -r "$tftpdir/xcat/genesis.fs.$arch.gz" + or -r "$tftpdir/xcat/genesis.fs.$arch.lzma" )) { #We have a shot... my $ent = $rents{$node}->[0]; @@ -1411,13 +1410,17 @@ sub mksysclone } } } - $kcmdline .= " xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename"; + $kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename"; + my $i = "xcat/genesis.fs.$arch.gz"; + if ( -r "$tftpdir/xcat/genesis.fs.$arch.lzma" ){ + $i = "xcat/genesis.fs.$arch.lzma"; + } $bptab->setNodeAttribs( $node, { kernel => "xcat/genesis.kernel.$arch", - initrd => "xcat/genesis.fs.$arch.gz", + initrd => $i, kcmdline => $kcmdline } ); diff --git a/xCAT/postscripts/configefi b/xCAT/postscripts/configefi index 4db78507c..5fb3d6295 100644 --- a/xCAT/postscripts/configefi +++ b/xCAT/postscripts/configefi @@ -1,6 +1,20 @@ if [ -d /sys/firmware/efi ]; then echo "Setting Boot Manager for the next boot." - efibootmgr -c -l \\EFI\\redhat\\grub.efi -L Linux + 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 + 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 diff --git a/xCAT/postscripts/runxcatpost b/xCAT/postscripts/runxcatpost index 9d4647342..595249408 100644 --- a/xCAT/postscripts/runxcatpost +++ b/xCAT/postscripts/runxcatpost @@ -1,4 +1,7 @@ #!/bin/bash +if [ -f "/opt/xcat/xcatinfo" ];then + rm -f "/opt/xcat/xcatinfo" +fi /opt/xcat/xcatdsklspost . /tmp/post-install/variables.txt diff --git a/xCAT/postscripts/updatenetwork b/xCAT/postscripts/updatenetwork index fc82ab64d..4f4e2dfca 100644 --- a/xCAT/postscripts/updatenetwork +++ b/xCAT/postscripts/updatenetwork @@ -14,22 +14,39 @@ if [ -d "/etc/sysconfig/network-scripts/" ];then #redhat str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$DEVICE" sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network + if [ -f $str_cfg_file ];then + echo "Old ifcfg-$DEVICE is:" + cat $str_cfg_file + HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'` + sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" $str_cfg_file + sed -i "s/UUID=.*//g" $str_cfg_file + else + echo "DEVICE=\"$DEVICE\"" > $str_cfg_file + echo "BOOTPROTO=\"dhcp\"" >> $str_cfg_file + echo "NM_CONTROLLED=\"yes\"" >> $str_cfg_file + echo "ONBOOT=\"yes\"" >> $str_cfg_file + fi elif [ -d "/etc/sysconfig/network/" ];then #suse str_cfg_file="/etc/sysconfig/network/ifcfg-$DEVICE" echo "$HOSTNAME" > /etc/HOSTNAME + if [ -f $str_cfg_file ];then + echo "Old ifcfg-$DEVICE is:" + cat $str_cfg_file + HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'` + sed -i "s/HWADDR=.*/HWADDR=$HWADDR/g" $str_cfg_file + sed -i "s/UUID=.*//g" $str_cfg_file + else + echo "DEVICE=\"$DEVICE\"" > $str_cfg_file + echo "BOOTPROTO=dhcp" >> $str_cfg_file + echo "STARTMODE=onboot" >> $str_cfg_file + echo "DHCLIENT_PRIMARY_DEVICE=yes" >> $str_cfg_file + fi else #ubuntu - str_cfg_file="/etc/network/interfaces.d/$DEVICE" - echo "$HOSTNAME" > /etc/hostname + echo "Does not support ubuntu." + exit 1 fi -echo "Old ifcfg-$DEVICE is:" -cat $str_cfg_file - -HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'` -sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" $str_cfg_file -sed -i "s/UUID=.*//g" $str_cfg_file - echo "New ifcfg-$DEVICE is:" cat $str_cfg_file From 80e8c21af7628a7f75da346556e4969024856615 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 27 Aug 2013 09:46:55 -0400 Subject: [PATCH 073/184] fixes for defect 3750 --- xCAT-server/lib/xcat/plugins/anaconda.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index ac38dfc07..afa0eca09 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -182,6 +182,8 @@ sub mknetboot my $xcatdport = "3001"; my $xcatiport = "3002"; my $nodestatus = "y"; + my @myself = xCAT::NetworkUtils->determinehostname(); + my $myname = $myself[(scalar @myself)-1]; #if ($sitetab) #{ @@ -446,7 +448,7 @@ sub mknetboot if ($statelite) { unless ( -r "$rootimgdir/kernel") { $callback->({ - error=>[qq{Did you run "genimage" before running "liteimg"? kernel cannot be found...}], + error=>[qq{Did you run "genimage" before running "liteimg"? kernel cannot be found at $rootimgdir/kernel on $myname}], errorcode=>[1] }); next; @@ -454,7 +456,7 @@ sub mknetboot if (!-r "$rootimgdir/initrd-statelite.gz") { if (! -r "$rootimgdir/initrd.gz") { $callback->({ - error=>[qq{Did you run "genimage" before running "liteimg"? initrd.gz or initrd-statelite.gz cannot be found}], + error=>[qq{Did you run "genimage" before running "liteimg"? initrd.gz or initrd-statelite.gz cannot be found at $rootimgdir/initrd.gz on $myname}], errorcode=>[1] }); next; @@ -473,7 +475,7 @@ sub mknetboot } else { unless ( -r "$rootimgdir/kernel") { $callback->({ - error=>[qq{Did you run "genimage" before running "packimage"? kernel cannot be found}], + error=>[qq{Did you run "genimage" before running "packimage"? kernel cannot be found at $rootimgdir/kernel on $myname}], errorcode=>[1] }); next; @@ -481,7 +483,7 @@ sub mknetboot if (!-r "$rootimgdir/initrd-stateless.gz") { if (! -r "$rootimgdir/initrd.gz") { $callback->({ - error=>[qq{Did you run "genimage" before running "packimage"? initrd.gz or initrd-stateless.gz cannot be found}], + error=>[qq{Did you run "genimage" before running "packimage"? initrd.gz or initrd-stateless.gz cannot be found at $rootimgdir/initrd.gz on $myname}], errorcode=>[1] }); next; @@ -491,7 +493,7 @@ sub mknetboot } unless ( -r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.sfs" ) { $callback->({ - error=>["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], + error=>["No packed image for platform $osver, architecture $arch, and profile $profile found at $rootimgdir/rootimg.gz or $rootimgdir/rootimg.sfs on $myname, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1]}); next; } From e313b49839201cffb54f009f9b6c91490110c774 Mon Sep 17 00:00:00 2001 From: Bruce Potter Date: Tue, 27 Aug 2013 11:23:22 -0400 Subject: [PATCH 074/184] change git cmd used to get current branch --- buildcore.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildcore.sh b/buildcore.sh index 7ec8b0a7a..a0cd222e5 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -88,7 +88,8 @@ fi # for the git case, query the current branch and set REL (changing master to devel if necessary) function setbranch { #git checkout $BRANCH - REL=`git rev-parse --abbrev-ref HEAD` + #REL=`git rev-parse --abbrev-ref HEAD` + REL='git name-rev --name-only HEAD' if [ "$REL" = "master" ]; then REL="devel" fi From cae2da8eba15f882f695272dafb942ef5e00a6f8 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 27 Aug 2013 12:24:02 -0400 Subject: [PATCH 075/184] add check for servicenodes and computenodes in noderange for nodeset. Also remove very old commented out code defect 3750 --- xCAT-server/lib/xcat/plugins/yaboot.pm | 55 ++++++++------------------ 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 6351ff2e6..2988a926a 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -5,6 +5,7 @@ use Sys::Syslog; use xCAT::Scope; use xCAT::Utils; use xCAT::TableUtils; +use xCAT::ServiceNodeUtils; use xCAT::NetworkUtils; use xCAT::MsgUtils; use File::Path; @@ -334,7 +335,7 @@ sub preprocess_request { @args=($req->{arg}); } @ARGV = @args; - + my $nodes = $req->{node}; #use Getopt::Long; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -375,13 +376,23 @@ sub preprocess_request { #Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when - #they specify no sharedtftp in site table - #my $stab = xCAT::Table->new('site'); - - #my $sent = $stab->getAttribs({key=>'sharedtftp'},'value'); + #if they specify no sharedtftp in site table my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp"); my $t_entry = $entries[0]; if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) { + # check for computenodes and servicenodes from the noderange, if so error out + my @SN; + my @CN; + xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN); + if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN + my $rsp; + $rsp->{data}->[0] = + "Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n"; + xCAT::MsgUtils->message("E", $rsp, $callback1); + return; + + } + $req->{'_disparatetftp'}=[1]; if ($req->{inittime}->[0]) { return [$req]; @@ -390,40 +401,6 @@ sub preprocess_request { } return [$req]; } -#sub preprocess_request { -# my $req = shift; -# my $callback = shift; -# my %localnodehash; -# my %dispatchhash; -# my $nrtab = xCAT::Table->new('noderes'); -# foreach my $node (@{$req->{node}}) { -# my $nodeserver; -# my $tent = $nrtab->getNodeAttribs($node,['tftpserver']); -# if ($tent) { $nodeserver = $tent->{tftpserver} } -# unless ($tent and $tent->{tftpserver}) { -# $tent = $nrtab->getNodeAttribs($node,['servicenode']); -# if ($tent) { $nodeserver = $tent->{servicenode} } -# } -# if ($nodeserver) { -# $dispatchhash{$nodeserver}->{$node} = 1; -# } else { -# $localnodehash{$node} = 1; -# } -# } -# my @requests; -# my $reqc = {%$req}; -# $reqc->{node} = [ keys %localnodehash ]; -# if (scalar(@{$reqc->{node}})) { push @requests,$reqc } -# -# foreach my $dtarg (keys %dispatchhash) { #iterate dispatch targets -# my $reqcopy = {%$req}; #deep copy -# $reqcopy->{'_xcatdest'} = $dtarg; -# $reqcopy->{node} = [ keys %{$dispatchhash{$dtarg}}]; -# push @requests,$reqcopy; -# } -# return \@requests; -#} -# sub process_request { From f4ddcdb9dedb4c487253dc756f018d9bd9611064 Mon Sep 17 00:00:00 2001 From: Bruce Potter Date: Tue, 27 Aug 2013 12:49:04 -0400 Subject: [PATCH 076/184] fix bld script change --- buildcore.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildcore.sh b/buildcore.sh index a0cd222e5..e337d4e60 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -89,7 +89,7 @@ fi function setbranch { #git checkout $BRANCH #REL=`git rev-parse --abbrev-ref HEAD` - REL='git name-rev --name-only HEAD' + REL=`git name-rev --name-only HEAD` if [ "$REL" = "master" ]; then REL="devel" fi From 25b028a5fdc193f322fd7a85b465392f21032d20 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 27 Aug 2013 12:51:50 -0400 Subject: [PATCH 077/184] add check for servicenodes and computenodes in noderange for nodeset. Also remove very old commented out code defect 3750 --- xCAT-server/lib/xcat/plugins/pxe.pm | 67 +++++++---------------------- 1 file changed, 15 insertions(+), 52 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index 9dab827bc..b5d947b56 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -10,6 +10,7 @@ use File::Path; use Getopt::Long; require xCAT::Utils; require xCAT::TableUtils; +use xCAT::ServiceNodeUtils; my $addkcmdlinehandled; my $request; my $callback; @@ -279,6 +280,7 @@ sub preprocess_request { my $callback1 = shift; my $command = $req->{command}->[0]; my $sub_req = shift; + my $nodes = $req->{node}; my @args=(); if (ref($req->{arg})) { @args=@{$req->{arg}}; @@ -327,6 +329,19 @@ sub preprocess_request { my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp"); my $t_entry = $entries[0]; if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) { + # check for computenodes and servicenodes from the noderange, if so error out + my @SN; + my @CN; + xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN); + if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN + my $rsp; + $rsp->{data}->[0] = + "Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n"; + xCAT::MsgUtils->message("E", $rsp, $callback1); + return; + + } + $req->{'_disparatetftp'}=[1]; if ($req->{inittime}->[0]) { return [$req]; @@ -335,58 +350,6 @@ sub preprocess_request { } return [$req]; } -#sub preprocess_request { -# my $req = shift; -# $callback = shift; -# if ($req->{_xcatdest}) { return [$req]; } #Exit if the packet has been preprocessed in its history -# my @requests = ({%$req}); #Start with a straight copy to reflect local instance -# my $sitetab = xCAT::Table->new('site'); -# (my $ent) = $sitetab->getAttribs({key=>'xcatservers'},'value'); -# $sitetab->close; -# if ($ent and $ent->{value}) { -# foreach (split /,/,$ent->{value}) { -# if (xCAT::NetworkUtils->thishostisnot($_)) { -# my $reqcopy = {%$req}; -# $reqcopy->{'_xcatdest'} = $_; -# push @requests,$reqcopy; -# } -# } -# } -# return \@requests; -#} -#sub preprocess_request { -# my $req = shift; -# my $callback = shift; -# my %localnodehash; -# my %dispatchhash; -# my $nrtab = xCAT::Table->new('noderes'); -# foreach my $node (@{$req->{node}}) { -# my $nodeserver; -# my $tent = $nrtab->getNodeAttribs($node,['tftpserver']); -# if ($tent) { $nodeserver = $tent->{tftpserver} } -# unless ($tent and $tent->{tftpserver}) { -# $tent = $nrtab->getNodeAttribs($node,['servicenode']); -# if ($tent) { $nodeserver = $tent->{servicenode} } -# } -# if ($nodeserver) { -# $dispatchhash{$nodeserver}->{$node} = 1; -# } else { -# $localnodehash{$node} = 1; -# } -# } -# my @requests; -# my $reqc = {%$req}; -# $reqc->{node} = [ keys %localnodehash ]; -# if (scalar(@{$reqc->{node}})) { push @requests,$reqc } -# -# foreach my $dtarg (keys %dispatchhash) { #iterate dispatch targets -# my $reqcopy = {%$req}; #deep copy -# $reqcopy->{'_xcatdest'} = $dtarg; -# $reqcopy->{node} = [ keys %{$dispatchhash{$dtarg}}]; -# push @requests,$reqcopy; -# } -# return \@requests; -#} sub process_request { $request = shift; From 0fa516df777b5ccb7140f06e09eb4356dc67830a Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 27 Aug 2013 13:12:19 -0400 Subject: [PATCH 078/184] add check for servicenodes and computenodes in noderange for nodeset. Also remove very old commented out code defect 3750 --- xCAT-server/lib/xcat/plugins/xnba.pm | 71 ++++++---------------------- 1 file changed, 15 insertions(+), 56 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 055fb1dd8..65ed1298c 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -10,7 +10,7 @@ use xCAT::MsgUtils; use Getopt::Long; use xCAT::Utils; use xCAT::TableUtils; - +use xCAT::ServiceNodeUtils; my $addkcmdlinehandled; my $request; my $callback; @@ -294,6 +294,7 @@ sub preprocess_request { my $callback1 = shift; my $command = $req->{command}->[0]; my $sub_req = shift; + my $nodes = $req->{node}; my @args=(); if (ref($req->{arg})) { @args=@{$req->{arg}}; @@ -345,11 +346,22 @@ sub preprocess_request { #Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when #they specify no sharedtftp in site table - #my $stab = xCAT::Table->new('site'); - #my $sent = $stab->getAttribs({key=>'sharedtftp'},'value');i my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp"); my $t_entry = $entries[0]; if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) { + # check for computenodes and servicenodes from the noderange, if so error out + my @SN; + my @CN; + xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN); + if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN + my $rsp; + $rsp->{data}->[0] = + "Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n"; + xCAT::MsgUtils->message("E", $rsp, $callback1); + return; + + } + $req->{'_disparatetftp'}=[1]; if ($req->{inittime}->[0]) { return [$req]; @@ -358,59 +370,6 @@ sub preprocess_request { } return [$req]; } -#sub preprocess_request { -# my $req = shift; -# $callback = shift; -# if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; } -# my @requests = ({%$req}); #Start with a straight copy to reflect local instance -# my $sitetab = xCAT::Table->new('site'); -# (my $ent) = $sitetab->getAttribs({key=>'xcatservers'},'value'); -# $sitetab->close; -# if ($ent and $ent->{value}) { -# foreach (split /,/,$ent->{value}) { -# if (xCAT::NetworkUtils->thishostisnot($_)) { -# my $reqcopy = {%$req}; -# $reqcopy->{'_xcatdest'} = $_; -# $reqcopy->{_xcatpreprocessed}->[0] = 1; -# push @requests,$reqcopy; -# } -# } -# } -# return \@requests; -#} -#sub preprocess_request { -# my $req = shift; -# my $callback = shift; -# my %localnodehash; -# my %dispatchhash; -# my $nrtab = xCAT::Table->new('noderes'); -# foreach my $node (@{$req->{node}}) { -# my $nodeserver; -# my $tent = $nrtab->getNodeAttribs($node,['tftpserver']); -# if ($tent) { $nodeserver = $tent->{tftpserver} } -# unless ($tent and $tent->{tftpserver}) { -# $tent = $nrtab->getNodeAttribs($node,['servicenode']); -# if ($tent) { $nodeserver = $tent->{servicenode} } -# } -# if ($nodeserver) { -# $dispatchhash{$nodeserver}->{$node} = 1; -# } else { -# $localnodehash{$node} = 1; -# } -# } -# my @requests; -# my $reqc = {%$req}; -# $reqc->{node} = [ keys %localnodehash ]; -# if (scalar(@{$reqc->{node}})) { push @requests,$reqc } -# -# foreach my $dtarg (keys %dispatchhash) { #iterate dispatch targets -# my $reqcopy = {%$req}; #deep copy -# $reqcopy->{'_xcatdest'} = $dtarg; -# $reqcopy->{node} = [ keys %{$dispatchhash{$dtarg}}]; -# push @requests,$reqcopy; -# } -# return \@requests; -#} sub process_request { $request = shift; From 1a5b1e908602799b041c32d85b7c7a05c372997f Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 28 Aug 2013 13:06:56 -0400 Subject: [PATCH 079/184] add support to supply expect timeout --- perl-xCAT/xCAT/RemoteShellExp.pm | 45 +++++++++++++++++++------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/perl-xCAT/xCAT/RemoteShellExp.pm b/perl-xCAT/xCAT/RemoteShellExp.pm index 11fba4f82..505cbeee6 100755 --- a/perl-xCAT/xCAT/RemoteShellExp.pm +++ b/perl-xCAT/xCAT/RemoteShellExp.pm @@ -41,15 +41,16 @@ package xCAT::RemoteShellExp; [-t node list] test ssh connection to the node [-k] Generates the ssh keys needed , for the user on the MN. [-s node list] copies the ssh keys to the nodes - + optional $timeout = timeout value for the expect. Usually from the xdsh -t flag + default timeout is 10 seconds exit 0 - good exit 1 - abort exit 2 - usage error Examples: -$rc=xCAT::RemoteShellExp->remoteshellexp("k",$callback,$remoteshellcmd); -$rc=xCAT::RemoteShellExp->remoteshellexp("s",$callback,$remoteshellcmd,$nodes); -$rc=xCAT::RemoteShellExp->remoteshellexp("t",$callback,$remoteshellcmd,$nodes); +$rc=xCAT::RemoteShellExp->remoteshellexp("k",$callback,$remoteshellcmd,$timeout); +$rc=xCAT::RemoteShellExp->remoteshellexp("s",$callback,$remoteshellcmd,$nodes,$timeout); +$rc=xCAT::RemoteShellExp->remoteshellexp("t",$callback,$remoteshellcmd,$nodes,$timeout); =cut @@ -70,7 +71,7 @@ use strict; #----------------------------------------------------------------------------- sub remoteshellexp { - my ($class, $flag, $callback, $remoteshell, $nodes) = @_; + my ($class, $flag, $callback, $remoteshell, $nodes, $timeout) = @_; my $rc=0; $::CALLBACK = $callback; if (!($flag)) @@ -89,8 +90,16 @@ sub remoteshellexp xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); return 2; + } + my $expecttimeout=10; # default + if (defined($timeout)) { # value supplied + $expecttimeout=$timeout; } + my $rsp = {}; + $rsp->{data}->[0] = + "Timeout is $expecttimeout."; + xCAT::MsgUtils->message("D", $rsp, $::CALLBACK); # for -s flag must have nodes and a $to_userid password my $to_user_password; if ($ENV{'DSH_REMOTE_PASSWORD'}) { @@ -180,7 +189,7 @@ sub remoteshellexp { # if the file size of the id_rsa key is 0, tell them to remove it # and run the command again - $rc=xCAT::RemoteShellExp->gensshkeys; + $rc=xCAT::RemoteShellExp->gensshkeys($expecttimeout); } # send ssh keys to the nodes/devices, to setup passwordless ssh if ($flag eq "s") @@ -193,15 +202,15 @@ sub remoteshellexp return 1; } if ($ssh_setup_cmd) { # setup ssh on devices - $rc=xCAT::RemoteShellExp->senddeviceskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$ssh_setup_cmd,$nodes); + $rc=xCAT::RemoteShellExp->senddeviceskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$ssh_setup_cmd,$nodes, $expecttimeout); } else { #setup ssh on nodes - $rc=xCAT::RemoteShellExp->sendnodeskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$nodes); + $rc=xCAT::RemoteShellExp->sendnodeskeys($remoteshell,$remotecopy,$to_userid,$to_user_password,$home,$nodes, $expecttimeout); } } # test ssh setup on the node if ($flag eq "t") { - $rc=xCAT::RemoteShellExp->testkeys($remoteshell,$to_userid,$nodes); + $rc=xCAT::RemoteShellExp->testkeys($remoteshell,$to_userid,$nodes,$expecttimeout); } return $rc; } @@ -220,9 +229,9 @@ sub remoteshellexp sub gensshkeys { - my ($class) = @_; + my ($class, $expecttimeout) = @_; my $keygen; - my $timeout = 10; # sets Expect default timeout, 0 accepts immediately + my $timeout = $expecttimeout; # sets Expect default timeout, 0 accepts immediately my $keygen_sent = 0; my $prompt1 = 'Generating public/private rsa'; my $prompt2 = 'Enter file.*:'; @@ -347,9 +356,9 @@ sub gensshkeys sub testkeys { - my ($class,$remoteshell,$to_userid,$nodes) = @_; + my ($class,$remoteshell,$to_userid,$nodes, $expecttimeout) = @_; my $testkeys; - my $timeout = 10; # sets Expect default timeout, 0 accepts immediately + my $timeout = $expecttimeout; # sets Expect default timeout my $testkeys_sent = 0; my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?'; my $prompt2 = 'ssword:'; @@ -469,9 +478,9 @@ sub testkeys sub sendnodeskeys { - my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$nodes) = @_; + my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$nodes, $expecttimeout) = @_; my $sendkeys; - my $timeout = 10; # sets Expect default timeout, 0 accepts immediately + my $timeout = $expecttimeout; # sets Expect default timeout, 0 accepts immediately my $sendkeys_sent = 0; my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?'; my $prompt2 = 'ssword:'; @@ -759,7 +768,7 @@ sub sendnodeskeys =head3 senddeviceskeys - Setup the ssh keys on the nodes + Setup the ssh keys on the switches =cut @@ -768,9 +777,9 @@ sub sendnodeskeys sub senddeviceskeys { - my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$ssh_setup_cmd,$nodes) = @_; + my ($class,$remoteshell,$remotecopy,$to_userid,$to_userpassword,$home,$ssh_setup_cmd,$nodes, $expecttimeout) = @_; my $sendkeys; - my $timeout = 10; # sets Expect default timeout, 0 accepts immediately + my $timeout = $expecttimeout; # sets Expect default timeout, 0 accepts immediately my $sendkeys_sent = 0; my $prompt1 = 'Are you sure you want to continue connecting (yes/no)?'; my $prompt2 = 'ssword:'; From e91888a79bc0077c296f2659c6a66cd8c5376a97 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Thu, 29 Aug 2013 03:01:10 -0700 Subject: [PATCH 080/184] add syscloneimgupdate scripts to update the target nodes files --- xCAT/postscripts/syscloneimgupdate | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 xCAT/postscripts/syscloneimgupdate diff --git a/xCAT/postscripts/syscloneimgupdate b/xCAT/postscripts/syscloneimgupdate new file mode 100755 index 000000000..b785f7a8d --- /dev/null +++ b/xCAT/postscripts/syscloneimgupdate @@ -0,0 +1,37 @@ +#!/bin/bash + +if [ "$NODESETSTATE" != "sysclone" ];then + exit 0 +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 +do + if [ ! -e $filename ];then + continue + fi + + grep -E "^\s*${filename}\s*$" "/etc/systemimager/updateclient.local.exclude" + if [ $? -ne 0 ];then + echo "$filename" >> "/etc/systemimager/updateclient.local.exclude" + fi +done + +#get the current image server +str_server_ip='' +. /opt/xcat/xcatinfo +if [ -n "$XCATSERVER" ];then + str_server_ip=$XCATSERVER +else + str_server_ip=$MASTER +fi + +if [ -z "$str_server_ip" ];then + echo "Can not find out the image server." + exit 1 +fi + +str_server_ip=`echo $str_server_ip | sed "s/'//g"` +#call system imager command to update the image +echo "si_updateclient --server $str_server_ip --no-bootloader --yes" +export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_updateclient --server $str_server_ip --no-bootloader --yes From ac791794006977445be4092fa720b67dda35ca24 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 29 Aug 2013 07:59:02 -0400 Subject: [PATCH 081/184] more code to enable user input timeout on xdsh -K --- perl-xCAT/xCAT/TableUtils.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/TableUtils.pm b/perl-xCAT/xCAT/TableUtils.pm index da113712a..228c1c244 100644 --- a/perl-xCAT/xCAT/TableUtils.pm +++ b/perl-xCAT/xCAT/TableUtils.pm @@ -257,6 +257,7 @@ sub bldnonrootSSHFiles Arguments: Array of nodes + Timeout for expect call (optional) Returns: Env Variables: $DSH_FROM_USERID, $DSH_TO_USERID, $DSH_REMOTE_PASSWORD @@ -281,7 +282,7 @@ sub bldnonrootSSHFiles #-------------------------------------------------------------------------------- sub setupSSH { - my ($class, $ref_nodes) = @_; + my ($class, $ref_nodes,$expecttimeout) = @_; my @nodes = $ref_nodes; my @badnodes = (); my $n_str = $nodes[0]; @@ -350,7 +351,7 @@ sub setupSSH # generates new keys for root, if they do not already exist my $rc= - xCAT::RemoteShellExp->remoteshellexp("k",$::CALLBACK,$::REMOTE_SHELL); + xCAT::RemoteShellExp->remoteshellexp("k",$::CALLBACK,$::REMOTE_SHELL,$expecttimeout); if ($rc != 0) { $rsp->{data}->[0] = "remoteshellexp failed generating keys."; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); @@ -442,7 +443,7 @@ rmdir \"/tmp/$to_userid\" \n"; if ($enablenodes) { # node on list to setup nodetonodessh chop $enablenodes; # remove last comma $ENV{'DSH_ENABLE_SSH'} = "YES"; - my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$enablenodes); + my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$enablenodes,$expecttimeout); if ($rc != 0) { $rsp->{data}->[0] = "remoteshellexp failed sending keys to enablenodes."; @@ -452,7 +453,7 @@ rmdir \"/tmp/$to_userid\" \n"; } if ($disablenodes) { # node on list to setup nodetonodessh chop $disablenodes; # remove last comma - my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$disablenodes); + my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$disablenodes,$expecttimeout); if ($rc != 0) { $rsp->{data}->[0] = "remoteshellexp failed sending keys to disablenodes."; @@ -462,7 +463,7 @@ rmdir \"/tmp/$to_userid\" \n"; } } else { # from user is not root or it is a device , always send private key $ENV{'DSH_ENABLE_SSH'} = "YES"; - my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$n_str); + my $rc=xCAT::RemoteShellExp->remoteshellexp("s",$::CALLBACK,"/usr/bin/ssh",$n_str,$expecttimeout); if ($rc != 0) { $rsp->{data}->[0] = "remoteshellexp failed sending keys."; @@ -476,7 +477,7 @@ rmdir \"/tmp/$to_userid\" \n"; foreach my $n (@testnodes) { my $rc= - xCAT::RemoteShellExp->remoteshellexp("t",$::CALLBACK,"/usr/bin/ssh",$n); + xCAT::RemoteShellExp->remoteshellexp("t",$::CALLBACK,"/usr/bin/ssh",$n,$expecttimeout); if ($rc != 0) { push @badnodes, $n; From 28fba7f066bec4d133fcb137057d567d1f7bfc4d Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 29 Aug 2013 09:11:14 -0400 Subject: [PATCH 082/184] implement timeout in xdsh -K --- perl-xCAT/xCAT/DSHCLI.pm | 2 +- perl-xCAT/xCAT/RemoteShellExp.pm | 6 +----- perl-xCAT/xCAT/TableUtils.pm | 3 ++- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index ecd6de7c8..ecdb2b4c3 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -4185,7 +4185,7 @@ sub parse_and_run_dsh # # setup ssh keys on the nodes or ib switch # - my $rc = xCAT::TableUtils->setupSSH($options{'nodes'}); + my $rc = xCAT::TableUtils->setupSSH($options{'nodes'},$options{'timeout'}); my @results = "return code = $rc"; return (@results); } diff --git a/perl-xCAT/xCAT/RemoteShellExp.pm b/perl-xCAT/xCAT/RemoteShellExp.pm index 505cbeee6..4d9b3d34d 100755 --- a/perl-xCAT/xCAT/RemoteShellExp.pm +++ b/perl-xCAT/xCAT/RemoteShellExp.pm @@ -48,7 +48,7 @@ package xCAT::RemoteShellExp; exit 2 - usage error Examples: -$rc=xCAT::RemoteShellExp->remoteshellexp("k",$callback,$remoteshellcmd,$timeout); +$rc=xCAT::RemoteShellExp->remoteshellexp("k",$callback,$remoteshellcmd,$nodes,$timeout); $rc=xCAT::RemoteShellExp->remoteshellexp("s",$callback,$remoteshellcmd,$nodes,$timeout); $rc=xCAT::RemoteShellExp->remoteshellexp("t",$callback,$remoteshellcmd,$nodes,$timeout); @@ -96,10 +96,6 @@ sub remoteshellexp $expecttimeout=$timeout; } - my $rsp = {}; - $rsp->{data}->[0] = - "Timeout is $expecttimeout."; - xCAT::MsgUtils->message("D", $rsp, $::CALLBACK); # for -s flag must have nodes and a $to_userid password my $to_user_password; if ($ENV{'DSH_REMOTE_PASSWORD'}) { diff --git a/perl-xCAT/xCAT/TableUtils.pm b/perl-xCAT/xCAT/TableUtils.pm index 228c1c244..9e3b452ad 100644 --- a/perl-xCAT/xCAT/TableUtils.pm +++ b/perl-xCAT/xCAT/TableUtils.pm @@ -350,8 +350,9 @@ sub setupSSH } # generates new keys for root, if they do not already exist + # nodes not used on this option but in there to preserve the interface my $rc= - xCAT::RemoteShellExp->remoteshellexp("k",$::CALLBACK,$::REMOTE_SHELL,$expecttimeout); + xCAT::RemoteShellExp->remoteshellexp("k",$::CALLBACK,$::REMOTE_SHELL,$n_str,$expecttimeout); if ($rc != 0) { $rsp->{data}->[0] = "remoteshellexp failed generating keys."; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); From 5a09a9b34abfe726de6ddc51552d79c61179cd62 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 29 Aug 2013 13:45:24 -0400 Subject: [PATCH 083/184] add timeout support to updatenode to pass into xdsh --- perl-xCAT/xCAT/Usage.pm | 7 ++++-- xCAT-client/bin/updatenode | 3 ++- xCAT-server/lib/xcat/plugins/updatenode.pm | 29 +++++++++++++++++++--- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 242104d2e..62ce7f9fe 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -345,9 +345,9 @@ my %usage = ( "Usage: updatenode [-h|--help|-v|--version | -g|--genmypost] or - updatenode [-V|--verbose] [-k|--security] [-s|--sn] + updatenode [-V|--verbose] [-k|--security] [-s|--sn] [-t ] or - updatenode [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw] + updatenode [-V|--verbose] [-F|--sync | -f|--snsync] [-l|--user[username]] [--fanout=[fanout value]] [-S|--sw] [-t ] [-P|--scripts [script1,script2,...]] [-s|--sn] [-A|--updateallsw] [-c|--cmdlineonly] [-d alt_source_dir] [attr=val [attr=val...]] @@ -384,6 +384,9 @@ Options: [-s|--sn] Set the server information stored on the nodes. + [-t|--timeout] Time out in seconds to allow the command to run. Default is no timeout, + except for updatenode -k which has a 10 second default timeout. + [-A|--updateallsw] Install or update all software contained in the source directory. (AIX only) diff --git a/xCAT-client/bin/updatenode b/xCAT-client/bin/updatenode index 35e7efd99..c2c2e2a73 100755 --- a/xCAT-client/bin/updatenode +++ b/xCAT-client/bin/updatenode @@ -88,7 +88,7 @@ if ( 'v|version' => \$::VERSION, 'V|verbose' => \$::VERBOSE, 'F|sync' => \$::FILESYNC, - 'g|genmypost' => \$::GENMYPOST, + 'g|genmypost' => \$::GENMYPOST, 'f|snsync' => \$::SNFILESYNC, 'l|user:s' => \$::USER, 'S|sw' => \$::SWMAINTENANCE, @@ -97,6 +97,7 @@ if ( 'k|security' => \$::SECURITY, 'o|os:s' => \$::OS, 'fanout=i' => \$::fanout, + 't|timetout=i' => \$::timeout, ) ) { &updatenode_usage(); diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index a8e03b1ad..6e427786e 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -227,6 +227,7 @@ sub preprocess_updatenode 'k|security' => \$::SECURITY, 'o|os:s' => \$::OS, 'fanout=i' => \$::fanout, + 't|timetout=i' => \$::timeout, ) ) @@ -832,13 +833,18 @@ sub security_update_sshkeys # call the xdsh -K to set up the ssh keys my @envs = @{$request->{environment}}; - my @args = ("-K"); + my $args; + push @$args,"-K"; + if (defined($::timeout)) { # timeout + push @$args,"-t" ; + push @$args,$::timeout; + } my $res = xCAT::Utils->runxcmd( { command => ['xdsh'], node => \@$nodes, - arg => \@args, + arg => $args, env => \@envs, }, $subreq, 0, 1 @@ -849,7 +855,7 @@ sub security_update_sshkeys my $rsp = {}; # not display password in verbose mode. $rsp->{data}->[0] = - " $localhostname: Internal call command: xdsh -K. nodes = @$nodes, arguments = @args, env = xxxxxx"; + " $localhostname: Internal call command: xdsh @$nodes " . join(' ', @$args); $rsp->{data}->[1] = " $localhostname: return messages of last command: @$res"; $callback->($rsp); @@ -1006,6 +1012,7 @@ sub updatenode 'k|security' => \$::SECURITY, 'o|os:s' => \$::OS, 'fanout=i' => \$::fanout, + 't|timetout=i' => \$::timeout, ) ) { @@ -1318,6 +1325,10 @@ sub updatenoderunps push @$args1,"-f" ; push @$args1,$::fanout; } + if (defined($::timeout)) { # timeout + push @$args1,"-t" ; + push @$args1,$::timeout; + } if (defined($::USER)) { # -l contains sudo user push @$args1,"--sudo" ; push @$args1,"-l" ; @@ -1450,6 +1461,10 @@ sub updatenodesyncfiles push @$args,"-f" ; push @$args,$::fanout; } + if (defined($::timeout)) { # timeout + push @$args,"-t" ; + push @$args,$::timeout; + } if (defined($::USER)) { # -l must sudo push @$args,"--sudo" ; push @$args,"-l" ; @@ -1646,6 +1661,10 @@ sub updatenodesoftware push @$args1,"-f" ; push @$args1,$::fanout; } + if (defined($::timeout)) { # timeout + push @$args1,"-t" ; + push @$args1,$::timeout; + } if (defined($::USER)) { # -l contains sudo user push @$args1,"--sudo" ; push @$args1,"-l" ; @@ -2622,6 +2641,10 @@ sub updateAIXsoftware push @$args1,"-f" ; push @$args1,$::fanout; } + if (defined($::timeout)) { # timeout + push @$args1,"-t" ; + push @$args1,$::timeout; + } push @$args1,"$installcmd"; $subreq->( From 3c86356e3bb63356169749624dcb0c74ef286492 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 29 Aug 2013 13:52:46 -0400 Subject: [PATCH 084/184] add timeout support to updatenode to pass into xdsh --- xCAT-client/pods/man1/updatenode.1.pod | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/xCAT-client/pods/man1/updatenode.1.pod b/xCAT-client/pods/man1/updatenode.1.pod index d8a2d1d1d..a181e76d3 100644 --- a/xCAT-client/pods/man1/updatenode.1.pod +++ b/xCAT-client/pods/man1/updatenode.1.pod @@ -4,11 +4,11 @@ B - Update nodes in an xCAT cluster environment. =head1 SYNOPSIS -B B [B<-V>|B<--verbose>] [B<-F>|B<--sync>] [B<-f>|B<--snsync>] [B<-S>|B<--sw>] [B<-l> I] [B<-P>|B<--scripts> [B]] [B<-s>|B<--sn>] [B<-A>|B<--updateallsw>] [B<-c>|B<--cmdlineonly>] [B<-d alt_source_dir>] [B<--fanout>] [B [B]] +B B [B<-V>|B<--verbose>] [B<-F>|B<--sync>] [B<-f>|B<--snsync>] [B<-S>|B<--sw>] [B<-l> I] [B<-P>|B<--scripts> [B]] [B<-s>|B<--sn>] [B<-A>|B<--updateallsw>] [B<-c>|B<--cmdlineonly>] [B<-d alt_source_dir>] [B<--fanout>] [B<-t timeout>} [B [B]] -B B [B<-k>|B<--security>] +B B [B<-k>|B<--security>] [B<-t timeout>] -B B [B<-V>|B<--verbose>] [B] +B B [B<-V>|B<--verbose>] [B<-t timeout>] [B] B B [B<-V>|B<--verbose>] [B<-f>|B<--snsync>] @@ -363,6 +363,11 @@ Specifies that node software should be updated. Set the server information stored on the nodes. +=item B<-t timeout> + +Specifies a timeout in seconds the command will wait for the remote targets to complete. If timeout is not specified +it will wait indefinitely. The exception is the updatenode -k option whose default timeout is 10 seconds. + =item B<-v|--version> Command Version. From 70c9b7c583dc7eee25025e9254cc8e976b175279 Mon Sep 17 00:00:00 2001 From: ligc Date: Fri, 30 Aug 2013 09:09:43 +0800 Subject: [PATCH 085/184] add rhelhpc6.4 support --- perl-xCAT/xCAT/data/discinfo.pm | 1 + .../xcat/install/rh/compute.rhelhpc6.tmpl | 148 ++++++++++++++++++ .../xcat/netboot/rh/compute.rhelhpc6.pkglist | 22 +++ 3 files changed, 171 insertions(+) mode change 100644 => 100755 perl-xCAT/xCAT/data/discinfo.pm create mode 100644 xCAT-server/share/xcat/install/rh/compute.rhelhpc6.tmpl create mode 100644 xCAT-server/share/xcat/netboot/rh/compute.rhelhpc6.pkglist diff --git a/perl-xCAT/xCAT/data/discinfo.pm b/perl-xCAT/xCAT/data/discinfo.pm old mode 100644 new mode 100755 index fce9eb6de..7e3f0b378 --- a/perl-xCAT/xCAT/data/discinfo.pm +++ b/perl-xCAT/xCAT/data/discinfo.pm @@ -64,6 +64,7 @@ require Exporter; "1305067719.718814" => "rhelhpc6.1",#x86_64 "1321545261.599847" => "rhelhpc6.2",#x86_64 "1339640148.070971" => "rhelhpc6.3",#x86_64 + "1359576195.413831" => "rhelhpc6.4",#x86_64, RHEL ComputeNode "1194015916.783841" => "fedora8", "1194015385.299901" => "fedora8", "1210112435.291709" => "fedora9", diff --git a/xCAT-server/share/xcat/install/rh/compute.rhelhpc6.tmpl b/xCAT-server/share/xcat/install/rh/compute.rhelhpc6.tmpl new file mode 100644 index 000000000..5e550a79c --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/compute.rhelhpc6.tmpl @@ -0,0 +1,148 @@ +# +#cmdline + +lang en_US + +# +# 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# +url --url http://#TABLE:noderes:$NODE:nfsserver#/install/#TABLE:nodetype:$NODE:os#/#TABLE:nodetype:$NODE:arch# + +#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# +%pre +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh# +%post +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rh# diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhelhpc6.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhelhpc6.pkglist new file mode 100644 index 000000000..e235bfaba --- /dev/null +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhelhpc6.pkglist @@ -0,0 +1,22 @@ +bash +dracut-network +nfs-utils +openssl +dhclient +kernel +openssh-server +openssh-clients +busybox +dash +iputils +bc +irqbalance +procps +wget +vim-minimal +ntp +rpm +rsync +rsyslog +e2fsprogs +parted From 6483bbc18ee6b6831934205b7a1b947568a73f55 Mon Sep 17 00:00:00 2001 From: Bruce Potter Date: Sat, 31 Aug 2013 10:35:25 -0400 Subject: [PATCH 086/184] specify --checksum for createrepo so the repo will work on rhel5 --- buildcore.sh | 4 ++-- builddep.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/buildcore.sh b/buildcore.sh index e337d4e60..f6fee37ae 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -350,8 +350,8 @@ if [ "$OSNAME" != "AIX" ]; then echo "Signing RPMs..." build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)' build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)' - createrepo $DESTDIR - createrepo $SRCDIR + createrepo --checksum sha $DESTDIR # specifying checksum so the repo will work on rhel5 + createrepo --checksum sha $SRCDIR rm -f $SRCDIR/repodata/repomd.xml.asc rm -f $DESTDIR/repodata/repomd.xml.asc gpg -a --detach-sign $DESTDIR/repodata/repomd.xml diff --git a/builddep.sh b/builddep.sh index 46e6dfab5..c649aceb3 100755 --- a/builddep.sh +++ b/builddep.sh @@ -103,9 +103,9 @@ if [ "$OSNAME" != "AIX" ]; then echo "Creating repodata directories..." for i in `find -mindepth 2 -maxdepth 2 -type d `; do if [ -n "$VERBOSEMODE" ]; then - createrepo $i + createrepo --checksum sha $i # specifying checksum so the repo will work on rhel5 else - createrepo $i >/dev/null + createrepo --checksum sha $i >/dev/null fi rm -f $i/repodata/repomd.xml.asc gpg -a --detach-sign $i/repodata/repomd.xml From 552063ef57b95030aa119169a7e367ddd522d4b3 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 4 Sep 2013 02:46:23 -0700 Subject: [PATCH 087/184] for bug 3762 --- xCAT/postscripts/confignics | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index 55aa2e749..01038847e 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -92,6 +92,37 @@ elif [ `echo $str_temp | grep -E "e(n|th)[0-9]+"` ];then fi +bool_exit_flag=0 +#check the required attributes +if [ -z "$NICIPS" ];then + if [ -n "$NICTYPES" ];then + logger -t xcat -p local4.info "confignics: nicips attribute is not defined. so the nictypes attribute can not be defined." + echo "confignics on $NODE: nicips attribute is not defined. so the nictypes attribute can not be defined." + bool_exit_flag=1 + fi + + if [ -n "$NICNETWORKS" ];then + logger -t xcat -p local4.info "confignics: nicips attribute is not defined. so the nicnetworks attribute can not be defined." + echo "confignics on $NODE: nicips attribute is not defined. so the nicnetworks attribute can not be defined." + bool_exit_flag=1 + fi +else + if [ -z "$NICTYPES" ];then + logger -t xcat -p local4.info "confignics: nictypes attribute is not defined." + echo "confignics on $NODE: nictypes attribute is not defined." + bool_exit_flag=1 + fi + + if [ -z "$NICNETWORKS" ];then + logger -t xcat -p local4.info "confignics: nicnetworks attribute is not defined." + echo "confignics on $NODE: nicnetworks attribute is not defined." + bool_exit_flag=1 + fi +fi + +if [ $bool_exit_flag -eq 1 ];then + exit 0 +fi splitconfig $NICIPS splitconfig $NICTYPES @@ -169,6 +200,11 @@ do echo "confignics on $NODE: processing custom scripts: ${array_temp[3]} for interface $key" ${array_temp[3]} else + if [ -n "${array_temp[2]}" ];then + logger -t xcat -p local4.info "confignics: ip address,nic type and network are required. $key: $str_value ." + echo "confignics on $NODE: ip address,nic type and network are required. $key: $str_value ." + continue + fi if [ "${array_temp[1]}" ];then str_nic_type=`echo ${array_temp[1]} | tr "[A-Z]" "[a-z]"` else From e1603a0242ef4dd1621f27263e3d93bafc8aed4a Mon Sep 17 00:00:00 2001 From: sjing Date: Wed, 4 Sep 2013 05:46:22 -0400 Subject: [PATCH 088/184] add an error message if mn's hostname can not be resolved. --- xCAT-server/lib/xcat/plugins/ddns.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index a6f68145c..92620dfe8 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -617,9 +617,11 @@ sub process_request { $ctx->{resolver} = Net::DNS::Resolver->new(nameservers=>['127.0.0.1']); } - add_or_delete_records($ctx); + my $ret = add_or_delete_records($ctx); + unless($ret) { + xCAT::SvrUtils::sendmsg("DNS setup is completed", $callback); + } - xCAT::SvrUtils::sendmsg("DNS setup is completed", $callback); umask($oldmask); } @@ -1073,8 +1075,11 @@ sub add_or_delete_records { } my $zone; foreach $zone (keys %{$ctx->{updatesbyzone}}) { - my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone}); - + my $ip = xCAT::NetworkUtils->getipaddr($ctx->{nsmap}->{$zone}); + if( !defined $ip) { + xCAT::SvrUtils::sendmsg([1,"Please make sure $ctx->{nsmap}->{$zone} exist in /etc/hosts or DNS."], $callback); + return 1; + } my $resolver = Net::DNS::Resolver->new(nameservers=>[$ip]); my $entry; my $numreqs = 300; # limit to 300 updates in a payload, something broke at 644 on a certain sample, choosing 300 for now From 53209a79d1aa476601cdfeb0b02f1548c9b2849c Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 5 Sep 2013 09:56:42 +0800 Subject: [PATCH 089/184] add the storage.rhels6.pkglist --- .../xcat/install/rh/storage.rhels6.pkglist | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 xCAT-server/share/xcat/install/rh/storage.rhels6.pkglist diff --git a/xCAT-server/share/xcat/install/rh/storage.rhels6.pkglist b/xCAT-server/share/xcat/install/rh/storage.rhels6.pkglist new file mode 100644 index 000000000..53e36645e --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/storage.rhels6.pkglist @@ -0,0 +1,38 @@ +#Please make sure there is a space between @ and group name +autofs +ksh +tcsh +ntp +tftp +xinetd +rsh +rsh-server +psacct +nfs-utils +net-snmp +rsync +yp-tools +ypserv +ypbind +m4 +sendmail-cf +gdb +binutils +openssh-server +util-linux +compat-libstdc++-33 +-kernel-xen +-kmod-cmirror-xen +-xen-devel +-kmod-gnbd-xen +-xen +-libvirt-devel +-libvirt-cim +-gnome-applet-vm +-kmod-gfs-xen +-xen-libs +-libvirt +-virt-viewer +-libvirt-python +-python-virtinst +-virt-manager From 115aef46f3c277702a9cd6b4315ee764d700f5a7 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 4 Sep 2013 20:56:05 -0700 Subject: [PATCH 090/184] bug 3768,3769,3770 --- xCAT/postscripts/configeth | 76 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 4 deletions(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index 22d633c5d..ab82f6b20 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -15,7 +15,7 @@ function v4mask2prefix(){ case $num_dec in 255) let num_bits+=8;; 254) let num_bits+=7;; - 253) let num_bits+=6;; + 252) let num_bits+=6;; 248) let num_bits+=5;; 240) let num_bits+=4;; 224) let num_bits+=3;; @@ -28,6 +28,72 @@ function v4mask2prefix(){ echo "$num_bits" } +function v4prefix2mask(){ + local a=$1 + local b=0 + local num_index=1 + local str_temp='' + local str_mask='' + + while [[ $num_index -le 4 ]] + do + if [ $a -ge 8 ];then + b=8 + a=$((a-8)) + else + b=$a + a=0 + fi + case $b in + 0) str_temp="0";; + 1) str_temp="128";; + 2) str_temp="192";; + 3) str_temp="224";; + 4) str_temp="240";; + 5) str_temp="248";; + 6) str_temp="252";; + 7) str_temp="254";; + 8) str_temp="255";; + esac + + str_mask=$str_mask$str_temp"." + + num_index=$((num_index+1)) + done + + str_mask=`echo $str_mask | sed 's/.$//'` + echo "$str_mask" +} + +function v4calcbcase(){ + local str_mask=$2 + echo $str_mask | grep '\.' + if [ $? -ne 0 ];then + str_mask=$(v4prefix2mask $str_mask) + fi + local str_bcast='' + local str_temp='' + local str_ifs=$IFS + IFS=$'.' + local array_ip=($1) + local array_mask=($str_mask) + IFS=$str_ifs + + if [ ${#array_ip[*]} -ne 4 -o ${#array_mask[*]} -ne 4 ];then + echo "255.255.255.255" + return + fi + + for index in {0..3} + do + str_temp=`echo $[ ${array_ip[$index]}|(${array_mask[$index]} ^ 255) ]` + str_bcast=$str_bcast$str_temp"." + done + + str_bcast=`echo $str_bcast | sed 's/.$//'` + echo "$str_bcast" +} + function configipv4(){ str_if_name=$1 str_v4ip=$2 @@ -230,8 +296,9 @@ function add_ip_temporary(){ str_label=$str_nic_name fi + str_bcase=$(calcbcase $str_ip $str_mask) #the label is ready, add the ip address directly - ip addr add $str_ip/${str_mask} dev $str_nic_name scope global label $str_label + ip addr add $str_ip/${str_mask} broadcast $str_bcase dev $str_nic_name scope global label $str_label fi fi } @@ -392,7 +459,7 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do #fetch the subnet and netmask in networks definition str_subnet=`echo $str_line | awk -F'net=' '{print $2}' | awk -F'|' '{print $1}'` - str_netmask=`echo $str_line | awk -F'mask=' '{print $2}' | awk -F'|' '{print $1}'` + str_netmask=`echo $str_line | awk -F'mask=' '{print $2}' | awk -F'|' '{print $1}' | sed 's:^/::'` str_gateway=`echo $str_line | awk -F'gateway=' '{print $2}' | awk -F'|' '{print $1}'` if [ ! $str_subnet -o ! $str_netmask ];then @@ -405,7 +472,8 @@ while [ $num_index -lt ${#array_nic_ips[*]} ];do array_nic_subnet[$num_index]=$str_subnet array_nic_netmask[$num_index]=$str_netmask array_nic_gateway[$num_index]=$str_gateway - if [ -n "$str_gateway" ];then + echo "$str_gateway" | grep ':' + if [ $? -eq 0 ];then str_ipv6_gateway=$str_gateway fi logger -t xcat -p local4.err "configeth: $str_ip, $str_subnet, $str_netmask, $str_gateway" From f0c6bcdbad9cf214d551116a4e99accc506ff63c Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 4 Sep 2013 23:27:28 -0700 Subject: [PATCH 091/184] Supporting full-partition and physical-partition with DFM --- perl-xCAT/xCAT/FSPUtils.pm | 10 +- perl-xCAT/xCAT/FSPvm.pm | 480 +++++++++++++++++++++++++++- perl-xCAT/xCAT/Schema.pm | 9 + perl-xCAT/xCAT/Usage.pm | 10 +- xCAT-server/lib/perl/xCAT/PPC.pm | 1 + xCAT-server/lib/xcat/plugins/fsp.pm | 1 + 6 files changed, 490 insertions(+), 21 deletions(-) diff --git a/perl-xCAT/xCAT/FSPUtils.pm b/perl-xCAT/xCAT/FSPUtils.pm index 01630196e..eb1dda4b6 100644 --- a/perl-xCAT/xCAT/FSPUtils.pm +++ b/perl-xCAT/xCAT/FSPUtils.pm @@ -368,11 +368,19 @@ sub fsp_api_action { } elsif( $parameter !=0 && $action =~ /^(on|reset)$/ ) { #powerinterval for lpars power on $cmd = "$fsp_api -a $action -i $parameter -T $tooltype -t $type:$fsp_ip:$id:$node_name:"; + } elsif ($action =~ /^part_set_lpar_def_state$/) { + $cmd = "$fsp_api -a $action -T $tooltype -s $parameter -t $type:$fsp_ip:$id:$node_name:"; + } elsif (exists($request->{opt}->{vios})) { + $cmd = "$fsp_api -a $action -T $tooltype -s 1 -t $type:$fsp_ip:$id:$node_name:$parameter"; } else { $cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:$parameter"; } } else { - $cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:"; + if (exists($request->{opt}->{vios})) { + $cmd = "$fsp_api -a $action -T $tooltype -s 1 -t $type:$fsp_ip:$id:$node_name:"; + } else { + $cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:"; + } } } xCAT::MsgUtils->verbose_message($request, "fsp_api_action cmd:$cmd."); diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index 29f2ed0d0..73265f5dc 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -361,7 +361,7 @@ sub mkvm_parse_args { # if ( !GetOptions( \%opt, qw(V|verbose ibautocfg ibacap=s i=s l=s c=s p=s full) )) { # return( usage() ); # } - if ( !GetOptions( \%opt, qw(V|verbose i=s m=s r=s ) )) { + if ( !GetOptions( \%opt, qw(V|verbose i=s m=s r=s full part vios) )) { return( usage() ); } #################################### @@ -408,13 +408,14 @@ sub mkvm_parse_args { } else { return(usage( "Invalid entry: $opt{m}.\n For Power 775, the pending memory interleaving mode only could be interleaved(or 1), or non-interleaved(or 2)." )); } - } else { + } elsif (!exists($opt{full}) && !exists($opt{part}) && !exists($opt{vios})){ $opt{m} = 2 ;# non-interleaved, which is the default } - my @ratio = (1, 2, 3, 4, 5); - my %octant_cfg = (); if ( exists( $opt{r} ) ) { + my @ratio = (1, 2, 3, 4, 5); + my %octant_cfg = (); + my @elems = split(/\,/,$opt{r}); my $range=""; while (my $elem = shift @elems) { @@ -461,12 +462,12 @@ sub mkvm_parse_args { } } # end of "if .. else.." } # end of while + $opt{octant_cfg}{octant_cfg_value} = (\%octant_cfg); + $opt{octant_cfg}{memory_interleave} = $opt{m}; } #end of if - $opt{octant_cfg}{octant_cfg_value} = (\%octant_cfg); - $opt{octant_cfg}{memory_interleave} = $opt{m}; - - if ( !exists( $opt{i} ) || !exists( $opt{r} ) ) { + + if ( (!exists( $opt{i} ) || !exists( $opt{r} )) && !exists($opt{full}) && !exists($opt{part}) && !exists($opt{vios})) { return(usage()); } @@ -483,6 +484,10 @@ sub mkvm_parse_args { if ( !$p) { return(usage("Not found the parent of $node")); } + if (exists($opt{full}) and defined($other_p) and $other_p eq $p){ + return(usage("Only one full partition can be created in one CEC")); + } + if(! defined( $other_p)) { $other_p = $p; } @@ -490,9 +495,10 @@ sub mkvm_parse_args { return(usage("For Power 775, please make sure the noderange are in one CEC ")); } } - $request->{node} = [$other_p]; - $request->{noderange} = $other_p; - + if (!exists($opt{full}) && !exists($opt{part}) &&!exists($opt{vios})) { + $request->{node} = [$other_p]; + $request->{noderange} = $other_p; + } #################################### # No operands - add command name #################################### @@ -535,10 +541,14 @@ sub rmvm_parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose service r) )) { + if ( !GetOptions( \%opt, qw(V|verbose service r p|part) )) { return( usage() ); } - return(usage( "rmvm doesn't support for Power 775." )); + + if (!exists($opt{p})) { + return(usage( "rmvm doesn't support for Power 775." )); + } + #################################### # Check for "-" with no option #################################### @@ -592,7 +602,7 @@ sub lsvm_parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose l|long) )) { + if ( !GetOptions( \%opt, qw(V|verbose l|long p|part) )) { return( usage() ); } #################################### @@ -1423,7 +1433,425 @@ sub xCATdB { } return undef; } +######################## +#***** partition related +######################## +#my @partition_query_actions = qw(part_get_partition_cap part_get_num_of_lpar_slots part_get_hyp_config_process_and_mem part_get_hyp_avail_process_and_mem part_get_service_authority_lpar_id part_get_shared_processing_resource part_get_all_vio_info lpar_lhea_mac part_get_all_io_bus_info part_get_lpar_processing part_get_lpar_memory get_huge_page get_cec_bsr); +my @partition_query_actions = qw(part_get_partition_cap part_get_hyp_process_and_mem part_get_all_io_bus_info get_huge_page get_cec_bsr); + +sub parse_part_get_info { + my $hash = shift; + my $data = shift; + my @array = split /\n/, $data; + foreach my $line (@array) { + chomp($line); + if ($line =~ /Num of lpar slots: (\d+)/i) { + $hash->{num_of_lpars} = $1; + } elsif ($line =~ /HYP Configurable Memory[^\(]*\((\d+)\s*regions\)/i) { + $hash->{hyp_config_mem} = $1; + } elsif ($line =~ /HYP Available Memory[^\(]*\((\d+)\s*regions\)/i) { + $hash->{hyp_avail_mem} = $1; + } elsif ($line =~ /HYP Memory Region Size[^\(]*\((\d+)\s*MB\)/i) { + $hash->{mem_region_size} = $1; + } elsif ($line =~ /HYP Configurable Processors: (\d+),\s*Avail Processors: (\d+)/i) { + $hash->{process_units_config} = $1; + $hash->{process_units_avail} = $2; + } elsif ($line =~ /Authority Lpar id:(\w+)/i) { + $hash->{service_lparid} = $1; + } elsif ($line =~ /(\d+),(\d+),[^,]*,(\w+),[^,]*,[^,]*,\w*\(([\w| |-|_]*)\)/) { + $hash->{bus}->{$3}->{cur_lparid} = $1; + $hash->{bus}->{$3}->{bus_slot} = $2; + $hash->{bus}->{$3}->{des} = $4; + } elsif ($line =~ /Phy drc_index:(\w+), Port group: (\w+), Phy port id: (\w+)/) { + $hash->{phy_drc_group_port}->{$1}->{$2}->{$3} = '1'; + } elsif ($line =~ /adapter_id=(\w+),lpar_id=([\d|-]+).*port_group=(\d+),phys_port_id=(\d+).*drc_index=(\w+),.*/) { + if (($2 == -1) && ($4 == 255)) { + $hash->{logic_drc_phydrc}->{$3}->{$5} = $1; + #$hash->{logic_drc_phydrc}->{$5}->{$1} = [$2,$3,$4]; + } + #} elsif ($line =~ /lpar 0:: Curr Memory::min: 1,cur: (\d+),max:/i) { + } elsif ($line =~ /Curr Memory Req[^\(]*\((\d+)\s*regions\)/i) { + $hash->{lpar0_used_mem} = $1; + #print "===>lpar0_used_mem:$hash->{lpar0_used_mem}.\n"; + } elsif ($line =~ /Available huge page memory\(in pages\):\s*(\d+)/) { + $hash->{huge_page_avail} = $1; + } elsif ($line =~ /Available BSR array:\s*(\d+)/) { + $hash->{cec_bsr_avail} = $1; + } + } +} + +sub query_cec_info_actions { + my $request = shift; + my $name = shift; + my $td = shift; + my $usage = shift; + my $action_array = shift; + my $lparid = @$td[0]; + my $data; + my @array = (); + my %hash = (); + if (!defined($action_array) or ref($action_array) ne "ARRAY") { + $action_array = \@partition_query_actions; + } + + foreach my $action (@$action_array) { + #$data .= "======> ret info for $action:\n"; + my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $td, $action); + chomp(@$values[1]); + if (@$values[1] =~ /^$/) { + next; + } + if ($usage eq 0) { + if ($lparid) { + if ($action eq "lpar_lhea_mac") { + my @output = split /\n/,@$values[1]; + foreach my $line (@output) { + if ($line =~ /adapter_id=\w+,lpar_id=$lparid,type=hea/) { + #$data .= "$line\n"; + push @array, [$name, $line, 0]; + } + } + #$data .= "\n"; + next; + } + if ($action eq "part_get_all_io_bus_info") { + my @output = split /\n/, @$values[1]; + foreach my $line (@output) { + if ($line =~ /$lparid,/) { + #$data .= "$line\n"; + push @array, [$name, $line, 0]; + } + } + #$data .= "\n"; + next; + } + } + #$data .= "@$values[1]\n\n"; + push @array, [$name, @$values[1], @$values[2]]; + } else { + &parse_part_get_info(\%hash, @$values[1]); + } + } + if ($usage eq 0) { + #return $data; + return \@array; + } else { + return \%hash; + } +} + +#my @partition_query_actions = qw(part_get_partition_cap part_get_num_of_lpar_slots part_get_hyp_config_process_and_mem part_get_hyp_avail_process_and_mem part_get_service_authority_lpar_id part_get_shared_processing_resource part_get_all_vio_info lpar_lhea_mac part_get_all_io_bus_info part_get_lpar_processing part_get_lpar_memory get_huge_page get_cec_bsr); +sub query_cec_info { + my $request = shift; + my $hash = shift; + my $args = $request->{opt}; + my @td = (); + my @result = (); + while (my ($mtms,$h) = each(%$hash) ) { + while (my ($name, $d) = each (%$h)) { + @td = @$d; + if (@$d[0] == 0 && @$d[4] ne "lpar") { + last; + } + #my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_vio_info","lpar_lhea_mac","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]); + my $rethash = query_cec_info_actions($request, $name, $d, 0, ["part_get_lpar_processing","part_get_lpar_memory","part_get_all_io_bus_info","get_huge_page","get_cec_bsr"]); + #push @result, [$name, $rethash, 0]; + push @result, @$rethash; + } + if (@td[0] == 0) { + my $rethash = query_cec_info_actions($request, @td[3],\@td, 0); + #push @result, [@td[3], $rethash, 0]; + push @result, @$rethash; + } + } + return \@result; +} + +######################## +#***** partition related +######################## + +my @partition_config_actions = qw/part_set_lpar_def_state part_set_lpar_pending_proc part_set_lpar_pending_mem part_set_pending_max_vslots part_set_lpar_shared_pool_util_auth part_set_lpar_group_id part_set_lpar_avail_priority part_set_partition_placement part_set_lhea_assign_info part_set_phea_port_info part_set_lhea_port_info part_set_veth_slot_config part_set_vscsi_slot_config part_set_vfchan_slot_config part_clear_vslot_config set_huge_page set_lpar_name/; + +sub set_lpar_undefined { + my $request = shift; + my $name = shift; + my $attr = shift; + my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $attr, "part_set_lpar_def_state", 0, 0x0); + if (!@$values[2]) { + return ([$name,"Done",0]); + } + return $values; +} + +sub clear_service_authority_lpar { + my $request = shift; + my $name = shift; + my $attr = shift; + my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $attr, "part_get_service_authority_lpar_id"); + my @array = split /\n/, @$values[1]; + my $service_lparid = undef; + foreach my $line (@array) { + if ($line =~ /Authority Lpar id:([-|\d]+)./i) { + $service_lparid = $1; + } + } + if (defined($service_lparid) and $service_lparid == @$attr[0]) { + xCAT::FSPUtils::fsp_api_action($request, $name, $attr, "part_set_service_authority_lpar_id"); + } +} + +sub remove { + my $request = shift; + my $hash = shift; + my @result = (); + while (my ($mtms, $h) = each (%$hash)) { + while (my ($name, $d) = each (%$h)) { + &clear_service_authority_lpar($request, $name, $d); + my $values = &set_lpar_undefined($request, $name, $d); + push @result, $values; + } + } + return \@result; +} + +sub deal_with_avail_mem { + my $request = shift; + my $name = shift; + my $d = shift; + my $lparhash = shift; + my ($before,$after,$res); + my @td = @$d; + @td[0] = 0; + my $values = xCAT::FSPUtils::fsp_api_action($request, $name, \@td, "part_get_lpar_memory"); + my %tmphash; + &parse_part_get_info(\%tmphash, @$values[1]); + if (exists($tmphash{lpar0_used_mem})) { + $before = $tmphash{lpar0_used_mem}; + } else { + return ([$name, "part_get_lpar_memory failed to get used memory for hypervisor.", 1]); + } + my $tmp_param = "1/1/".$lparhash->{hyp_config_mem}; + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_mem", 0, $tmp_param); + if (@$values[2]) { + return $values; + } + $values = xCAT::FSPUtils::fsp_api_action($request, $name, \@td, "part_get_lpar_memory"); + &parse_part_get_info(\%tmphash, @$values[1]); + if (exists($tmphash{lpar0_used_mem})) { + $after = $tmphash{lpar0_used_mem}; + $res = $after - $before; + if ($res < 0) { + return([$name, "Parse reserverd regions failed, before $before, after $after.", 1]); + } elsif ($lparhash->{hyp_avail_mem} - $res < 0) { + return([$name, "Parse reserverd regions failed, no enough memory, availe:$lparhash->{hyp_avail_mem}.", -1]); + } + my $mem = $lparhash->{memory}; + $mem =~ /(\d+)\/(\d+)\/(\d+)/; + if ($2 > $lparhash->{hyp_avail_mem} - $res) { + my $new_avail_mem = $lparhash->{hyp_avail_mem} - $res; + $lparhash->{memory} = "$1/$new_avail_mem/$3"; + } + return 0; + } else { + return ([$name, "part_get_lpar_memory failed to get used memory for hypervisor.", 1]); + } +} + +sub create_lpar { + my $request = shift; + my $name = shift; + my $d = shift; + my $lparhash = shift; + my $values; + if (exists($request->{opt}->{vios})) { + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x03); + } else { + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x01); + } + if (@$values[2] ne 0) { + return ([[$name, @$values[1], @$values[0]]]); + } + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_lpar_name", 0, $name); + if (@$values[2] ne 0) { + $values = &set_lpar_undefined($request, $name, $d); + return ([$name, @$values[1], @$values[0]]); + } + xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_shared_pool_util_auth"); + xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_group_id"); + xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_avail_priority"); + $values = &deal_with_avail_mem($request, $name, $d,$lparhash); + if (ref($values) eq "ARRAY") { + return ([@$values]); + } + #print "======>physlots:$lparhash->{physlots}.\n"; + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner_uber", 0, $lparhash->{physlots}); + #$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner", 0, join(",",@phy_io_array)); + if (@$values[2] ne 0) { + $values = &set_lpar_undefined($request, $name, $d); + return ([$name, @$values[1], @$values[2]]); + } + if (exists($lparhash->{phy_hea})) { + my $phy_hash = $lparhash->{phy_hea}; + foreach my $phy_drc (keys %$phy_hash) { + #print "======> set_lhea_assign_info: drc_index:$phy_drc.\n"; + xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lhea_assign_info", 0, $phy_drc); + my $group_hash = $phy_hash->{$phy_drc}; + foreach my $group_id (keys %$group_hash) { + my @lhea_drc = (keys %{$lparhash->{logic_drc_phydrc}->{$group_id}}); + foreach my $phy_port_id (keys %{$group_hash->{$group_id}}) { + my $tmp_param = "$phy_drc,$group_id,$phy_port_id"; + #print "======> set_phea_port_info: $tmp_param.\n"; + xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_phea_port_info", 0, $tmp_param); + my $tmp_lhea_param = $lhea_drc[$phy_port_id].",$phy_port_id"; + #print "======> set_lhea_port_info: $tmp_lhea_param.\n"; + xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lhea_port_info", 0, $tmp_lhea_param); + } + delete ($lparhash->{logic_drc_phydrc}->{$group_id}->{$lhea_drc[0]}); + delete ($lparhash->{logic_drc_phydrc}->{$group_id}->{$lhea_drc[1]}); + } + } + } + + #print "======>cpus:$lparhash->{cpus}.\n"; + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_proc", 0, $lparhash->{cpus}); + if (@$values[2] ne 0) { + $values = &set_lpar_undefined($request, $name, $d); + return ([$name, @$values[1], @$values[2]]); + } + #print "======>memory:$lparhash->{memory}.\n"; + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_mem", 0, $lparhash->{memory}); + if (@$values[2] ne 0) { + $values = &set_lpar_undefined($request, $name, $d); + return ([$name, @$values[1], @$values[2]]); + } + xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_comp_modes"); + #print "======>memory:$lparhash->{huge_page}.\n"; + xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_huge_page", 0, $lparhash->{huge_page}); + #print "======>bsr:$lparhash->{bsr_num}.\n"; + xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_lpar_bsr", 0, $lparhash->{bsr_num}); + xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_partition_placement"); + if (exists($request->{opt}->{vios})) { + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x04); + } else { + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_def_state", 0, 0x02); + } + if (@$values[2] ne 0) { + return ([$name, @$values[1], @$values[2]]); + } + return ([$name, "Done", 0]); +} + +sub mkspeclpar { + my $request = shift; + my $hash = shift; + my $values; + my @result = (); + my $vmtab = xCAT::Table->new( 'vm'); + unless($vmtab) { + return([["Error","Cannot open vm table", 1]]); + } + while (my ($mtms, $h) = each (%$hash)) { + my $memhash; + my @nodes = keys(%$h); + my $ent = $vmtab->getNodesAttribs(\@nodes, ['cpus', 'memory','physlots', 'othersettings']); + while (my ($name, $d) = each (%$h)) { + if (!exists($memhash->{run})) { + my @td = @$d; + @td[0] = 0; + $memhash = &query_cec_info_actions($request, $name, \@td, 1, ["part_get_hyp_process_and_mem","lpar_lhea_mac"]); + $memhash->{run} = 1; + } + my $tmp_ent = $ent->{$name}->[0]; + if (!defined($tmp_ent) ) { + return ([[$name, "Not find params", 1]]); + } elsif (!exists($tmp_ent->{cpus}) || !exists($tmp_ent->{memory}) || !exists($tmp_ent->{physlots})) { + return ([[$name, "The attribute 'vmcpus', 'vmmemory' and 'vmphyslots' are all needed to be specified.", 1]]); + } + if ($tmp_ent->{memory} =~ /(\d+)(G|M)\/(\d+)(G|M)\/(\d+)(G|M)/i) { + my $memsize = $memhash->{mem_region_size}; + my $min = $1; + if ($2 == "G") { + $min = $min * 1024; + } + $min = $min/$memsize; + my $cur = $3; + if ($4 == "G") { + $cur = $cur * 1024; + } + $cur = $cur/$memsize; + my $max = $5; + if ($6 == "G") { + $max = $max * 1024; + } + $max = $max/$memsize; + $tmp_ent->{memory} = "$min/$cur/$max"; + } + $tmp_ent->{hyp_config_mem} = $memhash->{hyp_config_mem}; + $tmp_ent->{hyp_avail_mem} = $memhash->{hyp_avail_mem}; + $tmp_ent->{huge_page} = "0/0/0"; + $tmp_ent->{bsr_num} = "0"; + if (exists($tmp_ent->{othersettings})) { + my $setting = $tmp_ent->{othersettings}; + if ($setting =~ /hugepage:(\d+)/) { + my $tmp = $1; + $tmp_ent->{huge_page} = "1/".$tmp."/".$tmp; + } + if ($setting =~ /bsr:(\d+)/) { + $tmp_ent->{bsr_num} = $1; + } + } + $tmp_ent->{phy_hea} = $memhash->{phy_drc_group_port}; + $tmp_ent->{logic_drc_phydrc} = $memhash->{logic_drc_phydrc}; + $values = &create_lpar($request, $name, $d, $tmp_ent); + push @result, $values; + $name = undef; + $d = undef; + } + } + return \@result; +} + +sub mkfulllpar { + my $request = shift; + my $hash = shift; + my $values; + my @result = (); + while (my ($mtms, $h) = each (%$hash)) { + my $rethash; + while (my ($name, $d) = each (%$h)) { + if (!exists($rethash->{run})) { + my @td = @$d; + @td[0] = 0; + $rethash = query_cec_info_actions($request, $name, \@td, 1); + if (ref($rethash) ne 'HASH') { + return ([[$mtms, "Cann't get hypervisor info hash", 1]]); + } + $rethash->{run} = 1; + #print Dumper($rethash); + } + my %lpar_param = (); + $lpar_param{cpus} = "1/".$rethash->{process_units_avail}."/".$rethash->{process_units_config}; + $lpar_param{memory} = "1/".$rethash->{hyp_avail_mem}."/".$rethash->{hyp_config_mem}; + $lpar_param{hyp_config_mem} = $rethash->{hyp_config_mem}; + $lpar_param{hyp_avail_mem} = $rethash->{hyp_avail_mem}; + my @phy_io_array = keys(%{$rethash->{bus}}); + $lpar_param{physlots} = join(",", @phy_io_array); + $lpar_param{huge_page} = "1/".$rethash->{huge_page_avail}."/".$rethash->{huge_page_avail}; + $lpar_param{bsr_num} = $rethash->{cec_bsr_avail}; + $lpar_param{phy_hea} = $rethash->{phy_drc_group_port}; + $lpar_param{logic_drc_phydrc} = $rethash->{logic_drc_phydrc}; + $values = &create_lpar($request, $name, $d, \%lpar_param); + $rethash->{logic_drc_phydrc} = $lpar_param{logic_drc_phydrc}; + push @result, $values; + $name = undef; + $d = undef; + } + } + return \@result; +} ########################################################################## # Creates logical partitions @@ -1437,6 +1865,10 @@ sub mkvm { # create a full system partition for each CECs managed by the HMC. if ( exists($opt->{full})) { return( mkfulllpar(@_) ); + } elsif (exists($opt->{part})){ + return (mkspeclpar(@_)); + } elsif (exists($opt->{vios})) { + return (mkspeclpar(@_)); } else { # if no, it will execute the original function. @@ -1455,15 +1887,29 @@ sub chvm { ########################################################################## # No rmvm for Power 775 ########################################################################## -#sub rmvm { +sub rmvm { + my $request = $_[0]; + my $opt = $request->{opt}; + if (exists($opt->{p})) { + return( remove(@_) ); + } else { + return ([["lpar","rmvm only support Power Partitioning.", 1]]); + } # return( remove(@_) ); -#} +} ########################################################################## # Lists logical partition profile ########################################################################## sub lsvm { - return( list(@_) ); + my $request = shift; + my $hash = shift; + my $args = $request->{opt}; + if (exists($args->{p})) { + return (query_cec_info($request, $hash)); + } else { + return( list($request, $hash) ); + } } 1; diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 5c7f82422..2048fa3ce 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -228,6 +228,7 @@ vm => { 'datacenter' => "Optionally specify a datacenter for the VM to exist in (only applicable to VMWare)", 'cluster' => 'Specify to the underlying virtualization infrastructure a cluster membership for the hypervisor.', 'vidproto' => "Request a specific protocol for remote video access be set up. For example, spice in KVM.", + 'physlots' => "Specify the physical slots drc index that will assigned to the partition, the delimiter is ',', and the drc index must started with '0x'.", 'vidmodel' => "Model of video adapter to provide to guest. For example, qxl in KVM", 'vidpassword' => "Password to use instead of temporary random tokens for VNC and SPICE access", 'storagecache' => "Select caching scheme to employ. E.g. KVM understands 'none', 'writethrough' and 'writeback'", @@ -2235,6 +2236,14 @@ my @nodeattrs = ( tabentry => 'vm.storage', access_tabentry => 'vm.node=attr:node', }, + {attr_name => 'vmphyslots', + tabentry => 'vm.physlots', + access_tabentry => 'vm.node=attr:node', + }, + {attr_name => 'vmothersetting', + tabentry => 'vm.othersettings', + access_tabentry => 'vm.node=attr:node', + }, {attr_name => 'vmstoragemodel', tabentry => 'vm.storagemodel', access_tabentry => 'vm.node=attr:node', diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 62ce7f9fe..2c63c3726 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -199,10 +199,12 @@ my %usage = ( "Usage: Common: mkvm [-h|--help|-v|--version] - For PPC(with HMC): + For PPC(with HMC) specific: mkvm noderange -i id -l singlenode [-V|--verbose] mkvm noderange -c destcec -p profile [-V|--verbose] mkvm noderange --full [-V|--verbose] + PPC (using Direct FSP Management) specific: + mkvm noderange <--full|--part> For KVM mkvm noderange -m|--master mastername -s|--size disksize -f|--force For zVM @@ -216,7 +218,7 @@ my %usage = ( PPC (with HMC) specific: lsvm [-a|--all] PPC (using Direct FSP Management) specific: - lsvm [-l|--long] + lsvm [-l|--long] [-p|--part] zVM specific: lsvm noderange lsvm noderange --getnetworknames @@ -264,7 +266,9 @@ my %usage = ( "rmvm" => "Usage: rmvm [--service][-V|--verbose] rmvm [-h|--help|-v|--version], - rmvm [-p] [-f]", + rmvm [-p] [-f] + PPC (using Direct FSP Management) specific: + rmvm [-p|--part]", "lsslp" => "Usage: lsslp [-h|--help|-v|--version] lsslp [][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM|IMM2|FSP] diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index 2285601e7..e692f286a 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -57,6 +57,7 @@ my %modules = ( cec => "xCAT::FSPvm", }, rmvm => { hmc => "xCAT::PPCvm", + hmc => "xCAT::FSPvm", }, lsvm => { hmc => "xCAT::PPCvm", fsp => "xCAT::FSPvm", diff --git a/xCAT-server/lib/xcat/plugins/fsp.pm b/xCAT-server/lib/xcat/plugins/fsp.pm index 7a1f3950f..6d29d8c77 100644 --- a/xCAT-server/lib/xcat/plugins/fsp.pm +++ b/xCAT-server/lib/xcat/plugins/fsp.pm @@ -28,6 +28,7 @@ sub handled_commands { mkvm => 'nodehm:mgt', lsvm => 'nodehm:mgt', chvm => 'nodehm:mgt', + rmvm => 'nodehm:mgt', rscan => 'nodehm:mgt', getfspcon => 'nodehm:cons', getmulcon => 'fsp', From 890555235e45baab7516d9a7c779a19b64b9b0d3 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Thu, 5 Sep 2013 01:07:45 -0700 Subject: [PATCH 092/184] Modify manpage for mkvm, lsvm, rmvm. And checking if parition is disabled. --- perl-xCAT/xCAT/FSPvm.pm | 5 ++- xCAT-client/pods/man1/lsvm.1.pod | 59 +++++++++++++++++++++++++++++++- xCAT-client/pods/man1/mkvm.1.pod | 57 +++++++++++++++++++++++++++--- xCAT-client/pods/man1/rmvm.1.pod | 15 ++++++++ 4 files changed, 130 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index 73265f5dc..321b7e1f7 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -1499,7 +1499,10 @@ sub query_cec_info_actions { foreach my $action (@$action_array) { #$data .= "======> ret info for $action:\n"; my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $td, $action); - chomp(@$values[1]); + chomp(@$values[1]); + if ($action eq "part_get_partition_cap" and (@$values[1] =~ /Error:/i or @$values[2] ne 0)) { + return ([[@$values]]); + } if (@$values[1] =~ /^$/) { next; } diff --git a/xCAT-client/pods/man1/lsvm.1.pod b/xCAT-client/pods/man1/lsvm.1.pod index 8b10080a8..24cb47d81 100644 --- a/xCAT-client/pods/man1/lsvm.1.pod +++ b/xCAT-client/pods/man1/lsvm.1.pod @@ -16,6 +16,8 @@ B [B<-a>| B<--all>] I B [B<-l>| B<--long>] I +B [B<-p>| B<--part>] I + =head2 For zVM: B I @@ -73,6 +75,9 @@ B<-l> Show lparnames for lpars. +B<-p|--part> + +Show detailed information for lpars, such as processor, memory, physical IO slot, hugepage, BSR, etc. =head1 RETURN VALUE @@ -190,7 +195,6 @@ Output is similar to: Page Size(in GB): 16 Maximum huge page memory(in pages): 24 Requested huge page memory(in pages): 15 -======= Number of BSR arrays: 256,Bytes per BSR array: 4096,Available BSR array: 0; Available huge page memory(in pages): 0 Configurable huge page memory(in pages): 12 @@ -208,6 +212,59 @@ Output is similar to: gpok3: INCLUDE LNXDFLT gpok3: COMMAND SET VSWITCH VSW2 GRANT LNX3 +6. For normal power machine, list out the detailed resource information: + + lsvm cec -p + +Output is similar to: + + cec: HYP Configurable Processors: 16, Avail Processors: 16. + HYP Configurable Memory:32.00 GB(128 regions). + HYP Available Memory: 31.25 GB(125 regions). + HYP Memory Region Size: 0.25 GB(256 MB). + cec: All Physical I/O info: + 65535,519,U78AA.001.WZSGVU7-P1-C7,0x21010207,0,0,0xffff(Empty Slot) + 65535,518,U78AA.001.WZSGVU7-P1-C6,0x21010206,0,0,0xffff(Empty Slot) + 65535,517,U78AA.001.WZSGVU7-P1-C5,0x21010205,0,0,0xffff(Empty Slot) + 65535,516,U78AA.001.WZSGVU7-P1-C4,0x21010204,0,0,0xffff(Empty Slot) + 65535,514,U78AA.001.WZSGVU7-P1-C19,0x21010202,0,0,0xffff(Empty Slot) + 65535,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0,0,0xc03(USB Controller) + 65535,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0,0,0x104(RAID Controller) + cec: Huge Page Memory + Available huge page memory(in pages): 2 + Configurable huge page memory(in pages): 2 + Page Size(in GB): 16 + Maximum huge page memory(in pages): 4 + Requested huge page memory(in pages): 2 + cec: Barrier Synchronization Register(BSR) + Number of BSR arrays: 256 + Bytes per BSR array: 4096 + Available BSR array: 256 + +For partition on normal power machine, list out the detailed information: + + lsvm lpar1 -p + +Output is similar to: + + lpar1: Lpar Processor Info: + Curr Processor Min: 1. + Curr Processor Req: 16. + Curr Processor Max: 16. + lpar1: Lpar Memory Info: + Curr Memory Min: 0.25 GB(1 regions). + Curr Memory Req: 30.75 GB(123 regions). + Curr Memory Max: 32.00 GB(128 regions). + lpar1: 1,519,U78AA.001.WZSGVU7-P1-C7,0x21010207,0,0,0xffff(Empty Slot) + lpar1: 1,518,U78AA.001.WZSGVU7-P1-C6,0x21010206,0,0,0xffff(Empty Slot) + lpar1: 1,517,U78AA.001.WZSGVU7-P1-C5,0x21010205,0,0,0xffff(Empty Slot) + lpar1: 1,516,U78AA.001.WZSGVU7-P1-C4,0x21010204,0,0,0xffff(Empty Slot) + lpar1: 1,514,U78AA.001.WZSGVU7-P1-C19,0x21010202,0,0,0xffff(Empty Slot) + lpar1: 1,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0,0,0xc03(USB Controller) + lpar1: 1,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0,0,0x104(RAID Controller) + lpar1: 1/2/2 + lpar1: 256. + =head1 FILES /opt/xcat/bin/lsvm diff --git a/xCAT-client/pods/man1/mkvm.1.pod b/xCAT-client/pods/man1/mkvm.1.pod index 4b1d971cd..3cfe44cd0 100644 --- a/xCAT-client/pods/man1/mkvm.1.pod +++ b/xCAT-client/pods/man1/mkvm.1.pod @@ -10,7 +10,7 @@ B [B<-h>| B<--help>] B [B<-v>| B<--version>] -=head2 For PPC (with HMC): +=head2 For PPC (with HMC) specific: B [B<-V>| B<--verbose>] I B<-i> I B<-l> I @@ -18,6 +18,11 @@ B [B<-V>| B<--verbose>] I B<-c> I B<-p> I B [B<-V>| B<--verbose>] I B<--full> + +=head2 For PPC (using Direct FSP Management) specific: + +B [I B<--full> B<--part>] + =head2 For KVM: B I [B<-m|--master> I] [B<-s|--size> I] [B<--mem> I] [B<--cpus> I] [B<-f|--force>] @@ -34,9 +39,7 @@ B I [I] [B I] =head1 DESCRIPTION -=head2 For PPC: - -For PPC (with HMC) specific: +=head2 For PPC (with HMC) specific: The first form of mkvm command creates new partition(s) with the same profile/resources as the partition specified by I. The -i and I specify the starting numeric partition number and the I for the newly created partitions, respectively. The LHEA port numbers and the HCA index numbers will be automatically increased if they are defined in the source partition. @@ -46,6 +49,12 @@ Please make sure the nodes in the I is defined in the I tab Please note that the mkvm command currently only supports creating standard LPARs, not virtual LPARs working with VIOS server. +=head2 For PPC (using Direct FSP Management) specific: + +With option I, a partition using all the resources on a normal power machine will be created. + +With option I, a partition using the parameters specified with attributes such as 'vmcpus', 'vmmory', 'vmphyslots', 'vmothersetting' will be created. + =head2 For KVM and Vmware: The mkvm command creates new virtual machine(s) with the I size of hard disk, I size of memory and I number of cpu. @@ -78,6 +87,10 @@ The cpu count which will be created for the kvm/vmware virtual machine. Request to create a new full system partition for each CEC. +=item B<--part> + +Request to create a partition with the specified parameters. + =item B<-f|--force> If B<-f|--force> is specified, the storage will be destroyed first if it existed. @@ -221,6 +234,42 @@ Output is similar to: mkvm vm1 -s 10G --mem 2048 --cpus 2 +8. To create a full partition on normal power machine. + +First, define a node object: + + mkdef -t node -o lpar1 mgt=fsp cons=fsp nodetype=ppc,osi id=1 hcp=cec parent=cec hwtype=lpar groups=lpar,all + +Then, create the partion on the specified cec. + + mkvm lpar1 --full + +The output is similar to: + + lpar1: Done + +To query the resources allocated to node 'lpar1', please reference L. + +Note: The 'parent' attribute for node 'lpar1' is the object name of physical power machine that the full partition will be created on. + +9. To create a partition using some of the resources on normal power machine. + +After a node object is defined, the resources that will be used for the partition shall be specified like this: + + chdef lpar1 vmcpus=1/4/16 vmmemory=1G/4G/32G vmphyslots=0x21010201,0x21010200 vmothersetting=bsr:128,hugepage:2 + +Then, create the partion on the specified cec. + + mkvm lpar1 --part + +The outout is similar to: + + lpar1: Done + +To query the resources allocated to node 'lpar1', please reference L. + +Note: The 'vmplyslots' specify the drc index of the physical slot device. Every drc index shall be delimited with ','. The 'vmothersetting' specify two kinds of resource, bsr(Barrier Synchronization Register) specified the num of BSR arrays, hugepage(Huge Page Memory) specified the num of pages. + =head1 FILES /opt/xcat/bin/mkvm diff --git a/xCAT-client/pods/man1/rmvm.1.pod b/xCAT-client/pods/man1/rmvm.1.pod index 4b4ede25e..400306db0 100644 --- a/xCAT-client/pods/man1/rmvm.1.pod +++ b/xCAT-client/pods/man1/rmvm.1.pod @@ -15,6 +15,10 @@ I I +=head2 PPC (using Direct FSP Management) specific: + +I I<-p|--part> + =head1 DESCRIPTION The rmvm command removes the partitions specified in noderange. If noderange is an CEC, all the partitions associated with that CEC will be removed. Note that removed partitions are automatically removed from the xCAT database. For IVM-managed systems, care must be taken to not remove the VIOS partition, or all the associated partitions will be removed as well. @@ -34,6 +38,8 @@ B<--service> Remove the service partitions of the specified CECs. B<-p> Purge the existence of the VM from persistant storage. This will erase all storage related to the VM in addition to removing it from the active virtualization configuration. +B<-p|--part> Remove the specified partiton on normal power machine. + B<-f> Force remove the VM, even if the VM appears to be online. This will bring down a live VM if requested. =head1 RETURN VALUE @@ -87,6 +93,15 @@ Output is similar to: gpok4: Deleting virtual server LNX4... Done + +6. To remove a partition on normal power machine. + +I + +Output is similar to: + + lpar1: Done + =head1 FILES /opt/xcat/bin/rmvm From 91d27eb358c84cfec74f3029e9f67150e262fa3d Mon Sep 17 00:00:00 2001 From: nott Date: Thu, 5 Sep 2013 10:56:49 -0400 Subject: [PATCH 093/184] #3752 - change tmp work dir location --- xCAT-buildkit/bin/buildkit | 40 +++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index afc2c2969..228f223e6 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -3080,11 +3080,15 @@ sub kit_addpkgs my $kitbfname = basename($kittarfile); $kitbfname =~ s/.tar.bz2$//; $kitbfname =~ s/.NEED_PRODUCT_PKGS$//; - my $tmpdir_base = "/tmp/buildkit_workdir/$kitbfname"; + + +# ndebug + # my $tmpdir_base = "/tmp/buildkit_workdir/$kitbfname"; + my $tmpdir_base = "/tmp/$kitbfname"; # Cleanup - should have been removed when last command ran # - but just in case - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); # the tar file may not be in the current dir $kittarfile = "$::workdir/$kittarfile"; @@ -3109,7 +3113,7 @@ sub kit_addpkgs if ( system("cd $tmpdir_base; tar -jxf $kittarfile ") ) { print "Error extracting tarfile $kittarfile \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } my $tmp_kit_conf = `find $tmpdir_base -name kit.conf`; @@ -3121,7 +3125,7 @@ sub kit_addpkgs unless ( open( $CKF, "<", $tmp_kit_conf ) ) { print "The Kit configuration file $tmp_kit_conf could not be read or was not included in the kit tar file. \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } my @lines = <$CKF>; @@ -3231,7 +3235,7 @@ sub kit_addpkgs if ( system("ls $fromfile > /dev/null") ){ print "The product package file $ext_filename could not be read from the package directory $rpmdir. \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } foreach my $repo (split(/,/, $ext_reponames)) { @@ -3239,13 +3243,13 @@ sub kit_addpkgs if ( ! -d ($repodir) && (! mkpath($repodir)) ) { print "Error creating repository directory $repodir\n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } if (system("cp -fp $fromfile $repodir")) { print "Error copying package file $fromfile to $repodir \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } $create_repodata_list{$repodir}=1; @@ -3277,7 +3281,7 @@ sub kit_addpkgs if (!-d "$tdir" or !-d "$source_dir") { print "Error open kitcomponent rpm build direcotry $tdir or $tdir/$non_native_kitcompname \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } @@ -3287,13 +3291,13 @@ sub kit_addpkgs my $fromfile = $rpmdir."/".$tepmfilename; if ( system("ls $fromfile > /dev/null") ){ print "The product package file $non_native_filename could not be read from the package directory $rpmdir. \n"; - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } if (system("cp -fp $fromfile $tdir/$non_native_kitcompname")) { print "Error copying package file $fromfile to $tdir/$non_native_kitcompname \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } } @@ -3318,7 +3322,7 @@ sub kit_addpkgs if (!-r "$spec") { print "Error open kitcomponent rpm build spec $tdir/$non_native_kitcompname.spec \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } my $rpmbuild_dir = $tmpdir."/rpmbuild"; @@ -3401,7 +3405,7 @@ sub kit_addpkgs if (system( $createrepocmd )) { print "Error running $createrepocmd. \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } } @@ -3411,13 +3415,13 @@ sub kit_addpkgs if ( system("cd $tmpdir; cd ..; tar -cjhf $new_tarfile $kitname/*") ) { print "Error building tarfile $new_tarfile \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } print "Kit tar file $new_tarfile successfully built \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 0; } @@ -3486,7 +3490,7 @@ sub NEW_kit_addpkgs if ( system("ls $fromfile > /dev/null") ){ print "The product package file $ext_filename could not be read from the package directory $rpmdir. \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } foreach my $repo (split(/,/, $ext_reponames)) { @@ -3494,13 +3498,13 @@ sub NEW_kit_addpkgs if ( ! -d ($repodir) && (! mkpath($repodir)) ) { print "Error creating repository directory $repodir\n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } if (system("cp -fp $fromfile $repodir")) { print "Error copying package file $fromfile to $repodir \n"; # Cleanup - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); return 1; } } @@ -3580,7 +3584,7 @@ sub NEW_kit_addpkgs my $buildtar_rc = &kit_buildtar; # clean out the tmp dir - system ("rm -Rf /tmp/buildkit_workdir"); + system ("rm -Rf $tmpdir_base"); if ($buildtar_rc) { print "Error building full kit tarfile \n"; From 7ad12aba7019c935a2945124779bd8c72af08427 Mon Sep 17 00:00:00 2001 From: nott Date: Thu, 5 Sep 2013 12:32:38 -0400 Subject: [PATCH 094/184] #3674 - add error return code --- xCAT-buildkit/bin/buildkit | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 228f223e6..aa18dcd9b 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -892,6 +892,7 @@ sub kit_cleanrepo } if ( !$got_one ) { print "Kit repository $repoid does not exist.\n"; + return 1; } } if ( -d "$::workdir/rpmbuild" ) { From 0fe302f9e893d80d0f66a30ebd1c219c2ea4acb2 Mon Sep 17 00:00:00 2001 From: nott Date: Thu, 5 Sep 2013 12:53:35 -0400 Subject: [PATCH 095/184] #3655 - add two new subroutines for comparing rpm versions --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 155 +++++++++++++++++++ 1 file changed, 155 insertions(+) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index b1e06c45d..81efa587a 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -51,6 +51,161 @@ This program module file, is a set of utilities used by xCAT buildkit command #------------------------------------------------------------- +#-------------------------------------------------------------------------- +=head3 get_latest_version + + Find the latest version in a list of rpms with the same basename + + Arguments: + - the repo location + - a list of rpms with the same basename + Returns: + - name of rpm + - undef + Example: + my $new_d = xCAT::BuildKitUtils->get_latest_version($repodir, \@rpmlist); + Comments: + +=cut +#-------------------------------------------------------------------------- +sub get_latest_version +{ + my ($class, $repodir, $rpms) = @_; + + my @rpmlist = @$rpms; + + my %localversions_hash = (); + my %file_name_hash = (); + + my $i = 0; + foreach my $rpm (@rpmlist) + { + + # include path + my $fullrpmpath = "$repodir/$rpm*"; + + # get the basename, version, and release for this rpm + my $rcmd = "rpm -qp --queryformat '%{N} %{V} %{R}\n' $repodir/$rpm*"; + my $out = `$rcmd`; + + my ($rpkg, $VERSION, $RELEASE) = split(' ', $out); + + chomp $VERSION; + chomp $RELEASE; + + $localversions_hash{$i}{'VERSION'} = $VERSION; + $localversions_hash{$i}{'RELEASE'} = $RELEASE; + + $file_name_hash{$VERSION}{$RELEASE} = $rpm; + $i++; + } + + if ($i == 0) + { + print "error\n"; + return undef; + } + + my $versionout = ""; + my $releaseout = ""; + $i = 0; + foreach my $k (keys %localversions_hash) + { + if ($i == 0) + { + $versionout = $localversions_hash{$k}{'VERSION'}; + $releaseout = $localversions_hash{$k}{'RELEASE'}; + } + + # if this is a newer version/release then set them + if ( xCAT::BuildKitUtils->testVersion($localversions_hash{$k}{'VERSION'}, ">", $versionout, $localversions_hash{$k}{'RELEASE'}, $releaseout) ) { + $versionout = $localversions_hash{$k}{'VERSION'}; + $releaseout = $localversions_hash{$k}{'RELEASE'}; + } + $i++; + } + + return ($file_name_hash{$versionout}{$releaseout}); +} + +#------------------------------------------------------------------------------ + + +=head3 testVersion + + Compare version1 and version2 according to the operator and + return True or False. + + Arguments: + $version1 + $operator + $version2 + $release1 + $release2 + Returns: + True or False + Example: + + Comments: + The return value is generated with the Require query of the + rpm command. + +=cut + +#----------------------------------------------------------------------------- +sub testVersion +{ + my ($class, $version1, $operator, $version2, $release1, $release2) = @_; + + my @a1 = split(/\./, $version1); + my @a2 = split(/\./, $version2); + my $len = (scalar(@a1) > scalar(@a2) ? scalar(@a1) : scalar(@a2)); + $#a1 = $len - 1; # make the arrays the same length before appending release + $#a2 = $len - 1; + push @a1, split(/\./, $release1); + push @a2, split(/\./, $release2); + $len = (scalar(@a1) > scalar(@a2) ? scalar(@a1) : scalar(@a2)); + my $num1 = ''; + my $num2 = ''; + + for (my $i = 0 ; $i < $len ; $i++) + { + # remove any non-numbers on the end + my ($d1) = $a1[$i] =~ /^(\d*)/; + my ($d2) = $a2[$i] =~ /^(\d*)/; + + my $diff = length($d1) - length($d2); + if ($diff > 0) # pad d2 + { + $num1 .= $d1; + $num2 .= ('0' x $diff) . $d2; + } + elsif ($diff < 0) # pad d1 + { + $num1 .= ('0' x abs($diff)) . $d1; + $num2 .= $d2; + } + else # they are the same length + { + $num1 .= $d1; + $num2 .= $d2; + } + } + + # Remove the leading 0s or perl will interpret the numbers as octal + $num1 =~ s/^0+//; + $num2 =~ s/^0+//; + + # be sure that $num1 is not a "". + if (length($num1) == 0) { $num1 = 0; } + if (length($num2) == 0) { $num2 = 0; } + + if ($operator eq '=') { $operator = '=='; } + my $bool = eval "$num1 $operator $num2"; + + return $bool; +} + #------------------------------------------------------------------------------- From a96f96e2d43bb1e589d1ab3b14709cf520de4b22 Mon Sep 17 00:00:00 2001 From: nott Date: Thu, 5 Sep 2013 13:11:06 -0400 Subject: [PATCH 096/184] #3655 - oops - remove dup subroutine --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 89 -------------------- 1 file changed, 89 deletions(-) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index 81efa587a..5bd55dd4e 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -267,95 +267,6 @@ sub get_OS_VRMF return (length($version) ? $version : undef); } -#---------------------------------------------------------------------------- - -=head3 testversion - - Compare version1 and version2 according to the operator and - return True or False. - - Arguments: - $version1 - $operator - $version2 - $release1 - $release2 - Returns: - True or False - - Example: - if (BuildKitUtils->testversion ( $ins_ver, - "<", - $req_ver, - $ins_rel, - $req_rel)){ blah; } - - Comments: - -=cut - -#------------------------------------------------------------------------------- -sub testversion -{ - my ($class, $version1, $operator, $version2, $release1, $release2) = @_; - - my @a1 = split(/\./, $version1); - my @a2 = split(/\./, $version2); - my $len = (scalar(@a1) > scalar(@a2) ? scalar(@a1) : scalar(@a2)); - $#a1 = $len - 1; # make the arrays the same length before appending release - $#a2 = $len - 1; - push @a1, split(/\./, $release1); - push @a2, split(/\./, $release2); - $len = (scalar(@a1) > scalar(@a2) ? scalar(@a1) : scalar(@a2)); - my $num1 = ''; - my $num2 = ''; - - for (my $i = 0 ; $i < $len ; $i++) - { - my ($d1) = $a1[$i] =~ /^(\d*)/; # remove any non-numbers on the end - my ($d2) = $a2[$i] =~ /^(\d*)/; - - my $diff = length($d1) - length($d2); - if ($diff > 0) # pad d2 - { - $num1 .= $d1; - $num2 .= ('0' x $diff) . $d2; - } - elsif ($diff < 0) # pad d1 - { - $num1 .= ('0' x abs($diff)) . $d1; - $num2 .= $d2; - } - else # they are the same length - { - $num1 .= $d1; - $num2 .= $d2; - } - } - - # Remove the leading 0s or perl will interpret the numbers as octal - $num1 =~ s/^0+//; - $num2 =~ s/^0+//; - - #SLES Changes ?? - # if $num1="", the "eval '$num1 $operator $num2'" will fail. - # So MUST BE be sure that $num1 is not a "". - if (length($num1) == 0) { $num1 = 0; } - if (length($num2) == 0) { $num2 = 0; } - #End of SLES Changes - - if ($operator eq '=') { $operator = '=='; } - my $bool = eval "$num1 $operator $num2"; - - if (length($@)) - { - # error msg ? - } - - return $bool; -} - - #------------------------------------------------------------------------------- =head3 isLinux From 464c4b0d3cbcb37187c36566096dd048b3b4cec7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 6 Sep 2013 11:15:39 -0400 Subject: [PATCH 097/184] Provide rpower reseat for NeXTScale --- xCAT-server/lib/xcat/plugins/ipmi.pm | 59 +++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 641fb7ae0..377c049b7 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1209,6 +1209,59 @@ sub ripmi_callback { xCAT::SvrUtils::sendmsg($output,$callback,$sessdata->{node},%allerrornodes); } +sub reseat_node { + my $sessdata = shift; + if (1) { # TODO: FPC path checked for + my $mptab = xCAT::Table->new('mp', -create=>0); + unless ($mptab) { + xCAT::SvrUtils::sendmsg([1,"mp table must be configured for reseat"],$callback,$sessdata->{node},%allerrornodes); + return; + } + my $mpent = $mptab->getNodeAttribs($sessdata->{node},[qw/mpa id/]); + unless ($mpent and $mpent->{mpa} and $mpent->{id}) { + xCAT::SvrUtils::sendmsg([1,"mp table must be configured for reseat"],$callback,$sessdata->{node},%allerrornodes); + return; + } + my $fpc = $mpent->{mpa}; + my $ipmitab = xCAT::Table->new("ipmi"); + my $ipmihash = $ipmitab->getNodesAttribs([$fpc],['bmc','username','password']) ; + my $authdata = xCAT::PasswordUtils::getIPMIAuth(noderange=>[$fpc],ipmihash=>$ipmihash); + my $nodeuser=$authdata->{$fpc}->{username}; + my $nodepass=$authdata->{$fpc}->{password}; + $sessdata->{slotnumber} = $mpent->{id}; + $sessdata->{fpcipmisession} = xCAT::IPMI->new(bmc=>$mpent->{mpa},userid=>$nodeuser,password=>$nodepass); + $sessdata->{fpcipmisession}->login(callback=>\&fpc_node_reseat,callback_args=>$sessdata); + } +} + +sub fpc_node_reseat { + my $status = shift; + my $sessdata = shift; + if ($status =~ /ERROR:/) { + xCAT::SvrUtils::sendmsg([1,$status],$callback,$sessdata->{node},%allerrornodes); + return; + } + $sessdata->{fpcipmisession}->subcmd(netfn=>0x32, command=>0xa4, + data=>[$sessdata->{slotnumber}, 2], + callback=>\&fpc_node_reseat_complete, callback_args=>$sessdata); +} + +sub fpc_node_reseat_complete { + my $rsp = shift; + my $sessdata = shift; + if ($rsp->{error}) { + xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes); + return; + } + if ($rsp->{code} == 0) { + xCAT::SvrUtils::sendmsg("reseat",$callback,$sessdata->{node},%allerrornodes); + } elsif ($rsp->{code} == 0xd5) { + xCAT::SvrUtils::sendmsg([1,"No node in slot"],$callback,$sessdata->{node},%allerrornodes); + } else { + xCAT::SvrUtils::sendmsg([1,"Unknown error code ".$rsp->{code}],$callback,$sessdata->{node},%allerrornodes); + } +} + sub power { my $sessdata = shift; @@ -1219,7 +1272,9 @@ sub power { my $rc = 0; my $text; my $code; - if (not $sessdata->{acpistate} and $sessdata->{mfg_id} == 20301) { #Only implemented for IBM servers + if ($sessdata->{subcommand} eq "reseat") { + reseat_node($sessdata); + } elsif (not $sessdata->{acpistate} and $sessdata->{mfg_id} == 20301) { #Only implemented for IBM servers $sessdata->{ipmisession}->subcmd(netfn=>0x3a,command=>0x1d,data=>[1],callback=>\&power_with_acpi,callback_args=>$sessdata); } else { $sessdata->{ipmisession}->subcmd(netfn=>0,command=>1,data=>[],callback=>\&power_with_context,callback_args=>$sessdata); @@ -5989,7 +6044,7 @@ sub preprocess_request { return 0; } - if ( ($subcmd ne 'stat') && ($subcmd ne 'state') && ($subcmd ne 'status') && ($subcmd ne 'on') && ($subcmd ne 'off') && ($subcmd ne 'softoff') && ($subcmd ne 'nmi')&& ($subcmd ne 'cycle') && ($subcmd ne 'reset') && ($subcmd ne 'boot') && ($subcmd ne 'wake') && ($subcmd ne 'suspend')) { + if ( ($subcmd ne 'reseat') && ($subcmd ne 'stat') && ($subcmd ne 'state') && ($subcmd ne 'status') && ($subcmd ne 'on') && ($subcmd ne 'off') && ($subcmd ne 'softoff') && ($subcmd ne 'nmi')&& ($subcmd ne 'cycle') && ($subcmd ne 'reset') && ($subcmd ne 'boot') && ($subcmd ne 'wake') && ($subcmd ne 'suspend')) { $callback->({data=>["Unsupported command: $command $subcmd", $usage_string]}); $request = {}; return; From 84e9d743147d313544f9e16a775b87f196373e49 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Sun, 8 Sep 2013 23:57:05 -0700 Subject: [PATCH 098/184] bug 3765 --- .../xcat/install/sles/sysclone.sles10.x86_64.otherpkgs.pkglist | 1 + .../xcat/install/sles/sysclone.sles11.x86_64.otherpkgs.pkglist | 1 + 2 files changed, 2 insertions(+) create mode 100644 xCAT-server/share/xcat/install/sles/sysclone.sles10.x86_64.otherpkgs.pkglist create mode 100644 xCAT-server/share/xcat/install/sles/sysclone.sles11.x86_64.otherpkgs.pkglist diff --git a/xCAT-server/share/xcat/install/sles/sysclone.sles10.x86_64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/sles/sysclone.sles10.x86_64.otherpkgs.pkglist new file mode 100644 index 000000000..88fc7c4fc --- /dev/null +++ b/xCAT-server/share/xcat/install/sles/sysclone.sles10.x86_64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/sles10/x86_64/systemimager-client diff --git a/xCAT-server/share/xcat/install/sles/sysclone.sles11.x86_64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/sles/sysclone.sles11.x86_64.otherpkgs.pkglist new file mode 100644 index 000000000..cc6a68fc9 --- /dev/null +++ b/xCAT-server/share/xcat/install/sles/sysclone.sles11.x86_64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/sles11/x86_64/systemimager-client From 5205218f1ae96e1b007d06ca19c3418c5de3a4b6 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Sun, 8 Sep 2013 23:26:25 -0700 Subject: [PATCH 099/184] Add a column 'physlots' for 'vm' table, it is used for partitioning. --- perl-xCAT/xCAT/Schema.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 2048fa3ce..76399856f 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -191,7 +191,7 @@ vmmaster => { } }, vm => { - cols => [qw(node mgr host migrationdest storage storagemodel storagecache storageformat cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter cluster guestostype othersettings vidmodel vidproto vidpassword comments disable)], + cols => [qw(node mgr host migrationdest storage storagemodel storagecache storageformat cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter cluster guestostype othersettings physlots vidmodel vidproto vidpassword comments disable)], keys => [qw(node)], tablespace =>'XCATTBS32K', table_desc => 'Virtualization parameters', From 01c3a1070deae141f71f8c1e881a834ae653c53d Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Tue, 10 Sep 2013 13:52:07 +0800 Subject: [PATCH 100/184] enable snmpv3 monitrong on 2.8 --- xCAT-server/lib/xcat/monitoring/snmpmon.pm | 233 ++++++++++++++++++--- 1 file changed, 206 insertions(+), 27 deletions(-) diff --git a/xCAT-server/lib/xcat/monitoring/snmpmon.pm b/xCAT-server/lib/xcat/monitoring/snmpmon.pm index 98f1f3ec5..9366cbc49 100644 --- a/xCAT-server/lib/xcat/monitoring/snmpmon.pm +++ b/xCAT-server/lib/xcat/monitoring/snmpmon.pm @@ -14,11 +14,20 @@ use xCAT::TableUtils; use xCAT::NodeRange; use xCAT_monitoring::monitorctrl; use Sys::Hostname; +use File::Path qw/mkpath/; #print "xCAT_monitoring::snmpmon loaded\n"; 1; +my $confdir; +if(xCAT::Utils->isAIX()){ + $::snmpconfdir = "/opt/freeware/etc"; +} else { + $::snmpconfdir = "/usr/share/snmp"; +} + + #------------------------------------------------------------------------------- =head1 xCAT_monitoring:snmpmon @@ -63,7 +72,11 @@ sub start { `/bin/kill -9 $pid`; } # start it up again! - system("/usr/sbin/snmptrapd -m ALL"); + if(xCAT::Utils->isAIX()){ + system("/opt/freeware/sbin/snmptrapd -m ALL"); + } else { + system("/usr/sbin/snmptrapd -m ALL"); + } # get the PID of the currently running snmpd if it is running. # if it's running then we just leave. Otherwise, if we don't get A PID, then we @@ -266,7 +279,7 @@ sub config { } return (1, "net-snmp is not installed") } else { - my ($ret, $err)=configSNMP(); + my ($ret, $err)=configSNMP(2, $noderef, $callback); if ($ret != 0) { return ($ret, $err);} } @@ -324,22 +337,25 @@ sub deconfig { my $callback=shift; my $localhostname=hostname(); - if (-f "/usr/share/snmp/snmptrapd.conf.orig"){ + if (-f "$::snmpconfdir/snmptrapd.conf.orig"){ # copy back the old one - `mv -f /usr/share/snmp/snmptrapd.conf.orig /usr/share/snmp/snmptrapd.conf`; + `mv -f $::snmpconfdir/snmptrapd.conf.orig $::snmpconfdir/snmptrapd.conf`; } else { - if (-f "/usr/share/snmp/snmptrapd.conf"){ + if (-f "$::snmpconfdir/snmptrapd.conf"){ # if the file exists, delete all entries that have xcat_traphandler - my $cmd = "grep -v xcat_traphandler /usr/share/snmp/snmptrapd.conf "; - $cmd .= "> /usr/share/snmp/snmptrapd.conf.unconfig "; - `$cmd`; + my $cmd = "grep -v xcat_traphandler $::snmpconfdir/snmptrapd.conf "; + $cmd .= "> $::snmpconfdir/snmptrapd.conf.unconfig "; + `$cmd`; # move it back to the snmptrapd.conf file. - `mv -f /usr/share/snmp/snmptrapd.conf.unconfig /usr/share/snmp/snmptrapd.conf`; + `mv -f $::snmpconfdir/snmptrapd.conf.unconfig $::snmpconfdir/snmptrapd.conf`; } } + deconfigSNMP(2,$noderef,$callback); + + if ($scope) { if ($callback) { my $rsp={}; @@ -359,7 +375,21 @@ sub deconfig { return (0, ""); } - +#-------------------------------------------------------------------------------- +=head3 deconfigSNMP + This function remove xcat_traphanlder from the snmptrapd.conf file, + remove the node configurations from snmptrapd.conf, and + restarts the snmptrapd with the new configuration. + Arguments: + none. + Returns: + (return code, message) +=cut +=cut +#-------------------------------------------------------------------------------- +sub deconfigSNMP { + return (0, ""); +} #-------------------------------------------------------------------------------- =head3 configBMC @@ -838,45 +868,54 @@ sub configSwitch { =cut #-------------------------------------------------------------------------------- sub configSNMP { + my $action=shift; + my $noderef=shift; + my $callback=shift; + + my $ret_val=0; + my $ret_text=""; + print "configSNMP called \n"; my $isSN=xCAT::Utils->isServiceNode(); my $master=xCAT::TableUtils->get_site_Master(); my $cmd; - # now move /usr/share/snmp/snmptrapd.conf to /usr/share/snmp/snmptrapd.conf.orig + + # now move $::snmpconfdir/snmptrapd.conf to $::snmpconfdir/snmptrapd.conf.orig # if it exists. - if (-f "/usr/share/snmp/snmptrapd.conf"){ - + mkpath("$::snmpconfdir"); + if (-f "$::snmpconfdir/snmptrapd.conf"){ + # if the file exists and has references to xcat_traphandler in mn or 'forward' in sn # then there is nothing that needs to be done. if ($isSN) { - `/bin/grep "forward default $master" /usr/share/snmp/snmptrapd.conf > /dev/null`; + `/bin/grep "forward default $master" $::snmpconfdir/snmptrapd.conf > /dev/null`; } else { - `/bin/grep xcat_traphandler /usr/share/snmp/snmptrapd.conf > /dev/null`; + `/bin/grep xcat_traphandler $::snmpconfdir/snmptrapd.conf > /dev/null`; } # if the return code is 1, then there is no xcat_traphandler, or 'forward' # references and we need to put them in. if($? >> 8){ # back up the original file. - `/bin/cp -f /usr/share/snmp/snmptrapd.conf /usr/share/snmp/snmptrapd.conf.orig`; + `/bin/cp -f $::snmpconfdir/snmptrapd.conf $::snmpconfdir/snmptrapd.conf.orig`; # if the file exists and does not have "authCommunity execute,net public" then add it. - open(FILE1, "/usr/share/snmp/snmptrapd.conf.tmp"); + open(FILE1, "<$::snmpconfdir/snmptrapd.conf"); + open(FILE, ">$::snmpconfdir/snmptrapd.conf.tmp"); my $found=0; my $forward_handled=0; while (readline(FILE1)) { - if (/\s*authCommunity.*public/) { - $found=1; + if (/\s*authCommunity.*public/) { + $found=1; if (!/\s*authCommunity\s*.*execute.*public/) { s/authCommunity\s*(.*)\s* public/authCommunity $1,execute public/; #modify it to have 'execute' if found - } + } if (!/\s*authCommunity\s*.*net.*public/) { s/authCommunity\s*(.*)\s* public/authCommunity $1,net public/; #modify it to have 'net' if found - } + } } elsif (/\s*forward\s*default/) { - if (($isSN) && (!/$master/)) { - s/\s*forward/\#forward/; #comment out the old one + if (($isSN) && (!/$master/)) { + s/\s*forward/\#forward/; #comment out the old one if (!$forward_handled) { print FILE "forward default $master\n"; $forward_handled=1; @@ -892,7 +931,7 @@ sub configSNMP { if (!$found) { #add new one if not found print FILE "authCommunity log,execute,net public\n"; } - + # now add the new traphandle commands: if (!$isSN) { print FILE "traphandle default $::XCATROOT/sbin/xcat_traphandler\n"; @@ -900,13 +939,13 @@ sub configSNMP { close(FILE1); close(FILE); - `mv -f /usr/share/snmp/snmptrapd.conf.tmp /usr/share/snmp/snmptrapd.conf`; + `mv -f $::snmpconfdir/snmptrapd.conf.tmp $::snmpconfdir/snmptrapd.conf`; } } else { # The snmptrapd.conf file does not exists # create the file: my $handle = new IO::File; - open($handle, ">/usr/share/snmp/snmptrapd.conf"); + open($handle, ">$::snmpconfdir/snmptrapd.conf"); print $handle "authCommunity log,execute,net public\n"; if ($isSN) { print $handle "forward default $master\n"; #forward the trap from sn to mn @@ -916,6 +955,146 @@ sub configSNMP { close($handle); } + + # Configure SNMPv3 on AIX +# if(xCAT::Utils->isAIX()){ + #the identification of this node + my @hostinfo=xCAT::NetworkUtils->determinehostname(); + my $isSV=xCAT::Utils->isServiceNode(); + my %iphash=(); + foreach(@hostinfo) {$iphash{$_}=1;} + if (!$isSV) { $iphash{'noservicenode'}=1;} + + my $all=0; + my %nodehash=(); + if ((!$noderef) || (@$noderef==0)) {$all=1;} + else { + foreach(@$noderef) { $nodehash{$_}=1;} + } + + my %mpa_hash=(); + my %masterhash=(); + my @node_a=(); + my $table=xCAT::Table->new("mp"); + if ($table) { + my @tmp1=$table->getAllNodeAttribs(['node','mpa']); + if (@tmp1 > 0) { + foreach(@tmp1) { + my $node=$_->{node}; + my $mpa=$_->{mpa}; + if ((!$all) && (!exists($nodehash{$node})) && (!exists($nodehash{$mpa}))) {next;} + + if ($mpa_hash{$mpa}) { next;} #already handled + + $mpa_hash{$mpa}=1; + + my $pHash=xCAT_monitoring::monitorctrl->getNodeMonServerPair([$mpa], 0); + if (ref($pHash) eq 'ARRAY') { + if ($callback) { + my $rsp={}; + if ($ret_val) { + $rsp->{data}->[0]=$pHash->[1]; + } + $callback->($rsp); + } else { + xCAT::MsgUtils->message('S', "[mon]: " . $pHash->[1]); + } + return (0, ""); + } + + my $pairs=$pHash->{$mpa}; + my @a_temp=split(':',$pairs); + my $monserver=$a_temp[0]; + my $master=$a_temp[1]; + + if ($monserver) { + if (!$iphash{$monserver}) { next;} #skip if has sn but not localhost + } else { + if ($isSV) { next; } #skip if does not have sn but localhost is a sn + } + + push(@node_a, $mpa); + + # find the master node and add the node in the hash + if(exists($masterhash{$master})) { + my $ref=$masterhash{$master}; + push(@$ref, $mpa); + } else { $masterhash{$master}=[$mpa]; } + } #foreach + } + $table->close(); + } + + if (@node_a==0){ return ($ret_val, $ret_text);} #nothing to handle + + # Read username, password, and mac from DB. + foreach my $mpa ( @node_a ) { + my $mac; + my $user; + my $password; + + my $mpatable=xCAT::Table->new("mpa"); + if ($mpatable) { + my $mpa_a = $mpatable->getAttribs({mpa => $mpa}, 'username', 'password'); + if ( $mpa_a and $mpa_a->{username} and $mpa_a->{password} ) { + $user = $mpa_a->{username}; + $password = $mpa_a->{password}; + } else { + xCAT::MsgUtils->message('E', "No username or password found for $mpa"); + } + } + + my $mactable=xCAT::Table->new("mac"); + if ( $mactable ) { + my $mac_a = $mactable->getAttribs({node=> $mpa}, 'mac'); + if ( $mac_a and $mac_a->{mac} ) { + $mac = $mac_a->{mac}; + } else { + xCAT::MsgUtils->message('E', "No mac found for $mpa"); + } + } + + my $found1=0; + my $found2=0; + if ( $mac and $user and $password ) { + #write configuration file + open(FILE1, "<$::snmpconfdir/snmptrapd.conf"); + open(FILE, ">$::snmpconfdir/snmptrapd.conf.tmp"); + while (readline(FILE1)) { + if (/\s*authUser.*$user/) { + $found1=1; + if (!/\s*authUser\s*.*execute.*$user/) { + s/authUser\s*(.*)\s* $user/authUser $1,execute $user/; #modify it to have 'execute' if found + } + } + if (!/\s*authUser\s*.*net.*$user/) { + s/authUser\s*(.*)\s* $user/authUser $1,net $user/; #modify it to have 'net' if found + } + + if (/\s*createUser.*$mac.*$user.*$password/) { + $found2=1; + } + + print FILE $_; + } + + } + + if (!$found1) { #add new one if not found + print FILE "authUser log,execute,net $user\n"; + } + + if (!$found2) { + print FILE "createUser -e 0x8000045001$mac $user SHA $password DES\n"; + } + + close(FILE1); + close(FILE); + `mv -f $::snmpconfdir/snmptrapd.conf.tmp $::snmpconfdir/snmptrapd.conf`; + } +# } + + # TODO: put the mib files to /usr/share/snmp/mibs return (0, ""); } From 3e0d22db7cc1aff4516d417c58cabd1ae6730626 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Tue, 10 Sep 2013 14:51:45 +0800 Subject: [PATCH 101/184] fixing bug 3764, add osminor version for sles. --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index 5bd55dd4e..644837924 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -129,8 +129,6 @@ sub get_latest_version } #------------------------------------------------------------------------------ - - =head3 testVersion Compare version1 and version2 according to the operator and @@ -206,7 +204,6 @@ sub testVersion return $bool; } - #------------------------------------------------------------------------------- =head3 isAIX @@ -454,6 +451,12 @@ sub osver $ver = $lines[0]; $ver =~ s/\.//; $ver =~ s/[^0-9]*([0-9]+).*/$1/; + my $minorver; + if (grep /PATCHLEVEL/, $lines[2]) { + $minorver = $lines[2]; + $minorver =~ s/PATCHLEVEL[^0-9]*([0-9]+).*/$1/; + } + $ver = $ver . ".$minorver" if ( $minorver ); } elsif (-f "/etc/UnitedLinux-release") { From dbcab937da3742e116ed099f08d466e9a6737031 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Tue, 10 Sep 2013 02:25:58 -0700 Subject: [PATCH 102/184] fix the postinst script for xcat-server on ubuntu --- xCAT-server/debian/postinst | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-server/debian/postinst b/xCAT-server/debian/postinst index b9f5c07f0..a7625fb7e 100644 --- a/xCAT-server/debian/postinst +++ b/xCAT-server/debian/postinst @@ -31,7 +31,6 @@ case "$1" in ln -sf /opt/xcat/sbin/xcatd /usr/sbin/xcatd #SHA1 has been get rid of after Squeeze released. Its functionality is also provided by Digest::SHA (which is in core). #but ipmi.pm need SHA1.pm, so create this link - cd - ;; abort-upgrade|abort-remove|abort-deconfigure) From 815e2d6583973ba2986b2e765b5e40aa3450a0ee Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 10 Sep 2013 09:12:55 -0400 Subject: [PATCH 103/184] add centos6 --- xCAT-server/lib/xcat/plugins/esx.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index 4069f4af9..b4820e312 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -97,6 +97,7 @@ my %guestidmap = ( "rhel.6.*" => "rhel6_", "rhel.5.*" => "rhel5_", "rhel4.*" => "rhel4_", + "centos6.*" => "rhel6_", "centos5.*" => "rhel5_", "centos4.*" => "rhel4_", "sles11.*" => "sles11_", From 716bb97084dad46ae70a51888f7e66cd7949f8a3 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 10 Sep 2013 14:21:54 -0400 Subject: [PATCH 104/184] fix defect 3777 --- xCAT-server/lib/perl/xCAT/RShellAPI.pm | 56 ++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/RShellAPI.pm b/xCAT-server/lib/perl/xCAT/RShellAPI.pm index 85ef891d1..44de8b1f5 100644 --- a/xCAT-server/lib/perl/xCAT/RShellAPI.pm +++ b/xCAT-server/lib/perl/xCAT/RShellAPI.pm @@ -90,6 +90,7 @@ sub run_remote_shell_api { my $output; my $errmsg; my $ssh_tried=0; + my $nl_tried=0; if (!$telnet) { eval { @@ -209,6 +210,18 @@ sub run_remote_shell_api { $output.="Password is required.\n"; return [1, $output]; } + } else { + # for some switches like BNT, user has to type an extra new line + # in order to get the prompt. + if ($verbose) { + print " add a newline\n"; + } + $nl_tried=1; + if (! $t->put(String => "\n", + Errmode => "return")) { + $output.="Login disconnected\n"; + return [1, $output]; + } } if (!$login_done) { @@ -228,13 +241,48 @@ sub run_remote_shell_api { $output.="Login failed: bad login name or password\n"; return [1, $output]; } else { - if ($t->errmsg) { - $output.= $t->errmsg . "\n"; - return [1, $output]; - + if (!$nl_tried) { + # for some switches like BNT, user has to type an extra new line + # in order to get the prompt. + if ($verbose) { + print " add a newline\n"; + } + $nl_tried=1; + if (! $t->put(String => "\n", + Errmode => "return")) { + $output.="Login disconnected\n"; + return [1, $output]; + } + } + else { + if ($t->errmsg) { + $output.= $t->errmsg . "\n"; + return [1, $output]; + + } } } } + + #check if the extra newline helps or not + if (!$login_done) { + #Wait for command prompt + ($prematch, $match) = $t->waitfor(Match => "/$prompt/", + Errmode => "return"); + if ($verbose) { + print "4. prematch=$prematch\n match=$match\n"; + } + + if ($match =~ /$prompt/) { + $login_done=1; + } else { + if ($t->errmsg) { + $output.= $t->errmsg . "\n"; + return [1, $output]; + } + } + } + } } } From 9704a7b176a010d9c4abae94e6c6f2fcfc0ca47f Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 11 Sep 2013 08:47:04 -0400 Subject: [PATCH 105/184] defect 3759: fix the man page for power 6 that attributes syssbpower,sysIPLtime were not in the command line list --- xCAT-client/pods/man1/renergy.1.pod | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-client/pods/man1/renergy.1.pod b/xCAT-client/pods/man1/renergy.1.pod index f12187487..aec573f92 100644 --- a/xCAT-client/pods/man1/renergy.1.pod +++ b/xCAT-client/pods/man1/renergy.1.pod @@ -14,7 +14,8 @@ B B I [-V] { all | [savingstatus] [cappingstatus] [cappingmaxmin] [cappingvalue] [cappingsoftmin] [averageAC] -[averageDC] [ambienttemp] [exhausttemp] [CPUspeed] } +[averageDC] [ambienttemp] [exhausttemp] [CPUspeed] +[syssbpower] [sysIPLtime]} B I [-V] { savingstatus={on | off} | cappingstatus={on | off} | cappingwatt=watt @@ -158,7 +159,7 @@ Supported attributes: B: savingstatus,cappingstatus,cappingmin,cappingmax, cappingvalue,cappingsoftmin,averageAC,averageDC,ambienttemp, -exhausttemp,CPUspeed +exhausttemp,CPUspeed,syssbpower,sysIPLtime B: savingstatus,cappingstatus,cappingwatt,cappingperc From 8b8b932213d03a81e9b0df91a3e56777a65af254 Mon Sep 17 00:00:00 2001 From: sjing Date: Wed, 11 Sep 2013 05:24:57 -0400 Subject: [PATCH 106/184] Enhance usability of makedns with more checks and better messages. --- xCAT-server/lib/xcat/plugins/ddns.pm | 91 ++++++++++++++++++++++------ 1 file changed, 73 insertions(+), 18 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 92620dfe8..78d655e3a 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -565,16 +565,55 @@ sub process_request { if ($ctx->{restartneeded}) { xCAT::SvrUtils::sendmsg("Restarting $service", $callback); - if (xCAT::Utils->isAIX()) - { - system("/usr/bin/stopsrc -s $service"); - system("/usr/bin/startsrc -s $service"); - } - else - { - system("service $service stop"); - system("service $service start"); - } + if (xCAT::Utils->isAIX()) + { + my $cmd = "/usr/bin/stopsrc -s $service"; + my @output=xCAT::Utils->runcmd($cmd, 0); + my $outp = join('', @output); + if ($::RUNCMD_RC != 0) + { + my $rsp = {}; + $rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return; + } + + $cmd = "/usr/bin/startsrc -s $service"; + @output=xCAT::Utils->runcmd($cmd, 0); + $outp = join('', @output); + if ($::RUNCMD_RC != 0) + { + my $rsp = {}; + $rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return; + } + } + else + { + my $cmd = "service $service stop"; + my @output=xCAT::Utils->runcmd($cmd, 0); + my $outp = join('', @output); + if ($::RUNCMD_RC != 0) + { + my $rsp = {}; + $rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return; + } + + $cmd = "service $service start"; + @output=xCAT::Utils->runcmd($cmd, 0); + $outp = join('', @output); + if ($::RUNCMD_RC != 0) + { + my $rsp = {}; + $rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return; + } + } + xCAT::SvrUtils::sendmsg("Restarting named complete", $callback); } } else { @@ -590,8 +629,16 @@ sub process_request { my @output=xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) { - system("/usr/bin/startsrc -s $service"); - xCAT::SvrUtils::sendmsg("Starting named complete", $callback); + $cmd = "/usr/bin/startsrc -s $service"; + @output=xCAT::Utils->runcmd($cmd, 0); + my $outp = join('', @output); + if ($::RUNCMD_RC != 0) + { + my $rsp = {}; + $rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return; + } } } else @@ -600,11 +647,19 @@ sub process_request { my @output=xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) { - system("service $service start"); - xCAT::SvrUtils::sendmsg("Starting named complete", $callback); + $cmd = "service $service start"; + @output=xCAT::Utils->runcmd($cmd, 0); + my $outp = join('', @output); + if ($::RUNCMD_RC != 0) + { + my $rsp = {}; + $rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return; + } } - } - + } + #now we stick to Net::DNS style updates, with TSIG if possible. TODO: kerberized (i.e. Windows) DNS server support, maybe needing to use nsupdate -g.... if ($external) { @@ -1099,7 +1154,7 @@ sub add_or_delete_records { { if ($reply->header->rcode ne 'NOERROR') { - xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone, error was ".$reply->header->rcode], $callback); + xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone, error was ".$reply->header->rcode.". See more details in system log."], $callback); } } else @@ -1117,7 +1172,7 @@ sub add_or_delete_records { { if ($reply->header->rcode ne 'NOERROR') { - xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone, error was ".$reply->header->rcode], $callback); + xCAT::SvrUtils::sendmsg([1,"Failure encountered updating $zone, error was ".$reply->header->rcode.". See more details in system log."], $callback); } } else From 031bc1e3bd22f0b5ef08e7bb7225dcec0b5f8b80 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 11 Sep 2013 03:10:15 -0700 Subject: [PATCH 107/184] bug 3755, No way to setup CN hardware clock --- xCAT/postscripts/setupntp | 138 ++++++++++++++++++++++++++------------ 1 file changed, 94 insertions(+), 44 deletions(-) diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index 1b62f24c0..356337ba7 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -56,6 +56,13 @@ is_lsb_ubuntu () } logger -t xcat "Install: Setup NTP" +#the ntp was set up by xcat, return directly +grep "xcatsetup" $conf_file +if [ $? -eq 0 ];then + logger -t xcat "NTP was already configured by xCAT." + echo "NTP was already configured by xCAT." + exit +fi # if master is the sitemaster, then use the ntpservers defined in the site # table, if they exist. If they don't exist, do not setup ntp # else use the master which should be a service node @@ -114,44 +121,88 @@ fi OS_TYPE=`uname` if [ $OS_TYPE = Linux ]; then - mkdir -p /var/lib/ntp - chown ntp /var/lib/ntp - echo "driftfile /var/lib/ntp/drift + mkdir -p /var/lib/ntp + chown ntp /var/lib/ntp + echo "driftfile /var/lib/ntp/drift disable auth -restrict 127.0.0.1" >>$conf_file -# default service for redhat/fedora -SERVICE=ntpd -echo $SERVICE -if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ] || ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ); then - SERVICE=ntp -fi +restrict 127.0.0.1 +#xcatsetup" >>$conf_file + # default service for redhat/fedora + SERVICE=ntpd + if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ] || ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ); then + SERVICE=ntp + fi -#service ntpd restart - service $SERVICE stop -#ntpdate program is deprecated on SuSE -if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ]; then - logger -t xcat "ntpd -q -g" - ntpd -q -g - if [ "$?" != "0" ] - then - echo - echo " ntpd -q -g failed" - logger -t xcat "ntpd -q -g failed" - fi -else - logger -t xcat "ntpdate -t5 $master " - ntpdate -t5 $master - if [ "$?" != "0" ] - then - echo - echo " ntpdate -t5 $master failed" + #ntpdate/sntp conflict with ntpd, stop the service first + service $SERVICE status + if [ $? -eq 0 ];then + service $SERVICE stop + fi + #ntpdate program is deprecated on SuSE + if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ]; then + logger -t xcat "sntp -P no -r $master" + sntp -P no -r $master + if [ "$?" != "0" ];then + echo " sntp -P no -r $master failed" + logger -t xcat "sntp -P no -r $master failed" + fi + else + logger -t xcat "ntpdate -t5 $master " + ntpdate -t5 $master + if [ "$?" != "0" ];then + echo " ntpdate -t5 $master failed" logger -t xcat "ntpdate -t5 $master failed" - fi -fi + fi + fi - service $SERVICE start - chkconfig --add $SERVICE >/dev/null 2>&1 - chkconfig --level 345 $SERVICE on >/dev/null 2>&1 + #setup the hardware clock + hwclock --systohc --utc + + #setup the RTC is UTC format, which will be used by os + if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ];then + sed -i 's/.*HWCLOCK.*/HWCLOCK="-u"/' /etc/sysconfig/clock + elif [ -f "/etc/debian_version" ];then + sed -i 's/.*UTC.*/UTC=yes/' /etc/default/rcS + else + grep -i "utc" /etc/sysconfig/clock + if [ $? -eq 0 ];then + sed -i 's/.*UTC.*/UTC=yes/' /etc/sysconfig/clock + else + echo "UTC=yes" >> /etc/sysconfig/clock + fi + fi + + #update the hardware clock automaticly + if [ -f "/etc/sysconfig/ntpd" ];then + grep -i "SYNC_HWCLOCK" /etc/sysconfig/ntpd + if [ $? -eq 0 ];then + sed -i 's/.*SYNC_HWCLOCK.*/SYNC_HWCLOCK=yes/' /etc/sysconfig/ntpd + else + echo "SYNC_HWCLOCK=yes" >> /etc/sysconfig/ntpd + fi + else + cron_file="/etc/cron.daily/xcatsethwclock" + if [ ! -f "$cron_file" ];then + echo "#!/bin/sh" > $cron_file + echo "/sbin/hwclock --systohc --utc" >> $cron_file + chmod a+x $cron_file + service cron restart + fi + fi + service $SERVICE start + + #start ntp and crontab automaticlly + if [ -f "/etc/debian_version" ];then + update-rc.d cron defaults + update-rc.d $SERVICE defaults + else + chkconfig --add $SERVICE >/dev/null 2>&1 + chkconfig --level 345 $SERVICE on >/dev/null 2>&1 + if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ];then + chkconfig --add cron >/dev/null 2>&1 + chkconfig --level 345 cron on >/dev/null 2>&1 + fi + fi else # stop and start AIX ntp echo "driftfile /etc/ntp.drift @@ -160,15 +211,14 @@ disable auth broadcastclient restrict 127.0.0.1" >>$conf_file - stopsrc -s xntpd - logger -t xcat "ntpdate -t5 $master " - ntpdate -t5 $master - if [ "$?" != "0" ] - then - echo - echo " ntpdate -t5 $master failed " - logger -t xcat "ntpdate -t5 $master failed" - fi - /usr/sbin/chrctcp -S -a xntpd + stopsrc -s xntpd + logger -t xcat "ntpdate -t5 $master " + ntpdate -t5 $master + if [ "$?" != "0" ] + then + echo " ntpdate -t5 $master failed " + logger -t xcat "ntpdate -t5 $master failed" + fi + /usr/sbin/chrctcp -S -a xntpd fi exit $? From 4f91b337576713cda3775e6368f6e592e174189c Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 11 Sep 2013 03:16:51 -0700 Subject: [PATCH 108/184] bug3767:Target node doesn't return 'booted' status in sysclone --- xCAT/postscripts/runxcatpost | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT/postscripts/runxcatpost b/xCAT/postscripts/runxcatpost index 595249408..3534484f1 100644 --- a/xCAT/postscripts/runxcatpost +++ b/xCAT/postscripts/runxcatpost @@ -8,5 +8,6 @@ fi if [ -x "/xcatpost/updateflag.awk" ];then /xcatpost/updateflag.awk $IMAGESERVER 3002 + updateflag.awk $IMAGESERVER 3002 "installstatus booted" fi From f1dc5da44610f6f7ea0e39963f7714cda99b9d9b Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 11 Sep 2013 02:36:27 -0700 Subject: [PATCH 109/184] Modifications of setting memory for partitions on Power Machines --- perl-xCAT/xCAT/FSPvm.pm | 72 ++++++++++++++------------------ xCAT-server/lib/perl/xCAT/PPC.pm | 2 +- 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index 321b7e1f7..9fe608e91 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -1471,8 +1471,9 @@ sub parse_part_get_info { #$hash->{logic_drc_phydrc}->{$5}->{$1} = [$2,$3,$4]; } #} elsif ($line =~ /lpar 0:: Curr Memory::min: 1,cur: (\d+),max:/i) { - } elsif ($line =~ /Curr Memory Req[^\(]*\((\d+)\s*regions\)/i) { + } elsif ($line =~ /HYP Reserved Memory Regions:(\d+), Min Required Regions:(\d+)/i) { $hash->{lpar0_used_mem} = $1; + $hash->{phy_min_mem_req} = $2; #print "===>lpar0_used_mem:$hash->{lpar0_used_mem}.\n"; } elsif ($line =~ /Available huge page memory\(in pages\):\s*(\d+)/) { $hash->{huge_page_avail} = $1; @@ -1522,7 +1523,7 @@ sub query_cec_info_actions { if ($action eq "part_get_all_io_bus_info") { my @output = split /\n/, @$values[1]; foreach my $line (@output) { - if ($line =~ /$lparid,/) { + if ($line =~ /^$lparid,/) { #$data .= "$line\n"; push @array, [$name, $line, 0]; } @@ -1625,42 +1626,31 @@ sub deal_with_avail_mem { my $name = shift; my $d = shift; my $lparhash = shift; - my ($before,$after,$res); - my @td = @$d; - @td[0] = 0; - my $values = xCAT::FSPUtils::fsp_api_action($request, $name, \@td, "part_get_lpar_memory"); - my %tmphash; - &parse_part_get_info(\%tmphash, @$values[1]); - if (exists($tmphash{lpar0_used_mem})) { - $before = $tmphash{lpar0_used_mem}; - } else { - return ([$name, "part_get_lpar_memory failed to get used memory for hypervisor.", 1]); - } - my $tmp_param = "1/1/".$lparhash->{hyp_config_mem}; - $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_mem", 0, $tmp_param); - if (@$values[2]) { - return $values; - } - $values = xCAT::FSPUtils::fsp_api_action($request, $name, \@td, "part_get_lpar_memory"); - &parse_part_get_info(\%tmphash, @$values[1]); - if (exists($tmphash{lpar0_used_mem})) { - $after = $tmphash{lpar0_used_mem}; - $res = $after - $before; - if ($res < 0) { - return([$name, "Parse reserverd regions failed, before $before, after $after.", 1]); - } elsif ($lparhash->{hyp_avail_mem} - $res < 0) { - return([$name, "Parse reserverd regions failed, no enough memory, availe:$lparhash->{hyp_avail_mem}.", -1]); + my $max_required_regions; + if ($lparhash->{memory} =~ /(\d+)\/(\d+)\/(\d+)/) { + my ($min,$cur,$max); + $min = $1; + $cur = $2; + $max = $3; + my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_get_hyp_res_mem_regions", 0, $3); + my %tmphash; + &parse_part_get_info(\%tmphash, @$values[1]); + if (exists($tmphash{lpar0_used_mem}) && exists($tmphash{phy_min_mem_req})) { + if ($min < $tmphash{phy_min_mem_req}) { + $min = $tmphash{phy_min_mem_req}; + } + if ($lparhash->{hyp_avail_mem} - $tmphash{lpar0_used_mem} < $min) { + return([$name, "Parse reserverd regions failed, no enough memory, availe:$lparhash->{hyp_avail_mem}.", 1]); + } + if ($cur > $lparhash->{hyp_avail_mem} - $tmphash{lpar0_used_mem}) { + my $new_cur = $lparhash->{hyp_avail_mem} - $tmphash{lpar0_used_mem}; + $lparhash->{memory} = "$min/$new_cur/$max"; + } + } else { + return ([$name, "Failed to get hypervisor reserved memory regions.", 1]); } - my $mem = $lparhash->{memory}; - $mem =~ /(\d+)\/(\d+)\/(\d+)/; - if ($2 > $lparhash->{hyp_avail_mem} - $res) { - my $new_avail_mem = $lparhash->{hyp_avail_mem} - $res; - $lparhash->{memory} = "$1/$new_avail_mem/$3"; - } - return 0; - } else { - return ([$name, "part_get_lpar_memory failed to get used memory for hypervisor.", 1]); } + return 0; } sub create_lpar { @@ -1685,10 +1675,6 @@ sub create_lpar { xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_shared_pool_util_auth"); xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_group_id"); xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_avail_priority"); - $values = &deal_with_avail_mem($request, $name, $d,$lparhash); - if (ref($values) eq "ARRAY") { - return ([@$values]); - } #print "======>physlots:$lparhash->{physlots}.\n"; $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner_uber", 0, $lparhash->{physlots}); #$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner", 0, join(",",@phy_io_array)); @@ -1724,6 +1710,12 @@ sub create_lpar { $values = &set_lpar_undefined($request, $name, $d); return ([$name, @$values[1], @$values[2]]); } + $values = &deal_with_avail_mem($request, $name, $d,$lparhash); + if (ref($values) eq "ARRAY") { + &set_lpar_undefined($request, $name, $d); + return ([@$values]); + } + #print "======>memory:$lparhash->{memory}.\n"; $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_mem", 0, $lparhash->{memory}); if (@$values[2] ne 0) { diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index e692f286a..a833ac540 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -57,7 +57,7 @@ my %modules = ( cec => "xCAT::FSPvm", }, rmvm => { hmc => "xCAT::PPCvm", - hmc => "xCAT::FSPvm", + fsp => "xCAT::FSPvm", }, lsvm => { hmc => "xCAT::PPCvm", fsp => "xCAT::FSPvm", From 817f8ce41140ac0460eadd93558583e8b338b1ff Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 11 Sep 2013 07:13:59 -0400 Subject: [PATCH 110/184] defect 3778 --- perl-xCAT/xCAT/Utils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 24f4bbf99..c64a87162 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3165,7 +3165,7 @@ sub noderangecontainsMn } } if ($mname) { # if Management Node defined in the database - if (grep(/$mname/, @noderange)) { # if MN in the noderange + if (grep(/^$mname$/, @noderange)) { # if MN in the noderange return $mname; } else { return ; From f58a3f2f9a0cb8efafb89648a808e95fb2c4aa6e Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 11 Sep 2013 08:54:22 -0400 Subject: [PATCH 111/184] defect 3766 --- xCAT-server/lib/xcat/plugins/updatenode.pm | 38 ++++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 6e427786e..4e6815d47 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -917,7 +917,7 @@ sub updatenode @::FAILEDNODES=(); #print Dumper($request); my $nodes = $request->{node}; - # $request->{status}= "yes"; for testing + #$request->{status}= "yes"; # for testing my $requeststatus; if (defined($request->{status})) { $requeststatus = $request->{status}; @@ -1538,12 +1538,20 @@ sub buildnodestatus if($line =~ /^\s*(\S+)\s*:\s*Remote_command_successful/) { my ($node,$info) = split (/:/, $line); - push(@::SUCCESSFULLNODES,$node); + if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer + next; + } else { + push(@::SUCCESSFULLNODES,$node); + } } elsif($line =~ /^\s*(\S+)\s*:\s*Remote_command_failed/) { my ($node,$info)= split (/:/, $line); - push(@::FAILEDNODES,$node); + if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer + next; + } else { + push(@::FAILEDNODES,$node); + } } else { @@ -1746,12 +1754,20 @@ sub getdata if($output =~ /^\s*(\S+)\s*:\s*Remote_command_successful/) { my ($node,$info) = split (/:/, $output); - push(@::SUCCESSFULLNODES,$node); + if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer + next; + } else { + push(@::SUCCESSFULLNODES,$node); + } } if($output =~ /^\s*(\S+)\s*:\s*Remote_command_failed/) { my ($node,$info) = split (/:/, $output); - push(@::FAILEDNODES,$node); + if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer + next; + } else { + push(@::FAILEDNODES,$node); + } } @@ -1804,7 +1820,11 @@ sub getdata2 if($output =~ /^\s*(\S+)\s*:\s*Remote_command_successful/) { my ($node,$info) = split (/:/, $output); - push(@::SUCCESSFULLNODES,$node); + if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer + next; + } else { + push(@::SUCCESSFULLNODES,$node); + } } # check for already installed, this is not an error if($output =~ /^\s*(\S+)\s*:\s*already installed/) @@ -1815,7 +1835,11 @@ sub getdata2 { if ($alreadyinstalled == 0) { # not an already install error my ($node,$info) = split (/:/, $output); - push(@::FAILEDNODES,$node); + if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer + next; + } else { + push(@::FAILEDNODES,$node); + } } } From e1635a9b4808993aba28ff950eb7bbec6d2e5673 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 11 Sep 2013 14:26:03 -0400 Subject: [PATCH 112/184] Implement rflash support for NeXtScale Enclosure manager --- xCAT-server/lib/xcat/plugins/ipmi.pm | 124 ++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 377c049b7..9951b02f0 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -56,6 +56,7 @@ sub handled_commands { rspreset => 'nodehm:mgt', #done rvitals => 'nodehm:mgt', #done rinv => 'nodehm:mgt', #done + rflash => 'nodehm:mgt', #done rsetboot => 'nodehm:mgt', #done rbeacon => 'nodehm:mgt', #done reventlog => 'nodehm:mgt', @@ -466,12 +467,16 @@ sub on_bmc_connect { } #ok, detect some common prereqs here, notably: #getdevid - if ($command eq "getrvidparms") { + if ($command eq "getrvidparms" or $command eq "rflash") { unless (defined $sessdata->{device_id}) { $sessdata->{ipmisession}->subcmd(netfn=>6,command=>1,data=>[],callback=>\&gotdevid,callback_args=>$sessdata); return; } - getrvidparms($sessdata); + if ($command eq "getrvidparms") { + getrvidparms($sessdata); + } else { + rflash($sessdata); + } } #initsdr if ($command eq "rinv" or $command eq "reventlog" or $command eq "rvitals") { @@ -1209,6 +1214,121 @@ sub ripmi_callback { xCAT::SvrUtils::sendmsg($output,$callback,$sessdata->{node},%allerrornodes); } +sub isfpc { + my $sessdata = shift; + return 1 +} +sub rflash { + my $sessdata = shift; + if (isfpc($sessdata)) { + #first, start a fpc firmware transaction + $sessdata->{firmpath} = $sessdata->{subcommand}; + $sessdata->{firmctx} = "init"; + $sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x17, + data=>[0,0,1,0,0,0,0], + callback=>\&fpc_firmup_config, + callback_args=>$sessdata); + } else { + die "Unimplemented"; + } +} + +sub fpc_firmup_config { + if (check_rsp_errors(@_)) { + abort_fpc_update($_[1]); + return; + } + my $rsp = shift; + my $sessdata = shift; + unless ($sessdata->{firmupxid}) { + $sessdata->{firmupxid} = $rsp->{data}->[0]; + } + my $data; + if ($sessdata->{firmctx} eq 'init') { + $data =[0, $sessdata->{firmupxid}, 1, 0, 1, 0, 0, 0, + length($sessdata->{firmpath}), + unpack("C*",$sessdata->{firmpath})]; + $sessdata->{firmctx} = 'p1'; + } elsif ($sessdata->{firmctx} eq 'p1') { + $data = [0, $sessdata->{firmupxid}, 3, 0, 5]; + $sessdata->{firmctx} = 'p2'; + } elsif ($sessdata->{firmctx} eq 'p2') { + $data = [0, $sessdata->{firmupxid}, 4, 0, 0xa]; + $sessdata->{firmctx} = 'p3'; + } elsif ($sessdata->{firmctx} eq 'p3') { + $data = [0, $sessdata->{firmupxid}, 5, 0, 3]; + $sessdata->{firmctx} = 'p4'; + } elsif ($sessdata->{firmctx} eq 'p4') { + $data = [0, $sessdata->{firmupxid}, 6, 0, 1]; + $sessdata->{firmctx} = 'xfer'; + xCAT::SvrUtils::sendmsg("Transferring firmware",$callback,$sessdata->{node},%allerrornodes); + $sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x19, + data=>[0, $sessdata->{firmupxid}], + callback=>\&fpc_firmxfer_watch, + callback_args=>$sessdata); + return; + + } + $sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x18, + data=>$data, + callback=>\&fpc_firmup_config, + callback_args=>$sessdata); +} +sub abort_fpc_update { + my $sessdata = shift; + $sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x15, data=>[], callback=>\&fpc_update_aborted, callback_args=>$sessdata); +} + +sub fpc_update_aborted { + check_rsp_errors(@_); + return; +} + +sub fpc_firmxfer_watch { + if ($_[0]->{code} == 0x89) { + xCAT::SvrUtils::sendmsg([1,"Transfer failed (wrong url?)"],$callback,$_[1]->{node},%allerrornodes); + abort_fpc_update($_[1]); + return; + } + if (check_rsp_errors(@_)) { + abort_fpc_update($_[1]); + return; + } + my $rsp = shift; + my $sessdata = shift; + my $delay=1; + my $watch=2; + if ($sessdata->{firmctx} eq 'apply') { $delay = 15; $watch = 1;} + if (check_rsp_errors(@_)) { + return; + } + my $percent = 0; + if ($rsp->{data} and (length(@{$rsp->{data}}) > 0)) { + $percent = $rsp->{data}->[0]; + } + #$callback->({sinfo=>"$percent%"}); + if ($percent == 100) { + if ($sessdata->{firmctx} eq 'xfer') { + xCAT::SvrUtils::sendmsg("Applying firmware",$callback,$sessdata->{node},%allerrornodes); + $sessdata->{firmctx} = "apply"; + $sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x20, + data=>[0, $sessdata->{firmupxid}], + callback=>\&fpc_firmxfer_watch, + callback_args=>$sessdata); + return; + } else { + xCAT::SvrUtils::sendmsg("Resetting FPC",$callback,$sessdata->{node},%allerrornodes); + resetbmc($sessdata); + } + } else { + $sessdata->{ipmisession}->subcmd(netfn=>0x8, command=>0x12, + data=>[$watch], + delayxmit=>$delay, + callback=>\&fpc_firmxfer_watch, + callback_args=>$sessdata); + } +} + sub reseat_node { my $sessdata = shift; if (1) { # TODO: FPC path checked for From 7c29fd4757b59d05b2183dbbc3d559bde6a02695 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 11 Sep 2013 23:51:05 -0700 Subject: [PATCH 113/184] confignics modify -s option --- xCAT/postscripts/configeth | 106 +++++++++++++++++++++++++++++++++--- xCAT/postscripts/confignics | 7 ++- 2 files changed, 103 insertions(+), 10 deletions(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index ab82f6b20..b17a92779 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -106,16 +106,10 @@ function configipv4(){ if [ $num_v4num -eq 0 ];then echo "DEVICE=${str_if_name}" > $str_conf_file echo "BOOTPROTO=static" >> $str_conf_file - echo "BROADCAST=" >> $str_conf_file - echo "ETHTOOL_OPTIONS=" >> $str_conf_file echo "IPADDR=${str_v4ip}" >> $str_conf_file - echo "MTU=" >> $str_conf_file - echo "NAME=" >> $str_conf_file echo "NETMASK=${str_v4mask}" >> $str_conf_file echo "NETWORK=${str_v4net}" >> $str_conf_file - echo "REMOTE_IPADDR=" >> $str_conf_file echo "STARTMODE=onboot" >> $str_conf_file - echo "UNIQUE=" >> $str_conf_file echo "USERCONTROL=no" >> $str_conf_file echo "_nm_name=static-0" >> $str_conf_file else @@ -148,7 +142,7 @@ function configipv4(){ echo "DEVICE=${str_if_name}:${num_v4num}" > $str_conf_file fi - echo "BOOTPROTO=none" >> $str_conf_file + echo "BOOTPROTO=static" >> $str_conf_file echo "NM_CONTROLLED=no" >> $str_conf_file echo "IPADDR=${str_v4ip}" >> $str_conf_file echo "NETMASK=${str_v4mask}" >> $str_conf_file @@ -211,7 +205,7 @@ configipv6(){ str_conf_file="/etc/sysconfig/network-scripts/ifcfg-${str_if_name}" if [ $num_v4num -eq 0 -a $num_v6num -eq 0 ];then echo "DEVICE=$str_if_name" > $str_conf_file - echo "BOOTPROTO=none" >> $str_conf_file + echo "BOOTPROTO=static" >> $str_conf_file echo "NM_CONTROLLED=no" >> $str_conf_file echo "ONBOOT=yes" >> $str_conf_file fi @@ -378,6 +372,102 @@ if [ "$1" = "-r" ];then delete_nic_config_files $str_nic_name fi exit 0 +elif [ "$1" = "-s" ];then + if [ $# -lt 2 ];then + logger -t xcat -p local4.err "configeth: config install nic, but the nic name is missed" + echo "configeth on $NODE: config install nic, but the nic name is missed" + exit 1 + fi + str_inst_nic=$2 + str_inst_ip='' + str_inst_mask='' + str_inst_gateway='' + if [ "$str_os_type" = "aix" ];then + logger -t xcat -p local4.err "configeth: aix does not support -s flag" + echo "configeth on $NODE: aix does not support -s flag" + exit 0 + elif [ -f "/etc/debian_version" ];then + str_lease_file="/var/lib/dhcp/dhclient."$str_inst_nic".leases" + if [ -e $str_lease_file ];then + str_inst_ip=`grep fixed-address $str_lease_file | tail -n 1 | awk '{print $2}' | sed 's/;$//'` + str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` + str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` + fi + elif [ -f "/etc/SuSE-release" ];then + str_lease_file="/var/lib/dhcpcd/dhcpcd-"$str_inst_nic".info" + if [ -e $str_lease_file ];then + str_inst_ip=`grep IPADDR $str_lease_file | tail -n 1 | awk -F'=' '{print $2}' | sed "s/'//g"` + str_inst_mask=`grep NETMASK $str_lease_file | tail -n 1 | awk -F'=' '{print $2}' | sed "s/'//g"` + str_inst_gateway=`grep GATEWAYS $str_lease_file | tail -n 1 | awk -F'=' '{print $2}' | sed "s/'//g"` + fi + else + str_lease_file=`ls /var/lib/dhclient/*$str_inst_nic*` + if [ -e $str_lease_file ];then + str_inst_ip=`grep fixed-address $str_lease_file | tail -n 1 | awk '{print $2}' | sed 's/;$//'` + str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` + str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` + fi + fi + + if [ -z "$str_inst_ip" -o -z "$str_inst_mask" ];then + logger -t xcat -p local4.err "configeth: config install nic, can not find the information from lease file, return." + echo "configeth on $NODE: config install nic, can not find information from dhcp lease file, return." + exit 0 + fi + + if [ -f "/etc/debian_version" ];then + str_conf_file="/etc/sysconfig/network/ifcfg-${str_inst_nic}" + echo "auto ${str_inst_nic}" > $str_conf_file + echo "iface ${str_inst_nic} inet static" >> $str_conf_file + echo " address ${str_inst_ip}" >> $str_conf_file + echo " netmask ${str_inst_mask}" >> $str_conf_file + if [ -n "$str_inst_gateway" ];then + echo " gateway $str_inst_gateway" >> $str_conf_file + fi + hostname $NODE + echo $NODE > /etc/hostname + elif [ -f "/etc/SuSE-release" ];then + str_conf_file="/etc/network/interfaces.d/${str_inst_nic}" + echo "DEVICE=${str_inst_nic}" > $str_conf_file + echo "BOOTPROTO=static" >> $str_conf_file + echo "IPADDR=${str_inst_ip}" >> $str_conf_file + echo "NETMASK=${str_inst_mask}" >> $str_conf_file + echo "STARTMODE=onboot" >> $str_conf_file + if [ -n "$str_inst_gateway" ];then + grep -i "default" /etc/sysconfig/network/routes + if [ $? -eq 0 ];then + sed -i "s/.*default.*/default ${str_inst_gateway} - -/i" /etc/sysconfig/network/routes + else + echo "default ${str_inst_gateway} - -" >> /etc/sysconfig/network/routes + fi + fi + + hostname $NODE + echo $NODE > /etc/HOSTNAME + else + str_conf_file="/etc/sysconfig/network-scripts/ifcfg-${str_inst_nic}" + echo "DEVICE=${str_inst_nic}" > $str_conf_file + echo "IPADDR=${str_inst_ip}" >> $str_conf_file + echo "NETMASK=${str_inst_mask}" >> $str_conf_file + echo "BOOTPROTO=static" >> $str_conf_file + echo "ONBOOT=yes" >> $str_conf_file + if [ -n "$str_inst_gateway" ];then + grep -i "GATEWAY" /etc/sysconfig/network + if [ $? -eq 0 ];then + sed -i "s/.*GATEWAY.*/GATEWAY=${str_inst_gateway}/i" /etc/sysconfig/network + else + echo "GATEWAY=${str_inst_gateway}" >> /etc/sysconfig/network + fi + fi + hostname $NODE + grep -i "HOSTNAME" /etc/sysconfig/network + if [ $? -eq 0 ];then + sed -i "s/.*HOSTNAME.*/HOSTNAME=${NODE}/i" /etc/sysconfig/network + else + echo "HOSTNAME=${NODE}" >> /etc/sysconfig/network + fi + fi + exit 0 fi #main prcess diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index 01038847e..9c7454e0d 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -91,6 +91,9 @@ elif [ `echo $str_temp | grep -E "e(n|th)[0-9]+"` ];then str_inst_nic=$str_temp fi +if [ $bool_cfg_inst_nic -eq 1 ];then + configeth -s $str_inst_nic +fi bool_exit_flag=0 #check the required attributes @@ -162,7 +165,7 @@ if [ $bool_remove -eq 1 ];then continue fi - if [ "$str_temp_nic" = "$str_inst_nic" -a $bool_cfg_inst_nic -eq 0 ];then + if [ "$str_temp_nic" = "$str_inst_nic" ];then continue fi @@ -187,7 +190,7 @@ do key=`echo $key | sed 's/^ \+//' | sed 's/ \+$//'` str_nic_type= str_value=$(hashget hash_defined_nics $key) - if [ "$key" = "$str_inst_nic" -a $bool_cfg_inst_nic -eq 0 ];then + if [ "$key" = "$str_inst_nic" ];then continue fi old_ifs=$IFS From 4082f1da22c6d76f313ba3fcdc89960cf8e13a5a Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 12 Sep 2013 07:56:39 -0400 Subject: [PATCH 114/184] add -t info --- xCAT-client/pods/man1/xdsh.1.pod | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-client/pods/man1/xdsh.1.pod b/xCAT-client/pods/man1/xdsh.1.pod index e5ba3c110..03b86bc09 100644 --- a/xCAT-client/pods/man1/xdsh.1.pod +++ b/xCAT-client/pods/man1/xdsh.1.pod @@ -117,7 +117,7 @@ A timeout value for remote command execution can be specified with the B<-t> flag or with the B environment variable. If any remote target does not provide output to either standard output or standard error within the timeout value, B displays an error message and -exits. +exits. If streaming mode is specified with the B<-s> flag, output is returned as it becomes available from each target, instead of waiting for the @@ -333,7 +333,8 @@ available from any target in the specified I, B displays an error and terminates execution for the remote targets that failed to respond. If I is not specified, B waits indefinitely to continue processing output from -all remote targets. +all remote targets. The exception is the -K flag which defaults +to 10 seconds. =item B<-T>|B<--trace> From 1b5cf5e0446db88e70a6ecfcc96d3528b950b7de Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 12 Sep 2013 09:24:20 -0400 Subject: [PATCH 115/184] defect 3750 --- xCAT-server/lib/xcat/plugins/vsmppxe.pm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/vsmppxe.pm b/xCAT-server/lib/xcat/plugins/vsmppxe.pm index 912c12cb9..f40655eb5 100644 --- a/xCAT-server/lib/xcat/plugins/vsmppxe.pm +++ b/xCAT-server/lib/xcat/plugins/vsmppxe.pm @@ -6,6 +6,7 @@ use Socket; use File::Copy; use Getopt::Long; use xCAT::MsgUtils; +use xCAT::ServiceNodeUtils; use xCAT::TableUtils qw(get_site_attribute); my $addkcmdlinehandled; @@ -210,6 +211,7 @@ sub preprocess_request { my $callback1 = shift; my $command = $req->{command}->[0]; my $sub_req = shift; + my $nodes = $req->{node}; my @args=(); if (ref($req->{arg})) { @args=@{$req->{arg}}; @@ -254,10 +256,22 @@ sub preprocess_request { return; } - #my $sent = $stab->getAttribs({key=>'sharedtftp'},'value'); my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp"); my $t_entry = $entries[0]; if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) { + # check for computenodes and servicenodes from the noderange, if so error out + my @SN; + my @CN; + xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN); + if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN + my $rsp; + $rsp->{data}->[0] = + "Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n"; + xCAT::MsgUtils->message("E", $rsp, $callback1); + return; + + } + $req->{'_disparatetftp'}=[1]; if ($req->{inittime}->[0]) { return [$req]; From 5653f343a30503d3f6e10de1b7e82d693d3fbcc9 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Fri, 13 Sep 2013 00:44:47 -0700 Subject: [PATCH 116/184] fix bug 3780: Incorrect password selected for blade --- xCAT-server/lib/xcat/plugins/blade.pm | 68 +++++++++++++-------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 88e7f2fc0..ae1613306 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -19,7 +19,6 @@ use xCAT::Utils; use xCAT::TableUtils; use xCAT::NetworkUtils; use xCAT::ServiceNodeUtils; -use xCAT::PasswordUtils; use xCAT::IMMUtils; use xCAT::Usage; use IO::Socket; @@ -4310,11 +4309,11 @@ sub process_request { return; } } - #my $bladeuser = 'USERID'; - #my $bladepass = 'PASSW0RD'; + my $bladeuser = 'USERID'; + my $bladepass = 'PASSW0RD'; my $blademaxp = 64; #my $sitetab = xCAT::Table->new('site'); - #my $mpatab = xCAT::Table->new('mpa'); + my $mpatab = xCAT::Table->new('mpa'); my $mptab = xCAT::Table->new('mp'); my $tmp; my @entries = xCAT::TableUtils->get_site_attribute("blademaxp"); @@ -4326,19 +4325,19 @@ sub process_request { # ($tmp)=$sitetab->getAttribs({'key'=>'blademaxp'},'value'); # if (defined($tmp)) { $blademaxp=$tmp->{value}; } #} - #if ($request->{environment}->[0]->{XCAT_BLADEUSER}) { - # $bladeuser=$request->{environment}->[0]->{XCAT_BLADEUSER}->[0]; - # $bladepass=$request->{environment}->[0]->{XCAT_BLADEPASS}->[0]; - #} else { - #my $passtab = xCAT::Table->new('passwd'); - # if ($passtab) { - # ($tmp)=$passtab->getAttribs({'key'=>'blade'},'username','password'); - # if (defined($tmp)) { - # $bladeuser = $tmp->{username}; - # $bladepass = $tmp->{password}; - # } - # } - #} + if ($request->{environment}->[0]->{XCAT_BLADEUSER}) { + $bladeuser=$request->{environment}->[0]->{XCAT_BLADEUSER}->[0]; + $bladepass=$request->{environment}->[0]->{XCAT_BLADEPASS}->[0]; + } else { + my $passtab = xCAT::Table->new('passwd'); + if ($passtab) { + ($tmp)=$passtab->getAttribs({'key'=>'blade'},'username','password'); + if (defined($tmp)) { + $bladeuser = $tmp->{username}; + $bladepass = $tmp->{password}; + } + } + } if ($request->{command}->[0] eq "findme") { my $mptab = xCAT::Table->new("mp"); unless ($mptab) { return 2; } @@ -4457,25 +4456,24 @@ sub process_request { my @nodes=split(',', $2); my @ids=split(',', $3); my @mptypes=split(',', $4); - #my $user=$bladeuser; - #my $pass=$bladepass; + my $user=$bladeuser; + my $pass=$bladepass; my $ent; - #if (defined($mpatab)) { - # my @user_array = $mpatab->getNodeAttribs($mpa, qw(username password)); - # foreach my $entry (@user_array) { - # if ($entry->{username}) { - # if ($entry->{username} =~ /^USERID$/ or $entry->{username} !~ /^HMC$/) { - # $ent = $entry; - # last; - # } - # } - # } - # if (defined($ent->{password})) { $pass = $ent->{password}; } - # if (defined($ent->{username})) { $user = $ent->{username}; } - #} - my $authdata = xCAT::PasswordUtils::getIPMIAuth(noderange=>[$mpa]); - $mpahash{$mpa}->{username} = $authdata->{$mpa}->{username}; - $mpahash{$mpa}->{password} = $authdata->{$mpa}->{password}; + if (defined($mpatab)) { + my @user_array = $mpatab->getNodeAttribs($mpa, qw(username password)); + foreach my $entry (@user_array) { + if ($entry->{username}) { + if ($entry->{username} =~ /^USERID$/) { + $ent = $entry; + last; + } + } + } + if (defined($ent->{password})) { $pass = $ent->{password}; } + if (defined($ent->{username})) { $user = $ent->{username}; } + } + $mpahash{$mpa}->{username} = $user; + $mpahash{$mpa}->{password} = $pass; my $nodehmtab = xCAT::Table->new('nodehm'); my $hmdata = $nodehmtab->getNodesAttribs(\@nodes, ['node', 'mgt']); for (my $i=0; $i<@nodes; $i++) { From 643952493a0363c6d6236556a5c2bc1c36d74ca9 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Fri, 13 Sep 2013 02:06:14 -0700 Subject: [PATCH 117/184] setupntp do not return directly --- xCAT/postscripts/setupntp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index 356337ba7..f58595801 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -56,13 +56,6 @@ is_lsb_ubuntu () } logger -t xcat "Install: Setup NTP" -#the ntp was set up by xcat, return directly -grep "xcatsetup" $conf_file -if [ $? -eq 0 ];then - logger -t xcat "NTP was already configured by xCAT." - echo "NTP was already configured by xCAT." - exit -fi # if master is the sitemaster, then use the ntpservers defined in the site # table, if they exist. If they don't exist, do not setup ntp # else use the master which should be a service node @@ -125,8 +118,7 @@ if [ $OS_TYPE = Linux ]; then chown ntp /var/lib/ntp echo "driftfile /var/lib/ntp/drift disable auth -restrict 127.0.0.1 -#xcatsetup" >>$conf_file +restrict 127.0.0.1" >>$conf_file # default service for redhat/fedora SERVICE=ntpd if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ] || ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ); then From 42af194434c900084c83b9edd1456dbcc8cf2503 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 13 Sep 2013 08:00:12 -0400 Subject: [PATCH 118/184] defect 3750 --- xCAT-server/lib/xcat/plugins/pxe.pm | 4 +++- xCAT-server/lib/xcat/plugins/vsmppxe.pm | 10 +++++++--- xCAT-server/lib/xcat/plugins/xnba.pm | 4 +++- xCAT-server/lib/xcat/plugins/yaboot.pm | 4 +++- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index b5d947b56..8fadc1e3e 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -346,7 +346,9 @@ sub preprocess_request { if ($req->{inittime}->[0]) { return [$req]; } - return xCAT::Scope->get_broadcast_scope($req,@_); + if (@CN >0 ) { # if compute nodes broadcast to all servicenodes + return xCAT::Scope->get_broadcast_scope($req,@_); + } } return [$req]; } diff --git a/xCAT-server/lib/xcat/plugins/vsmppxe.pm b/xCAT-server/lib/xcat/plugins/vsmppxe.pm index f40655eb5..8bf893bf8 100644 --- a/xCAT-server/lib/xcat/plugins/vsmppxe.pm +++ b/xCAT-server/lib/xcat/plugins/vsmppxe.pm @@ -2,13 +2,15 @@ package xCAT_plugin::vsmppxe; use Data::Dumper; use Sys::Syslog; +use xCAT::Scope; +use xCAT::Utils; +use xCAT::NetworkUtils; use Socket; use File::Copy; use Getopt::Long; use xCAT::MsgUtils; use xCAT::ServiceNodeUtils; - -use xCAT::TableUtils qw(get_site_attribute); +use xCAT::TableUtils; my $addkcmdlinehandled; my $request; my $callback; @@ -276,7 +278,9 @@ sub preprocess_request { if ($req->{inittime}->[0]) { return [$req]; } - return xCAT::Scope->get_broadcast_scope($req,@_); + if (@CN >0 ) { # if there are compute nodes then broadcast to any servicenodes + return xCAT::Scope->get_broadcast_scope($req,@_); + } } return [$req]; } diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 65ed1298c..4fdaffb1f 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -366,7 +366,9 @@ sub preprocess_request { if ($req->{inittime}->[0]) { return [$req]; } - return xCAT::Scope->get_broadcast_scope($req,@_); + if (@CN >0 ) { # if compute nodes broadcast to all servicenodes + return xCAT::Scope->get_broadcast_scope($req,@_); + } } return [$req]; } diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 2988a926a..2ee83de4e 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -397,7 +397,9 @@ sub preprocess_request { if ($req->{inittime}->[0]) { return [$req]; } - return xCAT::Scope->get_broadcast_scope($req,@_); + if (@CN >0 ) { # if compute nodes broadcast to all servicenodes + return xCAT::Scope->get_broadcast_scope($req,@_); + } } return [$req]; } From e861a7c0a92215b6b699f6bc9be68891c118d7c2 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 13 Sep 2013 13:57:32 -0400 Subject: [PATCH 119/184] add support for -a (addrows) flag --- xCAT-client/sbin/tabrestore | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/xCAT-client/sbin/tabrestore b/xCAT-client/sbin/tabrestore index 1c1ff1f2b..c0f5a7422 100755 --- a/xCAT-client/sbin/tabrestore +++ b/xCAT-client/sbin/tabrestore @@ -7,11 +7,15 @@ BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/o use lib "$::XCATROOT/lib/perl"; use File::Basename; use xCAT::Client; +use xCAT::Utils; + use Getopt::Long; sub usage { print "Usage: tabrestore .csv\n"; + print " tabrestore -a .csv\n"; print " tabrestore [-?|-h|--help]\n"; + print " tabrestore [-v|--version]\n"; exit $_[0]; } @@ -21,12 +25,35 @@ $cmdref->{command}->[0] = "tabrestore"; # Get the options my $HELP; -if (!GetOptions('h|?|help' => \$HELP)) { usage(1); } +if ( + !GetOptions( + 'h|?|help' => \$HELP, + 'v|version' => \$VERSION, + 'a|addrows' => \$ADDROWS, + ) +) +{ usage(1); } + my $arg=shift(@ARGV); while ($arg =~ /^-/) { push (@{$cmdref->{arg}}, $arg); $arg=shift(@ARGV); } +if ($VERSION) +{ + my $version = xCAT::Utils->Version(); + print "$version\n"; + exit 0; +} +if ($HELP) +{ + usage; +} +if ($ADDROWS) +{ + $cmdref->{addrows}->[0] = "yes"; +} + unless ($arg) { usage(2); } # no filename specified # Open the specified table file and put its contents in the data key @@ -40,7 +67,7 @@ while (<$fh>) { push @{$cmdref->{data}},$_; } -push (@{$cmdref->{arg}}, @ARGV); # get the rest of the arguments xCAT::Client::submit_request($cmdref,\&xCAT::Client::handle_response); -exit $xCAT::Client::EXITCODE; \ No newline at end of file +exit $xCAT::Client::EXITCODE; + From d8e840bafd8dda2beda6ff896386da0ac64612d0 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 13 Sep 2013 13:58:52 -0400 Subject: [PATCH 120/184] add support for -a (addrows) flag --- xCAT-server/lib/xcat/plugins/tabutils.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 2596cab60..39e05ef45 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -358,7 +358,11 @@ sub noderm nodech($nodes, \@tablist, $cb, 0); } - +# +# restores the table from the input CSV file. Default deletes the table rows and +# replaces with the rows in the file +# If -a flag is input then it adds the rows from the CSV file to the table. +# sub tabrestore { # the usage for tabrestore is in the tabrestore client cmd @@ -367,6 +371,7 @@ sub tabrestore my $request = shift; my $cb = shift; my $table = $request->{table}->[0]; + my $addrows = $request->{addrows}->[0]; # do not allow teal tables if ( $table =~ /^x_teal/ ) { $cb->({error => "$table is not supported in tabrestore. Use Teal maintenance commands. ",errorcode=>1}); @@ -377,7 +382,9 @@ sub tabrestore $cb->({error => "Unable to open $table",errorcode=>4}); return; } - $tab->delEntries(); #Yes, delete *all* entries + if (!defined($addrows)) { # this is a replace not add rows + $tab->delEntries(); #Yes, delete *all* entries + } my $header = shift @{$request->{data}}; unless ($header =~ /^#/) { $cb->({error => "Data missing header line starting with #",errorcode=>1}); From 7db86eedff274a9e0f83f8bff96476c4aaed643a Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 13 Sep 2013 14:13:44 -0400 Subject: [PATCH 121/184] add support for -a (addrows) flag --- xCAT-client/pods/man8/tabrestore.8.pod | 29 ++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/xCAT-client/pods/man8/tabrestore.8.pod b/xCAT-client/pods/man8/tabrestore.8.pod index e39e580ed..49a51cc8f 100644 --- a/xCAT-client/pods/man8/tabrestore.8.pod +++ b/xCAT-client/pods/man8/tabrestore.8.pod @@ -1,18 +1,21 @@ =head1 NAME -B - replaces the contents of an xCAT database table with the contents in a csv file. +B - replaces with or adds to a xCAT database table the contents in a csv file. =head1 SYNOPSIS -B I +B [-a] I B [I<-?> | I<-h> | I<--help>] +B [I | I<--version>] + =head1 DESCRIPTION The tabrestore command reads the contents of the specified file and puts its data in the corresponding table in the xCAT database. Any existing rows in that table -are replaced. The file must be in csv format. It could be created by tabdump. +are replaced unless the (-a) flag is used and then the rows in the file are added to the table. +The file must be in csv format. It could be created by tabdump. Only one table can be specified. This command can be used to copy the example table entries in /opt/xcat/share/xcat/templates/e1350 @@ -26,6 +29,14 @@ into the xCAT database. Display usage message. +=item B<-v|--version> + +Display version. + +=item B<-a|--addrows> + +Add rows from the CSV file to the table instead of replacing the table with the CSV file. + =back =head1 RETURN VALUE @@ -48,9 +59,9 @@ An error has occurred. =item * -To put rows into the mp table: +To replace the rows in the mp table with the rows in the mp.csv file: -B< tabrestore> I +B< tabrestore> I The file mp.csv could contain something like: @@ -59,9 +70,15 @@ The file mp.csv could contain something like: =item * +To add the rows in the mp.csv file to the rows in the mp table: + +B< tabrestore> -a I + +=item * + To restore database tables that we dumped with dumpxCATdb: -restorexCATdb -p =back From 1ca9533e619ea39f0535d9ed0185ce0847bb3749 Mon Sep 17 00:00:00 2001 From: immarvin Date: Sat, 14 Sep 2013 07:36:58 -0700 Subject: [PATCH 122/184] add fedora19 diskful install support --- perl-xCAT/xCAT/data/discinfo.pm | 2 + xCAT-server/lib/perl/xCAT/Template.pm | 2 +- .../install/fedora/compute.fedora19.pkglist | 10 ++ .../xcat/install/fedora/compute.fedora19.tmpl | 156 ++++++++++++++++++ xCAT-server/share/xcat/install/scripts/pre.rh | 17 +- 5 files changed, 185 insertions(+), 2 deletions(-) create mode 100644 xCAT-server/share/xcat/install/fedora/compute.fedora19.pkglist create mode 100644 xCAT-server/share/xcat/install/fedora/compute.fedora19.tmpl diff --git a/perl-xCAT/xCAT/data/discinfo.pm b/perl-xCAT/xCAT/data/discinfo.pm index 7e3f0b378..a14111d4f 100755 --- a/perl-xCAT/xCAT/data/discinfo.pm +++ b/perl-xCAT/xCAT/data/discinfo.pm @@ -76,6 +76,8 @@ require Exporter; "1273712675.937554" => "fedora13", #x86_64 DVD ISO "1287685820.403779" => "fedora14", #x86_64 DVD ISO "1305315870.828212" => "fedora15", #x86_64 DVD ISO + "1372355769.065812" => "fedora19", #x86_64 DVD ISO + "1372402928.663653" => "fedora19", #ppc64 DVD ISO "1194512200.047708" => "rhas4.6", "1194512327.501046" => "rhas4.6", diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 11d9c2085..69c560e4e 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -178,7 +178,7 @@ sub subvars { my $source_in_pre; my $c = 0; foreach my $pkgdir(@pkgdirs) { - if( $platform =~ /^(rh|SL|centos)$/ ) { + if( $platform =~ /^(rh|SL|centos|fedora)$/ ) { if ( $c == 0 ) { # After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x # the rhels5.9 will not be installed successfully. So put in kickstart directly. diff --git a/xCAT-server/share/xcat/install/fedora/compute.fedora19.pkglist b/xCAT-server/share/xcat/install/fedora/compute.fedora19.pkglist new file mode 100644 index 000000000..95f7e9963 --- /dev/null +++ b/xCAT-server/share/xcat/install/fedora/compute.fedora19.pkglist @@ -0,0 +1,10 @@ +#Please make sure there is a space between @ and group name +yp-tools +wget +vim-minimal +ntpdate +nfs-utils +rsync +net-tools +openssh-server +util-linux-ng diff --git a/xCAT-server/share/xcat/install/fedora/compute.fedora19.tmpl b/xCAT-server/share/xcat/install/fedora/compute.fedora19.tmpl new file mode 100644 index 000000000..c7dbef826 --- /dev/null +++ b/xCAT-server/share/xcat/install/fedora/compute.fedora19.tmpl @@ -0,0 +1,156 @@ +#egan@us.ibm.com +# +#cmdline + +lang en_US + +# +# 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 +#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 + +# +# mouse selection +# +#mouse genericps/2 --emulthree + +# +# 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 --ignoremissing +#INCLUDE_DEFAULT_PKGLIST# +%end +%pre +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rh# +%end +%post +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rh# +%end diff --git a/xCAT-server/share/xcat/install/scripts/pre.rh b/xCAT-server/share/xcat/install/scripts/pre.rh index 8fc78775f..03d591e80 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.rh +++ b/xCAT-server/share/xcat/install/scripts/pre.rh @@ -13,6 +13,8 @@ if [ -r /tmp/updates/etc/pki/tls/certs/ca-bundle.crt ]; then cp -f /tmp/updates/etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ fi + + cat >/tmp/baz.py </foo.log 2>&1 & + + + #time to ascertain fstype and PReP/UEFI/legacy #also, find first available block device (sda or vda likely) #TODO: pick a likely non-SAN target if possible @@ -163,6 +169,7 @@ for disk in /dev/vd*[^0-9];do break fi done + if [ -z "$instdisk" ]; then for disk in /dev/sd*[^0-9]; do eddname=$(/lib/udev/edd_id $disk 2> /dev/null) @@ -184,6 +191,7 @@ if [ -z "$instdisk" ]; then esac done fi + if [ -z "$instdisk" ]; then if [ ! -z "$firstdirectdisk" ]; then instdisk=$firstdirectdisk @@ -204,6 +212,7 @@ elif grep ext4 /proc/filesystems > /dev/null; then else FSTYPE=ext3 fi + if [ `uname -m` = "ppc64" ]; then echo 'part None --fstype "PPC PReP Boot" --ondisk '$instdisk' --size 8' >> /tmp/partitioning fi @@ -218,9 +227,15 @@ echo "part / --size 1 --grow --ondisk $instdisk --fstype $FSTYPE" >> /tmp/partit #XCA_PARTITION_SCRIPT# + # The following code is to generate the repository for the installation cat /proc/cmdline -export nextserver=`cat /proc/cmdline | grep http | head -n 1 | cut -d / -f 3 | cut -d : -f 1` +NEXTSERVER=`cat /proc/cmdline | grep http | head -n 1` +NEXTSERVER=${NEXTSERVER#*http://} +NEXTSERVER=${NEXTSERVER%%:*} + +export nextserver=$NEXTSERVER #INSTALL_SOURCES_IN_PRE# + From 431470e035f4a5a2e61633889cf109548b3d7ed1 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Sun, 15 Sep 2013 23:15:34 -0700 Subject: [PATCH 123/184] Enhancement of fixing for bug 3780: Incorrect password selected for blade --- xCAT-server/lib/xcat/plugins/blade.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index ae1613306..88e49dcb2 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -19,6 +19,7 @@ use xCAT::Utils; use xCAT::TableUtils; use xCAT::NetworkUtils; use xCAT::ServiceNodeUtils; +use xCAT::PasswordUtils; use xCAT::IMMUtils; use xCAT::Usage; use IO::Socket; @@ -5048,6 +5049,7 @@ sub updateBMC { my $user = shift; my $pass = shift; my @nodes = (); + my $mphash; my $mptab = xCAT::Table->new('mp'); if ($mptab) { my @mpents = $mptab->getAllNodeAttribs(['node','mpa','id']); @@ -5055,15 +5057,26 @@ sub updateBMC { my $node = $_->{node}; if (defined($_->{mpa}) and ($_->{mpa} eq $mpa) and defined($_->{id}) and ($_->{id} ne '0')) { push @nodes, $node; + $mphash->{$node} = [$_]; } } } my $ipmitab = xCAT::Table->new('ipmi'); if ($ipmitab) { - my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['bmc']); + my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['bmc','username','password']); foreach (@nodes) { if (defined($ipmihash->{$_}->[0]) && defined ($ipmihash->{$_}->[0]->{'bmc'})) { - xCAT::IMMUtils::setupIMM($_,curraddr=>$ipmihash->{$_}->[0]->{'bmc'},skipbmcidcheck=>1,skipnetconfig=>1,cliusername=>$user,clipassword=>$pass,callback=>$CALLBACK); + my $ipmiuser = $user; + my $ipmipass = $pass; + + my $authdata = xCAT::PasswordUtils::getIPMIAuth(noderange=>[$_],ipmihash=>$ipmihash, mphash=>$mphash); + if (exists($authdata->{$_}->{username})) { + $ipmiuser = $authdata->{$_}->{username}; + } + if (exists($authdata->{$_}->{password})) { + $ipmipass = $authdata->{$_}->{password}; + } + xCAT::IMMUtils::setupIMM($_,curraddr=>$ipmihash->{$_}->[0]->{'bmc'},skipbmcidcheck=>1,skipnetconfig=>1,cliusername=>$ipmiuser,clipassword=>$ipmipass,callback=>$CALLBACK); } } } From 77ea7d4e414056610aee95cc19c009f088a56334 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 16 Sep 2013 01:50:23 -0700 Subject: [PATCH 124/184] bug 3776: post install script hung when deploy rhels5.9 --- xCAT/postscripts/xcatflowrequest | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/xCAT/postscripts/xcatflowrequest b/xCAT/postscripts/xcatflowrequest index ab1253ead..caa4b41cf 100755 --- a/xCAT/postscripts/xcatflowrequest +++ b/xCAT/postscripts/xcatflowrequest @@ -5,21 +5,22 @@ # It is called by xcatdsklspost before calling getpostscripts.awk # it is called by remoteshell before calling getcredentials.awk # -exec 13<>/dev/udp/$1/$2 -echo "resourcerequest: xcatd" >&13 +exec {REMOTEFD}<>/dev/udp/$1/$2 +echo "resourcerequest: xcatd" >&$REMOTEFD parpid=$$ touch /tmp/goahead.$parpid touch /tmp/killme.$parpid exec 2> /dev/null while ! grep 'resourcerequest: ok' /tmp/goahead.$parpid > /dev/null; do ( - echo "resourcerequest: xcatd" >&13 - exec 14<>/proc/self/stat - read mystat<&14 + echo "resourcerequest: xcatd" >&$REMOTEFD + exec {LOCALFD}<>/proc/self/stat + read mystat<&$LOCALFD mypid=$(echo $mystat|cut -d " " -f 4) (sleep $(((RANDOM%60)+120)).$((RANDOM%50)); if [ -f /tmp/killme.$parpid ]; then kill -TERM $mypid; fi) & echo $! > /tmp/sleeperpid.$parpid - exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&13 + exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&$REMOTEFD + exec {LOCALFD}>&- ) done sleeper=$(cat /tmp/sleeperpid.$parpid) @@ -27,4 +28,5 @@ sleeper=$(ps -ef|awk "\$3==$sleeper"|awk '{print $2}') rm /tmp/goahead.$parpid rm /tmp/sleeperpid.$parpid rm /tmp/killme.$parpid +exec {REMOTEFD}>&- kill -TERM $sleeper From 219badd6f23cd24617a265016c307e8460cea41a Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 16 Sep 2013 09:27:45 -0400 Subject: [PATCH 125/184] defect 3781 --- xCAT/postscripts/remoteshell | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index 151208a00..a7b168cd1 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -84,8 +84,15 @@ if [ $? -ne 0 ]; then #the message received is the data cat /tmp/ssh_dsa_hostkey | grep -E -v '||' >/etc/ssh/ssh_host_dsa_key logger -t xCAT -p local4.info ssh_dsa_hostkey + MAX_RETRIES=10 + RETRY=0 MYCONT=`cat /etc/ssh/ssh_host_dsa_key` while [ -z "$MYCONT" ]; do + RETRY=$(($RETRY+1)) + if [ $RETRY -eq $MAX_RETRIES ] + then + break + fi #first contact daemon xcatflowrequest 3001 logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" /$xcatpost/xcatflowrequest $master 3001 @@ -119,7 +126,14 @@ if [ $? -ne 0 ]; then cat /tmp/ssh_rsa_hostkey | grep -E -v '||' >/etc/ssh/ssh_host_rsa_key logger -t xCAT -p local4.info ssh_rsa_hostkey MYCONT=`cat /etc/ssh/ssh_host_rsa_key` + MAX_RETRIES=10 + RETRY=0 while [ -z "$MYCONT" ]; do + RETRY=$(($RETRY+1)) + if [ $RETRY -eq $MAX_RETRIES ] + then + break + fi # first contact daemon xcatflowrequest 3001 logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" /$xcatpost/xcatflowrequest $master 3001 @@ -166,7 +180,14 @@ then cat /tmp/ssh_root_key | grep -E -v '||' > /root/.ssh/id_rsa logger -t xCAT -p local4.info ssh_root_key MYCONT=`cat /root/.ssh/id_rsa` + MAX_RETRIES=10 + RETRY=0 while [ -z "$MYCONT" ]; do + RETRY=$(($RETRY+1)) + if [ $RETRY -eq $MAX_RETRIES ] + then + break + fi # first contact daemon xcatflowrequest 3001 logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" /$xcatpost/xcatflowrequest $master 3001 From de3184b24aed5120244b66548dd504680ab14cb0 Mon Sep 17 00:00:00 2001 From: Sheng Feng Xing Date: Tue, 17 Sep 2013 10:19:43 +0800 Subject: [PATCH 126/184] Fix #3784: CFMUtils.pm reports error messages in Verbose model if osimage.cfmdir is not set --- perl-xCAT/xCAT/CFMUtils.pm | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/perl-xCAT/xCAT/CFMUtils.pm b/perl-xCAT/xCAT/CFMUtils.pm index 3bbdeba38..0bbd01f28 100644 --- a/perl-xCAT/xCAT/CFMUtils.pm +++ b/perl-xCAT/xCAT/CFMUtils.pm @@ -235,24 +235,13 @@ sub setCFMSynclistFile { # get the cfmdir and synclists attributes my $osimage_t = xCAT::Table->new('osimage'); my $records = $osimage_t->getAttribs({imagename=>$img}, 'cfmdir', 'synclists'); - if ($records) + if (defined ($records->{'cfmdir'})) { - if ($records->{'cfmdir'}) {$cfmdir = $records->{'cfmdir'}} - if ($records->{'synclists'}) {$synclists = $records->{'synclists'}} + $cfmdir = $records->{'cfmdir'}; + if (defined ($records->{'synclists'})) {$synclists = $records->{'synclists'}} } else { - if ($::VERBOSE) - { - my $rsp = {}; - $rsp->{data}->[0] = "There are no records for cfmdir and synclists attribute in the osimage:$img. There is nothing to process."; - xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); - } - return; - } - - # no cfmdir defined, return directly - if (!$cfmdir) - { - return; + # no cfmdir defined, return directly + return 0; } my $found = 0; From 4bbda3998f8b845c18b9d4035ad07a372aa40c3c Mon Sep 17 00:00:00 2001 From: litingt Date: Mon, 16 Sep 2013 23:22:30 -0400 Subject: [PATCH 127/184] confignics test case part one --- xCAT-test/autotest/testcase/confignics/cases0 | 262 ++++++++++++++++++ 1 file changed, 262 insertions(+) create mode 100644 xCAT-test/autotest/testcase/confignics/cases0 diff --git a/xCAT-test/autotest/testcase/confignics/cases0 b/xCAT-test/autotest/testcase/confignics/cases0 new file mode 100644 index 000000000..2558776c7 --- /dev/null +++ b/xCAT-test/autotest/testcase/confignics/cases0 @@ -0,0 +1,262 @@ +start:confignics_config_one_port_single_value +description:confignics +cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=100.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=100_1_0_0-255_255_0_0 +check:rc==0 +cmd:updatenode $$CN -P confignics +check:rc==0 +cmd:xdsh $$CN ifconfig +check:output=~100.1.0.100 +cmd:xdsh $$CN netstat -rn +check:output=~100.1.0.0 +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +check:output=~100.1.0.100 +check:output!~dhcp +cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 +cmd:xdsh $$CN ifdown $$SECONDNIC +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +end + +start:confignics_config_multiple_ports_single_value +description:confignics +cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 200_1_0_0-255_255_0_0 net=200.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=100.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=100_1_0_0-255_255_0_0 +check:rc==0 +cmd:chdef $$CN nicips.$$THIRDNIC=200.1.0.100 nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC=200_1_0_0-255_255_0_0 +check:rc==0 +cmd:updatenode $$CN -P confignics +check:rc==0 +cmd:xdsh $$CN ifconfig +check:output=~100.1.0.100 +check:output=~200.1.0.100 +cmd:xdsh $$CN netstat -rn +check:output=~100.1.0.0 +check:output=~200.1.0.0 +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +check:output=~100.1.0.100 +check:output!~dhcp +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi +check:output=~200.1.0.100 +check:output!~dhcp +cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 200_1_0_0-255_255_0_0 +cmd:xdsh $$CN ifdown $$SECONDNIC +cmd:xdsh $$CN ifdown $$THIRDNIC +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi +end + +start:confignics_config_multiple_ports_multiple_value +description:confignics +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +check:rc==0 +cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" +check:rc==0 +cmd:chdef $$CN nicips.$$THIRDNIC="13.1.0.100|14.1.0.100" nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC="13_1_0_0-255_255_0_0|14_1_0_0-255_255_0_0" +check:rc==0 +cmd:updatenode $$CN -P confignics +check:rc==0 +cmd:xdsh $$CN ifconfig +check:output=~11.1.0.100 +check:output=~12.1.0.100 +check:output=~13.1.0.100 +check:output=~14.1.0.100 +cmd:xdsh $$CN netstat -rn +check:output=~11.1.0.0 +check:output=~12.1.0.0 +check:output=~13.1.0.0 +check:output=~14.1.0.0 +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +check:output=~11.1.0.100 +check:output!~dhcp +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi +check:output=~12.1.0.100 +check:output!~dhcp +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi +check:output=~13.1.0.100 +check:output!~dhcp +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC:1; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1; fi +check:output=~14.1.0.100 +check:output!~dhcp +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 +cmd:xdsh $$CN ifdown $$SECONDNIC +cmd:xdsh $$CN ifdown $$THIRDNIC +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1; fi +end + +start:confignics_config_multiple_port_withnichostnamesuffixes_multiple_value +description:confignics +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +check:rc==0 +cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nichostnamesuffixes.$$SECONDNIC="-$$SECONDNIC-1|-$$SECONDNIC-2" +check:rc==0 +cmd:chdef $$CN nicips.$$THIRDNIC="13.1.0.100|14.1.0.100" nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC="13_1_0_0-255_255_0_0|14_1_0_0-255_255_0_0" nichostnamesuffixes.$$THIRDNIC="-$$THIRDNIC-1|-$$THIRDNIC-2" +check:rc==0 +cmd:cp /etc/hosts /etc/hosts.backup +cmd:rc==0 +cmd:makehosts $$CN +check:rc==0 +cmd:cat /etc/hosts +check:output=~$$CN-$$SECONDNIC-1 +check:output=~$$CN-$$SECONDNIC-2 +check:output=~$$CN-$$THIRDNIC-1 +check:output=~$$CN-$$THIRDNIC-2 +cmd:updatenode $$CN -P confignics +check:rc==0 +cmd:xdsh $$CN ifconfig +check:output=~11.1.0.100 +check:output=~12.1.0.100 +check:output=~13.1.0.100 +check:output=~14.1.0.100 +cmd:xdsh $$CN netstat -rn +check:output=~11.1.0.0 +check:output=~12.1.0.0 +check:output=~13.1.0.0 +check:output=~14.1.0.0 +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +check:output=~11.1.0.100 +check:output!~dhcp +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi +check:output=~12.1.0.100 +check:output!~dhcp +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi +check:output=~13.1.0.100 +check:output!~dhcp +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC:1; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1; fi +check:output=~14.1.0.100 +check:output!~dhcp +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 +cmd:xdsh $$CN ifdown $$SECONDNIC +cmd:xdsh $$CN ifdown $$THIRDNIC +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1; fi +cmd:cp /etc/hosts.backup /etc/hosts +end + +start:confignics_config_multiple_port_withnicaliases_multiple_value +description:confignics +cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 12_1_0_0-255_255_0_0 net=12.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:mkdef -t network -o 13_1_0_0-255_255_0_0 net=13.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +check:rc==0 +cmd:mkdef -t network -o 14_1_0_0-255_255_0_0 net=14.1.0.0 mask=255.255.0.0 mgtifname=$$THIRDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC="11.1.0.100|12.1.0.100" nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC="11_1_0_0-255_255_0_0|12_1_0_0-255_255_0_0" nicaliases.$$SECONDNIC="aliases1-1|aliases1-2" +check:rc==0 +cmd:chdef $$CN nicips.$$THIRDNIC="13.1.0.100|14.1.0.100" nictypes.$$THIRDNIC=Ethernet nicnetworks.$$THIRDNIC="13_1_0_0-255_255_0_0|14_1_0_0-255_255_0_0" nicaliases.$$THIRDNIC="aliases2-1|aliases2-2" +check:rc==0 +cmd:makehosts $$CN +check:rc==0 +cmd:cat /etc/hosts +check:output=~aliases1-1 +check:output=~aliases1-2 +check:output=~aliases2-1 +check:output=~aliases2-2 +cmd:updatenode $$CN -P confignics +check:rc==0 +cmd:xdsh $$CN ifconfig +check:output=~11.1.0.100 +check:output=~12.1.0.100 +check:output=~13.1.0.100 +check:output=~14.1.0.100 +cmd:xdsh $$CN netstat -rn +check:output=~11.1.0.0 +check:output=~12.1.0.0 +check:output=~13.1.0.0 +check:output=~14.1.0.0 +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +check:output=~11.1.0.100 +check:output!~dhcp +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi +check:output=~12.1.0.100 +check:output!~dhcp +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi +check:output=~13.1.0.100 +check:output!~dhcp +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$THIRDNIC:1; else xdsh $$CN cat /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1; fi +check:output=~14.1.0.100 +check:output!~dhcp +cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 +cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 +cmd:xdsh $$CN ifdown $$SECONDNIC +cmd:xdsh $$CN ifdown $$THIRDNIC +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC; fi +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$SECONDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$SECONDNIC:1; fi +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC; fi +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN rm -rf /etc/network/interfaces.d/$$THIRDNIC:1; else xdsh $$CN rm -rf /etc/sysconfig/network*/ifcfg-$$THIRDNIC:1; fi +end + +start:confignics_disable_set_to_yes +description:confignics +cmd:xdsh $$CN ifdown $$SECONDNIC +cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=100.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=100_1_0_0-255_255_0_0 +check:rc==0 +cmd:chtab node=$$CN nics.disable=yes +check:rc==0 +cmd:updatenode $$CN -P confignics +check:rc==0 +cmd:xdsh $$CN ifconfig +check:output!~100.1.0.100 +cmd:xdsh $$CN netstat -rn +check:output!~100.1.0.0 +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC; fi +check:output!~100.1.0.100 +cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 +cmd:chtab node=$$CN nics.disable=0 +end + +start:confignics_disable_set_to_1 +description:confignics +cmd:xdsh $$CN ifdown $$SECONDNIC +cmd:mkdef -t network -o 100_1_0_0-255_255_0_0 net=100.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC +check:rc==0 +cmd:chdef $$CN nicips.$$SECONDNIC=100.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=100_1_0_0-255_255_0_0 +check:rc==0 +cmd:chtab node=$$CN nics.disable=1 +check:rc==0 +cmd:updatenode $$CN -P confignics +check:rc==0 +cmd:xdsh $$CN ifconfig +check:output!~100.1.0.100 +cmd:xdsh $$CN netstat -rn +check:output!~100.1.0.0 +cmd:if [ "$OS" = "ubuntu" ];then xdsh $$CN cat /etc/network/interfaces.d/$$SECONDNIC; else xdsh $$CN cat /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC; fi +check:output!~100.1.0.100 +cmd:rmdef -t network -o 100_1_0_0-255_255_0_0 +cmd:chtab node=$$CN nics.disable=0 +end + + From af6b21edb072ba543e55a725e1e166eef32b8574 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Tue, 17 Sep 2013 00:48:22 -0700 Subject: [PATCH 128/184] bug 3763:write install nics's configuration file --- xCAT/postscripts/configeth | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index b17a92779..f3e03aefe 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -408,6 +408,11 @@ elif [ "$1" = "-s" ];then str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` fi fi + if [ -n "$MACADDRESS" ];then + str_inst_mac=$MACADDRESS + else + str_inst_mac=`ifconfig $str_inst_nic | grep HWaddr | awk -F'HWaddr' '{print $2}' | sed 's/\s*//'` + fi if [ -z "$str_inst_ip" -o -z "$str_inst_mask" ];then logger -t xcat -p local4.err "configeth: config install nic, can not find the information from lease file, return." @@ -421,6 +426,7 @@ elif [ "$1" = "-s" ];then echo "iface ${str_inst_nic} inet static" >> $str_conf_file echo " address ${str_inst_ip}" >> $str_conf_file echo " netmask ${str_inst_mask}" >> $str_conf_file + echo " hwaddress ether ${str_inst_mac}" >> $str_conf_file if [ -n "$str_inst_gateway" ];then echo " gateway $str_inst_gateway" >> $str_conf_file fi @@ -432,6 +438,7 @@ elif [ "$1" = "-s" ];then echo "BOOTPROTO=static" >> $str_conf_file echo "IPADDR=${str_inst_ip}" >> $str_conf_file echo "NETMASK=${str_inst_mask}" >> $str_conf_file + echo "HWADDR=${str_inst_mac}" >> $str_conf_file echo "STARTMODE=onboot" >> $str_conf_file if [ -n "$str_inst_gateway" ];then grep -i "default" /etc/sysconfig/network/routes @@ -451,6 +458,7 @@ elif [ "$1" = "-s" ];then echo "NETMASK=${str_inst_mask}" >> $str_conf_file echo "BOOTPROTO=static" >> $str_conf_file echo "ONBOOT=yes" >> $str_conf_file + echo "HWADDR=${str_inst_mac}" >> $str_conf_file if [ -n "$str_inst_gateway" ];then grep -i "GATEWAY" /etc/sysconfig/network if [ $? -eq 0 ];then From 74d5d437d5958b9fe1b7d33d5ae5ed0b0671f474 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Tue, 17 Sep 2013 07:18:22 -0700 Subject: [PATCH 129/184] enhancement of supporting partition on IBM power 7R1/7R2 machines. --- perl-xCAT/xCAT/FSPvm.pm | 278 +++++++++++++++++++++++-------- perl-xCAT/xCAT/Schema.pm | 4 +- perl-xCAT/xCAT/Usage.pm | 15 +- xCAT-client/pods/man1/chvm.1.pod | 89 ++++++++-- xCAT-client/pods/man1/lsvm.1.pod | 67 ++++---- xCAT-client/pods/man1/mkvm.1.pod | 77 +++++++-- xCAT-client/pods/man1/rmvm.1.pod | 19 ++- 7 files changed, 402 insertions(+), 147 deletions(-) diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index 9fe608e91..09b885a7f 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -51,6 +51,8 @@ sub parse_args { sub chvm_parse_extra_options { my $args = shift; my $opt = shift; + # Partition used attributes # + my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting); if (ref($args) ne 'ARRAY') { return "$args"; } @@ -71,7 +73,20 @@ sub chvm_parse_extra_options { # if ($value !~ /^\d+\/\d+\/\d+$/) { # return "'$value' invalid"; # } - } else { + } elsif (grep(/^$cmd$/, @support_ops)) { + if (exists($opt->{p775})) { + return "'$cmd' doesn't work for Power 775 machines."; + } elsif ($cmd eq "vmothersetting") { + if ($value =~ /hugepage:\s*(\d+)/i) { + $opt->{huge_page} = $1; + } + if ($value =~ /bsr:\s*(\d+)/i) { + $opt->{bsr} = $1; + } + next; + } + + } else { return "'$cmd' not support"; } $opt->{$cmd} = $value; @@ -109,7 +124,7 @@ sub chvm_parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose p=s i=s m=s r=s ) )) { + if ( !GetOptions( \%opt, qw(V|verbose p=s i=s m=s r=s p775) )) { return( usage() ); } #################################### @@ -126,8 +141,11 @@ sub chvm_parse_args { # return(usage( "Configuration file or attributes not specified" )); # } #} - + if (exists($opt{p775})) { my @cfgdata ; + if ((exists ($opt{p}) || defined($request->{stdin})) && !exists($opt{p775}) ) { + return(usage("Profile just work for Power 775")); + } if ( exists( $opt{p})) { if ( exists( $opt{i} ) || exists( $opt{r}) || exists( $opt{m} ) ) { @@ -302,6 +320,7 @@ sub chvm_parse_args { $request->{node} = [$other_p]; $request->{noderange} = $other_p; } + } #################################### # Check for an extra argument #################################### @@ -347,21 +366,23 @@ sub mkvm_parse_args { ############################################# # Process command-line arguments ############################################# - if ( !defined( $args )) { - return(usage( "No command specified" )); - } + #if ( !defined( $args )) { + # return(usage( "No command specified" )); + #} ############################################# # Checks case in GetOptions, allows opts # to be grouped (e.g. -vx), and terminates # at the first unrecognized option. ############################################# - @ARGV = @$args; + if (defined($args)) { + @ARGV = @$args; + } $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); -# if ( !GetOptions( \%opt, qw(V|verbose ibautocfg ibacap=s i=s l=s c=s p=s full) )) { +# if ( !GetOptions( \%opt, qw(V|verbose ibautocfg ibacap=s i=s l=s c=s p=s m=s r=s full) )) { # return( usage() ); # } - if ( !GetOptions( \%opt, qw(V|verbose i=s m=s r=s full part vios) )) { + if ( !GetOptions( \%opt, qw(V|verbose full vios) )) { return( usage() ); } #################################### @@ -370,7 +391,37 @@ sub mkvm_parse_args { if ( grep(/^-$/, @ARGV )) { return(usage( "Missing option: -" )); } + if (!exists($opt{p775})) { + my @unsupport_ops = (); + foreach my $tmpop (keys %opt) { + if ($tmpop !~ /full|vios|V/) { + push @unsupport_ops, $tmpop; + } + } + my @support_ops = qw(vmcpus vmmemory vmphyslots vmothersetting); + if (defined(@ARGV[0]) and defined($opt{full})) { + return(usage("Option 'full' shall be used alone.")); + } elsif (defined(@ARGV[0])) { + foreach my $arg (@ARGV) { + my ($cmd,$val) = split (/=/,$arg); + if (!grep(/^$cmd$/, @support_ops)) { + push @unsupport_ops, $cmd; + } elsif (!defined($val)) { + return(usage("The option $cmd need specific parameters.")); + } else { + $opt{$cmd} = $val; + } + } + } + if (@unsupport_ops) { + my $tmpops = join(",",@unsupport_ops); + return(usage( "The options $tmpops can only work(s) with Power 775 machines.")); + } + } else { + if (exists($opt{full}) or exists($opt{vios})) { + return(usage( "Option 'p775' only works for Power 775 machines.")); + } #################################### # Check for non-zero integer #################################### @@ -408,7 +459,7 @@ sub mkvm_parse_args { } else { return(usage( "Invalid entry: $opt{m}.\n For Power 775, the pending memory interleaving mode only could be interleaved(or 1), or non-interleaved(or 2)." )); } - } elsif (!exists($opt{full}) && !exists($opt{part}) && !exists($opt{vios})){ + } elsif (exists($opt{p775})){ $opt{m} = 2 ;# non-interleaved, which is the default } @@ -467,10 +518,10 @@ sub mkvm_parse_args { } #end of if - if ( (!exists( $opt{i} ) || !exists( $opt{r} )) && !exists($opt{full}) && !exists($opt{part}) && !exists($opt{vios})) { + if ( (!exists( $opt{i} ) || !exists( $opt{r} )) ) { return(usage()); } - + } $opt{target} = \@{$request->{node}}; my $ppctab = xCAT::Table->new( 'ppc'); unless($ppctab) { @@ -495,7 +546,7 @@ sub mkvm_parse_args { return(usage("For Power 775, please make sure the noderange are in one CEC ")); } } - if (!exists($opt{full}) && !exists($opt{part}) &&!exists($opt{vios})) { + if (exists($opt{p775})) { $request->{node} = [$other_p]; $request->{noderange} = $other_p; } @@ -541,11 +592,11 @@ sub rmvm_parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose service r p|part) )) { + if ( !GetOptions( \%opt, qw(V|verbose service r p775) )) { return( usage() ); } - if (!exists($opt{p})) { + if (exists($opt{p775})) { return(usage( "rmvm doesn't support for Power 775." )); } @@ -602,9 +653,12 @@ sub lsvm_parse_args { $Getopt::Long::ignorecase = 0; Getopt::Long::Configure( "bundling" ); - if ( !GetOptions( \%opt, qw(V|verbose l|long p|part) )) { + if ( !GetOptions( \%opt, qw(V|verbose l|long p775) )) { return( usage() ); } + if (exists($opt{l}) && !exists($opt{p775})) { + return(usage( "option 'l' only works for Power 775")); + } #################################### # Check for "-" with no option #################################### @@ -632,8 +686,9 @@ sub modify { my $request = shift; my $hash = shift; my $usage_string = xCAT::Usage->getUsage($request->{command}); - return modify_by_prof( $request, $hash) if ( $request->{opt}->{p} || $request->{stdin}); - return create( $request, $hash) if ( $request->{opt}->{i}); + return modify_by_prof( $request, $hash) if ( exists($request->{opt}->{p775}) and ($request->{opt}->{p} || $request->{stdin})); + return create( $request, $hash) if ( exists($request->{opt}->{p775}) and $request->{opt}->{i}); + return op_extra_cmds ($request, $hash) if (!exists($request->{opt}->{p775})); return op_extra_cmds ($request, $hash) if ($request->{opt}->{lparname} || $request->{opt}->{huge_page}); return ([["Error", "Miss argument\n".$usage_string, 1]]); } @@ -641,26 +696,72 @@ sub do_op_extra_cmds { my $request = shift; my $hash = shift; my @values = (); - my $action; - my $param; - if (exists($request->{opt}->{lparname})) { - $action = "set_lpar_name"; - $param = $request->{opt}->{lparname}; - } elsif (exists($request->{opt}->{huge_page})) { - $action = "set_huge_page"; - $param = $request->{opt}->{huge_page}; - } - my $lparname_para = $request->{opt}->{lparname}; + while (my ($mtms, $h) = each(%$hash)) { + my $memhash; while (my($name, $d) = each(%$h)) { - my $tmp_value = ($param eq '*') ? $name : $param; - xCAT::MsgUtils->verbose_message($request, "$request->{command} $action for node:$name, parm:$tmp_value."); - my $value = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action, 0, $tmp_value); - if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) { - return ([[$name, @$value[1], '1']]) ; - } else { - push @values, [$name, "Success", '0']; - } + foreach my $op (keys %{$request->{opt}}) { + my $action; + my $param = $request->{opt}->{$op}; + if ($op eq "lparname") { + $action = "set_lpar_name"; + } elsif ($op eq "huge_page") { + $action = "set_huge_page"; + } elsif ($op eq "vmcpus") { + $action = "part_set_lpar_pending_proc"; + } elsif ($op eq "vmphyslots") { + $action = "set_io_slot_owner_uber"; + } elsif ($op eq "vmmemory") { + my @td = @$d; + @td[0] = 0; + $memhash = &query_cec_info_actions($request, $name, \@td, 1, ["part_get_hyp_process_and_mem"]); + if (!exists($memhash->{run})) { + if ($param =~ /(\d+)([G|M]?)\/(\d+)([G|M]?)\/(\d+)([G|M]?)/i) { + my $memsize = $memhash->{mem_region_size}; + my $min = $1; + if ($2 == "G" or $2 == '') { + $min = $min * 1024; + } + $min = $min/$memsize; + my $cur = $3; + if ($4 == "G" or $4 == '') { + $cur = $cur * 1024; + } + $cur = $cur/$memsize; + my $max = $5; + if ($6 == "G" or $6 == '') { + $max = $max * 1024; + } + $max = $max/$memsize; + $request->{opt}->{$op} ="$min/$cur/$max"; + $param = $request->{opt}->{$op}; + } else { + return([[$name, "The format of param:$param is incorrect.", 1]]); + } + $memhash->{run} = 1; + } + $memhash->{memory} = $param; + $memhash->{lpar_used_regions} = 0; + my $ret = &deal_with_avail_mem($request, $name, $d, $memhash); + if (ref($ret) eq "ARRAY") { + return ([[@$ret]]); + } + $param = $memhash->{memory}; + $action = "part_set_lpar_pending_mem"; + } elsif ($op eq "bsr") { + $action = "set_lpar_bsr"; + } else { + last; + } + my $tmp_value = ($param eq '*') ? $name : $param; + xCAT::MsgUtils->verbose_message($request, "$request->{command} $action for node:$name, parm:$tmp_value."); + my $value = xCAT::FSPUtils::fsp_api_action($request, $name, $d, $action, 0, $tmp_value); + if (@$value[1] && ((@$value[1] =~ /Error/i) && (@$value[2] ne '0'))) { + return ([[$name, @$value[1], '1']]) ; + } else { + push @values, [$name, "Success", '0']; + } + } } } return \@values; @@ -1459,7 +1560,7 @@ sub parse_part_get_info { $hash->{process_units_avail} = $2; } elsif ($line =~ /Authority Lpar id:(\w+)/i) { $hash->{service_lparid} = $1; - } elsif ($line =~ /(\d+),(\d+),[^,]*,(\w+),[^,]*,[^,]*,\w*\(([\w| |-|_]*)\)/) { + } elsif ($line =~ /(\d+),(\d+),[^,]*,(\w+),\w*\(([\w| |-|_]*)\)/) { $hash->{bus}->{$3}->{cur_lparid} = $1; $hash->{bus}->{$3}->{bus_slot} = $2; $hash->{bus}->{$3}->{des} = $4; @@ -1471,10 +1572,15 @@ sub parse_part_get_info { #$hash->{logic_drc_phydrc}->{$5}->{$1} = [$2,$3,$4]; } #} elsif ($line =~ /lpar 0:: Curr Memory::min: 1,cur: (\d+),max:/i) { - } elsif ($line =~ /HYP Reserved Memory Regions:(\d+), Min Required Regions:(\d+)/i) { - $hash->{lpar0_used_mem} = $1; - $hash->{phy_min_mem_req} = $2; + } elsif ($line =~ /HYP Reserved Memory Regions:([-]?)(\d+), Min Required Regions:(\d+)/i) { + if ($1 eq '-') { + $hash->{lpar0_used_dec} = 1; + } + $hash->{lpar0_used_mem} = $2; + $hash->{phy_min_mem_req} = $3; #print "===>lpar0_used_mem:$hash->{lpar0_used_mem}.\n"; + } elsif ($line =~ /Curr Memory Req:[^\(]*\((\d+)\s*regions\)/) { + $hash->{lpar_used_regions} = $1; } elsif ($line =~ /Available huge page memory\(in pages\):\s*(\d+)/) { $hash->{huge_page_avail} = $1; } elsif ($line =~ /Available BSR array:\s*(\d+)/) { @@ -1501,7 +1607,8 @@ sub query_cec_info_actions { #$data .= "======> ret info for $action:\n"; my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $td, $action); chomp(@$values[1]); - if ($action eq "part_get_partition_cap" and (@$values[1] =~ /Error:/i or @$values[2] ne 0)) { + #if ($action eq "part_get_partition_cap" and (@$values[1] =~ /Error:/i or @$values[2] ne 0)) { + if (@$values[1] =~ /Error:/i or @$values[2] ne 0) { return ([[@$values]]); } if (@$values[1] =~ /^$/) { @@ -1629,21 +1736,38 @@ sub deal_with_avail_mem { my $max_required_regions; if ($lparhash->{memory} =~ /(\d+)\/(\d+)\/(\d+)/) { my ($min,$cur,$max); + my $used_regions = 0; + my $cur_avail = 0; $min = $1; $cur = $2; $max = $3; - my $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_get_hyp_res_mem_regions", 0, $3); my %tmphash; + my $values; + if (exists($lparhash->{lpar_used_regions})) { + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_get_lpar_memory"); + &parse_part_get_info(\%tmphash, @$values[1]); + if (exists($tmphash{lpar_used_regions})) { + $used_regions = $tmphash{lpar_used_regions}; + } + } + $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_get_hyp_res_mem_regions", 0, $3); &parse_part_get_info(\%tmphash, @$values[1]); if (exists($tmphash{lpar0_used_mem}) && exists($tmphash{phy_min_mem_req})) { if ($min < $tmphash{phy_min_mem_req}) { $min = $tmphash{phy_min_mem_req}; } - if ($lparhash->{hyp_avail_mem} - $tmphash{lpar0_used_mem} < $min) { - return([$name, "Parse reserverd regions failed, no enough memory, availe:$lparhash->{hyp_avail_mem}.", 1]); - } - if ($cur > $lparhash->{hyp_avail_mem} - $tmphash{lpar0_used_mem}) { - my $new_cur = $lparhash->{hyp_avail_mem} - $tmphash{lpar0_used_mem}; + + if (exists($lparhash->{lpar0_used_dec})) { + $cur_avail = $lparhash->{hyp_avail_mem} + $used_regions + $tmphash{lpar0_used_mem}; + } else { + $cur_avail = $lparhash->{hyp_avail_mem} + $used_regions - $tmphash{lpar0_used_mem}; + } + xCAT::MsgUtils->verbose_message($request, "====****====used:$used_regions,avail:$cur_avail,($min:$cur:$max)."); + if ($cur_avail < $min) { + return([$name, "Parse reserverd regions failed, no enough memory, available:$lparhash->{hyp_avail_mem}.", 1]); + } + if ($cur > $cur_avail) { + my $new_cur = $cur_avail; $lparhash->{memory} = "$min/$new_cur/$max"; } } else { @@ -1669,7 +1793,7 @@ sub create_lpar { } $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_lpar_name", 0, $name); if (@$values[2] ne 0) { - $values = &set_lpar_undefined($request, $name, $d); + &set_lpar_undefined($request, $name, $d); return ([$name, @$values[1], @$values[0]]); } xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_shared_pool_util_auth"); @@ -1679,7 +1803,7 @@ sub create_lpar { $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner_uber", 0, $lparhash->{physlots}); #$values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "set_io_slot_owner", 0, join(",",@phy_io_array)); if (@$values[2] ne 0) { - $values = &set_lpar_undefined($request, $name, $d); + &set_lpar_undefined($request, $name, $d); return ([$name, @$values[1], @$values[2]]); } if (exists($lparhash->{phy_hea})) { @@ -1707,7 +1831,7 @@ sub create_lpar { #print "======>cpus:$lparhash->{cpus}.\n"; $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_proc", 0, $lparhash->{cpus}); if (@$values[2] ne 0) { - $values = &set_lpar_undefined($request, $name, $d); + &set_lpar_undefined($request, $name, $d); return ([$name, @$values[1], @$values[2]]); } $values = &deal_with_avail_mem($request, $name, $d,$lparhash); @@ -1719,7 +1843,7 @@ sub create_lpar { #print "======>memory:$lparhash->{memory}.\n"; $values = xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_pending_mem", 0, $lparhash->{memory}); if (@$values[2] ne 0) { - $values = &set_lpar_undefined($request, $name, $d); + &set_lpar_undefined($request, $name, $d); return ([$name, @$values[1], @$values[2]]); } xCAT::FSPUtils::fsp_api_action($request, $name, $d, "part_set_lpar_comp_modes"); @@ -1742,6 +1866,7 @@ sub create_lpar { sub mkspeclpar { my $request = shift; my $hash = shift; + my $opt = $request->{opt}; my $values; my @result = (); my $vmtab = xCAT::Table->new( 'vm'); @@ -1760,25 +1885,37 @@ sub mkspeclpar { $memhash->{run} = 1; } my $tmp_ent = $ent->{$name}->[0]; + if (exists($opt->{vmcpus})) { + $tmp_ent->{cpus} = $opt->{vmcpus}; + } + if (exists($opt->{vmmemory})) { + $tmp_ent->{memory} = $opt->{vmmemory}; + } + if (exists($opt->{vmphyslots})) { + $tmp_ent->{physlots} = $opt->{vmphyslots}; + } + if (exists($opt->{vmothersetting})) { + $tmp_ent->{othersettings} = $opt->{vmothersetting}; + } if (!defined($tmp_ent) ) { return ([[$name, "Not find params", 1]]); } elsif (!exists($tmp_ent->{cpus}) || !exists($tmp_ent->{memory}) || !exists($tmp_ent->{physlots})) { return ([[$name, "The attribute 'vmcpus', 'vmmemory' and 'vmphyslots' are all needed to be specified.", 1]]); } - if ($tmp_ent->{memory} =~ /(\d+)(G|M)\/(\d+)(G|M)\/(\d+)(G|M)/i) { + if ($tmp_ent->{memory} =~ /(\d+)([G|M]?)\/(\d+)([G|M]?)\/(\d+)([G|M]?)/i) { my $memsize = $memhash->{mem_region_size}; my $min = $1; - if ($2 == "G") { + if ($2 == "G" or $2 == '') { $min = $min * 1024; } $min = $min/$memsize; my $cur = $3; - if ($4 == "G") { + if ($4 == "G" or $4 == '') { $cur = $cur * 1024; } $cur = $cur/$memsize; my $max = $5; - if ($6 == "G") { + if ($6 == "G" or $6 == '') { $max = $max * 1024; } $max = $max/$memsize; @@ -1858,17 +1995,14 @@ sub mkvm { # decide if issuing mkvm with the option '-f'. # if yes, mklpar will be invoked to # create a full system partition for each CECs managed by the HMC. - if ( exists($opt->{full})) { - return( mkfulllpar(@_) ); - } elsif (exists($opt->{part})){ - return (mkspeclpar(@_)); - } elsif (exists($opt->{vios})) { - return (mkspeclpar(@_)); - } - else { - # if no, it will execute the original function. - return( create(@_) ); - } + if (exists($opt->{p775})) { + return (create(@_)); + } + if (exists($opt->{full})) { + return (mkfulllpar(@_)); + } else { + return (mkspeclpar(@_)); + } } ########################################################################## @@ -1885,10 +2019,10 @@ sub chvm { sub rmvm { my $request = $_[0]; my $opt = $request->{opt}; - if (exists($opt->{p})) { - return( remove(@_) ); - } else { + if (exists($opt->{p775})) { return ([["lpar","rmvm only support Power Partitioning.", 1]]); + } else { + return( remove(@_) ); } # return( remove(@_) ); } @@ -1900,10 +2034,10 @@ sub lsvm { my $request = shift; my $hash = shift; my $args = $request->{opt}; - if (exists($args->{p})) { - return (query_cec_info($request, $hash)); - } else { + if (exists($args->{p775})) { return( list($request, $hash) ); + } else { + return (query_cec_info($request, $hash)); } } diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 76399856f..a14b958eb 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -222,13 +222,13 @@ vm => { 'vncport' => 'Tracks the current VNC display port (currently not meant to be set', 'textconsole' => 'Tracks the Psuedo-TTY that maps to the serial port or console of a VM', 'powerstate' => "This flag is used by xCAT to track the last known power state of the VM.", - 'othersettings' => "This allows specifying a semicolon delimited list of key->value pairs to include in a vmx file of VMware.", + 'othersettings' => "This allows specifying a semicolon delimited list of key->value pairs to include in a vmx file of VMware. For partitioning on normal power machines, this option is used to specify the hugepage and/or bsr information, the value is like:'hugepage:1,bsr=2'.", 'guestostype' => "This allows administrator to specify an identifier for OS to pass through to virtualization stack. Normally this should be ignored as xCAT will translate from nodetype.os rather than requiring this field be used\n", 'beacon' => "This flag is used by xCAT to track the state of the identify LED with respect to the VM.", 'datacenter' => "Optionally specify a datacenter for the VM to exist in (only applicable to VMWare)", 'cluster' => 'Specify to the underlying virtualization infrastructure a cluster membership for the hypervisor.', 'vidproto' => "Request a specific protocol for remote video access be set up. For example, spice in KVM.", - 'physlots' => "Specify the physical slots drc index that will assigned to the partition, the delimiter is ',', and the drc index must started with '0x'.", + 'physlots' => "Specify the physical slots drc index that will assigned to the partition, the delimiter is ',', and the drc index must started with '0x'. For more details, please reference to manpage of 'lsvm'.", 'vidmodel' => "Model of video adapter to provide to guest. For example, qxl in KVM", 'vidpassword' => "Password to use instead of temporary random tokens for VNC and SPICE access", 'storagecache' => "Select caching scheme to employ. E.g. KVM understands 'none', 'writethrough' and 'writeback'", diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 2c63c3726..3c7ce0038 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -204,7 +204,9 @@ my %usage = ( mkvm noderange -c destcec -p profile [-V|--verbose] mkvm noderange --full [-V|--verbose] PPC (using Direct FSP Management) specific: - mkvm noderange <--full|--part> + mkvm noderange [--full] + mkvm noderange [vmcpus=min/req/max] [vmmemory=min/req/max] + [vmphyslots=drc_index1,drc_index2...] [vmothersetting=hugepage:N,bsr:N] For KVM mkvm noderange -m|--master mastername -s|--size disksize -f|--force For zVM @@ -218,7 +220,8 @@ my %usage = ( PPC (with HMC) specific: lsvm [-a|--all] PPC (using Direct FSP Management) specific: - lsvm [-l|--long] [-p|--part] + lsvm [-l|--long] --p775 + lsvm zVM specific: lsvm noderange lsvm noderange --getnetworknames @@ -233,9 +236,11 @@ my %usage = ( chvm [-p profile][-V|--verbose] chvm = [=...] PPC (using Direct FSP Management) specific: - chvm [-p ] + chvm --p775 [-p ] + chvm --p775 -i [-m ] -r chvm [lparname=<*|name>] - chvm -i [-m ] -r + chvm [vmcpus=min/req/max] [vmmemory=min/req/max] + [vmphyslots=drc_index1,drc_index2...] [vmothersetting=hugepage:N,bsr:N] VMware specific: chvm [-a size][-d disk][-p disk][--resize disk=size][--cpus count][--mem memory] zVM specific: @@ -268,7 +273,7 @@ my %usage = ( rmvm [-h|--help|-v|--version], rmvm [-p] [-f] PPC (using Direct FSP Management) specific: - rmvm [-p|--part]", + rmvm ", "lsslp" => "Usage: lsslp [-h|--help|-v|--version] lsslp [][-V|--verbose][-i ip[,ip..]][-w][-r|-x|-z][-n][-I][-s FRAME|CEC|MM|IVM|RSA|HMC|CMM|IMM2|FSP] diff --git a/xCAT-client/pods/man1/chvm.1.pod b/xCAT-client/pods/man1/chvm.1.pod index a47894985..664a5cfc6 100644 --- a/xCAT-client/pods/man1/chvm.1.pod +++ b/xCAT-client/pods/man1/chvm.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Changes HMC-, IVM-, and zVM-managed partition profiles or virtual machines. For Power 775, chvm could be used to change the octant configuration values for generating LPARs; change the I/O slots assignment to LPARs within the same CEC. +B - Changes HMC-, DFM-, IVM-, and zVM-managed partition profiles or virtual machines. For Power 775, chvm could be used to change the octant configuration values for generating LPARs; change the I/O slots assignment to LPARs within the same CEC. =head1 SYNOPSIS @@ -16,11 +16,14 @@ B [B<-V>| B<--verbose>] I I=I [I=I...] =head2 PPC (using Direct FSP Management) specific: -B I [B<-p> I] +B I I<--p775> [B<-p> I] + +B I I<--p775> B<-i id> [B<-m> I] B<-r> I B I [B={B<*>|B}] -B I B<-i id> [B<-m> I] B<-r> I +B I [B] [B] + [B] [B] =head2 VMware/KVM specific: @@ -98,12 +101,18 @@ This command also supports to change specific partition attributes by specifying =head2 PPC (using Direct FSP Management) specific: +For Power 755(use option I<--p775> to specify): + chvm could be used to change the octant configuration values for generating LPARs. chvm is designed to set the Octant configure value to split the CPU and memory for partitions, and set Octant Memory interleaving value. The chvm will only set the pending attributes value. After chvm, the CEC needs to be rebooted manually for the pending values to be enabled. Before reboot the cec, the administrator can use chvm to change the partition plan. If the the partition needs I/O slots, the administrator should use chvm to assign the I/O slots. chvm is also designed to assign the I/O slots to the new LPAR. Both the current IO owning lpar and the new IO owning lpar must be powered off before an IO assignment. Otherwise, if the I/O slot is belonged to an Lpar and the LPAR is power on, the command will return an error when trying to assign that slot to a different lpar. The administrator should use lsvm to get the profile content, and then edit the content, and add the node name with ":" manually before the I/O which will be assigned to the node. And then the profile can be piped into the chvm command, or changed with the -p flag. +For normal power machine: + +chvm could be used to modify the resources assigned to partitions. The admin shall specify the attributes with options I, I, I and/or I. If nothing specified, nothing will be returned. + =head2 VMware/KVM specific: The chvm command modifes the vm specified in noderange. Calling with deregister or purge options at the same time as the resize option is not recommended. @@ -150,17 +159,21 @@ Verbose output. =over 10 +=item B<--p775> + +Specify the operation is for Power 775 machines. + =item B<-i> -Starting numeric id of the newly created partitions. For Power 775 using Direct FSP Management, the id value only could be B<1>, B<5>, B<9>, B<13>, B<17>, B<21>, B<25> and B<29>. +Starting numeric id of the newly created partitions. For Power 775 using Direct FSP Management, the id value only could be B<1>, B<5>, B<9>, B<13>, B<17>, B<21>, B<25> and B<29>. Shall work with option B<--p775>. =item B<-m> -memory interleaving. The setting value only could be B<1> or B<2>. B<2> means B mode (also 2MC mode), the memory cannot be shared across the processors in an octant. B<1> means B mode (also 8MC mode) , the memory can be shared. The default value is B<1> . +memory interleaving. The setting value only could be B<1> or B<2>. B<2> means B mode (also 2MC mode), the memory cannot be shared across the processors in an octant. B<1> means B mode (also 8MC mode) , the memory can be shared. The default value is B<1>. Shall work with option B<--p775>. =item B<-r> -partition rule. +partition rule. Shall work with option B<--p775>. If all the octants configuration value are same in one CEC, it will be " B<-r> B<0-7>:I" . @@ -176,12 +189,16 @@ The octants configuration value for one Octant could be B<1>, B<2>, B<3>, B<4>, =item B<-p> I -Name of I/O slots assignment profile. +Name of I/O slots assignment profile. Shall work with option B<--p775>. =item B={B<*>|B} Set LPAR name for the specified lpars. If '*' specified, it means to get names from xCAT database and then set them for the specified lpars. If a string is specified, it only supports single node and the string will be set for the specified lpar. The user can use lsvm to check the lparnames for lpars. +=item B B B B + +To specify the parameters that will be modified. + =back =head2 VMware/KVM specific: @@ -385,7 +402,7 @@ Output is similar to: then: - chvm lpar1 -i 1 -m 1 -r 0:1 + chvm lpar1 --p775 -i 1 -m 1 -r 0:1 Output is similar to: @@ -398,7 +415,7 @@ Output is similar to: then: - chvm lpar1-lpar8 -i 1 -m 1 -r 0-7:1 + chvm lpar1-lpar8 --p775 -i 1 -m 1 -r 0-7:1 Output is similar to: @@ -418,7 +435,7 @@ Output is similar to: then: - chvm lpar1-lpar9 -i 1 -m 1 -r 0:5,1-7:1 + chvm lpar1-lpar9 --p775 -i 1 -m 1 -r 0:5,1-7:1 Output is similar to: @@ -441,11 +458,11 @@ Output is similar to: then run the command: - cat /tmp/lparfile | chvm lpar4 + cat /tmp/lparfile | chvm lpar4 --p775 5. To change the I/O slot profile for lpar1-lpar8 using the configuration data in the file /tmp/lparfile. Users can use the output of lsvm.and remove the cec information, and modify the lpar id before each I/O, and run the command as following: - chvm lpar1-lpar8 -p /tmp/lparfile + chvm lpar1-lpar8 --p775 -p /tmp/lparfile 6. To change the LPAR name, enter: @@ -454,6 +471,52 @@ then run the command: Output is similar to: lpar1: Success + +7. For Normal Power machine, to modify the resource assigned to a partition: + +Before modify, the resource assigned to node 'lpar1' can be shown with: + lsvm lpar1 + +The output is similar to: + + lpar1: Lpar Processor Info: + Curr Processor Min: 1. + Curr Processor Req: 4. + Curr Processor Max: 16. + lpar1: Lpar Memory Info: + Curr Memory Min: 1.00 GB(4 regions). + Curr Memory Req: 4.00 GB(16 regions). + Curr Memory Max: 32.00 GB(128 regions). + lpar1: 1,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0xc03(USB Controller) + lpar1: 1,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0x104(RAID Controller) + lpar1: 1/2/2 + lpar1: 128. + +To modify the resource assignment: + + chvm lpar1 vmcpus=1/2/16 vmmemory=1G/8G/32G vmphyslots=0x21010202 + +The output is similar to: + + lpar1: Success + +The resource information after modification is similar to: + + lpar1: Lpar Processor Info: + Curr Processor Min: 1. + Curr Processor Req: 2. + Curr Processor Max: 16. + lpar1: Lpar Memory Info: + Curr Memory Min: 1.00 GB(4 regions). + Curr Memory Req: 8.00 GB(32 regions). + Curr Memory Max: 32.00 GB(128 regions). + lpar1: 1,514,U78AA.001.WZSGVU7-P1-C19,0x21010202,0xffff(Empty Slot) + lpar1: 1,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0xc03(USB Controller) + lpar1: 1,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0x104(RAID Controller) + lpar1: 1/2/2 + lpar1: 128. + +Note: The physical I/O resources specified with I will be appended to the specified partition. The physical I/O resources which are not specified but belonged to the partition will not be removed. For more information about I, please refer to L. =head2 VMware/KVM specific: @@ -520,7 +583,7 @@ Output is similar to: Output is similar to: gpok3: Replacing user entry of LNX3... Done - + =head1 FILES /opt/xcat/bin/chvm diff --git a/xCAT-client/pods/man1/lsvm.1.pod b/xCAT-client/pods/man1/lsvm.1.pod index 24cb47d81..652c03721 100644 --- a/xCAT-client/pods/man1/lsvm.1.pod +++ b/xCAT-client/pods/man1/lsvm.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Lists partition profile information for HMC-, IVM-, KVM-, Vmware- and zVM-managed nodes. For Power 775, it lists the LPARs' I/O slots information and CEC configuration. +B - Lists partition profile information for HMC-, DFM-, IVM-, KVM-, Vmware- and zVM-managed nodes. For Power 775, it lists the LPARs' I/O slots information and CEC configuration. =head1 SYNOPSIS @@ -14,9 +14,9 @@ B [B<-a>| B<--all>] I =head2 For PPC (using Direct FSP Management): -B [B<-l>| B<--long>] I +B [B<-l>| B<--long>] B<--p775> I -B [B<-p>| B<--part>] I +B I =head2 For zVM: @@ -28,7 +28,9 @@ The lsvm command lists all partition profiles defined for the partitions specifi =head2 For PPC (using Direct FSP Management): -For Power 775, lsvm lists all partition I/O slots information for the partitions specified in noderange. If noderange is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information. +For Power 775(use option I<--p775> to specify), lsvm lists all partition I/O slots information for the partitions specified in noderange. If noderange is a CEC, it gets the CEC's pump mode value, octant's memory interleaving value, the all the octants configure value, and all the I/O slots information. + +For DFM-managed (short for Direct FSP Management mode) normal power machine, lsvm lists the processor, memory, physical I/O slots, hugepage and BSR info for the specified partitions or CEC. The pump mode value has the valid options: 1 - Node Pump Mode @@ -71,13 +73,13 @@ B<-a> List all the profiles for one partition +B<--p775> + +Specify the operation is for Power 775 machines. + B<-l> -Show lparnames for lpars. - -B<-p|--part> - -Show detailed information for lpars, such as processor, memory, physical IO slot, hugepage, BSR, etc. +Show lparnames for lpars. It shall work with option B<--p775>. =head1 RETURN VALUE @@ -107,7 +109,7 @@ g Output is similar to: 3. For Power 775, to list the I/O slot information of lpar1, enter: - lsvm lpar1 + lsvm lpar1 --p775 Output is similar to: @@ -117,7 +119,7 @@ Output is similar to: To list the lparname of lpars, enter: - lsvm lpar1 -l + lsvm lpar1 -l --p775 Output is similar to: lpar1: 1: 514/U78A9.001.0123456-P1-C17/0x21010202/2/1 @@ -126,7 +128,7 @@ Output is similar to: 4. For Power 775, to list the I/O slot information and octant configuration of cec1, enter: - lsvm cec1 + lsvm cec1 --p775 Output is similar to: @@ -159,7 +161,7 @@ Output is similar to: To list the lparname of lpars, enter: - lsvm cec1 -l + lsvm cec1 -l --p775 Output is similar to: @@ -212,9 +214,9 @@ Output is similar to: gpok3: INCLUDE LNXDFLT gpok3: COMMAND SET VSWITCH VSW2 GRANT LNX3 -6. For normal power machine, list out the detailed resource information: +6. For DFM-managed normal power machine, list out the detailed resource information: - lsvm cec -p + lsvm cec Output is similar to: @@ -223,13 +225,13 @@ Output is similar to: HYP Available Memory: 31.25 GB(125 regions). HYP Memory Region Size: 0.25 GB(256 MB). cec: All Physical I/O info: - 65535,519,U78AA.001.WZSGVU7-P1-C7,0x21010207,0,0,0xffff(Empty Slot) - 65535,518,U78AA.001.WZSGVU7-P1-C6,0x21010206,0,0,0xffff(Empty Slot) - 65535,517,U78AA.001.WZSGVU7-P1-C5,0x21010205,0,0,0xffff(Empty Slot) - 65535,516,U78AA.001.WZSGVU7-P1-C4,0x21010204,0,0,0xffff(Empty Slot) - 65535,514,U78AA.001.WZSGVU7-P1-C19,0x21010202,0,0,0xffff(Empty Slot) - 65535,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0,0,0xc03(USB Controller) - 65535,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0,0,0x104(RAID Controller) + 65535,519,U78AA.001.WZSGVU7-P1-C7,0x21010207,0xffff(Empty Slot) + 65535,518,U78AA.001.WZSGVU7-P1-C6,0x21010206,0xffff(Empty Slot) + 65535,517,U78AA.001.WZSGVU7-P1-C5,0x21010205,0xffff(Empty Slot) + 65535,516,U78AA.001.WZSGVU7-P1-C4,0x21010204,0xffff(Empty Slot) + 65535,514,U78AA.001.WZSGVU7-P1-C19,0x21010202,0xffff(Empty Slot) + 65535,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0xc03(USB Controller) + 65535,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0x104(RAID Controller) cec: Huge Page Memory Available huge page memory(in pages): 2 Configurable huge page memory(in pages): 2 @@ -241,9 +243,11 @@ Output is similar to: Bytes per BSR array: 4096 Available BSR array: 256 -For partition on normal power machine, list out the detailed information: +Note: The lines list in "All Physical I/O info" section represent all the physical I/O resource information. The format is like "owner_lparid,slot_id,physical resource name,drc_index,slot_class_code(class discription)". The 'drc index' is short for Dynamic Resource Configuration Index, it uniquely indicate a physical I/O resource in normal power machine. - lsvm lpar1 -p +For DFM-managed partition on normal power machine, list out the detailed information: + + lsvm lpar1 Output is similar to: @@ -255,13 +259,13 @@ Output is similar to: Curr Memory Min: 0.25 GB(1 regions). Curr Memory Req: 30.75 GB(123 regions). Curr Memory Max: 32.00 GB(128 regions). - lpar1: 1,519,U78AA.001.WZSGVU7-P1-C7,0x21010207,0,0,0xffff(Empty Slot) - lpar1: 1,518,U78AA.001.WZSGVU7-P1-C6,0x21010206,0,0,0xffff(Empty Slot) - lpar1: 1,517,U78AA.001.WZSGVU7-P1-C5,0x21010205,0,0,0xffff(Empty Slot) - lpar1: 1,516,U78AA.001.WZSGVU7-P1-C4,0x21010204,0,0,0xffff(Empty Slot) - lpar1: 1,514,U78AA.001.WZSGVU7-P1-C19,0x21010202,0,0,0xffff(Empty Slot) - lpar1: 1,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0,0,0xc03(USB Controller) - lpar1: 1,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0,0,0x104(RAID Controller) + lpar1: 1,519,U78AA.001.WZSGVU7-P1-C7,0x21010207,0xffff(Empty Slot) + lpar1: 1,518,U78AA.001.WZSGVU7-P1-C6,0x21010206,0xffff(Empty Slot) + lpar1: 1,517,U78AA.001.WZSGVU7-P1-C5,0x21010205,0xffff(Empty Slot) + lpar1: 1,516,U78AA.001.WZSGVU7-P1-C4,0x21010204,0xffff(Empty Slot) + lpar1: 1,514,U78AA.001.WZSGVU7-P1-C19,0x21010202,0xffff(Empty Slot) + lpar1: 1,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0xc03(USB Controller) + lpar1: 1,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0x104(RAID Controller) lpar1: 1/2/2 lpar1: 256. @@ -275,4 +279,3 @@ Output is similar to: L, L, L - diff --git a/xCAT-client/pods/man1/mkvm.1.pod b/xCAT-client/pods/man1/mkvm.1.pod index 3cfe44cd0..8bb5f2661 100644 --- a/xCAT-client/pods/man1/mkvm.1.pod +++ b/xCAT-client/pods/man1/mkvm.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Creates HMC-, IVM-, and zVM-managed partitions or other virtual machines. +B - Creates HMC-, DFM-, IVM-, and zVM-managed partitions or other virtual machines. =head1 SYNOPSIS @@ -18,10 +18,12 @@ B [B<-V>| B<--verbose>] I B<-c> I B<-p> I B [B<-V>| B<--verbose>] I B<--full> - =head2 For PPC (using Direct FSP Management) specific: -B [I B<--full> B<--part>] +B I [B<--full>] + +B I [B] [B] + [B] [B] =head2 For KVM: @@ -53,7 +55,7 @@ Please note that the mkvm command currently only supports creating standard LPAR With option I, a partition using all the resources on a normal power machine will be created. -With option I, a partition using the parameters specified with attributes such as 'vmcpus', 'vmmory', 'vmphyslots', 'vmothersetting' will be created. +If no option is specified, a partition using the parameters specified with attributes such as 'vmcpus', 'vmmory', 'vmphyslots', 'vmothersetting' will be created. Those attributes can either be specified with '*def' commands running before or be specified with this command. =head2 For KVM and Vmware: @@ -87,9 +89,9 @@ The cpu count which will be created for the kvm/vmware virtual machine. Request to create a new full system partition for each CEC. -=item B<--part> +=item B B B B -Request to create a partition with the specified parameters. +To specify the parameters which are used to create a partition. The I, I and I are necessay, and the value specified with this command have a more high priority. If the value of any of the three options is not specified, the corresponding value specified for the node object will be used. If any of the three attributes is neither specified with this command nor specified with the node object, error information will be returned. To reference to L for more information about 'drc_index' for I. =item B<-f|--force> @@ -133,7 +135,7 @@ Verbose output. =head1 EXAMPLES -1. To create a new partition lpar5 based on the profile/resources of lpar4, enter: +1. To create a new HMC-managed partition lpar5 based on the profile/resources of lpar4, enter: mkdef -t node -o lpar5 mgt=hmc groups=all @@ -146,7 +148,7 @@ Output is similar to: lpar5: Success -2. To create new partitions lpar5-lpar8 based on the profile/resources of lpar4, enter: +2. To create new HMC-managed partitions lpar5-lpar8 based on the profile/resources of lpar4, enter: mkdef -t node -o lpar5-lpar8 mgt=hmc groups=all @@ -162,7 +164,7 @@ Output is similar to: lpar8: Success -3. To duplicate all the partitions associated with cec01 on cec02, first save the lpars from cec01 to a file: +3. To duplicate all the HMC-managed partitions associated with cec01 on cec02, first save the lpars from cec01 to a file: lsvm lpar01-lpar04 > /tmp/myprofile @@ -178,7 +180,7 @@ Output is similar to: lpar8: Success -4. To duplicate all the partitions associated with cec01 on cec02, one is for cec01, the other is for cec02: +4. To duplicate all the HMC-managed partitions associated with cec01 on cec02, one is for cec01, the other is for cec02: mkdef -t node -o lpar5,lpar6 mgt=hmc groups=all chtab node=lpar5 ppc.parent=cec01 @@ -248,27 +250,74 @@ The output is similar to: lpar1: Done -To query the resources allocated to node 'lpar1', please reference L. +To query the resources allocated to node 'lpar1' + + lsvm lpar1 + +The output is similar to: + + lpar1: Lpar Processor Info: + Curr Processor Min: 1. + Curr Processor Req: 16. + Curr Processor Max: 16. + lpar1: Lpar Memory Info: + Curr Memory Min: 0.25 GB(1 regions). + Curr Memory Req: 30.75 GB(123 regions). + Curr Memory Max: 32.00 GB(128 regions). + lpar1: 1,519,U78AA.001.WZSGVU7-P1-C7,0x21010207,0xffff(Empty Slot) + lpar1: 1,518,U78AA.001.WZSGVU7-P1-C6,0x21010206,0xffff(Empty Slot) + lpar1: 1,517,U78AA.001.WZSGVU7-P1-C5,0x21010205,0xffff(Empty Slot) + lpar1: 1,516,U78AA.001.WZSGVU7-P1-C4,0x21010204,0xffff(Empty Slot) + lpar1: 1,514,U78AA.001.WZSGVU7-P1-C19,0x21010202,0xffff(Empty Slot) + lpar1: 1,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0xc03(USB Controller) + lpar1: 1,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0x104(RAID Controller) + lpar1: 1/2/2 + lpar1: 256. + Note: The 'parent' attribute for node 'lpar1' is the object name of physical power machine that the full partition will be created on. 9. To create a partition using some of the resources on normal power machine. +Option 1: + After a node object is defined, the resources that will be used for the partition shall be specified like this: chdef lpar1 vmcpus=1/4/16 vmmemory=1G/4G/32G vmphyslots=0x21010201,0x21010200 vmothersetting=bsr:128,hugepage:2 Then, create the partion on the specified cec. - mkvm lpar1 --part + mkvm lpar1 + +Option 2: + + mkvm lpar1 vmcpus=1/4/16 vmmemory=1G/4G/32G vmphyslots=0x21010201,0x21010200 vmothersetting=bsr:128,hugepage:2 The outout is similar to: lpar1: Done + +Note: The 'vmplyslots' specify the drc index of the physical slot device. Every drc index shall be delimited with ','. The 'vmothersetting' specify two kinds of resource, bsr(Barrier Synchronization Register) specified the num of BSR arrays, hugepage(Huge Page Memory) specified the num of huge pages. -To query the resources allocated to node 'lpar1', please reference L. +To query the resources allocated to node 'lpar1' + + lsvm lpar1 + +The output is similar to: + + lpar1: Lpar Processor Info: + Curr Processor Min: 1. + Curr Processor Req: 4. + Curr Processor Max: 16. + lpar1: Lpar Memory Info: + Curr Memory Min: 1.00 GB(4 regions). + Curr Memory Req: 4.00 GB(16 regions). + Curr Memory Max: 32.00 GB(128 regions). + lpar1: 1,513,U78AA.001.WZSGVU7-P1-T7,0x21010201,0xc03(USB Controller) + lpar1: 1,512,U78AA.001.WZSGVU7-P1-T9,0x21010200,0x104(RAID Controller) + lpar1: 1/2/2 + lpar1: 128. -Note: The 'vmplyslots' specify the drc index of the physical slot device. Every drc index shall be delimited with ','. The 'vmothersetting' specify two kinds of resource, bsr(Barrier Synchronization Register) specified the num of BSR arrays, hugepage(Huge Page Memory) specified the num of pages. =head1 FILES diff --git a/xCAT-client/pods/man1/rmvm.1.pod b/xCAT-client/pods/man1/rmvm.1.pod index 400306db0..64cd291a2 100644 --- a/xCAT-client/pods/man1/rmvm.1.pod +++ b/xCAT-client/pods/man1/rmvm.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Removes HMC-, IVM-, KVM-, Vmware- and zVM-managed partitions or virtual machines. +B - Removes HMC-, DFM-, IVM-, KVM-, Vmware- and zVM-managed partitions or virtual machines. =head1 SYNOPSIS @@ -8,7 +8,6 @@ I I - I =head2 For KVM and Vmware: @@ -17,12 +16,14 @@ I =head2 PPC (using Direct FSP Management) specific: -I I<-p|--part> +I =head1 DESCRIPTION The rmvm command removes the partitions specified in noderange. If noderange is an CEC, all the partitions associated with that CEC will be removed. Note that removed partitions are automatically removed from the xCAT database. For IVM-managed systems, care must be taken to not remove the VIOS partition, or all the associated partitions will be removed as well. +For DFM-managed (short For Direct FSP Management mode) normal power machines, only partitions can be removed. No options is needed. + =head1 OPTIONS @@ -50,7 +51,7 @@ B<-f> Force remove the VM, even if the VM appears to be online. This w =head1 EXAMPLES -1. To remove the partition lpar3, enter: +1. To remove the HMC-managed partition lpar3, enter: I @@ -58,7 +59,7 @@ Output is similar to: lpar3: Success -2. To remove all the partitions associated with CEC cec01, enter: +2. To remove all the HMC-managed partitions associated with CEC cec01, enter: I @@ -68,7 +69,7 @@ Output is similar to: lpar2: Success lpar3: Success -3. To remove the service partitions of the specified CEC cec01 and cec02, enter: +3. To remove the HMC-managed service partitions of the specified CEC cec01 and cec02, enter: I @@ -77,7 +78,7 @@ Output is similar to: cec01: Success cec02: Success -4. To remove the partition lpar1, but retain its definition, enter: +4. To remove the HMC-managed partition lpar1, but retain its definition, enter: I @@ -94,9 +95,9 @@ Output is similar to: gpok4: Deleting virtual server LNX4... Done -6. To remove a partition on normal power machine. +6. To remove a DFM-managed partition on normal power machine: -I +I Output is similar to: From 5e728c73a15667b452c7d30ef5804ce12582b4f5 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 17 Sep 2013 10:36:12 -0400 Subject: [PATCH 130/184] fix for defect 3785(PCM) requirement --- xCAT-server/lib/xcat/plugins/updatenode.pm | 184 +++++++++++---------- 1 file changed, 94 insertions(+), 90 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 4e6815d47..b0a089744 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -918,18 +918,14 @@ sub updatenode #print Dumper($request); my $nodes = $request->{node}; #$request->{status}= "yes"; # for testing - my $requeststatus; - if (defined($request->{status})) { - $requeststatus = $request->{status}; - } my $localhostname = hostname(); - + $::CALLERCALLBACK=$callback; # if status return requested my $numberofnodes; # This is an internal call from another plugin requesting status # currently this is not displayed is only returned and not displayed # by updatenode. - if (defined($requeststatus) && ($requeststatus eq "yes")) { + if ((defined($request->{status})) && ($request->{status} eq "yes")) { $numberofnodes = @$nodes; my $rsp = {}; $rsp->{status}->[0] = "TOTAL NODES: $numberofnodes"; @@ -1049,6 +1045,8 @@ sub updatenode xCAT::TableUtils->setUpdateStatus(\@$nodes, $stat); } + + # # handle file synchronization # @@ -1192,21 +1190,6 @@ sub updatenode xCAT::TableUtils->setUpdateStatus(\@::FAILEDNODES, $stat); } - # internal call request for status, not output to CLI - if (defined($requeststatus) && ($requeststatus eq "yes")) { - foreach my $n (@::SUCCESSFULLNODES) { - my $rsp = {}; - $rsp->{status}->[0] = "$n: SUCCEEDED"; - $callback->($rsp); - } - foreach my $n (@::FAILEDNODES) { - my $rsp = {}; - $rsp->{status}->[0] = "$n: FAILED"; - $callback->($rsp); - } - - - } # if site.precreatemypostscripts = not 1 or yes or undefined, # remove all the # node files in the noderange in /tftpboot/mypostscripts @@ -1265,8 +1248,13 @@ sub updatenoderunps } else { $nfsv4 = "no"; } - + # if running postscript report status here, if requested. + if ((defined($request->{status})) && ($request->{status} eq "yes")) { + $::REPORTSTATUS="Y"; + } + # this drives getdata to report status complete for postscripts + $::TYPECALL ="P"; if (($request->{postscripts}) && ($request->{postscripts}->[0])) { $orig_postscripts = $request->{postscripts}->[0]; @@ -1409,6 +1397,16 @@ sub updatenodesyncfiles my $localhostname = hostname(); my %syncfile_node = (); my %syncfile_rootimage = (); + # if running -P or -S do not report or no status requested + if ((defined($request->{status})) && ($request->{status} eq "yes")) { # status requested + if (($request->{rerunps} && $request->{rerunps}->[0] eq "yes") || + ($request->{swmaintenance} && $request->{swmaintenance}->[0] eq "yes")){ + $::REPORTSTATUS="N"; + } else { # report at sync time (-F) + $::REPORTSTATUS="Y"; + } + } + my $node_syncfile = xCAT::SvrUtils->getsynclistfile($nodes); foreach my $node (@$nodes) { @@ -1522,7 +1520,8 @@ sub updatenodesyncfiles and then outputs the remaining user info Arguments: output,callback - Globals @::SUCCESSFULLNODES, @::FAILEDNODES + Globals @::SUCCESSFULLNODES, @::FAILEDNODE + $::REPORTSTATUS if "Y" then imediately return status in $::CALLERCALLBACK (PCM) =cut @@ -1538,6 +1537,11 @@ sub buildnodestatus if($line =~ /^\s*(\S+)\s*:\s*Remote_command_successful/) { my ($node,$info) = split (/:/, $line); + if ($::REPORTSTATUS eq "Y" ) { # return status NOW + my $rsp2 = {}; + $rsp2->{status}->[0] = "$node: SUCCEEDED"; + $::CALLERCALLBACK->($rsp2); + } if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer next; } else { @@ -1547,6 +1551,11 @@ sub buildnodestatus elsif($line =~ /^\s*(\S+)\s*:\s*Remote_command_failed/) { my ($node,$info)= split (/:/, $line); + if ($::REPORTSTATUS eq "Y" ) { # return status NOW + my $rsp2 = {}; + $rsp2->{status}->[0] = "$node: FAILED"; + $::CALLERCALLBACK->($rsp2); + } if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer next; } else { @@ -1619,6 +1628,18 @@ sub updatenodesoftware my $tftpdir = xCAT::TableUtils->getTftpDir(); my $localhostname = hostname(); my $rsp; + # Determine when to report status, do not report it here if -P is to run + if ((defined($request->{status})) && ($request->{status} eq "yes")) { # if status requested + if ($request->{rerunps} && $request->{rerunps}->[0] eq "yes") { # (-P) running postscripts + $::REPORTSTATUS="N"; + } else { + $::REPORTSTATUS="Y"; + } + } + + # this drives getdata to report status complete for software updatees + $::TYPECALL ="S"; + $CALLBACK = $callback; push @{$rsp->{data}}, "Performing software maintenance operations. This could take a while, if there are packages to install.\n"; @@ -1700,7 +1721,7 @@ sub updatenodesoftware arg => $args1, _xcatpreprocessed => [1] }, - \&getdata2 + \&getdata ); @@ -1736,7 +1757,11 @@ sub updatenodesoftware #------------------------------------------------------------------------------- =head3 getdata - This is the local callback that handles the response from - the xdsh streaming calls when running postscripts + the xdsh streaming calls when running postscripts(-P) and software updates (-S) + $::TYPECALL = P from postscripts runs or S from Software updates + $::CALLERCALLBACK = saved callback from calling routine + $::REPORTSTATUS, if Y, return the good/bad status right away from this + routine to the $::CALLERCALLBACK ( PCM) =cut #------------------------------------------------------------------------------- @@ -1747,6 +1772,7 @@ sub getdata my $rsp; foreach my $type (keys %$response) { + my $alreadyinstalled=0; foreach my $output (@{$response->{$type}}) { chomp($output); @@ -1754,27 +1780,61 @@ sub getdata if($output =~ /^\s*(\S+)\s*:\s*Remote_command_successful/) { my ($node,$info) = split (/:/, $output); + if ($::REPORTSTATUS eq "Y" ) { # return status NOW + my $rsp2 = {}; + $rsp2->{status}->[0] = "$node: SUCCEEDED"; + $::CALLERCALLBACK->($rsp2); + } if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer next; } else { - push(@::SUCCESSFULLNODES,$node); + push(@::SUCCESSFULLNODES,$node); } } + # check for already installed on software updates, this is not an error + if($output =~ /^\s*(\S+)\s*:\s*already installed/) + { + $alreadyinstalled = 1; + } + if($output =~ /^\s*(\S+)\s*:\s*Remote_command_failed/) { my ($node,$info) = split (/:/, $output); - if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer + if ($alreadyinstalled == 0) { # not an already install error, then real error + if ($::REPORTSTATUS eq "Y" ) { # return status NOW + my $rsp2 = {}; + $rsp2->{status}->[0] = "$node: FAILED"; + $::CALLERCALLBACK->($rsp2); + } + if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer next; - } else { - push(@::FAILEDNODES,$node); + } else { + push(@::FAILEDNODES,$node); + } + } else { # already installed is ok + if ($::REPORTSTATUS eq "Y" ) { # return status NOW + my $rsp2 = {}; + $rsp2->{status}->[0] = "$node: SUCCEEDED"; + $::CALLERCALLBACK->($rsp2); + } + if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer + next; + } else { + push(@::SUCCESSFULLNODES,$node); + } } } if ($output =~ /returned from postscript/) { + if ($::TYPECALL eq "P") { # -P flag $output =~ s/returned from postscript/Running of postscripts has completed./; + } else { # should be -S flag + $output =~ + s/returned from postscript/Running of Software Maintenance has completed./; + } } if ($RERUNPS4SECURITY && $RERUNPS4SECURITY eq "yes") { @@ -1798,66 +1858,6 @@ sub getdata } $CALLBACK->($rsp); } -#------------------------------------------------------------------------------- - -=head3 getdata2 - This is the local callback that handles the response from - the xdsh streaming calls when running software updates - -=cut -#------------------------------------------------------------------------------- -sub getdata2 -{ - no strict; - my $response = shift; - my $rsp; - foreach my $type (keys %$response) - { - my $alreadyinstalled=0; - foreach my $output (@{$response->{$type}}) - { - chomp($output); - $output =~ s/\\cM//; - if($output =~ /^\s*(\S+)\s*:\s*Remote_command_successful/) - { - my ($node,$info) = split (/:/, $output); - if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer - next; - } else { - push(@::SUCCESSFULLNODES,$node); - } - } - # check for already installed, this is not an error - if($output =~ /^\s*(\S+)\s*:\s*already installed/) - { - $alreadyinstalled = 1; - } - if($output =~ /^\s*(\S+)\s*:\s*Remote_command_failed/) - { - if ($alreadyinstalled == 0) { # not an already install error - my ($node,$info) = split (/:/, $output); - if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer - next; - } else { - push(@::FAILEDNODES,$node); - } - } - } - - - if ($output =~ /returned from postscript/) - { - $output =~ - s/returned from postscript/Running of Software Maintenance has completed./; - - } - if (($output !~ /^\s*(\S+)\s*:\s*Remote_command_successful/) && ($output !~ /^\s*(\S+)\s*:\s*Remote_command_failed/)) - { - push @{$rsp->{$type}}, "$output"; - } - } - } - $CALLBACK->($rsp); -} #------------------------------------------------------------------------------- @@ -2429,6 +2429,10 @@ sub updateAIXsoftware %nodeupdateinfo = %{$updates}; } + + # this drives getdata to report status complete for software updatees + $::TYPECALL ="S"; + my %bndloc; # get the server name for each node - as known by the node @@ -2678,7 +2682,7 @@ sub updateAIXsoftware arg => $args1, _xcatpreprocessed => [1] }, - \&getdata2 + \&getdata ); # remove pkglist_file from MN - local From 9a64ca9b843aa32a036e9b895384035faede401c Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 17 Sep 2013 12:19:52 -0400 Subject: [PATCH 131/184] fix defect 3786 --- perl-xCAT/xCAT/Client.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/perl-xCAT/xCAT/Client.pm b/perl-xCAT/xCAT/Client.pm index 80d9340a9..99b84e489 100644 --- a/perl-xCAT/xCAT/Client.pm +++ b/perl-xCAT/xCAT/Client.pm @@ -231,6 +231,16 @@ if (ref($request) eq 'HASH') { # the request is an array, not pure XML Timeout => 0, ); } + unless ($client) { + print "Unable to open socket connection to xcatd daemon on $xcathost.\n"; + print "Verify that the xcatd daemon is running and that your SSL setup is correct.\n"; + if ($@ =~ /SSL Timeout/) { + die "Connection failure: SSL Timeout or incorrect certificates in ~/.xcat"; + } else { + die "Connection failure: $@" + } + } + my $msg; if (ref($request) eq 'HASH') { # the request is an array, not pure XML $msg=XMLout($request,RootName=>'xcatrequest',NoAttr=>1,KeyAttr=>[]); From 7754845c7c2a5a8ce7fd35897eb5f2f307bae75b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 17 Sep 2013 17:26:36 -0400 Subject: [PATCH 132/184] Fix pasu with multi-node eX5 systems --- xCAT-client/bin/pasu | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-client/bin/pasu b/xCAT-client/bin/pasu index 3ebdb6038..19f1d6b87 100755 --- a/xCAT-client/bin/pasu +++ b/xCAT-client/bin/pasu @@ -219,6 +219,7 @@ sub asunode { my $passwd = shift; my $batchfile = shift; my $args; + $bmc =~ s/,.*//; if ($batchfile) { $args = "batch $batchfile"; } else { From 44f26b478d6c6e71308abfae8782bdc71eae6f69 Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 18 Sep 2013 07:56:13 +0800 Subject: [PATCH 133/184] fix bug 3745: makehosts -d to delete otherinterfaces hosts --- xCAT-server/lib/xcat/plugins/hosts.pm | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) mode change 100644 => 100755 xCAT-server/lib/xcat/plugins/hosts.pm diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm old mode 100644 new mode 100755 index ca78142c3..609c6028b --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -205,6 +205,32 @@ sub addotherinterfaces } } +sub delotherinterfaces +{ + my $node = shift; + my $otherinterfaces = shift; + my $domain = shift; + + my @itf_pairs = split(/,/, $otherinterfaces); + foreach (@itf_pairs) + { + my ($itf, $ip); + if ($_ =~ /!/) { + ($itf, $ip) = split(/!/, $_); + } else { + ($itf, $ip) = split(/:/, $_); + } + if ($ip && xCAT::NetworkUtils->isIpaddr($ip)) + { + if ($itf =~ /^-/) + { + $itf = $node . $itf; + } + delnode $itf, $ip, '', $domain; + } + } +} + sub add_hosts_content { my %args = @_; my $nodelist = $args{nodelist}; @@ -247,6 +273,10 @@ sub add_hosts_content { if ($DELNODE) { delnode $nodename, $ip, $ref->{hostnames}, $domain; + if (defined($ref->{otherinterfaces})) + { + delotherinterfaces $nodename, $ref->{otherinterfaces}, $domain; + } } else { From f79ec9bdbdc4d10b8515fe0cb97109fb42ad4fde Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 18 Sep 2013 13:46:34 +0800 Subject: [PATCH 134/184] fix for bug 3748: lsdef --osimage need to list all osimage attributes --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) mode change 100644 => 100755 xCAT-server/lib/xcat/plugins/DBobjectdefs.pm diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm old mode 100644 new mode 100755 index fe5172ab0..db8657ec3 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -3159,10 +3159,12 @@ sub defls foreach my $imgattr (keys %imgentry) { # Only store the attributes that are not in general node attributes - if(!defined($myhash{$obj}{$imgattr}) && defined($imgentry{$imgattr})) - { + # This is not the right thing to do, list all the osimage attributes instead, + # like the postscripts and postbootscripts attributes, + #if(!defined($myhash{$obj}{$imgattr}) && defined($imgentry{$imgattr})) + #{ $nodeosimagehash{$obj}{$imgattr} = $imgentry{$imgattr}; - } + #} } } if (scalar(keys %{$nodeosimagehash{$obj}}) == 0) From a0370be23f204de76fffcf056c066e3460198503 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 18 Sep 2013 06:53:42 -0400 Subject: [PATCH 135/184] update database immediately for defect 3785 --- xCAT-server/lib/xcat/plugins/updatenode.pm | 46 +++++++++++++++++----- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index b0a089744..07937d654 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -1172,23 +1172,26 @@ sub updatenode waitpid($_, 0); } } - - # update the node status, this is done when -F -S -P are run - # make sure the nodes only appear in one array good or bad - &cleanstatusarrays; - if(@::SUCCESSFULLNODES) - { + # if immediate return of status not requested (PCM), then update the DB here + # in one transaction, otherwise it is updated in getdata callback and buildnodestatus + if (!(defined($request->{status})) || ($request->{status} ne "yes")) { + # update the node status, this is done when -F -S -P are run + # make sure the nodes only appear in one array good or bad + &cleanstatusarrays; + if(@::SUCCESSFULLNODES) + { my $stat="synced"; xCAT::TableUtils->setUpdateStatus(\@::SUCCESSFULLNODES, $stat); - } - if(@::FAILEDNODES) - { + } + if(@::FAILEDNODES) + { my $stat="failed"; xCAT::TableUtils->setUpdateStatus(\@::FAILEDNODES, $stat); + } } # if site.precreatemypostscripts = not 1 or yes or undefined, # remove all the @@ -1541,6 +1544,11 @@ sub buildnodestatus my $rsp2 = {}; $rsp2->{status}->[0] = "$node: SUCCEEDED"; $::CALLERCALLBACK->($rsp2); + # update the nodelist table updatestatus flag for the node + my $stat="synced"; + my @nodearray=(); + push @nodearray,$node; + xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); } if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer next; @@ -1555,6 +1563,11 @@ sub buildnodestatus my $rsp2 = {}; $rsp2->{status}->[0] = "$node: FAILED"; $::CALLERCALLBACK->($rsp2); + # update the nodelist table updatestatus flag for the node + my $stat="failed"; + my @nodearray=(); + push @nodearray,$node; + xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); } if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer next; @@ -1784,6 +1797,11 @@ sub getdata my $rsp2 = {}; $rsp2->{status}->[0] = "$node: SUCCEEDED"; $::CALLERCALLBACK->($rsp2); + # update the nodelist table updatestatus flag for the node + my $stat="synced"; + my @nodearray=(); + push @nodearray,$node; + xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); } if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer next; @@ -1805,6 +1823,11 @@ sub getdata my $rsp2 = {}; $rsp2->{status}->[0] = "$node: FAILED"; $::CALLERCALLBACK->($rsp2); + # update the nodelist table updatestatus flag for the node + my $stat="failed"; + my @nodearray=(); + push @nodearray,$node; + xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); } if (grep(/^$node$/, @::FAILEDNODES)) { # already on the buffer next; @@ -1816,6 +1839,11 @@ sub getdata my $rsp2 = {}; $rsp2->{status}->[0] = "$node: SUCCEEDED"; $::CALLERCALLBACK->($rsp2); + # update the nodelist table updatestatus flag for the node + my $stat="synced"; + my @nodearray=(); + push @nodearray,$node; + xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); } if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer next; From 5d02531baa18b1ab8c2014a38c7bb572b0d3a36e Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 18 Sep 2013 08:20:28 -0400 Subject: [PATCH 136/184] fix extra output on -k interface --- xCAT-server/lib/xcat/plugins/updatenode.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 07937d654..02890728f 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -1871,10 +1871,11 @@ sub getdata $output =~ s/Running of postscripts has completed/Redeliver security files has completed/; push @{$rsp->{$type}}, $output; - } - elsif ($output !~ /Running postscript|Error loading module/) - { + } else { + if (($output !~ (/Running postscript/)) && ($output !~ (/Error loading module/)) && ($output !~ /^\s*(\S+)\s*:\s*Remote_command_successful/) && ($output !~ /^\s*(\S+)\s*:\s*Remote_command_failed/)) + { push @{$rsp->{$type}}, "$output"; + } } } else{ # for non -k option then get the rest of the output if (($output !~ (/Error loading module/)) && ($output !~ /^\s*(\S+)\s*:\s*Remote_command_successful/) && ($output !~ /^\s*(\S+)\s*:\s*Remote_command_failed/)) From 76edfcf6707bb5af131b608ef4f1a7f90d0d83af Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 18 Sep 2013 13:41:16 -0400 Subject: [PATCH 137/184] defect 3785 --- xCAT-server/lib/xcat/plugins/updatenode.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 02890728f..45d198ffa 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -1375,7 +1375,12 @@ sub updatenoderunps $subreq, 0, 1 ); } - + # report final status PCM + if ((defined($request->{status})) && ($request->{status} eq "yes")) { + my $rsp = {}; + $rsp->{status}->[0] = "Running of postscripts has completed."; + $callback->($rsp); + } return; } @@ -1764,6 +1769,12 @@ sub updatenodesoftware return 1; } } + # report final status PCM + if ((defined($request->{status})) && ($request->{status} eq "yes")) { + my $rsp = {}; + $rsp->{status}->[0] = "Running of Software maintenance has completed."; + $callback->($rsp); + } return; } From 5f0da1b2de8a7a87442c1374091f2c04b9638a0b Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 18 Sep 2013 14:08:34 -0400 Subject: [PATCH 138/184] document xcatmaxbatchconnections, try --- perl-xCAT/xCAT/Schema.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index a14b958eb..ead50b7c0 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1049,6 +1049,8 @@ site => { " xcatmaxconnections: Number of concurrent xCAT protocol requests before requests\n". " begin queueing. This applies to both client command requests\n". " and node requests, e.g. to get postscripts. Default is 64.\n\n". + " xcatmaxbatchconnections: Number of concurrent xCAT remote protocol requests allowed.\n". + " Value must be less than xcatmaxconnections. Default is 50.\n". " xcatdport: The port used by the xcatd daemon for client/server communication.\n\n". " xcatiport: The port used by xcatd to receive install status updates from nodes.\n\n", " xcatsslversion: The ssl version by xcatd. Default is SSLv3.\n\n", From 39c66d052f79a1e508f3219af2824e0cd1966426 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 18 Sep 2013 14:25:51 -0400 Subject: [PATCH 139/184] document xcatmaxbatchconnections update --- perl-xCAT/xCAT/Schema.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index ead50b7c0..bc4d38fa6 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1049,7 +1049,7 @@ site => { " xcatmaxconnections: Number of concurrent xCAT protocol requests before requests\n". " begin queueing. This applies to both client command requests\n". " and node requests, e.g. to get postscripts. Default is 64.\n\n". - " xcatmaxbatchconnections: Number of concurrent xCAT remote protocol requests allowed.\n". + " xcatmaxbatchconnections: Number of concurrent xCAT connections allowed from the nodes.\n". " Value must be less than xcatmaxconnections. Default is 50.\n". " xcatdport: The port used by the xcatd daemon for client/server communication.\n\n". " xcatiport: The port used by xcatd to receive install status updates from nodes.\n\n", From 84b503a443504f9a74ff333b438f7fa08f70dfcc Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 19 Sep 2013 07:36:16 -0400 Subject: [PATCH 140/184] defect 3785 --- xCAT-server/lib/xcat/plugins/updatenode.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 45d198ffa..7ffa384d5 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -1519,6 +1519,12 @@ sub updatenodesyncfiles xCAT::TableUtils->setUpdateStatus(\@$nodes, $stat); } + # report final status PCM + if ((defined($request->{status})) && ($request->{status} eq "yes")) { + my $rsp = {}; + $rsp->{status}->[0] = "File synchronization has completed."; + $callback->($rsp); + } return; } From caed010c3db73e079ed6c65936571cf44868869c Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 19 Sep 2013 10:46:36 -0400 Subject: [PATCH 141/184] defect 3580 --- xCAT-client/bin/pscp | 1 - xCAT-client/bin/psh | 32 +++++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/xCAT-client/bin/pscp b/xCAT-client/bin/pscp index ee3e7c2c6..aca2dc361 100755 --- a/xCAT-client/bin/pscp +++ b/xCAT-client/bin/pscp @@ -12,7 +12,6 @@ $XML::Simple::PREFERRED_PARSER='XML::Parser'; use IO::Handle; use IO::Select; use Thread qw(yield); -use xCAT::Utils; use Getopt::Long qw(:config pass_through require_order); use POSIX qw(:signal_h :errno_h :sys_wait_h); my $interface; diff --git a/xCAT-client/bin/psh b/xCAT-client/bin/psh index 4ce61652f..5e9486e4f 100755 --- a/xCAT-client/bin/psh +++ b/xCAT-client/bin/psh @@ -14,7 +14,6 @@ $XML::Simple::PREFERRED_PARSER='XML::Parser'; #use Data::Dumper; use IO::Handle; use IO::Select; -use xCAT::Utils; use Getopt::Long; use POSIX qw(:signal_h :errno_h :sys_wait_h); use Thread qw(yield); @@ -171,9 +170,36 @@ sub sshnode { if (length($username)) { $username = "-l $username"; } my $in; my $args = join(" ",@_); - #print "ssh -o BatchMode=yes $username $node " . xCAT::Utils->quote($args) . " 2>&1 |\n"; - my $pid = open($$out,"ssh -o BatchMode=yes $username $node " . xCAT::Utils->quote($args) . " 2>&1 |"); + #print "ssh -o BatchMode=yes $username $node " . "e($args) . " 2>&1 |\n"; + my $pid = open($$out,"ssh -o BatchMode=yes $username $node " . "e($args) . " 2>&1 |"); $pids{$pid} = $node; } +sub quote +{ + my $str = shift; + + # if the value has imbedded double quotes, use single quotes. If it also has + # single quotes, escape the double quotes. + if (!($str =~ /\"/)) # no embedded double quotes + { + $str =~ s/\$/\\\$/sg; # escape the dollar signs + $str =~ s/\`/\\\`/sg; + $str = qq("$str"); + } + elsif (!($str =~ /\'/)) + { + $str = qq('$str'); + } # no embedded single quotes + else # has both embedded double and single quotes + { + + # Escape the double quotes. (Escaping single quotes does not seem to work + # in the shells.) + $str =~ s/\"/\\\"/sg; #" this comment helps formating + $str =~ s/\$/\\\$/sg; # escape the dollar signs + $str =~ s/\`/\\\`/sg; + $str = qq("$str"); + } +} # vim: set et ts=2 sts=2 sw=2 : From 80d342485511aba0f93532d7809f72023a8fbc5b Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 19 Sep 2013 13:04:40 -0400 Subject: [PATCH 142/184] defect 3150, check for errors from DB. We can do itgit diff tabutils.pm --- xCAT-server/lib/xcat/plugins/tabutils.pm | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 39e05ef45..bc3c32c55 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -532,7 +532,7 @@ sub tabrestore next LINE; } - #TODO: check for error from DB and rollback + #check for error from DB and rollback my @rc = $tab->setAttribs(\%record, \%record); if (not defined($rc[0])) { @@ -2340,11 +2340,27 @@ else { } #commit all the changes + my $rollback; foreach (keys %tables) { if (exists($tableupdates{$_})) { - $tables{$_}->setAttribs(\%keyhash,\%{$tableupdates{$_}}); + my @rc=$tables{$_}->setAttribs(\%keyhash,\%{$tableupdates{$_}}); + if (not defined($rc[0])) + { + $rollback = 1; + $callback->({error => "DB error " . $rc[1] , errorcode=>[4]}); + } + } + if ($rollback) + { + $tables{$_}->rollback(); + $tables{$_}->close; + undef $tables{$_}; + return; + } + else + { + $tables{$_}->commit; } - $tables{$_}->commit; } } } From 75bb52802e8282df4c56fb823e8ee2a799939432 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 19 Sep 2013 15:53:29 -0400 Subject: [PATCH 143/184] Add support for esxi5.5 --- xCAT-server/lib/xcat/plugins/esx.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index b4820e312..97ec50eff 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -4219,6 +4219,13 @@ sub copycd { $found=1; last; } + if (/VMware ESXi 5\.5/) { + $darch="x86_64"; + $arch="x86_64"; + unless ($distname) { $distname='esxi5.5'; } + $found=1; + last; + } } } From c9508a796698f9ff68fde910e786f7cb2d6f93f8 Mon Sep 17 00:00:00 2001 From: Sheng Feng Xing Date: Sun, 22 Sep 2013 14:29:44 +0800 Subject: [PATCH 144/184] Fix #3793: CFMUtils.pm can not sync-up symbolic link directory under cfmdir --- perl-xCAT/xCAT/CFMUtils.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/CFMUtils.pm b/perl-xCAT/xCAT/CFMUtils.pm index 0bbd01f28..987cb0d65 100644 --- a/perl-xCAT/xCAT/CFMUtils.pm +++ b/perl-xCAT/xCAT/CFMUtils.pm @@ -363,7 +363,8 @@ sub updateCFMSynclistFile { # recursively list the files under cfm directory my @files = (); - find ( sub { push @files, $File::Find::name if (! -d) }, $cfmdir); + + find ( { wanted => sub { push @files, $File::Find::name if -f }, follow => 1 }, $cfmdir); if (!@files) # not files under cfm directory, skip to next loop { next; From 99f1ac8b79d83f21019b71b8de011361fbc5255d Mon Sep 17 00:00:00 2001 From: xq2005 Date: Sun, 22 Sep 2013 00:58:55 -0700 Subject: [PATCH 145/184] bug 3794 --- xCAT/postscripts/runxcatpost | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/runxcatpost b/xCAT/postscripts/runxcatpost index 3534484f1..d7c86c66b 100644 --- a/xCAT/postscripts/runxcatpost +++ b/xCAT/postscripts/runxcatpost @@ -8,6 +8,6 @@ fi if [ -x "/xcatpost/updateflag.awk" ];then /xcatpost/updateflag.awk $IMAGESERVER 3002 - updateflag.awk $IMAGESERVER 3002 "installstatus booted" + /xcatpost/updateflag.awk $IMAGESERVER 3002 "installstatus booted" fi From 2433281aa53942dcdba3182eb7015673755c7d88 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Mon, 23 Sep 2013 10:36:59 +0800 Subject: [PATCH 146/184] Fixing bug 3406, using md5 hash algorithm for centos 5.x during createrepo --- xCAT-buildkit/bin/buildkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index aa18dcd9b..ad5e33f96 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -808,7 +808,7 @@ sub kit_buildrepo1 # run createrepo my $cr_opts = ''; - if (( $repo->{osbasename} =~ m/rh|RH/ ) && + if (( $repo->{osbasename} =~ m/rh|RH|centos|CentOS/ ) && ( $repo->{osmajorversion} eq '5') ) { $cr_opts = '-s md5'; } From 2b453aea6f6e2565dd15bb2d8ab34a0d362a1f29 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Mon, 23 Sep 2013 11:02:12 +0800 Subject: [PATCH 147/184] Fixing bug 3406, using md5 hash algorithm for centos 5.x during createrepo --- xCAT-buildkit/bin/buildkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index ad5e33f96..245c296b6 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -3562,7 +3562,7 @@ sub NEW_kit_addpkgs my $repodir = "$::base_repodir/$kr->{kitreponame}"; if ( -d $repodir ) { my $cr_opts = ''; - if (( $kr->{osbasename} =~ m/rh|RH/ ) && + if (( $kr->{osbasename} =~ m/rh|RH|centos|CentOS/ ) && ( $kr->{osmajorversion} eq '5') ) { $cr_opts = '-s md5'; } From e342bd876c615299e86ae7490edfa7c9735ae5c8 Mon Sep 17 00:00:00 2001 From: Sheng Feng Xing Date: Mon, 23 Sep 2013 14:31:43 +0800 Subject: [PATCH 148/184] Merge PowerLinux 7R2 support patches into 2.8 branch --- perl-xCAT/xCAT/ProfiledNodeUtils.pm | 60 +++++++++- xCAT-server/lib/xcat/plugins/profilednodes.pm | 108 +++++++++++------- 2 files changed, 120 insertions(+), 48 deletions(-) diff --git a/perl-xCAT/xCAT/ProfiledNodeUtils.pm b/perl-xCAT/xCAT/ProfiledNodeUtils.pm index 80f740384..179109f7e 100644 --- a/perl-xCAT/xCAT/ProfiledNodeUtils.pm +++ b/perl-xCAT/xCAT/ProfiledNodeUtils.pm @@ -600,6 +600,46 @@ sub get_db_switchports #------------------------------------------------------------------------------- +=head3 get_all_cecs + Description : Get all CEC objects name in system. + Arguments : hashref: if not set, return a array ref. + if set, return a hash ref. + Returns : ref for CECs list. + Example : + my $arrayref = xCAT::ProfiledNodeUtils->get_all_cecs(); + my $hashref = xCAT::ProfiledNodeUtils->get_all_cecs(1); +=cut + +#------------------------------------------------------------------------------- +sub get_all_cecs +{ + my $hashref = shift; + my %cecshash; + my @cecslist; + + my $ppctab = xCAT::Table->new('ppc'); + my @cecs = $ppctab->getAllAttribsWhere("nodetype = 'cec'", 'node'); + foreach (@cecs) { + if($_->{'node'}) { + if ($hashref) { + $cecshash{$_->{'node'}} = 1; + } else { + push @cecslist, $_->{'node'}; + } + } + } + $ppctab->close(); + + # Return the ref accordingly + if ($hashref) { + return \%cecshash; + } else { + return \@cecslist; + } +} + +#------------------------------------------------------------------------------- + =head3 is_discover_started Description : Judge whether profiled nodes discovering is running or not. Arguments : NA @@ -758,7 +798,14 @@ sub check_profile_consistent{ my $mgt = undef; $mgt = $mgtentry->{'mgt'} if ($mgtentry->{'mgt'}); $nodehmtab->close(); - + + #Get hardwareprofile nodetype + my $ppctab = xCAT::Table->new('ppc'); + my $ntentry = $ppctab->getNodeAttribs($hardwareprofile, ['nodetype']); + my $nodetype = undef; + $nodetype = $ntentry->{'nodetype'} if ($ntentry->{'nodetype'}); + $ppctab->close(); + # Check if exists provision network if (not ($installnic and exists $netprofile_nicshash{$installnic}{"network"})){ return 0, "Provisioning network not defined for network profile." @@ -777,17 +824,18 @@ sub check_profile_consistent{ return 0, "$nictype networkprofile must use with hardwareprofile."; } } - - if (not $nictype and $mgt) { - # define hardwareprofile, not define fsp or bmc networkprofile + + # For nodetype is lpar node, not need to check the nictype as it is not required for lpar node + if (not $nictype and $mgt and $nodetype ne 'lpar' ) { + # define hardwareprofile, not define fsp or bmc networkprofile, and the node type is not lpar return 0, "$profile_dict{$mgt} hardwareprofile must use with $profile_dict{$mgt} networkprofile."; } - if ($profile_dict{$mgt} ne $nictype) { + if ($profile_dict{$mgt} ne $nictype and $nodetype ne 'lpar') { # Networkprofile's nictype is not consistent with hadrwareprofile's mgt return 0, "Networkprofile's nictype is not consistent with hardwareprofile's mgt."; } - + return 1, ""; } diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index 9161577e5..6e70bd1fa 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -31,6 +31,7 @@ require xCAT::ProfiledNodeUtils; my %allhostnames; my %allbmcips; my %allmacs; +my %allcecs; my %allmacsupper; my %allips; my %allinstallips; @@ -398,6 +399,10 @@ Usage: # Merge all BMC IPs and install IPs into allips. %allips = (%allips, %allbmcips, %allinstallips, %allfspips); + # Get all CEC names + $recordsref = xCAT::ProfiledNodeUtils->get_all_cecs(1); + %allcecs = %$recordsref; + #TODO: can not use getallnode to get rack infos. $recordsref = xCAT::ProfiledNodeUtils->get_all_rack(1); %allracks = %$recordsref; @@ -460,32 +465,26 @@ Usage: } } - # Create the real hostinfo string in stanza file format. + # Create the full hostinfo dict. xCAT::MsgUtils->message('S', "Generating new hostinfo string."); - my ($retcode_gen, $retstr_gen) = gen_new_hostinfo_string(\%hostinfo_dict); + my ($retcode_gen, $retstr_gen) = gen_new_hostinfo_dict(\%hostinfo_dict); unless ($retcode_gen){ setrsp_progress("Failed to validate node information file."); setrsp_errormsg($retstr_gen); return; } - # call mkdef to create hosts and then call nodemgmt for node management plugins. + # create hosts and then call nodemgmt for node management plugins. setrsp_progress("Importing nodes..."); setrsp_progress("Creating nodes..."); my $warnstr = ""; - my $retref = xCAT::Utils->runxcmd({command=>["mkdef"], stdin=>[$retstr_gen], arg=>['-z']}, $request_command, 0, 2); - my $retstrref = parse_runxcmd_ret($retref); - # runxcmd failed. - if ($::RUNCMD_RC != 0){ + if (xCAT::DBobjUtils->setobjdefs(\%hostinfo_dict) != 0){ $warnstr = "Warning: failed to import some nodes."; - setrsp_progress($warnstr); - if ($retstrref->[1]) { - $warnstr .= "Details: $retstrref->[1]"; - } + setrsp_progress($warnstr); } - + setrsp_progress("Configuring nodes..."); - $retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>\@nodelist, sequential=>[1], macflag=>[$mac_addr_mode]}, $request_command, 0, 2); - $retstrref = parse_runxcmd_ret($retref); + my $retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>\@nodelist, sequential=>[1], macflag=>[$mac_addr_mode]}, $request_command, 0, 2); + my $retstrref = parse_runxcmd_ret($retref); if ($::RUNCMD_RC != 0){ $warnstr .= "Warning: failed to run command kitnodeadd."; if ($retstrref->[1]) { @@ -542,12 +541,15 @@ Usage: } setrsp_progress("Updating DNS entries"); + $retref = ""; $retref = xCAT::Utils->runxcmd({command=>["makedns"], node=>$nodes, arg=>['-d']}, $request_command, 0, 2); setrsp_progress("Updating hosts entries"); + $retref = ""; $retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>$nodes, arg=>['-d']}, $request_command, 0, 2); setrsp_progress("Removing nodes..."); + $retref = ""; $retref = xCAT::Utils->runxcmd({command=>["noderm"], node=>$nodes}, $request_command, 0, 2); $retstrref = parse_runxcmd_ret($retref); if ($::RUNCMD_RC != 0){ @@ -739,6 +741,7 @@ Usage: # Call update plugins first. if(exists $args_dict{'hardwareprofile'} || exists $args_dict{'imageprofile'}){ setrsp_progress("Configuring nodes..."); + $retref = ""; $retref = xCAT::Utils->runxcmd({command=>["kitnodeupdate"], node=>$nodes, sequential=>[1]}, $request_command, 0, 2); $retstrref = parse_runxcmd_ret($retref); if ($::RUNCMD_RC != 0){ @@ -749,6 +752,7 @@ Usage: # If network profile specified. Need re-generate IPs for all nodess again. if(exists $args_dict{'networkprofile'}){ setrsp_progress("Regenerate IP addresses for nodes..."); + $retref = ""; $retref = xCAT::Utils->runxcmd({command=>["noderegenips"], node=>$nodes, sequential=>[1]}, $request_command, 0, 2); $retstrref = parse_runxcmd_ret($retref); if ($::RUNCMD_RC != 0){ @@ -980,9 +984,11 @@ Usage: #$retref = xCAT::Utils->runxcmd({command=>["makedns"], node=>$nodes, arg=>['-d']}, $request_command, 0, 2); #setrsp_progress("Updating hosts entries"); + $retref = ""; $retref = xCAT::Utils->runxcmd({command=>["makehosts"], node=>$nodes, arg=>['-d']}, $request_command, 0, 2); next; } + $retref = ""; $retref = xCAT::Utils->runxcmd({command=>[$command], node=>$nodes, sequential=>[1]}, $request_command, 0, 2); my $retstrref = parse_runxcmd_ret($retref); if ($::RUNCMD_RC != 0){ @@ -1070,6 +1076,7 @@ Usage: setrsp_progress("Warning: failed to update /etc/hosts for unmanaged node."); } + $retref = ""; $retref = xCAT::Utils->runxcmd({command=>["makedns"], node=>[$args_dict{"hostname"}]}, $request_command, 0, 2); $retstrref = parse_runxcmd_ret($retref); if ($::RUNCMD_RC != 0){ @@ -1601,22 +1608,20 @@ sub findme{ my ($hostinfo_dict_ref, $invalid_records_ref) = validate_node_entries(); my %hostinfo_dict = %$hostinfo_dict_ref; - # Create the real hostinfo string in stanza file format. + # Create the full hostinfo dict xCAT::MsgUtils->message('S', "Profiled nodes discover: Generating new hostinfo string.\n"); - my ($retcode_gen, $retstr_gen) = gen_new_hostinfo_string($hostinfo_dict_ref); + my ($retcode_gen, $retstr_gen) = gen_new_hostinfo_dict($hostinfo_dict_ref); unless ($retcode_gen){ setrsp_errormsg($retstr_gen); return; } - # call mkdef to create hosts and then call nodemgmt for node management plugins. - xCAT::MsgUtils->message('S', "Call mkdef to create nodes.\n"); - my $retref = xCAT::Utils->runxcmd({command=>["mkdef"], stdin=>[$retstr_gen], arg=>['-z']}, $request_command, 0, 2); - my $retstrref = parse_runxcmd_ret($retref); - # runxcmd failed. - if ($::RUNCMD_RC != 0){ - setrsp_errormsg($retstr_gen); - return; + # Create hosts and then call nodemgmt for node management plugins. + xCAT::MsgUtils->message('S', "Creating nodes...\n"); + my $warnstr; + if (xCAT::DBobjUtils->setobjdefs(\%hostinfo_dict) != 0){ + $warnstr = "Warning: failed to import node."; + setrsp_progress($warnstr); } my @nodelist = keys %hostinfo_dict; @@ -1626,10 +1631,11 @@ sub findme{ $request->{"command"} = ["discovered"]; $request->{"node"} = \@nodelist; $request->{discoverymethod} = ['profile']; - $retref = xCAT::Utils->runxcmd($request, $request_command, 0, 2); - $retstrref = parse_runxcmd_ret($retref); + my $retref = xCAT::Utils->runxcmd($request, $request_command, 0, 2); + my $retstrref = parse_runxcmd_ret($retref); xCAT::MsgUtils->message('S', "Call nodemgmt plugins.\n"); + $retref = ""; $retref = xCAT::Utils->runxcmd({command=>["kitnodeadd"], node=>\@nodelist, sequential=>[1]}, $request_command, 0, 2); $retstrref = parse_runxcmd_ret($retref); @@ -1642,19 +1648,19 @@ sub findme{ #------------------------------------------------------- -=head3 gen_new_hostinfo_string +=head3 gen_new_hostinfo_dict - Description : Generate a stanza file format string used for 'mkdef' to create nodes. + Description : Generate full hostinfo dict Arguments : hostinfo_dict_ref - The reference of hostinfo dict. Returns : (returnvalue, returnmsg) - returnvalue - 0, stands for generate new hostinfo string failed. - 1, stands for generate new hostinfo string OK. + returnvalue - 0, stands for generate new hostinfo dict failed. + 1, stands for generate new hostinfo dict OK. returnnmsg - error messages if generate failed. - - the new hostinfo string if generate OK. + - OK for success cases. =cut #------------------------------------------------------- -sub gen_new_hostinfo_string{ +sub gen_new_hostinfo_dict{ my $hostinfo_dict_ref = shift; my %hostinfo_dict = %$hostinfo_dict_ref; @@ -1683,9 +1689,9 @@ sub gen_new_hostinfo_string{ # Check whether this is Power env. my $is_fsp = xCAT::ProfiledNodeUtils->is_fsp_node($args_dict{'networkprofile'}); - # compose the stanza string for hostinfo file. - my $hostsinfostr = ""; foreach my $item (sort(keys %hostinfo_dict)){ + # Set Nodes's type: + $hostinfo_dict{$item}{"objtype"} = 'node'; # Generate IPs for other interfaces defined in MAC file. my %ipshash; foreach (keys %netprofileattr){ @@ -1760,6 +1766,22 @@ sub gen_new_hostinfo_string{ $hostinfo_dict{$item}{"mpa"} = $chassisname; } } + + # generate CEC-based rack-mount Power nodes' attributes + # lparid is optional, if not set, set it to 1 + if ((exists $hostinfo_dict{$item}{"cec"}) && (! $is_fsp) ){ + $hostinfo_dict{$item}{"hcp"} = $hostinfo_dict{$item}{"cec"}; + $hostinfo_dict{$item}{"parent"} = $hostinfo_dict{$item}{"cec"}; + delete($hostinfo_dict{$item}{"cec"}); + + if (exists $hostinfo_dict{$item}{"lparid"}) { + $hostinfo_dict{$item}{"id"} = $hostinfo_dict{$item}{"lparid"}; + delete($hostinfo_dict{$item}{"lparid"}); + } else { + $hostinfo_dict{$item}{"id"} = 1; + } + $hostinfo_dict{$item}{"mgt"} = "fsp"; + } # get the chain attribute from hardwareprofile and insert it to node. my $chaintab = xCAT::Table->new('chain'); @@ -1800,15 +1822,8 @@ sub gen_new_hostinfo_string{ } } - # Generate the hostinfo string. - $hostsinfostr = "$hostsinfostr$item:\n"; - my $itemdictref = $hostinfo_dict{$item}; - my %itemdict = %$itemdictref; - foreach (keys %itemdict){ - $hostsinfostr = "$hostsinfostr $_=\"$itemdict{$_}\"\n"; - } } - return 1, $hostsinfostr; + return 1, "OK"; } #------------------------------------------------------- @@ -2150,6 +2165,15 @@ sub validate_node_entry{ if (!($node_entry{$_} =~ /^[1-9]\d*$/)){ $errmsg .= "Specified slotid $node_entry{$_} is invalid"; } + }elsif ($_ eq "lparid"){ + if (not exists $node_entry{"cec"}){ + $errmsg .= "The lparid option must be used with the cec option.\n"; + } + }elsif ($_ eq "cec"){ + # 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 ($_ eq "nicips"){ # Check Multi-Nic's ip my $othernics = $node_entry{$_}; From 8bcf0a8717c876ba701c1edfa4dfd0c80e14f7d6 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 23 Sep 2013 01:08:58 -0700 Subject: [PATCH 149/184] bug 3795: node can not boot after cloning sles11.3 with legacy mode --- xCAT/postscripts/configefi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/configefi b/xCAT/postscripts/configefi index 5fb3d6295..da0e7face 100644 --- a/xCAT/postscripts/configefi +++ b/xCAT/postscripts/configefi @@ -47,8 +47,8 @@ else echo "grub-install --no-floppy --recheck $boot_device" grub-install --no-floppy --recheck $boot_device if [ $? -ne 0 ];then - #sles11, run grub install directly - grub-install + #sles11, run grub-install.unsupported directly + grub-install.unsupported --no-floppy --recheck $boot_device fi if [ -e /etc/mtab.bak ];then From e651a540d72ec1a10027465ff955f9f63ce01e72 Mon Sep 17 00:00:00 2001 From: Sheng Feng Xing Date: Mon, 23 Sep 2013 15:29:30 +0800 Subject: [PATCH 150/184] Commit new nodeimport man page into 2.8 branch for Power rack-mount node support --- xCAT-client/pods/man1/nodeimport.1.pod | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xCAT-client/pods/man1/nodeimport.1.pod b/xCAT-client/pods/man1/nodeimport.1.pod index 01f2ddf2d..994c9bcd1 100644 --- a/xCAT-client/pods/man1/nodeimport.1.pod +++ b/xCAT-client/pods/man1/nodeimport.1.pod @@ -123,6 +123,14 @@ To import nodes using a profile, follow the following steps: switch=myswitch switchport=9 + Example of a node information file that specifies a CEC-based rack-mounted Power node that uses direct FSP management: + # Node information file begins + # This entry defines a Power rack-mount node. + __hostname__: + mac=b8:ac:6f:37:59:28 + cec=mycec + # Node information file ends. + The node information file includes the following items: B<__hostname__:> This is a mandatory item. @@ -145,6 +153,10 @@ B> This is a mandatory item while define a PureFlex node. Description: The node position in the PureFlex Chassis. +B> This is a mandatory option for defining Power rack-mounted nodes. + +Description: Specifies the name of a Power rack-mount central electronic complex (CEC). + B> This is an optional item. Description: Specify the IP address used for provisioning a node, where is in the form xxx.xxx.xxx.xxx. If this item is not included, the IP address used to provision the node is generated automatically according to the Network Profile used by the node. From 4934dba5ea7461789272959821e5febcbb8dde53 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 23 Sep 2013 02:56:23 -0700 Subject: [PATCH 151/184] confignics modification for syntactics --- xCAT/postscripts/confignics | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index 9c7454e0d..b25163c94 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -208,7 +208,7 @@ do echo "confignics on $NODE: ip address,nic type and network are required. $key: $str_value ." continue fi - if [ "${array_temp[1]}" ];then + if [ -n "${array_temp[1]}" ];then str_nic_type=`echo ${array_temp[1]} | tr "[A-Z]" "[a-z]"` else if [ `echo $key | grep -E '(eth|en)[0-9]+'` ];then @@ -218,11 +218,11 @@ do fi fi - if [ $str_nic_type = "ethernet" ];then + if [ "$str_nic_type" = "ethernet" ];then logger -t xcat -p local4.info "confignics: call 'configeth $key ${array_temp[0]} ${array_temp[2]}'" echo "confignics on $NODE: call 'configeth $key ${array_temp[0]} ${array_temp[2]}'" configeth $key ${array_temp[0]} ${array_temp[2]} - elif [ $str_nic_type = "infiniband" ];then + elif [ "$str_nic_type" = "infiniband" ];then if [ $str_ib_nics ];then str_ib_nics=$str_ib_nics","$key else From 3583d5b59d01804d1a90e271206bb7ed5085fc73 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 23 Sep 2013 12:01:35 -0400 Subject: [PATCH 152/184] defect 3618 --- xCAT-server/sbin/xcatconfig | 45 ++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 0f46907b2..00102f048 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -241,6 +241,11 @@ if (xCAT::Utils->isMN()) { # Set tunables # # +if (($::settunables) && ( $::osname eq 'AIX')) { # not supported on AIX + xCAT::MsgUtils->message('E', "Setting tunables (-t) is not supported on AIX."); + exit 1; +} + if ($::FORCE || $::settunables || $::INITIALINSTALL ) { if ($::osname eq 'Linux') { @@ -848,9 +853,43 @@ sub genSSHRootKeys sub settunables { - xCAT::MsgUtils->message( - 'I', - "The set of tunables that will be initialized is TBD."); + # tuning ARP on Linux + # set for right now + my $cmd = "/bin/echo '1024' >/proc/sys/net/ipv4/neigh/default/gc_thresh1"; + my $outref = xCAT::Utils->runcmd("$cmd", 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message( 'E', "Could not run $cmd."); + } + $cmd = "/bin/echo '4096' >/proc/sys/net/ipv4/neigh/default/gc_thresh2"; + my $outref = xCAT::Utils->runcmd("$cmd", 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message( 'E', "Could not run $cmd."); + } + $cmd = "/bin/echo '8192' >/proc/sys/net/ipv4/neigh/default/gc_thresh3"; + my $outref = xCAT::Utils->runcmd("$cmd", 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message( 'E', "Could not run $cmd."); + } + # set for after reboot + if (!( -f "/etc/sysctl.conf.xcatbackup")){ # not already backed up + $cmd = "cp /etc/sysctl.conf /etc/sysctl.conf.xcatbackup"; + my $outref = xCAT::Utils->runcmd("$cmd", 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message( 'E', "Could not backup /etc/sysctl.conf."); + exit 1; + } + } + #delete all occurance of the attribute and then add xCAT settings + `sed -i '/net.ipv4.neigh.default.gc_thresh1 /'d /etc/sysctl.conf`; + `echo "net.ipv4.neigh.default.gc_thresh1 = 1024" >>/etc/sysctl.conf`; + `sed -i '/net.ipv4.neigh.default.gc_thresh2 /'d /etc/sysctl.conf`; + `echo "net.ipv4.neigh.default.gc_thresh2 = 4096" >>/etc/sysctl.conf`; + `sed -i '/net.ipv4.neigh.default.gc_thresh3 /'d /etc/sysctl.conf`; + `echo "net.ipv4.neigh.default.gc_thresh3 = 8192" >>/etc/sysctl.conf`; } #----------------------------------------------------------------------------- From f4296702e22544a7d71b131de55524891cf801d6 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Tue, 24 Sep 2013 02:16:39 -0700 Subject: [PATCH 153/184] bug 3798: confignics -s failed on sles11 sp3 --- xCAT/postscripts/configeth | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index f3e03aefe..d1e1d768e 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -421,7 +421,7 @@ elif [ "$1" = "-s" ];then fi if [ -f "/etc/debian_version" ];then - str_conf_file="/etc/sysconfig/network/ifcfg-${str_inst_nic}" + str_conf_file="/etc/network/interfaces.d/${str_inst_nic}" echo "auto ${str_inst_nic}" > $str_conf_file echo "iface ${str_inst_nic} inet static" >> $str_conf_file echo " address ${str_inst_ip}" >> $str_conf_file @@ -433,7 +433,7 @@ elif [ "$1" = "-s" ];then hostname $NODE echo $NODE > /etc/hostname elif [ -f "/etc/SuSE-release" ];then - str_conf_file="/etc/network/interfaces.d/${str_inst_nic}" + str_conf_file="/etc/sysconfig/network/ifcfg-${str_inst_nic}" echo "DEVICE=${str_inst_nic}" > $str_conf_file echo "BOOTPROTO=static" >> $str_conf_file echo "IPADDR=${str_inst_ip}" >> $str_conf_file From 1141e9cd7d99becd3bcf84240025749eb25b460b Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 24 Sep 2013 10:24:49 -0400 Subject: [PATCH 154/184] defect 3799 --- xCAT-server/lib/xcat/plugins/updatenode.pm | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 7ffa384d5..5ea27a64b 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -1551,7 +1551,17 @@ sub buildnodestatus if($line =~ /^\s*(\S+)\s*:\s*Remote_command_successful/) { my ($node,$info) = split (/:/, $line); - if ($::REPORTSTATUS eq "Y" ) { # return status NOW + if ($::REPORTSTATUS eq "Y" ) { # return status NOW + if (grep(/^$node$/, @::FAILEDNODES)) { # already on the fail buffer + my $rsp2 = {}; # report failed + $rsp2->{status}->[0] = "$node: FAILED"; + $::CALLERCALLBACK->($rsp2); + # update the nodelist table updatestatus flag for the node + my $stat="failed"; + my @nodearray=(); + push @nodearray,$node; + xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); + } else { # completely successful my $rsp2 = {}; $rsp2->{status}->[0] = "$node: SUCCEEDED"; $::CALLERCALLBACK->($rsp2); @@ -1560,6 +1570,7 @@ sub buildnodestatus my @nodearray=(); push @nodearray,$node; xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); + } } if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer next; @@ -1811,6 +1822,16 @@ sub getdata { my ($node,$info) = split (/:/, $output); if ($::REPORTSTATUS eq "Y" ) { # return status NOW + if (grep(/^$node$/, @::FAILEDNODES)) { # already on the fail buffer + my $rsp2 = {}; # report failed + $rsp2->{status}->[0] = "$node: FAILED"; + $::CALLERCALLBACK->($rsp2); + # update the nodelist table updatestatus flag for the node + my $stat="failed"; + my @nodearray=(); + push @nodearray,$node; + xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); + } else { # completely successful my $rsp2 = {}; $rsp2->{status}->[0] = "$node: SUCCEEDED"; $::CALLERCALLBACK->($rsp2); @@ -1819,6 +1840,7 @@ sub getdata my @nodearray=(); push @nodearray,$node; xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); + } } if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer next; @@ -1853,6 +1875,16 @@ sub getdata } } else { # already installed is ok if ($::REPORTSTATUS eq "Y" ) { # return status NOW + if (grep(/^$node$/, @::FAILEDNODES)) { # already on the fail buffer + my $rsp2 = {}; # report failed + $rsp2->{status}->[0] = "$node: FAILED"; + $::CALLERCALLBACK->($rsp2); + # update the nodelist table updatestatus flag for the node + my $stat="failed"; + my @nodearray=(); + push @nodearray,$node; + xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); + } else { # completely successful my $rsp2 = {}; $rsp2->{status}->[0] = "$node: SUCCEEDED"; $::CALLERCALLBACK->($rsp2); @@ -1861,6 +1893,7 @@ sub getdata my @nodearray=(); push @nodearray,$node; xCAT::TableUtils->setUpdateStatus(\@nodearray, $stat); + } } if (grep(/^$node$/, @::SUCCESSFULLNODES)) { # already on the buffer next; From 203d7025ada03cb10da0880ec0211b007ef5d1ba Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 24 Sep 2013 20:58:48 -0400 Subject: [PATCH 155/184] Phase 1 of SVC plugin implementation This commit is able to create storage in an existing mdisk grp. It hardcodes the iogrp to 0 for now. The next step is to make hosts and vhostmap. mkhost -name -hbawwpn -force And then map them together: mkvdiskhostmap -host -force If boot, store the wwn into storage.osvolume for future use. Commands to do: attachstorage detachstorage showstorage rmstorage suspect frontending: lsmdiskgrp to show state of avail space will be appropriate --- perl-xCAT/xCAT/Schema.pm | 14 +- xCAT-server/lib/perl/xCAT/SSHInteract.pm | 11 +- xCAT-server/lib/xcat/plugins/svc.pm | 205 +++++++++++++++++++++++ 3 files changed, 226 insertions(+), 4 deletions(-) create mode 100644 xCAT-server/lib/xcat/plugins/svc.pm diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index bc4d38fa6..9f2f705de 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -267,11 +267,14 @@ virtsd => { }, storage => { - cols => [qw(node osvolume size state storagepool hypervisor fcprange volumetag comments disable)], + cols => [qw(node osvolume size state storagepool hypervisor fcprange volumetag type controller comments disable)], keys => [qw(node)], table_descr => 'Node storage resources', descriptions => { node => 'The node name', + controller => 'The management address to attach/detach new volumes. + In the scenario involving multiple controllers, this data must be + passed as argument rather than by table value', osvolume => "Specification of what storage to place the node OS image onto. Examples include: localdisk (Install to first non-FC attached disk) usbdisk (Install to first USB mass storage device seen) @@ -281,6 +284,7 @@ storage => { storagepool => 'Name of storage pool where the volume is assigned.', hypervisor => 'Name of the hypervisor where the volume is configured.', fcprange => 'A range of acceptable fibre channels that the volume can use. Examples include: 3B00-3C00;4B00-4C00.', + type => 'The plugin used to drive storage configuration (e.g. svc)', volumetag => 'A specific tag used to identify the volume in the autoyast or kickstart template.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", @@ -2219,6 +2223,14 @@ my @nodeattrs = ( tabentry => 'storage.osvolume', access_tabentry => 'storage.node=attr:node', }, + {attr_name => 'storagcontroller', + tabentry => 'storage.controller', + access_tabentry => 'storage.node=attr:node', + }, + {attr_name => 'storagetype', + tabentry => 'storage.type', + access_tabentry => 'storage.node=attr:node', + }, ###################### # vm table # ###################### diff --git a/xCAT-server/lib/perl/xCAT/SSHInteract.pm b/xCAT-server/lib/perl/xCAT/SSHInteract.pm index be26fb5e2..9f95e8a7c 100644 --- a/xCAT-server/lib/perl/xCAT/SSHInteract.pm +++ b/xCAT-server/lib/perl/xCAT/SSHInteract.pm @@ -66,14 +66,19 @@ sub new { $self->print($password); my $nextline = $self->getline(); chomp($nextline); - while ($nextline =~ /^\s*$/) { + while ($nextline =~ /^\s*$/ or $nextline =~ /^Last login:/) { $nextline = $self->get(); chomp($nextline); } if ($nextline =~ /password:/i or $nextline =~ /Permission denied, please try again/ or $nextline =~ /disconnect from/) { die "Incorrect Password"; - } elsif ($nextline =~ /$promptex/) { - *$self->{_xcatsshinteract}->{_atprompt}=1; + } else { + while ($nextline =~ /^Last login:/) { + $nextline = $self->get(); + } + if ($nextline =~ /$promptex/) { + *$self->{_xcatsshinteract}->{_atprompt}=1; + } } } elsif ($match =~ /$promptex/) { *$self->{_xcatsshinteract}->{_atprompt}=1; diff --git a/xCAT-server/lib/xcat/plugins/svc.pm b/xCAT-server/lib/xcat/plugins/svc.pm new file mode 100644 index 000000000..a9990be10 --- /dev/null +++ b/xCAT-server/lib/xcat/plugins/svc.pm @@ -0,0 +1,205 @@ +# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html +#---------------------------------------------------------------------- + +# Plugin to interface with IBM SVC managed storage +# +use strict; + +package xCAT_plugin::svc; + +use xCAT::SvrUtils qw/sendmsg/; +use xCAT::SSHInteract; +use Getopt::Long; +Getopt::Long::Configure("bundling"); +Getopt::Long::Configure("pass_through"); + +my $callback; +my $dorequest; +my %controllersessions; + +sub handled_commands { + return { + mkstorage => "storage:type", + rmstorage => "storage:type", + } +} + +sub mkstorage { + my $request = shift; + my $ctx = shift; + my @nodes = @{$request->{node}}; + my $shared = 0; + my $controller; + my $pool; + my $size; + my $boot = 0; + unless (ref $request->{arg}) { + die "TODO: usage"; + } + @ARGV = @{$request->{arg}}; + unless (GetOptions( + 'shared' => \$shared, + 'controller=s' => \$controller, + 'boot' => \$boot, + 'size=f' => \$size, + 'pool=s' => \$pool, + )) { + foreach (@nodes) { + sendmsg([1,"Error parsing arguments"],$callback,$_); + } + } + if ($shared and $boot) { + foreach (@nodes) { + sendmsg([1,"Storage can not be both shared and boot"],$callback,$_); + } + } + my $storagetab = xCAT::Table->new('storage'); + my $storents = $storagetab->getNodesAttribs(\@nodes, + [qw/controller storagepool size/]); + if ($shared) { + unless ($size) { + foreach (@nodes) { + sendmsg([1, + "Size for shared volumes must be specified as an argument" + ], $callback,$_); + } + } + unless ($pool) { + $pool = assure_identical_table_values(\@nodes, $storents, 'storagepool'); + } + unless ($controller) { + $controller = assure_identical_table_values(\@nodes, $storents, 'controller'); + } + unless (defined $pool and defined $controller) { + return; + } + my $lun = create_lun(controller=>$controller, size=>$size, pool=>$pool); + my $wwns = get_wwns(@nodes); + } else { + foreach my $node (@nodes) { + mkstorage_single(node=>$node, size=>$size, pool=>$pool, + boot=>$boot, controller=>$controller, + cfg=>$storents->{$node}); + } + } +} + +sub got_wwns { + use Data::Dumper; + print Dumper(@_); +} + +sub get_wwns { + my @nodes = @_; + my %request = ( + node => \@nodes, + command => [ 'rinv' ], + arg => [ 'wwn' ] + ); + use Data::Dumper; + print Dumper(\%request); + $dorequest->(\%request, \&got_wwns); +} + +my $globaluser; +my $globalpass; +sub get_svc_creds { + my $controller = shift; + if ($globaluser and $globalpass) { + return { 'user' => $globaluser, 'pass' => $globalpass } + } + my $passtab = xCAT::Table->new('passwd',-create=>0); + my $passent = $passtab->getAttribs({key=>'svc'}, qw/username password/); + $globaluser = $passent->{username}; + $globalpass = $passent->{password}; + return { 'user' => $globaluser, 'pass' => $globalpass } +} + +sub establish_session { + my %args = @_; + my $controller = $args{controller}; + if ($controllersessions{$controller}) { + return $controllersessions{$controller}; + } + #need to establish a new session + my $cred = get_svc_creds($controller); + my $sess = new xCAT::SSHInteract(-username=>$cred->{user}, + -password=>$cred->{pass}, + -host=>$controller, + -output_record_separator=>"\r", + #Errmode=>"return", + #Input_Log=>"/tmp/svcdbgl", + Prompt=>'/>$/'); + unless ($sess and $sess->atprompt) { die "TODO: cleanly handle bad login" } + $controllersessions{$controller} = $sess; + return $sess; +} + +sub create_lun { + my %args = @_; + my $session = establish_session(%args); + my $pool = $args{pool}; + my $size = $args{size}; + my @result = $session->cmd("mkvdisk -iogrp io_grp0 -mdiskgrp $pool -size $size -unit gb"); + if ($result[0] =~ m/Virtual Disk, id \[(\d*)\], successfully created/) { + my $diskid = $1; + my $name; + my $wwn; + @result = $session->cmd("lsvdisk $diskid"); + foreach (@result) { + chomp; + if (/^name (.*)\z/) { + $name = $1; + } elsif (/^vdisk_UID (.*)\z/) { + $wwn = $1; + } + } + return { name => $name, id => $diskid, wwn => $wwn }; + } +} + +sub assure_identical_table_values { + my $nodes = shift; + my $storents = shift; + my $attribute = shift; + my $lastval; + foreach my $node (@$nodes) { + my $sent = $storents->{$node}->[0]; + unless ($sent) { + sendmsg([1, "No $attribute in arguments or table"], + $callback, $node); + return undef; + } + my $currval = $storents->{$node}->{$attribute}; + unless ($currval) { + sendmsg([1, "No $attribute in arguments or table"], + $callback, $node); + return undef; + } + if ($lastval and $currval ne $lastval) { + sendmsg([1, + "$attribute mismatch in table config, try specifying as argument"], + $callback, $node); + return undef; + } + } + return $lastval; +} + +sub mkstorage_single { + my %args = @_; +} + +sub process_request { + my $request = shift; + $callback = shift; + $dorequest = shift; + if ($request->{command}->[0] eq 'mkstorage') { + mkstorage($request); + } + foreach (values %controllersessions) { + $_->close(); + } +} + +1; From 239add6be27d624496b47f7f449da0b92b4f425d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 24 Sep 2013 21:04:02 -0400 Subject: [PATCH 156/184] Revert "Phase 1 of SVC plugin implementation" This reverts commit 203d7025ada03cb10da0880ec0211b007ef5d1ba. --- perl-xCAT/xCAT/Schema.pm | 14 +- xCAT-server/lib/perl/xCAT/SSHInteract.pm | 11 +- xCAT-server/lib/xcat/plugins/svc.pm | 205 ----------------------- 3 files changed, 4 insertions(+), 226 deletions(-) delete mode 100644 xCAT-server/lib/xcat/plugins/svc.pm diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 9f2f705de..bc4d38fa6 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -267,14 +267,11 @@ virtsd => { }, storage => { - cols => [qw(node osvolume size state storagepool hypervisor fcprange volumetag type controller comments disable)], + cols => [qw(node osvolume size state storagepool hypervisor fcprange volumetag comments disable)], keys => [qw(node)], table_descr => 'Node storage resources', descriptions => { node => 'The node name', - controller => 'The management address to attach/detach new volumes. - In the scenario involving multiple controllers, this data must be - passed as argument rather than by table value', osvolume => "Specification of what storage to place the node OS image onto. Examples include: localdisk (Install to first non-FC attached disk) usbdisk (Install to first USB mass storage device seen) @@ -284,7 +281,6 @@ storage => { storagepool => 'Name of storage pool where the volume is assigned.', hypervisor => 'Name of the hypervisor where the volume is configured.', fcprange => 'A range of acceptable fibre channels that the volume can use. Examples include: 3B00-3C00;4B00-4C00.', - type => 'The plugin used to drive storage configuration (e.g. svc)', volumetag => 'A specific tag used to identify the volume in the autoyast or kickstart template.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", @@ -2223,14 +2219,6 @@ my @nodeattrs = ( tabentry => 'storage.osvolume', access_tabentry => 'storage.node=attr:node', }, - {attr_name => 'storagcontroller', - tabentry => 'storage.controller', - access_tabentry => 'storage.node=attr:node', - }, - {attr_name => 'storagetype', - tabentry => 'storage.type', - access_tabentry => 'storage.node=attr:node', - }, ###################### # vm table # ###################### diff --git a/xCAT-server/lib/perl/xCAT/SSHInteract.pm b/xCAT-server/lib/perl/xCAT/SSHInteract.pm index 9f95e8a7c..be26fb5e2 100644 --- a/xCAT-server/lib/perl/xCAT/SSHInteract.pm +++ b/xCAT-server/lib/perl/xCAT/SSHInteract.pm @@ -66,19 +66,14 @@ sub new { $self->print($password); my $nextline = $self->getline(); chomp($nextline); - while ($nextline =~ /^\s*$/ or $nextline =~ /^Last login:/) { + while ($nextline =~ /^\s*$/) { $nextline = $self->get(); chomp($nextline); } if ($nextline =~ /password:/i or $nextline =~ /Permission denied, please try again/ or $nextline =~ /disconnect from/) { die "Incorrect Password"; - } else { - while ($nextline =~ /^Last login:/) { - $nextline = $self->get(); - } - if ($nextline =~ /$promptex/) { - *$self->{_xcatsshinteract}->{_atprompt}=1; - } + } elsif ($nextline =~ /$promptex/) { + *$self->{_xcatsshinteract}->{_atprompt}=1; } } elsif ($match =~ /$promptex/) { *$self->{_xcatsshinteract}->{_atprompt}=1; diff --git a/xCAT-server/lib/xcat/plugins/svc.pm b/xCAT-server/lib/xcat/plugins/svc.pm deleted file mode 100644 index a9990be10..000000000 --- a/xCAT-server/lib/xcat/plugins/svc.pm +++ /dev/null @@ -1,205 +0,0 @@ -# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html -#---------------------------------------------------------------------- - -# Plugin to interface with IBM SVC managed storage -# -use strict; - -package xCAT_plugin::svc; - -use xCAT::SvrUtils qw/sendmsg/; -use xCAT::SSHInteract; -use Getopt::Long; -Getopt::Long::Configure("bundling"); -Getopt::Long::Configure("pass_through"); - -my $callback; -my $dorequest; -my %controllersessions; - -sub handled_commands { - return { - mkstorage => "storage:type", - rmstorage => "storage:type", - } -} - -sub mkstorage { - my $request = shift; - my $ctx = shift; - my @nodes = @{$request->{node}}; - my $shared = 0; - my $controller; - my $pool; - my $size; - my $boot = 0; - unless (ref $request->{arg}) { - die "TODO: usage"; - } - @ARGV = @{$request->{arg}}; - unless (GetOptions( - 'shared' => \$shared, - 'controller=s' => \$controller, - 'boot' => \$boot, - 'size=f' => \$size, - 'pool=s' => \$pool, - )) { - foreach (@nodes) { - sendmsg([1,"Error parsing arguments"],$callback,$_); - } - } - if ($shared and $boot) { - foreach (@nodes) { - sendmsg([1,"Storage can not be both shared and boot"],$callback,$_); - } - } - my $storagetab = xCAT::Table->new('storage'); - my $storents = $storagetab->getNodesAttribs(\@nodes, - [qw/controller storagepool size/]); - if ($shared) { - unless ($size) { - foreach (@nodes) { - sendmsg([1, - "Size for shared volumes must be specified as an argument" - ], $callback,$_); - } - } - unless ($pool) { - $pool = assure_identical_table_values(\@nodes, $storents, 'storagepool'); - } - unless ($controller) { - $controller = assure_identical_table_values(\@nodes, $storents, 'controller'); - } - unless (defined $pool and defined $controller) { - return; - } - my $lun = create_lun(controller=>$controller, size=>$size, pool=>$pool); - my $wwns = get_wwns(@nodes); - } else { - foreach my $node (@nodes) { - mkstorage_single(node=>$node, size=>$size, pool=>$pool, - boot=>$boot, controller=>$controller, - cfg=>$storents->{$node}); - } - } -} - -sub got_wwns { - use Data::Dumper; - print Dumper(@_); -} - -sub get_wwns { - my @nodes = @_; - my %request = ( - node => \@nodes, - command => [ 'rinv' ], - arg => [ 'wwn' ] - ); - use Data::Dumper; - print Dumper(\%request); - $dorequest->(\%request, \&got_wwns); -} - -my $globaluser; -my $globalpass; -sub get_svc_creds { - my $controller = shift; - if ($globaluser and $globalpass) { - return { 'user' => $globaluser, 'pass' => $globalpass } - } - my $passtab = xCAT::Table->new('passwd',-create=>0); - my $passent = $passtab->getAttribs({key=>'svc'}, qw/username password/); - $globaluser = $passent->{username}; - $globalpass = $passent->{password}; - return { 'user' => $globaluser, 'pass' => $globalpass } -} - -sub establish_session { - my %args = @_; - my $controller = $args{controller}; - if ($controllersessions{$controller}) { - return $controllersessions{$controller}; - } - #need to establish a new session - my $cred = get_svc_creds($controller); - my $sess = new xCAT::SSHInteract(-username=>$cred->{user}, - -password=>$cred->{pass}, - -host=>$controller, - -output_record_separator=>"\r", - #Errmode=>"return", - #Input_Log=>"/tmp/svcdbgl", - Prompt=>'/>$/'); - unless ($sess and $sess->atprompt) { die "TODO: cleanly handle bad login" } - $controllersessions{$controller} = $sess; - return $sess; -} - -sub create_lun { - my %args = @_; - my $session = establish_session(%args); - my $pool = $args{pool}; - my $size = $args{size}; - my @result = $session->cmd("mkvdisk -iogrp io_grp0 -mdiskgrp $pool -size $size -unit gb"); - if ($result[0] =~ m/Virtual Disk, id \[(\d*)\], successfully created/) { - my $diskid = $1; - my $name; - my $wwn; - @result = $session->cmd("lsvdisk $diskid"); - foreach (@result) { - chomp; - if (/^name (.*)\z/) { - $name = $1; - } elsif (/^vdisk_UID (.*)\z/) { - $wwn = $1; - } - } - return { name => $name, id => $diskid, wwn => $wwn }; - } -} - -sub assure_identical_table_values { - my $nodes = shift; - my $storents = shift; - my $attribute = shift; - my $lastval; - foreach my $node (@$nodes) { - my $sent = $storents->{$node}->[0]; - unless ($sent) { - sendmsg([1, "No $attribute in arguments or table"], - $callback, $node); - return undef; - } - my $currval = $storents->{$node}->{$attribute}; - unless ($currval) { - sendmsg([1, "No $attribute in arguments or table"], - $callback, $node); - return undef; - } - if ($lastval and $currval ne $lastval) { - sendmsg([1, - "$attribute mismatch in table config, try specifying as argument"], - $callback, $node); - return undef; - } - } - return $lastval; -} - -sub mkstorage_single { - my %args = @_; -} - -sub process_request { - my $request = shift; - $callback = shift; - $dorequest = shift; - if ($request->{command}->[0] eq 'mkstorage') { - mkstorage($request); - } - foreach (values %controllersessions) { - $_->close(); - } -} - -1; From 089855bcd21dc0b63e1cadb9dc79320519fadd25 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 25 Sep 2013 01:49:56 -0400 Subject: [PATCH 157/184] defect 3779: change the output of driver injection to make it sensible --- xCAT-server/lib/xcat/plugins/anaconda.pm | 4 +++- xCAT-server/lib/xcat/plugins/sles.pm | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index afa0eca09..97096710d 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -3143,10 +3143,12 @@ sub insert_dd { @rpm_drivers = keys %dnhash; if (@rpm_list) { - if (@driver_list) { + if (@rpm_drivers) { push @{$rsp->{data}}, "The drivers:".join(',', sort(@rpm_drivers))." from ".join(',', sort(@rpm_list))." have been injected to initrd."; } elsif ($Injectalldriver) { push @{$rsp->{data}}, "All the drivers from :".join(',', sort(@rpm_list))." have been injected to initrd."; + } else { + push @{$rsp->{data}}, "No driver was injected to initrd."; } } diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 0bcdfb310..f9a660289 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -2298,10 +2298,10 @@ sub insert_dd () { @rpm_drivers = keys %dnhash; if (@rpm_list) { - if (@driver_list) { + if (@rpm_drivers) { push @{$rsp->{data}}, "The drivers:".join(',', sort(@rpm_drivers))." from ".join(',', sort(@rpm_list))." have been injected to initrd."; - } elsif ($Injectalldriver) { - push @{$rsp->{data}}, "All the drivers from :".join(',', sort(@rpm_list))." have been injected to initrd."; + } else { + push @{$rsp->{data}}, "No driver was injected to initrd."; } } xCAT::MsgUtils->message("I", $rsp, $callback); From f1976a7b99f7bdb32e1fdaed0f266c5ccfe8b5d6 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 25 Sep 2013 02:05:39 -0400 Subject: [PATCH 158/184] defect 3783: add the missing driver for sles11.3; fix the bug of adding new drivers with incorrect order --- xCAT-server/share/xcat/netboot/sles/genimage | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index a619a80e0..98f0b77be 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -794,7 +794,7 @@ if (@new_order) { } # add drivers for local disk support -push @ndrivers, ("ext3.ko", "virtio_pci.ko", "virtio_blk.ko", "ata_piix.ko", "libata.ko", "scsi_mod.ko", "ibmvscsi.ko", "megaraid_sas.ko", "pcieport.ko", "scsi_mod.ko", "sd_mod.ko"); +push @ndrivers, ("ext3.ko", "ext4.ko", "virtio_pci.ko", "virtio_blk.ko", "ata_piix.ko", "libata.ko", "scsi_mod.ko", "ibmvscsi.ko", "ibmvscsic.ko", "megaraid_sas.ko", "pcieport.ko", "sd_mod.ko"); open($moddeps,"<","$rootimg_dir/lib/modules/$kernelver/modules.dep"); my @moddeps = <$moddeps>; @@ -811,15 +811,24 @@ while (scalar @checkdeps) { foreach $dep (@deps) { $dep =~ s/.*\///; unless (grep { $_ eq $dep } @ndrivers) { #only add if not added - unshift (@checkdeps,$dep); #recursively check dependencies - unshift (@ndrivers,$dep); print "Added $dep as an autodetected depedency\n"; } + unshift (@checkdeps,$dep); #recursively check dependencies + unshift (@ndrivers,$dep); } } } close($moddeps); +#remove the duplicated drivers +my @fulldrivers; +foreach my $dn (@ndrivers) { + unless (grep {$_ eq $dn} @fulldrivers) { + push @fulldrivers, $dn; + } +} +@ndrivers = @fulldrivers; + # before mkinitrd, run depmod to generate the modules.dep system("chroot $rootimg_dir depmod $kernelver"); From 8b6feb6b306311dc415d878a84a636221a9b34b6 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 25 Sep 2013 07:23:16 -0400 Subject: [PATCH 159/184] add /install/custom directory --- xCAT-server/sbin/xcatsnap | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/xCAT-server/sbin/xcatsnap b/xCAT-server/sbin/xcatsnap index f895d4ea9..500f62b06 100755 --- a/xCAT-server/sbin/xcatsnap +++ b/xCAT-server/sbin/xcatsnap @@ -39,10 +39,18 @@ # This command can only be run by a root user. # #################################################################### - +BEGIN +{ + $::XCATROOT = + $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} + : -d '/opt/xcat' ? '/opt/xcat' + : '/usr'; +} +use lib "$::XCATROOT/lib/perl"; use File::Spec; use Getopt::Long; use strict; +require xCAT::MsgUtils; my $OSname; my @Commands_array; my $Command_name; @@ -193,7 +201,7 @@ sub snap_it { @files_array = ( "/etc/xcat/*","$::ROOTHOME/.xcat/*", "$INSTALLDIR/autoinst/*", - "$INSTALLDIR/postscripts/*", "$INSTALLDIR/prescripts/*", + "$INSTALLDIR/postscripts/*", "$INSTALLDIR/prescripts/*", "$INSTALLDIR/custom/*", "/tftpboot/*", "/var/log/consoles/*", "/etc/*-release", "/etc/dhcpd.conf", "/var/lib/dhcpd/dhcpd.leases", "/etc/hosts", "/etc/resolv.conf", @@ -332,7 +340,11 @@ if ($::HELP ) { exit 0; } if ($::VERSION) { - print " xcatsnap tool version 1.0\n"; + my $version = xCAT::Utils->Version(); + $version .= "\n"; + xCAT::MsgUtils->message("N", $version); + exit 0; + exit 0; } From 3d31d5f1124932e6b8ce20fcea9bc7a35dcc4ca0 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 25 Sep 2013 08:07:16 -0400 Subject: [PATCH 160/184] defect 3800 --- xCAT-buildkit/bin/buildkit | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 245c296b6..5ded2c6ab 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -23,9 +23,6 @@ BEGIN if ($^O =~ /^aix/i) { print "ERROR - buildkit is not supported on AIX \n"; exit 1; -# if AIX - make sure we include perl 5.8.2 in INC path. -# Needed to find perl dependencies shipped in deps tarball. -# unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); } use lib "$::XCATROOT/lib/perl"; @@ -582,6 +579,7 @@ sub kit_create } print "Kit template for $kitname created in $kitdir directory \n"; + return 0; } #----------------------------------------------------------------------------- @@ -644,7 +642,7 @@ sub kit_buildrepo if ( &kit_buildrepo1($kr->{kitrepoid}) ) { return 1; } } } - + return $rc; } #----------------------------------------------------------------------------- @@ -1030,7 +1028,7 @@ sub kit_cleantar print "Removed $::workdir/debbuild\n"; } } - return; + return 0; } #----------------------------------------------------------------------------- From 6e14118bcdf5dfcf75184f8776705e3533ff86e5 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 25 Sep 2013 08:13:00 -0400 Subject: [PATCH 161/184] sync back up 2.8.3 and 2.9 --- xCAT-buildkit/bin/buildkit | 3 --- 1 file changed, 3 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 5ded2c6ab..516a6c8da 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -3080,9 +3080,6 @@ sub kit_addpkgs $kitbfname =~ s/.tar.bz2$//; $kitbfname =~ s/.NEED_PRODUCT_PKGS$//; - -# ndebug - # my $tmpdir_base = "/tmp/buildkit_workdir/$kitbfname"; my $tmpdir_base = "/tmp/$kitbfname"; # Cleanup - should have been removed when last command ran From 9dcd216ac1b833b4895df754b866b5032ef0876b Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 26 Sep 2013 03:04:36 -0400 Subject: [PATCH 162/184] check in the code to support the driver injection for stateless: 1. genimage will copy the generated initrd to /tftpboot;2. support nodeset --noupdateinitrd --- xCAT-server/lib/xcat/plugins/anaconda.pm | 3 ++- xCAT-server/lib/xcat/plugins/genimage.pm | 27 ++++++++++++++++++++++++ xCAT-server/lib/xcat/plugins/sles.pm | 3 ++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 97096710d..446634564 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -172,6 +172,7 @@ sub mknetboot my $nodes = @{$req->{node}}; my @args = @{$req->{arg}} if(exists($req->{arg})); my @nodes = @{$req->{node}}; + my $noupdateinitrd = $req->{'noupdateinitrd'}; my $ostab = xCAT::Table->new('nodetype'); #my $sitetab = xCAT::Table->new('site'); my $linuximagetab; @@ -522,7 +523,7 @@ sub mknetboot } } - if ($docopy) { + if ($docopy && !$noupdateinitrd) { mkpath("$tftppath"); if (-f "$rootimgdir/hypervisor") { copy("$rootimgdir/hypervisor", "$tftppath"); diff --git a/xCAT-server/lib/xcat/plugins/genimage.pm b/xCAT-server/lib/xcat/plugins/genimage.pm index 6284a16eb..9108dec90 100644 --- a/xCAT-server/lib/xcat/plugins/genimage.pm +++ b/xCAT-server/lib/xcat/plugins/genimage.pm @@ -10,6 +10,7 @@ use xCAT::SvrUtils; use xCAT::Table; #use Data::Dumper; use File::Path; +use File::Copy; use Getopt::Long; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -169,6 +170,7 @@ sub process_request { $otherpkglist = $ref_linuximage_tab->{'otherpkglist'}; $postinstall_filename = $ref_linuximage_tab->{'postinstall'}; $destdir = $ref_linuximage_tab->{'rootimgdir'}; + $rootimg_dir = $ref_linuximage_tab->{'rootimgdir'}; $driverupdatesrc = $ref_linuximage_tab->{'driverupdatesrc'}; # TODO: how can we do if the user specifies one wrong value to the following attributes? @@ -363,6 +365,31 @@ sub process_request { # print FILE "\n"; #} #close FILE; + + # update the generated initrd to /tftpboot/xcat so that don't need to rerun nodeset to update them + if (($::RUNCMD_RC == 0) && $imagename) { + my $tftpdir = "/tftpboot"; + my @siteents = xCAT::TableUtils->get_site_attribute("tftpdir"); + if ($#siteents >= 0) + { + $tftpdir = $siteents[0]; + } + my $tftppath = "$tftpdir/xcat/osimage/$imagename"; + + my $installdir = "/install"; + @siteents = xCAT::TableUtils->get_site_attribute("installdir"); + if ($#siteents >= 0) + { + $installdir = $siteents[0]; + } + + unless (-d $tftppath) { + mkpath $tftppath; + } + copy("$rootimg_dir/initrd-stateless.gz", "$tftppath"); + copy("$rootimg_dir/initrd-statelite.gz", "$tftppath"); + copy("$rootimg_dir/kernel", "$tftppath"); + } #parse the output and save the image data to osimage and linuximage table save_image_data($callback, $doreq, $tempfile); diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index f9a660289..d887ce0a1 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -56,6 +56,7 @@ sub mknetboot my $globaltftpdir = "/tftpboot"; my $nodes = @{$req->{node}}; my @nodes = @{$req->{node}}; + my $noupdateinitrd = $req->{'noupdateinitrd'}; my $ostab = xCAT::Table->new('nodetype'); #my $sitetab = xCAT::Table->new('site'); my $linuximagetab; @@ -405,7 +406,7 @@ sub mknetboot } } - if ($docopy) { + if ($docopy && !$noupdateinitrd) { mkpath("$tftppath"); copy("$rootimgdir/kernel", "$tftppath"); if ($statelite) { From 9a9705a1bf7c50d7c30cd1406a614854435f04b9 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Thu, 26 Sep 2013 19:31:06 -0700 Subject: [PATCH 163/184] bug:3804 --- xCAT/postscripts/confignics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index b25163c94..4fc91aae6 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -203,7 +203,7 @@ do echo "confignics on $NODE: processing custom scripts: ${array_temp[3]} for interface $key" ${array_temp[3]} else - if [ -n "${array_temp[2]}" ];then + if [ -z "${array_temp[2]}" ];then logger -t xcat -p local4.info "confignics: ip address,nic type and network are required. $key: $str_value ." echo "confignics on $NODE: ip address,nic type and network are required. $key: $str_value ." continue From efd7d6eadbf1dabf036b031683f4841d251eeec8 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 27 Sep 2013 01:57:59 -0400 Subject: [PATCH 164/184] defect 3803: appending the default drvier list even new driver is specified in netdrivers attr; change the output message of genimage --- xCAT-server/share/xcat/netboot/rh/genimage | 47 +++++++++++++------- xCAT-server/share/xcat/netboot/sles/genimage | 25 +++++------ 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index aca1fc013..d99271dd1 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -174,15 +174,13 @@ if ($netdriver) { } } -# Use the default list if not specified -unless (@ndrivers) { - if ($arch eq 'x86' or $arch eq 'x86_64') { - @ndrivers = qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en virtio_net be2net/; - } elsif ($arch eq 'ppc64') { - @ndrivers = qw/e1000 e1000e igb ibmveth ehea/; - } elsif ($arch eq 's390x') { - @ndrivers = qw/qdio ccwgroup/; - } +# Add the default driver list +if ($arch eq 'x86' or $arch eq 'x86_64') { + push @ndrivers, qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en virtio_net be2net/; +} elsif ($arch eq 'ppc64') { + push @ndrivers, qw/e1000 e1000e igb ibmveth ehea/; +} elsif ($arch eq 's390x') { + push @ndrivers, qw/qdio ccwgroup/; } foreach (@ndrivers) { @@ -491,10 +489,6 @@ foreach my $dd (@dd_drivers) { print "Added driver $dd from driver update disk or driver rpm\n"; } -foreach my $driver (@ndrivers) { - print "Added driver $driver from root image\n"; -} - if (@new_order) { @ndrivers = (@new_order, @ndrivers); } @@ -514,14 +508,24 @@ while (scalar @checkdeps) { foreach $dep (@deps) { $dep =~ s/.*\///; unless (grep { $_ eq $dep } @ndrivers) { #only add if not added - unshift (@checkdeps,$dep); #recursively check dependencies - unshift (@ndrivers,$dep); print "Added $dep as an autodetected depedency\n"; } + unshift (@checkdeps,$dep); #recursively check dependencies + unshift (@ndrivers,$dep); } } } close($moddeps); + +#remove the duplicated drivers +my @fulldrivers; +foreach my $dn (@ndrivers) { + unless (grep {$_ eq $dn} @fulldrivers) { + push @fulldrivers, $dn; + } +} +@ndrivers = @fulldrivers; + unlink "/tmp/genimage.$$.yum.conf"; if (-d "$rootimg_dir/usr/share/dracut") { $dracutmode = 1; @@ -770,7 +774,17 @@ sub mkinitrd_dracut { # Add drivers to support local disk push @ndrivers, "ext3"; push @ndrivers, "ext4"; + #remove the duplicated drivers + my @fulldrivers; + foreach my $dn (@ndrivers) { + unless (grep {$_ eq $dn} @fulldrivers) { + push @fulldrivers, $dn; + } + } + @ndrivers = @fulldrivers; + my $add_drivers = join(' ', @ndrivers); + print "Try to load drivers: $add_drivers to initrd.\n"; my $DRACUTCONF; if ($mode eq "statelite") { @@ -1529,6 +1543,7 @@ sub isnetdriver { my $filetoadd = $File::Find::name; $filetoadd =~ s!$rootimg_dir/!!; push @filestoadd,[$filetoadd,"lib/$_"]; + print "Added driver $_ to initrd\n"; } } } @@ -1889,7 +1904,7 @@ sub load_dd () system ("cp -rf $real_path $rootimg_dir$1"); push @rpm_drivers, $driver; } else { - print "Error: cannot find the driver $driver from the driver rpms\n"; + print "Warning: cannot find the driver $driver from the driver rpms\n"; } } } elsif ($Injectalldriver) { diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 98f0b77be..35af5ee8d 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -173,15 +173,13 @@ if ($netdriver) { } } -# Use the default list if not specified -unless (@ndrivers) { - if ($arch eq 'x86' or $arch eq 'x86_64') { - @ndrivers = qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en be2net/; - } elsif ($arch eq 'ppc64') { - @ndrivers = qw/tg3 e1000 e1000e igb ibmveth ehea be2net/; - } elsif ($arch eq "s390x") { - @ndrivers = qw/qdio ccwgroup qeth qeth_l2 qeth_l3/; - } +# Add the default driver list +if ($arch eq 'x86' or $arch eq 'x86_64') { + push @ndrivers, qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en be2net/; +} elsif ($arch eq 'ppc64') { + push @ndrivers, qw/tg3 e1000 e1000e igb ibmveth ehea be2net/; +} elsif ($arch eq "s390x") { + push @ndrivers, qw/qdio ccwgroup qeth qeth_l2 qeth_l3/; } foreach (@ndrivers) { @@ -785,10 +783,6 @@ foreach my $dd (@dd_drivers) { print "Added driver $dd from driver update disk or driver rpm\n"; } -foreach my $driver (@ndrivers) { - print "Added driver $driver from root image\n"; -} - if (@new_order) { @ndrivers = (@new_order, @ndrivers); } @@ -1563,7 +1557,7 @@ EOMS print "The initial ramdisk for statelite has been generated successfully!\n"; } else { system("cd /tmp/xcatinitrd.$$;find .|cpio -H newc -o|gzip -9 -c - > $destdir/initrd-stateless.gz"); - print "The initial ramdisk for statelite has been generated successfully!\n"; + print "The initial ramdisk for stateless has been generated successfully!\n"; } system("rm -rf /tmp/xcatinitrd.$$"); @@ -1583,6 +1577,7 @@ sub isnetdriver { my $filetoadd = $File::Find::name; $filetoadd =~ s!$rootimg_dir!!; push @filestoadd,[$filetoadd,"lib/$_"]; + print "Added driver $_ to initrd\n"; } } } @@ -2001,7 +1996,7 @@ sub load_dd() system ("cp -rf $real_path $rootimg_dir$1"); push @rpm_drivers, $driver; } else { - print "Error: cannot find the driver $driver from the driver rpms\n"; + print "Warning: cannot find the driver $driver from the driver rpms\n"; } } } elsif ($Injectalldriver) { From daab6a0cde1f58e0d5fdecb907528acdb6dab08f Mon Sep 17 00:00:00 2001 From: xq2005 Date: Fri, 27 Sep 2013 02:51:23 -0700 Subject: [PATCH 165/184] ubuntu 13.04 stateful support --- xCAT-server/lib/xcat/plugins/debian.pm | 9 +++++++-- xCAT-server/share/xcat/install/scripts/pre.ubuntu | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 520ba0635..66ac98d99 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -831,7 +831,7 @@ sub mkinstall #} # need to add these in, otherwise aptitude will ask questions - $kcmdline .= " locale=en_US console-setup/layoutcode=us"; + $kcmdline .= " locale=en_US"; #$kcmdline .= " netcfg/wireless_wep= netcfg/get_hostname= netcfg/get_domain="; # default answers as much as possible, we don't want any interactiveness :) @@ -849,11 +849,16 @@ sub mkinstall #$kcmdline .= " DEBCONF_DEBUG=5"; # I don't need the timeout for ubuntu, but for debian there is a problem with getting dhcp in a timely manner - $kcmdline .= " netcfg/dhcp_timeout=120"; # safer way to set hostname, avoid problems with nameservers $kcmdline .= " hostname=".$node; + #from 12.10, the live install changed, so add the live-installer + if ( -r "$pkgdir/install/filesystem.squashfs") + { + $kcmdline .= " live-installer/net-image=http://${instserver}${pkgdir}/install/filesystem.squashfs"; + } + $bptab->setNodeAttribs( $node, { diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu b/xCAT-server/share/xcat/install/scripts/pre.ubuntu index b6a86c2d1..f6c9efd44 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu @@ -41,6 +41,7 @@ if [ -z "$instdisk" ]; then fi fi if [ ! -z "$instdisk" ]; then debconf-set partman-auto/disk "$instdisk"; fi +debconf-get open-iscsi/targets > /tmp/q sleep 0.1 done & From 4dd43607b8844aa42e14772ef40adb23f3a21962 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Fri, 27 Sep 2013 02:57:55 -0700 Subject: [PATCH 166/184] ubuntu 13.04 stateful support --- xCAT-server/share/xcat/install/ubuntu/compute.tmpl | 4 ++-- xCAT-server/share/xcat/install/ubuntu/kvm.tmpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index 76136115f..28a5ddefa 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -5,14 +5,14 @@ d-i localechooser/supported-locales multiselect en_US.UTF-8 # Keyboard Selection d-i console-setup/ask_detect boolean false -d-i console-setup/layoutcode string en +d-i keyboard-configuration/layoutcode string en ### Network Configuration d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string - +d-i netcfg/dhcp_timeout string 120 ### Mirror settings # If you select ftp, the mirror/country string does not need to be set. diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl index 76136115f..28a5ddefa 100644 --- a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl @@ -5,14 +5,14 @@ d-i localechooser/supported-locales multiselect en_US.UTF-8 # Keyboard Selection d-i console-setup/ask_detect boolean false -d-i console-setup/layoutcode string en +d-i keyboard-configuration/layoutcode string en ### Network Configuration d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string - +d-i netcfg/dhcp_timeout string 120 ### Mirror settings # If you select ftp, the mirror/country string does not need to be set. From 1fa9bdb32f88d070b0bb2b991a3865b0a0374991 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 27 Sep 2013 09:56:45 -0400 Subject: [PATCH 167/184] temp fix for defect 3797, at least get it working on SLES --- xCAT/postscripts/xcatflowrequest | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/xCAT/postscripts/xcatflowrequest b/xCAT/postscripts/xcatflowrequest index caa4b41cf..d44c7d6bd 100755 --- a/xCAT/postscripts/xcatflowrequest +++ b/xCAT/postscripts/xcatflowrequest @@ -5,22 +5,21 @@ # It is called by xcatdsklspost before calling getpostscripts.awk # it is called by remoteshell before calling getcredentials.awk # -exec {REMOTEFD}<>/dev/udp/$1/$2 -echo "resourcerequest: xcatd" >&$REMOTEFD +exec 50<>/dev/udp/$1/$2 +echo "resourcerequest: xcatd" >&50 parpid=$$ touch /tmp/goahead.$parpid touch /tmp/killme.$parpid exec 2> /dev/null while ! grep 'resourcerequest: ok' /tmp/goahead.$parpid > /dev/null; do ( - echo "resourcerequest: xcatd" >&$REMOTEFD - exec {LOCALFD}<>/proc/self/stat - read mystat<&$LOCALFD + echo "resourcerequest: xcatd" >&50 + exec 51<>/proc/self/stat + read mystat<&51 mypid=$(echo $mystat|cut -d " " -f 4) (sleep $(((RANDOM%60)+120)).$((RANDOM%50)); if [ -f /tmp/killme.$parpid ]; then kill -TERM $mypid; fi) & echo $! > /tmp/sleeperpid.$parpid - exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&$REMOTEFD - exec {LOCALFD}>&- + exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&50 ) done sleeper=$(cat /tmp/sleeperpid.$parpid) @@ -28,5 +27,4 @@ sleeper=$(ps -ef|awk "\$3==$sleeper"|awk '{print $2}') rm /tmp/goahead.$parpid rm /tmp/sleeperpid.$parpid rm /tmp/killme.$parpid -exec {REMOTEFD}>&- kill -TERM $sleeper From 6dec17db73003495f0f77dbb551a1ed1104a27bc Mon Sep 17 00:00:00 2001 From: John Simpson Date: Mon, 30 Sep 2013 16:51:00 -0400 Subject: [PATCH 168/184] Add support for missing NeXtScale sensors --- xCAT-server/lib/xcat/plugins/ipmi.pm | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 9951b02f0..29f225c5e 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -5366,6 +5366,57 @@ sub sensor_was_read { if (@exparts) { $extext = join(",",@exparts); } + } elsif ($sdr->sensor_type == 0x28) { + if ($exdata1 & 1) { + push @exparts,"Degraded or unavailable"; + } + if ($exdata1 & 1<<1) { + push @exparts,"Degraded or unavailable"; + } + if ($exdata1 & 1<<2) { + push @exparts,"Offline"; + } + if ($exdata1 & 1<<3) { + push @exparts,"Unavailable"; + } + if ($exdata1 & 1<<4) { + push @exparts,"Failure"; + } + if ($exdata1 & 1<<5) { + push @exparts,"FRU Failure"; + } + } elsif ($sdr->sensor_type == 0x2b) { + if ($exdata1 & 1) { + push @exparts,"Change detected"; + } + if ($exdata1 & 1<<1) { + push @exparts,"Firmware change detected"; + } + if ($exdata1 & 1<<2) { + push @exparts,"Hardware incompatibility detected"; + } + if ($exdata1 & 1<<3) { + push @exparts,"Firmware incompatibility detected"; + } + if ($exdata1 & 1<<4) { + push @exparts,"Unsupported hardware version"; + } + if ($exdata1 & 1<<5) { + push @exparts,"Unsupported firmware verion"; + } + if ($exdata1 & 1<<6) { + push @exparts,"Hardware change successful"; + } + if ($exdata1 & 1<<7) { + push @exparts,"Firmware change successful"; + } + } elsif ($sdr->sensor_type == 0x1b) { + if ($exdata1 & 1) { + push @exparts,"Cable connected"; + } + if ($exdata1 & 1<<1) { + push @exparts,"Incorrect cable connection"; + } } else { $extext = "xCAT needs to add support for ".$sdr->sensor_type; } From 83308c89e4d32c84057fa31c4c062e871326d8ed Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 1 Oct 2013 08:22:07 -0400 Subject: [PATCH 169/184] defect 3811 --- xCAT-server/lib/xcat/plugins/credentials.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/credentials.pm b/xCAT-server/lib/xcat/plugins/credentials.pm index 9d3d48615..6b667b494 100644 --- a/xCAT-server/lib/xcat/plugins/credentials.pm +++ b/xCAT-server/lib/xcat/plugins/credentials.pm @@ -138,7 +138,7 @@ sub process_request } elsif (/ssh_dsa_hostkey/) { if (-r "/etc/xcat/hostkeys/$client/ssh_host_dsa_key") { - $tfilename="/etc/xcat/hostkeys/$client/ssh_host_rsa_key"; + $tfilename="/etc/xcat/hostkeys/$client/ssh_host_dsa_key"; } elsif (-r "/etc/xcat/hostkeys/ssh_host_dsa_key") { $tfilename="/etc/xcat/hostkeys/ssh_host_dsa_key"; } else { From 5392fb7e3464f32562abb77afe87d71a5eda23d2 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 2 Oct 2013 09:12:29 -0400 Subject: [PATCH 170/184] defect 3797 --- xCAT/postscripts/xcatflowrequest | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/xCAT/postscripts/xcatflowrequest b/xCAT/postscripts/xcatflowrequest index d44c7d6bd..64a04c760 100755 --- a/xCAT/postscripts/xcatflowrequest +++ b/xCAT/postscripts/xcatflowrequest @@ -5,21 +5,36 @@ # It is called by xcatdsklspost before calling getpostscripts.awk # it is called by remoteshell before calling getcredentials.awk # -exec 50<>/dev/udp/$1/$2 -echo "resourcerequest: xcatd" >&50 +# check bash version, if < 4 then cannot use autodetect of next FD +bashversion=$BASH_VERSION +bashversionnum=`echo $bashversion | cut -d. -f1` +if [[ $bashversionnum > 3 ]]; then + exec {REMOTEFD}<>/dev/udp/$1/$2 +else + exec 50<>/dev/udp/$1/$2 + echo "resourcerequest: xcatd" >&50 + REMOTEFD=50 +fi +echo "resourcerequest: xcatd" >&$REMOTEFD parpid=$$ touch /tmp/goahead.$parpid touch /tmp/killme.$parpid exec 2> /dev/null while ! grep 'resourcerequest: ok' /tmp/goahead.$parpid > /dev/null; do ( - echo "resourcerequest: xcatd" >&50 - exec 51<>/proc/self/stat - read mystat<&51 + echo "resourcerequest: xcatd" >&$REMOTEFD + if [[ $bashversionnum > 3 ]]; then + exec {LOCALFD}<>/proc/self/stat + else + exec 51<>/proc/self/stat + LOCALFD=51 + fi + read mystat<&$LOCALFD mypid=$(echo $mystat|cut -d " " -f 4) (sleep $(((RANDOM%60)+120)).$((RANDOM%50)); if [ -f /tmp/killme.$parpid ]; then kill -TERM $mypid; fi) & echo $! > /tmp/sleeperpid.$parpid - exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&50 + exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&$REMOTEFD + exec {LOCALFD}>&- ) done sleeper=$(cat /tmp/sleeperpid.$parpid) @@ -27,4 +42,9 @@ sleeper=$(ps -ef|awk "\$3==$sleeper"|awk '{print $2}') rm /tmp/goahead.$parpid rm /tmp/sleeperpid.$parpid rm /tmp/killme.$parpid +if [[ $bashversionnum > 3 ]]; then + exec {REMOTEFD}>&- +else + exec 50>&- +fi kill -TERM $sleeper From fb71204859691d17f03c4488b32c7ea9a13d470d Mon Sep 17 00:00:00 2001 From: nott Date: Wed, 2 Oct 2013 11:29:07 -0400 Subject: [PATCH 171/184] support multi pakage dirs --- xCAT-buildkit/bin/buildkit | 206 +++++++++++++++++++++++-------------- 1 file changed, 126 insertions(+), 80 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 516a6c8da..af40aa41a 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -21,7 +21,7 @@ BEGIN } if ($^O =~ /^aix/i) { - print "ERROR - buildkit is not supported on AIX \n"; + print "ERROR - the buildkit command is not supported on AIX \n"; exit 1; } @@ -34,7 +34,6 @@ use Cwd 'abs_path'; use File::Path; use File::Basename; - #----------------------------------------------------------------------------- # Main @@ -393,7 +392,7 @@ while ($arg) { $::current_dir = $::workdir; } if ( ! $::KIT_CREATE ) { - print "kit basename not specified for buildkit create command \n"; + print "The Kit basename was not specified for the buildkit create command.\n"; &usage; exit 1; } @@ -402,7 +401,7 @@ while ($arg) { } elsif ( $command eq 'buildrepo' ) { $::KIT_BUILDREPO=shift(@ARGV); if ( ! $::KIT_BUILDREPO ) { - print "kit package repository name not specified for buildkit buildrepo command \n"; + print "The Kit package repository name was not specified for buildkit buildrepo command.\n"; &usage; exit 1; } @@ -424,17 +423,17 @@ while ($arg) { } elsif ( $command eq 'addpkgs' ) { $::KIT_ADDPKGS=shift(@ARGV); if (!($::KIT_ADDPKGS)){ - print "Missing parameter: must be specified with \'buildkit addpkgs\' \n"; + print "Missing parameter: the name must be specified when using the \'buildkit addpkgs\' command.\n"; &usage; exit (1); } if (!($::PKGDIR)){ - print "Missing option: -p must be specified with \'buildkit addpkgs\' \n"; + print "Missing option: the -p option must be specified with \'buildkit addpkgs\' command. \n"; &usage; exit (1); } } else { - print "buildkit command $arg not recognized \n"; + print "The buildkit command $arg is not recognized.\n"; &usage; exit (1); } @@ -470,8 +469,6 @@ if ( $::KIT_CLEANALL ) { } if ( $::KIT_ADDPKGS ) { $rc = &kit_addpkgs; } - - exit $rc; ##################################### @@ -619,20 +616,20 @@ sub kit_chkconfig #----------------------------------------------------------------------------- sub kit_buildrepo - { - my $rc = 0; my $repoid = $::KIT_BUILDREPO; if ( !$debianflag ){ - - # Check if createrepo bin exists or not. Fail at the beginning. - if (! (-e "/usr/bin/createrepo") ) { - print "Error: /usr/bin/createrepo does not exist, install createrepo first\n"; + # Check if createrepo exists or not. Fail at the beginning. + #- don't use specific path - may not be correct in build env + my $rcmd = "createrepo -h > /dev/null"; + if ( system( $rcmd ) ) { + print "Error: the createrepo command does not seem to be installed. Make sure createrepo is installed before running the buildkit command. \n"; return 1; } } + $repoid =~ s/\s+//g; $repoid =~ tr/A-Z/a-z/; # convert to lowercase if ( $repoid ne 'all' ) { @@ -654,11 +651,8 @@ sub kit_buildrepo =cut #----------------------------------------------------------------------------- - sub kit_buildrepo1 - { - my $rc = 0; my $repoid = shift; $repoid =~ s/\s+//g; @@ -818,8 +812,6 @@ sub kit_buildrepo1 return 0; } - - #----------------------------------------------------------------------------- =head3 kit_listrepo @@ -829,9 +821,7 @@ sub kit_buildrepo1 =cut #----------------------------------------------------------------------------- - sub kit_listrepo - { # print "Kit Repository: Status \n"; foreach my $kr (@{$::bldkit_config->{kitrepo}{entries}}) { @@ -853,9 +843,7 @@ sub kit_listrepo =cut #----------------------------------------------------------------------------- - sub kit_cleanrepo - { my $repoid = $::KIT_CLEANREPO; my $tmp_repoid = $repoid; @@ -915,9 +903,7 @@ sub kit_cleanrepo =cut #----------------------------------------------------------------------------- - sub kit_buildtar - { foreach my $kr (@{$::bldkit_config->{kitrepo}{entries}}) { if (&validate_repo($kr)) { @@ -1904,7 +1890,7 @@ sub build_kitcomp } return 0; } - + # find the kitrepo hash for this component foreach my $kr (@{$::bldkit_config->{kitrepo}{entries}}) { if ($comp->{kitrepoid} eq $kr->{kitrepoid}) { @@ -1913,7 +1899,7 @@ sub build_kitcomp } } my $repodir = $::base_repodir."/".$repo{kitreponame}; - + # Fix the kitpkgdeps value for this kitcomponent # For any kitpkgdep that has an rpm file in the repo, # specifically reference it's version-release @@ -2056,34 +2042,63 @@ sub update_kitcomp_kitpkgdeps my $repodir = shift; if (defined($comp->{kitpkgdeps})) { - my $new_kitpkgdeps = ''; - foreach my $d (split(/,/, $comp->{kitpkgdeps})) { - $d =~ s/\s+//g; - my $d_short = $d; - $d_short =~ s/^([\w\.\-]+)[<>=]*.*$/$1/; - if ( $d_short eq $d ) { - # no version-release comparisons specified for this kitpkgdep - # do we have an rpm file in the repo? - my $cmd = "rpm -q --qf \"%{NAME} >= %{VERSION}-%{RELEASE},\" -p $repodir/$d-\[0-9\]\*.rpm 2>/dev/null"; - if ($::VERBOSE) { - print "running rpm query to get version-release info: \n $cmd \n"; - } - my $new_d = `$cmd`; - chomp($new_d); - if ($::VERBOSE) { - print "output: \n \'$new_d\' \n"; - } - if ( $new_d ne '' ) { - $new_kitpkgdeps .= "$new_d,"; + # we have some rpms listed -n buildkit.conf file + my $new_kitpkgdeps = ''; + foreach my $d (split(/,/, $comp->{kitpkgdeps})) { + $d =~ s/\s+//g; + my $d_short = $d; + # strip off everything after ">=" + $d_short =~ s/^([\w\.\-]+)[<>=]*.*$/$1/; + + # if they are the same then there was no v/r info provided + if ( $d_short eq $d ) { + # no version-release comparisons specified for this kitpkgdep + # do we have this rpm file? + # get a list of any matches + my $lscmd = "cd $repodir; /bin/ls $d-\[0-9\]\*.rpm 2>/dev/null"; + my @rpmlist = `$lscmd`; + + if ( scalar(@rpmlist) == 0) { + print "Error: Could not find rpm named $d in $repodir. \n"; + next; + } + + # get the newest version there is + my $newestrpm = xCAT::BuildKitUtils->get_latest_version($repodir, \@rpmlist); + + if (!$newestrpm) { + print "Error: Could not determine the latest version of rpm $d contained in $repodir. \n"; + next; + } + + # get the Version and release values for this rpm + my $cmd = "rpm -q --qf \"%{NAME} >= %{VERSION}-%{RELEASE}\" -p $repodir/$newestrpm 2>/dev/null"; + if ($::VERBOSE) { + print "running rpm query to get version-release info: \n $cmd \n"; + } + + my $new_d = `$cmd`; + if (!$new_d) { + print "Error: Could not determine the latest version of rpm $d. \n"; + next; + } + + chomp($new_d); + if ($::VERBOSE) { + print "output: \n \'$new_d\' \n"; + } + if ( $new_d ne '' ) { + $new_kitpkgdeps .= "$new_d,"; + } else { + $new_kitpkgdeps .= "$d,"; + } } else { $new_kitpkgdeps .= "$d,"; } - } else { - $new_kitpkgdeps .= "$d,"; } - } - $new_kitpkgdeps =~ s/(\,)*$//; - $comp->{kitpkgdeps} = $new_kitpkgdeps; + + $new_kitpkgdeps =~ s/(\,)*$//; + $comp->{kitpkgdeps} = $new_kitpkgdeps; } return 0; } @@ -2091,7 +2106,7 @@ sub update_kitcomp_kitpkgdeps #----------------------------------------------------------------------------- =head3 gen_kitcomp_spec - + generate the rpm spec file for the kitcomponent metapkg rpm input: kitcomponent hash kitrepo hash @@ -2504,9 +2519,7 @@ sub gen_kitcomp_debdir{ =cut #----------------------------------------------------------------------------- - sub load_script - { my $scriptname = shift; my $SF; @@ -2524,8 +2537,6 @@ sub load_script return $script_contents; } - - #----------------------------------------------------------------------------- =head3 create_kitconf @@ -3075,13 +3086,14 @@ sub kit_addpkgs { # add RPM pkgs to an existing kit tarfile my $kittarfile=$::KIT_ADDPKGS; - my $rpmdir = $::PKGDIR; my $kitbfname = basename($kittarfile); $kitbfname =~ s/.tar.bz2$//; $kitbfname =~ s/.NEED_PRODUCT_PKGS$//; - my $tmpdir_base = "/tmp/$kitbfname"; + # - could be list of pkgdir s + my @pkgdirlist = split(",", $::PKGDIR); + # Cleanup - should have been removed when last command ran # - but just in case system ("rm -Rf $tmpdir_base"); @@ -3095,9 +3107,11 @@ sub kit_addpkgs } $kittarfile = abs_path($kittarfile); - if ( !(-d $rpmdir) ) { - print "The package directory $rpmdir could not be read. \n"; - return 1; + foreach my $rpmdir (@pkgdirlist) { + if ( !(-d $rpmdir) ) { + print "The package directory $rpmdir could not be read. \n"; + return 1; + } } # Create work directory @@ -3159,6 +3173,8 @@ sub kit_addpkgs exit 1; } + my $rpmdir=$::PKGDIR; + my $ext_filename = ''; my $ext_reponames = ''; my $non_native_filename = ''; @@ -3435,7 +3451,9 @@ sub NEW_kit_addpkgs # add RPM pkgs to an existing kit tarfile my $tmpdir_base = shift; my $tmpdir = shift; - my $rpmdir = $::PKGDIR; + + # - could be list of pkgdir dirs + my @pkgdirlist = split(",", $::PKGDIR); $::NEW_PARTIAL_KIT = 1; $::workdir = "$tmpdir_base/build_input"; @@ -3447,12 +3465,13 @@ sub NEW_kit_addpkgs if ($tmp_buildkit_conf ne $::full_buildkit_conf) { print "$tmp_buildkit_conf should match $::full_buildkit_conf .... error??? \n"; } + my $loadrc = &load_bldkitconf($tmp_buildkit_conf); if ( $loadrc != 0 ) { print "Error reading buildkit config file $tmp_buildkit_conf \n"; return 1; } - + if ( defined($::KITVERSION) ) { $::bldkit_config->{kit}{entries}[0]->{version} = $::KITVERSION; } @@ -3465,6 +3484,7 @@ sub NEW_kit_addpkgs print "Error validating buildkit config file $tmp_buildkit_conf \n"; return 1; } + if ($tmpdir ne $::deploy_dir) { if (system ("mv $tmpdir $::deploy_dir ") ) { print "Error moving $tmpdir to $::deploy_dir \n"; @@ -3475,20 +3495,23 @@ sub NEW_kit_addpkgs $::base_repodir = "$::deploy_dir/repos"; my $kitname = $::bldkit_config->{kit}{entries}[0]->{kitname}; - - # Handle external packages + # Handle external packages if ($::HAVE_EXTERNAL_PKG) { foreach my $kp (@{$::bldkit_config->{kitpackage}{entries}}) { if ($kp->{isexternalpkg} eq 'yes') { my $ext_filename = $kp->{filename}; my $ext_reponames = $kp->{kitreponame}; - my $fromfile = $rpmdir."/".$ext_filename; - if ( system("ls $fromfile > /dev/null") ){ - print "The product package file $ext_filename could not be read from the package directory $rpmdir. \n"; + + my $files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename); + my @fromfiles=@$files; + + if (scalar(@fromfiles) ==0 ) { + print "Error: The product package file $ext_filename was not found in the package directory(s) @pkgdirlist.\n"; # Cleanup system ("rm -Rf $tmpdir_base"); return 1; } + foreach my $repo (split(/,/, $ext_reponames)) { my $repodir = $::base_repodir."/".$repo; if ( ! -d ($repodir) && (! mkpath($repodir)) ) { @@ -3497,18 +3520,28 @@ sub NEW_kit_addpkgs system ("rm -Rf $tmpdir_base"); return 1; } + + foreach my $fromfile (@fromfiles) { if (system("cp -fp $fromfile $repodir")) { print "Error copying package file $fromfile to $repodir \n"; # Cleanup system ("rm -Rf $tmpdir_base"); return 1; } + } + if ($::VERBOSE) { + print "Copied @fromfiles\n to $repodir\n"; + } } } } } # Handle non_native_pkgs + # Comma-separated list of non-native package + # paths that will be included as files in this kit + # component. + # these are not RPMs! my $to_source_dir = "$::workdir/source_packages"; mkpath("$to_source_dir"); foreach my $kc (@{$::bldkit_config->{kitcomponent}{entries}}) { @@ -3519,16 +3552,28 @@ sub NEW_kit_addpkgs if ("$key" =~ /EXTERNALPKGS/) { #the $non_native_filename may contain several pkgs, can check and copy at the same time foreach my $nnpkg (split(/,/, $value)){ - - my $fromfile = $rpmdir."/".$nnpkg; - if ( system("ls $fromfile > /dev/null") ){ - print "The product package file $nnpkg could not be read from the package directory $rpmdir. \n"; - return 1; - } - if (system("cp -fp $fromfile $to_source_dir")) { - print "Error copying package file $fromfile to $to_source_dir \n"; - return 1; - } + my $found=0; + foreach my $pdir (@pkgdirlist) { + my $fromfile = $pdir."/".$nnpkg; + if ( system("ls $fromfile > /dev/null") ){ + next; + } else { + $found++; + if (system("cp -fp $fromfile $to_source_dir")) { + print "Error copying package file $fromfile to $to_source_dir \n"; + # Cleanup + system ("rm -Rf $tmpdir_base"); + next; + } else { + if ($::VERBOSE) { + print "Copied $fromfile to $to_source_dir\n"; + } + } + } + } + if (!$found) { + print "Could not find $nnpkg.\n"; + } } } } @@ -3539,6 +3584,7 @@ sub NEW_kit_addpkgs $::HAVE_EXTERNAL_PKG = ''; $::HAVE_NON_NATIVE_PKGS = ''; $::NON_NATIVE_PKGS = {}; + foreach my $kc (@{$::bldkit_config->{kitcomponent}{entries}}) { my $rc=0; if ( $debianflag ){ @@ -3552,6 +3598,7 @@ sub NEW_kit_addpkgs return 1; } } + # run createrepo foreach my $kr (@{$::bldkit_config->{kitrepo}{entries}}) { my $repodir = "$::base_repodir/$kr->{kitreponame}"; @@ -3575,7 +3622,6 @@ sub NEW_kit_addpkgs } } - # Build the full kit tar file my $buildtar_rc = &kit_buildtar; From 57b6ff1af731df005f45c9d0483493fa17a1c721 Mon Sep 17 00:00:00 2001 From: nott Date: Wed, 2 Oct 2013 11:32:00 -0400 Subject: [PATCH 172/184] add find_latest_pkg --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 101 ++++++++++++++++++- 1 file changed, 99 insertions(+), 2 deletions(-) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index 644837924..ee99d7905 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -85,7 +85,7 @@ sub get_latest_version my $fullrpmpath = "$repodir/$rpm*"; # get the basename, version, and release for this rpm - my $rcmd = "rpm -qp --queryformat '%{N} %{V} %{R}\n' $repodir/$rpm*"; + my $rcmd = "rpm -qp --queryformat '%{N} %{V} %{R}\n' $repodir/$rpm"; my $out = `$rcmd`; my ($rpkg, $VERSION, $RELEASE) = split(' ', $out); @@ -125,10 +125,107 @@ sub get_latest_version $i++; } - return ($file_name_hash{$versionout}{$releaseout}); + if ($i == 0) + { + print "Error: Could not determine the latest version for the following list of rpms: @rpmlist\n"; + return undef; + } else { + return ($file_name_hash{$versionout}{$releaseout}); + } +} + +#-------------------------------------------------------------------------- +=head3 find_latest_pkg + + Find the latest rpm package give the rpm name and a list of + possible package locations. + + Arguments: + - a list of package directories + - the name of the rpm + Returns: + - \@foundrpmlist + - undef + Example: + my $newrpm = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirs, $rpmname); + Comments: + +=cut +#-------------------------------------------------------------------------- +sub find_latest_pkg +{ + my ($class, $pkgdirs, $rpmname) = @_; + my @pkgdirlist = @$pkgdirs; + + 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 + foreach my $rpmdir (@pkgdirlist) { + my $ffile = $rpmdir."/".$rpmname; + + 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 %foundrpm hash + my $cmd = "/bin/ls $ffile 2>/dev/null"; + my $output = `$cmd`; + my @rpmlist = split(/\n/, $output); + + if ( scalar(@rpmlist) == 0) { + # no rpms to check + next; + } + + foreach my $r (@rpmlist) { + my $rcmd = "rpm -qp --queryformat '%{N} %{V} %{R}\n' $r*"; + my $out = `$rcmd`; + my ($name, $fromV, $fromR) = split(' ', $out); + chomp $fromV; + chomp $fromR; + + # ex. {ppe_rte_man}{/tmp/rpm1/ppe_rte_man-1.3.0.5-s005a.x86_64.rpm}{version}=$fromV; + $foundrpm{$name}{$r}{version}=$fromV; + $foundrpm{$name}{$r}{release}=$fromR; + +#print "name=$name, full=$r, verson= $fromV, release=$fromR\n"; + } + } + } + + # for each unique rpm basename + foreach my $r (keys %foundrpm ) { + # if more than one with same basename then find the latest + my $latestmatch=""; + foreach my $frpm (keys %{$foundrpm{$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 $frpm is newer than use it + if ( xCAT::BuildKitUtils->testVersion($foundrpm{$r}{$frpm}{version}, ">", $foundrpm{$r}{$latestmatch}{version}, $foundrpm{$r}{$frpm}{release}, $foundrpm{$r}{$latestmatch}{release}) ) { + $latestmatch = $frpm; + } + + } else { + $latestmatch = $frpm; + } + } + push(@rpms, $latestmatch); + } + + if (scalar(@rpms)) { + return \@rpms; + } else { + return undef; + } } #------------------------------------------------------------------------------ + + =head3 testVersion Compare version1 and version2 according to the operator and From b117fb3dbc0e128d0c1663d23979c7995e019ff7 Mon Sep 17 00:00:00 2001 From: nott Date: Wed, 2 Oct 2013 11:50:35 -0400 Subject: [PATCH 173/184] pkgdir support --- xCAT-buildkit/bin/buildkit | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index af40aa41a..aa485bbd4 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -34,6 +34,7 @@ use Cwd 'abs_path'; use File::Path; use File::Basename; + #----------------------------------------------------------------------------- # Main From 37d616d5fbe91b7303fd84a57ab56b95ee1aa8b2 Mon Sep 17 00:00:00 2001 From: nott Date: Wed, 2 Oct 2013 14:22:02 -0400 Subject: [PATCH 174/184] pkgdir support --- xCAT-buildkit/bin/buildkit | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index aa485bbd4..af40aa41a 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -34,7 +34,6 @@ use Cwd 'abs_path'; use File::Path; use File::Basename; - #----------------------------------------------------------------------------- # Main From 3790ae7b65f44ec57c66dc221b939f048094ce9b Mon Sep 17 00:00:00 2001 From: nott Date: Wed, 2 Oct 2013 14:24:24 -0400 Subject: [PATCH 175/184] add find_latest_pkg --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index ee99d7905..9a0dc30a4 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -13,6 +13,8 @@ if ($^O =~ /^aix/i) { unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); } + + use lib "$::XCATROOT/lib/perl"; use POSIX qw(ceil); use File::Path; From 8521b46ab22bafdf8dbf7a759005ef9b12560baf Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 24 Jul 2013 18:39:47 +0000 Subject: [PATCH 176/184] Add information about IBM backup firmware to rinv git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@17017 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/ipmi.pm | 62 +++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 29f225c5e..db22c7a1f 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1960,9 +1960,69 @@ sub got_fpga_buildid { $sessdata->{fpgabuildid} = $res{data}; get_imm_property(property=>"/v2/fpga/build_version",callback=>\&got_fpga_version,sessdata=>$sessdata); } else { - initfru_with_mprom($sessdata); + get_imm_property(property=>"/v2/ibmc/dm/fw/bios/backup_build_id",callback=>\&got_backup_bios_buildid,sessdata=>$sessdata); } } +sub got_backup_bios_buildid { + my %res = @_; + my $sessdata = $res{sessdata}; + if ($res{data}) { + $sessdata->{backupbiosbuild} = $res{data}; + get_imm_property(property=>"/v2/ibmc/dm/fw/bios/backup_build_version",callback=>\&got_backup_bios_version,sessdata=>$sessdata); + } else { + initfru_with_mprom($sessdata); + } +} + +sub got_backup_bios_version { + my %res = @_; + my $sessdata = $res{sessdata}; + if ($res{data}) { + $sessdata->{backupbiosversion} = $res{data}; + my $fru = FRU->new(); + $fru->rec_type("bios,uefi,firmware"); + $fru->desc("Backup UEFI Version"); + $fru->value($sessdata->{backupbiosversion}." (".$sessdata->{backupbiosbuild}.")"); + $sessdata->{fru_hash}->{backupuefi} = $fru; + get_imm_property(property=>"/v2/ibmc/dm/fw/imm2/backup_build_id",callback=>\&got_backup_imm_buildid,sessdata=>$sessdata); + } else { + initfru_with_mprom($sessdata); + } +} + +sub got_backup_imm_buildid { + my %res = @_; + my $sessdata = $res{sessdata}; + if ($res{data}) { + $sessdata->{backupimmbuild} = $res{data}; + get_imm_property(property=>"/v2/ibmc/dm/fw/imm2/backup_build_version",callback=>\&got_backup_imm_version,sessdata=>$sessdata); + } else { + initfru_with_mprom($sessdata); + } +} +sub got_backup_imm_version { + my %res = @_; + my $sessdata = $res{sessdata}; + if ($res{data}) { + $sessdata->{backupimmversion} = $res{data}; + get_imm_property(property=>"/v2/ibmc/dm/fw/imm2/backup_build_date",callback=>\&got_backup_imm_builddate,sessdata=>$sessdata); + } else { + initfru_with_mprom($sessdata); + } +} +sub got_backup_imm_builddate { + my %res = @_; + my $sessdata = $res{sessdata}; + if ($res{data}) { + $sessdata->{backupimmdate} = $res{data}; + my $fru = FRU->new(); + $fru->rec_type("bios,uefi,firmware"); + $fru->desc("Backup IMM Version"); + $fru->value($sessdata->{backupimmversion}." (".$sessdata->{backupimmbuild}." ".$sessdata->{backupimmdate}.")"); + $sessdata->{fru_hash}->{backupimm} = $fru; + } + initfru_with_mprom($sessdata); +} sub got_fpga_version { my %res = @_; my $sessdata = $res{sessdata}; From 7ec38c7be8acf8ba29b41daac365cec59b13286d Mon Sep 17 00:00:00 2001 From: xq2005 Date: Mon, 7 Oct 2013 22:59:22 -0700 Subject: [PATCH 177/184] bug 3809: get the dhcp info from lease file --- xCAT/postscripts/configeth | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index d1e1d768e..b29c8f1b5 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -388,21 +388,21 @@ elif [ "$1" = "-s" ];then exit 0 elif [ -f "/etc/debian_version" ];then str_lease_file="/var/lib/dhcp/dhclient."$str_inst_nic".leases" - if [ -e $str_lease_file ];then + if [ -e "$str_lease_file" ];then str_inst_ip=`grep fixed-address $str_lease_file | tail -n 1 | awk '{print $2}' | sed 's/;$//'` str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` fi elif [ -f "/etc/SuSE-release" ];then str_lease_file="/var/lib/dhcpcd/dhcpcd-"$str_inst_nic".info" - if [ -e $str_lease_file ];then + if [ -e "$str_lease_file" ];then str_inst_ip=`grep IPADDR $str_lease_file | tail -n 1 | awk -F'=' '{print $2}' | sed "s/'//g"` str_inst_mask=`grep NETMASK $str_lease_file | tail -n 1 | awk -F'=' '{print $2}' | sed "s/'//g"` str_inst_gateway=`grep GATEWAYS $str_lease_file | tail -n 1 | awk -F'=' '{print $2}' | sed "s/'//g"` fi else - str_lease_file=`ls /var/lib/dhclient/*$str_inst_nic*` - if [ -e $str_lease_file ];then + str_lease_file=`ls /var/lib/dhclient/*$str_inst_nic* | grep leases` + if [ -e "$str_lease_file" ];then str_inst_ip=`grep fixed-address $str_lease_file | tail -n 1 | awk '{print $2}' | sed 's/;$//'` str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'` From 80deb78f25656886b1099ea215118e97975c08f0 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Tue, 8 Oct 2013 01:42:55 -0700 Subject: [PATCH 178/184] bug 3808: error info when running confignics --- xCAT/postscripts/configeth | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index b29c8f1b5..356dbb872 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -784,9 +784,13 @@ else num_ipv4_index=0 num_ipv6_index=0 num_index=0 - cat $str_his_file | grep $str_nic_name - if [ $? -ne 0 ];then - echo "${str_nic_name}" >> $str_his_file + if [ -e "$str_his_file" ];then + grep $str_nic_name $str_his_file + if [ $? -ne 0 ];then + echo "${str_nic_name}" >> $str_his_file + fi + else + echo "${str_nic_name}" > $str_his_file fi #delete the old alias configuration files on redhat if [ "$str_os_type" = "redhat" ];then From 90c24d0ff71ac9958464dfa472f1dbdeec7b9046 Mon Sep 17 00:00:00 2001 From: jjhua Date: Tue, 8 Oct 2013 16:38:48 -0400 Subject: [PATCH 179/184] fixed bug 3796. At the end of genimage, remove the repositories of zypper. --- xCAT-server/share/xcat/netboot/sles/genimage | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 35af5ee8d..d22bf48eb 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -674,6 +674,8 @@ EOS_UNAME } +system("rm -rf $rootimg_dir/etc/zypp/repos.d/*"); + # output the changed the attributes so that it can be save into db by the caller. # all the information has been gathered # now, update the linuximage and osimage tables From 066696686f9283c2058a897a9c682fb0a4b90f7a Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 8 Oct 2013 15:31:17 -0400 Subject: [PATCH 180/184] defect 3816 --- xCAT-server/lib/perl/xCAT/Template.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 69c560e4e..b7c2e82bb 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -875,7 +875,11 @@ sub tabdb } } #$tmplerr="Unable to find requested $field from $table, with $key"; + my $savekey=$key; + $key = '$NODE'; # make sure we use getNodeAttribs when get_replacement + # calls this routine (tabdb) my $rep=get_replacement($table,$key,$field); + $key=$savekey; # restore just in case we rely on the node=$node setting if ($rep) { return tabdb($rep->[0], $rep->[1], $rep->[2]); } else { From ded2be133e354826601ddc502d55e63ffaafc165 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 9 Oct 2013 12:17:42 -0400 Subject: [PATCH 181/184] defect 3760 --- xCAT-server/lib/xcat/plugins/pxe.pm | 5 +++-- xCAT-server/lib/xcat/plugins/yaboot.pm | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/pxe.pm b/xCAT-server/lib/xcat/plugins/pxe.pm index 8fadc1e3e..24bec99af 100644 --- a/xCAT-server/lib/xcat/plugins/pxe.pm +++ b/xCAT-server/lib/xcat/plugins/pxe.pm @@ -129,7 +129,7 @@ sub setstate { $kcmdlinehack =~ s/#TABLE:([^:#]+):([^:#]+):([^:#]+)#/$naval/; } else { my $msg = "Table key of $2 not yet supported by boottarget mini-template"; - $callback->({ + $::callback->({ error => ["$msg"], errorcode => [1] }); @@ -148,7 +148,7 @@ sub setstate { unless ($ipfn) { my @myself = xCAT::NetworkUtils->determinehostname(); my $myname = $myself[(scalar @myself)-1]; - $callback->( + $::callback->( { error => [ "$myname: Unable to determine or reasonably guess the image server for $node" @@ -357,6 +357,7 @@ sub process_request { $request = shift; $callback = shift; my $sub_req = shift; + $::callback=$callback; my @args; my @nodes; my @rnodes; diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 2ee83de4e..e305ecfde 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -104,7 +104,7 @@ sub setstate { if (xCAT::InstUtils->is_me($sn)) { my @myself = xCAT::NetworkUtils->determinehostname(); my $myname = $myself[(scalar @myself)-1]; - $callback->( + $::callback->( { error => [ "$myname: Unable to determine the image server for $node on service node $sn" @@ -116,7 +116,7 @@ sub setstate { } } } else { - $callback->( + $::callback->( { error => [ "$myname: Unable to determine the image server for $node" @@ -408,6 +408,7 @@ sub preprocess_request { sub process_request { $request = shift; $callback = shift; + $::callback=$callback; $sub_req = shift; my $command = $request->{command}->[0]; %breaknetbootnodes=(); From cd79e33f7ca1cf7aeba87aa2103c752b6f498eea Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 9 Oct 2013 13:43:45 -0400 Subject: [PATCH 182/184] defect 3819 --- perl-xCAT/xCAT/Schema.pm | 2 ++ xCAT-server/sbin/xcatconfig | 1 + 2 files changed, 3 insertions(+) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index bc4d38fa6..201858754 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1032,6 +1032,8 @@ site => { " virtual network bridge up correctly. See\n". " https://sourceforge.net/apps/mediawiki/xcat/index.php?title=XCAT_Virtualization_with_KVM#Setting_up_a_network_bridge\n\n". " rsh/rcp will be setup and used on AIX. Default is yes.\n\n". + " useflowcontrol: (yes/1 or no/0). If yes, postscripts will use xcatd flow control. If no,\n". + " postscripts use wait and retry. Default is no.\n\n". " useNFSv4onAIX: (yes/1 or no/0). If yes, NFSv4 will be used with NIM. If no,\n". " NFSv3 will be used with NIM. Default is no.\n\n". " vcenterautojoin: When set to no, the VMWare plugin will not attempt to auto remove\n". diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 00102f048..5d0aa1191 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1243,6 +1243,7 @@ sub initDB $chtabcmds .= "$::XCATROOT/sbin/chtab key=vsftp site.value=n;"; $chtabcmds .= "$::XCATROOT/sbin/chtab key=cleanupxcatpost site.value=no;"; $chtabcmds .= "$::XCATROOT/sbin/chtab key=dhcplease site.value=43200;"; + $chtabcmds .= "$::XCATROOT/sbin/chtab key=useflowcontrol site.value=yes;"; if ($::osname eq 'AIX') { From 09dc9a129e68512ab072e76fe1068c15b4f29853 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 9 Oct 2013 15:23:47 -0400 Subject: [PATCH 183/184] defect 3819 --- xCAT/postscripts/remoteshell | 90 +++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 16 deletions(-) diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index a7b168cd1..85ef54d71 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -22,6 +22,11 @@ if [ "$(uname -s)" = "AIX" ]; then exit 0 fi master=$MASTER +# are we using xcat flow control +useflowcontrol=0 +if [ $USEFLOWCONTROL = "YES" ] || [ $USEFLOWCONTROL = "yes" ] || [ $USEFLOWCONTROL = "1" ]; then + useflowcontrol=1 +fi if [ -r /etc/ssh/sshd_config ] then @@ -71,13 +76,19 @@ if [ ! -x /usr/bin/openssl ]; then fi allowcred.awk & CREDPID=$! +sleep 1 -#first contact daemon xcatflowrequest 3001 -logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" -/$xcatpost/xcatflowrequest $master 3001 +if [ $useflowcontrol = "1" ]; then + #first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "remoteshell: sending /$xcatpost/xcatflowrequest $master 3001" + /$xcatpost/xcatflowrequest $master 3001 +fi getcredentials.awk ssh_dsa_hostkey | grep -E -v '|' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_dsa_hostkey +if [ $useflowcontrol = "1" ]; then + logger -t xCAT -p local4.info "remoteshell: received response /$xcatpost/xcatflowrequest $master 3001" +fi #check the message is an error or not grep -E '' /tmp/ssh_dsa_hostkey if [ $? -ne 0 ]; then @@ -88,15 +99,27 @@ if [ $? -ne 0 ]; then RETRY=0 MYCONT=`cat /etc/ssh/ssh_host_dsa_key` while [ -z "$MYCONT" ]; do + # not using flow control , need to sleep + if [ $useflowcontrol = "0" ]; then + let SLI=$RANDOM%10 + let SLI=SLI+10 + sleep $SLI + fi + RETRY=$(($RETRY+1)) if [ $RETRY -eq $MAX_RETRIES ] then break fi - #first contact daemon xcatflowrequest 3001 - logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" - /$xcatpost/xcatflowrequest $master 3001 + if [ $useflowcontrol = "1" ]; then + #first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "remoteshell: sending /$xcatpost/xcatflowrequest $master 3001" + /$xcatpost/xcatflowrequest $master 3001 + fi getcredentials.awk ssh_dsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_dsa_key + if [ $useflowcontrol = "1" ]; then + logger -t xCAT -p local4.info "remoteshell: received response /$xcatpost/xcatflowrequest $master 3001" + fi MYCONT=`cat /etc/ssh/ssh_host_dsa_key` done chmod 600 /etc/ssh/ssh_host_dsa_key @@ -115,10 +138,16 @@ fi rm /tmp/ssh_dsa_hostkey # first contact daemon xcatflowrequest 3001 - logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" -/$xcatpost/xcatflowrequest $master 3001 +if [ $useflowcontrol = "1" ]; then + #first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "remoteshell: sending /$xcatpost/xcatflowrequest $master 3001" + /$xcatpost/xcatflowrequest $master 3001 +fi getcredentials.awk ssh_rsa_hostkey | grep -E -v '|' | sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_rsa_hostkey +if [ $useflowcontrol = "1" ]; then + logger -t xCAT -p local4.info "remoteshell: received response /$xcatpost/xcatflowrequest $master 3001" +fi #check whether the message is an error or not grep -E '' /tmp/ssh_rsa_hostkey if [ $? -ne 0 ]; then @@ -129,16 +158,28 @@ if [ $? -ne 0 ]; then MAX_RETRIES=10 RETRY=0 while [ -z "$MYCONT" ]; do + # not using flow control , need to sleep + if [ $useflowcontrol = "0" ]; then + let SLI=$RANDOM%10 + let SLI=SLI+10 + sleep $SLI + fi RETRY=$(($RETRY+1)) if [ $RETRY -eq $MAX_RETRIES ] then break fi # first contact daemon xcatflowrequest 3001 - logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" - /$xcatpost/xcatflowrequest $master 3001 + if [ $useflowcontrol = "1" ]; then + #first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "remoteshell: sending /$xcatpost/xcatflowrequest $master 3001" + /$xcatpost/xcatflowrequest $master 3001 + fi getcredentials.awk ssh_rsa_hostkey | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /etc/ssh/ssh_host_rsa_key + if [ $useflowcontrol = "1" ]; then + logger -t xCAT -p local4.info "remoteshell: received response /$xcatpost/xcatflowrequest $master 3001" + fi MYCONT=`cat /etc/ssh/ssh_host_rsa_key` done chmod 600 /etc/ssh/ssh_host_rsa_key @@ -169,10 +210,16 @@ sleep 1 if [ $ENABLESSHBETWEENNODES = "YES" ]; then #first contact daemon xcatflowrequest 3001 - logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" - /$xcatpost/xcatflowrequest $master 3001 + if [ $useflowcontrol = "1" ]; then + #first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "remoteshell: sending /$xcatpost/xcatflowrequest $master 3001" + /$xcatpost/xcatflowrequest $master 3001 + fi getcredentials.awk ssh_root_key | grep -E -v '|'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /tmp/ssh_root_key + if [ $useflowcontrol = "1" ]; then + logger -t xCAT -p local4.info "remoteshell: received response /$xcatpost/xcatflowrequest $master 3001" + fi #check whether the message is an error or not grep -E '' /tmp/ssh_root_key if [ $? -ne 0 ]; then @@ -183,16 +230,27 @@ then MAX_RETRIES=10 RETRY=0 while [ -z "$MYCONT" ]; do + if [ $useflowcontrol = "0" ]; then + let SLI=$RANDOM%10 + let SLI=SLI+10 + sleep $SLI + fi RETRY=$(($RETRY+1)) if [ $RETRY -eq $MAX_RETRIES ] then break fi # first contact daemon xcatflowrequest 3001 - logger -t xCAT -p local4.info "xcatdsklspost: /$xcatpost/xcatflowrequest $master 3001" - /$xcatpost/xcatflowrequest $master 3001 - getcredentials.awk ssh_root_key | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /root/.ssh/id_rsa - MYCONT=`cat /root/.ssh/id_rsa` + if [ $useflowcontrol = "1" ]; then + #first contact daemon xcatflowrequest 3001 + logger -t xCAT -p local4.info "remoteshell: sending /$xcatpost/xcatflowrequest $master 3001" + /$xcatpost/xcatflowrequest $master 3001 + fi + getcredentials.awk ssh_root_key | grep -v '<'|sed -e 's/<//' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /root/.ssh/id_rsa + if [ $useflowcontrol = "1" ]; then + logger -t xCAT -p local4.info "remoteshell: received response /$xcatpost/xcatflowrequest $master 3001" + fi + MYCONT=`cat /root/.ssh/id_rsa` done else #This is an error message From cb77ac92d7e510d1b8d94b4a2cceb73a37a3cf3c Mon Sep 17 00:00:00 2001 From: Bruce Potter Date: Wed, 9 Oct 2013 19:54:10 -0400 Subject: [PATCH 184/184] fix setversionvars command not found problem during promote --- buildcore.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/buildcore.sh b/buildcore.sh index f6fee37ae..97ab6e8f4 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -141,6 +141,12 @@ else NOARCH=noarch fi +function setversionvars { + VER=`cat Version` + SHORTVER=`cat Version|cut -d. -f 1,2` + SHORTSHORTVER=`cat Version|cut -d. -f 1` +} + if [ "$PROMOTE" != 1 ]; then # very long if statement to not do builds if we are promoting # we are doing a snap build @@ -195,12 +201,6 @@ else # using svn GITUP=$SVNUP fi -function setversionvars { - VER=`cat Version` - SHORTVER=`cat Version|cut -d. -f 1,2` - SHORTSHORTVER=`cat Version|cut -d. -f 1` -} - setversionvars # Function for making the noarch rpms