From 46cab0033d252f0b7ce0300297608f5ceb205f35 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 23 Oct 2013 11:02:31 -0400 Subject: [PATCH 01/12] Have fsm server build drop seqdiscovery incurred requirements --- xCAT-server/xCAT-server.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index 83264f71a..cbacec3c9 100644 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -272,6 +272,7 @@ rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hmc.pm rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ivm.pm rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/lsslp.pm rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/slpdiscover.pm +rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/seqdiscovery.pm rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/remoteimmsetup.pm rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/IMMUtils.pm rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/RShellAPI.pm From 68649e7ee1ea8a2bd6ddd9a6da979ba486788c36 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 23 Oct 2013 13:23:37 -0400 Subject: [PATCH 02/12] defect 3851- handle multiple MN in DB --- perl-xCAT/xCAT/DSHCLI.pm | 16 +++++++++---- perl-xCAT/xCAT/ServiceNodeUtils.pm | 13 ++++++----- xCAT-server/lib/perl/xCAT/Postage.pm | 4 ++-- xCAT-server/lib/xcat/plugins/updatenode.pm | 7 +++--- xCAT-server/sbin/xcatconfig | 26 +++++++++++++--------- 5 files changed, 40 insertions(+), 26 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index ecdb2b4c3..73d1a9232 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -3237,7 +3237,14 @@ sub bld_resolve_nodes_hash # find out if we have an MN in the list, local cp and sh will be used # not remote shell - my $mname = xCAT::Utils->noderangecontainsMn(@target_list); + # find out the names for the Management Node + my @MNnodeinfo = xCAT::NetworkUtils->determinehostname; + my $mname = pop @MNnodeinfo; # hostname + #my $rsp = {}; + #$rsp->{info}->[0] = + # "Management node name is $mname."; + # xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); + foreach my $target (@target_list) { @@ -4079,11 +4086,12 @@ sub parse_and_run_dsh # check if any node in the noderange is the Management Node and exit # with error, if the Management Node is in the Database and in the # noderange - my $mname = xCAT::Utils->noderangecontainsMn(@nodelist); - if ($mname) { # MN in the nodelist + my @mname = xCAT::Utils->noderangecontainsMn(@nodelist); + if (@mname) { # MN in the nodelist + my $nodes=join(',', @mname); my $rsp = {}; $rsp->{error}->[0] = - "You must not run -K option against the Management Node:$mname."; + "You must not run -K option against the Management Node:$nodes."; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); return; } diff --git a/perl-xCAT/xCAT/ServiceNodeUtils.pm b/perl-xCAT/xCAT/ServiceNodeUtils.pm index 5bcf6508b..28bf81a98 100644 --- a/perl-xCAT/xCAT/ServiceNodeUtils.pm +++ b/perl-xCAT/xCAT/ServiceNodeUtils.pm @@ -242,12 +242,13 @@ sub getAllSN # if did not input "ALL" and there is a MN, remove it my @newservicenodes; if ((!defined($options)) || ($options ne "ALL")) { - my $mname = xCAT::Utils->noderangecontainsMn(@servicenodes); - if ($mname) { # if there is a MN - foreach my $nodes (@servicenodes) { - if ($mname ne ($nodes)){ - push @newservicenodes, $nodes; - } + my @mname = xCAT::Utils->noderangecontainsMn(@servicenodes); + if (@mname) { # if there is a MN + foreach my $node (@servicenodes) { + # check to see if node in MN list + if (!(grep(/^$node$/, @mname))) { # if node not in the MN array + push @newservicenodes, $node; + } } $servicenodetab->close; return @newservicenodes; # return without the MN in the array diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index 96c4699c3..2e12c6409 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -211,7 +211,7 @@ sub makescript { return; } - $mn = xCAT::Utils->noderangecontainsMn(@$nodes); + @::mn = xCAT::Utils->noderangecontainsMn(@$nodes); my $cfgflag=0; my $cloudflag=0; @@ -652,7 +652,7 @@ sub getNodeType my $node = shift; my $result; - if ( $node =~ /^$mn$/) { + if (grep(/^$node$/, @::mn)) { # is it in the Management Node array $result="MN"; return $result; } diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 3162d71fa..6adc76019 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -396,12 +396,13 @@ sub preprocess_updatenode # check to see if the Management Node is in the noderange and # if it is abort - my $mname = xCAT::Utils->noderangecontainsMn(@$nodes); - if ($mname) + my @mname = xCAT::Utils->noderangecontainsMn(@$nodes); + if (@mname) { # MN in the nodelist + my $nodes=join(',', @mname); my $rsp = {}; $rsp->{error}->[0] = - "You must not run -k option against the Management Node:$mname."; + "You must not run -k option against a management node: $nodes."; xCAT::MsgUtils->message("E", $rsp, $callback, 1); return; } diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 5d0aa1191..f9d0b428a 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -2124,23 +2124,27 @@ sub setupMNinDB my $defined = 0; my $cmds="XCATBYPASS=Y $::XCATROOT/sbin/tabdump nodelist | grep __mgmtnode"; - my $output = xCAT::Utils->runcmd("$cmds", -1); + my @output = xCAT::Utils->runcmd("$cmds", -1); + if ($::RUNCMD_RC == 0) # found a management node defined { my $chtabcmds; - my @mn = split(",", $output); + my @mn = split(",", $output[0]); $mn[0] =~ s/"//g; # remove the quotes if ($mn[0] ne $mnname) { # does not match current host name,delete it - $chtabcmds = "$::XCATROOT/sbin/chtab -d node=$mn[0] nodelist;"; - my $outref = xCAT::Utils->runcmd("$chtabcmds", 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message('E', "Could not run $chtabcmds."); - return; - } + my $size=@output; # if more than one management node defined, do not remove any + if ($size == 1) { + $chtabcmds = "$::XCATROOT/sbin/chtab -d node=$mn[0] nodelist;"; + my $outref = xCAT::Utils->runcmd("$chtabcmds", 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message('E', "Could not run $chtabcmds."); + return; + } + } } else { # it is defined and good - xCAT::MsgUtils->message('I', "$mnname already defined in the nodelist table."); - $defined=1; + xCAT::MsgUtils->message('I', "$mnname already defined in the nodelist table."); + $defined=1; } } # now add with the new name , if not already there From 25ab6e5f523cfb5bc3efbc9ba9dd7c25a68b2189 Mon Sep 17 00:00:00 2001 From: John Simpson Date: Wed, 23 Oct 2013 17:01:35 -0400 Subject: [PATCH 03/12] update to configfpc to add support for verbose and -i option and a ping verification --- xCAT-server/lib/xcat/plugins/configfpc.pm | 230 +++++++++++++++++----- 1 file changed, 177 insertions(+), 53 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/configfpc.pm b/xCAT-server/lib/xcat/plugins/configfpc.pm index 7ba94c4ff..e74f78d7d 100644 --- a/xCAT-server/lib/xcat/plugins/configfpc.pm +++ b/xCAT-server/lib/xcat/plugins/configfpc.pm @@ -17,6 +17,7 @@ use xCAT::NetworkUtils; use Data::Dumper; use xCAT::MacMap; use Socket; +use Net::Ping; ########################################################################## ## Command handler method from tables @@ -34,6 +35,41 @@ sub process_request { $::CALLBACK = $callback; + if ( defined( @{$::args} ) ) { + @ARGV = @{$::args}; + } + Getopt::Long::Configure( "bundling", "no_ignore_case", "no_pass_through" ); + my $getopt_success = Getopt::Long::GetOptions( + 'help|h|?' => \$::opt_h, + 'i|I=s' => \$::opt_I, + 'verbose|V' => \$::opt_V, + 'version|v' => \$::opt_v, + ); + + # Option -h for Help + if ( defined($::opt_h) || (!$getopt_success) ) { + &configfpc_usage; + return 0; + } + + if ( (!$::opt_I) ) { # missing required option - msg and return + my $rsp; + push @{ $rsp->{data} }, "Missing required option -i \n"; + xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); + &configfpc_usage; + return 0; + } + + # Option -V for verbose output + if ( defined($::opt_V) ) { + $::VERBOSE=$::opt_V; + } + + # Option -i for kit component attributes + if ( defined($::opt_I) ) { + $::interface = $::opt_I; + } + my $command = $request->{command}->[0]; my $localhostname = hostname(); @@ -53,6 +89,19 @@ sub process_request { return 0; } +sub configfpc_usage { + my $rsp; + push @{ $rsp->{data} }, + "\nUsage: configfpc - Configure the NeXtScale FPCs.i This command requires the -i option to give specify which network adapter to use to look for the FPCs.\n"; + push @{ $rsp->{data} }, + " configfpc -i interface_adapter \n "; + push @{ $rsp->{data} }, + " configfpc [-V|--verbose] -i adapter_interface \n "; + push @{ $rsp->{data} }, " configfpc [-h|--help|-?] \n"; + xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); + return 0; +} + # # Main process subroutine # @@ -87,6 +136,14 @@ sub configfpc { # This is the default FPC IP that we are looking for my $foundfpc = 0; + + # Setup routing to 182.168.0.100 network + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "Adding route definition for $::interface and 192.168.0.101 network"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } + my $setroute = `ip addr add dev $::interface 192.168.0.101/16`; # # check for an FPC - this ping will also add the FPC IP and MAC to the ARP table @@ -96,33 +153,25 @@ sub configfpc { if ( $res =~ /100% packet loss/g) { # xCAT::MsgUtils->message ("I", "There are no default $fpcip FPC IP addresses to process"); $foundfpc = 0; + + my %rsp = {}; + push@{ $rsp{data} }, "No nodes Found FPC with $fpcip address"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); exit; # EXIT if we find no more default IP addresses on the network } else { # xCAT::MsgUtils->message ("I", "Found $fpcip FPC IP addresses to process"); + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "Found FPC with $fpcip address"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } $foundfpc = 1; } - # - # make the FPC node definition - this is removed at the end of processing the FPCs - # this default FPC node definition is used by rspconfig to change the netmask, default route, and IP address of the default FPC - # - # Object name: deffpc - # bmc=deffpc - # bmcpassword=PASSW0RD - # bmcusername=USERID - # cons=ipmi - # groups=deffpc - # mgt=ipmi - # mpa=deffpc - # - my $out = xCAT::Utils->runxcmd( - { - command => ["mkdef"], - arg => [ "-t","node","-o",$defnode,"bmc=deffpc","bmcpassword=Passw0rd","bmcusername=USERID","cons=ipmi","groups=deffpc","mgt=ipmi","mpa=deffpc" ] - }, - $subreq, 0,1); - + + my $addnode = &add_node($defnode,$callback); + # # Main loop - check to see if we found an FPC and continue to set the FPC infomration and look for the next one # @@ -139,46 +188,55 @@ sub configfpc { # Change the FPC network netmask, gateway, and ip &set_FPC_network_parms($defnode,$netmask,$gateway,$newfpcip,$callback,$subreq); + + # message changed network settings + my %rsp = {}; + push@{ $rsp{data} }, "Configured FPC with MAC $fpcmac as $node ($newfpcip)"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); - # sleep for 4 seconds to allow rspconfig to change the IP value before validating with ping - sleep 5; - - # # Validate that new IP is working - Use ping to check if the new IP has been set - # - $res = `LANG=C ping -c 1 -w 5 $newfpcip`; - #$res = system("LANG=C ping -c 1 -w 5 $fpcip 2>&1"); - if ( $res =~ /100% packet loss/g) { - my %rsp; - push@{ $rsp{data} }, "The new ip $newfpcip was not accessible"; - xCAT::MsgUtils->message( "I", \%rsp, $callback ); - #xCAT::MsgUtils->message("I","The new ip $newfpcip was not accessible"); - } else { - my %rsp; - push@{ $rsp{data} }, "Changed the IP address for the FPC with $fpcmac MAC to $newfpcip IP for node $node"; - xCAT::MsgUtils->message( "I", \%rsp, $callback ); - #xCAT::MsgUtils->message("I","Changed the IP address for the FPC with $fpcmac MAC to $newfpcip IP for node $node"); + my $p = Net::Ping->new(); + my $ping_success=1; + while ($ping_success) { + if ($p->ping($newfpcip)) { + my %rsp = {}; + push@{ $rsp{data} }, "Verified the FPC with MAC $fpcmac is responding to the new IP $newfpcip as node $node"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + $ping_success=0; + } + else { + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "ping to $newfpcip is unsuccessful. Retrying "; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } + } } + $p->close(); + # The Node associated with this MAC was not found - print an infomrational message and continue } else { my %rsp; - push@{ $rsp{data} }, "No FPC node found that is associated with MAC address $fpcmac\nCheck to see if the switch and switch table conta ins the information needed to locate this FPC MAC"; + push@{ $rsp{data} }, "No FPC found that is associated with MAC address $fpcmac.\nCheck to see if the switch and switch table contain the information needed to locate this FPC MAC"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); - # xCAT::MsgUtils->message("I","No FPC node found that is associated with MAC address $fpcmac\nCheck to see if the switch and switch table contains the information needed to locate this FPC MAC"); } # # Delete this FPC default IP Arp entry to get ready to look for another defautl FPC # + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "Removing default IP $fpcip from the arp table"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } my $arpout = `arp -d $fpcip`; # check for another FPC $res = `LANG=C ping -c 1 -w 5 $fpcip 2>&1`; if ( $res =~ /100% packet loss/g) { my %rsp; - push@{ $rsp{data} }, "There are no more default $fpcip FPC IP addresses to process"; + push@{ $rsp{data} }, "There are no more FPCs with the default IP address to process"; xCAT::MsgUtils->message( "I", \%rsp, $callback ); - #xCAT::MsgUtils->message("I","There are no more default $fpcip FPC IP addresses to process"); $foundfpc = 0; } else { @@ -187,12 +245,30 @@ sub configfpc { } # - # Cleanup on the way out - Remove the deffpc node definition + # Cleanup on the way out - Delete route and remove the deffpc node definition # - $out=xCAT::Utils->runxcmd( + # Delete routing to 182.168.0.100 network + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "Deleting route definition for $::interface and 192.168.0.101 network"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } + my $setroute = `ip addr del dev $::interface 192.168.0.101/16`; + + # Delete routing to 182.168.0.100 network + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "Removing default FPC node definition $defnode"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } + + if($::VERBOSE){ $::VERBOSE = {}; } + #if($::VERBOSE){ undef $::VERBOSE; } + + my $out=xCAT::Utils->runxcmd( { command => ['rmdef'], - arg => [ "deffpc"] + arg => [ $defnode ] }, $subreq, 0,1); @@ -265,16 +341,18 @@ sub set_FPC_network_parms { # Proceed with changing the FPC network parameters. # Set FPC Netmask - - + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "Use rspconfig to set the FPC netmask $netmask for node $defnode"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } my $netmaskout = xCAT::Utils->runxcmd( { command => ["rspconfig"], - node => [$defnode], + node => ["$defnode"], arg => [ "netmask=$netmask" ] }, $request, 0,1); - if ($::RUNCMD_RC != 0) { my %rsp; push@{ $rsp{data} }, "Could not change nemask $netmask on default FPC"; @@ -283,14 +361,18 @@ sub set_FPC_network_parms { } # Set FPC gateway + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "Use rspconfig to set the FPC gateway $gateway"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } my $gatewayout = xCAT::Utils->runxcmd( { command => ["rspconfig"], - node => [$defnode], + node => ["$defnode"], arg => [ "gateway=$gateway" ] }, $request, 0,1); - if ($::RUNCMD_RC != 0) { my %rsp; push@{ $rsp{data} }, "Could not change gateway $gateway on default FPC"; @@ -298,16 +380,19 @@ sub set_FPC_network_parms { $error++; } - # Set FPC Ip address + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "Use rspconfig to set the FPC IP address $newfpcip"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } my $ipout = xCAT::Utils->runxcmd( { command => ["rspconfig"], - node => [$defnode], + node => ["$defnode"], arg => [ "ip=$newfpcip" ] }, $request, 0,1); - if ($::RUNCMD_RC != 0) { my %rsp; push@{ $rsp{data} }, "Could not change ip address $newfpcip on default FPC"; @@ -344,7 +429,46 @@ sub get_node { my $macmap = xCAT::MacMap->new(); my $node = ''; $node = $macmap->find_mac($fpcmac,0); + # verbose + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "Found FPC with MAC $fpcmac associated with node $node"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } return ($node,$fpcmac); } + +# +# This subroutine adds the deffpc node entry for use by rspconfig +# +sub add_node { + my $defnode = shift; + my $callback = shift; +# add this node entry +# Object name: feihu-fpc +# bmc=feihu-fpc (Table:ipmi - Key:node - Column:bmc) +# bmcpassword=PASSW0RD (Table:ipmi - Key:node - Column:password) +# bmcusername=USERID (Table:ipmi - Key:node - Column:username) +# cons=ipmi (Table:nodehm - Key:node - Column:cons) +# groups=fpc (Table:nodelist - Key:node - Column:groups) +# mgt=ipmi (Table:nodehm - Key:node - Column:mgt) +# + + if($::VERBOSE){ + my %rsp = {}; + push@{ $rsp{data} }, "Creating default FPC node deffpc with IP 192.168.0.100 for later use with rspconfig"; + xCAT::MsgUtils->message( "I", \%rsp, $callback ); + } + + my $nodelisttab = xCAT::Table->new('nodelist',-create=>1); + $nodelisttab->setNodeAttribs($defnode, {groups =>'defaultfpc'}); + my $nodehmtab = xCAT::Table->new('nodehm',-create=>1); + $nodehmtab->setNodeAttribs($defnode, {mgt => 'ipmi'}); + my $ipmitab = xCAT::Table->new('ipmi',-create=>1); + $ipmitab->setNodeAttribs($defnode, {bmc => $defnode, username => 'USERID', password => 'PASSW0RD'}); + +return 0; +} + 1; From 14d49836f88fdeda5f86b6a4955332f1d97a8068 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Thu, 24 Oct 2013 14:45:38 +0800 Subject: [PATCH 04/12] fixing bug 3848: add prerequisite component as dependency of kit component meta rpm --- xCAT-buildkit/bin/buildkit | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 2c4d2e374..02ca942cb 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -1915,6 +1915,8 @@ sub build_kitcomp # specifically reference it's version-release if ( &update_kitcomp_kitpkgdeps($comp,$repodir) ) { return 1; } + $::VALID_PRER_COMPONENT = 0; + if ( !$::PREREQUISITE ) { if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) { if ( &gen_kitcomp_spec($comp,\%repo, 'PREREQUISITE') ) { return 1; } @@ -1954,6 +1956,8 @@ sub build_kitcomp } } + $::VALID_PRER_COMPONENT = 1; + } if ( &gen_kitcomp_spec($comp,\%repo, 'METARPM') ) { return 1; } @@ -2271,7 +2275,12 @@ sub gen_kitcomp_spec s/<<>>/$::bldkit_config->{kit}{entries}[0]->{url}/; s/<<>>//; s/<<>>/$comp->{kitpkgdeps}/; - s/<<>>/$comp->{kitcompdeps}/; + #Update kitcompdeps for prep_ + if ( $::VALID_PRER_COMPONENT ) { + s/<<>>/$comp->{kitcompdeps},prep_$comp->{basename}/; + } else { + s/<<>>/$comp->{kitcompdeps}/; + } s/<<>>/$comp->{description}/; s/<<>>/$nonnativepkgs/; s/<<>>/$sourcetar/; From 07ee30b7bb4ceccbf211b192229ab5f4d3bc9158 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 23 Oct 2013 23:44:04 -0700 Subject: [PATCH 05/12] fix bug 3651: rspconfig with cmm does not execute or provide error when entry found in ipmi table --- perl-xCAT/xCAT/Utils.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index c64a87162..30fda8d1e 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3221,6 +3221,11 @@ sub filter_nodes{ if ($ipmitab) { $ipmitabhash = $ipmitab->getNodesAttribs(\@nodes,['bmc']); } + my $nodehmhash; + my $nodehmtab = xCAT::Table->new("nodehm"); + if ($nodehmtab) { + $nodehmhash = $nodehmtab->getNodesAttribs(\@nodes,['mgt']); + } my (@mp, @ngpfsp, @ngpbmc, @commonfsp, @commonbmc, @unknow); @@ -3230,6 +3235,15 @@ sub filter_nodes{ # if only in 'ipmi', a common x86 node foreach (@nodes) { if (defined ($mptabhash->{$_}->[0]) && defined ($mptabhash->{$_}->[0]->{'mpa'})) { + if ($mptabhash->{$_}->[0]->{'mpa'} eq $_) { + if (defined($nodehmhash->{$_}->[0]) && defined($nodehmhash->{$_}->[0]->{'mgt'}) && + $nodehmhash->{$_}->[0]->{'mgt'} eq "blade") { + push @mp, $_; + } else { + push @unknow, $_; + } + next; + } if (defined ($ppctabhash->{$_}->[0]) && defined ($ppctabhash->{$_}->[0]->{'hcp'})) { # flex power node push @ngpfsp, $_; @@ -3275,6 +3289,7 @@ sub filter_nodes{ } else { push @{$mpnodes}, @ngpfsp; } + push @{$mpnodes}, @ngpbmc; } elsif ($cmd eq "rvitals") { if (@args && (grep /^lcds$/,@args)) { push @{$fspnodes},@ngpfsp; From 2ff2cfe4e2ea5a8fff8874e1e9b14b48e92726c2 Mon Sep 17 00:00:00 2001 From: sjing Date: Thu, 24 Oct 2013 04:13:55 -0400 Subject: [PATCH 06/12] Handle the case where networks.nameservers is a comma delimited list --- xCAT-server/lib/xcat/plugins/ddns.pm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 78d655e3a..6516d25ad 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -295,14 +295,23 @@ sub process_request { my @networks = $networkstab->getAllAttribs('net','mask','ddnsdomain','domain','nameservers'); # exclude the net if it is using an external dns server. - foreach (@networks) + foreach my $net (@networks) { - if ($_ and $_->{nameservers}) + if ($net and $net->{nameservers}) { - my $myip = xCAT::NetworkUtils->my_ip_facing($_->{net}); - unless (($_->{nameservers} eq $myip) || ($_->{nameservers} eq '') || ($_->{nameservers} eq $sitens)) + my $valid = 0; + my $myip = xCAT::NetworkUtils->my_ip_facing($net->{net}); + foreach (split /,/, $net->{nameservers}) { - $_ = undef; + chomp $_; + if (($_ eq $myip) || ($_ eq '') || ($_ eq $sitens)) + { + $valid += 1; + } + } + unless ($valid > 0) + { + $net = undef; } } } From 0c5aa5d8bf6fd15ea923de3350f68538fc4190c4 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 24 Oct 2013 08:05:29 -0400 Subject: [PATCH 07/12] defect 3369: to add the flag -g for genimage command like for sles that make rh could handle the case that the kernel version is different with the name of kernel rpm when using -k to specify a new kernel version. --- xCAT-client/pods/man1/genimage.1.pod | 2 +- xCAT-server/lib/xcat/plugins/genimage.pm | 8 -------- xCAT-server/share/xcat/netboot/rh/genimage | 13 +++++++++---- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/xCAT-client/pods/man1/genimage.1.pod b/xCAT-client/pods/man1/genimage.1.pod index 9a65efa24..d297e6edd 100644 --- a/xCAT-client/pods/man1/genimage.1.pod +++ b/xCAT-client/pods/man1/genimage.1.pod @@ -132,7 +132,7 @@ in the install image. =item B<-g> I -This flag is for SLES only. Use this flag to specify the rpm version for kernel packages in the image. It must be present if -k flag is specified in the command for SLES. +Use this flag to specify the rpm version for kernel packages in the image. It must be present if -k flag is specified in the command for SLES. Generally, the value of -g is the part after B and before B<.rpm> in a kernel rpm name. =item B<-m> statelite diff --git a/xCAT-server/lib/xcat/plugins/genimage.pm b/xCAT-server/lib/xcat/plugins/genimage.pm index 9108dec90..e2e3bb08a 100644 --- a/xCAT-server/lib/xcat/plugins/genimage.pm +++ b/xCAT-server/lib/xcat/plugins/genimage.pm @@ -270,14 +270,6 @@ sub process_request { return 1; } - if ($krpmver) { - if ($osfamily ne "sles") { - $krpmver=""; - $callback->({error=>["-g flag is valid for Sles only."],errorcode=>[1]}); - return 1; - } - } - my $cmd="cd $profDir; ./genimage"; if ($arch) { $cmd .= " -a $arch";} if ($osver) { $cmd .= " -o $osver";} diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 6b75afe34..a4c232542 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -48,6 +48,7 @@ my $tmplimit; my $installroot = "/install"; my $kerneldir; my $kernelver = ""; #`uname -r`; +my $krpmver; my $basekernelver; # = $kernelver; my $customdir=$fullpath; $customdir =~ s/.*share\/xcat/$installroot\/custom/; @@ -80,6 +81,7 @@ GetOptions( 'l=s' => \$rootlimit, 't=s' => \$tmplimit, 'k=s' => \$kernelver, + 'g=s' => \$krpmver, 'permission=s' => \$permission, 'kerneldir=s' => \$kerneldir, 'tempfile=s' =>\$tempfile, #internal flag @@ -266,16 +268,19 @@ unless ($onlyinitrd) { # replace the kernel package with the name has the specific version foreach my $p (@$pa) { if ($p =~ /^kernel$/ && $kernelver) { - my $kernelname = "kernel-".$kernelver; + my $kernelname; + if ($krpmver) { + $kernelname = "kernel-".$krpmver; + } else { + $kernelname = "kernel-".$kernelver; + } my $searchkern = $yumcmd . " list $kernelname -q"; my @kernpkgs = `$searchkern`; my $found = 0; foreach my $k (@kernpkgs) { if ($k =~ /\s*kernel[^\s]*\s+([\w\.-]+)/) { my $version = $1; - my $relversion = $kernelver; - $relversion =~ s/\.[^\.]+$//; - if ($version == $relversion) { + if ($kernelver =~ /$version/) { $found++; } } From 9b89fdcc0761030219fdd00611fd8e3a24c9f949 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 24 Oct 2013 08:58:21 -0400 Subject: [PATCH 08/12] defect 3588: For rpower reset on kvm, in the case persistkvmguests is enabled, check the domain is inactive before resetting the domain --- xCAT-server/lib/xcat/plugins/kvm.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 5679815d6..8c68dd488 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -2348,7 +2348,7 @@ sub power { $dom->shutdown(); } else { $retstring .= "$status_noop"; } } elsif ($subcommand eq 'reset') { - if ($dom) { + if ($dom && $dom->is_active()) { my $oldxml=$dom->get_xml_description(); my $newxml=reconfigvm($node,$oldxml); #This *was* to be clever, but libvirt doesn't even frontend the capability, great... From ffe7ccbf3bdc03339e9d6774f588aed268c07b78 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Thu, 24 Oct 2013 02:09:20 -0700 Subject: [PATCH 09/12] fix bug 3820: rinv for feihu FPC is producing errors --- xCAT-server/lib/xcat/plugins/ipmi.pm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 30d849551..f40ef3c27 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2911,8 +2911,10 @@ sub parsefru { return "unknown-COULDGUESS",undef; #be lazy for now, TODO revisit this and add guessing if it ever matters } $currsize=($bytes->[$curridx+1])*8; - @currarea=@{$bytes}[$curridx..($curridx+$currsize-1)]; #splice @$bytes,$curridx,$currsize; - $fruhash->{chassis} = parsechassis(@currarea); + if ($currsize > 0) { + @currarea=@{$bytes}[$curridx..($curridx+$currsize-1)]; #splice @$bytes,$curridx,$currsize; + $fruhash->{chassis} = parsechassis(@currarea); + } } if ($bytes->[3]) { #Board info area, to be preserved $curridx=$bytes->[3]*8; @@ -2920,8 +2922,10 @@ sub parsefru { return "unknown-COULDGUESS",undef; } $currsize=($bytes->[$curridx+1])*8; - @currarea=@{$bytes}[$curridx..($curridx+$currsize-1)]; - $fruhash->{board} = parseboard(@currarea); + if ($currsize > 0) { + @currarea=@{$bytes}[$curridx..($curridx+$currsize-1)]; + $fruhash->{board} = parseboard(@currarea); + } } if (ref $global_sessdata->{currmacs}) { $fruhash->{board}->{macaddrs}=[]; @@ -2938,8 +2942,10 @@ sub parsefru { return "unknown-COULDGUESS",undef; } $currsize=($bytes->[$curridx+1])*8; - @currarea=@{$bytes}[$curridx..($curridx+$currsize-1)]; - $fruhash->{product} = parseprod(@currarea); + if ($currsize > 0) { + @currarea=@{$bytes}[$curridx..($curridx+$currsize-1)]; + $fruhash->{product} = parseprod(@currarea); + } } if ($bytes->[5]) { #Generic multirecord present.. $fruhash->{extra}=[]; From 14331df1961f611f90c8a9fbcf1ffd2777bd086b Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 24 Oct 2013 06:45:23 -0400 Subject: [PATCH 10/12] defect 3851, further enhancements --- perl-xCAT/xCAT/DSHCLI.pm | 19 ++++++++++--------- xCAT-server/sbin/xcatconfig | 32 +++++++++++++------------------- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 73d1a9232..9b09140c5 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -3240,11 +3240,14 @@ sub bld_resolve_nodes_hash # find out the names for the Management Node my @MNnodeinfo = xCAT::NetworkUtils->determinehostname; my $mname = pop @MNnodeinfo; # hostname - #my $rsp = {}; - #$rsp->{info}->[0] = - # "Management node name is $mname."; - # xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); - + my $cmd="hostname"; + my $localhostname = xCAT::Utils->runcmd($cmd,0); + if ($::RUNCMD_RC != 0) + { + my $rsp = {}; + $rsp->{info}->[0] = "Command: $cmd failed. Continuing..."; + xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); + } foreach my $target (@target_list) { @@ -3253,11 +3256,9 @@ sub bld_resolve_nodes_hash my $localhost; my $user; my $context = "XCAT"; - # check to see if this node is the Management Node - if ($mname) { - if ($mname eq $target) { + # check to see if this node is the Management Node we are on, can run local commands (sh,cp) + if (($mname eq $target) || ($localhostname eq $target)){ $localhost=$target; - } } my %properties = ( 'hostname' => $hostname, diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index f9d0b428a..3106f2b90 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -2107,8 +2107,8 @@ sub cleanupPSTable =head3 setupMNinDB - Will add/replace the management node to the noderes table with group=__mgmtnode - Will add/replace the management node to the servicenode tble with group=__mgmtnode + Will add the management node to the noderes table with group=__mgmtnode + Will add the management node to the servicenode tble with group=__mgmtnode =cut @@ -2126,25 +2126,18 @@ sub setupMNinDB my $cmds="XCATBYPASS=Y $::XCATROOT/sbin/tabdump nodelist | grep __mgmtnode"; my @output = xCAT::Utils->runcmd("$cmds", -1); - if ($::RUNCMD_RC == 0) # found a management node defined + if ($::RUNCMD_RC == 0) # found nodes in __mgmtnode { my $chtabcmds; - my @mn = split(",", $output[0]); - $mn[0] =~ s/"//g; # remove the quotes - if ($mn[0] ne $mnname) { # does not match current host name,delete it - my $size=@output; # if more than one management node defined, do not remove any - if ($size == 1) { - $chtabcmds = "$::XCATROOT/sbin/chtab -d node=$mn[0] nodelist;"; - my $outref = xCAT::Utils->runcmd("$chtabcmds", 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message('E', "Could not run $chtabcmds."); - return; - } - } - } else { # it is defined and good - xCAT::MsgUtils->message('I', "$mnname already defined in the nodelist table."); + # Look through the MN list and see if this MN is defined + foreach my $line (@output) { + my @mn = split(",", $line); + $mn[0]=~ s/"//g; # remove the quotes + if ($mn[0] eq $mnname) { # already in the database + verbose("$mnname already defined in the the nodelist table."); $defined=1; + last; + } } } # now add with the new name , if not already there @@ -2199,9 +2192,10 @@ sub setupMNinDB } } else { # it was already defined in the servicenode table - xCAT::MsgUtils->message('I', "$mnname was already defined in the servicenode table."); + verbose("$mnname already defined in the the servicenode table."); } + xCAT::MsgUtils->message('I', "Management Node defined in the database."); return; } #----------------------------------------------------------------------------- From bb5c8469c7a359d98df8b001069cb62844cba0e5 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 24 Oct 2013 10:41:48 -0400 Subject: [PATCH 11/12] defect 3789: fixed the issue that xcatdebug command kill the xcatd ssl listening process. The fix is that just remove the handling debug message from plugin modules since xcatd loads plugin modules for each command run, don't need xcatdebug for plugin any more. --- xCAT-server/sbin/xcatd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 20d272850..9b271a3e2 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -2177,7 +2177,7 @@ sub enable_callingtrace{ my @xcatdfuncs = (); # function list that will be enabled for xcatd # call the subroutine scan_plugins to fill the symbol table - scan_plugins(); + #scan_plugins(); # Backup the trace log my ($sec,$min,$hour,$mday,$mon,$year) = localtime(); From 713c85179f24becbb720400dac1fa8c2cc27a162 Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 24 Oct 2013 07:15:58 -0400 Subject: [PATCH 12/12] defect 3851, further enhancements --- perl-xCAT/xCAT/Utils.pm | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 30fda8d1e..8c58dfa2e 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3151,26 +3151,30 @@ sub noderangecontainsMn { my ($class, @noderange)=@_; # check if any node in the noderange is the Management Node return the - # name - my $mname; + # name + my @mnames; # management node names in the database, members of __mgmtnode my $tab = xCAT::Table->new('nodelist'); my @nodelist=$tab->getAllNodeAttribs(['node','groups']); foreach my $n (@nodelist) { if (defined($n->{'groups'})) { my @groups=split(",",$n->{'groups'}); if ((grep (/__mgmtnode/,@groups))) { # this is the MN - $mname=$n->{'node'}; - last; + push @mnames,$n->{'node'}; } } } - if ($mname) { # if Management Node defined in the database - if (grep(/^$mname$/, @noderange)) { # if MN in the noderange - return $mname; - } else { - return ; + my @MNs; # management node names found the noderange + if (@mnames) { # if any Management Node defined in the database + foreach my $mn (@mnames) { + if (grep(/^$mn$/, @noderange)) { # if MN in the noderange + push @MNs, $mn; + } + } + if (@MNs) { # management nodes in the noderange + return @MNs; } } + return; # if no MN in the noderange, return nothing } =head3 filter_nodes